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
38struct quotahandle; /* Opaque. */
39struct quotacursor; /* Opaque. */
40
41
42void quotaval_clear(struct quotaval *);
43
44struct quotahandle *quota_open(const char *);
45void quota_close(struct quotahandle *);
46
47const char *quota_getmountpoint(struct quotahandle *);
48const char *quota_getmountdevice(struct quotahandle *);
49
50const char *quota_getimplname(struct quotahandle *);
51unsigned quota_getrestrictions(struct quotahandle *);
52
53int quota_getnumidtypes(struct quotahandle *);
54const char *quota_idtype_getname(struct quotahandle *, int /*idtype*/);
55
56int quota_getnumobjtypes(struct quotahandle *);
57const char *quota_objtype_getname(struct quotahandle *, int /*objtype*/);
58int quota_objtype_isbytes(struct quotahandle *, int /*objtype*/);
59
60int quota_quotaon(struct quotahandle *, int /*idtype*/);
61int quota_quotaoff(struct quotahandle *, int /*idtype*/);
62
63int quota_get(struct quotahandle *, const struct quotakey *,
64	      struct quotaval *);
65
66int quota_put(struct quotahandle *, const struct quotakey *,
67	      const struct quotaval *);
68
69int quota_delete(struct quotahandle *, const struct quotakey *);
70
71struct quotacursor *quota_opencursor(struct quotahandle *);
72void quotacursor_close(struct quotacursor *);
73
74int quotacursor_skipidtype(struct quotacursor *, int /*idtype*/);
75
76int quotacursor_get(struct quotacursor *, struct quotakey *,
77		    struct quotaval *);
78
79int quotacursor_getn(struct quotacursor *, struct quotakey *,
80		     struct quotaval *, unsigned /*maxnum*/);
81
82int quotacursor_atend(struct quotacursor *);
83int quotacursor_rewind(struct quotacursor *);
84
85#endif /* _QUOTA_H_ */
86