ulfs_quotacommon.h revision 1.1
11.1Sdholland/* $NetBSD: ulfs_quotacommon.h,v 1.1 2013/06/06 00:40:55 dholland Exp $ */ 21.1Sdholland/* from NetBSD: quota.h,v 1.30 2012/08/26 02:32:14 dholland Exp */ 31.1Sdholland 41.1Sdholland/* 51.1Sdholland * Copyright (c) 1982, 1986, 1993 61.1Sdholland * The Regents of the University of California. All rights reserved. 71.1Sdholland * 81.1Sdholland * This code is derived from software contributed to Berkeley by 91.1Sdholland * Robert Elz at The University of Melbourne. 101.1Sdholland * 111.1Sdholland * Redistribution and use in source and binary forms, with or without 121.1Sdholland * modification, are permitted provided that the following conditions 131.1Sdholland * are met: 141.1Sdholland * 1. Redistributions of source code must retain the above copyright 151.1Sdholland * notice, this list of conditions and the following disclaimer. 161.1Sdholland * 2. Redistributions in binary form must reproduce the above copyright 171.1Sdholland * notice, this list of conditions and the following disclaimer in the 181.1Sdholland * documentation and/or other materials provided with the distribution. 191.1Sdholland * 3. Neither the name of the University nor the names of its contributors 201.1Sdholland * may be used to endorse or promote products derived from this software 211.1Sdholland * without specific prior written permission. 221.1Sdholland * 231.1Sdholland * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 241.1Sdholland * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 251.1Sdholland * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 261.1Sdholland * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 271.1Sdholland * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 281.1Sdholland * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 291.1Sdholland * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 301.1Sdholland * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 311.1Sdholland * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 321.1Sdholland * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 331.1Sdholland * SUCH DAMAGE. 341.1Sdholland * 351.1Sdholland * @(#)quota.h 8.3 (Berkeley) 8/19/94 361.1Sdholland */ 371.1Sdholland 381.1Sdholland#ifndef _UFS_UFS_QUOTA_H_ 391.1Sdholland#define _UFS_UFS_QUOTA_H_ 401.1Sdholland 411.1Sdholland/* 421.1Sdholland * These definitions are common to the original disk quota implementation 431.1Sdholland * (quota1) and the newer implementation (quota2) 441.1Sdholland */ 451.1Sdholland 461.1Sdholland/* 471.1Sdholland * The following constants define the usage of the quota file array in the 481.1Sdholland * ufsmount structure and dquot array in the inode structure. The semantics 491.1Sdholland * of the elements of these arrays are defined in the routine getinoquota; 501.1Sdholland * the remainder of the quota code treats them generically and need not be 511.1Sdholland * inspected when changing the size of the array. 521.1Sdholland */ 531.1Sdholland#define MAXQUOTAS 2 541.1Sdholland#define USRQUOTA 0 /* element used for user quotas */ 551.1Sdholland#define GRPQUOTA 1 /* element used for group quotas */ 561.1Sdholland 571.1Sdholland/* 581.1Sdholland * Initializer for the strings corresponding to the quota ID types. 591.1Sdholland * (in quota1 these are also the default names of the quota files) 601.1Sdholland */ 611.1Sdholland#define INITQFNAMES { \ 621.1Sdholland "user", /* USRQUOTA */ \ 631.1Sdholland "group", /* GRPQUOTA */ \ 641.1Sdholland} 651.1Sdholland 661.1Sdholland#if !defined(HAVE_NBTOOL_CONFIG_H) 671.1Sdholland#include <sys/quota.h> 681.1Sdholland__inline static int __unused 691.1Sdhollandquota_idtype_to_ufs(int idtype) 701.1Sdholland{ 711.1Sdholland switch (idtype) { 721.1Sdholland case QUOTA_IDTYPE_USER: 731.1Sdholland return USRQUOTA; 741.1Sdholland case QUOTA_IDTYPE_GROUP: 751.1Sdholland return GRPQUOTA; 761.1Sdholland default: 771.1Sdholland return -1; 781.1Sdholland } 791.1Sdholland} 801.1Sdholland 811.1Sdhollandstatic __inline int __unused 821.1Sdhollandquota_idtype_from_ufs(int ufstype) 831.1Sdholland{ 841.1Sdholland switch (ufstype) { 851.1Sdholland case USRQUOTA: 861.1Sdholland return QUOTA_IDTYPE_USER; 871.1Sdholland case GRPQUOTA: 881.1Sdholland return QUOTA_IDTYPE_GROUP; 891.1Sdholland default: 901.1Sdholland return -1; 911.1Sdholland } 921.1Sdholland} 931.1Sdholland#endif /* !defined(HAVE_NBTOOL_CONFIG_H) */ 941.1Sdholland 951.1Sdholland#ifdef _KERNEL 961.1Sdholland 971.1Sdholland#include <sys/cdefs.h> 981.1Sdholland 991.1Sdholland__BEGIN_DECLS 1001.1Sdhollandvoid dqinit(void); 1011.1Sdhollandvoid dqreinit(void); 1021.1Sdhollandvoid dqdone(void); 1031.1Sdholland__END_DECLS 1041.1Sdholland#endif /* _KERNEL */ 1051.1Sdholland 1061.1Sdholland#endif /* !_UFS_UFS_QUOTA_H_ */ 107