Annotation of src/lib/libquota/quotapvt.h, Revision 1.14
1.14 ! dholland 1: /* $NetBSD: quotapvt.h,v 1.13 2012/02/01 05:34:41 dholland Exp $ */
1.1 dholland 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:
1.10 dholland 31: #define QUOTA_MODE_NFS 1
1.13 dholland 32: #define QUOTA_MODE_OLDFILES 2
33: #define QUOTA_MODE_KERNEL 3
1.10 dholland 34:
1.1 dholland 35: struct quotahandle {
36: char *qh_mountpoint;
1.2 dholland 37: char *qh_mountdevice;
1.10 dholland 38: int qh_mode;
1.6 dholland 39:
40: /* these are used only by quota_oldfiles */
1.10 dholland 41: int qh_oldfilesopen;
1.6 dholland 42: int qh_userfile;
43: int qh_groupfile;
1.1 dholland 44: };
45:
1.5 dholland 46: struct quotacursor {
47: struct quotahandle *qc_qh;
1.13 dholland 48: enum { QC_OLDFILES, QC_KERNEL } qc_type;
1.5 dholland 49: union {
1.6 dholland 50: struct oldfiles_quotacursor *qc_oldfiles;
1.13 dholland 51: struct kernel_quotacursor *qc_kernel;
1.5 dholland 52: } u;
53: };
54:
55:
1.13 dholland 56: /* new non-proplib kernel interface */
57: const char *__quota_kernel_getimplname(struct quotahandle *);
58: unsigned __quota_kernel_getrestrictions(struct quotahandle *);
1.14 ! dholland 59: int __quota_kernel_getnumidtypes(struct quotahandle *);
1.13 dholland 60: const char *__quota_kernel_idtype_getname(struct quotahandle *, int idtype);
1.14 ! dholland 61: int __quota_kernel_getnumobjtypes(struct quotahandle *);
1.13 dholland 62: const char *__quota_kernel_objtype_getname(struct quotahandle *, int objtype);
63: int __quota_kernel_objtype_isbytes(struct quotahandle *, int objtype);
64: int __quota_kernel_quotaon(struct quotahandle *, int idtype);
65: int __quota_kernel_quotaoff(struct quotahandle *, int idtype);
66: int __quota_kernel_get(struct quotahandle *qh, const struct quotakey *qk,
1.1 dholland 67: struct quotaval *qv);
1.13 dholland 68: int __quota_kernel_put(struct quotahandle *qh, const struct quotakey *qk,
1.7 dholland 69: const struct quotaval *qv);
1.13 dholland 70: int __quota_kernel_delete(struct quotahandle *qh, const struct quotakey *qk);
71: struct kernel_quotacursor *__quota_kernel_cursor_create(struct quotahandle *);
72: void __quota_kernel_cursor_destroy(struct quotahandle *,
73: struct kernel_quotacursor *);
74: int __quota_kernel_cursor_skipidtype(struct quotahandle *,
75: struct kernel_quotacursor *,
1.14 ! dholland 76: int idtype);
1.13 dholland 77: int __quota_kernel_cursor_get(struct quotahandle *,
78: struct kernel_quotacursor *,
79: struct quotakey *, struct quotaval *);
80: int __quota_kernel_cursor_getn(struct quotahandle *,
81: struct kernel_quotacursor *,
1.5 dholland 82: struct quotakey *, struct quotaval *,
1.14 ! dholland 83: unsigned maxnum);
1.13 dholland 84: int __quota_kernel_cursor_atend(struct quotahandle *,
85: struct kernel_quotacursor *);
86: int __quota_kernel_cursor_rewind(struct quotahandle *,
87: struct kernel_quotacursor *);
1.2 dholland 88:
89: /* nfs rquotad interface */
90: int __quota_nfs_get(struct quotahandle *qh, const struct quotakey *qk,
91: struct quotaval *qv);
92:
1.5 dholland 93:
1.6 dholland 94: /* direct interface to old (quota1-type) files */
1.10 dholland 95: void __quota_oldfiles_load_fstab(void);
96: int __quota_oldfiles_infstab(const char *);
1.6 dholland 97: int __quota_oldfiles_initialize(struct quotahandle *qh);
98: const char *__quota_oldfiles_getimplname(struct quotahandle *);
1.12 dholland 99: const char *__quota_oldfiles_getquotafile(struct quotahandle *, int idtype,
100: char *buf, size_t maxlen);
101: int __quota_oldfiles_quotaon(struct quotahandle *, int idtype);
1.6 dholland 102: int __quota_oldfiles_get(struct quotahandle *qh, const struct quotakey *qk,
103: struct quotaval *qv);
1.8 dholland 104: int __quota_oldfiles_put(struct quotahandle *qh, const struct quotakey *qk,
105: const struct quotaval *qv);
106: int __quota_oldfiles_delete(struct quotahandle *qh, const struct quotakey *qk);
1.6 dholland 107: struct oldfiles_quotacursor *
108: __quota_oldfiles_cursor_create(struct quotahandle *);
109: void __quota_oldfiles_cursor_destroy(struct oldfiles_quotacursor *);
110: int __quota_oldfiles_cursor_skipidtype(struct oldfiles_quotacursor *,
1.14 ! dholland 111: int idtype);
1.6 dholland 112: int __quota_oldfiles_cursor_get(struct quotahandle *,
113: struct oldfiles_quotacursor *,
114: struct quotakey *, struct quotaval *);
115: int __quota_oldfiles_cursor_getn(struct quotahandle *,
116: struct oldfiles_quotacursor *,
117: struct quotakey *, struct quotaval *,
118: unsigned);
119: int __quota_oldfiles_cursor_atend(struct oldfiles_quotacursor *);
120: int __quota_oldfiles_cursor_rewind(struct oldfiles_quotacursor *);
121:
122:
1.3 dholland 123: /* compat for old library */
124: int __quota_getquota(const char *path, struct quotaval *qv, uid_t id,
125: const char *class);
126:
CVSweb <webmaster@jp.NetBSD.org>