Just curious about the maximum file size. provided by some popular Linux file systems, I saw that some of them fit the TB scale.
My question is, if the file pointer is 32 bits wide, like most Linux that we meet today, does this mean that the maximum distance we can solve is 2 ^ 32-1 bytes? Then how can we save a file larger than 4 GB?
In addition, even if we can save such a file, how can we find a position outside the range of 2 ^ 32?
4 , " " (LFS) Linux. , LFS, , 64- . , Linux 32 64- (, x86 x86-64). . http://www.suse.de/~aj/linux_lfs.html
LFS glibc 2.2 kernel 2.4.0 ( 2000-2001), Linux .
Linux, (, lseek64 lseek) #define _FILE_OFFSET_BITS 64, 64 .
lseek64
lseek
#define _FILE_OFFSET_BITS 64
Linux, , (.. , kohlehydrat).
. , . , #define, , "" " ". 64 , .
#define
. FILE * C stdio - , , , , , . fseek(), , , long, fgetpos() fsetpos() fpos_t.
FILE *
fseek()
long
fgetpos()
fsetpos()
fpos_t
, off_t . , , , "Large File Support" (LFS), ABI off_t. ( API #define API.)
off_t
read(int fd, void *buf, size_t count);
( , "" .)
- - , (Inodes), (), . , .
lseek64 . Ext4 16 TiB.
UNIX , , 32- , 2,4 .
, 0x7fffffff .
ext2 . , . . Linux .
There are also some user space programs that cannot handle files larger than 2 GB .
The maximum file size is limited min( (b/4)3+(b/4)2+b/4+12, 232*b )due to i_block (an array of EXT2_N_BLOCKS)and i_blocks( 32-bits integer value )representing the number of bytes of bytes in the file.
min( (b/4)3+(b/4)2+b/4+12, 232*b )
i_block (an array of EXT2_N_BLOCKS)
i_blocks( 32-bits integer value )
Source: https://habr.com/ru/post/1790710/More articles:Reading a cache file previously written by the same application - androidMS Office Word 2007/2010 - how to view editing an existing SELECT inline merge? - sqlClojure - How do I check for prompt types in protocols? - clojureWinApp form loads too much data during a load event - c #Download a Windows form with over 200 controls - multithreadingScriptmanager RegisterStartupScript does not work with callbacks - c #onclick bind event button - javascriptAsyncTasks and thread safe data objects? - androidYoutube control video player using Javascript from FireFox add-on - javascriptWork with large arrays - OutOfRam - delphiAll Articles