summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael I. Bushnell <mib@gnu.org>1994-07-14 17:06:33 +0000
committerMichael I. Bushnell <mib@gnu.org>1994-07-14 17:06:33 +0000
commitdaa8dda4b2d8e8f96552a43d39f24843a9197844 (patch)
treecc1c879a1f893112de46c76ca7b19b5707d3e15e
parentd60cca507408625cc8adbdf18f0c14eb662717ee (diff)
Formerly dinode.h.~2~
-rw-r--r--ufs/dinode.h202
1 files changed, 94 insertions, 108 deletions
diff --git a/ufs/dinode.h b/ufs/dinode.h
index dfde2050..5b9915d9 100644
--- a/ufs/dinode.h
+++ b/ufs/dinode.h
@@ -1,122 +1,108 @@
-/* Format of an inode on disk
- Copyright (C) 1991, 1993 Free Software Foundation
-
-This file is part of the GNU Hurd.
-
-The GNU Hurd is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-The GNU Hurd is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with the GNU Hurd; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* Modified from UCB by Michael I. Bushnell. */
-
/*
- * 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.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * 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.
*
- * Redistribution is only permitted until one year after the first shipment
- * of 4.4BSD by the Regents. Otherwise, redistribution and use in source and
- * binary forms are permitted provided that: (1) source distributions retain
- * this entire copyright notice and comment, and (2) distributions including
- * binaries display the following acknowledgement: This product includes
- * software developed by the University of California, Berkeley and its
- * contributors'' in the documentation or other materials provided with the
- * distribution and in all advertising materials mentioning features or use
- * of this software. 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.
- * 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.
+ * 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 7.9 (Berkeley) 6/28/90
+ * @(#)dinode.h 8.3 (Berkeley) 1/21/94
*/
/*
- * 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)
-#define NDADDR 12 /* direct addresses in inode */
-#define NIADDR 3 /* indirect addresses in inode */
+/*
+ * A dinode contains all the meta-data associated with a UFS file.
+ * This structure defines the on-disk format of a dinode.
+ */
-/* Indexes into di_ib */
-#define INDIR_SINGLE 0
-#define INDIR_DOUBLE 1
-#define INDIR_TRIPLE 2 /* NOT SUPPORTED */
+#define NDADDR 12 /* Direct addresses in inode. */
+#define NIADDR 3 /* Indirect addresses in inode. */
struct dinode {
- u_short di_model; /* 0: mode and type of file (low bits) */
- nlink_t di_nlink; /* 2: number of links to file */
- u_short di_uidl; /* 4: owner's user id (low bits) */
- u_short di_gidl; /* 6: owner's group id (low bits) */
- u_quad di_qsize; /* 8: number of bytes in file */
- time_t di_atime; /* 16: time last accessed */
- long di_atusec;
- time_t di_mtime; /* 24: time last modified */
- long di_mtusec;
- time_t di_ctime; /* 32: last time inode changed */
- long di_ctusec;
- daddr_t di_db[NDADDR]; /* 40: disk block addresses */
- daddr_t di_ib[NIADDR]; /* 88: indirect blocks */
- long di_flags; /* 100: status, currently unused */
- long di_blocks; /* 104: blocks actually held */
- long di_gen; /* 108: generation number */
- long di_trans; /* 112: filesystem tranlator */
- uid_t di_author; /* 116: author id */
- u_short di_uidh; /* 120: user id (high bits) */
- u_short di_gidh; /* 122: group id (high bits) */
- u_short di_modeh; /* 124: mode (high bits) */
- short di_spare; /* 126: reserved, currently unused */
+ u_short di_mode; /* 0: IFMT and permissions. */
+ short di_nlink; /* 2: File link count. */
+ 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: File byte count. */
+ struct timespec di_atime; /* 16: Last access time. */
+ struct timespec di_mtime; /* 24: Last modified time. */
+ 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 */
};
-#define DI_UID(di) ((di)->di_uidl | ((int)(di)->di_uidh << 16))
-#define DI_GID(di) ((di)->di_gidl | ((int)(di)->di_gidh << 16))
-#define DI_MODE(di) ((di)->di_model | ((int)(di)->di_modeh << 16))
-
-#define LINK_MAX 32767 /* limited by width of nlink_t == 16 bits */
-
-#if BYTE_ORDER == LITTLE_ENDIAN || defined(tahoe) /* ugh! -- must be fixed */
-#define di_size di_qsize.val[0]
-#else /* BYTE_ORDER == BIG_ENDIAN */
-#define di_size di_qsize.val[1]
-#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_inumber di_u.inumber
+#define di_ogid di_u.oldids[1]
+#define di_ouid di_u.oldids[0]
#define di_rdev di_db[0]
-
-/* file modes -- these are known to match appropriate values in gnu/stat.h */
-#define IFMT 000000170000 /* type of file */
-#define IFIFO 000000010000 /* named pipe (fifo) */
-#define IFCHR 000000020000 /* character special */
-#define IFDIR 000000040000 /* directory */
-#define IFBLK 000000060000 /* block special */
-#define IFREG 000000100000 /* regular */
-#define IFLNK 000000120000 /* symbolic link */
-#define IFSOCK 000000140000 /* socket */
-
-#define ISPEC 000000607000 /* special user-changeable bits */
-#define INOCACHE 000000400000 /* don't cache contents */
-#define IUSEUNK 000000200000 /* use IUNK in pref to IKNOWN */
-#define ISUID 000000004000 /* set user id on execution */
-#define ISGID 000000002000 /* set group id on execution */
-#define ISVTX 000000001000 /* caching preference / append only dir */
-
-/* masks for various sets of permissions: */
-#define IOWNER 000000000700 /* owner of file */
-#define IGROUP 000000000070 /* group of file */
-#define IKNOWN 000000000007 /* anyone who possesses a uid */
-#define IUNKNOWN 000007000000 /* anyone who doesn't possess a uid */
-
-#define ISPARE 037770000000 /* unused (yet) */
-
-#define IREAD 0400 /* read, write, execute permissions */
-#define IWRITE 0200
-#define IEXEC 0100
-
+#define di_shortlink di_db
+#define MAXSYMLINKLEN ((NDADDR + NIADDR) * sizeof(daddr_t))
+
+/* File modes. */
+#define IEXEC 0000100 /* Executable. */
+#define IWRITE 0000200 /* Writeable. */
+#define IREAD 0000400 /* Readable. */
+#define ISVTX 0001000 /* Sticky bit. */
+#define ISGID 0002000 /* Set-gid. */
+#define ISUID 0004000 /* Set-uid. */
+
+/* File types. */
+#define IFMT 0170000 /* Mask of file type. */
+#define IFIFO 0010000 /* Named pipe (fifo). */
+#define IFCHR 0020000 /* Character device. */
+#define IFDIR 0040000 /* Directory file. */
+#define IFBLK 0060000 /* Block device. */
+#define IFREG 0100000 /* Regular file. */
+#define IFLNK 0120000 /* Symbolic link. */
+#define IFSOCK 0140000 /* UNIX domain socket. */