Home | History | Annotate | only in /src/usr.bin/quota
History log of /src/usr.bin/quota
RevisionDateAuthorComments
 1.15 03-Jun-2023  lukem bsd.own.mk: rename GCC_NO_* to CC_WNO_*

Rename compiler-warning-disable variables from
GCC_NO_warning
to
CC_WNO_warning
where warning is the full warning name as used by the compiler.

GCC_NO_IMPLICIT_FALLTHRU is CC_WNO_IMPLICIT_FALLTHROUGH

Using the convention CC_compilerflag, where compilerflag
is based on the full compiler flag name.
 1.14 13-Oct-2019  mrg introduce some common variables for use in GCC warning disables:

GCC_NO_FORMAT_TRUNCATION -Wno-format-truncation (GCC 7/8)
GCC_NO_STRINGOP_TRUNCATION -Wno-stringop-truncation (GCC 8)
GCC_NO_STRINGOP_OVERFLOW -Wno-stringop-overflow (GCC 8)
GCC_NO_CAST_FUNCTION_TYPE -Wno-cast-function-type (GCC 8)

use these to turn off warnings for most GCC-8 complaints. many
of these are false positives, most of the real bugs are already
commited, or are yet to come.


we plan to introduce versions of (some?) of these that use the
"-Wno-error=" form, which still displays the warnings but does
not make it an error, and all of the above will be re-considered
as either being "fix me" (warning still displayed) or "warning
is wrong."
 1.13 11-Aug-2013  dholland branches: 1.13.26;
Passes WARNS=5; don't set WARNS=4.
 1.12 01-Feb-2012  dholland branches: 1.12.6;
libquota no longer requires libprop. Also remove some other no-longer-used
.PATH'd-in bits from repquota.
 1.11 09-Jan-2012  dholland Clean up usr.bin/quota to use the new libquota API.
(with one relatively minor exception remaining)
 1.10 24-Mar-2011  bouyer branches: 1.10.4;
Add a new libquota library, which contains some blocks to build and/or
parse quota plists; as well as a getfsquota() function to retrieve quotas
for a single id from a single filesystem (whatever filesystem this is:
a local quota-enabled fs or NFS). This is build on functions getufsquota()
(for local filesystems with UFS-like quotas) and getnfsquota();
which are also available to userland programs.
move functions from quota2_subr.c to libquota or libprop as appropriate,
and ajust in-tree quota tools.
move some declarations from kernel headers to either sys/quota.h or
quota/quota.h as appropriate. ufs/ufs/quota.h still installed because
it's needed by other installed ufs headers.
ufs/ufs/quota1.h still installed as a quick&dirty way to get a code
using the old quotactl() to compile (just include ufs/ufs/quota1.h instead of
ufs/ufs/quota.h - old code won't compile without this change and this is
on purpose).
Discussed on tech-kern@ and tech-net@ (long thread, but not much about
libquota itself ...)
 1.9 06-Mar-2011  christos - merge more code.
- simplify struct access.
 1.8 06-Mar-2011  christos - WARNS=4
- KNF
- don't cast malloc
- don't use static buffers
- fix types
- remove extra \n's from errors
- fix prototypes
 1.7 06-Mar-2011  bouyer merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.
 1.6 12-Jul-1998  mrg branches: 1.6.64;
quota does not need to be setuid root.
 1.5 09-Jan-1997  tls RCS ID police
 1.4 28-Jun-1994  deraadt more NFS quota support from <bouyer@ensta.fr> and myself.
 1.3 13-Jun-1994  mycroft Merge local changes.
 1.2 31-Jul-1993  mycroft Add RCS indentifiers.
 1.1 09-Apr-1993  cgd branches: 1.1.1;
added, from net/2 (patch 124).
 1.1.1.1 13-Jun-1994  mycroft Update from 4.4-Lite.
 1.6.64.5 14-Feb-2011  bouyer The rpc.rquotad protocol uses the legacy definitions and integer types.
Convert from/to dqblk using the quota1_subr.c routines to have the
necessery convertions done.
 1.6.64.4 03-Feb-2011  bouyer factor out code to chech a quota against its limits.
 1.6.64.3 28-Jan-2011  bouyer Rename getufsquota to getvfsquota, and abstract in its own file.
 1.6.64.2 21-Jan-2011  bouyer Add support for quotactl("getall") command, and convert repquota to new
world.
 1.6.64.1 20-Jan-2011  bouyer Snapshot of work in progress on a modernised disk quota system:
- new quotactl syscall (versionned for backward compat), which takes
as parameter a path to a mount point, and a prop_dictionary
(in plistref format) describing commands and arguments.
For each command, status and data are returned as a prop_dictionary.
quota commands features will be added to take advantage of this,
exporting quota data or getting quota commands as plists.

