ulfs_quotacommon.h revision 1.1
1/* $NetBSD: ulfs_quotacommon.h,v 1.1 2013/06/06 00:40:55 dholland Exp $ */ 2/* from NetBSD: quota.h,v 1.30 2012/08/26 02:32:14 dholland Exp */ 3 4/* 5 * Copyright (c) 1982, 1986, 1993 6 * The Regents of the University of California. All rights reserved. 7 * 8 * This code is derived from software contributed to Berkeley by 9 * Robert Elz at The University of Melbourne. 10 * 11 * Redistribution and use in source and binary forms, with or without 12 * modification, are permitted provided that the following conditions 13 * are met: 14 * 1. Redistributions of source code must retain the above copyright 15 * notice, this list of conditions and the following disclaimer. 16 * 2. Redistributions in binary form must reproduce the above copyright 17 * notice, this list of conditions and the following disclaimer in the 18 * documentation and/or other materials provided with the distribution. 19 * 3. Neither the name of the University nor the names of its contributors 20 * may be used to endorse or promote products derived from this software 21 * without specific prior written permission. 22 * 23 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 * 35 * @(#)quota.h 8.3 (Berkeley) 8/19/94 36 */ 37 38#ifndef _UFS_UFS_QUOTA_H_ 39#define _UFS_UFS_QUOTA_H_ 40 41/* 42 * These definitions are common to the original disk quota implementation 43 * (quota1) and the newer implementation (quota2) 44 */ 45 46/* 47 * The following constants define the usage of the quota file array in the 48 * ufsmount structure and dquot array in the inode structure. The semantics 49 * of the elements of these arrays are defined in the routine getinoquota; 50 * the remainder of the quota code treats them generically and need not be 51 * inspected when changing the size of the array. 52 */ 53#define MAXQUOTAS 2 54#define USRQUOTA 0 /* element used for user quotas */ 55#define GRPQUOTA 1 /* element used for group quotas */ 56 57/* 58 * Initializer for the strings corresponding to the quota ID types. 59 * (in quota1 these are also the default names of the quota files) 60 */ 61#define INITQFNAMES { \ 62 "user", /* USRQUOTA */ \ 63 "group", /* GRPQUOTA */ \ 64} 65 66#if !defined(HAVE_NBTOOL_CONFIG_H) 67#include <sys/quota.h> 68__inline static int __unused 69quota_idtype_to_ufs(int idtype) 70{ 71 switch (idtype) { 72 case QUOTA_IDTYPE_USER: 73 return USRQUOTA; 74 case QUOTA_IDTYPE_GROUP: 75 return GRPQUOTA; 76 default: 77 return -1; 78 } 79} 80 81static __inline int __unused 82quota_idtype_from_ufs(int ufstype) 83{ 84 switch (ufstype) { 85 case USRQUOTA: 86 return QUOTA_IDTYPE_USER; 87 case GRPQUOTA: 88 return QUOTA_IDTYPE_GROUP; 89 default: 90 return -1; 91 } 92} 93#endif /* !defined(HAVE_NBTOOL_CONFIG_H) */ 94 95#ifdef _KERNEL 96 97#include <sys/cdefs.h> 98 99__BEGIN_DECLS 100void dqinit(void); 101void dqreinit(void); 102void dqdone(void); 103__END_DECLS 104#endif /* _KERNEL */ 105 106#endif /* !_UFS_UFS_QUOTA_H_ */ 107