xref: /netbsd-src/include/quota.h (revision a15505744dcc5edbcae726145341337bf1e5799d)
1*a1550574Ssevan /* $NetBSD: quota.h,v 1.7 2017/04/04 12:25:40 sevan Exp $ */
2*a1550574Ssevan 
30d7dfe62Sdholland /*-
40d7dfe62Sdholland  * Copyright (c) 2011 The NetBSD Foundation, Inc.
50d7dfe62Sdholland  * All rights reserved.
60d7dfe62Sdholland  *
70d7dfe62Sdholland  * This code is derived from software contributed to The NetBSD Foundation
80d7dfe62Sdholland  * by David A. Holland.
90d7dfe62Sdholland  *
100d7dfe62Sdholland  * Redistribution and use in source and binary forms, with or without
110d7dfe62Sdholland  * modification, are permitted provided that the following conditions
120d7dfe62Sdholland  * are met:
130d7dfe62Sdholland  * 1. Redistributions of source code must retain the above copyright
140d7dfe62Sdholland  *    notice, this list of conditions and the following disclaimer.
150d7dfe62Sdholland  * 2. Redistributions in binary form must reproduce the above copyright
160d7dfe62Sdholland  *    notice, this list of conditions and the following disclaimer in the
170d7dfe62Sdholland  *    documentation and/or other materials provided with the distribution.
180d7dfe62Sdholland  *
190d7dfe62Sdholland  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
200d7dfe62Sdholland  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
210d7dfe62Sdholland  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
220d7dfe62Sdholland  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
230d7dfe62Sdholland  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
240d7dfe62Sdholland  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
250d7dfe62Sdholland  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
260d7dfe62Sdholland  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
270d7dfe62Sdholland  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
280d7dfe62Sdholland  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
290d7dfe62Sdholland  * POSSIBILITY OF SUCH DAMAGE.
300d7dfe62Sdholland  */
310d7dfe62Sdholland 
320d7dfe62Sdholland #ifndef _QUOTA_H_
330d7dfe62Sdholland #define _QUOTA_H_
340d7dfe62Sdholland 
350d7dfe62Sdholland #include <sys/types.h>
360d7dfe62Sdholland #include <sys/quota.h>
370d7dfe62Sdholland 
380d7dfe62Sdholland struct quotahandle; /* Opaque. */
390d7dfe62Sdholland struct quotacursor; /* Opaque. */
400d7dfe62Sdholland 
410d7dfe62Sdholland 
420d7dfe62Sdholland void quotaval_clear(struct quotaval *);
430d7dfe62Sdholland 
440d7dfe62Sdholland struct quotahandle *quota_open(const char *);
450d7dfe62Sdholland void quota_close(struct quotahandle *);
460d7dfe62Sdholland 
470d7dfe62Sdholland const char *quota_getmountpoint(struct quotahandle *);
480d7dfe62Sdholland const char *quota_getmountdevice(struct quotahandle *);
490d7dfe62Sdholland 
500d7dfe62Sdholland const char *quota_getimplname(struct quotahandle *);
51f6b247aaSdholland unsigned quota_getrestrictions(struct quotahandle *);
520d7dfe62Sdholland 
53832d4ca7Sdholland int quota_getnumidtypes(struct quotahandle *);
540d7dfe62Sdholland const char *quota_idtype_getname(struct quotahandle *, int /*idtype*/);
550d7dfe62Sdholland 
56832d4ca7Sdholland int quota_getnumobjtypes(struct quotahandle *);
570d7dfe62Sdholland const char *quota_objtype_getname(struct quotahandle *, int /*objtype*/);
580d7dfe62Sdholland int quota_objtype_isbytes(struct quotahandle *, int /*objtype*/);
590d7dfe62Sdholland 
605f0d2c5fSdholland int quota_quotaon(struct quotahandle *, int /*idtype*/);
615f0d2c5fSdholland int quota_quotaoff(struct quotahandle *, int /*idtype*/);
625f0d2c5fSdholland 
630d7dfe62Sdholland int quota_get(struct quotahandle *, const struct quotakey *,
640d7dfe62Sdholland 	      struct quotaval *);
650d7dfe62Sdholland 
660d7dfe62Sdholland int quota_put(struct quotahandle *, const struct quotakey *,
670d7dfe62Sdholland 	      const struct quotaval *);
680d7dfe62Sdholland 
690d7dfe62Sdholland int quota_delete(struct quotahandle *, const struct quotakey *);
700d7dfe62Sdholland 
710d7dfe62Sdholland struct quotacursor *quota_opencursor(struct quotahandle *);
720d7dfe62Sdholland void quotacursor_close(struct quotacursor *);
730d7dfe62Sdholland 
74832d4ca7Sdholland int quotacursor_skipidtype(struct quotacursor *, int /*idtype*/);
750d7dfe62Sdholland 
760d7dfe62Sdholland int quotacursor_get(struct quotacursor *, struct quotakey *,
770d7dfe62Sdholland 		    struct quotaval *);
780d7dfe62Sdholland 
790d7dfe62Sdholland int quotacursor_getn(struct quotacursor *, struct quotakey *,
800d7dfe62Sdholland 		     struct quotaval *, unsigned /*maxnum*/);
810d7dfe62Sdholland 
820d7dfe62Sdholland int quotacursor_atend(struct quotacursor *);
830d7dfe62Sdholland int quotacursor_rewind(struct quotacursor *);
840d7dfe62Sdholland 
850d7dfe62Sdholland #endif /* _QUOTA_H_ */
86