Module Name:    src
Committed By:   dholland
Date:           Mon Feb 13 01:24:03 UTC 2012

Modified Files:
        src/distrib/sets/lists/comp: mi
        src/lib/libc/sys: Makefile.inc
        src/lib/libquota: Makefile libquota.3
        src/share/man/man9: vfsops.9
Added Files:
        src/lib/libc/sys: __quotactl.2
Removed Files:
        src/lib/libc/sys: quotactl.2

Log Message:
Quota-related docs fixes:

- Remove old quotactl(2); replace with new __quotactl(2).
- Document quota_getrestrictions(3), the semantic restriction codes,
  and quota_quotaon/off(3).
- Update VFS_QUOTACTL(9), which was still describing the pre-proplib API.

Approved by releng for the freeze.


To generate a diff of this commit:
cvs rdiff -u -r1.1733 -r1.1734 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.211 -r1.212 src/lib/libc/sys/Makefile.inc
cvs rdiff -u -r0 -r1.1 src/lib/libc/sys/__quotactl.2
cvs rdiff -u -r1.29 -r0 src/lib/libc/sys/quotactl.2
cvs rdiff -u -r1.8 -r1.9 src/lib/libquota/Makefile
cvs rdiff -u -r1.3 -r1.4 src/lib/libquota/libquota.3
cvs rdiff -u -r1.43 -r1.44 src/share/man/man9/vfsops.9

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.1733 src/distrib/sets/lists/comp/mi:1.1734
--- src/distrib/sets/lists/comp/mi:1.1733	Sat Feb 11 23:31:22 2012
+++ src/distrib/sets/lists/comp/mi	Mon Feb 13 01:24:01 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.1733 2012/02/11 23:31:22 martin Exp $
+#	$NetBSD: mi,v 1.1734 2012/02/13 01:24:01 dholland Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -4655,6 +4655,7 @@
 ./usr/share/man/cat1/yacc.0			comp-c-catman		.cat
 ./usr/share/man/cat2/_Exit.0			comp-c-catman		.cat
 ./usr/share/man/cat2/__clone.0			comp-c-catman		.cat
+./usr/share/man/cat2/__quotactl.0		comp-c-catman		.cat
 ./usr/share/man/cat2/__syscall.0		comp-c-catman		.cat
 ./usr/share/man/cat2/_exit.0			comp-c-catman		.cat
 ./usr/share/man/cat2/_lwp_continue.0		comp-c-catman		.cat
@@ -4838,7 +4839,7 @@
 ./usr/share/man/cat2/ptrace.0			comp-c-catman		.cat
 ./usr/share/man/cat2/pwrite.0			comp-c-catman		.cat
 ./usr/share/man/cat2/pwritev.0			comp-c-catman		.cat
-./usr/share/man/cat2/quotactl.0			comp-c-catman		.cat
+./usr/share/man/cat2/quotactl.0			comp-obsolete		obsolete
 ./usr/share/man/cat2/rasctl.0			comp-c-catman		.cat
 ./usr/share/man/cat2/read.0			comp-c-catman		.cat
 ./usr/share/man/cat2/readlink.0			comp-c-catman		.cat
@@ -8549,12 +8550,15 @@
 ./usr/share/man/cat3/quota_getmountpoint.0	comp-c-catman		.cat
 ./usr/share/man/cat3/quota_getnumidtypes.0	comp-c-catman		.cat
 ./usr/share/man/cat3/quota_getnumobjtypes.0	comp-c-catman		.cat
+./usr/share/man/cat3/quota_getrestrictions.0	comp-c-catman		.cat
 ./usr/share/man/cat3/quota_idtype_getname.0	comp-c-catman		.cat
 ./usr/share/man/cat3/quota_objtype_getname.0	comp-c-catman		.cat
 ./usr/share/man/cat3/quota_objtype_isbytes.0	comp-c-catman		.cat
 ./usr/share/man/cat3/quota_open.0		comp-c-catman		.cat
 ./usr/share/man/cat3/quota_opencursor.0		comp-c-catman		.cat
 ./usr/share/man/cat3/quota_put.0		comp-c-catman		.cat
