changes for 64-bit machines (from bostic)
authorKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Sat, 9 Jul 1994 14:45:07 +0000 (06:45 -0800)
committerKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Sat, 9 Jul 1994 14:45:07 +0000 (06:45 -0800)
SCCS-vsn: sys/ufs/ufs/inode.h 8.5
SCCS-vsn: sys/ufs/ufs/quota.h 8.2
SCCS-vsn: sys/ufs/ufs/ufsmount.h 8.3
SCCS-vsn: sys/ufs/ufs/dir.h 8.3
SCCS-vsn: sys/ufs/ufs/dinode.h 8.4
SCCS-vsn: sys/ufs/ffs/fs.h 8.8
SCCS-vsn: sys/ufs/lfs/lfs.h 8.5

usr/src/sys/ufs/ffs/fs.h
usr/src/sys/ufs/lfs/lfs.h
usr/src/sys/ufs/ufs/dinode.h
usr/src/sys/ufs/ufs/dir.h
usr/src/sys/ufs/ufs/inode.h
usr/src/sys/ufs/ufs/quota.h
usr/src/sys/ufs/ufs/ufsmount.h

index 5386b9f..247a281 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)fs.h        8.7 (Berkeley) %G%
+ *     @(#)fs.h        8.8 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
  * The path name on which the file system is mounted is maintained
  * in fs_fsmnt. MAXMNTLEN defines the amount of space allocated in 
  * the super block for this name.
  * The path name on which the file system is mounted is maintained
  * in fs_fsmnt. MAXMNTLEN defines the amount of space allocated in 
  * the super block for this name.
+ */
+#define MAXMNTLEN      512
+
+/*
  * The limit on the amount of summary information per file system
  * is defined by MAXCSBUFS. It is currently parameterized for a
  * The limit on the amount of summary information per file system
  * is defined by MAXCSBUFS. It is currently parameterized for a
- * maximum of two million cylinders.
+ * size of 128 bytes (2 million cylinder groups on machines with
+ * 32-bit pointers, and 1 million on 64-bit machines).
  */
  */
-#define MAXMNTLEN 512
-#define MAXCSBUFS 32
+#define        MAXCSBUFS       (128 / sizeof(void *))
 
 /*
  * A summary of contiguous blocks of various sizes is maintained
 
 /*
  * A summary of contiguous blocks of various sizes is maintained
  * the ``fs_cs'' macro to work (see below).
  */
 struct csum {
  * the ``fs_cs'' macro to work (see below).
  */
 struct csum {
-       long    cs_ndir;        /* number of directories */
-       long    cs_nbfree;      /* number of free blocks */
-       long    cs_nifree;      /* number of free inodes */
-       long    cs_nffree;      /* number of free frags */
+       int32_t cs_ndir;                /* number of directories */
+       int32_t cs_nbfree;              /* number of free blocks */
+       int32_t cs_nifree;              /* number of free inodes */
+       int32_t cs_nffree;              /* number of free frags */
 };
 
 /*
 };
 
 /*
- * Super block for a file system.
+ * Super block for an FFS file system.
  */
 struct fs {
  */
 struct fs {
-       struct  fs *fs_link;            /* linked list of file systems */
-       struct  fs *fs_rlink;           /*     used for incore super blocks */
-       daddr_t fs_sblkno;              /* addr of super-block in filesys */
-       daddr_t fs_cblkno;              /* offset of cyl-block in filesys */
-       daddr_t fs_iblkno;              /* offset of inode-blocks in filesys */
-       daddr_t fs_dblkno;              /* offset of first data after cg */
-       long    fs_cgoffset;            /* cylinder group offset in cylinder */
-       long    fs_cgmask;              /* used to calc mod fs_ntrak */
-       time_t  fs_time;                /* last time written */
-       long    fs_size;                /* number of blocks in fs */
-       long    fs_dsize;               /* number of data blocks in fs */
-       long    fs_ncg;                 /* number of cylinder groups */
-       long    fs_bsize;               /* size of basic blocks in fs */
-       long    fs_fsize;               /* size of frag blocks in fs */
-       long    fs_frag;                /* number of frags in a block in fs */
+       int32_t  unused_1;              /* historic file system linked list, */
+       int32_t  unused_2;              /*     used for incore super blocks */
+       daddr_t  fs_sblkno;             /* addr of super-block in filesys */
+       daddr_t  fs_cblkno;             /* offset of cyl-block in filesys */
+       daddr_t  fs_iblkno;             /* offset of inode-blocks in filesys */
+       daddr_t  fs_dblkno;             /* offset of first data after cg */
+       int32_t  fs_cgoffset;           /* cylinder group offset in cylinder */
+       int32_t  fs_cgmask;             /* used to calc mod fs_ntrak */
+       time_t   fs_time;               /* last time written */
+       int32_t  fs_size;               /* number of blocks in fs */
+       int32_t  fs_dsize;              /* number of data blocks in fs */
+       int32_t  fs_ncg;                /* number of cylinder groups */
+       int32_t  fs_bsize;              /* size of basic blocks in fs */
+       int32_t  fs_fsize;              /* size of frag blocks in fs */
+       int32_t  fs_frag;               /* number of frags in a block in fs */
 /* these are configuration parameters */
 /* these are configuration parameters */
-       long    fs_minfree;             /* minimum percentage of free blocks */
-       long    fs_rotdelay;            /* num of ms for optimal next block */
-       long    fs_rps;                 /* disk revolutions per second */
+       int32_t  fs_minfree;            /* minimum percentage of free blocks */
+       int32_t  fs_rotdelay;           /* num of ms for optimal next block */
+       int32_t  fs_rps;                /* disk revolutions per second */
 /* these fields can be computed from the others */
 /* these fields can be computed from the others */
-       long    fs_bmask;               /* ``blkoff'' calc of blk offsets */
-       long    fs_fmask;               /* ``fragoff'' calc of frag offsets */
-       long    fs_bshift;              /* ``lblkno'' calc of logical blkno */
-       long    fs_fshift;              /* ``numfrags'' calc number of frags */
+       int32_t  fs_bmask;              /* ``blkoff'' calc of blk offsets */
+       int32_t  fs_fmask;              /* ``fragoff'' calc of frag offsets */
+       int32_t  fs_bshift;             /* ``lblkno'' calc of logical blkno */
+       int32_t  fs_fshift;             /* ``numfrags'' calc number of frags */
 /* these are configuration parameters */
 /* these are configuration parameters */
-       long    fs_maxcontig;           /* max number of contiguous blks */
-       long    fs_maxbpg;              /* max number of blks per cyl group */
+       int32_t  fs_maxcontig;          /* max number of contiguous blks */
+       int32_t  fs_maxbpg;             /* max number of blks per cyl group */
 /* these fields can be computed from the others */
 /* these fields can be computed from the others */
-       long    fs_fragshift;           /* block to frag shift */
-       long    fs_fsbtodb;             /* fsbtodb and dbtofsb shift constant */
-       long    fs_sbsize;              /* actual size of super block */
-       long    fs_csmask;              /* csum block offset */
-       long    fs_csshift;             /* csum block number */
-       long    fs_nindir;              /* value of NINDIR */
-       long    fs_inopb;               /* value of INOPB */
-       long    fs_nspf;                /* value of NSPF */
+       int32_t  fs_fragshift;          /* block to frag shift */
+       int32_t  fs_fsbtodb;            /* fsbtodb and dbtofsb shift constant */
+       int32_t  fs_sbsize;             /* actual size of super block */
+       int32_t  fs_csmask;             /* csum block offset */
+       int32_t  fs_csshift;            /* csum block number */
+       int32_t  fs_nindir;             /* value of NINDIR */
+       int32_t  fs_inopb;              /* value of INOPB */
+       int32_t  fs_nspf;               /* value of NSPF */
 /* yet another configuration parameter */
 /* yet another configuration parameter */
-       long    fs_optim;               /* optimization preference, see below */
+       int32_t  fs_optim;              /* optimization preference, see below */
 /* these fields are derived from the hardware */
 /* these fields are derived from the hardware */
-       long    fs_npsect;              /* # sectors/track including spares */
-       long    fs_interleave;          /* hardware sector interleave */
-       long    fs_trackskew;           /* sector 0 skew, per track */
-       long    fs_headswitch;          /* head switch time, usec */
-       long    fs_trkseek;             /* track-to-track seek, usec */
+       int32_t  fs_npsect;             /* # sectors/track including spares */
+       int32_t  fs_interleave;         /* hardware sector interleave */
+       int32_t  fs_trackskew;          /* sector 0 skew, per track */
+       int32_t  fs_headswitch;         /* head switch time, usec */
+       int32_t  fs_trkseek;            /* track-to-track seek, usec */
 /* sizes determined by number of cylinder groups and their sizes */
 /* sizes determined by number of cylinder groups and their sizes */
-       daddr_t fs_csaddr;              /* blk addr of cyl grp summary area */
-       long    fs_cssize;              /* size of cyl grp summary area */
-       long    fs_cgsize;              /* cylinder group size */
+       daddr_t  fs_csaddr;             /* blk addr of cyl grp summary area */
+       int32_t  fs_cssize;             /* size of cyl grp summary area */
+       int32_t  fs_cgsize;             /* cylinder group size */
 /* these fields are derived from the hardware */
 /* these fields are derived from the hardware */
-       long    fs_ntrak;               /* tracks per cylinder */
-       long    fs_nsect;               /* sectors per track */
-       long    fs_spc;                 /* sectors per cylinder */
+       int32_t  fs_ntrak;              /* tracks per cylinder */
+       int32_t  fs_nsect;              /* sectors per track */
+       int32_t  fs_spc;                        /* sectors per cylinder */
 /* this comes from the disk driver partitioning */
 /* this comes from the disk driver partitioning */
-       long    fs_ncyl;                /* cylinders in file system */
+       int32_t  fs_ncyl;               /* cylinders in file system */
 /* these fields can be computed from the others */
 /* these fields can be computed from the others */
-       long    fs_cpg;                 /* cylinders per group */
-       long    fs_ipg;                 /* inodes per group */
-       long    fs_fpg;                 /* blocks per group * fs_frag */
+       int32_t  fs_cpg;                        /* cylinders per group */
+       int32_t  fs_ipg;                        /* inodes per group */
+       int32_t  fs_fpg;                        /* blocks per group * fs_frag */
 /* this data must be re-computed after crashes */
        struct  csum fs_cstotal;        /* cylinder summary information */
 /* these fields are cleared at mount time */
 /* this data must be re-computed after crashes */
        struct  csum fs_cstotal;        /* cylinder summary information */
 /* these fields are cleared at mount time */
-       char    fs_fmod;                /* super block modified flag */
-       char    fs_clean;               /* file system is clean flag */
-       char    fs_ronly;               /* mounted read-only flag */
-       char    fs_flags;               /* currently unused flag */
-       char    fs_fsmnt[MAXMNTLEN];    /* name mounted on */
+       int8_t   fs_fmod;               /* super block modified flag */
+       int8_t   fs_clean;              /* file system is clean flag */
+       int8_t   fs_ronly;              /* mounted read-only flag */
+       int8_t   fs_flags;              /* currently unused flag */
+       u_char   fs_fsmnt[MAXMNTLEN];   /* name mounted on */
        long    fs_dbsize;              /* hardware sector size */
        long    fs_sparecon[31];        /* reserved for future constants */
 /* these fields retain the current block allocation info */
        long    fs_dbsize;              /* hardware sector size */
        long    fs_sparecon[31];        /* reserved for future constants */
 /* these fields retain the current block allocation info */
-       long    fs_cgrotor;             /* last cg searched */
+       int32_t  fs_cgrotor;            /* last cg searched */
        struct  csum *fs_csp[MAXCSBUFS];/* list of fs_cs info buffers */
        struct  csum *fs_csp[MAXCSBUFS];/* list of fs_cs info buffers */
-       long    fs_cpc;                 /* cyl per cycle in postbl */
-       short   fs_opostbl[16][8];      /* old rotation block list head */
-       long    fs_sparecon[50];        /* reserved for future constants */
-       long    fs_contigsumsize;       /* size of cluster summary array */ 
-       long    fs_maxsymlinklen;       /* max length of an internal symlink */
-       long    fs_inodefmt;            /* format of on-disk inodes */
+       int32_t  fs_cpc;                /* cyl per cycle in postbl */
+       int16_t  fs_opostbl[16][8];     /* old rotation block list head */
+       int32_t  fs_sparecon[50];       /* reserved for future constants */
+       int32_t  fs_contigsumsize;      /* size of cluster summary array */ 
+       int32_t  fs_maxsymlinklen;      /* max length of an internal symlink */
+       int32_t  fs_inodefmt;           /* format of on-disk inodes */
        u_quad_t fs_maxfilesize;        /* maximum representable file size */
        u_quad_t fs_maxfilesize;        /* maximum representable file size */
-       quad_t  fs_qbmask;              /* ~fs_bmask - for use with quad size */
-       quad_t  fs_qfmask;              /* ~fs_fmask - for use with quad size */
-       long    fs_state;               /* validate fs_clean field */
-       long    fs_postblformat;        /* format of positional layout tables */
-       long    fs_nrpos;               /* number of rotational positions */
-       long    fs_postbloff;           /* (short) rotation block list head */
-       long    fs_rotbloff;            /* (u_char) blocks for each rotation */
-       long    fs_magic;               /* magic number */
-       u_char  fs_space[1];            /* list of blocks for each rotation */
+       quad_t   fs_qbmask;             /* ~fs_bmask - for use with quad size */
+       quad_t   fs_qfmask;             /* ~fs_fmask - for use with quad size */
+       int32_t  fs_state;              /* validate fs_clean field */
+       int32_t  fs_postblformat;       /* format of positional layout tables */
+       int32_t  fs_nrpos;              /* number of rotational positions */
+       int32_t  fs_postbloff;          /* (u_int16) rotation block list head */
+       int32_t  fs_rotbloff;           /* (u_int8) blocks for each rotation */
+       int32_t  fs_magic;              /* magic number */
+       u_int8_t fs_space[1];           /* list of blocks for each rotation */
 /* actually longer */
 };
 /* actually longer */
 };
+
 /*
 /*
- * Filesystem idetification
+ * Filesystem identification
  */
 #define        FS_MAGIC        0x011954        /* the fast filesystem magic number */
 #define        FS_OKAY         0x7c269d38      /* superblock checksum */
  */
 #define        FS_MAGIC        0x011954        /* the fast filesystem magic number */
 #define        FS_OKAY         0x7c269d38      /* superblock checksum */
@@ -240,11 +245,12 @@ struct fs {
 #define fs_postbl(fs, cylno) \
     (((fs)->fs_postblformat == FS_42POSTBLFMT) \
     ? ((fs)->fs_opostbl[cylno]) \
 #define fs_postbl(fs, cylno) \
     (((fs)->fs_postblformat == FS_42POSTBLFMT) \
     ? ((fs)->fs_opostbl[cylno]) \
-    : ((short *)((char *)(fs) + (fs)->fs_postbloff) + (cylno) * (fs)->fs_nrpos))
+    : ((int16_t *)((u_int8_t *)(fs) + \
+       (fs)->fs_postbloff) + (cylno) * (fs)->fs_nrpos))
 #define fs_rotbl(fs) \
     (((fs)->fs_postblformat == FS_42POSTBLFMT) \
     ? ((fs)->fs_space) \
 #define fs_rotbl(fs) \
     (((fs)->fs_postblformat == FS_42POSTBLFMT) \
     ? ((fs)->fs_space) \
-    : ((u_char *)((char *)(fs) + (fs)->fs_rotbloff)))
+    : ((u_int8_t *)((u_int8_t *)(fs) + (fs)->fs_rotbloff)))
 
 /*
  * The size of a cylinder group is calculated by CGSIZE. The maximum size
 
 /*
  * The size of a cylinder group is calculated by CGSIZE. The maximum size
@@ -253,13 +259,13 @@ struct fs {
  * cylinder group and the (struct cg) size.
  */
 #define CGSIZE(fs) \
  * cylinder group and the (struct cg) size.
  */
 #define CGSIZE(fs) \
-    /* base cg */      (sizeof(struct cg) + sizeof(long) + \
-    /* blktot size */  (fs)->fs_cpg * sizeof(long) + \
-    /* blks size */    (fs)->fs_cpg * (fs)->fs_nrpos * sizeof(short) + \
+    /* base cg */      (sizeof(struct cg) + sizeof(int32_t) + \
+    /* blktot size */  (fs)->fs_cpg * sizeof(int32_t) + \
+    /* blks size */    (fs)->fs_cpg * (fs)->fs_nrpos * sizeof(int16_t) + \
     /* inode map */    howmany((fs)->fs_ipg, NBBY) + \
     /* block map */    howmany((fs)->fs_cpg * (fs)->fs_spc / NSPF(fs), NBBY) +\
     /* if present */   ((fs)->fs_contigsumsize <= 0 ? 0 : \
     /* inode map */    howmany((fs)->fs_ipg, NBBY) + \
     /* block map */    howmany((fs)->fs_cpg * (fs)->fs_spc / NSPF(fs), NBBY) +\
     /* if present */   ((fs)->fs_contigsumsize <= 0 ? 0 : \
-    /* cluster sum */  (fs)->fs_contigsumsize * sizeof(long) + \
+    /* cluster sum */  (fs)->fs_contigsumsize * sizeof(int32_t) + \
     /* cluster map */  howmany((fs)->fs_cpg * (fs)->fs_spc / NSPB(fs), NBBY)))
 
 /*
     /* cluster map */  howmany((fs)->fs_cpg * (fs)->fs_spc / NSPB(fs), NBBY)))
 
 /*
@@ -274,79 +280,81 @@ struct fs {
  * Cylinder group block for a file system.
  */
 #define        CG_MAGIC        0x090255
  * Cylinder group block for a file system.
  */
 #define        CG_MAGIC        0x090255
-struct cg {
-       struct  cg *cg_link;            /* linked list of cyl groups */
-       long    cg_magic;               /* magic number */
-       time_t  cg_time;                /* time last written */
-       long    cg_cgx;                 /* we are the cgx'th cylinder group */
-       short   cg_ncyl;                /* number of cyl's this cg */
-       short   cg_niblk;               /* number of inode blocks this cg */
-       long    cg_ndblk;               /* number of data blocks this cg */
+struct cg {
+       int32_t  unused_1;              /* historic cyl groups linked list */
+       int32_t  cg_magic;              /* magic number */
+       time_t   cg_time;               /* time last written */
+       int32_t  cg_cgx;                /* we are the cgx'th cylinder group */
+       int16_t  cg_ncyl;               /* number of cyl's this cg */
+       int16_t  cg_niblk;              /* number of inode blocks this cg */
+       int32_t  cg_ndblk;              /* number of data blocks this cg */
        struct  csum cg_cs;             /* cylinder summary information */
        struct  csum cg_cs;             /* cylinder summary information */
-       long    cg_rotor;               /* position of last used block */
-       long    cg_frotor;              /* position of last used frag */
-       long    cg_irotor;              /* position of last used inode */
-       long    cg_frsum[MAXFRAG];      /* counts of available frags */
-       long    cg_btotoff;             /* (long) block totals per cylinder */
-       long    cg_boff;                /* (short) free block positions */
-       long    cg_iusedoff;            /* (char) used inode map */
-       long    cg_freeoff;             /* (u_char) free block map */
-       long    cg_nextfreeoff;         /* (u_char) next available space */
-       long    cg_clustersumoff;       /* (long) counts of avail clusters */
-       long    cg_clusteroff;          /* (char) free cluster map */
-       long    cg_nclusterblks;        /* number of clusters this cg */
-       long    cg_sparecon[13];        /* reserved for future use */
-       u_char  cg_space[1];            /* space for cylinder group maps */
+       int32_t  cg_rotor;              /* position of last used block */
+       int32_t  cg_frotor;             /* position of last used frag */
+       int32_t  cg_irotor;             /* position of last used inode */
+       int32_t  cg_frsum[MAXFRAG];     /* counts of available frags */
+       int32_t  cg_btotoff;            /* (int32) block totals per cylinder */
+       int32_t  cg_boff;               /* (u_int16) free block positions */
+       int32_t  cg_iusedoff;           /* (u_int8) used inode map */
+       int32_t  cg_freeoff;            /* (u_int8) free block map */
+       int32_t  cg_nextfreeoff;        /* (u_int8) next available space */
+       int32_t  cg_clustersumoff;      /* (u_int32) counts of avail clusters */
+       int32_t  cg_clusteroff;         /* (u_int8) free cluster map */
+       int32_t  cg_nclusterblks;       /* number of clusters this cg */
+       int32_t  cg_sparecon[13];       /* reserved for future use */
+       u_int8_t cg_space[1];           /* space for cylinder group maps */
 /* actually longer */
 };
 /* actually longer */
 };
+
 /*
  * Macros for access to cylinder group array structures
  */
 #define cg_blktot(cgp) \
     (((cgp)->cg_magic != CG_MAGIC) \
     ? (((struct ocg *)(cgp))->cg_btot) \
 /*
  * Macros for access to cylinder group array structures
  */
 #define cg_blktot(cgp) \
     (((cgp)->cg_magic != CG_MAGIC) \
     ? (((struct ocg *)(cgp))->cg_btot) \
-    : ((long *)((char *)(cgp) + (cgp)->cg_btotoff)))
+    : ((int32_t *)((u_int8_t *)(cgp) + (cgp)->cg_btotoff)))
 #define cg_blks(fs, cgp, cylno) \
     (((cgp)->cg_magic != CG_MAGIC) \
     ? (((struct ocg *)(cgp))->cg_b[cylno]) \
 #define cg_blks(fs, cgp, cylno) \
     (((cgp)->cg_magic != CG_MAGIC) \
     ? (((struct ocg *)(cgp))->cg_b[cylno]) \
-    : ((short *)((char *)(cgp) + (cgp)->cg_boff) + (cylno) * (fs)->fs_nrpos))
+    : ((int16_t *)((u_int8_t *)(cgp) + \
+       (cgp)->cg_boff) + (cylno) * (fs)->fs_nrpos))
 #define cg_inosused(cgp) \
     (((cgp)->cg_magic != CG_MAGIC) \
     ? (((struct ocg *)(cgp))->cg_iused) \
 #define cg_inosused(cgp) \
     (((cgp)->cg_magic != CG_MAGIC) \
     ? (((struct ocg *)(cgp))->cg_iused) \
-    : ((char *)((char *)(cgp) + (cgp)->cg_iusedoff)))
+    : ((u_int8_t *)((u_int8_t *)(cgp) + (cgp)->cg_iusedoff)))
 #define cg_blksfree(cgp) \
     (((cgp)->cg_magic != CG_MAGIC) \
     ? (((struct ocg *)(cgp))->cg_free) \
 #define cg_blksfree(cgp) \
     (((cgp)->cg_magic != CG_MAGIC) \
     ? (((struct ocg *)(cgp))->cg_free) \
-    : ((u_char *)((char *)(cgp) + (cgp)->cg_freeoff)))
+    : ((u_int8_t *)((u_int8_t *)(cgp) + (cgp)->cg_freeoff)))
 #define cg_chkmagic(cgp) \
     ((cgp)->cg_magic == CG_MAGIC || ((struct ocg *)(cgp))->cg_magic == CG_MAGIC)
 #define cg_clustersfree(cgp) \
 #define cg_chkmagic(cgp) \
     ((cgp)->cg_magic == CG_MAGIC || ((struct ocg *)(cgp))->cg_magic == CG_MAGIC)
 #define cg_clustersfree(cgp) \
-    ((u_char *)((char *)(cgp) + (cgp)->cg_clusteroff))
+    ((u_int8_t *)((u_int8_t *)(cgp) + (cgp)->cg_clusteroff))
 #define cg_clustersum(cgp) \
 #define cg_clustersum(cgp) \
-    ((long *)((char *)(cgp) + (cgp)->cg_clustersumoff))
+    ((int32_t *)((u_int8_t *)(cgp) + (cgp)->cg_clustersumoff))
 
 /*
  * The following structure is defined
  * for compatibility with old file systems.
  */
 
 /*
  * The following structure is defined
  * for compatibility with old file systems.
  */
-struct ocg {
-       struct  ocg *cg_link;           /* linked list of cyl groups */
-       struct  ocg *cg_rlink;          /*     used for incore cyl groups */
-       time_t  cg_time;                /* time last written */
-       long    cg_cgx;                 /* we are the cgx'th cylinder group */
-       short   cg_ncyl;                /* number of cyl's this cg */
-       short   cg_niblk;               /* number of inode blocks this cg */
-       long    cg_ndblk;               /* number of data blocks this cg */
+struct ocg {
+       int32_t  unused_1;              /* historic linked list of cyl groups */
+       int32_t  unused_2;              /*     used for incore cyl groups */
+       time_t   cg_time;               /* time last written */
+       int32_t  cg_cgx;                /* we are the cgx'th cylinder group */
+       int16_t  cg_ncyl;               /* number of cyl's this cg */
+       int16_t  cg_niblk;              /* number of inode blocks this cg */
+       int32_t  cg_ndblk;              /* number of data blocks this cg */
        struct  csum cg_cs;             /* cylinder summary information */
        struct  csum cg_cs;             /* cylinder summary information */
-       long    cg_rotor;               /* position of last used block */
-       long    cg_frotor;              /* position of last used frag */
-       long    cg_irotor;              /* position of last used inode */
-       long    cg_frsum[8];            /* counts of available frags */
-       long    cg_btot[32];            /* block totals per cylinder */
-       short   cg_b[32][8];            /* positions of free blocks */
-       char    cg_iused[256];          /* used inode map */
-       long    cg_magic;               /* magic number */
-       u_char  cg_free[1];             /* free block map */
+       int32_t  cg_rotor;              /* position of last used block */
+       int32_t  cg_frotor;             /* position of last used frag */
+       int32_t  cg_irotor;             /* position of last used inode */
+       int32_t  cg_frsum[8];           /* counts of available frags */
+       int32_t  cg_btot[32];           /* block totals per cylinder */
+       int16_t  cg_b[32][8];           /* positions of free blocks */
+       u_int8_t cg_iused[256];         /* used inode map */
+       int32_t  cg_magic;              /* magic number */
+       u_int8_t cg_free[1];            /* free block map */
 /* actually longer */
 };
 
 /* actually longer */
 };
 
@@ -449,20 +457,22 @@ struct    ocg {
            ? (fs)->fs_bsize \
            : (fragroundup(fs, blkoff(fs, (dip)->di_size))))
 
            ? (fs)->fs_bsize \
            : (fragroundup(fs, blkoff(fs, (dip)->di_size))))
 
+
 /*
 /*
- * Number of disk sectors per block; assumes DEV_BSIZE byte sector size.
+ * Number of disk sectors per block/fragment; assumes DEV_BSIZE byte
+ * sector size.
  */
 #define        NSPB(fs)        ((fs)->fs_nspf << (fs)->fs_fragshift)
 #define        NSPF(fs)        ((fs)->fs_nspf)
 
 /*
  */
 #define        NSPB(fs)        ((fs)->fs_nspf << (fs)->fs_fragshift)
 #define        NSPF(fs)        ((fs)->fs_nspf)
 
 /*
- * INOPB is the number of inodes in a secondary storage block.
+ * Number of inodes in a secondary storage block/fragment.
  */
 #define        INOPB(fs)       ((fs)->fs_inopb)
 #define        INOPF(fs)       ((fs)->fs_inopb >> (fs)->fs_fragshift)
 
 /*
  */
 #define        INOPB(fs)       ((fs)->fs_inopb)
 #define        INOPF(fs)       ((fs)->fs_inopb >> (fs)->fs_fragshift)
 
 /*
- * NINDIR is the number of indirects in a file system block.
+ * Number of indirects in a file system block.
  */
 #define        NINDIR(fs)      ((fs)->fs_nindir)
 
  */
 #define        NINDIR(fs)      ((fs)->fs_nindir)
 
index f9f53e9..75e4b24 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)lfs.h       8.4 (Berkeley) %G%
+ *     @(#)lfs.h       8.5 (Berkeley) %G%
  */
 
 #define        LFS_LABELPAD    8192            /* LFS label size */
  */
 
 #define        LFS_LABELPAD    8192            /* LFS label size */
 /* On-disk and in-memory checkpoint segment usage structure. */
 typedef struct segusage SEGUSE;
 struct segusage {
 /* On-disk and in-memory checkpoint segment usage structure. */
 typedef struct segusage SEGUSE;
 struct segusage {
-       u_long  su_nbytes;              /* number of live bytes */
-       u_long  su_lastmod;             /* SEGUSE last modified timestamp */
-       u_short su_nsums;               /* number of summaries in segment */
-       u_short su_ninos;               /* number of inode blocks in seg */
-#define        SEGUSE_ACTIVE           0x1     /* segment is currently being written */
-#define        SEGUSE_DIRTY            0x2     /* segment has data in it */
-#define        SEGUSE_SUPERBLOCK       0x4     /* segment contains a superblock */
-       u_long  su_flags;
+       u_int32_t su_nbytes;            /* number of live bytes */
+       u_int32_t su_lastmod;           /* SEGUSE last modified timestamp */
+       u_int16_t su_nsums;             /* number of summaries in segment */
+       u_int16_t su_ninos;             /* number of inode blocks in seg */
+
+#define        SEGUSE_ACTIVE           0x01    /* segment is currently being written */
+#define        SEGUSE_DIRTY            0x02    /* segment has data in it */
+#define        SEGUSE_SUPERBLOCK       0x04    /* segment contains a superblock */
+       u_int32_t su_flags;
 };
 
 #define        SEGUPB(fs)      (1 << (fs)->lfs_sushift)
 };
 
 #define        SEGUPB(fs)      (1 << (fs)->lfs_sushift)
@@ -46,99 +47,99 @@ struct segusage {
 /* On-disk file information.  One per file with data blocks in the segment. */
 typedef struct finfo FINFO;
 struct finfo {
 /* On-disk file information.  One per file with data blocks in the segment. */
 typedef struct finfo FINFO;
 struct finfo {
-       u_long  fi_nblocks;             /* number of blocks */
-       u_long  fi_version;             /* version number */
-       u_long  fi_ino;                 /* inode number */
-       long    fi_blocks[1];           /* array of logical block numbers */
+       u_int32_t fi_nblocks;           /* number of blocks */
+       u_int32_t fi_version;           /* version number */
+       u_int32_t fi_ino;               /* inode number */
+       daddr_t   fi_blocks[1];         /* array of logical block numbers */
 };
 
 /* On-disk and in-memory super block. */
 struct lfs {
 #define        LFS_MAGIC       0x070162
 };
 
 /* On-disk and in-memory super block. */
 struct lfs {
 #define        LFS_MAGIC       0x070162
-       u_long  lfs_magic;              /* magic number */
+       u_int32_t lfs_magic;            /* magic number */
 #define        LFS_VERSION     1
 #define        LFS_VERSION     1
-       u_long  lfs_version;            /* version number */
+       u_int32_t lfs_version;          /* version number */
 
 
-       u_long  lfs_size;               /* number of blocks in fs */
-       u_long  lfs_ssize;              /* number of blocks per segment */
-       u_long  lfs_dsize;              /* number of disk blocks in fs */
-       u_long  lfs_bsize;              /* file system block size */
-       u_long  lfs_fsize;              /* size of frag blocks in fs */
-       u_long  lfs_frag;               /* number of frags in a block in fs */
+       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. */
 
 /* Checkpoint region. */
-       ino_t   lfs_free;               /* start of the free list */
-       u_long  lfs_bfree;              /* number of free disk blocks */
-       u_long  lfs_nfiles;             /* number of allocated inodes */
-       long    lfs_avail;              /* blocks available for writing */
-       u_long  lfs_uinodes;            /* inodes in cache not yet on disk */
-       daddr_t lfs_idaddr;             /* inode file disk address */
-       ino_t   lfs_ifile;              /* inode file inode number */
-       daddr_t lfs_lastseg;            /* address of last segment written */
-       daddr_t lfs_nextseg;            /* address of next segment to write */
-       daddr_t lfs_curseg;             /* current segment being written */
-       daddr_t lfs_offset;             /* offset in curseg for next partial */
-       daddr_t lfs_lastpseg;           /* address of last partial written */
-       u_long  lfs_tstamp;             /* time stamp */
+       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 */
+       daddr_t   lfs_idaddr;           /* inode file disk address */
+       ino_t     lfs_ifile;            /* inode file inode number */
+       daddr_t   lfs_lastseg;          /* address of last segment written */
+       daddr_t   lfs_nextseg;          /* address of next segment to write */
+       daddr_t   lfs_curseg;           /* current segment being written */
+       daddr_t   lfs_offset;           /* offset in curseg for next partial */
+       daddr_t   lfs_lastpseg;         /* address of last partial written */
+       u_int32_t lfs_tstamp;           /* time stamp */
 
 /* These are configuration parameters. */
 
 /* These are configuration parameters. */
-       u_long  lfs_minfree;            /* minimum percentage of free blocks */
+       u_int32_t lfs_minfree;          /* minimum percentage of free blocks */
 
 /* These fields can be computed from the others. */
 
 /* These fields can be computed from the others. */
-       u_quad_t lfs_maxfilesize;       /* maximum representable file size */
-       u_long  lfs_dbpseg;             /* disk blocks per segment */
-       u_long  lfs_inopb;              /* inodes per block */
-       u_long  lfs_ifpb;               /* IFILE entries per block */
-       u_long  lfs_sepb;               /* SEGUSE entries per block */
-       u_long  lfs_nindir;             /* indirect pointers per block */
-       u_long  lfs_nseg;               /* number of segments */
-       u_long  lfs_nspf;               /* number of sectors per fragment */
-       u_long  lfs_cleansz;            /* cleaner info size in blocks */
-       u_long  lfs_segtabsz;           /* segment table size in blocks */
-
-       u_long  lfs_segmask;            /* calculate offset within a segment */
-       u_long  lfs_segshift;           /* fast mult/div for segments */
-       u_long  lfs_bmask;              /* calc block offset from file offset */
-       u_long  lfs_bshift;             /* calc block number from file offset */
-       u_long  lfs_ffmask;             /* calc frag offset from file offset */
-       u_long  lfs_ffshift;            /* fast mult/div for frag from file */
-       u_long  lfs_fbmask;             /* calc frag offset from block offset */
-       u_long  lfs_fbshift;            /* fast mult/div for frag from block */
-       u_long  lfs_fsbtodb;            /* fsbtodb and dbtofsb shift constant */
-       u_long  lfs_sushift;            /* fast mult/div for segusage table */
+       u_quad_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_int32_t lfs_bmask;            /* calc block offset from file offset */
+       u_int32_t lfs_bshift;           /* calc block number from file offset */
+       u_int32_t lfs_ffmask;           /* calc frag offset from file offset */
+       u_int32_t lfs_ffshift;          /* fast mult/div for frag from file */
+       u_int32_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 */
 
 #define        LFS_MIN_SBINTERVAL      5       /* minimum superblock segment spacing */
 #define        LFS_MAXNUMSB            10      /* superblock disk offsets */
-       daddr_t lfs_sboffs[LFS_MAXNUMSB];
+       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. */
 
 /* These fields are set at mount time and are meaningless on disk. */
-       struct  segment *lfs_sp;        /* current segment being written */
-       struct  vnode *lfs_ivnode;      /* vnode for the ifile */
-       u_long  lfs_seglock;            /* single-thread the segment writer */
-       pid_t   lfs_lockpid;            /* pid of lock holder */
-       u_long  lfs_iocount;            /* number of ios pending */
-       u_long  lfs_writer;             /* don't allow any dirops to start */
-       u_long  lfs_dirops;             /* count of active directory ops */
-       u_long  lfs_doifile;            /* Write ifile blocks on next write */
-       u_long  lfs_nactive;            /* Number of segments since last ckp */
-       u_char  lfs_fmod;               /* super block modified flag */
-       u_char  lfs_clean;              /* file system is clean flag */
-       u_char  lfs_ronly;              /* mounted read-only flag */
-       u_char  lfs_flags;              /* currently unused flag */
-       u_char  lfs_fsmnt[MNAMELEN];    /* name mounted on */
-       u_char  pad[3];                 /* long-align */
-
-/* Checksum; valid on disk. */
-       u_long  lfs_cksum;              /* checksum for superblock checking */
-       long    lfs_maxsymlinklen;      /* max length of an internal symlink */
+       struct segment *lfs_sp;         /* current segment being written */
+       struct vnode *lfs_ivnode;       /* vnode for the ifile */
+       u_long    lfs_seglock;          /* single-thread the segment writer */
+       pid_t     lfs_lockpid;          /* pid of lock holder */
+       u_long    lfs_iocount;          /* number of ios pending */
+       u_long    lfs_writer;           /* don't allow any dirops to start */
+       u_long    lfs_dirops;           /* count of active directory ops */
+       u_long    lfs_doifile;          /* Write ifile blocks on next write */
+       u_long    lfs_nactive;          /* Number of segments since last ckp */
+       int8_t    lfs_fmod;             /* super block modified flag */
+       int8_t    lfs_clean;            /* file system is clean flag */
+       int8_t    lfs_ronly;            /* mounted read-only flag */
+       int8_t    lfs_flags;            /* currently unused flag */
+       u_char    lfs_fsmnt[MNAMELEN];  /* name mounted on */
 };
 
 /*
 };
 
 /*
- * Inode 0 is the out-of-band inode number, inode 1 is the inode number for
- * the IFILE, the root inode is 2 and the lost+found inode is 3.
+ * Inode 0:    out-of-band inode number
+ * Inode 1:    IFILE inode number
+ * Inode 2:    root inode
+ * Inode 3:    lost+found inode number
  */
  */
-
-/* Fixed inode numbers. */
 #define        LFS_UNUSED_INUM 0               /* out of band inode number */
 #define        LFS_IFILE_INUM  1               /* IFILE inode number */
 #define        LOSTFOUNDINO    3               /* lost+found inode number */
 #define        LFS_UNUSED_INUM 0               /* out of band inode number */
 #define        LFS_IFILE_INUM  1               /* IFILE inode number */
 #define        LOSTFOUNDINO    3               /* lost+found inode number */
@@ -157,10 +158,10 @@ struct lfs {
 
 typedef struct ifile IFILE;
 struct ifile {
 
 typedef struct ifile IFILE;
 struct ifile {
-       u_long  if_version;             /* inode version number */
+       u_int32_t if_version;           /* inode version number */
 #define        LFS_UNUSED_DADDR        0       /* out-of-band daddr */
 #define        LFS_UNUSED_DADDR        0       /* out-of-band daddr */
-       daddr_t if_daddr;               /* inode disk address */
-       ino_t   if_nextfree;            /* next-unallocated inode */
+       daddr_t   if_daddr;             /* inode disk address */
+       ino_t     if_nextfree;          /* next-unallocated inode */
 };
 
 /*
 };
 
 /*
@@ -168,8 +169,8 @@ struct ifile {
  * to pass information between the cleaner and the kernel.
  */
 typedef struct _cleanerinfo {
  * to pass information between the cleaner and the kernel.
  */
 typedef struct _cleanerinfo {
-       u_long  clean;                  /* K: number of clean segments */
-       u_long  dirty;                  /* K: number of dirty segments */
+       u_int32_t clean;                /* K: number of clean segments */
+       u_int32_t dirty;                /* K: number of dirty segments */
 } CLEANERINFO;
 
 #define        CLEANSIZE_SU(fs)                                                \
 } CLEANERINFO;
 
 #define        CLEANSIZE_SU(fs)                                                \
@@ -184,16 +185,17 @@ typedef struct _cleanerinfo {
 /* On-disk segment summary information */
 typedef struct segsum SEGSUM;
 struct segsum {
 /* On-disk segment summary information */
 typedef struct segsum SEGSUM;
 struct segsum {
-       u_long  ss_sumsum;              /* check sum of summary block */
-       u_long  ss_datasum;             /* check sum of data */
-       daddr_t ss_next;                /* next segment */
-       u_long  ss_create;              /* creation time stamp */
-       u_short ss_nfinfo;              /* number of file info structures */
-       u_short ss_ninos;               /* number of inodes in summary */
+       u_int32_t ss_sumsum;            /* check sum of summary block */
+       u_int32_t ss_datasum;           /* check sum of data */
+       daddr_t   ss_next;              /* next segment */
+       u_int32_t ss_create;            /* creation time stamp */
+       u_int16_t ss_nfinfo;            /* number of file info structures */
+       u_int16_t ss_ninos;             /* number of inodes in summary */
+
 #define        SS_DIROP        0x01            /* segment begins a dirop */
 #define        SS_CONT         0x02            /* more partials to finish this write*/
 #define        SS_DIROP        0x01            /* segment begins a dirop */
 #define        SS_CONT         0x02            /* more partials to finish this write*/
-       u_short ss_flags;               /* used for directory operations */
-       u_short ss_pad;                 /* extra space */
+       u_int16_t ss_flags;             /* used for directory operations */
+       u_int16_t ss_pad;               /* extra space */
        /* FINFO's and inode daddr's... */
 };
 
        /* FINFO's and inode daddr's... */
 };
 
@@ -256,8 +258,8 @@ struct segsum {
  * the segment usage table, plus an ifile page.
  */
 #define LFS_FITS(fs, db)                                               \
  * the segment usage table, plus an ifile page.
  */
 #define LFS_FITS(fs, db)                                               \
-       ((long)((db + ((fs)->lfs_uinodes + INOPB((fs))) / INOPB((fs)) + \
-       fsbtodb(fs, 1) + LFS_SUMMARY_SIZE / DEV_BSIZE +                 \
+       ((int32_t)((db + ((fs)->lfs_uinodes + INOPB((fs))) /            \
+       INOPB((fs)) + fsbtodb(fs, 1) + LFS_SUMMARY_SIZE / DEV_BSIZE +   \
        (fs)->lfs_segtabsz)) < (fs)->lfs_avail)
 
 /* Determine if a buffer belongs to the ifile */
        (fs)->lfs_segtabsz)) < (fs)->lfs_avail)
 
 /* Determine if a buffer belongs to the ifile */
@@ -278,23 +280,24 @@ typedef struct block_info {
 
 /* In-memory description of a segment about to be written. */
 struct segment {
 
 /* In-memory description of a segment about to be written. */
 struct segment {
-       struct lfs      *fs;            /* file system pointer */
+       struct lfs       *fs;           /* file system pointer */
        struct buf      **bpp;          /* pointer to buffer array */
        struct buf      **cbpp;         /* pointer to next available bp */
        struct buf      **start_bpp;    /* pointer to first bp in this set */
        struct buf      **bpp;          /* pointer to buffer array */
        struct buf      **cbpp;         /* pointer to next available bp */
        struct buf      **start_bpp;    /* pointer to first bp in this set */
-       struct buf      *ibp;           /* buffer pointer to inode page */
-       struct finfo    *fip;           /* current fileinfo pointer */
-       struct vnode    *vp;            /* vnode being gathered */
-       void    *segsum;                /* segment summary info */
-       u_long  ninodes;                /* number of inodes in this segment */
-       u_long  seg_bytes_left;         /* bytes left in segment */
-       u_long  sum_bytes_left;         /* bytes left in summary block */
-       u_long  seg_number;             /* number of this segment */
-       daddr_t *start_lbp;             /* beginning lbn for this set */
+       struct buf       *ibp;          /* buffer pointer to inode page */
+       struct finfo     *fip;          /* current fileinfo pointer */
+       struct vnode     *vp;           /* vnode being gathered */
+       void     *segsum;               /* segment summary info */
+       u_int32_t ninodes;              /* number of inodes in this segment */
+       u_int32_t seg_bytes_left;       /* bytes left in segment */
+       u_int32_t sum_bytes_left;       /* bytes left in summary block */
+       u_int32_t seg_number;           /* number of this segment */
+       daddr_t  *start_lbp;            /* beginning lbn for this set */
+
 #define        SEGM_CKP        0x01            /* doing a checkpoint */
 #define        SEGM_CLEAN      0x02            /* cleaner call; don't sort */
 #define        SEGM_SYNC       0x04            /* wait for segment */
 #define        SEGM_CKP        0x01            /* doing a checkpoint */
 #define        SEGM_CLEAN      0x02            /* cleaner call; don't sort */
 #define        SEGM_SYNC       0x04            /* wait for segment */
-       u_long  seg_flags;              /* run-time flags for this segment */
+       u_int16_t seg_flags;            /* run-time flags for this segment */
 };
 
 #define ISSPACE(F, BB, C)                                              \
 };
 
 #define ISSPACE(F, BB, C)                                              \
@@ -311,18 +314,18 @@ struct segment {
 #ifdef DOSTATS
 /* Statistics Counters */
 struct lfs_stats {
 #ifdef DOSTATS
 /* Statistics Counters */
 struct lfs_stats {
-       int     segsused;
-       int     psegwrites;
-       int     psyncwrites;
-       int     pcleanwrites;
-       int     blocktot;
-       int     cleanblocks;
-       int     ncheckpoints;
-       int     nwrites;
-       int     nsync_writes;
-       int     wait_exceeded;
-       int     write_exceeded;
-       int     flush_invoked;
+       u_int   segsused;
+       u_int   psegwrites;
+       u_int   psyncwrites;
+       u_int   pcleanwrites;
+       u_int   blocktot;
+       u_int   cleanblocks;
+       u_int   ncheckpoints;
+       u_int   nwrites;
+       u_int   nsync_writes;
+       u_int   wait_exceeded;
+       u_int   write_exceeded;
+       u_int   flush_invoked;
 };
 extern struct lfs_stats lfs_stats;
 #endif
 };
 extern struct lfs_stats lfs_stats;
 #endif
index f7cad98..4553690 100644 (file)
@@ -9,7 +9,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)dinode.h    8.3 (Berkeley) %G%
+ *     @(#)dinode.h    8.4 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
 #define        NIADDR  3                       /* Indirect addresses in inode. */
 
 struct dinode {
 #define        NIADDR  3                       /* Indirect addresses in inode. */
 
 struct dinode {
-       u_short         di_mode;        /*   0: IFMT and permissions. */
-       short           di_nlink;       /*   2: File link count. */
+       u_int16_t       di_mode;        /*   0: IFMT, permissions; see below. */
+       int16_t         di_nlink;       /*   2: File link count. */
        union {
        union {
-               u_short oldids[2];      /*   4: Ffs: old user and group ids. */
-               ino_t   inumber;        /*   4: Lfs: inode number. */
+               u_int16_t oldids[2];    /*   4: Ffs: old user and group ids. */
+               ino_t     inumber;      /*   4: Lfs: inode number. */
        } di_u;
        u_quad_t        di_size;        /*   8: File byte count. */
        struct timespec di_atime;       /*  16: Last access time. */
        } di_u;
        u_quad_t        di_size;        /*   8: File byte count. */
        struct timespec di_atime;       /*  16: Last access time. */
@@ -41,12 +41,12 @@ struct dinode {
        struct timespec di_ctime;       /*  32: Last inode change time. */
        daddr_t         di_db[NDADDR];  /*  40: Direct disk blocks. */
        daddr_t         di_ib[NIADDR];  /*  88: Indirect disk blocks. */
        struct timespec di_ctime;       /*  32: Last inode change time. */
        daddr_t         di_db[NDADDR];  /*  40: Direct disk blocks. */
        daddr_t         di_ib[NIADDR];  /*  88: Indirect disk blocks. */
-       u_long          di_flags;       /* 100: Status flags (chflags). */
-       long            di_blocks;      /* 104: Blocks actually held. */
-       long            di_gen;         /* 108: Generation number. */
-       u_long          di_uid;         /* 112: File owner. */
-       u_long          di_gid;         /* 116: File group. */
-       long            di_spare[2];    /* 120: Reserved; currently unused */
+       u_int32_t       di_flags;       /* 100: Status flags (chflags). */
+       int32_t         di_blocks;      /* 104: Blocks actually held. */
+       int32_t         di_gen;         /* 108: Generation number. */
+       u_int32_t       di_uid;         /* 112: File owner. */
+       u_int32_t       di_gid;         /* 116: File group. */
+       int32_t         di_spare[2];    /* 120: Reserved; currently unused */
 };
 
 /*
 };
 
 /*
@@ -63,7 +63,7 @@ struct dinode {
 #define        di_shortlink    di_db
 #define        MAXSYMLINKLEN   ((NDADDR + NIADDR) * sizeof(daddr_t))
 
 #define        di_shortlink    di_db
 #define        MAXSYMLINKLEN   ((NDADDR + NIADDR) * sizeof(daddr_t))
 
-/* File modes. */
+/* File permissions. */
 #define        IEXEC           0000100         /* Executable. */
 #define        IWRITE          0000200         /* Writeable. */
 #define        IREAD           0000400         /* Readable. */
 #define        IEXEC           0000100         /* Executable. */
 #define        IWRITE          0000200         /* Writeable. */
 #define        IREAD           0000400         /* Readable. */
index 68145b4..1d4eeaf 100644 (file)
@@ -9,7 +9,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)dir.h       8.2 (Berkeley) %G%
+ *     @(#)dir.h       8.3 (Berkeley) %G%
  */
 
 #ifndef _DIR_H_
  */
 
 #ifndef _DIR_H_
 #define        MAXNAMLEN       255
 
 struct direct {
 #define        MAXNAMLEN       255
 
 struct direct {
-       u_long  d_ino;                  /* inode number of entry */
-       u_short d_reclen;               /* length of this record */
-       u_char  d_type;                 /* file type, see below */
-       u_char  d_namlen;               /* length of string in d_name */
-       char    d_name[MAXNAMLEN + 1];  /* name with length <= MAXNAMLEN */
+       u_int32_t d_ino;                /* inode number of entry */
+       u_int16_t d_reclen;             /* length of this record */
+       u_int8_t  d_type;               /* file type, see below */
+       u_int8_t  d_namlen;             /* length of string in d_name */
+       char      d_name[MAXNAMLEN + 1];/* name with length <= MAXNAMLEN */
 };
 
 /*
 };
 
 /*
@@ -78,44 +78,43 @@ struct      direct {
 #if (BYTE_ORDER == LITTLE_ENDIAN)
 #define DIRSIZ(oldfmt, dp) \
     ((oldfmt) ? \
 #if (BYTE_ORDER == LITTLE_ENDIAN)
 #define DIRSIZ(oldfmt, dp) \
     ((oldfmt) ? \
-    ((sizeof (struct direct) - (MAXNAMLEN+1)) + (((dp)->d_type+1 + 3) &~ 3)) : \
-    ((sizeof (struct direct) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3)))
+    ((sizeof(struct direct) - (MAXNAMLEN+1)) + (((dp)->d_type+1 + 3) &~ 3)) : \
+    ((sizeof(struct direct) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3)))
 #else
 #define DIRSIZ(oldfmt, dp) \
 #else
 #define DIRSIZ(oldfmt, dp) \
-    ((sizeof (struct direct) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3))
+    ((sizeof(struct direct) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3))
 #endif
 #define OLDDIRFMT      1
 #define NEWDIRFMT      0
 
 /*
 #endif
 #define OLDDIRFMT      1
 #define NEWDIRFMT      0
 
 /*
- * Template for manipulating directories.
- * Should use struct direct's, but the name field
- * is MAXNAMLEN - 1, and this just won't do.
+ * Template for manipulating directories.  Should use struct direct's,
+ * but the name field is MAXNAMLEN - 1, and this just won't do.
  */
 struct dirtemplate {
  */
 struct dirtemplate {
-       u_long  dot_ino;
-       short   dot_reclen;
-       u_char  dot_type;
-       u_char  dot_namlen;
-       char    dot_name[4];            /* must be multiple of 4 */
-       u_long  dotdot_ino;
-       short   dotdot_reclen;
-       u_char  dotdot_type;
-       u_char  dotdot_namlen;
-       char    dotdot_name[4];         /* ditto */
+       u_int32_t       dot_ino;
+       int16_t         dot_reclen;
+       u_int8_t        dot_type;
+       u_int8_t        dot_namlen;
+       char            dot_name[4];    /* must be multiple of 4 */
+       u_int32_t       dotdot_ino;
+       int16_t         dotdot_reclen;
+       u_int8_t        dotdot_type;
+       u_int8_t        dotdot_namlen;
+       char            dotdot_name[4]; /* ditto */
 };
 
 /*
  * This is the old format of directories, sanz type element.
  */
 struct odirtemplate {
 };
 
 /*
  * This is the old format of directories, sanz type element.
  */
 struct odirtemplate {
-       u_long  dot_ino;
-       short   dot_reclen;
-       u_short dot_namlen;
-       char    dot_name[4];            /* must be multiple of 4 */
-       u_long  dotdot_ino;
-       short   dotdot_reclen;
-       u_short dotdot_namlen;
-       char    dotdot_name[4];         /* ditto */
+       u_int32_t       dot_ino;
+       int16_t         dot_reclen;
+       u_int16_t       dot_namlen;
+       char            dot_name[4];    /* must be multiple of 4 */
+       u_int32_t       dotdot_ino;
+       int16_t         dotdot_reclen;
+       u_int16_t       dotdot_namlen;
+       char            dotdot_name[4]; /* ditto */
 };
 #endif /* !_DIR_H_ */
 };
 #endif /* !_DIR_H_ */
index 039fd8c..4489485 100644 (file)
@@ -9,59 +9,57 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)inode.h     8.4 (Berkeley) %G%
+ *     @(#)inode.h     8.5 (Berkeley) %G%
  */
 
 #include <ufs/ufs/dinode.h>
 
 /*
  * Theoretically, directories can be more than 2Gb in length, however, in
  */
 
 #include <ufs/ufs/dinode.h>
 
 /*
  * Theoretically, directories can be more than 2Gb in length, however, in
- * practice this seems unlikely. So, we define the type doff_t as a long
- * to keep down the cost of doing lookup on a 32-bit machine. If you are
- * porting to a 64-bit architecture, you should make doff_t the same as off_t.
+ * practice this seems unlikely. So, we define the type doff_t as a 32-bit
+ * quantity to keep down the cost of doing lookup on a 32-bit machine.
  */
  */
-#define        doff_t  long
+#define        doff_t  int32_t
 
 /*
 
 /*
- * The inode is used to describe each active (or recently active)
- * file in the UFS filesystem. It is composed of two types of
- * information. The first part is the information that is needed
- * only while the file is active (such as the identity of the file
- * and linkage to speed its lookup). The second part is the 
- * permannent meta-data associated with the file which is read
- * in from the permanent dinode from long term storage when the
- * file becomes active, and is put back when the file is no longer
- * being used.
+ * The inode is used to describe each active (or recently active) file in the
+ * UFS filesystem. It is composed of two types of information. The first part
+ * is the information that is needed only while the file is active (such as
+ * the identity of the file and linkage to speed its lookup). The second part
+ * is * the permanent meta-data associated with the file which is read in
+ * from the permanent dinode from long term storage when the file becomes
+ * active, and is put back when the file is no longer being used.
  */
 struct inode {
  */
 struct inode {
-       struct  inode *i_next;  /* Hash chain forward. */
+       struct  inode  *i_next; /* Hash chain forward. */
        struct  inode **i_prev; /* Hash chain back. */
        struct  inode **i_prev; /* Hash chain back. */
-       struct  vnode *i_vnode; /* Vnode associated with this inode. */
-       struct  vnode *i_devvp; /* Vnode for block I/O. */
-       u_long  i_flag;         /* I* flags. */
-       dev_t   i_dev;          /* Device associated with the inode. */
-       ino_t   i_number;       /* The identity of the inode. */
+       struct  vnode  *i_vnode;/* Vnode associated with this inode. */
+       struct  vnode  *i_devvp;/* Vnode for block I/O. */
+       u_int32_t i_flag;       /* flags, see below */
+       dev_t     i_dev;        /* Device associated with the inode. */
+       ino_t     i_number;     /* The identity of the inode. */
+
        union {                 /* Associated filesystem. */
                struct  fs *fs;         /* FFS */
                struct  lfs *lfs;       /* LFS */
        } inode_u;
 #define        i_fs    inode_u.fs
 #define        i_lfs   inode_u.lfs
        union {                 /* Associated filesystem. */
                struct  fs *fs;         /* FFS */
                struct  lfs *lfs;       /* LFS */
        } inode_u;
 #define        i_fs    inode_u.fs
 #define        i_lfs   inode_u.lfs
-       struct  dquot *i_dquot[MAXQUOTAS];      /* Dquot structures. */
-       u_quad_t i_modrev;      /* Revision level for lease. */
-       struct  lockf *i_lockf; /* Head of byte-level lock list. */
-       pid_t   i_lockholder;   /* DEBUG: holder of inode lock. */
-       pid_t   i_lockwaiter;   /* DEBUG: latest blocked for inode lock. */
+
+       struct   dquot *i_dquot[MAXQUOTAS]; /* Dquot structures. */
+       u_quad_t i_modrev;      /* Revision level for NFS lease. */
+       struct   lockf *i_lockf;/* Head of byte-level lock list. */
+       pid_t    i_lockholder;  /* DEBUG: holder of inode lock. */
+       pid_t    i_lockwaiter;  /* DEBUG: latest blocked for inode lock. */
        /*
         * Side effects; used during directory lookup.
         */
        /*
         * Side effects; used during directory lookup.
         */
-       long    i_count;        /* Size of free slot in directory. */
-       doff_t  i_endoff;       /* End of useful stuff in directory. */
-       doff_t  i_diroff;       /* Offset in dir, where we found last entry. */
-       doff_t  i_offset;       /* Offset of free space in directory. */
-       ino_t   i_ino;          /* Inode number of found directory. */
-       u_long  i_reclen;       /* Size of found directory entry. */
-       long    i_spare[11];    /* Spares to round up to 128 bytes. */
+       int32_t   i_count;      /* Size of free slot in directory. */
+       doff_t    i_endoff;     /* End of useful stuff in directory. */
+       doff_t    i_diroff;     /* Offset in dir, where we found last entry. */
+       doff_t    i_offset;     /* Offset of free space in directory. */
+       ino_t     i_ino;        /* Inode number of found directory. */
+       u_int32_t i_reclen;     /* Size of found directory entry. */
        /*
         * The on-disk dinode itself.
         */
        /*
         * The on-disk dinode itself.
         */
@@ -128,9 +126,9 @@ struct indir {
 
 /* This overlays the fid structure (see mount.h). */
 struct ufid {
 
 /* This overlays the fid structure (see mount.h). */
 struct ufid {
-       u_short ufid_len;       /* Length of structure. */
-       u_short ufid_pad;       /* Force long alignment. */
-       ino_t   ufid_ino;       /* File number (ino). */
-       long    ufid_gen;       /* Generation number. */
+       u_int16_t ufid_len;     /* Length of structure. */
+       u_int16_t ufid_pad;     /* Force 32-bit alignment. */
+       ino_t     ufid_ino;     /* File number (ino). */
+       int32_t   ufid_gen;     /* Generation number. */
 };
 #endif /* KERNEL */
 };
 #endif /* KERNEL */
index db96d1f..071ae7a 100644 (file)
@@ -7,7 +7,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)quota.h     8.1 (Berkeley) %G%
+ *     @(#)quota.h     8.2 (Berkeley) %G%
  */
 
 #ifndef _QUOTA_
  */
 
 #ifndef _QUOTA_
@@ -22,8 +22,8 @@
  * failure). The timer is started when the user crosses their soft limit, it
  * is reset when they go below their soft limit.
  */
  * failure). The timer is started when the user crosses their soft limit, it
  * is reset when they go below their soft limit.
  */
-#define        MAX_IQ_TIME     (7*24*60*60)    /* 1 week */
-#define        MAX_DQ_TIME     (7*24*60*60)    /* 1 week */
+#define        MAX_IQ_TIME     (7*24*60*60)    /* seconds in 1 week */
+#define        MAX_DQ_TIME     (7*24*60*60)    /* seconds in 1 week */
 
 /*
  * The following constants define the usage of the quota file array in the
 
 /*
  * The following constants define the usage of the quota file array in the
  * the vnode for each quota file (a pointer is retained in the ufsmount
  * structure).
  */
  * the vnode for each quota file (a pointer is retained in the ufsmount
  * structure).
  */
-struct dqblk {
-       u_long  dqb_bhardlimit; /* absolute limit on disk blks alloc */
-       u_long  dqb_bsoftlimit; /* preferred limit on disk blks */
-       u_long  dqb_curblocks;  /* current block count */
-       u_long  dqb_ihardlimit; /* maximum # allocated inodes + 1 */
-       u_long  dqb_isoftlimit; /* preferred inode limit */
-       u_long  dqb_curinodes;  /* current # allocated inodes */
-       time_t  dqb_btime;      /* time limit for excessive disk use */
-       time_t  dqb_itime;      /* time limit for excessive files */
+struct dqblk {
+       u_int32_t dqb_bhardlimit;       /* absolute limit on disk blks alloc */
+       u_int32_t dqb_bsoftlimit;       /* preferred limit on disk blks */
+       u_int32_t dqb_curblocks;        /* current block count */
+       u_int32_t dqb_ihardlimit;       /* maximum # allocated inodes + 1 */
+       u_int32_t dqb_isoftlimit;       /* preferred inode limit */
+       u_int32_t dqb_curinodes;        /* current # allocated inodes */
+       time_t    dqb_btime;            /* time limit for excessive disk use */
+       time_t    dqb_itime;            /* time limit for excessive files */
 };
 
 /*
 };
 
 /*
@@ -87,14 +87,14 @@ struct      dqblk {
  * filesystem for the current user or group. A cache is kept of recently
  * used entries.
  */
  * filesystem for the current user or group. A cache is kept of recently
  * used entries.
  */
-struct dquot {
-       struct  dquot *dq_forw, **dq_back; /* hash list */
-       struct  dquot *dq_freef, **dq_freeb; /* free list */
-       short   dq_flags;               /* flags, see below */
-       short   dq_cnt;                 /* count of active references */
-       short   dq_spare;               /* unused spare padding */
-       short   dq_type;                /* quota type of this dquot */
-       u_long  dq_id;                  /* identifier this applies to */
+struct dquot {
+       struct  dquot *dq_forw, **dq_back;      /* hash list */
+       struct  dquot *dq_freef, **dq_freeb;    /* free list */
+       u_int16_t dq_flags;             /* flags, see below */
+       u_int16_t dq_cnt;               /* count of active references */
+       u_int16_t dq_spare;             /* unused spare padding */
+       u_int16_t dq_type;              /* quota type of this dquot */
+       u_int32_t dq_id;                /* identifier this applies to */
        struct  ufsmount *dq_ump;       /* filesystem that this is taken from */
        struct  dqblk dq_dqb;           /* actual usage & quotas */
 };
        struct  ufsmount *dq_ump;       /* filesystem that this is taken from */
        struct  dqblk dq_dqb;           /* actual usage & quotas */
 };
@@ -120,11 +120,11 @@ struct    dquot {
 #define        dq_itime        dq_dqb.dqb_itime
 
 /*
 #define        dq_itime        dq_dqb.dqb_itime
 
 /*
- * If the system has never checked for a quota for this file, then it is set
- * to NODQUOT.  Once a write attempt is made the inode pointer is set to
- * reference a dquot structure.
+ * If the system has never checked for a quota for this file, then it is
+ * set to NODQUOT.  Once a write attempt is made the inode pointer is set
+ * to reference a dquot structure.
  */
  */
-#define        NODQUOT         ((struct dquot *) 0)
+#define        NODQUOT         NULL
 
 /*
  * Flags to chkdq() and chkiq()
 
 /*
  * Flags to chkdq() and chkiq()
index 4d6e525..06d830b 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)ufsmount.h  8.2 (Berkeley) %G%
+ *     @(#)ufsmount.h  8.3 (Berkeley) %G%
  */
 
 struct buf;
  */
 
 struct buf;
@@ -21,12 +21,14 @@ struct ufsmount {
        struct  mount *um_mountp;               /* filesystem vfs structure */
        dev_t   um_dev;                         /* device mounted */
        struct  vnode *um_devvp;                /* block device mounted vnode */
        struct  mount *um_mountp;               /* filesystem vfs structure */
        dev_t   um_dev;                         /* device mounted */
        struct  vnode *um_devvp;                /* block device mounted vnode */
+
        union {                                 /* pointer to superblock */
                struct  lfs *lfs;               /* LFS */
                struct  fs *fs;                 /* FFS */
        } ufsmount_u;
 #define        um_fs   ufsmount_u.fs
 #define        um_lfs  ufsmount_u.lfs
        union {                                 /* pointer to superblock */
                struct  lfs *lfs;               /* LFS */
                struct  fs *fs;                 /* FFS */
        } ufsmount_u;
 #define        um_fs   ufsmount_u.fs
 #define        um_lfs  ufsmount_u.lfs
+
        struct  vnode *um_quotas[MAXQUOTAS];    /* pointer to quota files */
        struct  ucred *um_cred[MAXQUOTAS];      /* quota file access cred */
        u_long  um_nindir;                      /* indirect ptrs per block */
        struct  vnode *um_quotas[MAXQUOTAS];    /* pointer to quota files */
        struct  ucred *um_cred[MAXQUOTAS];      /* quota file access cred */
        u_long  um_nindir;                      /* indirect ptrs per block */
@@ -37,6 +39,7 @@ struct ufsmount {
        char    um_qflags[MAXQUOTAS];           /* quota specific flags */
        struct  netexport um_export;            /* export information */
 };
        char    um_qflags[MAXQUOTAS];           /* quota specific flags */
        struct  netexport um_export;            /* export information */
 };
+
 /*
  * Flags describing the state of quotas.
  */
 /*
  * Flags describing the state of quotas.
  */
@@ -50,8 +53,6 @@ struct ufsmount {
  * Macros to access file system parameters in the ufsmount structure.
  * Used by ufs_bmap.
  */
  * Macros to access file system parameters in the ufsmount structure.
  * Used by ufs_bmap.
  */
-#define        blkptrtodb(ump, b)      ((b) << (ump)->um_bptrtodb)
-#define        is_sequential(ump, a, b) ((b) == (a) + ump->um_seqinc)
-#define MNINDIR(ump)   ((ump)->um_nindir)
-
-
+#define MNINDIR(ump)                   ((ump)->um_nindir)
+#define        blkptrtodb(ump, b)              ((b) << (ump)->um_bptrtodb)
+#define        is_sequential(ump, a, b)        ((b) == (a) + ump->um_seqinc)