]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - quota/quota.h
5db0a7419711f13dab7535c728ced40d31a473ae
[thirdparty/xfsprogs-dev.git] / quota / quota.h
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * Copyright (c) 2005 Silicon Graphics, Inc.
4 * All Rights Reserved.
5 */
6
7 #include "xqm.h"
8 #include "libfrog/paths.h"
9 #include "project.h"
10 #include <stdbool.h>
11
12 /*
13 * Different forms of XFS quota
14 */
15 enum {
16 XFS_BLOCK_QUOTA = 0x1,
17 XFS_INODE_QUOTA = 0x2,
18 XFS_RTBLOCK_QUOTA = 0x4,
19 };
20
21 /*
22 * System call definitions mapping to platform-specific quotactl
23 */
24 extern int xfsquotactl(int __cmd, const char *__device,
25 uint __type, uint __id, void * __addr);
26 enum {
27 XFS_QUOTAON, /* enable accounting/enforcement */
28 XFS_QUOTAOFF, /* disable accounting/enforcement */
29 XFS_GETQUOTA, /* get disk limits and usage */
30 XFS_SETQLIM, /* set disk limits */
31 XFS_GETQSTAT, /* get quota subsystem status */
32 XFS_QUOTARM, /* free disk space used by dquots */
33 XFS_QSYNC, /* flush delayed allocate space */
34 XFS_GETQSTATV, /* newer version of quota stats */
35 XFS_GETNEXTQUOTA, /* get disk limits and usage */
36 };
37
38 /*
39 * Utility routines
40 */
41 extern char *type_to_string(uint __type);
42 extern char *form_to_string(uint __form);
43 extern char *time_to_string(time_t __time, uint __flags);
44 extern char *bbs_to_string(uint64_t __v, char *__c, uint __size);
45 extern char *num_to_string(uint64_t __v, char *__c, uint __size);
46 extern char *pct_to_string(uint64_t __v, uint64_t __t, char *__c, uint __s);
47
48 extern FILE *fopen_write_secure(char *__filename);
49
50 /*
51 * Various utility routine flags
52 */
53 enum {
54 NO_HEADER_FLAG = 0x0001, /* don't print header */
55 VERBOSE_FLAG = 0x0002, /* increase verbosity */
56 HUMAN_FLAG = 0x0004, /* human-readable values */
57 QUOTA_FLAG = 0x0008, /* uid/gid/prid over-quota (soft) */
58 LIMIT_FLAG = 0x0010, /* uid/gid/prid over-limit (hard) */
59 ALL_MOUNTS_FLAG = 0x0020, /* iterate over every mounted xfs */
60 TERSE_FLAG = 0x0040, /* decrease verbosity */
61 HISTOGRAM_FLAG = 0x0080, /* histogram format output */
62 DEFAULTS_FLAG = 0x0100, /* use value as a default */
63 ABSOLUTE_FLAG = 0x0200, /* absolute time, not related to now */
64 NO_LOOKUP_FLAG = 0x0400, /* skip name lookups, just report ID */
65 GETNEXTQUOTA_FLAG = 0x0800, /* use getnextquota quotactl */
66 };
67
68 /*
69 * Identifier (uid/gid/prid) cache routines
70 */
71 #define NMAX 32
72 extern char *uid_to_name(uint32_t __uid);
73 extern char *gid_to_name(uint32_t __gid);
74 extern char *prid_to_name(uint32_t __prid);
75 extern bool isdigits_only(const char *);