- new on disk-format storage (all 64bit wide), integrated to metadata for
ffs (and playing nicely with wapbl).
Quotas are enabled on a ffs filesystem via superblock flags.
tunefs(8) can enable or disable quotas.
On a quota-enabled filesystem, fsck_ffs(8) will track per-uid/gid
block and inode usages, and will check and update quotas in Pass 6.
quota usage and limits are stored in unliked files (one for users,
one for groups)l fsck_ffs(8) will create the files if needed, or
free them if needed. This means that after enabling or disabling
quotas on a filesystem; a fsck_ffs(8) run is required.
quotacheck(8) is not needed any more, on a unclean shutdown
fsck or journal replay will take care of fixing quotas.
newfs(8) can create a ready-to-mount quota-enabled filesystem
(superblock flags are set and quota inodes are created).
Other new features or semantic changes:
- default quota datas, applied to users or groups which don't already
have a quota entry
- per-user/group grace time (instead of a filesystem global one)
- 0 really means "nothing allowed at all", not "no limit".
If you want "no limit", set the limit to UQUAD_MAX (tools will
understand "unlimited" and "-")

A quota file is structured as follow:
it starts with a header, containing a few per-filesystem values,
and the default quota limits.
Quota entries are linked together as a simple list, each entry has a
pointer (as an offset withing the file) to the next.
The header has a pointer to a list of free quota entries, and
a hash table of in-use entries. The size of the hash table depends
on the filesystem block size (header+hash table should fit in the
first block). The file is not sparse and is a multiple of
filesystem block size (when the free quota entry list is empty a new
filesystem block is allocated). quota entries to not cross
filesystem block boundaries.

In memory, the kernel keeps a cache of recently used quota entries
as a reference to the block number, and offset withing the block.
The quota entry itself is keept in the buf cache.

fsck_ffs(8), tunefs(8) and newfs(8) supports are completed (with
related atf tests :)
The kernel can update disk usage and report it via quotactl(2).

Todo: enforce quotas limits (limits are not checked by kernel yet)
update repquota, edquota and rpc.rquotad to the new world
implement compat_50_quotactl ioctl.
update quotactl(2) man page

fsck_ffs required fixes so that allocating new blocks or inodes will
properly update the superblock and cg sumaries. This was not an issue up
to now because superblock and cg sumaries check happened last, but now
allocations or frees can happen in pass 6.
 1.10.4.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.10.4.1 17-Apr-2012  yamt sync with head
 1.12.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.13.26.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.10 30-Jan-2012  dholland Remove this material, which is no longer used.
 1.9 25-Nov-2011  dholland Rename struct ufs_quota_entry -> struct quotaval.
 1.8 30-Sep-2011  jym branches: 1.8.2;
Fix an implementation inconsistency with the prop_*_send_syscall() and
prop_*_recv_syscall() functions from proplib(3). They now share the
same logic as the one from prop_*_send_ioctl() functions:
- returns an int
- 0 indicates "no error", otherwise returns the error number (and
set errno)

Many consumers of the prop_*_{ioctl, syscall} expect errno to be set
on error and use err() to display the error message. As such, ensures that
errno gets set before returning from these functions.

prop_*_send_syscall() functions returned a boolean, and now return an int.
Fix all call sites to use the new paradigm (only quota2 is affected in src).

As the prop_*_{send,recv}_syscall() API appeared in -current and is only
used by the recent quota2 code, I am not bumping the lib. The API change
only affects the prop_*_send_syscall() function (recv_syscall()s were
already used correctly), so ensure you are not mixing "old" -current
quota binaries with a new proplib(3) (or the other way around). This
change will be announced via a HEADS-UP and UPDATING.

Does not affect the kernel part of proplib.

Document the correct API in prop_array(3) and prop_dictionary(3).

Thanks to Francois Tigeot for noticing the API inconsistency and
reporting it on tech-kern@.

ok bouyer@.
 1.7 07-Jun-2011  bouyer Fix bad cut'n'paste in copyright. Pointed out by dyoung@
 1.6 24-Mar-2011  bouyer branches: 1.6.2;
Add a new libquota library, which contains some blocks to build and/or
parse quota plists; as well as a getfsquota() function to retrieve quotas
for a single id from a single filesystem (whatever filesystem this is:
a local quota-enabled fs or NFS). This is build on functions getufsquota()
(for local filesystems with UFS-like quotas) and getnfsquota();
which are also available to userland programs.
move functions from quota2_subr.c to libquota or libprop as appropriate,
and ajust in-tree quota tools.
move some declarations from kernel headers to either sys/quota.h or
quota/quota.h as appropriate. ufs/ufs/quota.h still installed because
it's needed by other installed ufs headers.
ufs/ufs/quota1.h still installed as a quick&dirty way to get a code
using the old quotactl() to compile (just include ufs/ufs/quota1.h instead of
ufs/ufs/quota.h - old code won't compile without this change and this is
on purpose).
Discussed on tech-kern@ and tech-net@ (long thread, but not much about
libquota itself ...)
 1.5 12-Mar-2011  bouyer Don't include quotautil.h here, it's not used.
 1.4 06-Mar-2011  christos - merge more code.
- simplify struct access.
 1.3 06-Mar-2011  christos - WARNS=4
- KNF
- don't cast malloc
- don't use static buffers
- fix types
- remove extra \n's from errors
- fix prototypes
 1.2 06-Mar-2011  bouyer merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.
 1.1 28-Jan-2011  bouyer branches: 1.1.2;
