11.4Sdholland/*	$NetBSD: ulfs_quotacommon.h,v 1.4 2013/06/08 02:04:31 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.2Sdholland#ifndef	_UFS_LFS_ULFS_QUOTACOMMON_H_
391.2Sdholland#define	_UFS_LFS_ULFS_QUOTACOMMON_H_
401.1Sdholland
411.4Sdholland#include <ufs/lfs/lfs.h>
421.4Sdholland#include <ufs/lfs/lfs_inode.h>
431.4Sdholland
441.1Sdholland/*
451.1Sdholland * These definitions are common to the original disk quota implementation
461.1Sdholland * (quota1) and the newer implementation (quota2)
471.1Sdholland */
481.1Sdholland
491.1Sdholland/*
501.1Sdholland * Initializer for the strings corresponding to the quota ID types.
511.1Sdholland * (in quota1 these are also the default names of the quota files)
521.1Sdholland */
531.1Sdholland#define INITQFNAMES { \
541.2Sdholland	"user",		/* ULFS_USRQUOTA */ \
551.2Sdholland	"group",	/* ULFS_GRPQUOTA */ \
561.1Sdholland}
571.1Sdholland
581.1Sdholland#if !defined(HAVE_NBTOOL_CONFIG_H)
591.1Sdholland#include <sys/quota.h>
601.1Sdholland__inline static int __unused
611.2Sdhollandquota_idtype_to_ulfs(int idtype)
621.1Sdholland{
631.1Sdholland	switch (idtype) {
641.1Sdholland	case QUOTA_IDTYPE_USER:
651.2Sdholland		return ULFS_USRQUOTA;
661.1Sdholland	case QUOTA_IDTYPE_GROUP:
671.2Sdholland		return ULFS_GRPQUOTA;
681.1Sdholland	default:
691.1Sdholland		return -1;
701.1Sdholland	}
711.1Sdholland}
721.1Sdholland
731.1Sdhollandstatic __inline int __unused
741.2Sdhollandquota_idtype_from_ulfs(int ulfstype)
751.1Sdholland{
761.2Sdholland	switch (ulfstype) {
771.2Sdholland	case ULFS_USRQUOTA:
781.1Sdholland		return QUOTA_IDTYPE_USER;
791.2Sdholland	case ULFS_GRPQUOTA:
801.1Sdholland		return QUOTA_IDTYPE_GROUP;
811.1Sdholland	default:
821.1Sdholland		return -1;
831.1Sdholland	}
841.1Sdholland}
851.1Sdholland#endif /* !defined(HAVE_NBTOOL_CONFIG_H) */
861.1Sdholland
871.1Sdholland#ifdef _KERNEL
881.1Sdholland
891.1Sdholland#include <sys/cdefs.h>
901.1Sdholland
911.1Sdholland__BEGIN_DECLS
921.3Sdhollandvoid	lfs_dqinit(void);
931.3Sdhollandvoid	lfs_dqreinit(void);
941.3Sdhollandvoid	lfs_dqdone(void);
951.1Sdholland__END_DECLS
961.1Sdholland#endif /* _KERNEL */
971.1Sdholland
981.2Sdholland#endif /* !_UFS_LFS_ULFS_QUOTACOMMON_H_ */
99