Loading fs/xfs/Makefile +1 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ xfs-$(CONFIG_XFS_QUOTA) += $(addprefix quota/, \ xfs_qm_syscalls.o \ xfs_qm_bhv.o \ xfs_qm.o) xfs-$(CONFIG_XFS_QUOTA) += linux-2.6/xfs_quotaops.o ifeq ($(CONFIG_XFS_QUOTA),y) xfs-$(CONFIG_PROC_FS) += quota/xfs_qm_stats.o Loading fs/xfs/linux-2.6/xfs_iops.c +9 −21 Original line number Diff line number Diff line Loading @@ -211,8 +211,13 @@ xfs_vn_mknod( * Irix uses Missed'em'V split, but doesn't want to see * the upper 5 bits of (14bit) major. */ if (S_ISCHR(mode) || S_ISBLK(mode)) { if (unlikely(!sysv_valid_dev(rdev) || MAJOR(rdev) & ~0x1ff)) return -EINVAL; rdev = sysv_encode_dev(rdev); } else { rdev = 0; } if (test_default_acl && test_default_acl(dir)) { if (!_ACL_ALLOC(default_acl)) { Loading @@ -224,28 +229,11 @@ xfs_vn_mknod( } } xfs_dentry_to_name(&name, dentry); if (IS_POSIXACL(dir) && !default_acl) mode &= ~current->fs->umask; switch (mode & S_IFMT) { case S_IFCHR: case S_IFBLK: case S_IFIFO: case S_IFSOCK: rdev = sysv_encode_dev(rdev); case S_IFREG: xfs_dentry_to_name(&name, dentry); error = xfs_create(XFS_I(dir), &name, mode, rdev, &ip, NULL); break; case S_IFDIR: error = xfs_mkdir(XFS_I(dir), &name, mode, &ip, NULL); break; default: error = EINVAL; break; } if (unlikely(error)) goto out_free_acl; Loading fs/xfs/linux-2.6/xfs_linux.h +0 −11 Original line number Diff line number Diff line Loading @@ -147,17 +147,6 @@ #define SYNCHRONIZE() barrier() #define __return_address __builtin_return_address(0) /* * IRIX (BSD) quotactl makes use of separate commands for user/group, * whereas on Linux the syscall encodes this information into the cmd * field (see the QCMD macro in quota.h). These macros help keep the * code portable - they are not visible from the syscall interface. */ #define Q_XSETGQLIM XQM_CMD(8) /* set groups disk limits */ #define Q_XGETGQUOTA XQM_CMD(9) /* get groups disk limits */ #define Q_XSETPQLIM XQM_CMD(10) /* set projects disk limits */ #define Q_XGETPQUOTA XQM_CMD(11) /* get projects disk limits */ #define dfltprid 0 #define MAXPATHLEN 1024 Loading fs/xfs/linux-2.6/xfs_quotaops.c 0 → 100644 +157 −0 Original line number Diff line number Diff line /* * Copyright (c) 2008, Christoph Hellwig * All Rights Reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it would be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "xfs.h" #include "xfs_dmapi.h" #include "xfs_sb.h" #include "xfs_inum.h" #include "xfs_ag.h" #include "xfs_mount.h" #include "xfs_quota.h" #include "xfs_log.h" #include "xfs_trans.h" #include "xfs_bmap_btree.h" #include "xfs_inode.h" #include "quota/xfs_qm.h" #include <linux/quota.h> STATIC int xfs_quota_type(int type) { switch (type) { case USRQUOTA: return XFS_DQ_USER; case GRPQUOTA: return XFS_DQ_GROUP; default: return XFS_DQ_PROJ; } } STATIC int xfs_fs_quota_sync( struct super_block *sb, int type) { struct xfs_mount *mp = XFS_M(sb); if (!XFS_IS_QUOTA_RUNNING(mp)) return -ENOSYS; return -xfs_sync_inodes(mp, SYNC_DELWRI); } STATIC int xfs_fs_get_xstate( struct super_block *sb, struct fs_quota_stat *fqs) { struct xfs_mount *mp = XFS_M(sb); if (!XFS_IS_QUOTA_RUNNING(mp)) return -ENOSYS; return -xfs_qm_scall_getqstat(mp, fqs); } STATIC int xfs_fs_set_xstate( struct super_block *sb, unsigned int uflags, int op) { struct xfs_mount *mp = XFS_M(sb); unsigned int flags = 0; if (sb->s_flags & MS_RDONLY) return -EROFS; if (!XFS_IS_QUOTA_RUNNING(mp)) return -ENOSYS; if (!capable(CAP_SYS_ADMIN)) return -EPERM; if (uflags & XFS_QUOTA_UDQ_ACCT) flags |= XFS_UQUOTA_ACCT; if (uflags & XFS_QUOTA_PDQ_ACCT) flags |= XFS_PQUOTA_ACCT; if (uflags & XFS_QUOTA_GDQ_ACCT) flags |= XFS_GQUOTA_ACCT; if (uflags & XFS_QUOTA_UDQ_ENFD) flags |= XFS_UQUOTA_ENFD; if (uflags & (XFS_QUOTA_PDQ_ENFD|XFS_QUOTA_GDQ_ENFD)) flags |= XFS_OQUOTA_ENFD; switch (op) { case Q_XQUOTAON: return -xfs_qm_scall_quotaon(mp, flags); case Q_XQUOTAOFF: if (!XFS_IS_QUOTA_ON(mp)) return -EINVAL; return -xfs_qm_scall_quotaoff(mp, flags); case Q_XQUOTARM: if (XFS_IS_QUOTA_ON(mp)) return -EINVAL; return -xfs_qm_scall_trunc_qfiles(mp, flags); } return -EINVAL; } STATIC int xfs_fs_get_xquota( struct super_block *sb, int type, qid_t id, struct fs_disk_quota *fdq) { struct xfs_mount *mp = XFS_M(sb); if (!XFS_IS_QUOTA_RUNNING(mp)) return -ENOSYS; if (!XFS_IS_QUOTA_ON(mp)) return -ESRCH; return -xfs_qm_scall_getquota(mp, id, xfs_quota_type(type), fdq); } STATIC int xfs_fs_set_xquota( struct super_block *sb, int type, qid_t id, struct fs_disk_quota *fdq) { struct xfs_mount *mp = XFS_M(sb); if (sb->s_flags & MS_RDONLY) return -EROFS; if (!XFS_IS_QUOTA_RUNNING(mp)) return -ENOSYS; if (!XFS_IS_QUOTA_ON(mp)) return -ESRCH; if (!capable(CAP_SYS_ADMIN)) return -EPERM; return -xfs_qm_scall_setqlim(mp, id, xfs_quota_type(type), fdq); } struct quotactl_ops xfs_quotactl_operations = { .quota_sync = xfs_fs_quota_sync, .get_xstate = xfs_fs_get_xstate, .set_xstate = xfs_fs_set_xstate, .get_xquota = xfs_fs_get_xquota, .set_xquota = xfs_fs_set_xquota, }; fs/xfs/linux-2.6/xfs_super.c +3 −61 Original line number Diff line number Diff line Loading @@ -68,7 +68,6 @@ #include <linux/freezer.h> #include <linux/parser.h> static struct quotactl_ops xfs_quotactl_operations; static struct super_operations xfs_super_operations; static kmem_zone_t *xfs_ioend_zone; mempool_t *xfs_ioend_pool; Loading Loading @@ -180,7 +179,7 @@ xfs_parseargs( int dswidth = 0; int iosize = 0; int dmapi_implies_ikeep = 1; uchar_t iosizelog = 0; __uint8_t iosizelog = 0; /* * Copy binary VFS mount flags we are interested in. Loading Loading @@ -1333,57 +1332,6 @@ xfs_fs_show_options( return -xfs_showargs(XFS_M(mnt->mnt_sb), m); } STATIC int xfs_fs_quotasync( struct super_block *sb, int type) { return -XFS_QM_QUOTACTL(XFS_M(sb), Q_XQUOTASYNC, 0, NULL); } STATIC int xfs_fs_getxstate( struct super_block *sb, struct fs_quota_stat *fqs) { return -XFS_QM_QUOTACTL(XFS_M(sb), Q_XGETQSTAT, 0, (caddr_t)fqs); } STATIC int xfs_fs_setxstate( struct super_block *sb, unsigned int flags, int op) { return -XFS_QM_QUOTACTL(XFS_M(sb), op, 0, (caddr_t)&flags); } STATIC int xfs_fs_getxquota( struct super_block *sb, int type, qid_t id, struct fs_disk_quota *fdq) { return -XFS_QM_QUOTACTL(XFS_M(sb), (type == USRQUOTA) ? Q_XGETQUOTA : ((type == GRPQUOTA) ? Q_XGETGQUOTA : Q_XGETPQUOTA), id, (caddr_t)fdq); } STATIC int xfs_fs_setxquota( struct super_block *sb, int type, qid_t id, struct fs_disk_quota *fdq) { return -XFS_QM_QUOTACTL(XFS_M(sb), (type == USRQUOTA) ? Q_XSETQLIM : ((type == GRPQUOTA) ? Q_XSETGQLIM : Q_XSETPQLIM), id, (caddr_t)fdq); } /* * This function fills in xfs_mount_t fields based on mount args. * Note: the superblock _has_ now been read in. Loading Loading @@ -1466,7 +1414,9 @@ xfs_fs_fill_super( sb_min_blocksize(sb, BBSIZE); sb->s_xattr = xfs_xattr_handlers; sb->s_export_op = &xfs_export_operations; #ifdef CONFIG_XFS_QUOTA sb->s_qcop = &xfs_quotactl_operations; #endif sb->s_op = &xfs_super_operations; error = xfs_dmops_get(mp); Loading Loading @@ -1609,14 +1559,6 @@ static struct super_operations xfs_super_operations = { .show_options = xfs_fs_show_options, }; static struct quotactl_ops xfs_quotactl_operations = { .quota_sync = xfs_fs_quotasync, .get_xstate = xfs_fs_getxstate, .set_xstate = xfs_fs_setxstate, .get_xquota = xfs_fs_getxquota, .set_xquota = xfs_fs_setxquota, }; static struct file_system_type xfs_fs_type = { .owner = THIS_MODULE, .name = "xfs", Loading Loading
fs/xfs/Makefile +1 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ xfs-$(CONFIG_XFS_QUOTA) += $(addprefix quota/, \ xfs_qm_syscalls.o \ xfs_qm_bhv.o \ xfs_qm.o) xfs-$(CONFIG_XFS_QUOTA) += linux-2.6/xfs_quotaops.o ifeq ($(CONFIG_XFS_QUOTA),y) xfs-$(CONFIG_PROC_FS) += quota/xfs_qm_stats.o Loading
fs/xfs/linux-2.6/xfs_iops.c +9 −21 Original line number Diff line number Diff line Loading @@ -211,8 +211,13 @@ xfs_vn_mknod( * Irix uses Missed'em'V split, but doesn't want to see * the upper 5 bits of (14bit) major. */ if (S_ISCHR(mode) || S_ISBLK(mode)) { if (unlikely(!sysv_valid_dev(rdev) || MAJOR(rdev) & ~0x1ff)) return -EINVAL; rdev = sysv_encode_dev(rdev); } else { rdev = 0; } if (test_default_acl && test_default_acl(dir)) { if (!_ACL_ALLOC(default_acl)) { Loading @@ -224,28 +229,11 @@ xfs_vn_mknod( } } xfs_dentry_to_name(&name, dentry); if (IS_POSIXACL(dir) && !default_acl) mode &= ~current->fs->umask; switch (mode & S_IFMT) { case S_IFCHR: case S_IFBLK: case S_IFIFO: case S_IFSOCK: rdev = sysv_encode_dev(rdev); case S_IFREG: xfs_dentry_to_name(&name, dentry); error = xfs_create(XFS_I(dir), &name, mode, rdev, &ip, NULL); break; case S_IFDIR: error = xfs_mkdir(XFS_I(dir), &name, mode, &ip, NULL); break; default: error = EINVAL; break; } if (unlikely(error)) goto out_free_acl; Loading
fs/xfs/linux-2.6/xfs_linux.h +0 −11 Original line number Diff line number Diff line Loading @@ -147,17 +147,6 @@ #define SYNCHRONIZE() barrier() #define __return_address __builtin_return_address(0) /* * IRIX (BSD) quotactl makes use of separate commands for user/group, * whereas on Linux the syscall encodes this information into the cmd * field (see the QCMD macro in quota.h). These macros help keep the * code portable - they are not visible from the syscall interface. */ #define Q_XSETGQLIM XQM_CMD(8) /* set groups disk limits */ #define Q_XGETGQUOTA XQM_CMD(9) /* get groups disk limits */ #define Q_XSETPQLIM XQM_CMD(10) /* set projects disk limits */ #define Q_XGETPQUOTA XQM_CMD(11) /* get projects disk limits */ #define dfltprid 0 #define MAXPATHLEN 1024 Loading
fs/xfs/linux-2.6/xfs_quotaops.c 0 → 100644 +157 −0 Original line number Diff line number Diff line /* * Copyright (c) 2008, Christoph Hellwig * All Rights Reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it would be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "xfs.h" #include "xfs_dmapi.h" #include "xfs_sb.h" #include "xfs_inum.h" #include "xfs_ag.h" #include "xfs_mount.h" #include "xfs_quota.h" #include "xfs_log.h" #include "xfs_trans.h" #include "xfs_bmap_btree.h" #include "xfs_inode.h" #include "quota/xfs_qm.h" #include <linux/quota.h> STATIC int xfs_quota_type(int type) { switch (type) { case USRQUOTA: return XFS_DQ_USER; case GRPQUOTA: return XFS_DQ_GROUP; default: return XFS_DQ_PROJ; } } STATIC int xfs_fs_quota_sync( struct super_block *sb, int type) { struct xfs_mount *mp = XFS_M(sb); if (!XFS_IS_QUOTA_RUNNING(mp)) return -ENOSYS; return -xfs_sync_inodes(mp, SYNC_DELWRI); } STATIC int xfs_fs_get_xstate( struct super_block *sb, struct fs_quota_stat *fqs) { struct xfs_mount *mp = XFS_M(sb); if (!XFS_IS_QUOTA_RUNNING(mp)) return -ENOSYS; return -xfs_qm_scall_getqstat(mp, fqs); } STATIC int xfs_fs_set_xstate( struct super_block *sb, unsigned int uflags, int op) { struct xfs_mount *mp = XFS_M(sb); unsigned int flags = 0; if (sb->s_flags & MS_RDONLY) return -EROFS; if (!XFS_IS_QUOTA_RUNNING(mp)) return -ENOSYS; if (!capable(CAP_SYS_ADMIN)) return -EPERM; if (uflags & XFS_QUOTA_UDQ_ACCT) flags |= XFS_UQUOTA_ACCT; if (uflags & XFS_QUOTA_PDQ_ACCT) flags |= XFS_PQUOTA_ACCT; if (uflags & XFS_QUOTA_GDQ_ACCT) flags |= XFS_GQUOTA_ACCT; if (uflags & XFS_QUOTA_UDQ_ENFD) flags |= XFS_UQUOTA_ENFD; if (uflags & (XFS_QUOTA_PDQ_ENFD|XFS_QUOTA_GDQ_ENFD)) flags |= XFS_OQUOTA_ENFD; switch (op) { case Q_XQUOTAON: return -xfs_qm_scall_quotaon(mp, flags); case Q_XQUOTAOFF: if (!XFS_IS_QUOTA_ON(mp)) return -EINVAL; return -xfs_qm_scall_quotaoff(mp, flags); case Q_XQUOTARM: if (XFS_IS_QUOTA_ON(mp)) return -EINVAL; return -xfs_qm_scall_trunc_qfiles(mp, flags); } return -EINVAL; } STATIC int xfs_fs_get_xquota( struct super_block *sb, int type, qid_t id, struct fs_disk_quota *fdq) { struct xfs_mount *mp = XFS_M(sb); if (!XFS_IS_QUOTA_RUNNING(mp)) return -ENOSYS; if (!XFS_IS_QUOTA_ON(mp)) return -ESRCH; return -xfs_qm_scall_getquota(mp, id, xfs_quota_type(type), fdq); } STATIC int xfs_fs_set_xquota( struct super_block *sb, int type, qid_t id, struct fs_disk_quota *fdq) { struct xfs_mount *mp = XFS_M(sb); if (sb->s_flags & MS_RDONLY) return -EROFS; if (!XFS_IS_QUOTA_RUNNING(mp)) return -ENOSYS; if (!XFS_IS_QUOTA_ON(mp)) return -ESRCH; if (!capable(CAP_SYS_ADMIN)) return -EPERM; return -xfs_qm_scall_setqlim(mp, id, xfs_quota_type(type), fdq); } struct quotactl_ops xfs_quotactl_operations = { .quota_sync = xfs_fs_quota_sync, .get_xstate = xfs_fs_get_xstate, .set_xstate = xfs_fs_set_xstate, .get_xquota = xfs_fs_get_xquota, .set_xquota = xfs_fs_set_xquota, };
fs/xfs/linux-2.6/xfs_super.c +3 −61 Original line number Diff line number Diff line Loading @@ -68,7 +68,6 @@ #include <linux/freezer.h> #include <linux/parser.h> static struct quotactl_ops xfs_quotactl_operations; static struct super_operations xfs_super_operations; static kmem_zone_t *xfs_ioend_zone; mempool_t *xfs_ioend_pool; Loading Loading @@ -180,7 +179,7 @@ xfs_parseargs( int dswidth = 0; int iosize = 0; int dmapi_implies_ikeep = 1; uchar_t iosizelog = 0; __uint8_t iosizelog = 0; /* * Copy binary VFS mount flags we are interested in. Loading Loading @@ -1333,57 +1332,6 @@ xfs_fs_show_options( return -xfs_showargs(XFS_M(mnt->mnt_sb), m); } STATIC int xfs_fs_quotasync( struct super_block *sb, int type) { return -XFS_QM_QUOTACTL(XFS_M(sb), Q_XQUOTASYNC, 0, NULL); } STATIC int xfs_fs_getxstate( struct super_block *sb, struct fs_quota_stat *fqs) { return -XFS_QM_QUOTACTL(XFS_M(sb), Q_XGETQSTAT, 0, (caddr_t)fqs); } STATIC int xfs_fs_setxstate( struct super_block *sb, unsigned int flags, int op) { return -XFS_QM_QUOTACTL(XFS_M(sb), op, 0, (caddr_t)&flags); } STATIC int xfs_fs_getxquota( struct super_block *sb, int type, qid_t id, struct fs_disk_quota *fdq) { return -XFS_QM_QUOTACTL(XFS_M(sb), (type == USRQUOTA) ? Q_XGETQUOTA : ((type == GRPQUOTA) ? Q_XGETGQUOTA : Q_XGETPQUOTA), id, (caddr_t)fdq); } STATIC int xfs_fs_setxquota( struct super_block *sb, int type, qid_t id, struct fs_disk_quota *fdq) { return -XFS_QM_QUOTACTL(XFS_M(sb), (type == USRQUOTA) ? Q_XSETQLIM : ((type == GRPQUOTA) ? Q_XSETGQLIM : Q_XSETPQLIM), id, (caddr_t)fdq); } /* * This function fills in xfs_mount_t fields based on mount args. * Note: the superblock _has_ now been read in. Loading Loading @@ -1466,7 +1414,9 @@ xfs_fs_fill_super( sb_min_blocksize(sb, BBSIZE); sb->s_xattr = xfs_xattr_handlers; sb->s_export_op = &xfs_export_operations; #ifdef CONFIG_XFS_QUOTA sb->s_qcop = &xfs_quotactl_operations; #endif sb->s_op = &xfs_super_operations; error = xfs_dmops_get(mp); Loading Loading @@ -1609,14 +1559,6 @@ static struct super_operations xfs_super_operations = { .show_options = xfs_fs_show_options, }; static struct quotactl_ops xfs_quotactl_operations = { .quota_sync = xfs_fs_quotasync, .get_xstate = xfs_fs_getxstate, .set_xstate = xfs_fs_setxstate, .get_xquota = xfs_fs_getxquota, .set_xquota = xfs_fs_setxquota, }; static struct file_system_type xfs_fs_type = { .owner = THIS_MODULE, .name = "xfs", Loading