1*2b7e44b3Sdholland /* $NetBSD: quotapvt.h,v 1.6 2012/01/09 15:41:59 dholland Exp $ */ 25a065375Sdholland /*- 35a065375Sdholland * Copyright (c) 2011 The NetBSD Foundation, Inc. 45a065375Sdholland * All rights reserved. 55a065375Sdholland * 65a065375Sdholland * This code is derived from software contributed to The NetBSD Foundation 75a065375Sdholland * by David A. Holland. 85a065375Sdholland * 95a065375Sdholland * Redistribution and use in source and binary forms, with or without 105a065375Sdholland * modification, are permitted provided that the following conditions 115a065375Sdholland * are met: 125a065375Sdholland * 1. Redistributions of source code must retain the above copyright 135a065375Sdholland * notice, this list of conditions and the following disclaimer. 145a065375Sdholland * 2. Redistributions in binary form must reproduce the above copyright 155a065375Sdholland * notice, this list of conditions and the following disclaimer in the 165a065375Sdholland * documentation and/or other materials provided with the distribution. 175a065375Sdholland * 185a065375Sdholland * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 195a065375Sdholland * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 205a065375Sdholland * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 215a065375Sdholland * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 225a065375Sdholland * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 235a065375Sdholland * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 245a065375Sdholland * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 255a065375Sdholland * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 265a065375Sdholland * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 275a065375Sdholland * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 285a065375Sdholland * POSSIBILITY OF SUCH DAMAGE. 295a065375Sdholland */ 305a065375Sdholland 315a065375Sdholland struct quotahandle { 325a065375Sdholland char *qh_mountpoint; 3301237e81Sdholland char *qh_mountdevice; 3401237e81Sdholland int qh_isnfs; 35*2b7e44b3Sdholland 36*2b7e44b3Sdholland /* these are used only by quota_oldfiles */ 37*2b7e44b3Sdholland int qh_hasoldfiles; 38*2b7e44b3Sdholland int qh_userfile; 39*2b7e44b3Sdholland int qh_groupfile; 40*2b7e44b3Sdholland 41*2b7e44b3Sdholland char spare[14*sizeof(char *) + 12 * sizeof(int)]; 425a065375Sdholland }; 435a065375Sdholland 440599112cSdholland struct quotacursor { 450599112cSdholland struct quotahandle *qc_qh; 46*2b7e44b3Sdholland enum { QC_PROPLIB, QC_OLDFILES } qc_type; 470599112cSdholland union { 480599112cSdholland struct proplib_quotacursor *qc_proplib; 49*2b7e44b3Sdholland struct oldfiles_quotacursor *qc_oldfiles; 500599112cSdholland } u; 510599112cSdholland }; 520599112cSdholland 530599112cSdholland 545a065375Sdholland /* proplib kernel interface */ 55*2b7e44b3Sdholland int __quota_proplib_getversion(struct quotahandle *qh, int8_t *version_ret); 56ef4f90bcSdholland const char *__quota_proplib_getimplname(struct quotahandle *); 575a065375Sdholland int __quota_proplib_get(struct quotahandle *qh, const struct quotakey *qk, 585a065375Sdholland struct quotaval *qv); 590599112cSdholland struct proplib_quotacursor *__quota_proplib_cursor_create(void); 600599112cSdholland void __quota_proplib_cursor_destroy(struct proplib_quotacursor *); 610599112cSdholland int __quota_proplib_cursor_skipidtype(struct proplib_quotacursor *, 620599112cSdholland unsigned idtype); 630599112cSdholland int __quota_proplib_cursor_get(struct quotahandle *, 640599112cSdholland struct proplib_quotacursor *, 650599112cSdholland struct quotakey *, struct quotaval *); 660599112cSdholland int __quota_proplib_cursor_getn(struct quotahandle *, 670599112cSdholland struct proplib_quotacursor *, 680599112cSdholland struct quotakey *, struct quotaval *, 690599112cSdholland unsigned); 700599112cSdholland int __quota_proplib_cursor_atend(struct quotahandle *, 710599112cSdholland struct proplib_quotacursor *); 720599112cSdholland int __quota_proplib_cursor_rewind(struct proplib_quotacursor *); 730599112cSdholland 7401237e81Sdholland 7501237e81Sdholland /* nfs rquotad interface */ 7601237e81Sdholland int __quota_nfs_get(struct quotahandle *qh, const struct quotakey *qk, 7701237e81Sdholland struct quotaval *qv); 7801237e81Sdholland 790599112cSdholland 80*2b7e44b3Sdholland /* direct interface to old (quota1-type) files */ 81*2b7e44b3Sdholland int __quota_oldfiles_initialize(struct quotahandle *qh); 82*2b7e44b3Sdholland const char *__quota_oldfiles_getimplname(struct quotahandle *); 83*2b7e44b3Sdholland int __quota_oldfiles_get(struct quotahandle *qh, const struct quotakey *qk, 84*2b7e44b3Sdholland struct quotaval *qv); 85*2b7e44b3Sdholland struct oldfiles_quotacursor * 86*2b7e44b3Sdholland __quota_oldfiles_cursor_create(struct quotahandle *); 87*2b7e44b3Sdholland void __quota_oldfiles_cursor_destroy(struct oldfiles_quotacursor *); 88*2b7e44b3Sdholland int __quota_oldfiles_cursor_skipidtype(struct oldfiles_quotacursor *, 89*2b7e44b3Sdholland unsigned idtype); 90*2b7e44b3Sdholland int __quota_oldfiles_cursor_get(struct quotahandle *, 91*2b7e44b3Sdholland struct oldfiles_quotacursor *, 92*2b7e44b3Sdholland struct quotakey *, struct quotaval *); 93*2b7e44b3Sdholland int __quota_oldfiles_cursor_getn(struct quotahandle *, 94*2b7e44b3Sdholland struct oldfiles_quotacursor *, 95*2b7e44b3Sdholland struct quotakey *, struct quotaval *, 96*2b7e44b3Sdholland unsigned); 97*2b7e44b3Sdholland int __quota_oldfiles_cursor_atend(struct oldfiles_quotacursor *); 98*2b7e44b3Sdholland int __quota_oldfiles_cursor_rewind(struct oldfiles_quotacursor *); 99*2b7e44b3Sdholland 100*2b7e44b3Sdholland 1015082b605Sdholland /* compat for old library */ 1025082b605Sdholland int __quota_getquota(const char *path, struct quotaval *qv, uid_t id, 1035082b605Sdholland const char *class); 1045082b605Sdholland 105