quotapvt.h revision 1.8 1 /* $NetBSD: quotapvt.h,v 1.8 2012/01/09 15:45:19 dholland Exp $ */
2 /*-
3 * Copyright (c) 2011 The NetBSD Foundation, Inc.
4 * All rights reserved.
5 *
6 * This code is derived from software contributed to The NetBSD Foundation
7 * by David A. Holland.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
29 */
30
31 struct quotahandle {
32 char *qh_mountpoint;
33 char *qh_mountdevice;
34 int qh_isnfs;
35
36 /* these are used only by quota_oldfiles */
37 int qh_hasoldfiles;
38 int qh_userfile;
39 int qh_groupfile;
40
41 char spare[14*sizeof(char *) + 12 * sizeof(int)];
42 };
43
44 struct quotacursor {
45 struct quotahandle *qc_qh;
46 enum { QC_PROPLIB, QC_OLDFILES } qc_type;
47 union {
48 struct proplib_quotacursor *qc_proplib;
49 struct oldfiles_quotacursor *qc_oldfiles;
50 } u;
51 };
52
53
54 /* proplib kernel interface */
55 int __quota_proplib_getversion(struct quotahandle *qh, int8_t *version_ret);
56 const char *__quota_proplib_getimplname(struct quotahandle *);
57 int __quota_proplib_get(struct quotahandle *qh, const struct quotakey *qk,
58 struct quotaval *qv);
59 int __quota_proplib_put(struct quotahandle *qh, const struct quotakey *qk,
60 const struct quotaval *qv);
61 int __quota_proplib_delete(struct quotahandle *qh, const struct quotakey *qk);
62 struct proplib_quotacursor *__quota_proplib_cursor_create(void);
63 void __quota_proplib_cursor_destroy(struct proplib_quotacursor *);
64 int __quota_proplib_cursor_skipidtype(struct proplib_quotacursor *,
65 unsigned idtype);
66 int __quota_proplib_cursor_get(struct quotahandle *,
67 struct proplib_quotacursor *,
68 struct quotakey *, struct quotaval *);
69 int __quota_proplib_cursor_getn(struct quotahandle *,
70 struct proplib_quotacursor *,
71 struct quotakey *, struct quotaval *,
72 unsigned);
73 int __quota_proplib_cursor_atend(struct quotahandle *,
74 struct proplib_quotacursor *);
75 int __quota_proplib_cursor_rewind(struct proplib_quotacursor *);
76
77
78 /* nfs rquotad interface */
79 int __quota_nfs_get(struct quotahandle *qh, const struct quotakey *qk,
80 struct quotaval *qv);
81
82
83 /* direct interface to old (quota1-type) files */
84 int __quota_oldfiles_initialize(struct quotahandle *qh);
85 const char *__quota_oldfiles_getimplname(struct quotahandle *);
86 int __quota_oldfiles_get(struct quotahandle *qh, const struct quotakey *qk,
87 struct quotaval *qv);
88 int __quota_oldfiles_put(struct quotahandle *qh, const struct quotakey *qk,
89 const struct quotaval *qv);
90 int __quota_oldfiles_delete(struct quotahandle *qh, const struct quotakey *qk);
91 struct oldfiles_quotacursor *
92 __quota_oldfiles_cursor_create(struct quotahandle *);
93 void __quota_oldfiles_cursor_destroy(struct oldfiles_quotacursor *);
94 int __quota_oldfiles_cursor_skipidtype(struct oldfiles_quotacursor *,
95 unsigned idtype);
96 int __quota_oldfiles_cursor_get(struct quotahandle *,
97 struct oldfiles_quotacursor *,
98 struct quotakey *, struct quotaval *);
99 int __quota_oldfiles_cursor_getn(struct quotahandle *,
100 struct oldfiles_quotacursor *,
101 struct quotakey *, struct quotaval *,
102 unsigned);
103 int __quota_oldfiles_cursor_atend(struct oldfiles_quotacursor *);
104 int __quota_oldfiles_cursor_rewind(struct oldfiles_quotacursor *);
105
106
107 /* compat for old library */
108 int __quota_getquota(const char *path, struct quotaval *qv, uid_t id,
109 const char *class);
110
111