]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blame - quota/quota.h
xfs: fix maxicount division by zero error
[thirdparty/xfsprogs-dev.git] / quota / quota.h
CommitLineData
959ef981 1// SPDX-License-Identifier: GPL-2.0
5aead01d 2/*
da23017d
NS
3 * Copyright (c) 2005 Silicon Graphics, Inc.
4 * All Rights Reserved.
5aead01d
NS
5 */
6
6b803e5a 7#include "xqm.h"
42b4c8e8 8#include "libfrog/paths.h"
59f1f2a6 9#include "libfrog/projects.h"
fd537fc5 10#include <stdbool.h>
5aead01d
NS
11
12/*
13 * Different forms of XFS quota
14 */
15enum {
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 */
24extern int xfsquotactl(int __cmd, const char *__device,
25 uint __type, uint __id, void * __addr);
26enum {
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 */
546bedf4 33 XFS_QSYNC, /* flush delayed allocate space */
513fc424
ES
34 XFS_GETQSTATV, /* newer version of quota stats */
35 XFS_GETNEXTQUOTA, /* get disk limits and usage */
5aead01d
NS
36};
37
38/*
39 * Utility routines
40 */
41extern char *type_to_string(uint __type);
42extern char *form_to_string(uint __form);
44214b5a 43extern char *time_to_string(time_t __time, uint __flags);
14f8b681
DW
44extern char *bbs_to_string(uint64_t __v, char *__c, uint __size);
45extern char *num_to_string(uint64_t __v, char *__c, uint __size);
46extern char *pct_to_string(uint64_t __v, uint64_t __t, char *__c, uint __s);
5aead01d
NS
47
48extern FILE *fopen_write_secure(char *__filename);
49
50/*
51 * Various utility routine flags
52 */
53enum {
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 */
1774874a 64 NO_LOOKUP_FLAG = 0x0400, /* skip name lookups, just report ID */
6a9a085e 65 GETNEXTQUOTA_FLAG = 0x0800, /* use getnextquota quotactl */
5aead01d
NS
66};
67
68/*
69 * Identifier (uid/gid/prid) cache routines
70 */
ce8d0b3a 71#define NMAX 32
14f8b681
DW
72extern char *uid_to_name(uint32_t __uid);
73extern char *gid_to_name(uint32_t __gid);
74extern char *prid_to_name(uint32_t __prid);
fd537fc5 75extern bool isdigits_only(const char *);