+./usr/share/man/cat3/quota_quotaoff.0		comp-c-catman		.cat
+./usr/share/man/cat3/quota_quotaon.0		comp-c-catman		.cat
 ./usr/share/man/cat3/quotacursor_atend.0	comp-c-catman		.cat
 ./usr/share/man/cat3/quotacursor_close.0	comp-c-catman		.cat
 ./usr/share/man/cat3/quotacursor_get.0		comp-c-catman		.cat
@@ -11024,6 +11028,7 @@
 ./usr/share/man/html1/yacc.html			comp-c-htmlman		html
 ./usr/share/man/html2/_Exit.html		comp-c-htmlman		html
 ./usr/share/man/html2/__clone.html		comp-c-htmlman		html
+./usr/share/man/html2/__quotactl.html		comp-c-htmlman		html
 ./usr/share/man/html2/__syscall.html		comp-c-htmlman		html
 ./usr/share/man/html2/_exit.html		comp-c-htmlman		html
 ./usr/share/man/html2/_lwp_continue.html	comp-c-htmlman		html
@@ -11199,7 +11204,7 @@
 ./usr/share/man/html2/ptrace.html		comp-c-htmlman		html
 ./usr/share/man/html2/pwrite.html		comp-c-htmlman		html
 ./usr/share/man/html2/pwritev.html		comp-c-htmlman		html
-./usr/share/man/html2/quotactl.html		comp-c-htmlman		html
+./usr/share/man/html2/quotactl.html		comp-obsolete		obsolete
 ./usr/share/man/html2/rasctl.html		comp-c-htmlman		html
 ./usr/share/man/html2/read.html			comp-c-htmlman		html
 ./usr/share/man/html2/readlink.html		comp-c-htmlman		html
@@ -14801,12 +14806,15 @@
 ./usr/share/man/html3/quota_getmountpoint.html	comp-c-htmlman		html
 ./usr/share/man/html3/quota_getnumidtypes.html	comp-c-htmlman		html
 ./usr/share/man/html3/quota_getnumobjtypes.html	comp-c-htmlman		html
+./usr/share/man/html3/quota_getrestrictions.html	comp-c-htmlman		html
 ./usr/share/man/html3/quota_idtype_getname.html	comp-c-htmlman		html
 ./usr/share/man/html3/quota_objtype_getname.html	comp-c-htmlman		html
 ./usr/share/man/html3/quota_objtype_isbytes.html	comp-c-htmlman		html
 ./usr/share/man/html3/quota_open.html		comp-c-htmlman		html
 ./usr/share/man/html3/quota_opencursor.html	comp-c-htmlman		html
 ./usr/share/man/html3/quota_put.html		comp-c-htmlman		html
+./usr/share/man/html3/quota_quotaoff.html		comp-c-htmlman		html
+./usr/share/man/html3/quota_quotaon.html		comp-c-htmlman		html
 ./usr/share/man/html3/quotacursor_atend.html	comp-c-htmlman		html
 ./usr/share/man/html3/quotacursor_close.html	comp-c-htmlman		html
 ./usr/share/man/html3/quotacursor_get.html	comp-c-htmlman		html
@@ -17159,6 +17167,7 @@
 ./usr/share/man/man1/yacc.1			comp-c-man		.man
 ./usr/share/man/man2/_Exit.2			comp-c-man		.man
 ./usr/share/man/man2/__clone.2			comp-c-man		.man
+./usr/share/man/man2/__quotactl.2		comp-c-man		.man
 ./usr/share/man/man2/__syscall.2		comp-c-man		.man
 ./usr/share/man/man2/_exit.2			comp-c-man		.man
 ./usr/share/man/man2/_lwp_continue.2		comp-c-man		.man
