Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] Enable LFS by default on 32-bit #338

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions arch/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,10 @@ config ARCH_THREAD_STACK_ALLOCATOR
config ARCH_WANTS_DYNAMIC_TASK_STRUCT
bool

config ARCH_32BIT_OFF_T
bool
depends on !64BIT

config HAVE_REGS_AND_STACK_ACCESS_API
bool
help
Expand Down
1 change: 1 addition & 0 deletions arch/arc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ config ARC
select ARC_TIMERS
select ARCH_HAS_SG_CHAIN
select ARCH_SUPPORTS_ATOMIC_RMW if ARC_HAS_LLSC
select ARCH_32BIT_OFF_T
select BUILDTIME_EXTABLE_SORT
select CLONE_BACKWARDS
select COMMON_CLK
Expand Down
1 change: 1 addition & 0 deletions arch/arm/Kconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
config ARM
bool
default y
select ARCH_32BIT_OFF_T
select ARCH_CLOCKSOURCE_DATA
select ARCH_HAS_DEVMEM_IS_ALLOWED
select ARCH_HAS_ELF_RANDOMIZE
Expand Down
1 change: 1 addition & 0 deletions arch/blackfin/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ config RWSEM_XCHGADD_ALGORITHM

config BLACKFIN
def_bool y
select ARCH_32BIT_OFF_T
select HAVE_ARCH_KGDB
select HAVE_ARCH_TRACEHOOK
select HAVE_DYNAMIC_FTRACE
Expand Down
1 change: 1 addition & 0 deletions arch/cris/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ config LOCKDEP_SUPPORT
config CRIS
bool
default y
select ARCH_32BIT_OFF_T
select HAVE_IDE
select GENERIC_ATOMIC64
select HAVE_UID16
Expand Down
1 change: 1 addition & 0 deletions arch/frv/Kconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
config FRV
bool
default y
select ARCH_32BIT_OFF_T
select HAVE_IDE
select HAVE_ARCH_TRACEHOOK
select HAVE_PERF_EVENTS
Expand Down
1 change: 1 addition & 0 deletions arch/h8300/Kconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
config H8300
def_bool y
select ARCH_32BIT_OFF_T
select GENERIC_ATOMIC64
select HAVE_UID16
select VIRT_TO_BUS
Expand Down
1 change: 1 addition & 0 deletions arch/hexagon/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ comment "Linux Kernel Configuration for Hexagon"

config HEXAGON
def_bool y
select ARCH_32BIT_OFF_T
select HAVE_OPROFILE
# Other pending projects/to-do items.
# select HAVE_REGS_AND_STACK_ACCESS_API
Expand Down
1 change: 1 addition & 0 deletions arch/m32r/Kconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
config M32R
bool
default y
select ARCH_32BIT_OFF_T
select HAVE_IDE
select HAVE_OPROFILE
select INIT_ALL_POSSIBLE
Expand Down
1 change: 1 addition & 0 deletions arch/m68k/Kconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
config M68K
bool
default y
select ARCH_32BIT_OFF_T
select ARCH_MIGHT_HAVE_PC_PARPORT if ISA
select HAVE_IDE
select HAVE_AOUT if MMU
Expand Down
1 change: 1 addition & 0 deletions arch/metag/Kconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
config METAG
def_bool y
select ARCH_32BIT_OFF_T
select EMBEDDED
select GENERIC_ATOMIC64
select GENERIC_CLOCKEVENTS
Expand Down
1 change: 1 addition & 0 deletions arch/microblaze/Kconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
config MICROBLAZE
def_bool y
select ARCH_32BIT_OFF_T
select ARCH_HAS_GCOV_PROFILE_ALL
select ARCH_MIGHT_HAVE_PC_PARPORT
select ARCH_WANT_IPC_PARSE_VERSION
Expand Down
1 change: 1 addition & 0 deletions arch/mips/Kconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
config MIPS
bool
default y
select ARCH_32BIT_OFF_T if !64BIT
select ARCH_SUPPORTS_UPROBES
select ARCH_MIGHT_HAVE_PC_PARPORT
select ARCH_MIGHT_HAVE_PC_SERIO
Expand Down
1 change: 1 addition & 0 deletions arch/mn10300/Kconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
config MN10300
def_bool y
select ARCH_32BIT_OFF_T
select HAVE_EXIT_THREAD
select HAVE_OPROFILE
select HAVE_UID16
Expand Down
1 change: 1 addition & 0 deletions arch/nios2/Kconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
config NIOS2
def_bool y
select ARCH_32BIT_OFF_T
select CLKSRC_OF
select GENERIC_ATOMIC64
select GENERIC_CLOCKEVENTS
Expand Down
1 change: 1 addition & 0 deletions arch/openrisc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

