1.\"- 2.\" Copyright (c) 2008 Dag-Erling Co��dan Sm��rgrav 3.\" All rights reserved. 4.\" 5.\" Redistribution and use in source and binary forms, with or without 6.\" modification, are permitted provided that the following conditions 7.\" are met: 8.\" 1. Redistributions of source code must retain the above copyright 9.\" notice, this list of conditions and the following disclaimer. 10.\" 2. Redistributions in binary form must reproduce the above copyright 11.\" notice, this list of conditions and the following disclaimer in the 12.\" documentation and/or other materials provided with the distribution. 13.\" 14.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24.\" SUCH DAMAGE. 25.\"
| 1.\"- 2.\" Copyright (c) 2008 Dag-Erling Co��dan Sm��rgrav 3.\" All rights reserved. 4.\" 5.\" Redistribution and use in source and binary forms, with or without 6.\" modification, are permitted provided that the following conditions 7.\" are met: 8.\" 1. Redistributions of source code must retain the above copyright 9.\" notice, this list of conditions and the following disclaimer. 10.\" 2. Redistributions in binary form must reproduce the above copyright 11.\" notice, this list of conditions and the following disclaimer in the 12.\" documentation and/or other materials provided with the distribution. 13.\" 14.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24.\" SUCH DAMAGE. 25.\"
|
26.\" $FreeBSD: projects/quota64/lib/libutil/quotafile.3 188569 2009-02-13 06:17:53Z mckusick $
| 26.\" $FreeBSD: projects/quota64/lib/libutil/quotafile.3 188604 2009-02-14 08:08:08Z mckusick $
|
27.\"
| 27.\"
|
28.Dd November 4, 2008
| 28.Dd February 14, 2009
|
29.Dt QUOTAFILE 3 30.Os 31.Sh NAME 32.Nm quota_open
| 29.Dt QUOTAFILE 3 30.Os 31.Sh NAME 32.Nm quota_open
|
33.Nm quota_create
| |
34.Nm quota_read
| 33.Nm quota_read
|
35.Nm quota_write
| 34.Nm quota_write_limits 35.Nm quota_write_usage
|
36.Nm quota_close
| 36.Nm quota_close
|
37.Nd "Manipulate quota files"
| 37.Nd "Manipulate quotas"
|
38.Sh LIBRARY 39.Lb libutil 40.Sh SYNOPSIS 41.In ufs/ufs/quota.h 42.In libutil.h
| 38.Sh LIBRARY 39.Lb libutil 40.Sh SYNOPSIS 41.In ufs/ufs/quota.h 42.In libutil.h
|
| 43.In fstab.h
|
43.Ft "struct quotafile *"
| 44.Ft "struct quotafile *"
|
44.Fn quota_open "const char *path" 45.Ft "struct quotafile *" 46.Fn quota_create "const char *path"
| 45.Fn quota_open "struct fstab *fs" "int quotatype" "int openflags"
|
47.Ft int 48.Fn quota_read "struct quotafile *qf" "struct dqblk *dqb" "int id" 49.Ft int
| 46.Ft int 47.Fn quota_read "struct quotafile *qf" "struct dqblk *dqb" "int id" 48.Ft int
|
50.Fn quota_write "struct quotafile *qf" "const struct dqblk *dqb" "int id"
| 49.Fn quota_write_limits "struct quotafile *qf" "struct dqblk *dqb" "int id"
|
51.Ft int
| 50.Ft int
|
52.Fn quota_close "struct quotafile *qf"
| 51.Fn quota_write_usage "struct quotafile *qf" "struct dqblk *dqb" "int id"
|
53.Ft int
| 52.Ft int
|
54.Fn hasquota "struct fstab *fs" "int type" "char **qfnamep"
| 53.Fn quota_close "struct quotafile *qf"
|
55.Sh DESCRIPTION
| 54.Sh DESCRIPTION
|
| 55These functions are designed to simplify access to filesystem quotas. 56If quotas are active on a filesystem, 57these functions will access them directly from the kernel using the 58.Fn quotactl 59system call. 60If quotas are not active, 61these functions will access them by reading and writing 62the quota files directly. 63.Pp 64The 65.Fn quota_open 66function takes a pointer to an 67.Vt fstab 68entry corresponding to the filesystem on which quotas 69are to be accessed. 70The 71.Va quotatype 72field indicates the type of quotas being sought, either 73.Dv USRQUOTA 74or 75.Dv GRPQUOTA . 76The 77.Va openflags 78are those used by the 79.Fn open 80system call, usually either 81.Dv O_RDONLY 82if the quotas are just to be read, or 83.Dv O_RDWR 84if the quotas are to be updated. 85The 86.Dv O_CREAT 87flag should be specified if a new quota file of the requested type should 88be created if it does not already exist. 89.Pp 90The 91.Fn quota_read 92function reads the quota from the filesystem and quota type referenced by 93.Va qf 94for the user (or group) specified by 95.Va id 96into the 97.Vt dqblk 98quota structure pointed to by 99.Va dqb . 100.Pp 101The 102.Fn quota_write_limits 103function updates the limit fields (but not the usage fields) 104for the filesystem and quota type referenced by 105.Va qf 106for the user (or group) specified by 107.Va id 108from the 109.Vt dqblk 110quota structure pointed to by 111.Va dqb . 112.Pp 113The 114.Fn quota_write_usage 115function updates the usage fields (but not the limit fields) 116for the filesystem and quota type referenced by 117.Va qf 118for the user (or group) specified by 119.Va id 120from the 121.Vt dqblk 122quota structure pointed to by 123.Va dqb . 124.Pp 125The 126.Fn quota_close 127function closes any open file descriptors and frees any storage 128associated with the filesystem and quota type referenced by 129.Va qf .
|
56.Sh RETURN VALUES
| 130.Sh RETURN VALUES
|
| 131If the filesystem has quotas associated with it, 132.Fn quota_open 133returns a pointer to a 134.Vt quotafile 135structure used in subsequent quota access calls. 136If the filesystem has no quotas, or access permission is denied 137.Dv NULL 138is returned and 139.Va errno 140is set to indicate the cause of failure. 141.Pp 142The 143.Fn quota_read , 144.Fn quota_write_limits , 145.Fn quota_write_usage , 146and 147.Fn quota_close 148functions return zero on success. 149On error they return 150.Dv -1 151and set 152.Va errno 153to indicate the cause of failure.
|
57.Sh SEE ALSO 58.Xr quotactl 2 , 59.Xr quota.user 5 , 60.Xr quota.group 5 61.Sh HISTORY 62The 63.Nm 64functions first appeared in 65.Fx 8.0 . 66.Sh AUTHORS 67.An -nosplit 68The 69.Nm 70functions and this manual page were written by
| 154.Sh SEE ALSO 155.Xr quotactl 2 , 156.Xr quota.user 5 , 157.Xr quota.group 5 158.Sh HISTORY 159The 160.Nm 161functions first appeared in 162.Fx 8.0 . 163.Sh AUTHORS 164.An -nosplit 165The 166.Nm 167functions and this manual page were written by
|
71.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org .
| 168.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org 169and 170.An Marshall Kirk McKusick .
|
| |