include/linux/quota.h
Source file repositories/reference/linux-study-clean/include/linux/quota.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/quota.h- Extension
.h- Size
- 19211 bytes
- Lines
- 544
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/list.hlinux/mutex.hlinux/rwsem.hlinux/spinlock.hlinux/wait.hlinux/percpu_counter.hlinux/dqblk_xfs.hlinux/dqblk_v1.hlinux/dqblk_v2.hlinux/atomic.hlinux/uidgid.hlinux/projid.huapi/linux/quota.h
Detected Declarations
struct kqidstruct mem_dqblkstruct quota_format_typestruct mem_dqinfostruct super_blockstruct dqstatsstruct dquotstruct quota_format_opsstruct dquot_operationsstruct pathstruct qc_dqblkstruct qc_type_statestruct qc_statestruct qc_infostruct quotactl_opsstruct quota_format_typestruct quota_infostruct quota_module_nameenum quota_typefunction qid_validfunction make_kqid_invalidfunction make_kqid_uidfunction make_kqid_gidfunction make_kqid_projidfunction qid_has_mappingfunction info_dirtyfunction dqstats_incfunction dqstats_decfunction dquot_state_flagfunction dquot_generic_flagfunction dquot_state_typesfunction quota_send_warning
Annotated Snippet
struct kqid { /* Type in which we store the quota identifier */
union {
kuid_t uid;
kgid_t gid;
kprojid_t projid;
};
enum quota_type type; /* USRQUOTA (uid) or GRPQUOTA (gid) or PRJQUOTA (projid) */
};
extern bool qid_eq(struct kqid left, struct kqid right);
extern bool qid_lt(struct kqid left, struct kqid right);
extern qid_t from_kqid(struct user_namespace *to, struct kqid qid);
extern qid_t from_kqid_munged(struct user_namespace *to, struct kqid qid);
extern bool qid_valid(struct kqid qid);
/**
* make_kqid - Map a user-namespace, type, qid tuple into a kqid.
* @from: User namespace that the qid is in
* @type: The type of quota
* @qid: Quota identifier
*
* Maps a user-namespace, type qid tuple into a kernel internal
* kqid, and returns that kqid.
*
* When there is no mapping defined for the user-namespace, type,
* qid tuple an invalid kqid is returned. Callers are expected to
* test for and handle invalid kqids being returned.
* Invalid kqids may be tested for using qid_valid().
*/
static inline struct kqid make_kqid(struct user_namespace *from,
enum quota_type type, qid_t qid)
{
struct kqid kqid;
kqid.type = type;
switch (type) {
case USRQUOTA:
kqid.uid = make_kuid(from, qid);
break;
case GRPQUOTA:
kqid.gid = make_kgid(from, qid);
break;
case PRJQUOTA:
kqid.projid = make_kprojid(from, qid);
break;
default:
BUG();
}
return kqid;
}
/**
* make_kqid_invalid - Explicitly make an invalid kqid
* @type: The type of quota identifier
*
* Returns an invalid kqid with the specified type.
*/
static inline struct kqid make_kqid_invalid(enum quota_type type)
{
struct kqid kqid;
kqid.type = type;
switch (type) {
case USRQUOTA:
kqid.uid = INVALID_UID;
break;
case GRPQUOTA:
kqid.gid = INVALID_GID;
break;
case PRJQUOTA:
kqid.projid = INVALID_PROJID;
break;
default:
BUG();
}
return kqid;
}
/**
* make_kqid_uid - Make a kqid from a kuid
* @uid: The kuid to make the quota identifier from
*/
static inline struct kqid make_kqid_uid(kuid_t uid)
{
struct kqid kqid;
kqid.type = USRQUOTA;
kqid.uid = uid;
return kqid;
}
Annotation
- Immediate include surface: `linux/list.h`, `linux/mutex.h`, `linux/rwsem.h`, `linux/spinlock.h`, `linux/wait.h`, `linux/percpu_counter.h`, `linux/dqblk_xfs.h`, `linux/dqblk_v1.h`.
- Detected declarations: `struct kqid`, `struct mem_dqblk`, `struct quota_format_type`, `struct mem_dqinfo`, `struct super_block`, `struct dqstats`, `struct dquot`, `struct quota_format_ops`, `struct dquot_operations`, `struct path`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.