Home | History | Annotate | Line # | Download | only in libquota
quotapvt.h revision 1.6
      1 /*	$NetBSD: quotapvt.h,v 1.6 2012/01/09 15:41:59 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 struct proplib_quotacursor *__quota_proplib_cursor_create(void);
     60 void __quota_proplib_cursor_destroy(struct proplib_quotacursor *);
     61 int __quota_proplib_cursor_skipidtype(struct proplib_quotacursor *,
     62 				      unsigned idtype);
     63 int __quota_proplib_cursor_get(struct quotahandle *,
     64 			       struct proplib_quotacursor *,
     65 			       struct quotakey *, struct quotaval *);
     66 int __quota_proplib_cursor_getn(struct quotahandle *,
     67 				struct proplib_quotacursor *,
     68 				struct quotakey *, struct quotaval *,
     69 				unsigned);
     70 int __quota_proplib_cursor_atend(struct quotahandle *,
     71 				 struct proplib_quotacursor *);
     72 int __quota_proplib_cursor_rewind(struct proplib_quotacursor *);
     73 
     74 
     75 /* nfs rquotad interface */
     76 int __quota_nfs_get(struct quotahandle *qh, const struct quotakey *qk,
     77 		    struct quotaval *qv);
     78 
     79 
     80 /* direct interface to old (quota1-type) files */
     81 int __quota_oldfiles_initialize(struct quotahandle *qh);
     82 const char *__quota_oldfiles_getimplname(struct quotahandle *);
     83 int __quota_oldfiles_get(struct quotahandle *qh, const struct quotakey *qk,
     84 			struct quotaval *qv);
     85 struct oldfiles_quotacursor *
     86 	__quota_oldfiles_cursor_create(struct quotahandle *);
     87 void __quota_oldfiles_cursor_destroy(struct oldfiles_quotacursor *);
     88 int __quota_oldfiles_cursor_skipidtype(struct oldfiles_quotacursor *,
     89 				      unsigned idtype);
     90 int __quota_oldfiles_cursor_get(struct quotahandle *,
     91 			       struct oldfiles_quotacursor *,
     92 			       struct quotakey *, struct quotaval *);
     93 int __quota_oldfiles_cursor_getn(struct quotahandle *,
     94 				struct oldfiles_quotacursor *,
     95 				struct quotakey *, struct quotaval *,
     96 				unsigned);
     97 int __quota_oldfiles_cursor_atend(struct oldfiles_quotacursor *);
     98 int __quota_oldfiles_cursor_rewind(struct oldfiles_quotacursor *);
     99 
    100 
    101 /* compat for old library */
    102 int __quota_getquota(const char *path, struct quotaval *qv, uid_t id,
    103 		     const char *class);
    104 
    105