root / lab4 / .minix-src / include / sys / quota.h @ 14
History | View | Annotate | Download (2.97 KB)
1 | 13 | up20180614 | /* $NetBSD: quota.h,v 1.12 2012/01/30 00:56:19 dholland Exp $ */
|
---|---|---|---|
2 | /*-
|
||
3 | * Copyright (c) 2010 Manuel Bouyer
|
||
4 | * All rights reserved.
|
||
5 | *
|
||
6 | * Redistribution and use in source and binary forms, with or without
|
||
7 | * modification, are permitted provided that the following conditions
|
||
8 | * are met:
|
||
9 | * 1. Redistributions of source code must retain the above copyright
|
||
10 | * notice, this list of conditions and the following disclaimer.
|
||
11 | * 2. Redistributions in binary form must reproduce the above copyright
|
||
12 | * notice, this list of conditions and the following disclaimer in the
|
||
13 | * documentation and/or other materials provided with the distribution.
|
||
14 | *
|
||
15 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||
16 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||
17 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||
18 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||
19 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||
20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||
21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||
22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||
23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||
24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||
25 | * POSSIBILITY OF SUCH DAMAGE.
|
||
26 | */
|
||
27 | |||
28 | #ifndef _SYS_QUOTA_H_
|
||
29 | #define _SYS_QUOTA_H_
|
||
30 | |||
31 | #include <sys/types.h> |
||
32 | |||
33 | /* quota id types (entities being billed) */
|
||
34 | #define QUOTA_IDTYPE_USER 0 |
||
35 | #define QUOTA_IDTYPE_GROUP 1 |
||
36 | |||
37 | /* quota object types (things being limited) */
|
||
38 | #define QUOTA_OBJTYPE_BLOCKS 0 |
||
39 | #define QUOTA_OBJTYPE_FILES 1 |
||
40 | |||
41 | /* id value for "default" */
|
||
42 | #define QUOTA_DEFAULTID ((id_t)-1) |
||
43 | |||
44 | /* limit value for "no limit" */
|
||
45 | #define QUOTA_NOLIMIT ((uint64_t)0xffffffffffffffffULL) |
||
46 | |||
47 | /* time value for "no time" */
|
||
48 | #define QUOTA_NOTIME ((time_t)-1) |
||
49 | |||
50 | /*
|
||
51 | * Semantic restrictions. These are hints applications can use
|
||
52 | * to help produce comprehensible error diagnostics when something
|
||
53 | * unsupported is attempted.
|
||
54 | */
|
||
55 | #define QUOTA_RESTRICT_NEEDSQUOTACHECK 0x1 /* quotacheck(8) required */ |
||
56 | #define QUOTA_RESTRICT_UNIFORMGRACE 0x2 /* grace time is global */ |
||
57 | #define QUOTA_RESTRICT_32BIT 0x4 /* values limited to 2^32 */ |
||
58 | #define QUOTA_RESTRICT_READONLY 0x8 /* updates not supported */ |
||
59 | |||
60 | |||
61 | /*
|
||
62 | * Structure used to describe the key part of a quota record.
|
||
63 | */
|
||
64 | struct quotakey {
|
||
65 | int qk_idtype; /* type of id (user, group, etc.) */ |
||
66 | id_t qk_id; /* actual id number */
|
||
67 | int qk_objtype; /* type of fs object (blocks, files, etc.) */ |
||
68 | }; |
||
69 | |||
70 | /*
|
||
71 | * Structure used to describe the value part of a quota record.
|
||
72 | */
|
||
73 | struct quotaval {
|
||
74 | uint64_t qv_hardlimit; /* absolute limit */
|
||
75 | uint64_t qv_softlimit; /* overflowable limit */
|
||
76 | uint64_t qv_usage; /* current usage */
|
||
77 | time_t qv_expiretime; /* time when softlimit grace expires */
|
||
78 | time_t qv_grace; /* allowed time for overflowing soft limit */
|
||
79 | }; |
||
80 | |||
81 | #endif /* _SYS_QUOTA_H_ */ |