aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Scott <nathans@sgi.com>2005-06-21 01:48:04 -0400
committerNathan Scott <nathans@sgi.com>2005-06-21 01:48:04 -0400
commit77bc5beb5977a166e41b87c9d55d8e9cf2b3a04f (patch)
treec4721d0fe343cb7c0bc0f61720581f2498b2b0bb
parentbd5a876ac4c130e8e1986dcdbb21839ae4cd91c0 (diff)
[XFS] Makes more sense to use the fsxattr interface instead of adding new
ioctls for project IDs. SGI-PV: 938145 SGI-Modid: xfs-linux:xfs-kern:22899a Signed-off-by: Nathan Scott <nathans@sgi.com>
-rw-r--r--fs/xfs/linux-2.6/xfs_ioctl.c33
-rw-r--r--fs/xfs/linux-2.6/xfs_ioctl32.c2
-rw-r--r--fs/xfs/xfs_fs.h5
3 files changed, 10 insertions, 30 deletions
diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c
index df17d93bd096..05a447e51cc0 100644
--- a/fs/xfs/linux-2.6/xfs_ioctl.c
+++ b/fs/xfs/linux-2.6/xfs_ioctl.c
@@ -777,8 +777,6 @@ xfs_ioctl(
777 case XFS_IOC_GETVERSION: 777 case XFS_IOC_GETVERSION:
778 case XFS_IOC_GETXFLAGS: 778 case XFS_IOC_GETXFLAGS:
779 case XFS_IOC_SETXFLAGS: 779 case XFS_IOC_SETXFLAGS:
780 case XFS_IOC_GETPROJID:
781 case XFS_IOC_SETPROJID:
782 case XFS_IOC_FSGETXATTR: 780 case XFS_IOC_FSGETXATTR:
783 case XFS_IOC_FSSETXATTR: 781 case XFS_IOC_FSSETXATTR:
784 case XFS_IOC_FSGETXATTRA: 782 case XFS_IOC_FSGETXATTRA:
@@ -1176,7 +1174,8 @@ xfs_ioc_xattr(
1176 1174
1177 switch (cmd) { 1175 switch (cmd) {
1178 case XFS_IOC_FSGETXATTR: { 1176 case XFS_IOC_FSGETXATTR: {
1179 va.va_mask = XFS_AT_XFLAGS|XFS_AT_EXTSIZE|XFS_AT_NEXTENTS; 1177 va.va_mask = XFS_AT_XFLAGS | XFS_AT_EXTSIZE | \
1178 XFS_AT_NEXTENTS | XFS_AT_PROJID;
1180 VOP_GETATTR(vp, &va, 0, NULL, error); 1179 VOP_GETATTR(vp, &va, 0, NULL, error);
1181 if (error) 1180 if (error)
1182 return -error; 1181 return -error;
@@ -1184,6 +1183,7 @@ xfs_ioc_xattr(
1184 fa.fsx_xflags = va.va_xflags; 1183 fa.fsx_xflags = va.va_xflags;
1185 fa.fsx_extsize = va.va_extsize; 1184 fa.fsx_extsize = va.va_extsize;
1186 fa.fsx_nextents = va.va_nextents; 1185 fa.fsx_nextents = va.va_nextents;
1186 fa.fsx_projid = va.va_projid;
1187 1187
1188 if (copy_to_user(arg, &fa, sizeof(fa))) 1188 if (copy_to_user(arg, &fa, sizeof(fa)))
1189 return -XFS_ERROR(EFAULT); 1189 return -XFS_ERROR(EFAULT);
@@ -1198,9 +1198,10 @@ xfs_ioc_xattr(
1198 if (filp->f_flags & (O_NDELAY|O_NONBLOCK)) 1198 if (filp->f_flags & (O_NDELAY|O_NONBLOCK))
1199 attr_flags |= ATTR_NONBLOCK; 1199 attr_flags |= ATTR_NONBLOCK;
1200 1200
1201 va.va_mask = XFS_AT_XFLAGS | XFS_AT_EXTSIZE; 1201 va.va_mask = XFS_AT_XFLAGS | XFS_AT_EXTSIZE | XFS_AT_PROJID;
1202 va.va_xflags = fa.fsx_xflags; 1202 va.va_xflags = fa.fsx_xflags;
1203 va.va_extsize = fa.fsx_extsize; 1203 va.va_extsize = fa.fsx_extsize;
1204 va.va_projid = fa.fsx_projid;
1204 1205
1205 VOP_SETATTR(vp, &va, attr_flags, NULL, error); 1206 VOP_SETATTR(vp, &va, attr_flags, NULL, error);
1206 if (!error) 1207 if (!error)
@@ -1209,7 +1210,8 @@ xfs_ioc_xattr(
1209 } 1210 }
1210 1211
1211 case XFS_IOC_FSGETXATTRA: { 1212 case XFS_IOC_FSGETXATTRA: {
1212 va.va_mask = XFS_AT_XFLAGS|XFS_AT_EXTSIZE|XFS_AT_ANEXTENTS; 1213 va.va_mask = XFS_AT_XFLAGS | XFS_AT_EXTSIZE | \
1214 XFS_AT_ANEXTENTS | XFS_AT_PROJID;
1213 VOP_GETATTR(vp, &va, 0, NULL, error); 1215 VOP_GETATTR(vp, &va, 0, NULL, error);
1214 if (error) 1216 if (error)
1215 return -error; 1217 return -error;
@@ -1217,6 +1219,7 @@ xfs_ioc_xattr(
1217 fa.fsx_xflags = va.va_xflags; 1219 fa.fsx_xflags = va.va_xflags;
1218 fa.fsx_extsize = va.va_extsize; 1220 fa.fsx_extsize = va.va_extsize;
1219 fa.fsx_nextents = va.va_anextents; 1221 fa.fsx_nextents = va.va_anextents;
1222 fa.fsx_projid = va.va_projid;
1220 1223
1221 if (copy_to_user(arg, &fa, sizeof(fa))) 1224 if (copy_to_user(arg, &fa, sizeof(fa)))
1222 return -XFS_ERROR(EFAULT); 1225 return -XFS_ERROR(EFAULT);
@@ -1260,26 +1263,6 @@ xfs_ioc_xattr(
1260 return 0; 1263 return 0;
1261 } 1264 }
1262 1265
1263 case XFS_IOC_GETPROJID: {
1264 va.va_mask = XFS_AT_PROJID;
1265 VOP_GETATTR(vp, &va, 0, NULL, error);
1266 if (error)
1267 return -error;
1268 if (copy_to_user(arg, &va.va_projid, sizeof(va.va_projid)))
1269 return -XFS_ERROR(EFAULT);
1270 return 0;
1271 }
1272
1273 case XFS_IOC_SETPROJID: {
1274 if (!capable(CAP_SYS_ADMIN))
1275 return -EPERM;
1276 va.va_mask = XFS_AT_PROJID;
1277 if (copy_from_user(&va.va_projid, arg, sizeof(va.va_projid)))
1278 return -XFS_ERROR(EFAULT);
1279 VOP_SETATTR(vp, &va, 0, NULL, error);
1280 return -error;
1281 }
1282
1283 default: 1266 default:
1284 return -ENOTTY; 1267 return -ENOTTY;
1285 } 1268 }
diff --git a/fs/xfs/linux-2.6/xfs_ioctl32.c b/fs/xfs/linux-2.6/xfs_ioctl32.c
index be72aca59447..0f8f1384eb36 100644
--- a/fs/xfs/linux-2.6/xfs_ioctl32.c
+++ b/fs/xfs/linux-2.6/xfs_ioctl32.c
@@ -100,8 +100,6 @@ __linvfs_compat_ioctl(int mode, struct file *f, unsigned cmd, unsigned long arg)
100 case XFS_IOC_GETBMAP: 100 case XFS_IOC_GETBMAP:
101 case XFS_IOC_GETBMAPA: 101 case XFS_IOC_GETBMAPA:
102 case XFS_IOC_GETBMAPX: 102 case XFS_IOC_GETBMAPX:
103 case XFS_IOC_SETPROJID:
104 case XFS_IOC_GETPROJID:
105/* not handled 103/* not handled
106 case XFS_IOC_FD_TO_HANDLE: 104 case XFS_IOC_FD_TO_HANDLE:
107 case XFS_IOC_PATH_TO_HANDLE: 105 case XFS_IOC_PATH_TO_HANDLE:
diff --git a/fs/xfs/xfs_fs.h b/fs/xfs/xfs_fs.h
index a7bd4687fa50..095af0a5cff3 100644
--- a/fs/xfs/xfs_fs.h
+++ b/fs/xfs/xfs_fs.h
@@ -60,7 +60,8 @@ struct fsxattr {
60 __u32 fsx_xflags; /* xflags field value (get/set) */ 60 __u32 fsx_xflags; /* xflags field value (get/set) */
61 __u32 fsx_extsize; /* extsize field value (get/set)*/ 61 __u32 fsx_extsize; /* extsize field value (get/set)*/
62 __u32 fsx_nextents; /* nextents field value (get) */ 62 __u32 fsx_nextents; /* nextents field value (get) */
63 unsigned char fsx_pad[16]; 63 __u32 fsx_projid; /* project identifier (get/set) */
64 unsigned char fsx_pad[12];
64}; 65};
65#endif 66#endif
66 67
@@ -477,8 +478,6 @@ typedef struct xfs_handle {
477/* XFS_IOC_SETBIOSIZE ---- deprecated 46 */ 478/* XFS_IOC_SETBIOSIZE ---- deprecated 46 */
478/* XFS_IOC_GETBIOSIZE ---- deprecated 47 */ 479/* XFS_IOC_GETBIOSIZE ---- deprecated 47 */
479#define XFS_IOC_GETBMAPX _IOWR('X', 56, struct getbmap) 480#define XFS_IOC_GETBMAPX _IOWR('X', 56, struct getbmap)
480#define XFS_IOC_SETPROJID _IOWR('X', 57, __uint32_t)
481#define XFS_IOC_GETPROJID _IOWR('X', 58, __uint32_t)
482 481
483/* 482/*
484 * ioctl commands that replace IRIX syssgi()'s 483 * ioctl commands that replace IRIX syssgi()'s