|
From: Andrea A. <an...@su...> - 2000-12-18 15:20:19
|
Dump is currently not able to work with largefiles (this is not a LFS news
because 64bit archs in 2.2.x can generate largefiles just now).
This patch makes dump to work with largefiles. Since I work only on purerly
userspace and kernel LFS systems I didn't cared to make it dynamic with an
autoconf check in LFS, but it should be easy to add for you.
This is the patch against dump CVS:
Index: dump//compat/include/bsdcompat.h
===================================================================
RCS file: /cvsroot/dump/dump/compat/include/bsdcompat.h,v
retrieving revision 1.12
diff -u -r1.12 bsdcompat.h
--- dump//compat/include/bsdcompat.h 2000/12/04 15:43:16 1.12
+++ dump//compat/include/bsdcompat.h 2000/12/18 02:35:11
@@ -102,6 +102,7 @@
#define di_rdev di_db[0]
/* #define di_ouid di_uid */
/* #define di_ogid di_gid */
+#define di_size_high di_dir_acl
/*
* This is the ext2_dir_entry structure but the fields have been renamed
Index: dump//dump/traverse.c
===================================================================
RCS file: /cvsroot/dump/dump/dump/traverse.c,v
retrieving revision 1.24
diff -u -r1.24 traverse.c
--- dump//dump/traverse.c 2000/12/05 16:57:38 1.24
+++ dump//dump/traverse.c 2000/12/18 02:35:13
@@ -149,6 +149,7 @@
blockest(struct dinode const *dp)
{
long blkest, sizeest;
+ u_quad_t i_size;
/*
* dp->di_size is the size of the file in bytes.
@@ -164,19 +165,20 @@
* dump blocks (sizeest vs. blkest in the indirect block
* calculation).
*/
- blkest = howmany(dbtob(dp->di_blocks), TP_BSIZE);
- sizeest = howmany(dp->di_size, TP_BSIZE);
+ blkest = howmany((u_quad_t)dp->di_blocks*fs->blocksize, TP_BSIZE);
+ i_size = dp->di_size + ((u_quad_t) dp->di_size_high << 32);
+ sizeest = howmany(i_size, TP_BSIZE);
if (blkest > sizeest)
blkest = sizeest;
#ifdef __linux__
- if (dp->di_size > fs->blocksize * NDADDR) {
+ if (i_size > fs->blocksize * NDADDR) {
/* calculate the number of indirect blocks on the dump tape */
blkest +=
howmany(sizeest - NDADDR * fs->blocksize / TP_BSIZE,
NINDIR(sblock) * EXT2_FRAGS_PER_BLOCK(fs->super));
}
#else
- if (dp->di_size > sblock->fs_bsize * NDADDR) {
+ if (i_size > sblock->fs_bsize * NDADDR) {
/* calculate the number of indirect blocks on the dump tape */
blkest +=
howmany(sizeest - NDADDR * sblock->fs_bsize / TP_BSIZE,
@@ -715,7 +718,7 @@
void
dumpino(struct dinode *dp, ino_t ino)
{
- int cnt;
+ unsigned long cnt;
fsizeT size;
char buf[TP_BSIZE];
struct old_bsd_inode obi;
@@ -724,6 +727,7 @@
#else
int ind_level;
#endif
+ u_quad_t i_size = dp->di_size + ((u_quad_t) dp->di_size_high << 32);
if (newtape) {
newtape = 0;
@@ -735,7 +739,7 @@
obi.di_mode = dp->di_mode;
obi.di_uid = dp->di_uid;
obi.di_gid = dp->di_gid;
- obi.di_qsize.v = (u_quad_t)dp->di_size;
+ obi.di_qsize.v = i_size;
obi.di_atime = dp->di_atime;
obi.di_mtime = dp->di_mtime;
obi.di_ctime = dp->di_ctime;
@@ -744,7 +748,7 @@
obi.di_flags = dp->di_flags;
obi.di_gen = dp->di_gen;
memmove(&obi.di_db, &dp->di_db, (NDADDR + NIADDR) * sizeof(daddr_t));
- if (dp->di_file_acl || dp->di_dir_acl)
+ if (dp->di_file_acl)
warn("ACLs in inode #%ld won't be dumped", (long)ino);
memmove(&spcl.c_dinode, &obi, sizeof(obi));
#else /* __linux__ */
@@ -771,8 +775,8 @@
* Check for short symbolic link.
*/
#ifdef __linux__
- if (dp->di_size > 0 &&
- dp->di_size < EXT2_N_BLOCKS * sizeof (daddr_t)) {
+ if (i_size > 0 &&
+ i_size < EXT2_N_BLOCKS * sizeof (daddr_t)) {
spcl.c_addr[0] = 1;
spcl.c_count = 1;
writeheader(ino);
@@ -800,7 +804,7 @@
case S_IFDIR:
#endif
case S_IFREG:
- if (dp->di_size > 0)
+ if (i_size)
break;
/* fall through */
@@ -815,16 +819,16 @@
msg("Warning: undefined file type 0%o\n", dp->di_mode & IFMT);
return;
}
- if (dp->di_size > NDADDR * sblock->fs_bsize)
+ if (i_size > NDADDR * sblock->fs_bsize)
#ifdef __linux__
cnt = NDADDR * EXT2_FRAGS_PER_BLOCK(fs->super);
#else
cnt = NDADDR * sblock->fs_frag;
#endif
else
- cnt = howmany(dp->di_size, sblock->fs_fsize);
+ cnt = howmany(i_size, sblock->fs_fsize);
blksout(&dp->di_db[0], cnt, ino);
- if ((size = dp->di_size - NDADDR * sblock->fs_bsize) <= 0)
+ if ((quad_t) (size = i_size - NDADDR * sblock->fs_bsize) <= 0)
return;
#ifdef __linux__
bc.max = NINDIR(sblock) * EXT2_FRAGS_PER_BLOCK(fs->super);
@@ -953,7 +957,7 @@
obi.di_flags = dp->di_flags;
obi.di_gen = dp->di_gen;
memmove(&obi.di_db, &dp->di_db, (NDADDR + NIADDR) * sizeof(daddr_t));
- if (dp->di_file_acl || dp->di_dir_acl)
+ if (dp->di_file_acl)
warn("ACLs in inode #%ld won't be dumped", (long)ino);
memmove(&spcl.c_dinode, &obi, sizeof(obi));
#else /* __linux__ */
And this is the patch against e2fsprogs-1.19.
diff -urN e2fsprogs-1.19/lib/ext2fs/block.c e2fsprogs-1.19-lfs/lib/ext2fs/block.c
--- e2fsprogs-1.19/lib/ext2fs/block.c Thu May 18 15:20:33 2000
+++ e2fsprogs-1.19-lfs/lib/ext2fs/block.c Mon Dec 18 01:42:19 2000
@@ -468,7 +468,7 @@
xl.real_private = priv_data;
xl.func = func;
- return ext2fs_block_iterate2(fs, ino, BLOCK_FLAG_NO_LARGE | flags,
+ return ext2fs_block_iterate2(fs, ino, flags,
block_buf, xlate_func, &xl);
}
Both e2fsprogs and dump needs to be ./configured with:
--with-ccopts=-D_FILE_OFFSET_BITS=64
Then dump seems to be happy about largefiles... (it's not extremely well
tested though).
Comments are welcome.
Andrea
|