file getvfsquota.c was initially added on branch bouyer-quota2.
 1.1.2.3 09-Feb-2011  bouyer Use prop_array_add_and_rel()
 1.1.2.2 30-Jan-2011  bouyer Implement "get version" quotactl command, which return the filesystem's
enabled quota versiob (1 for legacy, 2 for new).
For quota2, make quota and repquota print the user's allowed grace period
if -v is given and not overquota (if overquota, the remaining time is
printed instead, as usual).
 1.1.2.1 28-Jan-2011  bouyer Rename getufsquota to getvfsquota, and abstract in its own file.
 1.6.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.8.2.1 17-Apr-2012  yamt sync with head
 1.6 30-Jan-2012  dholland Remove this material, which is no longer used.
 1.5 25-Nov-2011  dholland Rename struct ufs_quota_entry -> struct quotaval.
 1.4 24-Mar-2011  bouyer branches: 1.4.4;
Add a new libquota library, which contains some blocks to build and/or
parse quota plists; as well as a getfsquota() function to retrieve quotas
for a single id from a single filesystem (whatever filesystem this is:
a local quota-enabled fs or NFS). This is build on functions getufsquota()
(for local filesystems with UFS-like quotas) and getnfsquota();
which are also available to userland programs.
move functions from quota2_subr.c to libquota or libprop as appropriate,
and ajust in-tree quota tools.
move some declarations from kernel headers to either sys/quota.h or
quota/quota.h as appropriate. ufs/ufs/quota.h still installed because
it's needed by other installed ufs headers.
ufs/ufs/quota1.h still installed as a quick&dirty way to get a code
using the old quotactl() to compile (just include ufs/ufs/quota1.h instead of
ufs/ufs/quota.h - old code won't compile without this change and this is
on purpose).
Discussed on tech-kern@ and tech-net@ (long thread, but not much about
libquota itself ...)
 1.3 06-Mar-2011  christos - WARNS=4
- KNF
- don't cast malloc
- don't use static buffers
- fix types
- remove extra \n's from errors
- fix prototypes
 1.2 06-Mar-2011  bouyer merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.
 1.1 28-Jan-2011  bouyer branches: 1.1.2;
file getvfsquota.h was initially added on branch bouyer-quota2.
 1.1.2.2 30-Jan-2011  bouyer Implement "get version" quotactl command, which return the filesystem's
enabled quota versiob (1 for legacy, 2 for new).
For quota2, make quota and repquota print the user's allowed grace period
if -v is given and not overquota (if overquota, the remaining time is
printed instead, as usual).
 1.1.2.1 28-Jan-2011  bouyer Rename getufsquota to getvfsquota, and abstract in its own file.
 1.4.4.1 17-Apr-2012  yamt sync with head
 1.7 04-Mar-2025  andvar s/traditionnal/traditional/ in comment.
 1.6 24-Mar-2011  bouyer branches: 1.6.56;
Add a new libquota library, which contains some blocks to build and/or
parse quota plists; as well as a getfsquota() function to retrieve quotas
for a single id from a single filesystem (whatever filesystem this is:
a local quota-enabled fs or NFS). This is build on functions getufsquota()
(for local filesystems with UFS-like quotas) and getnfsquota();
which are also available to userland programs.
move functions from quota2_subr.c to libquota or libprop as appropriate,
and ajust in-tree quota tools.
move some declarations from kernel headers to either sys/quota.h or
quota/quota.h as appropriate. ufs/ufs/quota.h still installed because
it's needed by other installed ufs headers.
ufs/ufs/quota1.h still installed as a quick&dirty way to get a code
using the old quotactl() to compile (just include ufs/ufs/quota1.h instead of
ufs/ufs/quota.h - old code won't compile without this change and this is
on purpose).
Discussed on tech-kern@ and tech-net@ (long thread, but not much about
libquota itself ...)
 1.5 07-Mar-2011  bouyer Properly evaluate the space needed to print "unlimited" in an human-readable
way.
 1.4 06-Mar-2011  christos - merge more code.
- simplify struct access.
 1.3 06-Mar-2011  christos - WARNS=4
- KNF
- don't cast malloc
- don't use static buffers
- fix types
- remove extra \n's from errors
- fix prototypes
 1.2 06-Mar-2011  bouyer merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.
 1.1 21-Jan-2011  bouyer branches: 1.1.2;
file printquota.c was initially added on branch bouyer-quota2.
 1.1.2.7 30-Jan-2011  bouyer Allow edquota to edit per-user grace times on quota2 (or the default, global
grace times on quota1). Use re-use -t to specify the grace time on command
line; editing the grace time on quota1 is done with -d now.
 1.1.2.6 30-Jan-2011  bouyer Revert to previous format for timeprt, which is less precise but more
user-friendly. Introduce timepprt for cases where we want human-readable but
precise time display.
 1.1.2.5 30-Jan-2011  bouyer Change timeprt to print in weeks, days, hours, minutes, seconds
Change timeprt and intprt to take the number of acceptable char as argument
Drop HN_PRIV_UNLIMITED, the printable space will decide how to print
"unlimited"
 1.1.2.4 30-Jan-2011  bouyer Implement "get version" quotactl command, which return the filesystem's
