Annotation of 43BSDReno/sys/ufs/quota.h, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1982, 1986 Regents of the University of California.
        !             3:  * All rights reserved.
        !             4:  *
        !             5:  * This code is derived from software contributed to Berkeley by
        !             6:  * Robert Elz at The University of Melbourne.
        !             7:  *
        !             8:  * Redistribution is only permitted until one year after the first shipment
        !             9:  * of 4.4BSD by the Regents.  Otherwise, redistribution and use in source and
        !            10:  * binary forms are permitted provided that: (1) source distributions retain
        !            11:  * this entire copyright notice and comment, and (2) distributions including
        !            12:  * binaries display the following acknowledgement:  This product includes
        !            13:  * software developed by the University of California, Berkeley and its
        !            14:  * contributors'' in the documentation or other materials provided with the
        !            15:  * distribution and in all advertising materials mentioning features or use
        !            16:  * of this software.  Neither the name of the University nor the names of
        !            17:  * its contributors may be used to endorse or promote products derived from
        !            18:  * this software without specific prior written permission.
        !            19:  * THIS SOFTWARE IS PROVIDED AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
        !            20:  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
        !            21:  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
        !            22:  *
        !            23:  *     @(#)quota.h     7.6 (Berkeley) 6/28/90
        !            24:  */
        !            25: 
        !            26: /*
        !            27:  * Definitions for disk quotas imposed on the average user
        !            28:  * (big brother finally hits UNIX).
        !            29:  *
        !            30:  * The following constants define the amount of time given a user
        !            31:  * before the soft limits are treated as hard limits (usually resulting
        !            32:  * in an allocation failure). The timer is started when the user crosses
        !            33:  * their soft limit, it is reset when they go below their soft limit.
        !            34:  */
        !            35: #define        MAX_IQ_TIME     (7*24*60*60)    /* 1 week */
        !            36: #define        MAX_DQ_TIME     (7*24*60*60)    /* 1 week */
        !            37: 
        !            38: /*
        !            39:  * The following constants define the usage of the quota file array
        !            40:  * in the ufsmount structure and dquot array in the inode structure.
        !            41:  * The semantics of the elements of these arrays are defined in the
        !            42:  * routine getinoquota; the remainder of the quota code treats them
        !            43:  * generically and need not be inspected when changing the size of
        !            44:  * the array.
        !            45:  */
        !            46: #define        MAXQUOTAS       2
        !            47: #define        USRQUOTA        0       /* element used for user quotas */
        !            48: #define        GRPQUOTA        1       /* element used for group quotas */
        !            49: 
        !            50: /*
        !            51:  * Definitions for the default names of the quotas files.
        !            52:  */
        !            53: #define INITQFNAMES { \
        !            54:        "user",         /* USRQUOTA */ \
        !            55:        "group",        /* GRPQUOTA */ \
        !            56:        "undefined", \
        !            57: };
        !            58: #ifndef KERNEL
        !            59: char *qfname = "quota";
        !            60: char *qfextension[] = INITQFNAMES;
        !            61: char *quotagroup = "operator";
        !            62: #endif
        !            63: 
        !            64: /*
        !            65:  * Command definitions for the 'quotactl' system call.
        !            66:  * The commands are broken into a main command defined below
        !            67:  * and a subcommand that is used to convey the type of
        !            68:  * quota that is being manipulated (see above).
        !            69:  */
        !            70: #define SUBCMDMASK     0x00ff
        !            71: #define SUBCMDSHIFT    8
        !            72: #define        QCMD(cmd, type) (((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK))
        !            73: 
        !            74: #define        Q_QUOTAON       0x0100  /* enable quotas */
        !            75: #define        Q_QUOTAOFF      0x0200  /* disable quotas */
        !            76: #define        Q_GETQUOTA      0x0300  /* get limits and usage */
        !            77: #define        Q_SETQUOTA      0x0400  /* set limits and usage */
        !            78: #define        Q_SETUSE        0x0500  /* set usage */
        !            79: #define        Q_SYNC          0x0600  /* sync disk copy of a filesystems quotas */
        !            80: 
        !            81: /*
        !            82:  * The following structure defines the format of the disk quota file
        !            83:  * (as it appears on disk) - the file is an array of these structures
        !            84:  * indexed by user or group number.  The setquota system call establishes
        !            85:  * the vnode for each quota file (a pointer is retained in the ufsmount
        !            86:  * structure).
        !            87:  */
        !            88: struct dqblk {
        !            89:        u_long  dqb_bhardlimit; /* absolute limit on disk blks alloc */
        !            90:        u_long  dqb_bsoftlimit; /* preferred limit on disk blks */
        !            91:        u_long  dqb_curblocks;  /* current block count */
        !            92:        u_long  dqb_ihardlimit; /* maximum # allocated inodes + 1 */
        !            93:        u_long  dqb_isoftlimit; /* preferred inode limit */
        !            94:        u_long  dqb_curinodes;  /* current # allocated inodes */
        !            95:        time_t  dqb_btime;      /* time limit for excessive disk use */
        !            96:        time_t  dqb_itime;      /* time limit for excessive files */
        !            97: };
        !            98: 
        !            99: #ifdef KERNEL
        !           100: /*
        !           101:  * The following structure records disk usage for a user or group on a
        !           102:  * filesystem. There is one allocated for each quota that exists on any
        !           103:  * filesystem for the current user or group. A cache is kept of recently
        !           104:  * used entries.
        !           105:  */
        !           106: struct dquot {
        !           107:        struct  dquot *dq_forw, *dq_back;/* MUST be first entry */
        !           108:        struct  dquot *dq_freef, **dq_freeb; /* free list */
        !           109:        short   dq_flags;               /* flags, see below */
        !           110:        short   dq_cnt;                 /* count of active references */
        !           111:        short   dq_spare;               /* unused spare padding */
        !           112:        short   dq_type;                /* quota type of this dquot */
        !           113:        u_long  dq_id;                  /* identifier this applies to */
        !           114:        struct  ufsmount *dq_ump;       /* filesystem that this is taken from */
        !           115:        struct  dqblk dq_dqb;           /* actual usage & quotas */
        !           116: };
        !           117: /*
        !           118:  * Flag values.
        !           119:  */
        !           120: #define        DQ_LOCK         0x01            /* this quota locked (no MODS) */
        !           121: #define        DQ_WANT         0x02            /* wakeup on unlock */
        !           122: #define        DQ_MOD          0x04            /* this quota modified since read */
        !           123: #define        DQ_FAKE         0x08            /* no limits here, just usage */
        !           124: #define        DQ_BLKS         0x10            /* has been warned about blk limit */
        !           125: #define        DQ_INODS        0x20            /* has been warned about inode limit */
        !           126: /*
        !           127:  * Shorthand notation.
        !           128:  */
        !           129: #define        dq_bhardlimit   dq_dqb.dqb_bhardlimit
        !           130: #define        dq_bsoftlimit   dq_dqb.dqb_bsoftlimit
        !           131: #define        dq_curblocks    dq_dqb.dqb_curblocks
        !           132: #define        dq_ihardlimit   dq_dqb.dqb_ihardlimit
        !           133: #define        dq_isoftlimit   dq_dqb.dqb_isoftlimit
        !           134: #define        dq_curinodes    dq_dqb.dqb_curinodes
        !           135: #define        dq_btime        dq_dqb.dqb_btime
        !           136: #define        dq_itime        dq_dqb.dqb_itime
        !           137: 
        !           138: /*
        !           139:  * If the system has never checked for a quota for this file,
        !           140:  * then it is set to NODQUOT. Once a write attempt is made
        !           141:  * the inode pointer is set to reference a dquot structure.
        !           142:  */
        !           143: #define        NODQUOT         ((struct dquot *) 0)
        !           144: 
        !           145: /*
        !           146:  * Flags to chkdq() and chkiq()
        !           147:  */
        !           148: #define        FORCE   0x01    /* force usage changes independent of limits */
        !           149: #define        CHOWN   0x02    /* (advisory) change initiated by chown */
        !           150: 
        !           151: /*
        !           152:  * Macros to avoid subroutine calls to trivial functions.
        !           153:  */
        !           154: #ifndef DIAGNOSTIC
        !           155: #define        DQREF(dq)       (dq)->dq_cnt++
        !           156: #else
        !           157: #define        DQREF(dq)       dqref(dq)
        !           158: #endif /* DIAGNOSTIC */
        !           159: #endif /* KERNEL */

unix.superglobalmegacorp.com

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