@@ -17341,7 +17350,7 @@
 ./usr/share/man/man2/ptrace.2			comp-c-man		.man
 ./usr/share/man/man2/pwrite.2			comp-c-man		.man
 ./usr/share/man/man2/pwritev.2			comp-c-man		.man
-./usr/share/man/man2/quotactl.2			comp-c-man		.man
+./usr/share/man/man2/quotactl.2			comp-obsolete		obsolete
 ./usr/share/man/man2/rasctl.2			comp-c-man		.man
 ./usr/share/man/man2/read.2			comp-c-man		.man
 ./usr/share/man/man2/readlink.2			comp-c-man		.man
@@ -21051,12 +21060,15 @@
 ./usr/share/man/man3/quota_getmountpoint.3	comp-c-man		.man
 ./usr/share/man/man3/quota_getnumidtypes.3	comp-c-man		.man
 ./usr/share/man/man3/quota_getnumobjtypes.3	comp-c-man		.man
+./usr/share/man/man3/quota_getrestrictions.3		comp-c-man		.man
 ./usr/share/man/man3/quota_idtype_getname.3	comp-c-man		.man
 ./usr/share/man/man3/quota_objtype_getname.3	comp-c-man		.man
 ./usr/share/man/man3/quota_objtype_isbytes.3	comp-c-man		.man
 ./usr/share/man/man3/quota_open.3		comp-c-man		.man
 ./usr/share/man/man3/quota_opencursor.3		comp-c-man		.man
 ./usr/share/man/man3/quota_put.3		comp-c-man		.man
+./usr/share/man/man3/quota_quotaoff.3		comp-c-man		.man
+./usr/share/man/man3/quota_quotaon.3		comp-c-man		.man
 ./usr/share/man/man3/quotacursor_atend.3	comp-c-man		.man
 ./usr/share/man/man3/quotacursor_close.3	comp-c-man		.man
 ./usr/share/man/man3/quotacursor_get.3		comp-c-man		.man

Index: src/lib/libc/sys/Makefile.inc
diff -u src/lib/libc/sys/Makefile.inc:1.211 src/lib/libc/sys/Makefile.inc:1.212
--- src/lib/libc/sys/Makefile.inc:1.211	Sat Feb 11 23:31:24 2012
+++ src/lib/libc/sys/Makefile.inc	Mon Feb 13 01:24:03 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.211 2012/02/11 23:31:24 martin Exp $
+#	$NetBSD: Makefile.inc,v 1.212 2012/02/13 01:24:03 dholland Exp $
 #	@(#)Makefile.inc	8.3 (Berkeley) 10/24/94
 
 # sys sources
@@ -231,7 +231,7 @@ MAN+=	accept.2 access.2 acct.2 adjtime.2
 	mount.2 \
 	mprotect.2 mremap.2 msgctl.2 msgget.2 msgrcv.2 msgsnd.2 msync.2 \
 	munmap.2 nanosleep.2 nfssvc.2 ntp_adjtime.2 open.2 pathconf.2 pipe.2 \
-	pmc_control.2 poll.2 posix_fadvise.2 profil.2 ptrace.2 quotactl.2 \
+	pmc_control.2 poll.2 posix_fadvise.2 profil.2 ptrace.2 __quotactl.2 \
 	rasctl.2 read.2 readlink.2 \
 	reboot.2 recv.2 rename.2 revoke.2 rmdir.2 \
 	select.2 semctl.2 \

Index: src/lib/libquota/Makefile
diff -u src/lib/libquota/Makefile:1.8 src/lib/libquota/Makefile:1.9
--- src/lib/libquota/Makefile:1.8	Wed Feb  1 17:52:07 2012
+++ src/lib/libquota/Makefile	Mon Feb 13 01:24:03 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.8 2012/02/01 17:52:07 dholland Exp $
+#	$NetBSD: Makefile,v 1.9 2012/02/13 01:24:03 dholland Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/4/93
 
 .include <bsd.own.mk>
