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