move ROOTINO here, so applications don't have to include ufsmount.h
[unix-history] / usr / src / sys / ufs / ffs / dinode.h
index dd34866..9dec869 100644 (file)
@@ -2,23 +2,22 @@
  * Copyright (c) 1982, 1989 The Regents of the University of California.
  * All rights reserved.
  *
  * Copyright (c) 1982, 1989 The Regents of the University of California.
  * All rights reserved.
  *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the University of California, Berkeley.  The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ * %sccs.include.redist.c%
  *
  *
- *     @(#)dinode.h    7.6 (Berkeley) %G%
+ *     @(#)dinode.h    7.12 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
- * This structure defines the on-disk format of an inode.
+ * The root inode is the root of the file system.  Inode 0 can't be used for
+ * normal purposes and historically bad blocks were linked to inode 1, thus
+ * the root inode is 2.  (Inode 1 is no longer used for this purpose, however
+ * numerous dump tapes make this assumption, so we are stuck with it).
+ */
+#define        ROOTINO ((ino_t)2)
+
+/*
+ * A dinode contains all the meta-data associated with a UFS file.
+ * This structure defines the on-disk format of a dinode.
  */
 
 #define        NDADDR  12              /* direct addresses in inode */
  */
 
 #define        NDADDR  12              /* direct addresses in inode */
@@ -29,7 +28,7 @@ struct dinode {
        short   di_nlink;       /*  2: number of links to file */
        uid_t   di_uid;         /*  4: owner's user id */
        gid_t   di_gid;         /*  6: owner's group id */
        short   di_nlink;       /*  2: number of links to file */
        uid_t   di_uid;         /*  4: owner's user id */
        gid_t   di_gid;         /*  6: owner's group id */
-       quad    di_qsize;       /*  8: number of bytes in file */
+       u_quad  di_qsize;       /*  8: number of bytes in file */
        time_t  di_atime;       /* 16: time last accessed */
        long    di_atspare;
        time_t  di_mtime;       /* 24: time last modified */
        time_t  di_atime;       /* 16: time last accessed */
        long    di_atspare;
        time_t  di_mtime;       /* 24: time last modified */
@@ -44,26 +43,31 @@ struct dinode {
        long    di_spare[4];    /* 112: reserved, currently unused */
 };
 
        long    di_spare[4];    /* 112: reserved, currently unused */
 };
 
-/* ugh! -- must be fixed */
-#if defined(vax) || defined(tahoe)
+#ifdef BYTE_ORDER
+#if BYTE_ORDER == LITTLE_ENDIAN || defined(tahoe) /* ugh! -- must be fixed */
 #define        di_size         di_qsize.val[0]
 #define        di_size         di_qsize.val[0]
-#else
+#else /* BYTE_ORDER == BIG_ENDIAN */
 #define        di_size         di_qsize.val[1]
 #endif
 #define        di_size         di_qsize.val[1]
 #endif
+#else
+#define        di_size         BYTE_ORDER_UNDEFINED
+#endif
+
 #define        di_rdev         di_db[0]
 
 /* file modes */
 #define        di_rdev         di_db[0]
 
 /* file modes */
-#define        IFMT            0170000         /* type of file */
-#define        IFCHR           0020000         /* character special */
+#define        IFMT            0170000         /* mask of file type */
+#define        IFIFO           0010000         /* named pipe (fifo) */
+#define        IFCHR           0020000         /* character special device */
 #define        IFDIR           0040000         /* directory */
 #define        IFDIR           0040000         /* directory */
-#define        IFBLK           0060000         /* block special */
-#define        IFREG           0100000         /* regular */
+#define        IFBLK           0060000         /* block special device */
+#define        IFREG           0100000         /* regular file */
 #define        IFLNK           0120000         /* symbolic link */
 #define        IFLNK           0120000         /* symbolic link */
-#define        IFSOCK          0140000         /* socket */
+#define        IFSOCK          0140000         /* UNIX domain socket */
 
 
-#define        ISUID           04000           /* set user id on execution */
-#define        ISGID           02000           /* set group id on execution */
-#define        ISVTX           01000           /* save swapped text even after use */
-#define        IREAD           0400            /* read, write, execute permissions */
-#define        IWRITE          0200
-#define        IEXEC           0100
+#define        ISUID           04000           /* set user identifier when exec'ing */
+#define        ISGID           02000           /* set group identifier when exec'ing */
+#define        ISVTX           01000           /* save execution information on exit */
+#define        IREAD           0400            /* read permission */
+#define        IWRITE          0200            /* write permission */
+#define        IEXEC           0100            /* execute permission */