xref: /netbsd-src/include/quota.h (revision a15505744dcc5edbcae726145341337bf1e5799d)
1 /* $NetBSD: quota.h,v 1.7 2017/04/04 12:25:40 sevan Exp $ */
2 
3 /*-
4  * Copyright (c) 2011 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by David A. Holland.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 #ifndef _QUOTA_H_
33 #define _QUOTA_H_
34 
35 #include <sys/types.h>
36 #include <sys/quota.h>
37 
38 struct quotahandle; /* Opaque. */
39 struct quotacursor; /* Opaque. */
40 
41 
42 void quotaval_clear(struct quotaval *);
43 
44 struct quotahandle *quota_open(const char *);
45 void quota_close(struct quotahandle *);
46 
47 const char *quota_getmountpoint(struct quotahandle *);
48 const char *quota_getmountdevice(struct quotahandle *);
49 
50 const char *quota_getimplname(struct quotahandle *);
51 unsigned quota_getrestrictions(struct quotahandle *);
52 
53 int quota_getnumidtypes(struct quotahandle *);
54 const char *quota_idtype_getname(struct quotahandle *, int /*idtype*/);
55 
56 int quota_getnumobjtypes(struct quotahandle *);
57 const char *quota_objtype_getname(struct quotahandle *, int /*objtype*/);
58 int quota_objtype_isbytes(struct quotahandle *, int /*objtype*/);
59 
60 int quota_quotaon(struct quotahandle *, int /*idtype*/);
61 int quota_quotaoff(struct quotahandle *, int /*idtype*/);
62 
63 int quota_get(struct quotahandle *, const struct quotakey *,
64 	      struct quotaval *);
65 
66 int quota_put(struct quotahandle *, const struct quotakey *,
67 	      const struct quotaval *);
68 
69 int quota_delete(struct quotahandle *, const struct quotakey *);
70 
71 struct quotacursor *quota_opencursor(struct quotahandle *);
72 void quotacursor_close(struct quotacursor *);
73 
74 int quotacursor_skipidtype(struct quotacursor *, int /*idtype*/);
75 
76 int quotacursor_get(struct quotacursor *, struct quotakey *,
77 		    struct quotaval *);
78 
79 int quotacursor_getn(struct quotacursor *, struct quotakey *,
80 		     struct quotaval *, unsigned /*maxnum*/);
81 
82 int quotacursor_atend(struct quotacursor *);
83 int quotacursor_rewind(struct quotacursor *);
84 
85 #endif /* _QUOTA_H_ */
86