The Pedigree Project 0.1
Quota.h
1/* Copyright (c) 2026, Pedigree Developers. */
2#ifndef PEDIGREE_VFS_QUOTA_H
3#define PEDIGREE_VFS_QUOTA_H
4
5#include "pedigree/kernel/compiler.h"
6#include "pedigree/kernel/processor/types.h"
7
8enum class QuotaType { User, Group };
9enum class QuotaOperation { Enable, Disable, GetFormat, Get, Set, Sync };
10enum class QuotaStatus {
11 Success,
12 Unsupported,
13 Invalid,
14 NotEnabled,
15 Busy,
16 ReadOnly,
17 NoMemory,
18 IoError,
19 Limit,
20 Overflow,
21 Permission,
22 NoSpace,
23 TooLarge
24};
25
26int EXPORTED_PUBLIC quotaError(QuotaStatus status);
27
28namespace Quota {
29constexpr uint32_t OldFormat = 1;
30constexpr uint32_t BlockLimits = 1, Space = 2, InodeLimits = 4, Inodes = 8;
31constexpr uint32_t BlockTime = 16, InodeTime = 32;
32constexpr uint32_t Limits = BlockLimits | InodeLimits;
33constexpr uint32_t Usage = Space | Inodes;
34constexpr uint32_t Supported = Limits | Usage;
35} // namespace Quota
36
38 // Linux quota limits are in 1024-byte units; currentSpace is in bytes.
39 uint64_t blockHardLimit = 0;
40 uint64_t blockSoftLimit = 0;
41 uint64_t currentSpace = 0;
42 uint64_t inodeHardLimit = 0;
43 uint64_t inodeSoftLimit = 0;
44 uint64_t currentInodes = 0;
45 uint64_t blockTime = 0;
46 uint64_t inodeTime = 0;
47 uint32_t valid = 0;
48 uint32_t reserved = 0;
49};
50
52 QuotaOperation operation = QuotaOperation::Get;
53 QuotaType type = QuotaType::User;
54 uint32_t id = 0;
55 uint32_t format = 0;
56 QuotaRecord record;
57};
58
60 QuotaRecord record;
61 uint32_t format = 0;
62};
63
64#endif
Definition Group.h:32
Definition User.h:32