@@ -25,12 +25,15 @@ MLINKS=	libquota.3 quota_close.3 \
 	libquota.3 quota_getmountpoint.3 \
 	libquota.3 quota_getnumidtypes.3 \
 	libquota.3 quota_getnumobjtypes.3 \
+	libquota.3 quota_getrestrictions.3 \
 	libquota.3 quota_idtype_getname.3 \
 	libquota.3 quota_objtype_getname.3 \
 	libquota.3 quota_objtype_isbytes.3 \
 	libquota.3 quota_open.3 \
 	libquota.3 quota_opencursor.3 \
 	libquota.3 quota_put.3 \
+	libquota.3 quota_quotaoff.3 \
+	libquota.3 quota_quotaon.3 \
 	libquota.3 quotacursor_atend.3 \
 	libquota.3 quotacursor_close.3 \
 	libquota.3 quotacursor_get.3 \

Index: src/lib/libquota/libquota.3
diff -u src/lib/libquota/libquota.3:1.3 src/lib/libquota/libquota.3:1.4
--- src/lib/libquota/libquota.3:1.3	Wed Feb  1 05:46:46 2012
+++ src/lib/libquota/libquota.3	Mon Feb 13 01:24:03 2012
@@ -1,4 +1,4 @@
-.\"	$NetBSD: libquota.3,v 1.3 2012/02/01 05:46:46 dholland Exp $
+.\"	$NetBSD: libquota.3,v 1.4 2012/02/13 01:24:03 dholland Exp $
 .\"
 .\" Copyright (c) 2012 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -36,6 +36,7 @@
 .Nm quota_getmountdevice ,
 .Nm quota_getmountpoint ,
 .Nm quota_getimplname ,
+.Nm quota_getrestrictions ,
 .Nm quota_getnumidtypes ,
 .Nm quota_getnumobjtypes ,
 .Nm quota_idtype_getname ,
@@ -51,6 +52,8 @@
 .Nm quotacursor_getn ,
 .Nm quotacursor_atend ,
 .Nm quotacursor_rewind ,
+.Nm quota_quotaon ,
+.Nm quota_quotaoff ,
 .Nm quotaval_clear
 .Nd disk quota access and control library
 .Sh LIBRARY
@@ -67,6 +70,8 @@
 .Fn quota_getmountpoint "struct quotahandle *qh"
 .Ft const char *
 .Fn quota_getimplname "struct quotahandle *qh"
+.Ft unsigned
+.Fn quota_getrestrictions "struct quotahandle *qh"
 .Ft int
 .Fn quota_getnumidtypes "struct quotahandle *qh"
 .Ft int
@@ -97,6 +102,10 @@
 .Fn quotacursor_atend "struct quotacursor *qc"
 .Ft int
 .Fn quotacursor_rewind "struct quotacursor *qc"
+.Ft int
+.Fn quota_quotaon "struct quotahandle *qh" "int idtype"
+.Ft int
+.Fn quota_quotaoff "struct quotahandle *qh" "int idtype"
 .Ft void
 .Fn quotaval_clear "struct quotaval *qv"
 .Sh DESCRIPTION
@@ -218,6 +227,42 @@ library provides access to quota v1 data
 .Xr quotaon 8
 is called by direct access to the on-disk quota information.
 However, this method is not recommended.
