Skip to contentSkip to conversation

Large file support (LFS) for can-utils

RFC PATCH In review Oliver Hartkopp 2 participants 3 messages Feb 21, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 Large file support (LFS) for can-utils

Hi Uwe,

yesterday I tried to create a really big CAN logfile with

candump -l any

logging 9 CAN interfaces.

But unfortunately the length of the log file on my 32 bit i686 machine was limited to 2147483647 == 0x7FFFFFFF == int32 max ...

I did some investigation and there's some kind of large file support (LFS) in recent gnu libraries that allow 32 bit applications to create large files with file length values > 0x7FFFFFFF when the filesystem supports it.

When applying the patch below my candump was able to create a large log file.

Alternatively

candump -L any > filename

did the job too as obviously 'cat' has large file support ;-)

What do you think about LFS?
Would this be the correct way to add the LFS support?

Regards,
Oliver

Not-really-signed-off-by Oliver Hartkopp <[email protected]>

---

Makefile +1 -0
index ab99746..a926177 100644
@@ -45,6 +45,7 @@ MAKEFLAGS = -k
 
 CFLAGS    = -O2 -Wall -Wno-parentheses -Iinclude \
 	    -fno-strict-aliasing \
+	    -D_FILE_OFFSET_BITS=64 \
 	    -DSO_RXQ_OVFL=40 \
 	    -DPF_CAN=29 \
 	    -DAF_CAN=PF_CAN
#1 lore raw

Here's some more documentation about LFS:

http://www.gnupg.org/documentation/manuals/gpgme/Largefile-Support-_0028LFS_0029.html

There's also a autoconf macro AC_SYS_LARGEFILE

Regards,
Oliver

Quoted 46 lines · Oliver Hartkopp

Hi Uwe,

yesterday I tried to create a really big CAN logfile with

candump -l any

logging 9 CAN interfaces.

But unfortunately the length of the log file on my 32 bit i686 machine was limited to 2147483647 == 0x7FFFFFFF == int32 max ...

I did some investigation and there's some kind of large file support (LFS) in recent gnu libraries that allow 32 bit applications to create large files with file length values > 0x7FFFFFFF when the filesystem supports it.

When applying the patch below my candump was able to create a large log file.

Alternatively

candump -L any > filename

did the job too as obviously 'cat' has large file support ;-)

What do you think about LFS?
Would this be the correct way to add the LFS support?

Regards,
Oliver

Not-really-signed-off-by Oliver Hartkopp <[email protected]>

---

Makefile +1 -0
index ab99746..a926177 100644
@@ -45,6 +45,7 @@ MAKEFLAGS = -k
 
 CFLAGS    = -O2 -Wall -Wno-parentheses -Iinclude \
 	    -fno-strict-aliasing \
+	    -D_FILE_OFFSET_BITS=64 \
 	    -DSO_RXQ_OVFL=40 \
 	    -DPF_CAN=29 \
 	    -DAF_CAN=PF_CAN
#2 lore raw
In reply to Oliver Hartkopp

Hello Oliver,

Quoted 13 lines · Oliver Hartkopp

yesterday I tried to create a really big CAN logfile with

candump -l any

logging 9 CAN interfaces.

But unfortunately the length of the log file on my 32 bit i686 machine was limited to 2147483647 == 0x7FFFFFFF == int32 max ...

I did some investigation and there's some kind of large file support (LFS) in recent gnu libraries that allow 32 bit applications to create large files with file length values > 0x7FFFFFFF when the filesystem supports it.

Quoted 7 lines

When applying the patch below my candump was able to create a large log file.

Alternatively

candump -L any > filename

did the job too as obviously 'cat' has large file support ;-)

<pedantic>
There is no cat involved, > is handled by your shell. </pedantic>
Doesn't really make a difference though.

Quoted 2 lines

What do you think about LFS?
Would this be the correct way to add the LFS support?

Maybe:

	CFLAGS += $(getconf LFS_CFLAGS)
	LDFLAGS += $(getconf LFS_LDFLAGS)

but on the other hand autoconf does it differently, they set

	_FILE_OFFSET_BITS=64

only if it's needed (assuming I understood that autoconf m4 stuff correctly). Also LDFLAGS are not handled at all by autoconf.

Makefile MAKEFLAGS = -k · line 51

Quoted 13 lines
Makefile +1 -0
index ab99746..a926177 100644
@@ -45,6 +45,7 @@ MAKEFLAGS = -k
 
 CFLAGS    = -O2 -Wall -Wno-parentheses -Iinclude \
 	    -fno-strict-aliasing \
+	    -D_FILE_OFFSET_BITS=64 \
 	    -DSO_RXQ_OVFL=40 \
 	    -DPF_CAN=29 \
 	    -DAF_CAN=PF_CAN

-DVAR=VAL should better go into CPPFLAGS.

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |