~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Linux/include/linux/quota.h

Version: ~ [ 2.4.0 ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  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 and use in source and binary forms, with or without
  9  * modification, are permitted provided that the following conditions
 10  * are met:
 11  * 1. Redistributions of source code must retain the above copyright
 12  *    notice, this list of conditions and the following disclaimer.
 13  * 2. Redistributions in binary form must reproduce the above copyright
 14  *    notice, this list of conditions and the following disclaimer in the
 15  *    documentation and/or other materials provided with the distribution.
 16  * 3. All advertising materials mentioning features or use of this software
 17  *    must display the following acknowledgement:
 18  *   This product includes software developed by the University of
 19  *   California, Berkeley and its contributors.
 20  * 4. Neither the name of the University nor the names of its contributors
 21  *    may be used to endorse or promote products derived from this software
 22  *    without specific prior written permission.
 23  *
 24  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 25  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 26  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 27  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 28  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 29  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 30  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 31  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 33  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 34  * SUCH DAMAGE.
 35  *
 36  * Version: $Id: quota.h,v 2.0 1996/11/17 16:48:14 mvw Exp mvw $
 37  */
 38 
 39 #ifndef _LINUX_QUOTA_
 40 #define _LINUX_QUOTA_
 41 
 42 #include <linux/errno.h>
 43 
 44 /*
 45  * Convert diskblocks to blocks and the other way around.
 46  */
 47 #define dbtob(num) (num << BLOCK_SIZE_BITS)
 48 #define btodb(num) (num >> BLOCK_SIZE_BITS)
 49 
 50 /*
 51  * Convert count of filesystem blocks to diskquota blocks, meant
 52  * for filesystems where i_blksize != BLOCK_SIZE
 53  */
 54 #define fs_to_dq_blocks(num, blksize) (((num) * (blksize)) / BLOCK_SIZE)
 55 
 56 /*
 57  * Definitions for disk quotas imposed on the average user
 58  * (big brother finally hits Linux).
 59  *
 60  * The following constants define the amount of time given a user
 61  * before the soft limits are treated as hard limits (usually resulting
 62  * in an allocation failure). The timer is started when the user crosses
 63  * their soft limit, it is reset when they go below their soft limit.
 64  */
 65 #define MAX_IQ_TIME  604800     /* (7*24*60*60) 1 week */
 66 #define MAX_DQ_TIME  604800     /* (7*24*60*60) 1 week */
 67 
 68 #define MAXQUOTAS 2
 69 #define USRQUOTA  0             /* element used for user quotas */
 70 #define GRPQUOTA  1             /* element used for group quotas */
 71 
 72 /*
 73  * Definitions for the default names of the quotas files.
 74  */
 75 #define INITQFNAMES { \
 76         "user",    /* USRQUOTA */ \
 77         "group",   /* GRPQUOTA */ \
 78         "undefined", \
 79 };
 80 
 81 #define QUOTAFILENAME "quota"
 82 #define QUOTAGROUP "staff"
 83 
 84 extern int nr_dquots, nr_free_dquots;
 85 extern int max_dquots;
 86 extern int dquot_root_squash;
 87 
 88 #define NR_DQHASH 43            /* Just an arbitrary number */
 89 #define NR_DQUOTS 1024          /* Maximum number of quotas active at one time (Configurable from /proc/sys/fs) */
 90 
 91 /*
 92  * Command definitions for the 'quotactl' system call.
 93  * The commands are broken into a main command defined below
 94  * and a subcommand that is used to convey the type of
 95  * quota that is being manipulated (see above).
 96  */
 97 #define SUBCMDMASK  0x00ff
 98 #define SUBCMDSHIFT 8
 99 #define QCMD(cmd, type)  (((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK))