+Note that the
+.Dv userquota
+and
+.Dv groupquota
+mount options are read and interpreted at quotaon time, not
+.Xr mount 8
+time.
+This allowed historic implementations to avoid storing the path in the
+kernel.
+.Ss Semantic Restrictions
+Some quota implementations are restricted in their functionality or
+semantics.
+The following restriction codes are defined to allow
+.Nm libquota
+client code to adapt or to provide more helpful diagnostic messages.
+.Bl -tag -width 4n
+.It QUOTA_RESTRICT_NEEDSQUOTACHECK
+The quota implementation is a quota v1 system and requires the
+old-style quota check and mount process as described in the
+previous section.
+.It QUOTA_RESTRICT_UNIFORMGRACE
+The grace period for how long a quota can be over the soft limit can
+be specified only once, globally, for all principals.
+It is set via the default
+.Pq Dv QUOTA_DEFAULTID
+quota entry.
+.It QUOTA_RESTRICT_32BIT
+The values in struct quotaval are limited to 32 bits wide.
+Larger values will be treated as
+.Dv QUOTA_NOLIMIT .
+.It QUOTA_RESTRICT_READONLY
+The quota information is read-only.
+Attempts to update it using
+.Fn quota_put
+or other functions will fail.
+.El
 .Ss Function Descriptions
 .Bl -tag -width 4n
 .It Fn quota_open
@@ -246,6 +291,10 @@ This is retrieved with
 Return a human-readable string describing the underlying quota
 implementation.
 Client programs should not attempt to interpret this string.
+.It Fn quota_getrestrictions
+Return the semantic restriction flags for the underlying quota
+implementation.
+The possible flags are described above.
 .It Fn quota_getnumidtypes
 Return the number of ID types supported by this volume.
 Will ordinarily be two; ideally code using this library should be
@@ -344,6 +393,30 @@ Returns true if the cursor has reached t
 .It Fn quotacursor_rewind
 Resets a cursor to point to the beginning of the quota store, allowing
 another pass over the data.
+.It Fn quota_quotaon
+For old-style quota v1 implementations, this function enables quotas
+for the specified ID type.
+To ensure that the quota files are consistent with the file system
+state,
+.Xr quotacheck 8
+must have been run beforehand.
+As described above, the file system volume must be listed in
+.Xr fstab 5
+and the corresponding old-style mount option,
+.Dv userquota
+or
+.Dv groupquota ,
+must be set therein.
+The path name for the quota file is retrieved from
+.Xr fstab 5
+and passed to the kernel.
+This function will fail if used on newer quota implementations with
+in-file-system quotas.
+.It Fn quota_quotaoff
+For old-style quotas, this function disables quotas for the specified
+ID type.
+This function will fail if used on newer quota implementations with
+in-file-system quotas.
 .It Fn quotaval_clear
 A convenience function for initializing a struct quotaval instance
 to the default empty state.

Index: src/share/man/man9/vfsops.9
diff -u src/share/man/man9/vfsops.9:1.43 src/share/man/man9/vfsops.9:1.44
--- src/share/man/man9/vfsops.9:1.43	Thu Dec  2 12:54:13 2010
+++ src/share/man/man9/vfsops.9	Mon Feb 13 01:24:00 2012
@@ -1,4 +1,4 @@
-.\"     $NetBSD: vfsops.9,v 1.43 2010/12/02 12:54:13 wiz Exp $
+.\"     $NetBSD: vfsops.9,v 1.44 2012/02/13 01:24:00 dholland Exp $
 .\"
 .\" Copyright (c) 2001 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -60,7 +60,7 @@
 .Ft int
 .Fn VFS_ROOT "struct mount *mp" "struct vnode **vpp"
 .Ft int
-.Fn VFS_QUOTACTL "struct mount *mp" "int cmds" "uid_t uid" "void *arg"
+.Fn VFS_QUOTACTL "struct mount *mp" "struct quotactl_args *args"
 .Ft int
 .Fn VFS_STATVFS "struct mount *mp" "struct statvfs *sbp"
 .Ft int
@@ -280,21 +280,20 @@ While resolving the pathname, the pathna
 have to go through the directory tree in the file system associated
 with that mount point and therefore requires the root vnode of the
 file system.
-.It Fn VFS_QUOTACTL "mp" "cmds" "uid" "arg"
+.It Fn VFS_QUOTACTL "mp" "args"
 Query/modify user space quotas for the file system specified by the
 mount structure
 .Fa mp .