enabled quota versiob (1 for legacy, 2 for new).
For quota2, make quota and repquota print the user's allowed grace period
if -v is given and not overquota (if overquota, the remaining time is
printed instead, as usual).
 1.1.2.3 30-Jan-2011  bouyer intprt() can be called up to 3 times for a single printf();
make sure to return 3 different static buffers in such a case.
 1.1.2.2 29-Jan-2011  bouyer Allow to pass HN_PRIV_UNLIMITED flag (private to printquota consumers),
which cause it to return "unlimited" instead of "-" of UQUAD_MAX.
Introduce intrd(), which parses a string and return a value appropriate
for quota limits. The string can be a decimal number, a value in
understandable by dehumanize_number(), "-" or "unlimited".
 1.1.2.1 21-Jan-2011  bouyer Add support for quotactl("getall") command, and convert repquota to new
world.
 1.6.56.1 02-Aug-2025  perseant Sync with HEAD
 1.5 24-Mar-2011  bouyer Add a new libquota library, which contains some blocks to build and/or
parse quota plists; as well as a getfsquota() function to retrieve quotas
for a single id from a single filesystem (whatever filesystem this is:
a local quota-enabled fs or NFS). This is build on functions getufsquota()
(for local filesystems with UFS-like quotas) and getnfsquota();
which are also available to userland programs.
move functions from quota2_subr.c to libquota or libprop as appropriate,
and ajust in-tree quota tools.
move some declarations from kernel headers to either sys/quota.h or
quota/quota.h as appropriate. ufs/ufs/quota.h still installed because
it's needed by other installed ufs headers.
ufs/ufs/quota1.h still installed as a quick&dirty way to get a code
using the old quotactl() to compile (just include ufs/ufs/quota1.h instead of
ufs/ufs/quota.h - old code won't compile without this change and this is
on purpose).
Discussed on tech-kern@ and tech-net@ (long thread, but not much about
libquota itself ...)
 1.4 06-Mar-2011  christos - merge more code.
- simplify struct access.
 1.3 06-Mar-2011  christos - WARNS=4
- KNF
- don't cast malloc
- don't use static buffers
- fix types
- remove extra \n's from errors
- fix prototypes
 1.2 06-Mar-2011  bouyer merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.
 1.1 21-Jan-2011  bouyer branches: 1.1.2;
file printquota.h was initially added on branch bouyer-quota2.
 1.1.2.7 30-Jan-2011  bouyer Allow edquota to edit per-user grace times on quota2 (or the default, global
grace times on quota1). Use re-use -t to specify the grace time on command
line; editing the grace time on quota1 is done with -d now.
 1.1.2.6 30-Jan-2011  bouyer Revert to previous format for timeprt, which is less precise but more
user-friendly. Introduce timepprt for cases where we want human-readable but
precise time display.
 1.1.2.5 30-Jan-2011  bouyer Change timeprt to print in weeks, days, hours, minutes, seconds
Change timeprt and intprt to take the number of acceptable char as argument
Drop HN_PRIV_UNLIMITED, the printable space will decide how to print
"unlimited"
 1.1.2.4 30-Jan-2011  bouyer Implement "get version" quotactl command, which return the filesystem's
enabled quota versiob (1 for legacy, 2 for new).
For quota2, make quota and repquota print the user's allowed grace period
if -v is given and not overquota (if overquota, the remaining time is
printed instead, as usual).
 1.1.2.3 29-Jan-2011  bouyer Allow to pass HN_PRIV_UNLIMITED flag (private to printquota consumers),
which cause it to return "unlimited" instead of "-" of UQUAD_MAX.
Introduce intrd(), which parses a string and return a value appropriate
for quota limits. The string can be a decimal number, a value in
understandable by dehumanize_number(), "-" or "unlimited".
 1.1.2.2 28-Jan-2011  bouyer Rename getufsquota to getvfsquota, and abstract in its own file.
 1.1.2.1 21-Jan-2011  bouyer Add support for quotactl("getall") command, and convert repquota to new
world.
 1.23 21-Jan-2020  wiz Use standard Dd format. Remove superfluous Pp
 1.22 20-Jan-2020  dholland ...and it seems that -d is no longer restricted to root.

(No particular reason it should be; I suspect this changed when we got
real quota plumbing as historically -d would have been a special case
of asking about another user.)
 1.21 20-Jan-2020  dholland Document the actual behavior of -g; clarify the optional user/group args.
 1.20 20-Jan-2020  dholland Clarify -u.
 1.19 12-May-2012  wiz branches: 1.19.32;
Bump date for previous.
 1.18 12-May-2012  dholland Remove traces of -D option, which no longer does anything.
 1.17 13-Feb-2012  dholland branches: 1.17.2;
Update dangling references to quotactl(2), mostly now libquota(3), and to
quotactl(8), mostly now quotarestore(8). ok riz@
 1.16 06-Mar-2011  wiz branches: 1.16.4;
Sort options. Split "file system" like usual. Bump date.
 1.15 06-Mar-2011  bouyer merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.
 1.14 07-Aug-2003  agc branches: 1.14.52;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22365, verified by myself.
 1.13 25-Feb-2003  wiz .Nm does not need a dummy argument ("") before punctuation or
