Annotation of Net2/ufs/dinode.h, revision 1.1.1.2

1.1       root        1: /*
                      2:  * Copyright (c) 1982, 1989 The Regents of the University of California.
                      3:  * All rights reserved.
                      4:  *
                      5:  * Redistribution and use in source and binary forms, with or without
                      6:  * modification, are permitted provided that the following conditions
                      7:  * are met:
                      8:  * 1. Redistributions of source code must retain the above copyright
                      9:  *    notice, this list of conditions and the following disclaimer.
                     10:  * 2. Redistributions in binary form must reproduce the above copyright
                     11:  *    notice, this list of conditions and the following disclaimer in the
                     12:  *    documentation and/or other materials provided with the distribution.
                     13:  * 3. All advertising materials mentioning features or use of this software
                     14:  *    must display the following acknowledgement:
                     15:  *     This product includes software developed by the University of
                     16:  *     California, Berkeley and its contributors.
                     17:  * 4. Neither the name of the University nor the names of its contributors
                     18:  *    may be used to endorse or promote products derived from this software
                     19:  *    without specific prior written permission.
                     20:  *
                     21:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     22:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     23:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     24:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     25:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     26:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     27:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     28:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     29:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     30:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     31:  * SUCH DAMAGE.
                     32:  *
1.1.1.2 ! root       33:  *     from: @(#)dinode.h      7.10 (Berkeley) 5/8/91
        !            34:  *     dinode.h,v 1.7 1993/06/16 05:42:25 mycroft Exp
1.1       root       35:  */
                     36: 
1.1.1.2 ! root       37: #ifndef _UFS_DINODE_H_
        !            38: #define _UFS_DINODE_H_
        !            39: 
1.1       root       40: /*
                     41:  * A dinode contains all the meta-data associated with a UFS file.
                     42:  * This structure defines the on-disk format of a dinode.
                     43:  */
                     44: 
                     45: #define        NDADDR  12              /* direct addresses in inode */
                     46: #define        NIADDR  3               /* indirect addresses in inode */
                     47: 
1.1.1.2 ! root       48: #define        MAXFASTLINK     (((NDADDR+NIADDR) * sizeof(daddr_t)) - 1)
        !            49: 
1.1       root       50: struct dinode {
                     51:        u_short di_mode;        /*  0: mode and type of file */
                     52:        short   di_nlink;       /*  2: number of links to file */
                     53:        uid_t   di_uid;         /*  4: owner's user id */
                     54:        gid_t   di_gid;         /*  6: owner's group id */
                     55:        u_quad  di_qsize;       /*  8: number of bytes in file */
                     56:        time_t  di_atime;       /* 16: time last accessed */
                     57:        long    di_atspare;
                     58:        time_t  di_mtime;       /* 24: time last modified */
                     59:        long    di_mtspare;
                     60:        time_t  di_ctime;       /* 32: last time inode changed */
                     61:        long    di_ctspare;
1.1.1.2 ! root       62:        union {
        !            63:                struct {
        !            64:                        daddr_t di_udb[NDADDR]; /* 40: disk block addresses */
        !            65:                        daddr_t di_uib[NIADDR]; /* 88: indirect blocks */
        !            66:                } di_addr;
        !            67:                dev_t di_urdev;                 /* 40: device number */
        !            68:                char di_usymlink[MAXFASTLINK+1];/* 40: data for fast symlink */
        !            69:        } di_un;
1.1       root       70:        long    di_flags;       /* 100: status, currently unused */
                     71:        long    di_blocks;      /* 104: blocks actually held */
                     72:        long    di_gen;         /* 108: generation number */
1.1.1.2 ! root       73:        u_long  di_fsize;       /* 112: fast access (data in inode) size */
        !            74: #define        DI_SPARE_SZ     3               /* 116: spare for 4 longs */
        !            75:        u_long  di_spare[DI_SPARE_SZ];  /* reserved (unused) */
1.1       root       76: };
                     77: 
1.1.1.2 ! root       78: #define        di_db           di_un.di_addr.di_udb
        !            79: #define di_ib          di_un.di_addr.di_uib
        !            80: #define        di_symlink      di_un.di_usymlink
        !            81: 
1.1       root       82: #if BYTE_ORDER == LITTLE_ENDIAN || defined(tahoe) /* ugh! -- must be fixed */
                     83: #define        di_size         di_qsize.val[0]
                     84: #else /* BYTE_ORDER == BIG_ENDIAN */
                     85: #define        di_size         di_qsize.val[1]
                     86: #endif
1.1.1.2 ! root       87: #define        di_rdev         di_un.di_urdev
1.1       root       88: 
                     89: /* file modes */
                     90: #define        IFMT            0170000         /* mask of file type */
                     91: #define        IFIFO           0010000         /* named pipe (fifo) */
                     92: #define        IFCHR           0020000         /* character special device */
                     93: #define        IFDIR           0040000         /* directory */
                     94: #define        IFBLK           0060000         /* block special device */
                     95: #define        IFREG           0100000         /* regular file */
                     96: #define        IFLNK           0120000         /* symbolic link */
                     97: #define        IFSOCK          0140000         /* UNIX domain socket */
                     98: 
                     99: #define        ISUID           04000           /* set user identifier when exec'ing */
                    100: #define        ISGID           02000           /* set group identifier when exec'ing */
                    101: #define        ISVTX           01000           /* save execution information on exit */
                    102: #define        IREAD           0400            /* read permission */
                    103: #define        IWRITE          0200            /* write permission */
                    104: #define        IEXEC           0100            /* execute permission */
1.1.1.2 ! root      105: 
        !           106: #define        DFASTLINK(di) \
        !           107:        ((((di).di_mode & IFMT) == IFLNK) && \
        !           108:         ((di).di_size <= MAXFASTLINK) && \
        !           109:         ((di).di_size == (di).di_fsize))
        !           110: 
        !           111: #endif /* !_UFS_DINODE_H_ */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.