-The argument specifies the control command to perform.
-The userid is specified in
-.Fa id
+The argument structure provides the operation ID and arguments to
+perform.
+This is the same interface as documented in
+.Xr __quotactl 2
+except that the file system argument has been resolved.
+All
+.Xr copyin 2
 and
-.Fa arg
-allows command-specific data to be returned to the system call
-interface.
-.Fn VFS_QUOTACTL
-is the file system type specific implementation of the
-.Xr quotactl 2
-system call.
+.Xr copyout 2
+processing is handled by code above the file system.
 .It Fn VFS_STATVFS "mp" "sbp"
 Get file system statistics for the file system specified by the mount
 structure

Added files:

Index: src/lib/libc/sys/__quotactl.2
diff -u /dev/null src/lib/libc/sys/__quotactl.2:1.1
--- /dev/null	Mon Feb 13 01:24:03 2012
+++ src/lib/libc/sys/__quotactl.2	Mon Feb 13 01:24:03 2012
@@ -0,0 +1,357 @@
+.\"	$NetBSD: __quotactl.2,v 1.1 2012/02/13 01:24:03 dholland Exp $
+.\"
+.\" Copyright (c) 1983, 1990, 1991, 1993
+.\"	The Regents of the University of California.  All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" Robert Elz at The University of Melbourne.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\" 3. Neither the name of the University nor the names of its contributors
+.\"    may be used to endorse or promote products derived from this software
+.\"    without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\"	@(#)quotactl.2	8.2 (Berkeley) 3/10/95
+.\"
+.Dd February 11, 2012
+.Dt __QUOTACTL 2
+.Os
+.Sh NAME
+.Nm __quotactl
+.Nd manipulate file system quotas
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In sys/quota.h
+.In sys/quotactl.h
+.Ft int
+.Fn __quotactl "const char *path" "struct quotactl_args *args"
+.Sh DESCRIPTION
+The
+.Fn __quotactl
+call manipulates file system quotas.
+This is an internal interface and is documented for reference purposes
+only.
+All application and utility code should use the
+.Xr libquota 3
+interface.
+.Pp
+The
+.Fn __quotactl
+function performs one of several quota-related operations on the file
+system named by
+.Fa path .
+The operation and arguments to that operation are passed in the
+.Fa args
+argument.
+The operation is stored in the
+.Fa qc_op
+member of
+.Fa args .
+The arguments are placed in a union such that the first and second
+arguments of the operation
+.Dv QUOTACTL_EXAMPLE
+are found as the members
+.Fa u.example.qc_arg1
+and
+.Fa u.example.qc_arg2 .
+The descriptions below will refer to the operations as functions of
+the form
+.Fn QUOTACTL_EXAMPLE "int arg1" "int arg2"
+and elide the encoding of these arguments into the
+.Fa args
+structure.
+Explicit mention of the
+.Fa path
+argument is also omitted.
+.Pp
+There are fourteen quota control operations.
+These are:
+.Bl -tag -width abcdef
+.\" ************************************************************
+.It Fn QUOTACTL_STAT "struct quotastat *info"
+Information about the quota implementation on the selected volume is
+returned in
+.Fa info .
+The
+.Dv quotastat
+structure contains the following members:
+.Bl -tag -width qs_restrictions
+.It qs_implname
+A human-readable string describing the underlying implementation of
+quotas.
+This is suitable for display to users
+.Pq and system administrators
+but should not be interpreted by software.
+See
+.Xr quota_getimplname 3 .
+.It qs_numidtypes
+The number of ID types supported by this implementation.
+See
+.Xr quota_getnumidtypes 3 .
+.It qs_numobjtypes
+The number of object types supported by this implementation.
+See
+.Xr quota_getnumobjtypes 3 .
+.It qs_restrictions
+Flags identifying specific semantic limitations of the implementation.
+See
+.Xr quota_getrestrictions 3 .
+.El
+.\" ************************************************************
+.It Fn QUOTACTL_IDTYPESTAT "int idtype" "struct quotaidtypestat *info"
+Information about a particular ID type on the selected volume is
+returned in
+.Fa info .
+The
+.Dv quotaidtypestat
+structure contains the following members:
+.Bl -tag -width qs_restrictions
+.It qis_name
+The name of the ID type.
+See
+.Xr quota_idtype_getname 3 .
+.El
+.\" ************************************************************
+.It Fn QUOTACTL_OBJYPESTAT "int objtype" "struct quotaobjtypestat *info"
+Information about a particular object type on the selected volume is
+returned in
+.Fa info .
+The
+.Dv quotaobjtypestat
+structure contains the following members:
+.Bl -tag -width qs_restrictions
+.It qos_name
+The name of the object type.
+See
+.Xr quota_objtype_getname 3 .
+.It qos_isbytes
+A flag that is nonzero if the object type is something measured in
+bytes.
+See
+.Xr quota_objtype_isbytes 3 .
+.El
+.\" ************************************************************
+.It Fn QUOTACTL_GET "const struct quotakey *key" "struct quotaval *val"
+Return in
+.Fa val
+the quota information selected by
+.Fa key .
+See
+.Xr quota_get 3 .
+.\" ************************************************************
+.It Fn QUOTACTL_PUT "const struct quotakey *key" "const struct quotaval *val"
+The quota information selected by
+.Fa key
+is updated to the values provided in
+.Fa val .
+Note that the current usage information, which is file system
+meta-data, cannot be updated via this interface.
+If the usage information is incorrect a tool such as
+.Xr fsck 8
+or
+.Xr quotactl 8
+with file-system-specific knowledge must be used to repair the
+on-disk information.
+See
+.Xr quota_put 3 .
+.\" ************************************************************
+.It Fn QUOTACTL_DELETE "const struct quotakey *key"
+The quota information selected by
+.Fa key
+is removed.
+See
+.Xr quota_delete 3 .
+.\" ************************************************************
+.It Fn QUOTACTL_CURSOROPEN "struct quotakcursor *cursor"
+A cursor for iterating the quota information is created.
+The
+.Dv quotakcursor
+structure is a semi-opaque type holding the iteration state used by
+the quota implementation.
+The caller is responsible for allocating and maintaining storage for
+the cursor.
+Every cursor that is opened should be closed.
+It is not specified whether a cursor remains valid if
+.Xr memcpy 3
+is used to move it to a different location in user memory.
+It is not specified whether or how a cursor may be duplicated.
+Passing an uninitialized, corrupted, or closed cursor to operations
+other than
+.Fn QUOTACTL_CURSOROPEN
+will produce unspecified behavior.
+As per general standards for system calls such actions must not
+produce undefined or materially adverse behavior in the kernel;
+however, the effect on a user process may be arbitrary.
+The
+.Xr libquota 3
+interface wraps the system call level quota cursors in a friendlier
+interface.
+See
+.Xr quota_opencursor 3 .
+.\" ************************************************************
+.It Fn QUOTACTL_CURSORCLOSE "struct quotakcursor *cursor"
+The cursor passed in is closed.
+See
+.Xr quotacursor_close 3 .
+.\" ************************************************************
+.It Fn QUOTACTL_CURSORSKIPIDTYPE "struct quotakcursor *cursor" "int idtype"
+This operation provides a hint that iteration can skip over a
+particular ID type.
+The implementation is not obliged to honor the hint.
+See
+.Xr quotacursor_skipidtype 3 .
+.\" ************************************************************
+.It Fn QUOTACTL_CURSORGET "struct quotakcursor *cursor" "struct quotakey *keys" "struct quotaval *vals" "unsigned maxnum" "unsigned *ret"
+This operation retrieves data at the current cursor position and
+advances it.
+Up to
+.Fa maxnum
+quota records are retrieved and stored into the arrays named by
+.Fa keys
+and
+.Fa vals .
+The number of records retrieved is stored into the variable pointed to
+by
+.Fa ret .
+See
+.Xr quotacursor_get 3
+and
+.Xr quotacursor_getn 3 .
+.\" ************************************************************
+.It Fn QUOTACTL_CURSORATEND "struct quotakcursor *cursor" "int *ret"
+This operation generates a nonzero value if the cursor has reached the
+end of the available quota information and zero otherwise.
+The generated value is stored into the variable pointed to by
+.Fa ret .
+See
+.Xr quotacursor_atend 3 .
+.\" ************************************************************
+.It Fn QUOTACTL_CURSORREWIND "struct quotakcursor *cursor"
+This operation updates the cursor state so that further calls to
+.Fn QUOTACTL_CURSORGET
+will begin again at the start of the iteration.
+See
+.Xr quotacursor_rewind 3 .
+.\" ************************************************************
+.It Fn QUOTACTL_QUOTAON "int idtype" "const char *quotafile"
+This operation is accepted only by old-style
+.Pq Dq quota1
+quota implementations.
+Quotas for the ID type named by
+.Fa idtype
+are switched on, and the file
+.Fa quotafile
+is used to hold the quota information.
+This operation can also be used when quotas are already switched on
+to change the file used to hold the quota information.
+Note however that as the current usage information in the file must be
+consistent with the current state of the file system, in general it is
+not safe to call
+.Fn QUOTACTL_QUOTAON
+except in single-user mode.
+See
+.Xr quotaon 8
+for more information.
+Normally
+quotaon 8
+is run during the boot sequence after
+quotacheck 8 .
+Also see
+.Xr quota_quotaon 3 .
+.\" ************************************************************
+.It Fn QUOTACTL_QUOTAOFF "int idtype"
+This operation is accepted only by old-style
+.Pq Dq quota1
+quota implementations.
+Quotas for the ID type named by
+.Fa idtype
+are switched off.
+Once quotas are switched off the file system behaves as if no quotas
+are present.
+Normally
+quotaoff 8
+is run during the shutdown sequence.
+Also see
+.Xr quota_quotaoff 3 .
+.\" ************************************************************
+.El
+.Sh RETURN VALUES
+On success,
+.Fn __quotactl
+returns 0.
+Otherwise the value \-1 is returned and an error code reflecting the
+reason for the failure is placed in
+.Va errno .
+.Sh ERRORS
+.Fn __quotactl
+failures include:
+.Bl -tag -width Er
+.It Bq Er EFAULT
+A pointer points outside the process's allocated address space.
+.It Bq Er EINVAL
+The operation code was out of range.
+.It Bq Er EINVAL
+A requested ID or object type was out of range.
+.It Bq Er EINVAL
+A corrupted or invalid cursor was passed in.
+.It Bq Er ENODEV
+The requested action was inappropriate for
+.Pq or not supported by
+the selected volume.
+.It Bq Er ENOENT
+No quota information exists for the requested key.
+.It Bq Er ENOMEM
+Memory could not be allocated within the kernel.
+.It Bq Er ENXIO
+The target file system type is capable of supporting quotas, but
+quotas are not enabled on the selected volume.
+.It Bq Er EOPNOTSUPP
+The target file system does not support quotas.
+.El
+.Sh SEE ALSO
+.Xr quota 1 ,
+.Xr libquota 3 ,
+.Xr fstab 5 ,
+.Xr edquota 8 ,
+.Xr quotacheck 8 ,
+.Xr quotaon 8 ,
+.Xr quotarestore 8 ,
+.Xr repquota 8
+.Sh HISTORY
+The original
+.Fn quotactl
+function call appeared in
+.Bx 4.3 Reno .
+The current
+.Fn __quotactl
+interface appeared in
+.Nx 6.0 .
+.Sh BUGS
+As of this writing the error returns that occur in practice are not
+always completely consistent with the intent documented above.
+.Pp
+There should be some way to integrate this call with the resource
+limit interface provided by
+.Xr setrlimit 2
+and
+.Xr getrlimit 2 .

Reply via email to