2 .\" Copyright (c) 2009 Dag-Erling Smørgrav and
3 .\" Marshall Kirk McKusick. All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
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.
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
35 .Nm quota_write_limits ,
36 .Nm quota_write_usage ,
40 .Nm quota_check_path ,
42 .Nd "Manipulate quotas"
52 .Ft "struct quotafile *"
53 .Fn quota_open "struct fstab *fs" "int quotatype" "int openflags"
55 .Fn quota_close "struct quotafile *qf"
57 .Fn quota_on "const struct quotafile *qf"
59 .Fn quota_off "const struct quotafile *qf"
61 .Fn quota_read "struct quotafile *qf" "struct dqblk *dqb" "int id"
63 .Fn quota_write_limits "struct quotafile *qf" "struct dqblk *dqb" "int id"
65 .Fn quota_write_usage "struct quotafile *qf" "struct dqblk *dqb" "int id"
67 .Fn quota_fsname "const struct quotafile *qf"
69 .Fn quota_qfname "const struct quotafile *qf"
71 .Fn quota_maxid "const struct quotafile *qf"
73 .Fn quota_check_path "const struct quotafile *qf" "const char *path"
75 .Fn quota_convert "struct quotafile *qf" "int wordsize"
77 These functions are designed to simplify access to filesystem quotas.
78 If quotas are active on a filesystem,
79 these functions will access them directly from the kernel using the
82 If quotas are not active,
83 these functions will access them by reading and writing
84 the quota files directly.
88 function takes a pointer to an
90 entry corresponding to the filesystem on which quotas
94 field indicates the type of quotas being sought, either
100 are those used by the
102 system call, usually either
104 if the quotas are just to be read, or
106 if the quotas are to be updated.
109 flag should be specified if a new quota file of the requested type
110 should be created if it does not already exist.
114 function closes any open file descriptors and frees any storage
115 associated with the filesystem and quota type referenced by
120 function enables quotas for the filesystem associated with its
122 argument which may have been opened with
128 function returns 0 if successful;
129 otherwise the value\~-1 is returned and the global variable
131 is set to indicate the error, see
133 for the possible errors.
137 function disables quotas for the filesystem associated with its
139 argument which may have been opened with
145 function returns 0 if successful;
146 otherwise the value\~-1 is returned and the global variable
148 is set to indicate the error, see
150 for the possible errors.
154 function reads the quota from the filesystem and quota type referenced by
156 for the user (or group) specified by
160 quota structure pointed to by
164 .Fn quota_write_limits
165 function updates the limit fields (but not the usage fields)
166 for the filesystem and quota type referenced by
168 for the user (or group) specified by
172 quota structure pointed to by
176 .Fn quota_write_usage
177 function updates the usage fields (but not the limit fields)
178 for the filesystem and quota type referenced by
180 for the user (or group) specified by
184 quota structure pointed to by
189 function returns a pointer to a buffer containing the path to the root
190 of the file system that corresponds to its
192 argument, as listed in
194 Note that this may be a symbolic link to the actual directory.
198 function returns a pointer to a buffer containing the name of the
199 quota file that corresponds to its
202 Note that this may be a symbolic link to the actual file.
206 function returns the maximum user (or group)
208 contained in the quota file associated with its
214 function checks if the specified path is within the filesystem that
220 argument refers to a symbolic link,
226 function converts the quota file associated with its
228 argument to the data size specified by its
231 The supported wordsize arguments are 32 for the old 32-bit
232 quota file format and 64 for the new 64-bit quota file format.
235 function may only be called to operate on quota files that
236 are not currently active.
237 .Sh IMPLEMENTATION NOTES
238 If the underlying quota file is in or converted to the old 32-bit format,
239 limit and usage values written to the quota file will be clipped to 32 bits.
241 If the filesystem has quotas associated with it,
243 returns a pointer to a
245 structure used in subsequent quota access calls.
246 If the filesystem has no quotas, or access permission is denied
250 is set to indicate the error.
254 function returns\~1 for a positive result and\~0 for a negative
256 If an error occurs, it returns\~-1 and sets
258 to indicate the error.
262 .Fn quota_write_limits ,
263 .Fn quota_write_usage ,
267 functions return zero on success.
268 On error they return\~-1
271 to indicate the error.
279 functions first appeared in
285 functions and this manual page were written by
286 .An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org
288 .An Marshall Kirk McKusick Aq Mt mckusick@mckusick.com .