large files and filesystem support
PATCH 19/24 large files and filesystem support
Summary of this patch:
[19/24] large files and filesystem support
- This fixes what remains unmodified.
Signed-off-by Takashi Sato [email protected]
---
debugfs/logdump.c +1 -1
@@ -339,7 +339,7 @@ static void dump_journal(char *cmdname,journal_header_t *header;tid_t transaction; -unsigned int blocknr =0 ; +blk_t blocknr =0 ;/* First, check to see if there's an ext2 superblock header */ retval = read_journal_block(cmdname, source, 0,
e2fsck/e2fsck.h +1 -1
@@ -94,7 +94,7 @@ struct dir_info {*/ struct dx_dir_info {ext2_ino_t ino;/* Inode number */ -int numblocks;/* number of blocks */ +blk_t numblocks;/* number of blocks */ int hashversion;short depth;/* depth of tree */ struct dx_dirblock_info *dx_block;/* Array of size numblocks */
e2fsck/emptydir.c +4 -3
@@ -167,9 +167,10 @@ static int fix_directory(ext2_filsys fs,return 0 ;if (edi->freed_blocks) { - edi->inode.i_size -= edi->freed_blocks * fs->blocksize; - edi->inode.i_blocks -= edi->freed_blocks * - (fs->blocksize /i_blocks_base (fs, &edi->inode)); + edi->inode.i_size -= (unsigned long long )edi->freed_blocks * + fs->blocksize; + edi->inode.i_blocks -= (unsigned long long )edi->freed_blocks * + (fs->blocksize /i_blocks_base (fs, &edi->inode)); (void )ext2fs_write_inode (fs, db->ino, &edi->inode); }return 0 ;
e2fsck/extend.c +2 -2
@@ -57,7 +57,7 @@ int main(int argc, char **argv)perror (filename);exit (1 ); } - ret =lseek (fd, nblocks*blocksize,SEEK_SET ); + ret =ext2fs_llseek (fd, (off_t )nblocks*blocksize,SEEK_SET );if (ret <0 ) {perror ("lseek" );exit (1 );
@@ -67,7 +67,7 @@ int main(int argc, char **argv)perror ("read" );exit (1 ); } - ret =lseek (fd, nblocks*blocksize,SEEK_SET ); + ret =ext2fs_llseek (fd, (off_t )nblocks*blocksize,SEEK_SET );if (ret <0 ) {perror ("lseek #2" );exit (1 );
e2fsck/pass2.c +1 -1
@@ -97,7 +97,7 @@ void e2fsck_pass2(e2fsck_t ctx)struct check_dir_struct cd;struct dx_dir_info *dx_dir;struct dx_dirblock_info *dx_db, *dx_parent; -int b; +blk_t b;int i, depth;problem_t code;int bad_dir;
lib/ext2fs/bmap.c +2 -1
@@ -260,7 +260,8 @@ done:if (buf)ext2fs_free_mem (&buf);if ((retval ==0 ) && (blocks_alloc || inode_dirty)) { - inode->i_blocks += (blocks_alloc * fs->blocksize) /i_blocks_base (fs, inode); + inode->i_blocks += ((e2_blkcnt_t )blocks_alloc * + fs->blocksize) /i_blocks_base (fs, inode); retval =ext2fs_write_inode (fs, ino, inode); }return retval;
lib/ext2fs/ext2_io.h +1 -1
@@ -90,7 +90,7 @@ struct struct_io_manager {extern errcode_t io_channel_set_options (io_channel channel,const char *options);extern errcode_t io_channel_write_byte (io_channel channel, -unsigned long offset, +ext2_loff_t offset,int count,const void *data);/* unix_io.c */
lib/ext2fs/inode.c +2 -1
@@ -495,7 +495,8 @@ errcode_t ext2fs_get_next_inode(ext2_inoerrcode_t ext2fs_read_inode_full (ext2_filsys fs,ext2_ino_t ino,struct ext2_inode * inode,int bufsize) { -unsigned long group, block, block_nr, offset; +unsigned long group, offset; +e2_blkcnt_t block, block_nr;char *ptr;errcode_t retval;int clen, i, inodes_per_block, length;
lib/ext2fs/inode_io.c +6 -6
@@ -207,9 +207,9 @@ static errcode_t inode_read_blk(io_chann data = (struct inode_private_data *) channel->private_data;EXT2_CHECK_MAGIC (data,EXT2_ET_MAGIC_INODE_IO_CHANNEL ); -if ((retval =ext2fs_file_lseek (data->file, - block * channel->block_size, -EXT2_SEEK_SET ,0 ))) +if ((retval =ext2fs_file_llseek (data->file, + (unsigned long long )block * + channel->block_size,EXT2_SEEK_SET ,0 )))return retval; count = (count <0 ) ? -count : (count * channel->block_size);
@@ -227,9 +227,9 @@ static errcode_t inode_write_blk(io_chan data = (struct inode_private_data *) channel->private_data;EXT2_CHECK_MAGIC (data,EXT2_ET_MAGIC_INODE_IO_CHANNEL ); -if ((retval =ext2fs_file_lseek (data->file, - block * channel->block_size, -EXT2_SEEK_SET ,0 ))) +if ((retval =ext2fs_file_llseek (data->file, + (unsigned long long )block * + channel->block_size,EXT2_SEEK_SET ,0 )))return retval; count = (count <0 ) ? -count : (count * channel->block_size);
lib/ext2fs/io_manager.c +1 -1
@@ -56,7 +56,7 @@ errcode_t io_channel_set_options(io_chanreturn retval; } -errcode_t io_channel_write_byte (io_channel channel,unsigned long offset, +errcode_t io_channel_write_byte (io_channel channel,ext2_loff_t offset,int count,const void *data) {EXT2_CHECK_MAGIC (channel,EXT2_ET_MAGIC_IO_CHANNEL );
lib/ext2fs/tst_getsectsize.c +2 -2
@@ -27,8 +27,8 @@int main (int argc,char **argv) { -int sectsize; -int retval; +unsigned sectsize; +int retval;if (argc <2 ) {fprintf (stderr,"Usage: %s device\n" , argv[0 ]);
lib/ext2fs/tst_getsize.c +1 -1
@@ -39,6 +39,6 @@ int main(int argc, const char *argv[])com_err (argv[0 ], retval,"while getting device size" );exit (1 ); } -printf ("%s is device has %d blocks.\n" , argv[1 ], blocks); +printf ("%s is device has %u blocks.\n" , argv[1 ], blocks);return 0 ; }
misc/e2image.c +14 -11
@@ -63,8 +63,8 @@ static void write_header(int fd, structexit (1 ); } -if (lseek (fd,0 ,SEEK_SET ) <0 ) { -perror ("lseek while writing header" ); +if (ext2fs_llseek (fd,0 ,SEEK_SET ) <0 ) { +perror ("ext2fs_llseek while writing header" );exit (1 ); }memset (header_buf,0 , blocksize);
@@ -94,14 +94,14 @@ static void write_image_file(ext2_filsyswrite_header (fd,NULL , fs->blocksize);memset (&hdr,0 ,sizeof (struct ext2_image_hdr )); - hdr.offset_super =lseek (fd,0 ,SEEK_CUR ); + hdr.offset_super =ext2fs_llseek (fd,0 ,SEEK_CUR ); retval =ext2fs_image_super_write (fs, fd,0 );if (retval) {com_err (program_name, retval,_ ("while writing superblock" ));exit (1 ); } - hdr.offset_inode =lseek (fd,0 ,SEEK_CUR ); + hdr.offset_inode =ext2fs_llseek (fd,0 ,SEEK_CUR ); retval =ext2fs_image_inode_write (fs, fd, (fd !=1 ) ?IMAGER_FLAG_SPARSEWRITE :0 );if (retval) {
@@ -109,14 +109,14 @@ static void write_image_file(ext2_filsysexit (1 ); } - hdr.offset_blockmap =lseek (fd,0 ,SEEK_CUR ); + hdr.offset_blockmap =ext2fs_llseek (fd,0 ,SEEK_CUR ); retval =ext2fs_image_bitmap_write (fs, fd,0 );if (retval) {com_err (program_name, retval,_ ("while writing block bitmap" ));exit (1 ); } - hdr.offset_inodemap =lseek (fd,0 ,SEEK_CUR ); + hdr.offset_inodemap =ext2fs_llseek (fd,0 ,SEEK_CUR ); retval =ext2fs_image_bitmap_write (fs, fd,IMAGER_FLAG_INODEMAP );if (retval) {com_err (program_name, retval,_ ("while writing inode bitmap" ));
@@ -307,7 +307,7 @@ static int check_zero_block(char *buf, ireturn 1 ; } -static void write_block (int fd,char *buf,int sparse_offset, +static void write_block (int fd,char *buf,ext2_loff_t sparse_offset,int blocksize,blk_t block) {int count;
@@ -316,7 +316,7 @@ static void write_block(int fd, char *buif (sparse_offset) {#ifdef HAVE_LSEEK64 if (lseek64 (fd, sparse_offset,SEEK_CUR ) <0 ) -perror ("lseek" ); +perror ("lseek64" );#else if (lseek (fd, sparse_offset,SEEK_CUR ) <0 )perror ("lseek" );
@@ -575,8 +575,11 @@ static void install_image(char *device,exit (1 ); } - +#ifdef HAVE_OPEN64 + fd =open64 (image_fn,O_RDONLY ); +#else fd =open (image_fn,O_RDONLY ); +#endif if (fd <0 ) {perror (image_fn);exit (1 );
@@ -592,8 +595,8 @@ static void install_image(char *device,ext2fs_rewrite_to_io (fs, io); -if (lseek (fd, fs->image_header->offset_inode,SEEK_SET ) <0 ) { -perror ("lseek" ); +if (ext2fs_llseek (fd, fs->image_header->offset_inode,SEEK_SET ) <0 ) { +perror ("lseek64" );exit (1 ); }
misc/filefrag.c +3 -1
@@ -38,6 +38,7 @@ extern int optind;#include <sys/vfs.h> #include <sys/ioctl.h> #include <linux/fd.h> +#include <ext2fs/ext2fs.h> int verbose =0 ;
@@ -96,7 +97,8 @@ static void frag_report(const char *fileif (verbose) {printf ("Filesystem type is: %x\n" , fsinfo.f_type); } - cylgroups = (fsinfo.f_blocks + fsinfo.f_bsize*8 -1 ) / fsinfo.f_bsize*8 ; + cylgroups = ((long long )fsinfo.f_blocks + fsinfo.f_bsize*8 -1 ) / + fsinfo.f_bsize*8 ;if (verbose) {printf ("Filesystem cylinder groups is approximately %ld\n" , cylgroups);