Home | History | Annotate | Download | only in quota
History log of /src/usr.bin/quota/quota.c
RevisionDateAuthorComments
 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.

RSS XML Feed