config OPENRISC
def_bool y
select ARCH_32BIT_OFF_T
select OF
select OF_EARLY_FLATTREE
select IRQ_DOMAIN
Expand Down
1 change: 1 addition & 0 deletions arch/parisc/Kconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
config PARISC
def_bool y
select ARCH_32BIT_OFF_T if !64BIT
select ARCH_MIGHT_HAVE_PC_PARPORT
select HAVE_IDE
select HAVE_OPROFILE
Expand Down
1 change: 1 addition & 0 deletions arch/powerpc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ config ARCH_HAS_DMA_SET_COHERENT_MASK
config PPC
bool
default y
select ARCH_32BIT_OFF_T if PPC32
select BUILDTIME_EXTABLE_SORT
select ARCH_MIGHT_HAVE_PC_PARPORT
select ARCH_MIGHT_HAVE_PC_SERIO
Expand Down
1 change: 1 addition & 0 deletions arch/score/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ menu "Machine selection"

config SCORE
def_bool y
select ARCH_32BIT_OFF_T
select GENERIC_IRQ_SHOW
select GENERIC_IOMAP
select GENERIC_ATOMIC64
Expand Down
1 change: 1 addition & 0 deletions arch/sh/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ config SUPERH

config SUPERH32
def_bool ARCH = "sh"
select ARCH_32BIT_OFF_T
select HAVE_KPROBES
select HAVE_KRETPROBES
select HAVE_IOREMAP_PROT if MMU && !X2TLB
Expand Down
1 change: 1 addition & 0 deletions arch/sparc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ config SPARC

config SPARC32
def_bool !64BIT
select ARCH_32BIT_OFF_T
select GENERIC_ATOMIC64
select CLZ_TAB
select HAVE_UID16
Expand Down
1 change: 1 addition & 0 deletions arch/tile/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

config TILE
def_bool y
select ARCH_32BIT_OFF_T if !64BIT
select ARCH_HAS_DEVMEM_IS_ALLOWED
select ARCH_HAVE_NMI_SAFE_CMPXCHG
select ARCH_WANT_FRAME_POINTERS
Expand Down
1 change: 1 addition & 0 deletions arch/unicore32/Kconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
config UNICORE32
def_bool y
select ARCH_32BIT_OFF_T
select ARCH_HAS_DEVMEM_IS_ALLOWED
select ARCH_MIGHT_HAVE_PC_PARPORT
select ARCH_MIGHT_HAVE_PC_SERIO
Expand Down
1 change: 1 addition & 0 deletions arch/x86/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ config X86
select ACPI_LEGACY_TABLES_LOOKUP if ACPI
select ACPI_SYSTEM_POWER_STATES_SUPPORT if ACPI
select ANON_INODES
select ARCH_32BIT_OFF_T if X86_32
select ARCH_CLOCKSOURCE_DATA
select ARCH_DISCARD_MEMBLOCK
select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI
Expand Down
1 change: 1 addition & 0 deletions arch/x86/um/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ config 64BIT
config X86_32
def_bool !64BIT
select HAVE_AOUT
select ARCH_32BIT_OFF_T
select ARCH_WANT_IPC_PARSE_VERSION
select MODULES_USE_ELF_REL
select CLONE_BACKWARDS
Expand Down
1 change: 1 addition & 0 deletions arch/xtensa/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ config ZONE_DMA

config XTENSA
def_bool y
select ARCH_32BIT_OFF_T
select ARCH_WANT_FRAME_POINTERS
select ARCH_WANT_IPC_PARSE_VERSION
select BUILDTIME_EXTABLE_SORT
Expand Down
2 changes: 1 addition & 1 deletion include/linux/fcntl.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


#ifndef force_o_largefile
#define force_o_largefile() (BITS_PER_LONG != 32)
#define force_o_largefile() (!IS_ENABLED(CONFIG_ARCH_32BIT_OFF_T))
#endif

#if BITS_PER_LONG == 32
Expand Down
33 changes: 33 additions & 0 deletions tools/lkl/tests/boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,38 @@ int test_fstat(char *str, int len)
return TEST_FAILURE;
}

int test_lfs(char *str, int len)
{
long long fd;
long long ret;
int result = TEST_FAILURE;

ret = lkl_sys_open("/largefile", LKL_O_CREAT | LKL_O_WRONLY, 0);
if (ret < 0) {
snprintf(str, len, "open: %s", lkl_strerror(ret));
return TEST_FAILURE;
}
fd = ret;

lkl_loff_t nearly_3gb = (3 * 1024LL * 1024 * 1024 * 1024) - 1;

ret = lkl_sys_pwrite64(fd, "x", 1, nearly_3gb);
if (ret < 0) {
snprintf(str, len, "pwrite: %s", lkl_strerror(ret));
goto out;
}
snprintf(str, len, "%lld", ret);
result = TEST_SUCCESS;

out:
ret = lkl_sys_close(fd);
if (ret < 0) {
snprintf(str, len, "close: %s", lkl_strerror(ret));
result = TEST_FAILURE;
}
return result;
}

int test_mkdir(char *str, int len)
{
long ret;
Expand Down Expand Up @@ -932,6 +964,7 @@ int main(int argc, char **argv)
TEST(lseek);
TEST(read);
TEST(fstat);
TEST(lfs);
TEST(mkdir);
TEST(stat);
#ifndef __MINGW32__
Expand Down