for correct formatting of the SYNOPSIS any longer.
 1.12 08-Dec-2001  wiz Sort sections.
 1.11 01-Dec-2001  wiz Whitespace cleanup.
 1.10 22-Mar-1999  garbled More and more .Os cleanups. .Os is defined in the tmac.doc-common file,
so we shouldn't override it with versions in the manpages. Many more to
come.
 1.9 19-Oct-1997  lukem disable WARNS here, fix .Nm usage, deprecate register, s/index/strchr/
 1.8 19-Oct-1997  mrg merge lite-2; clean up includes.
 1.7 09-Jan-1997  tls RCS ID police
 1.6 11-Nov-1996  lukem fix the the typos
 1.5 01-Feb-1996  jtc Fixed to use ffs instead of ufs; See PR #1790, etc.
 1.4 28-Jun-1994  deraadt branches: 1.4.4;
more NFS quota support from <bouyer@ensta.fr> and myself.
 1.3 13-Jun-1994  mycroft Merge local changes.
 1.2 01-Aug-1993  mycroft Add RCS indentifiers.
 1.1 09-Apr-1993  cgd branches: 1.1.1;
added, from net/2 (patch 124).
 1.1.1.1 13-Jun-1994  mycroft Update from 4.4-Lite.
 1.4.4.1 01-Feb-1996  jtc ufs -> ffs change from main branch
 1.14.52.3 21-Jan-2011  bouyer Add support for quotactl("getall") command, and convert repquota to new
world.
 1.14.52.2 21-Jan-2011  bouyer Remove FILES section, it's obsolete
 1.14.52.1 20-Jan-2011  bouyer Snapshot of work in progress on a modernised disk quota system:
- new quotactl syscall (versionned for backward compat), which takes
as parameter a path to a mount point, and a prop_dictionary
(in plistref format) describing commands and arguments.
For each command, status and data are returned as a prop_dictionary.
quota commands features will be added to take advantage of this,
exporting quota data or getting quota commands as plists.

- new on disk-format storage (all 64bit wide), integrated to metadata for
ffs (and playing nicely with wapbl).
Quotas are enabled on a ffs filesystem via superblock flags.
tunefs(8) can enable or disable quotas.
On a quota-enabled filesystem, fsck_ffs(8) will track per-uid/gid
block and inode usages, and will check and update quotas in Pass 6.
quota usage and limits are stored in unliked files (one for users,
one for groups)l fsck_ffs(8) will create the files if needed, or
free them if needed. This means that after enabling or disabling
quotas on a filesystem; a fsck_ffs(8) run is required.
quotacheck(8) is not needed any more, on a unclean shutdown
fsck or journal replay will take care of fixing quotas.
newfs(8) can create a ready-to-mount quota-enabled filesystem
(superblock flags are set and quota inodes are created).
Other new features or semantic changes:
- default quota datas, applied to users or groups which don't already
have a quota entry
- per-user/group grace time (instead of a filesystem global one)
- 0 really means "nothing allowed at all", not "no limit".
If you want "no limit", set the limit to UQUAD_MAX (tools will
understand "unlimited" and "-")

A quota file is structured as follow:
it starts with a header, containing a few per-filesystem values,
and the default quota limits.
Quota entries are linked together as a simple list, each entry has a
pointer (as an offset withing the file) to the next.
The header has a pointer to a list of free quota entries, and
a hash table of in-use entries. The size of the hash table depends
on the filesystem block size (header+hash table should fit in the
first block). The file is not sparse and is a multiple of
filesystem block size (when the free quota entry list is empty a new
filesystem block is allocated). quota entries to not cross
filesystem block boundaries.

In memory, the kernel keeps a cache of recently used quota entries
as a reference to the block number, and offset withing the block.
The quota entry itself is keept in the buf cache.

fsck_ffs(8), tunefs(8) and newfs(8) supports are completed (with
related atf tests :)
The kernel can update disk usage and report it via quotactl(2).

Todo: enforce quotas limits (limits are not checked by kernel yet)
update repquota, edquota and rpc.rquotad to the new world
implement compat_50_quotactl ioctl.
update quotactl(2) man page

