if (addr == NULL && cmd != Q_SYNC) return XFS_ERROR(EINVAL); if (id < 0 && cmd != Q_SYNC) return XFS_ERROR(EINVAL); 
ASSERT(addr != NULL); 
xfs_qm_quotactl(	struct bhv_desc *bdp,	int		cmd,	int		id,	xfs_caddr_t	addr){	xfs_mount_t	*mp;	int		error;	struct vfs	*vfsp;	vfsp = bhvtovfs(bdp);	mp = XFS_VFSTOM(vfsp);	if (addr == NULL && cmd != Q_SYNC)		return XFS_ERROR(EINVAL);	if (id < 0 && cmd != Q_SYNC)		return XFS_ERROR(EINVAL);	/*	 * The following commands are valid even when quotaoff.	 */	switch (cmd) {	case Q_XQUOTARM:		/*		 * Truncate quota files. quota must be off.		 */		if (XFS_IS_QUOTA_ON(mp) || addr == NULL)			return XFS_ERROR(EINVAL);		if (vfsp->vfs_flag & VFS_RDONLY)			return XFS_ERROR(EROFS);		return (xfs_qm_scall_trunc_qfiles(mp,			       xfs_qm_import_qtype_flags(*(uint *)addr)));	case Q_XGETQSTAT:		/*		 * Get quota status information.		 */		return (xfs_qm_scall_getqstat(mp, (fs_quota_stat_t *)addr));	case Q_XQUOTAON:		/*		 * QUOTAON - enabling quota enforcement.		 * Quota accounting must be turned on at mount time.		 */		if (addr == NULL)			return XFS_ERROR(EINVAL);		if (vfsp->vfs_flag & VFS_RDONLY)			return XFS_ERROR(EROFS);		return (xfs_qm_scall_quotaon(mp,					  xfs_qm_import_flags(*(uint *)addr)));	case Q_XQUOTAOFF:		if (vfsp->vfs_flag & VFS_RDONLY)			return XFS_ERROR(EROFS);		break;	default:		break;	}	if (! XFS_IS_QUOTA_ON(mp))		return XFS_ERROR(ESRCH);	switch (cmd) {	case Q_XQUOTAOFF:		if (vfsp->vfs_flag & VFS_RDONLY)			return XFS_ERROR(EROFS);		error = xfs_qm_scall_quotaoff(mp,					    xfs_qm_import_flags(*(uint *)addr),					    B_FALSE);		break;	case Q_XGETQUOTA:		error = xfs_qm_scall_getquota(mp, (xfs_dqid_t)id, XFS_DQ_USER,					(fs_disk_quota_t *)addr);		break;	case Q_XGETGQUOTA:		error = xfs_qm_scall_getquota(mp, (xfs_dqid_t)id, XFS_DQ_GROUP,					(fs_disk_quota_t *)addr);		break;	case Q_XGETPQUOTA:		error = xfs_qm_scall_getquota(mp, (xfs_dqid_t)id, XFS_DQ_PROJ,					(fs_disk_quota_t *)addr);		break;	case Q_XSETQLIM:		if (vfsp->vfs_flag & VFS_RDONLY)			return XFS_ERROR(EROFS);		error = xfs_qm_scall_setqlim(mp, (xfs_dqid_t)id, XFS_DQ_USER,					     (fs_disk_quota_t *)addr);		break;	case Q_XSETGQLIM:		if (vfsp->vfs_flag & VFS_RDONLY)			return XFS_ERROR(EROFS);		error = xfs_qm_scall_setqlim(mp, (xfs_dqid_t)id, XFS_DQ_GROUP,					     (fs_disk_quota_t *)addr);		break;	case Q_XSETPQLIM:		if (vfsp->vfs_flag & VFS_RDONLY)			return XFS_ERROR(EROFS);		error = xfs_qm_scall_setqlim(mp, (xfs_dqid_t)id, XFS_DQ_PROJ,					     (fs_disk_quota_t *)addr);		break;	default:		error = XFS_ERROR(EINVAL);		break;	}	return (error);}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/c310ab6c071a688e5291028972d1ae8314f67536/xfs_qm_syscalls.c/clean/fs/xfs/quota/xfs_qm_syscalls.c