BSD 4_4 release
[unix-history] / usr / src / sys / ufs / ufs / dinode.h
index 3e9a07e..47a1ffc 100644 (file)
@@ -1,10 +1,36 @@
 /*
 /*
- * Copyright (c) 1982, 1989 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1982, 1989, 1993
+ *     The Regents of the University of California.  All rights reserved.
  *
  *
- * %sccs.include.redist.c%
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
  *
  *
- *     @(#)dinode.h    7.15 (Berkeley) %G%
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)dinode.h    8.1 (Berkeley) 6/11/93
  */
 
 /*
  */
 
 /*
 struct dinode {
        u_short         di_mode;        /*   0: mode and type of file */
        short           di_nlink;       /*   2: number of links to file */
 struct dinode {
        u_short         di_mode;        /*   0: mode and type of file */
        short           di_nlink;       /*   2: number of links to file */
-       u_short         di_ouid;        /*   4: old owner's user id */
-       u_short         di_ogid;        /*   6: old owner's group id */
-       u_quad_t        di_qsize;       /*   8: number of bytes in file */
+       union {
+               u_short oldids[2];      /*   4: ffs: old user and group ids */
+               ino_t   inumber;        /*   4: lfs: inode number */
+       } di_u;
+       u_quad_t        di_size;        /*   8: number of bytes in file */
        struct timespec di_atime;       /*  16: time last accessed */
        struct timespec di_mtime;       /*  24: time last modified */
        struct timespec di_ctime;       /*  32: last time inode changed */
        daddr_t         di_db[NDADDR];  /*  40: disk block addresses */
        daddr_t         di_ib[NIADDR];  /*  88: indirect blocks */
        struct timespec di_atime;       /*  16: time last accessed */
        struct timespec di_mtime;       /*  24: time last modified */
        struct timespec di_ctime;       /*  32: last time inode changed */
        daddr_t         di_db[NDADDR];  /*  40: disk block addresses */
        daddr_t         di_ib[NIADDR];  /*  88: indirect blocks */
-       long            di_flags;       /* 100: status, currently unused */
+       u_long          di_flags;       /* 100: status flags */
        long            di_blocks;      /* 104: blocks actually held */
        long            di_gen;         /* 108: generation number */
        u_long          di_uid;         /* 112: owner's user id */
        long            di_blocks;      /* 104: blocks actually held */
        long            di_gen;         /* 108: generation number */
        u_long          di_uid;         /* 112: owner's user id */
@@ -42,18 +70,19 @@ struct dinode {
        long            di_spare[2];    /* 120: reserved, currently unused */
 };
 
        long            di_spare[2];    /* 120: reserved, currently unused */
 };
 
-#ifdef _NOQUAD
-#define di_size        di_qsize.val[_QUAD_LOWWORD]
-#else
-#define di_size        di_qsize
-#endif
-
-#if defined(tahoe) /* ugh! -- must be fixed */
-#undef di_size
-#define        di_size         di_qsize.val[0]
-#endif
-
+/*
+ * The di_db fields may be overlaid with other information for
+ * file types that do not have associated disk storage. Block
+ * and character devices overlay the first data block with their
+ * dev_t value. Short symbolic links place their path in the
+ * di_db area.
+ */
+#define        di_ouid         di_u.oldids[0]
+#define        di_ogid         di_u.oldids[1]
+#define        di_inumber      di_u.inumber
 #define        di_rdev         di_db[0]
 #define        di_rdev         di_db[0]
+#define di_shortlink   di_db
+#define        MAXSYMLINKLEN   ((NDADDR + NIADDR) * sizeof(daddr_t))
 
 /* file modes */
 #define        IFMT            0170000         /* mask of file type */
 
 /* file modes */
 #define        IFMT            0170000         /* mask of file type */