QUOTAFILE(3)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1

πŸ’… 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 an fstab entry corresponding to the filesystem on which quotas are to be accessed. the quotatype field indicates the type of quotas being sought, either USRQUOTA or GRPQUOTA. the openflags are those used by the open() system call, usually either O_RDONLY if the quotas are just to be read, or O_RDWR if the quotas are to be updated. the O_CREAT flag 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 by qf.
  • quota_on() β€” enables quotas for the filesystem associated with its qf argument, which may have been opened with O_RDONLY or O_RDWR. quota_on() returns 0 if successful; otherwise the value -1 is returned and the global variable errno is set to indicate the error β€” see quotactl(2) for the possible errors.
  • quota_off() β€” disables quotas for the filesystem associated with its qf argument, which may have been opened with O_RDONLY or O_RDWR. quota_off() returns 0 if successful; otherwise the value -1 is returned and the global variable errno is set to indicate the error β€” see quotactl(2) for the possible errors.
  • quota_read() β€” reads the quota from the filesystem and quota type referenced by qf for the user (or group) specified by id into the dqblk quota structure pointed to by dqb.
  • quota_write_limits() β€” updates the limit fields (but not the usage fields) for the filesystem and quota type referenced by qf for the user (or group) specified by id from the dqblk quota structure pointed to by dqb.
  • quota_write_usage() β€” updates the usage fields (but not the limit fields) for the filesystem and quota type referenced by qf for the user (or group) specified by id from the dqblk quota structure pointed to by dqb.
  • quota_fsname() β€” returns a pointer to a buffer containing the path to the root of the file system that corresponds to its qf argument, 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 its qf argument. 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 its qf argument.
  • quota_check_path() β€” checks if the specified path is within the filesystem that corresponds to its qf argument. if the path argument refers to a symbolic link, quota_check_path() will follow it. πŸ”₯
  • quota_convert() β€” converts the quota file associated with its qf argument to the data size specified by its wordsize argument. the supported wordsize arguments are 32 for the old 32-bit quota file format and 64 for 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