| 1 | /* $NetBSD: ulfs_quotacommon.h,v 1.4 2013/06/08 02:04:31 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_LFS_ULFS_QUOTACOMMON_H_ |
| 39 | #define _UFS_LFS_ULFS_QUOTACOMMON_H_ |
| 40 | |
| 41 | #include <ufs/lfs/lfs.h> |
| 42 | #include <ufs/lfs/lfs_inode.h> |
| 43 | |
| 44 | /* |
| 45 | * These definitions are common to the original disk quota implementation |
| 46 | * (quota1) and the newer implementation (quota2) |
| 47 | */ |
| 48 | |
| 49 | /* |
| 50 | * Initializer for the strings corresponding to the quota ID types. |
| 51 | * (in quota1 these are also the default names of the quota files) |
| 52 | */ |
| 53 | #define INITQFNAMES { \ |
| 54 | "user", /* ULFS_USRQUOTA */ \ |
| 55 | "group", /* ULFS_GRPQUOTA */ \ |
| 56 | } |
| 57 | |
| 58 | #if !defined(HAVE_NBTOOL_CONFIG_H) |
| 59 | #include <sys/quota.h> |
| 60 | __inline static int __unused |
| 61 | quota_idtype_to_ulfs(int idtype) |
| 62 | { |
| 63 | switch (idtype) { |
| 64 | case QUOTA_IDTYPE_USER: |
| 65 | return ULFS_USRQUOTA; |
| 66 | case QUOTA_IDTYPE_GROUP: |
| 67 | return ULFS_GRPQUOTA; |
| 68 | default: |
| 69 | return -1; |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | static __inline int __unused |
| 74 | quota_idtype_from_ulfs(int ulfstype) |
| 75 | { |
| 76 | switch (ulfstype) { |
| 77 | case ULFS_USRQUOTA: |
| 78 | return QUOTA_IDTYPE_USER; |
| 79 | case ULFS_GRPQUOTA: |
| 80 | return QUOTA_IDTYPE_GROUP; |
| 81 | default: |
| 82 | return -1; |
| 83 | } |
| 84 | } |
| 85 | #endif /* !defined(HAVE_NBTOOL_CONFIG_H) */ |
| 86 | |
| 87 | #ifdef _KERNEL |
| 88 | |
| 89 | #include <sys/cdefs.h> |
| 90 | |
| 91 | __BEGIN_DECLS |
| 92 | void lfs_dqinit(void); |
| 93 | void lfs_dqreinit(void); |
| 94 | void lfs_dqdone(void); |
| 95 | __END_DECLS |
| 96 | #endif /* _KERNEL */ |
| 97 | |
| 98 | #endif /* !_UFS_LFS_ULFS_QUOTACOMMON_H_ */ |
| 99 | |