100 
101 #define Q_QUOTAON  0x0100       /* enable quotas */
102 #define Q_QUOTAOFF 0x0200       /* disable quotas */
103 #define Q_GETQUOTA 0x0300       /* get limits and usage */
104 #define Q_SETQUOTA 0x0400       /* set limits and usage */
105 #define Q_SETUSE   0x0500       /* set usage */
106 #define Q_SYNC     0x0600       /* sync disk copy of a filesystems quotas */
107 #define Q_SETQLIM  0x0700       /* set limits */
108 #define Q_GETSTATS 0x0800       /* get collected stats */
109 #define Q_RSQUASH  0x1000       /* set root_squash option */
110 
111 /*
112  * The following structure defines the format of the disk quota file
113  * (as it appears on disk) - the file is an array of these structures
114  * indexed by user or group number.
115  */
116 struct dqblk {
117         __u32 dqb_bhardlimit;   /* absolute limit on disk blks alloc */
118         __u32 dqb_bsoftlimit;   /* preferred limit on disk blks */
119         __u32 dqb_curblocks;    /* current block count */
120         __u32 dqb_ihardlimit;   /* absolute limit on allocated inodes */
121         __u32 dqb_isoftlimit;   /* preferred inode limit */
122         __u32 dqb_curinodes;    /* current # allocated inodes */
123         time_t dqb_btime;               /* time limit for excessive disk use */
124         time_t dqb_itime;               /* time limit for excessive inode use */
125 };
126 
127 /*
128  * Shorthand notation.
129  */
130 #define dq_bhardlimit   dq_dqb.dqb_bhardlimit
131 #define dq_bsoftlimit   dq_dqb.dqb_bsoftlimit
132 #define dq_curblocks    dq_dqb.dqb_curblocks
133 #define dq_ihardlimit   dq_dqb.dqb_ihardlimit
134 #define dq_isoftlimit   dq_dqb.dqb_isoftlimit
135 #define dq_curinodes    dq_dqb.dqb_curinodes
136 #define dq_btime        dq_dqb.dqb_btime
137 #define dq_itime        dq_dqb.dqb_itime
138 
139 #define dqoff(UID)      ((loff_t)((UID) * sizeof (struct dqblk)))
140 
141 struct dqstats {
142         __u32 lookups;
143         __u32 drops;
144         __u32 reads;
145         __u32 writes;
146         __u32 cache_hits;
147         __u32 allocated_dquots;
148         __u32 free_dquots;
149         __u32 syncs;
150 };
151 
152 #ifdef __KERNEL__
153 
154 /*
155  * Maximum length of a message generated in the quota system,
156  * that needs to be kicked onto the tty.
157  */
158 #define MAX_QUOTA_MESSAGE 75
159 
160 #define DQ_LOCKED     0x01      /* locked for update */
161 #define DQ_WANT       0x02      /* wanted for update */
162 #define DQ_MOD        0x04      /* dquot modified since read */
163 #define DQ_BLKS       0x10      /* uid/gid has been warned about blk limit */
164 #define DQ_INODES     0x20      /* uid/gid has been warned about inode limit */
165 #define DQ_FAKE       0x40      /* no limits only usage */
166 
167 struct dquot {
168         struct dquot *dq_next;          /* Pointer to next dquot */
169         struct dquot **dq_pprev;
170         struct list_head dq_free;       /* free list element */
171         struct dquot *dq_hash_next;     /* Pointer to next in dquot_hash */
172         struct dquot **dq_hash_pprev;   /* Pointer to previous in dquot_hash */
173         wait_queue_head_t dq_wait;      /* Pointer to waitqueue */
174         int dq_count;                   /* Reference count */
175 
176         /* fields after this point are cleared when invalidating */
177         struct super_block *dq_sb;      /* superblock this applies to */
178         unsigned int dq_id;             /* ID this applies to (uid, gid) */
179         kdev_t dq_dev;                  /* Device this applies to */
180         short dq_type;                  /* Type of quota */
181         short dq_flags;                 /* See DQ_* */
182         unsigned long dq_referenced;    /* Number of times this dquot was 
183                                            referenced during its lifetime */
184         struct dqblk dq_dqb;            /* Diskquota usage */
185 };
186 
187 #define NODQUOT (struct dquot *)NULL
188 
189 /*
190  * Flags used for set_dqblk.
191  */
192 #define QUOTA_SYSCALL     0x01
193 #define SET_QUOTA         0x02
194 #define SET_USE           0x04
195 #define SET_QLIMIT        0x08
196 
197 #define QUOTA_OK          0
198 #define NO_QUOTA          1
199 
200 #else
201 
202 # /* nodep */ include <sys/cdefs.h>
203 
204 __BEGIN_DECLS
205 long quotactl __P ((int, const char *, int, caddr_t));
206 __END_DECLS
207 
208 #endif /* __KERNEL__ */
209 #endif /* _QUOTA_ */
210 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.