Subject: kern/6032: Break out of on-disk from in-memory LFS superblock
To: None <gnats-bugs@gnats.netbsd.org, perseant@hhhh.org>
From: None <perseant@hhhh.org>
List: netbsd-bugs
Date: 08/24/1998 17:54:12
>Number: 6032
>Category: kern
>Synopsis: sizeof(struct lfs) is machine-dependent. This fixes that.
>Confidential: no
>Severity: serious
>Priority: low
>Responsible: kern-bug-people (Kernel Bug People)
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Mon Aug 24 18:05:01 1998
>Last-Modified:
>Originator: Konrad Schroder
>Organization:
-------------------------------------------------------------------------
Konrad Schroder http://www.hitl.washington.edu/people/perseant/
System Administrator perseant@hitl.washington.edu
Human Interface Technology Lab Voice: +1.206.616.1478
Box 352142, University of Washington, 98195, USA FAX: +1.206.543.5380
>Release: mid-August 1998
>Environment:
System: NetBSD danish 1.3G NetBSD 1.3G (LFS) #2: Mon Aug 24 11:50:52 PDT 1998 perseant@ftp:/usr/src/sys/arch/i386/compile/LFS sparc
>Description:
Basically, the presence of pointers and badly aligned non-pointer
types in struct lfs makes it unsuitable for writing to disk directly
(cf. PR# 1351, and CGD's response). The enclosed patch fixes this
by breaking out the dynamic data (incl. segment summary pointers, etc.)
and rearranging certain of the other fields in the on-disk structure
so that they are aligned properly without padding on non-i386
platforms.
Diffs are smaller than one might expect. :^)
This should take care of PR #s 1351, 4641, and 5121.
>How-To-Repeat:
Compile newlfs(8) on the sparc, and watch it fail.
(Repeat of PR # 5121).
>Fix:
*** sys/ufs/lfs.dist/lfs.h Sun Mar 1 04:22:48 1998
--- sys/ufs/lfs.dlfs/lfs.h Sun Aug 23 12:49:01 1998
***************
*** 83,150 ****
};
! /* On-disk and in-memory super block. */
! struct lfs {
#define LFS_MAGIC 0x070162
! u_int32_t lfs_magic; /* magic number */
#define LFS_VERSION 1
! u_int32_t lfs_version; /* version number */
! u_int32_t lfs_size; /* number of blocks in fs */
! u_int32_t lfs_ssize; /* number of blocks per segment */
! u_int32_t lfs_dsize; /* number of disk blocks in fs */
! u_int32_t lfs_bsize; /* file system block size */
! u_int32_t lfs_fsize; /* size of frag blocks in fs */
! u_int32_t lfs_frag; /* number of frags in a block in fs */
/* Checkpoint region. */
! ino_t lfs_free; /* start of the free list */
! u_int32_t lfs_bfree; /* number of free disk blocks */
! u_int32_t lfs_nfiles; /* number of allocated inodes */
! int32_t lfs_avail; /* blocks available for writing */
! u_int32_t lfs_uinodes; /* inodes in cache not yet on disk */
! ufs_daddr_t lfs_idaddr; /* inode file disk address */
! ino_t lfs_ifile; /* inode file inode number */
! ufs_daddr_t lfs_lastseg; /* address of last segment written */
! ufs_daddr_t lfs_nextseg; /* address of next segment to write */
! ufs_daddr_t lfs_curseg; /* current segment being written */
! ufs_daddr_t lfs_offset; /* offset in curseg for next partial */
! ufs_daddr_t lfs_lastpseg; /* address of last partial written */
! u_int32_t lfs_tstamp; /* time stamp */
/* These are configuration parameters. */
! u_int32_t lfs_minfree; /* minimum percentage of free blocks */
/* These fields can be computed from the others. */
! u_int64_t lfs_maxfilesize; /* maximum representable file size */
! u_int32_t lfs_dbpseg; /* disk blocks per segment */
! u_int32_t lfs_inopb; /* inodes per block */
! u_int32_t lfs_ifpb; /* IFILE entries per block */
! u_int32_t lfs_sepb; /* SEGUSE entries per block */
! u_int32_t lfs_nindir; /* indirect pointers per block */
! u_int32_t lfs_nseg; /* number of segments */
! u_int32_t lfs_nspf; /* number of sectors per fragment */
! u_int32_t lfs_cleansz; /* cleaner info size in blocks */
! u_int32_t lfs_segtabsz; /* segment table size in blocks */
!
! u_int32_t lfs_segmask; /* calculate offset within a segment */
! u_int32_t lfs_segshift; /* fast mult/div for segments */
! u_int64_t lfs_bmask; /* calc block offset from file offset */
! u_int32_t lfs_bshift; /* calc block number from file offset */
! u_int64_t lfs_ffmask; /* calc frag offset from file offset */
! u_int32_t lfs_ffshift; /* fast mult/div for frag from file */
! u_int64_t lfs_fbmask; /* calc frag offset from block offset */
! u_int32_t lfs_fbshift; /* fast mult/div for frag from block */
! u_int32_t lfs_fsbtodb; /* fsbtodb and dbtofsb shift constant */
! u_int32_t lfs_sushift; /* fast mult/div for segusage table */
! int32_t lfs_maxsymlinklen; /* max length of an internal symlink */
#define LFS_MIN_SBINTERVAL 5 /* minimum superblock segment spacing */
! #define LFS_MAXNUMSB 10 /* superblock disk offsets */
! ufs_daddr_t lfs_sboffs[LFS_MAXNUMSB];
/* Checksum -- last valid disk field. */
! u_int32_t lfs_cksum; /* checksum for superblock checking */
/* These fields are set at mount time and are meaningless on disk. */
struct segment *lfs_sp; /* current segment being written */
--- 83,199 ----
};
! /* On-disk super block. */
! struct dlfs {
#define LFS_MAGIC 0x070162
! u_int32_t dlfs_magic; /* 0: magic number */
#define LFS_VERSION 1
! u_int32_t dlfs_version; /* 4: version number */
! u_int32_t dlfs_size; /* 8: number of blocks in fs */
! u_int32_t dlfs_ssize; /* 12: number of blocks per segment */
! u_int32_t dlfs_dsize; /* 16: number of disk blocks in fs */
! u_int32_t dlfs_bsize; /* 20: file system block size */
! u_int32_t dlfs_fsize; /* 24: size of frag blocks in fs */
! u_int32_t dlfs_frag; /* 28: number of frags in a block in fs */
/* Checkpoint region. */
! ino_t dlfs_free; /* 32: start of the free list */
! u_int32_t dlfs_bfree; /* 36: number of free disk blocks */
! u_int32_t dlfs_nfiles; /* 40: number of allocated inodes */
! int32_t dlfs_avail; /* 44: blocks available for writing */
! u_int32_t dlfs_uinodes; /* 48: inodes in cache not yet on disk */
! ufs_daddr_t dlfs_idaddr; /* 52: inode file disk address */
! ino_t dlfs_ifile; /* 56: inode file inode number */
! ufs_daddr_t dlfs_lastseg; /* 60: address of last segment written */
! ufs_daddr_t dlfs_nextseg; /* 64: address of next segment to write */
! ufs_daddr_t dlfs_curseg; /* 68: current segment being written */
! ufs_daddr_t dlfs_offset; /* 72: offset in curseg for next partial */
! ufs_daddr_t dlfs_lastpseg; /* 76: address of last partial written */
! u_int32_t dlfs_tstamp; /* 80: time stamp */
/* These are configuration parameters. */
! u_int32_t dlfs_minfree; /* 84: minimum percentage of free blocks */
/* These fields can be computed from the others. */
! u_int64_t dlfs_maxfilesize; /* 88: maximum representable file size */
! u_int32_t dlfs_dbpseg; /* 96: disk blocks per segment */
! u_int32_t dlfs_inopb; /* 100: inodes per block */
! u_int32_t dlfs_ifpb; /* 104: IFILE entries per block */
! u_int32_t dlfs_sepb; /* 108: SEGUSE entries per block */
! u_int32_t dlfs_nindir; /* 112: indirect pointers per block */
! u_int32_t dlfs_nseg; /* 116: number of segments */
! u_int32_t dlfs_nspf; /* 120: number of sectors per fragment */
! u_int32_t dlfs_cleansz; /* 124: cleaner info size in blocks */
! u_int32_t dlfs_segtabsz; /* 128: segment table size in blocks */
! u_int32_t dlfs_segmask; /* 132: calculate offset within a segment */
! u_int32_t dlfs_segshift; /* 136: fast mult/div for segments */
! u_int32_t dlfs_bshift; /* 140: calc block number from file offset */
! u_int32_t dlfs_ffshift; /* 144: fast mult/div for frag from file */
! u_int32_t dlfs_fbshift; /* 148: fast mult/div for frag from block */
! u_int64_t dlfs_bmask; /* 152: calc block offset from file offset */
! u_int64_t dlfs_ffmask; /* 160: calc frag offset from file offset */
! u_int64_t dlfs_fbmask; /* 168: calc frag offset from block offset */
! u_int32_t dlfs_fsbtodb; /* 176: fsbtodb and dbtofsb shift constant */
! u_int32_t dlfs_sushift; /* 180: fast mult/div for segusage table */
! int32_t dlfs_maxsymlinklen; /* 184: max length of an internal symlink */
#define LFS_MIN_SBINTERVAL 5 /* minimum superblock segment spacing */
! #define LFS_MAXNUMSB 10 /* 188: superblock disk offsets */
! ufs_daddr_t dlfs_sboffs[LFS_MAXNUMSB];
/* Checksum -- last valid disk field. */
! u_int32_t dlfs_cksum; /* 228: checksum for superblock checking */
! int32_t dlfs_pad[70]; /* 232: round to 512 bytes */
! };
+ /* In-memory super block. */
+ struct lfs {
+ struct dlfs lfs_dlfs; /* on-disk parameters */
+ #define lfs_magic lfs_dlfs.dlfs_magic
+ #define lfs_version lfs_dlfs.dlfs_version
+ #define lfs_size lfs_dlfs.dlfs_size
+ #define lfs_ssize lfs_dlfs.dlfs_ssize
+ #define lfs_dsize lfs_dlfs.dlfs_dsize
+ #define lfs_bsize lfs_dlfs.dlfs_bsize
+ #define lfs_fsize lfs_dlfs.dlfs_fsize
+ #define lfs_frag lfs_dlfs.dlfs_frag
+ #define lfs_free lfs_dlfs.dlfs_free
+ #define lfs_bfree lfs_dlfs.dlfs_bfree
+ #define lfs_nfiles lfs_dlfs.dlfs_nfiles
+ #define lfs_avail lfs_dlfs.dlfs_avail
+ #define lfs_uinodes lfs_dlfs.dlfs_uinodes
+ #define lfs_idaddr lfs_dlfs.dlfs_idaddr
+ #define lfs_ifile lfs_dlfs.dlfs_ifile
+ #define lfs_lastseg lfs_dlfs.dlfs_lastseg
+ #define lfs_nextseg lfs_dlfs.dlfs_nextseg
+ #define lfs_curseg lfs_dlfs.dlfs_curseg
+ #define lfs_offset lfs_dlfs.dlfs_offset
+ #define lfs_lastpseg lfs_dlfs.dlfs_lastpseg
+ #define lfs_tstamp lfs_dlfs.dlfs_tstamp
+ #define lfs_minfree lfs_dlfs.dlfs_minfree
+ #define lfs_maxfilesize lfs_dlfs.dlfs_maxfilesize
+ #define lfs_dbpseg lfs_dlfs.dlfs_dbpseg
+ #define lfs_inopb lfs_dlfs.dlfs_inopb
+ #define lfs_ifpb lfs_dlfs.dlfs_ifpb
+ #define lfs_sepb lfs_dlfs.dlfs_sepb
+ #define lfs_nindir lfs_dlfs.dlfs_nindir
+ #define lfs_nseg lfs_dlfs.dlfs_nseg
+ #define lfs_nspf lfs_dlfs.dlfs_nspf
+ #define lfs_cleansz lfs_dlfs.dlfs_cleansz
+ #define lfs_segtabsz lfs_dlfs.dlfs_segtabsz
+ #define lfs_segmask lfs_dlfs.dlfs_segmask
+ #define lfs_segshift lfs_dlfs.dlfs_segshift
+ #define lfs_bmask lfs_dlfs.dlfs_bmask
+ #define lfs_bshift lfs_dlfs.dlfs_bshift
+ #define lfs_ffmask lfs_dlfs.dlfs_ffmask
+ #define lfs_ffshift lfs_dlfs.dlfs_ffshift
+ #define lfs_fbmask lfs_dlfs.dlfs_fbmask
+ #define lfs_fbshift lfs_dlfs.dlfs_fbshift
+ #define lfs_fsbtodb lfs_dlfs.dlfs_fsbtodb
+ #define lfs_sushift lfs_dlfs.dlfs_sushift
+ #define lfs_maxsymlinklen lfs_dlfs.dlfs_maxsymlinklen
+ #define lfs_sboffs lfs_dlfs.dlfs_sboffs
+ #define lfs_cksum lfs_dlfs.dlfs_cksum
/* These fields are set at mount time and are meaningless on disk. */
struct segment *lfs_sp; /* current segment being written */
***************
*** 162,167 ****
int8_t lfs_flags; /* currently unused flag */
u_char lfs_fsmnt[MNAMELEN]; /* name mounted on */
-
- int32_t lfs_pad[40]; /* round to 512 bytes */
};
--- 211,214 ----
*** sys/ufs/lfs.dist/lfs_cksum.c Sun Mar 1 04:22:49 1998
--- sys/ufs/lfs.dlfs/lfs_cksum.c Sun Aug 23 12:54:39 1998
***************
*** 41,49 ****
--- 41,52 ----
#include <sys/systm.h>
#include <sys/lock.h>
+ #include <sys/mount.h>
#include <ufs/ufs/quota.h>
#include <ufs/ufs/inode.h>
+ #include <ufs/lfs/lfs.h>
#include <ufs/lfs/lfs_extern.h>
#else
u_long cksum __P((void *, size_t));
+ u_long cksum __P((struct dlfs *, size_t));
#endif
***************
*** 68,70 ****
--- 71,83 ----
}
return (sum);
+ }
+
+ u_long
+ lfs_sb_cksum(fs)
+ struct dlfs *fs;
+ {
+ size_t size;
+
+ size = sizeof(*fs) - sizeof(fs->dlfs_cksum) - sizeof(fs->dlfs_pad);
+ return cksum(fs,size);
}
*** sys/ufs/lfs.dist/lfs_segment.c Sat May 9 04:16:35 1998
--- sys/ufs/lfs.dlfs/lfs_segment.c Sun Aug 23 12:57:19 1998
***************
*** 974,981 ****
/* Checksum the superblock and copy it into a buffer. */
! fs->lfs_cksum = cksum(fs, sizeof(struct lfs) - sizeof(fs->lfs_cksum));
bp = lfs_newbuf(VTOI(fs->lfs_ivnode)->i_devvp, fs->lfs_sboffs[0],
LFS_SBPAD);
! *(struct lfs *)bp->b_data = *fs;
/* XXX Toggle between first two superblocks; for now just write first */
--- 974,981 ----
/* Checksum the superblock and copy it into a buffer. */
! fs->lfs_cksum = lfs_sb_cksum(&(fs->lfs_dlfs));
bp = lfs_newbuf(VTOI(fs->lfs_ivnode)->i_devvp, fs->lfs_sboffs[0],
LFS_SBPAD);
! *(struct lfs *)bp->b_data = fs->lfs_dlfs;
/* XXX Toggle between first two superblocks; for now just write first */
*** sys/ufs/lfs.dist/lfs_vfsops.c Thu Jun 25 04:25:14 1998
--- sys/ufs/lfs.dlfs/lfs_vfsops.c Sun Aug 23 13:01:24 1998
***************
*** 269,272 ****
--- 269,273 ----
{
extern struct vnode *rootvp;
+ struct dlfs *dfs;
register struct lfs *fs;
register struct ufsmount *ump;
***************
*** 317,325 ****
if (error)
goto out;
! fs = (struct lfs *)bp->b_data;
/* Check the basics. */
! if (fs->lfs_magic != LFS_MAGIC || fs->lfs_bsize > MAXBSIZE ||
! fs->lfs_bsize < sizeof(struct lfs)) {
error = EINVAL; /* XXX needs translation */
goto out;
--- 318,327 ----
if (error)
goto out;
!
! dfs = (struct dlfs *)bp->b_data;
/* Check the basics. */
! if (dfs->dlfs_magic != LFS_MAGIC || dfs->lfs_bsize > MAXBSIZE ||
! dfs->dlfs_bsize < sizeof(struct dlfs)) {
error = EINVAL; /* XXX needs translation */
goto out;
***************
*** 329,333 ****
ump = (struct ufsmount *)malloc(sizeof *ump, M_UFSMNT, M_WAITOK);
fs = ump->um_lfs = malloc(sizeof(struct lfs), M_UFSMNT, M_WAITOK);
! bcopy(bp->b_data, fs, sizeof(struct lfs));
if (sizeof(struct lfs) < LFS_SBPAD) /* XXX why? */
bp->b_flags |= B_INVAL;
--- 331,335 ----
ump = (struct ufsmount *)malloc(sizeof *ump, M_UFSMNT, M_WAITOK);
fs = ump->um_lfs = malloc(sizeof(struct lfs), M_UFSMNT, M_WAITOK);
! bcopy(bp->b_data, &(fs->lfs_dlfs), sizeof(struct dlfs));
if (sizeof(struct lfs) < LFS_SBPAD) /* XXX why? */
bp->b_flags |= B_INVAL;
*** sbin/newlfs.1.3F/extern.h Sun Mar 1 04:18:07 1998
--- sbin/newlfs.dlfs/extern.h Sun Aug 23 12:17:00 1998
***************
*** 36,39 ****
--- 36,42 ----
*/
+ struct dlfs;
+
+ u_long lfs_sb_cksum __P((struct dlfs *));
u_long cksum __P((void *, size_t));
u_short dkcksum __P((struct disklabel *));
*** sbin/newlfs.1.3F/lfs.c Thu Apr 2 04:17:46 1998
--- sbin/newlfs.dlfs/lfs.c Mon Aug 24 10:14:00 1998
***************
*** 95,143 ****
static struct lfs lfs_default = {
! /* lfs_magic */ LFS_MAGIC,
! /* lfs_version */ LFS_VERSION,
! /* lfs_size */ 0,
! /* lfs_ssize */ DFL_LFSSEG/DFL_LFSBLOCK,
! /* lfs_dsize */ 0,
! /* lfs_bsize */ DFL_LFSBLOCK,
! /* lfs_fsize */ DFL_LFSFRAG,
! /* lfs_frag */ 1,
! /* lfs_free */ LFS_FIRST_INUM,
! /* lfs_bfree */ 0,
! /* lfs_nfiles */ 0,
! /* lfs_avail */ 0,
! /* lfs_uinodes */ 0,
! /* lfs_idaddr */ 0,
! /* lfs_ifile */ LFS_IFILE_INUM,
! /* lfs_lastseg */ 0,
! /* lfs_nextseg */ 0,
! /* lfs_curseg */ 0,
! /* lfs_offset */ 0,
! /* lfs_lastpseg */ 0,
! /* lfs_tstamp */ 0,
! /* lfs_minfree */ MINFREE,
! /* lfs_maxfilesize */ 0,
! /* lfs_dbpseg */ DFL_LFSSEG/DEV_BSIZE,
! /* lfs_inopb */ DFL_LFSBLOCK/sizeof(struct dinode),
! /* lfs_ifpb */ DFL_LFSBLOCK/sizeof(IFILE),
! /* lfs_sepb */ DFL_LFSBLOCK/sizeof(SEGUSE),
! /* lfs_nindir */ DFL_LFSBLOCK/sizeof(daddr_t),
! /* lfs_nseg */ 0,
! /* lfs_nspf */ 0,
! /* lfs_cleansz */ 0,
! /* lfs_segtabsz */ 0,
! /* lfs_segmask */ DFL_LFSSEG_MASK,
! /* lfs_segshift */ DFL_LFSSEG_SHIFT,
! /* lfs_bmask */ DFL_LFSBLOCK_MASK,
! /* lfs_bshift */ DFL_LFSBLOCK_SHIFT,
! /* lfs_ffmask */ DFL_LFS_FFMASK,
! /* lfs_ffshift */ DFL_LFS_FFSHIFT,
! /* lfs_fbmask */ DFL_LFS_FBMASK,
! /* lfs_fbshift */ DFL_LFS_FBSHIFT,
! /* lfs_fsbtodb */ 0,
! /* lfs_sushift */ 0,
! /* lfs_maxsymlinklen */ MAXSYMLINKLEN,
! /* lfs_sboffs */ { 0 },
! /* lfs_cksum */ 0,
/* lfs_sp */ NULL,
/* lfs_ivnode */ NULL,
--- 95,146 ----
static struct lfs lfs_default = {
! { /* lfs_dlfs */
! /* dlfs_magic */ LFS_MAGIC,
! /* dlfs_version */ LFS_VERSION,
! /* dlfs_size */ 0,
! /* dlfs_ssize */ DFL_LFSSEG/DFL_LFSBLOCK,
! /* dlfs_dsize */ 0,
! /* dlfs_bsize */ DFL_LFSBLOCK,
! /* dlfs_fsize */ DFL_LFSFRAG,
! /* dlfs_frag */ 1,
! /* dlfs_free */ LFS_FIRST_INUM,
! /* dlfs_bfree */ 0,
! /* dlfs_nfiles */ 0,
! /* dlfs_avail */ 0,
! /* dlfs_uinodes */ 0,
! /* dlfs_idaddr */ 0,
! /* dlfs_ifile */ LFS_IFILE_INUM,
! /* dlfs_lastseg */ 0,
! /* dlfs_nextseg */ 0,
! /* dlfs_curseg */ 0,
! /* dlfs_offset */ 0,
! /* dlfs_lastpseg */ 0,
! /* dlfs_tstamp */ 0,
! /* dlfs_minfree */ MINFREE,
! /* dlfs_maxfilesize */ 0,
! /* dlfs_dbpseg */ DFL_LFSSEG/DEV_BSIZE,
! /* dlfs_inopb */ DFL_LFSBLOCK/sizeof(struct dinode),
! /* dlfs_ifpb */ DFL_LFSBLOCK/sizeof(IFILE),
! /* dlfs_sepb */ DFL_LFSBLOCK/sizeof(SEGUSE),
! /* dlfs_nindir */ DFL_LFSBLOCK/sizeof(daddr_t),
! /* dlfs_nseg */ 0,
! /* dlfs_nspf */ 0,
! /* dlfs_cleansz */ 0,
! /* dlfs_segtabsz */ 0,
! /* dlfs_segmask */ DFL_LFSSEG_MASK,
! /* dlfs_segshift */ DFL_LFSSEG_SHIFT,
! /* dlfs_bshift */ DFL_LFSBLOCK_SHIFT,
! /* dlfs_ffshift */ DFL_LFS_FFSHIFT,
! /* dlfs_fbshift */ DFL_LFS_FBSHIFT,
! /* dlfs_bmask */ DFL_LFSBLOCK_MASK,
! /* dlfs_ffmask */ DFL_LFS_FFMASK,
! /* dlfs_fbmask */ DFL_LFS_FBMASK,
! /* dlfs_fsbtodb */ 0,
! /* dlfs_sushift */ 0,
! /* dlfs_maxsymlinklen */ MAXSYMLINKLEN,
! /* dlfs_sboffs */ { 0 },
! /* dlfs_cksum */ 0,
! /* dlfs_pad */ { 0 }
! },
/* lfs_sp */ NULL,
/* lfs_ivnode */ NULL,
***************
*** 153,158 ****
/* lfs_ronly */ 0,
/* lfs_flags */ 0,
! /* lfs_fsmnt */ { 0 },
! /* lfs_pad */ { 0 },
};
--- 156,160 ----
/* lfs_ronly */ 0,
/* lfs_flags */ 0,
! /* lfs_fsmnt */ { 0 }
};
***************
*** 378,383 ****
*/
lfsp->lfs_nfiles = LFS_FIRST_INUM - 1;
- lfsp->lfs_cksum =
- cksum(lfsp, sizeof(struct lfs) - sizeof(lfsp->lfs_cksum));
/* Now create a block of disk inodes */
--- 380,383 ----
***************
*** 491,496 ****
/* Write Supberblock */
lfsp->lfs_offset = (off + lfsp->lfs_bsize) / lp->d_secsize;
! put(fd, LFS_LABELPAD, lfsp, sizeof(struct lfs));
/*
--- 491,497 ----
/* Write Supberblock */
+ lfsp->lfs_cksum = lfs_sb_cksum(&(lfsp->lfs_dlfs));
lfsp->lfs_offset = (off + lfsp->lfs_bsize) / lp->d_secsize;
! put(fd, LFS_LABELPAD, &(lfsp->lfs_dlfs), sizeof(struct dlfs));
/*
***************
*** 581,586 ****
/* Now, write rest of segments containing superblocks */
! lfsp->lfs_cksum =
! cksum(lfsp, sizeof(struct lfs) - sizeof(lfsp->lfs_cksum));
for (seg_addr = last_addr = lfsp->lfs_sboffs[0], j = 1, i = 1;
i < lfsp->lfs_nseg; i++) {
--- 582,586 ----
/* Now, write rest of segments containing superblocks */
! lfsp->lfs_cksum = lfs_sb_cksum(&(lfsp->lfs_dlfs));
for (seg_addr = last_addr = lfsp->lfs_sboffs[0], j = 1, i = 1;
i < lfsp->lfs_nseg; i++) {
***************
*** 594,598 ****
if (j < (LFS_MAXNUMSB - 2))
j++;
! put(fd, seg_seek, lfsp, sizeof(struct lfs));
seg_seek += LFS_SBPAD;
}
--- 594,598 ----
if (j < (LFS_MAXNUMSB - 2))
j++;
! put(fd, seg_seek, &(lfsp->lfs_dlfs), sizeof(struct dlfs));
seg_seek += LFS_SBPAD;
}
*** usr.sbin/dumplfs.dist/dumplfs.c Tue Mar 3 04:27:17 1998
--- usr.sbin/dumplfs.dlfs/dumplfs.c Sun Aug 23 12:36:55 1998
***************
*** 152,156 ****
/* Read the first superblock */
! get(fd, LFS_LABELPAD, &lfs_sb1, sizeof(struct lfs));
daddr_shift = lfs_sb1.lfs_bshift - lfs_sb1.lfs_fsbtodb;
--- 152,156 ----
/* Read the first superblock */
! get(fd, LFS_LABELPAD, &(lfs_sb1.lfs_dlfs), sizeof(struct dlfs));
daddr_shift = lfs_sb1.lfs_bshift - lfs_sb1.lfs_fsbtodb;
***************
*** 160,164 ****
*/
get(fd,
! lfs_sb1.lfs_sboffs[1] << daddr_shift, &lfs_sb2, sizeof(struct lfs));
lfs_master = &lfs_sb1;
--- 160,164 ----
*/
get(fd,
! lfs_sb1.lfs_sboffs[1] << daddr_shift, &(lfs_sb2.lfs_dlfs), sizeof(struct dlfs));
lfs_master = &lfs_sb1;
***************
*** 512,516 ****
if (dump_sb && sb) {
! get(fd, super_off, &lfs_sb, sizeof(struct lfs));
dump_super(&lfs_sb);
}
--- 512,516 ----
if (dump_sb && sb) {
! get(fd, super_off, &(lfs_sb.lfs_dlfs), sizeof(struct dlfs));
dump_super(&lfs_sb);
}
***************
*** 589,592 ****
--- 589,593 ----
"offset ", lfsp->lfs_offset);
(void)printf("tstamp %s", ctime((time_t *)&lfsp->lfs_tstamp));
+ #if 0 /* This is no longer stored on disk! --ks */
(void)printf("\nIn-Memory Information\n");
(void)printf("%s%d\t%s0x%X\t%s%d%s%d\t%s%d\n",
***************
*** 601,604 ****
--- 602,606 ----
"clean ", lfsp->lfs_clean,
"ronly ", lfsp->lfs_ronly);
+ #endif
}
*** libexec/lfs_cleanerd.dist/clean.h Sun Mar 1 04:17:44 1998
--- libexec/lfs_cleanerd.dlfs/clean.h Mon Aug 24 17:13:39 1998
***************
*** 140,144 ****
#define PRINT_BINFO(bip) { \
(void)printf("\tinode: %d lbn: %d daddr: 0x%lx create: %s\n", \
! (bip)->bi_inode, (bip)->bi_lbn, (bip)->bi_daddr, \
ctime((time_t *)&(bip)->bi_segcreate)); \
fflush(stdout); \
--- 140,144 ----
#define PRINT_BINFO(bip) { \
(void)printf("\tinode: %d lbn: %d daddr: 0x%lx create: %s\n", \
! (bip)->bi_inode, (bip)->bi_lbn, (unsigned long)(bip)->bi_daddr, \
ctime((time_t *)&(bip)->bi_segcreate)); \
fflush(stdout); \
***************
*** 147,151 ****
#define PRINT_SEGUSE(sup, n) { \
(void)printf("Segment %d nbytes=%lu\tflags=%c%c%c ninos=%d nsums=%d lastmod: %s\n", \
! n, (sup)->su_nbytes, \
(sup)->su_flags & SEGUSE_DIRTY ? 'D' : 'C', \
(sup)->su_flags & SEGUSE_ACTIVE ? 'A' : ' ', \
--- 147,151 ----
#define PRINT_SEGUSE(sup, n) { \
(void)printf("Segment %d nbytes=%lu\tflags=%c%c%c ninos=%d nsums=%d lastmod: %s\n", \
! n, (unsigned long)(sup)->su_nbytes, \
(sup)->su_flags & SEGUSE_DIRTY ? 'D' : 'C', \
(sup)->su_flags & SEGUSE_ACTIVE ? 'A' : ' ', \
*** libexec/lfs_cleanerd.dist/cleanerd.c Fri May 22 04:09:32 1998
--- libexec/lfs_cleanerd.dlfs/cleanerd.c Mon Aug 24 17:13:06 1998
***************
*** 438,442 ****
#ifdef VERBOSE
(void)printf("cleaning segment %d: contains %lu bytes\n", id,
! sp->su_nbytes);
fflush(stdout);
#endif
--- 438,442 ----
#ifdef VERBOSE
(void)printf("cleaning segment %d: contains %lu bytes\n", id,
! (unsigned long)sp->su_nbytes);
fflush(stdout);
#endif
*** libexec/lfs_cleanerd.dist/library.c Mon Aug 10 04:08:33 1998
--- libexec/lfs_cleanerd.dlfs/library.c Sun Aug 23 12:33:49 1998
***************
*** 171,175 ****
get(fid, LFS_LABELPAD, buf, LFS_SBPAD);
! memcpy(sbp, buf, sizeof(struct lfs));
close (fid);
--- 171,175 ----
get(fid, LFS_LABELPAD, buf, LFS_SBPAD);
! memcpy(&(sbp->lfs_dlfs), buf, sizeof(struct dlfs));
close (fid);
>Audit-Trail:
>Unformatted: