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