QUOTAFILE(3)
π NAME π
okay so this is the QUOTAFILE(3) manual β the whole libutil quota bestie package β and it's literally here to manipulate quotas. π
The functions are:
quota_open, quota_close, quota_on, quota_off, quota_read, quota_write_limits, quota_write_usage, quota_fsname, quota_qfname, quota_maxid, quota_check_path, quota_convert β all here to handle quotas, no cap.
π LIBRARY π
System Utilities Library (libutil, -lutil)
β¨ SYNOPSIS β¨
#include <sys/param.h>
#include <sys/mount.h>
#include <ufs/ufs/quota.h>
#include <fcntl.h>
#include <fstab.h>
#include <libutil.h>
struct quotafile *
quota_open(struct fstab *fs, int quotatype, int openflags);
int
quota_close(struct quotafile *qf);
int
quota_on(const struct quotafile *qf);
int
quota_off(const struct quotafile *qf);
int
quota_read(struct quotafile *qf, struct dqblk *dqb, int id);
int
quota_write_limits(struct quotafile *qf, struct dqblk *dqb, int id);
int
quota_write_usage(struct quotafile *qf, struct dqblk *dqb, int id);
const char *
quota_fsname(const struct quotafile *qf);
const char *
quota_qfname(const struct quotafile *qf);
int
quota_maxid(const struct quotafile *qf);
int
quota_check_path(const struct quotafile *qf, const char *path);
int
quota_convert(struct quotafile *qf, int wordsize);
π¦ DESCRIPTION π¦
okay so these functions are designed to simplify access to filesystem quotas. if quotas are active on a filesystem, these functions will access them directly from the kernel using the quotactl() system call. if quotas are not active, these functions will access them by reading and writing the quota files directly. π«
quota_open()β takes a pointer to anfstabentry corresponding to the filesystem on which quotas are to be accessed. thequotatypefield indicates the type of quotas being sought, eitherUSRQUOTAorGRPQUOTA. theopenflagsare those used by theopen()system call, usually eitherO_RDONLYif the quotas are just to be read, orO_RDWRif the quotas are to be updated. theO_CREATflag should be specified if a new quota file of the requested type should be created if it does not already exist.quota_close()β closes any open file descriptors and frees any storage associated with the filesystem and quota type referenced byqf.quota_on()β enables quotas for the filesystem associated with itsqfargument, which may have been opened withO_RDONLYorO_RDWR.quota_on()returns0if successful; otherwise the value-1is returned and the global variableerrnois set to indicate the error β seequotactl(2)for the possible errors.quota_off()β disables quotas for the filesystem associated with itsqfargument, which may have been opened withO_RDONLYorO_RDWR.quota_off()returns0if successful; otherwise the value-1is returned and the global variableerrnois set to indicate the error β seequotactl(2)for the possible errors.quota_read()β reads the quota from the filesystem and quota type referenced byqffor the user (or group) specified byidinto thedqblkquota structure pointed to bydqb.quota_write_limits()β updates the limit fields (but not the usage fields) for the filesystem and quota type referenced byqffor the user (or group) specified byidfrom thedqblkquota structure pointed to bydqb.quota_write_usage()β updates the usage fields (but not the limit fields) for the filesystem and quota type referenced byqffor the user (or group) specified byidfrom thedqblkquota structure pointed to bydqb.quota_fsname()β returns a pointer to a buffer containing the path to the root of the file system that corresponds to itsqfargument, as listed in/etc/fstab. note that this may be a symbolic link to the actual directory. π«Άquota_qfname()β returns a pointer to a buffer containing the name of the quota file that corresponds to itsqfargument. note that this may be a symbolic link to the actual file. πquota_maxid()β returns the maximum user (or group) id contained in the quota file associated with itsqfargument.quota_check_path()β checks if the specifiedpathis within the filesystem that corresponds to itsqfargument. if thepathargument refers to a symbolic link,quota_check_path()will follow it. π₯quota_convert()β converts the quota file associated with itsqfargument to the data size specified by itswordsizeargument. the supportedwordsizearguments are32for the old 32-bit quota file format and64for the new 64-bit quota file format.quota_convert()may only be called to operate on quota files that are not currently active. β οΈ
πΈ IMPLEMENTATION NOTES πΈ
if the underlying quota file is in or converted to the old 32-bit format, limit and usage values written to the quota file will be clipped to 32 bits. π
π§ RETURN VALUES π§
if the filesystem has quotas associated with it, quota_open() returns a pointer to a quotafile structure used in subsequent quota access calls. if the filesystem has no quotas, or access permission is denied, NULL is returned and errno is set to indicate the error.
quota_check_path() returns 1 for a positive result and 0 for a negative result. if an error occurs, it returns -1 and sets errno to indicate the error.
quota_read(), quota_write_limits(), quota_write_usage(), quota_convert(), and quota_close() return zero on success. on error they return -1 and set errno to indicate the error. β¨
π₯ SEE ALSO π₯
π HISTORY π
the quotafile functions first appeared in FreeBSD 8.1.
π AUTHORS π
the quotafile functions and this manual page were written by Dag-Erling SmΓΈrgrav <des@FreeBSD.org> and Marshall Kirk McKusick <mckusick@mckusick.com>.
k bye bestie π β this page is brought to you by Debian, dated December 28, 2009, and it's the QUOTAFILE(3) manual. slay. π
β¨
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright (c) 2009 Dag-Erling SmΓΈrgrav and
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms