2012-01-25 21:43:37 +04:00
|
|
|
/* $NetBSD: quotapvt.h,v 1.10 2012/01/25 17:43:37 dholland Exp $ */
|
2012-01-09 19:27:04 +04:00
|
|
|
/*-
|
|
|
|
* Copyright (c) 2011 The NetBSD Foundation, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This code is derived from software contributed to The NetBSD Foundation
|
|
|
|
* by David A. Holland.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
|
|
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
|
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
|
|
|
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
2012-01-25 21:43:37 +04:00
|
|
|
#define QUOTA_MODE_NFS 1
|
|
|
|
#define QUOTA_MODE_PROPLIB 2
|
|
|
|
#define QUOTA_MODE_OLDFILES 3
|
|
|
|
|
2012-01-09 19:27:04 +04:00
|
|
|
struct quotahandle {
|
|
|
|
char *qh_mountpoint;
|
2012-01-09 19:29:55 +04:00
|
|
|
char *qh_mountdevice;
|
2012-01-25 21:43:37 +04:00
|
|
|
int qh_mode;
|
2012-01-09 19:41:58 +04:00
|
|
|
|
|
|
|
/* these are used only by quota_oldfiles */
|
2012-01-25 21:43:37 +04:00
|
|
|
int qh_oldfilesopen;
|
2012-01-09 19:41:58 +04:00
|
|
|
int qh_userfile;
|
|
|
|
int qh_groupfile;
|
|
|
|
|
|
|
|
char spare[14*sizeof(char *) + 12 * sizeof(int)];
|
2012-01-09 19:27:04 +04:00
|
|
|
};
|
|
|
|
|
2012-01-09 19:40:10 +04:00
|
|
|
struct quotacursor {
|
|
|
|
struct quotahandle *qc_qh;
|
2012-01-09 19:41:58 +04:00
|
|
|
enum { QC_PROPLIB, QC_OLDFILES } qc_type;
|
2012-01-09 19:40:10 +04:00
|
|
|
union {
|
|
|
|
struct proplib_quotacursor *qc_proplib;
|
2012-01-09 19:41:58 +04:00
|
|
|
struct oldfiles_quotacursor *qc_oldfiles;
|
2012-01-09 19:40:10 +04:00
|
|
|
} u;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2012-01-09 19:27:04 +04:00
|
|
|
/* proplib kernel interface */
|
2012-01-09 19:41:58 +04:00
|
|
|
int __quota_proplib_getversion(struct quotahandle *qh, int8_t *version_ret);
|
2012-01-09 19:34:34 +04:00
|
|
|
const char *__quota_proplib_getimplname(struct quotahandle *);
|
2012-01-25 05:22:56 +04:00
|
|
|
unsigned __quota_proplib_getnumidtypes(void);
|
|
|
|
const char *__quota_proplib_idtype_getname(int idtype);
|
|
|
|
unsigned __quota_proplib_getnumobjtypes(void);
|
|
|
|
const char *__quota_proplib_objtype_getname(int objtype);
|
|
|
|
int __quota_proplib_objtype_isbytes(int objtype);
|
2012-01-09 19:27:04 +04:00
|
|
|
int __quota_proplib_get(struct quotahandle *qh, const struct quotakey *qk,
|
|
|
|
struct quotaval *qv);
|
2012-01-09 19:43:19 +04:00
|
|
|
int __quota_proplib_put(struct quotahandle *qh, const struct quotakey *qk,
|
|
|
|
const struct quotaval *qv);
|
|
|
|
int __quota_proplib_delete(struct quotahandle *qh, const struct quotakey *qk);
|
2012-01-09 19:40:10 +04:00
|
|
|
struct proplib_quotacursor *__quota_proplib_cursor_create(void);
|
|
|
|
void __quota_proplib_cursor_destroy(struct proplib_quotacursor *);
|
|
|
|
int __quota_proplib_cursor_skipidtype(struct proplib_quotacursor *,
|
|
|
|
unsigned idtype);
|
|
|
|
int __quota_proplib_cursor_get(struct quotahandle *,
|
|
|
|
struct proplib_quotacursor *,
|
|
|
|
struct quotakey *, struct quotaval *);
|
|
|
|
int __quota_proplib_cursor_getn(struct quotahandle *,
|
|
|
|
struct proplib_quotacursor *,
|
|
|
|
struct quotakey *, struct quotaval *,
|
|
|
|
unsigned);
|
|
|
|
int __quota_proplib_cursor_atend(struct quotahandle *,
|
|
|
|
struct proplib_quotacursor *);
|
|
|
|
int __quota_proplib_cursor_rewind(struct proplib_quotacursor *);
|
|
|
|
|
2012-01-09 19:29:55 +04:00
|
|
|
|
|
|
|
/* nfs rquotad interface */
|
|
|
|
int __quota_nfs_get(struct quotahandle *qh, const struct quotakey *qk,
|
|
|
|
struct quotaval *qv);
|
|
|
|
|
2012-01-09 19:40:10 +04:00
|
|
|
|
2012-01-09 19:41:58 +04:00
|
|
|
/* direct interface to old (quota1-type) files */
|
2012-01-25 21:43:37 +04:00
|
|
|
void __quota_oldfiles_load_fstab(void);
|
|
|
|
int __quota_oldfiles_infstab(const char *);
|
2012-01-09 19:41:58 +04:00
|
|
|
int __quota_oldfiles_initialize(struct quotahandle *qh);
|
|
|
|
const char *__quota_oldfiles_getimplname(struct quotahandle *);
|
|
|
|
int __quota_oldfiles_get(struct quotahandle *qh, const struct quotakey *qk,
|
|
|
|
struct quotaval *qv);
|
2012-01-09 19:45:19 +04:00
|
|
|
int __quota_oldfiles_put(struct quotahandle *qh, const struct quotakey *qk,
|
|
|
|
const struct quotaval *qv);
|
|
|
|
int __quota_oldfiles_delete(struct quotahandle *qh, const struct quotakey *qk);
|
2012-01-09 19:41:58 +04:00
|
|
|
struct oldfiles_quotacursor *
|
|
|
|
__quota_oldfiles_cursor_create(struct quotahandle *);
|
|
|
|
void __quota_oldfiles_cursor_destroy(struct oldfiles_quotacursor *);
|
|
|
|
int __quota_oldfiles_cursor_skipidtype(struct oldfiles_quotacursor *,
|
|
|
|
unsigned idtype);
|
|
|
|
int __quota_oldfiles_cursor_get(struct quotahandle *,
|
|
|
|
struct oldfiles_quotacursor *,
|
|
|
|
struct quotakey *, struct quotaval *);
|
|
|
|
int __quota_oldfiles_cursor_getn(struct quotahandle *,
|
|
|
|
struct oldfiles_quotacursor *,
|
|
|
|
struct quotakey *, struct quotaval *,
|
|
|
|
unsigned);
|
|
|
|
int __quota_oldfiles_cursor_atend(struct oldfiles_quotacursor *);
|
|
|
|
int __quota_oldfiles_cursor_rewind(struct oldfiles_quotacursor *);
|
|
|
|
|
|
|
|
|
2012-01-09 19:31:11 +04:00
|
|
|
/* compat for old library */
|
|
|
|
int __quota_getquota(const char *path, struct quotaval *qv, uid_t id,
|
|
|
|
const char *class);
|
|
|
|
|