fsck_ffs required fixes so that allocating new blocks or inodes will
properly update the superblock and cg sumaries. This was not an issue up
to now because superblock and cg sumaries check happened last, but now
allocations or frees can happen in pass 6.
 1.16.4.2 23-May-2012  yamt sync with head.
 1.16.4.1 17-Apr-2012  yamt sync with head
 1.17.2.1 19-May-2012  riz Pull up following revision(s) (requested by dholland in ticket #268):
usr.bin/quota/quota.1: revision 1.18
usr.bin/quota/quota.1: revision 1.19
usr.sbin/repquota/repquota.8: revision 1.16
usr.sbin/repquota/repquota.8: revision 1.17
usr.bin/quota/quota.c: revision 1.49
usr.sbin/repquota/repquota.c: revision 1.44
Remove traces of -D flag, which no longer does anything.
Remove traces of -D option, which no longer does anything.
Bump date for previous.
Bump date for previous.
 1.19.32.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.50 13-Jul-2014  dholland Remove leftover #if 0 code from before the libquota rework.
 1.49 12-May-2012  dholland branches: 1.49.2; 1.49.8;
Remove traces of -D option, which no longer does anything.
 1.48 05-Feb-2012  dholland branches: 1.48.2;
Remove unneeded #include.
 1.47 01-Feb-2012  dholland Simplify elaborate calls to quota_check_limit().
 1.46 30-Jan-2012  dholland Remove unused include.
 1.45 30-Jan-2012  dholland Remove an old, no longer necessary hack from libquota and handle the
relevant case properly in usr.bin/quota.
 1.44 09-Jan-2012  dholland Clean up usr.bin/quota to use the new libquota API.
(with one relatively minor exception remaining)
 1.43 30-Nov-2011  dholland Adjust the quota-fetching code to allow more than two object types.
(as far as we can so far, at least)

Note that quota won't actually work fully with multiple object types
as it is, but this and the last change are a good start and do fold
together a lot of duplicated code.
 1.42 30-Nov-2011  dholland Clean up the printout code to support more than the old fixed two
object types.
 1.41 30-Nov-2011  dholland Move a big chunk of code out of a loop into its own function.
 1.40 27-Nov-2011  dholland Use __dead, not attribute noreturn.
 1.39 27-Nov-2011  dholland The proper type for a variable that can be either a uid or gid is id_t,
not uint32_t.
 1.38 25-Nov-2011  dholland Rename struct ufs_quota_entry -> struct quotaval.
 1.37 24-Mar-2011  bouyer branches: 1.37.4;
Add a new libquota library, which contains some blocks to build and/or
parse quota plists; as well as a getfsquota() function to retrieve quotas
for a single id from a single filesystem (whatever filesystem this is:
a local quota-enabled fs or NFS). This is build on functions getufsquota()
(for local filesystems with UFS-like quotas) and getnfsquota();
which are also available to userland programs.
move functions from quota2_subr.c to libquota or libprop as appropriate,
and ajust in-tree quota tools.
move some declarations from kernel headers to either sys/quota.h or
quota/quota.h as appropriate. ufs/ufs/quota.h still installed because
it's needed by other installed ufs headers.
ufs/ufs/quota1.h still installed as a quick&dirty way to get a code
using the old quotactl() to compile (just include ufs/ufs/quota1.h instead of
ufs/ufs/quota.h - old code won't compile without this change and this is
on purpose).
Discussed on tech-kern@ and tech-net@ (long thread, but not much about
libquota itself ...)
 1.36 06-Mar-2011  christos - merge more code.
- simplify struct access.
 1.35 06-Mar-2011  christos - WARNS=4
- KNF
- don't cast malloc
- don't use static buffers
- fix types
- remove extra \n's from errors
- fix prototypes
 1.34 06-Mar-2011  bouyer merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.
 1.33 13-Apr-2009  lukem branches: 1.33.2;
Fix -Wcast-qual and -Wshadow issues
 1.32 21-Jul-2008  lukem branches: 1.32.6;
Remove the \n and tabs from the __COPYRIGHT() strings.
Tweak to use a consistent format.
 1.31 17-Jul-2007  christos branches: 1.31.12;
eliminate MFSTYPENAME
 1.30 07-Sep-2004  jrf Replaced strncpy with strlcpy. Thanks to Peter Postma who
pointed them our in PR #25762. Approved by christos@NetBSD.org.
 1.29 21-Apr-2004  christos Replace the statfs() family of system calls with statvfs().
Retain binary compatibility.
 1.28 05-Jan-2004  jmmv Homogenize usage messages: make the 'usage' word all lowercase, as this seems
to be the most common practice in our tree.
 1.27 21-Sep-2003  bouyer Check the right error code to fallback to rquota v1 RPC.
Problem found and fix tested by Jan Schaumann.
 1.26 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22365, verified by myself.
 1.25 14-Feb-2003  bouyer Implement rquota RPC version 2, compatible with the linux implementation,
as proposed on tech-userlevel on Dec 06 2002. This allows to retrieve
group quota informations from NFS servers.
 1.24 06-Jan-2003  wiz specified, not specifed.
 1.23 29-Mar-2001  cgd Fix order of arithmetic operations so that NFS file system quotas over
4GB are displayed properly.
 1.22 16-Dec-1999  bouyer branches: 1.22.4;
Explicitely cast to (u_quad_t) calls to btodb() and dbtob() to avoid
int overflow. It's now possible to add/display quotas of more than
4G.
XXX I'm sure there is a PR open on this but I couln't find it with the
usual search engines. If someone knows it's number ...
 1.21 25-Aug-1998  ross branches: 1.21.2; 1.21.6;
Add { and } to shut up egcs. Reformat the more questionable code.
 1.20 26-Jul-1998  mycroft const poisoning.
 1.19 12-Jul-1998  mrg call getuid() once. KNF. ensure a buffer is nul-terminated.
 1.18 02-Apr-1998  kleink Need <time.h> for time() prototype.
 1.17 20-Oct-1997  mrg fix compile warnings on the sparc.
 1.16 19-Oct-1997  lukem disable WARNS here, fix .Nm usage, deprecate register, s/index/strchr/
 1.15 19-Oct-1997  mrg merge lite-2; clean up includes.
 1.14 25-Aug-1997  kleink Lseek(2) usage cleanup: the use of L_SET/L_INCR/L_XTND is deprecated,
use SEEK_SET/SEEK_CUR/SEEK_END instead.
 1.13 11-Feb-1997  mrg remove dangerous sprintf and strcpy calls.
 1.12 09-Jan-1997  tls RCS ID police
 1.11 01-Apr-1996  mark Use an integer instead of a char to store the getopt() return value in
order to match the function prototype and to work with compilers that
default to unsigned chars.
Compare the getopt() return value with -1 instead of EOF.
 1.10 01-Feb-1996  jtc Fixed to use ffs instead of ufs; See PR #1790, etc.
 1.9 18-Jun-1995  cgd branches: 1.9.2;
don't assume f_fstypename is larger than MFSNAMELEN or is nul-terminated
 1.8 03-Jun-1995  mycroft Include the egid when displaying the groups and doing security checks.
 1.7 24-Dec-1994  cgd needs stdlib.h
 1.6 28-Jun-1994  deraadt more NFS quota support from <bouyer@ensta.fr> and myself.
 1.5 13-Jun-1994  mycroft Merge local changes.
 1.4 01-Apr-1994  cgd long cast
 1.3 01-Apr-1994  jtc Getgroup's second argument is now a gid_t ptr.
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 09-Apr-1993  cgd branches: 1.1.1;
added, from net/2 (patch 124).
 1.1.1.2 28-Sep-1995  tls imported from 44lite2
 1.1.1.1 13-Jun-1994  mycroft Update from 4.4-Lite.
 1.9.2.1 01-Feb-1996  jtc ufs -> ffs change from main branch
 1.21.6.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.21.2.1 16-Dec-1999  he Pull up revision 1.22 (requested by bouyer):
Allow use of quotas bigger than 4GB by avoiding integer overflow.
 1.22.4.1 30-Mar-2001  he Pull up revision 1.23 (requested by cgd):
Fix order of arithmetic operations so that NFS file system quotas
over 4GB are displayed properly.
 1.31.12.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.32.6.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.33.2.10 05-Mar-2011  bouyer The new quotactl interface should be filesystem-independant, so check only the
MNT_QUOTA flag.
 1.33.2.9 14-Feb-2011  bouyer With quota2 semantic, we may be overquota even if usage is 0.
Print quota in default output in this case.
 1.33.2.8 14-Feb-2011  bouyer The rpc.rquotad protocol uses the legacy definitions and integer types.
Convert from/to dqblk using the quota1_subr.c routines to have the
necessery convertions done.
 1.33.2.7 03-Feb-2011  bouyer factor out code to chech a quota against its limits.
 1.33.2.6 31-Jan-2011  bouyer Catch up with Q2V -> QL rename
 1.33.2.5 30-Jan-2011  bouyer Change timeprt to print in weeks, days, hours, minutes, seconds
Change timeprt and intprt to take the number of acceptable char as argument
Drop HN_PRIV_UNLIMITED, the printable space will decide how to print
"unlimited"
 1.33.2.4 30-Jan-2011  bouyer Implement "get version" quotactl command, which return the filesystem's
enabled quota versiob (1 for legacy, 2 for new).
For quota2, make quota and repquota print the user's allowed grace period
if -v is given and not overquota (if overquota, the remaining time is
printed instead, as usual).
 1.33.2.3 28-Jan-2011  bouyer Rename getufsquota to getvfsquota, and abstract in its own file.
 1.33.2.2 21-Jan-2011  bouyer Add support for quotactl("getall") command, and convert repquota to new
world.
 1.33.2.1 20-Jan-2011  bouyer Snapshot of work in progress on a modernised disk quota system:
- new quotactl syscall (versionned for backward compat), which takes
as parameter a path to a mount point, and a prop_dictionary
(in plistref format) describing commands and arguments.
For each command, status and data are returned as a prop_dictionary.
quota commands features will be added to take advantage of this,
exporting quota data or getting quota commands as plists.

- new on disk-format storage (all 64bit wide), integrated to metadata for
ffs (and playing nicely with wapbl).
Quotas are enabled on a ffs filesystem via superblock flags.
tunefs(8) can enable or disable quotas.
On a quota-enabled filesystem, fsck_ffs(8) will track per-uid/gid
block and inode usages, and will check and update quotas in Pass 6.
quota usage and limits are stored in unliked files (one for users,
one for groups)l fsck_ffs(8) will create the files if needed, or
free them if needed. This means that after enabling or disabling
quotas on a filesystem; a fsck_ffs(8) run is required.
quotacheck(8) is not needed any more, on a unclean shutdown
fsck or journal replay will take care of fixing quotas.
newfs(8) can create a ready-to-mount quota-enabled filesystem
(superblock flags are set and quota inodes are created).
Other new features or semantic changes:
- default quota datas, applied to users or groups which don't already
have a quota entry
- per-user/group grace time (instead of a filesystem global one)
- 0 really means "nothing allowed at all", not "no limit".
If you want "no limit", set the limit to UQUAD_MAX (tools will
understand "unlimited" and "-")

A quota file is structured as follow:
it starts with a header, containing a few per-filesystem values,
and the default quota limits.
Quota entries are linked together as a simple list, each entry has a
pointer (as an offset withing the file) to the next.
The header has a pointer to a list of free quota entries, and
a hash table of in-use entries. The size of the hash table depends
on the filesystem block size (header+hash table should fit in the
first block). The file is not sparse and is a multiple of
filesystem block size (when the free quota entry list is empty a new
filesystem block is allocated). quota entries to not cross
filesystem block boundaries.

In memory, the kernel keeps a cache of recently used quota entries
as a reference to the block number, and offset withing the block.
The quota entry itself is keept in the buf cache.

fsck_ffs(8), tunefs(8) and newfs(8) supports are completed (with
related atf tests :)
The kernel can update disk usage and report it via quotactl(2).

Todo: enforce quotas limits (limits are not checked by kernel yet)
update repquota, edquota and rpc.rquotad to the new world
implement compat_50_quotactl ioctl.
update quotactl(2) man page

fsck_ffs required fixes so that allocating new blocks or inodes will
properly update the superblock and cg sumaries. This was not an issue up
to now because superblock and cg sumaries check happened last, but now
allocations or frees can happen in pass 6.
 1.37.4.2 23-May-2012  yamt sync with head.
 1.37.4.1 17-Apr-2012  yamt sync with head
 1.48.2.1 19-May-2012  riz Pull up following revision(s) (requested by dholland in ticket #268):
usr.bin/quota/quota.1: revision 1.18
usr.bin/quota/quota.1: revision 1.19
usr.sbin/repquota/repquota.8: revision 1.16
usr.sbin/repquota/repquota.8: revision 1.17
usr.bin/quota/quota.c: revision 1.49
usr.sbin/repquota/repquota.c: revision 1.44
Remove traces of -D flag, which no longer does anything.
Remove traces of -D option, which no longer does anything.
Bump date for previous.
Bump date for previous.
 1.49.8.1 10-Aug-2014  tls Rebase.
 1.49.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.6 30-Jan-2012  dholland Remove stray p in identifier name. This has (as far as I can tell)
prevented quotacheck and other old-style quota bits from working since
last March. Use a correct declaration in the header file, so that if
something similar happens again affected programs will fail to link
instead of failing to work.

This kind of nonsense is why I like -Wl,-warn-common.
 1.5 30-Jan-2012  dholland Don't strlcpy from a string buffer to itself; the behavior is not
defined.
 1.4 25-Jan-2012  dholland Remove unnecessary include.
 1.3 24-Mar-2011  bouyer branches: 1.3.4;
Add a new libquota library, which contains some blocks to build and/or
parse quota plists; as well as a getfsquota() function to retrieve quotas
for a single id from a single filesystem (whatever filesystem this is:
a local quota-enabled fs or NFS). This is build on functions getufsquota()
(for local filesystems with UFS-like quotas) and getnfsquota();
which are also available to userland programs.
move functions from quota2_subr.c to libquota or libprop as appropriate,
and ajust in-tree quota tools.
move some declarations from kernel headers to either sys/quota.h or
quota/quota.h as appropriate. ufs/ufs/quota.h still installed because
it's needed by other installed ufs headers.
ufs/ufs/quota1.h still installed as a quick&dirty way to get a code
using the old quotactl() to compile (just include ufs/ufs/quota1.h instead of
ufs/ufs/quota.h - old code won't compile without this change and this is
on purpose).
Discussed on tech-kern@ and tech-net@ (long thread, but not much about
libquota itself ...)
 1.2 06-Mar-2011  christos merge one more triplicated function
 1.1 06-Mar-2011  christos - merge more code.
- simplify struct access.
 1.3.4.1 17-Apr-2012  yamt sync with head
 1.4 30-Jan-2012  dholland Remove stray p in identifier name. This has (as far as I can tell)
prevented quotacheck and other old-style quota bits from working since
last March. Use a correct declaration in the header file, so that if
something similar happens again affected programs will fail to link
instead of failing to work.

This kind of nonsense is why I like -Wl,-warn-common.
 1.3 24-Mar-2011  bouyer branches: 1.3.4;
Add a new libquota library, which contains some blocks to build and/or
parse quota plists; as well as a getfsquota() function to retrieve quotas
for a single id from a single filesystem (whatever filesystem this is:
a local quota-enabled fs or NFS). This is build on functions getufsquota()
(for local filesystems with UFS-like quotas) and getnfsquota();
which are also available to userland programs.
move functions from quota2_subr.c to libquota or libprop as appropriate,
and ajust in-tree quota tools.
move some declarations from kernel headers to either sys/quota.h or
quota/quota.h as appropriate. ufs/ufs/quota.h still installed because
it's needed by other installed ufs headers.
ufs/ufs/quota1.h still installed as a quick&dirty way to get a code
using the old quotactl() to compile (just include ufs/ufs/quota1.h instead of
ufs/ufs/quota.h - old code won't compile without this change and this is
on purpose).
Discussed on tech-kern@ and tech-net@ (long thread, but not much about
libquota itself ...)
 1.2 06-Mar-2011  christos merge one more triplicated function
 1.1 06-Mar-2011  christos - merge more code.
- simplify struct access.
 1.3.4.1 17-Apr-2012  yamt sync with head

RSS XML Feed