OpenCores
URL https://opencores.org/ocsvn/c0or1k/c0or1k/trunk

Subversion Repositories c0or1k

[/] [c0or1k/] [trunk/] [conts/] [posix/] [libposix/] [include/] [posix/] [sys/] [quota.h] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 drasko
/* This just represents the non-kernel parts of <linux/quota.h>.
2
 *
3
 * here's the corresponding copyright:
4
 * Copyright (c) 1982, 1986 Regents of the University of California.
5
 * All rights reserved.
6
 *
7
 * This code is derived from software contributed to Berkeley by
8
 * Robert Elz at The University of Melbourne.
9
 *
10
 * Redistribution and use in source and binary forms, with or without
11
 * modification, are permitted provided that the following conditions
12
 * are met:
13
 * 1. Redistributions of source code must retain the above copyright
14
 *    notice, this list of conditions and the following disclaimer.
15
 * 2. Redistributions in binary form must reproduce the above copyright
16
 *    notice, this list of conditions and the following disclaimer in the
17
 *    documentation and/or other materials provided with the distribution.
18
 * 4. Neither the name of the University nor the names of its contributors
19
 *    may be used to endorse or promote products derived from this software
20
 *    without specific prior written permission.
21
 *
22
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32
 * SUCH DAMAGE.
33
 *
34
 * Version: $Id: quota.h,v 1.1 2002/01/03 04:00:09 andersen Exp $
35
 */
36
 
37
#ifndef _SYS_QUOTA_H
38
#define _SYS_QUOTA_H 1
39
 
40
#include <features.h>
41
#include <sys/types.h>
42
 
43
/*
44
 * Convert diskblocks to blocks and the other way around.
45
 * currently only to fool the BSD source. :-)
46
 */
47
#define dbtob(num) ((num) << 10)
48
#define btodb(num) ((num) >> 10)
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
#define NR_DQHASH 43          /* Just an arbitrary number any suggestions ? */
85
#define NR_DQUOTS 256         /* Number of quotas active at one time */
86
 
87
/*
88
 * Command definitions for the 'quotactl' system call.
89
 * The commands are broken into a main command defined below
90
 * and a subcommand that is used to convey the type of
91
 * quota that is being manipulated (see above).
92
 */
93
#define SUBCMDMASK  0x00ff
94
#define SUBCMDSHIFT 8
95
#define QCMD(cmd, type)  (((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK))
96
 
97
#define Q_QUOTAON  0x0100       /* enable quotas */
98
#define Q_QUOTAOFF 0x0200       /* disable quotas */
99
#define Q_GETQUOTA 0x0300       /* get limits and usage */
100
#define Q_SETQUOTA 0x0400       /* set limits and usage */
101
#define Q_SETUSE   0x0500       /* set usage */
102
#define Q_SYNC     0x0600       /* sync disk copy of a filesystems quotas */
103
#define Q_SETQLIM  0x0700       /* set limits */
104
#define Q_GETSTATS 0x0800       /* get collected stats */
105
#define Q_RSQUASH  0x1000       /* set root_squash option */
106
 
107
/*
108
 * The following structure defines the format of the disk quota file
109
 * (as it appears on disk) - the file is an array of these structures
110
 * indexed by user or group number.
111
 */
112
struct dqblk
113
  {
114
    u_int32_t dqb_bhardlimit;   /* absolute limit on disk blks alloc */
115
    u_int32_t dqb_bsoftlimit;   /* preferred limit on disk blks */
116
    u_int32_t dqb_curblocks;    /* current block count */
117
    u_int32_t dqb_ihardlimit;   /* maximum # allocated inodes */
118
    u_int32_t dqb_isoftlimit;   /* preferred inode limit */
119
    u_int32_t dqb_curinodes;    /* current # allocated inodes */
120
    time_t dqb_btime;           /* time limit for excessive disk use */
121
    time_t dqb_itime;           /* time limit for excessive files */
122
  };
123
 
124
/*
125
 * Shorthand notation.
126
 */
127
#define dq_bhardlimit   dq_dqb.dqb_bhardlimit
128
#define dq_bsoftlimit   dq_dqb.dqb_bsoftlimit
129
#define dq_curblocks    dq_dqb.dqb_curblocks
130
#define dq_ihardlimit   dq_dqb.dqb_ihardlimit
131
#define dq_isoftlimit   dq_dqb.dqb_isoftlimit
132
#define dq_curinodes    dq_dqb.dqb_curinodes
133
#define dq_btime        dq_dqb.dqb_btime
134
#define dq_itime        dq_dqb.dqb_itime
135
 
136
#define dqoff(UID)      ((loff_t)((UID) * sizeof (struct dqblk)))
137
 
138
struct dqstats
139
  {
140
    u_int32_t lookups;
141
    u_int32_t drops;
142
    u_int32_t reads;
143
    u_int32_t writes;
144
    u_int32_t cache_hits;
145
    u_int32_t pages_allocated;
146
    u_int32_t allocated_dquots;
147
    u_int32_t free_dquots;
148
    u_int32_t syncs;
149
  };
150
 
151
__BEGIN_DECLS
152
 
153
extern int quotactl (int __cmd, const char *__special, int __id,
154
                     caddr_t __addr) __THROW;
155
 
156
__END_DECLS
157
 
158
#endif /* sys/quota.h */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.