]>
Commit | Line | Data |
---|---|---|
5aead01d | 1 | /* |
da23017d NS |
2 | * Copyright (c) 2005 Silicon Graphics, Inc. |
3 | * All Rights Reserved. | |
5aead01d | 4 | * |
da23017d NS |
5 | * This program is free software; you can redistribute it and/or |
6 | * modify it under the terms of the GNU General Public License as | |
5aead01d NS |
7 | * published by the Free Software Foundation. |
8 | * | |
da23017d NS |
9 | * This program is distributed in the hope that it would be useful, |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
5aead01d | 13 | * |
da23017d NS |
14 | * You should have received a copy of the GNU General Public License |
15 | * along with this program; if not, write the Free Software Foundation, | |
16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
5aead01d NS |
17 | */ |
18 | ||
6b803e5a CH |
19 | #include "xqm.h" |
20 | #include "path.h" | |
21 | #include "project.h" | |
fd537fc5 | 22 | #include <stdbool.h> |
5aead01d NS |
23 | |
24 | /* | |
25 | * Different forms of XFS quota | |
26 | */ | |
27 | enum { | |
28 | XFS_BLOCK_QUOTA = 0x1, | |
29 | XFS_INODE_QUOTA = 0x2, | |
30 | XFS_RTBLOCK_QUOTA = 0x4, | |
31 | }; | |
32 | ||
33 | /* | |
34 | * System call definitions mapping to platform-specific quotactl | |
35 | */ | |
36 | extern int xfsquotactl(int __cmd, const char *__device, | |
37 | uint __type, uint __id, void * __addr); | |
38 | enum { | |
39 | XFS_QUOTAON, /* enable accounting/enforcement */ | |
40 | XFS_QUOTAOFF, /* disable accounting/enforcement */ | |
41 | XFS_GETQUOTA, /* get disk limits and usage */ | |
42 | XFS_SETQLIM, /* set disk limits */ | |
43 | XFS_GETQSTAT, /* get quota subsystem status */ | |
44 | XFS_QUOTARM, /* free disk space used by dquots */ | |
546bedf4 | 45 | XFS_QSYNC, /* flush delayed allocate space */ |
513fc424 ES |
46 | XFS_GETQSTATV, /* newer version of quota stats */ |
47 | XFS_GETNEXTQUOTA, /* get disk limits and usage */ | |
5aead01d NS |
48 | }; |
49 | ||
50 | /* | |
51 | * Utility routines | |
52 | */ | |
53 | extern char *type_to_string(uint __type); | |
54 | extern char *form_to_string(uint __form); | |
44214b5a | 55 | extern char *time_to_string(time_t __time, uint __flags); |
14f8b681 DW |
56 | extern char *bbs_to_string(uint64_t __v, char *__c, uint __size); |
57 | extern char *num_to_string(uint64_t __v, char *__c, uint __size); | |
58 | extern char *pct_to_string(uint64_t __v, uint64_t __t, char *__c, uint __s); | |
5aead01d NS |
59 | |
60 | extern FILE *fopen_write_secure(char *__filename); | |
61 | ||
62 | /* | |
63 | * Various utility routine flags | |
64 | */ | |
65 | enum { | |
66 | NO_HEADER_FLAG = 0x0001, /* don't print header */ | |
67 | VERBOSE_FLAG = 0x0002, /* increase verbosity */ | |
68 | HUMAN_FLAG = 0x0004, /* human-readable values */ | |
69 | QUOTA_FLAG = 0x0008, /* uid/gid/prid over-quota (soft) */ | |
70 | LIMIT_FLAG = 0x0010, /* uid/gid/prid over-limit (hard) */ | |
71 | ALL_MOUNTS_FLAG = 0x0020, /* iterate over every mounted xfs */ | |
72 | TERSE_FLAG = 0x0040, /* decrease verbosity */ | |
73 | HISTOGRAM_FLAG = 0x0080, /* histogram format output */ | |
74 | DEFAULTS_FLAG = 0x0100, /* use value as a default */ | |
75 | ABSOLUTE_FLAG = 0x0200, /* absolute time, not related to now */ | |
1774874a | 76 | NO_LOOKUP_FLAG = 0x0400, /* skip name lookups, just report ID */ |
6a9a085e | 77 | GETNEXTQUOTA_FLAG = 0x0800, /* use getnextquota quotactl */ |
5aead01d NS |
78 | }; |
79 | ||
80 | /* | |
81 | * Identifier (uid/gid/prid) cache routines | |
82 | */ | |
ce8d0b3a | 83 | #define NMAX 32 |
14f8b681 DW |
84 | extern char *uid_to_name(uint32_t __uid); |
85 | extern char *gid_to_name(uint32_t __gid); | |
86 | extern char *prid_to_name(uint32_t __prid); | |
fd537fc5 | 87 | extern bool isdigits_only(const char *); |