aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorMichal Marek <mmarek@suse.cz>2007-07-10 21:09:57 -0400
committerTim Shimmin <tes@chook.melbourne.sgi.com>2007-07-14 01:41:39 -0400
commit547e00c3c681265b1fe5e34c7643f3ddac748ba0 (patch)
treefa72774cb123ad45230399d508aa11e80cbbd770 /fs/xfs
parent3a59c94c4b48878c6af047cdfc8c137d0fa7a0f0 (diff)
[XFS] Compat ioctl handler for XFS_IOC_FSGEOMETRY_V1.
i386 struct xfs_fsop_geom_v1 has no padding after the last member, so the size is different. SGI-PV: 967354 SGI-Modid: xfs-linux-melb:xfs-kern:29100a Signed-off-by: Michal Marek <mmarek@suse.cz> Signed-off-by: David Chinner <dgc@sgi.com> Signed-off-by: Tim Shimmin <tes@sgi.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/linux-2.6/xfs_ioctl32.c42
1 files changed, 41 insertions, 1 deletions
diff --git a/fs/xfs/linux-2.6/xfs_ioctl32.c b/fs/xfs/linux-2.6/xfs_ioctl32.c
index b83cebc165f1..5b91335e97dd 100644
--- a/fs/xfs/linux-2.6/xfs_ioctl32.c
+++ b/fs/xfs/linux-2.6/xfs_ioctl32.c
@@ -75,6 +75,42 @@ xfs_ioctl32_flock(
75 return (unsigned long)p; 75 return (unsigned long)p;
76} 76}
77 77
78typedef struct compat_xfs_fsop_geom_v1 {
79 __u32 blocksize; /* filesystem (data) block size */
80 __u32 rtextsize; /* realtime extent size */
81 __u32 agblocks; /* fsblocks in an AG */
82 __u32 agcount; /* number of allocation groups */
83 __u32 logblocks; /* fsblocks in the log */
84 __u32 sectsize; /* (data) sector size, bytes */
85 __u32 inodesize; /* inode size in bytes */
86 __u32 imaxpct; /* max allowed inode space(%) */
87 __u64 datablocks; /* fsblocks in data subvolume */
88 __u64 rtblocks; /* fsblocks in realtime subvol */
89 __u64 rtextents; /* rt extents in realtime subvol*/
90 __u64 logstart; /* starting fsblock of the log */
91 unsigned char uuid[16]; /* unique id of the filesystem */
92 __u32 sunit; /* stripe unit, fsblocks */
93 __u32 swidth; /* stripe width, fsblocks */
94 __s32 version; /* structure version */
95 __u32 flags; /* superblock version flags */
96 __u32 logsectsize; /* log sector size, bytes */
97 __u32 rtsectsize; /* realtime sector size, bytes */
98 __u32 dirblocksize; /* directory block size, bytes */
99} __attribute__((packed)) compat_xfs_fsop_geom_v1_t;
100
101#define XFS_IOC_FSGEOMETRY_V1_32 \
102 _IOR ('X', 100, struct compat_xfs_fsop_geom_v1)
103
104STATIC unsigned long xfs_ioctl32_geom_v1(unsigned long arg)
105{
106 compat_xfs_fsop_geom_v1_t __user *p32 = (void __user *)arg;
107 xfs_fsop_geom_v1_t __user *p = compat_alloc_user_space(sizeof(*p));
108
109 if (copy_in_user(p, p32, sizeof(*p32)))
110 return -EFAULT;
111 return (unsigned long)p;
112}
113
78#else 114#else
79 115
80typedef struct xfs_fsop_bulkreq32 { 116typedef struct xfs_fsop_bulkreq32 {
@@ -118,7 +154,6 @@ xfs_compat_ioctl(
118 154
119 switch (cmd) { 155 switch (cmd) {
120 case XFS_IOC_DIOINFO: 156 case XFS_IOC_DIOINFO:
121 case XFS_IOC_FSGEOMETRY_V1:
122 case XFS_IOC_FSGEOMETRY: 157 case XFS_IOC_FSGEOMETRY:
123 case XFS_IOC_GETVERSION: 158 case XFS_IOC_GETVERSION:
124 case XFS_IOC_GETXFLAGS: 159 case XFS_IOC_GETXFLAGS:
@@ -166,6 +201,10 @@ xfs_compat_ioctl(
166 arg = xfs_ioctl32_flock(arg); 201 arg = xfs_ioctl32_flock(arg);
167 cmd = _NATIVE_IOC(cmd, struct xfs_flock64); 202 cmd = _NATIVE_IOC(cmd, struct xfs_flock64);
168 break; 203 break;
204 case XFS_IOC_FSGEOMETRY_V1_32:
205 arg = xfs_ioctl32_geom_v1(arg);
206 cmd = _NATIVE_IOC(cmd, struct xfs_fsop_geom_v1);
207 break;
169 208
170#else /* These are handled fine if no alignment issues */ 209#else /* These are handled fine if no alignment issues */
171 case XFS_IOC_ALLOCSP: 210 case XFS_IOC_ALLOCSP:
@@ -176,6 +215,7 @@ xfs_compat_ioctl(
176 case XFS_IOC_FREESP64: 215 case XFS_IOC_FREESP64:
177 case XFS_IOC_RESVSP64: 216 case XFS_IOC_RESVSP64:
178 case XFS_IOC_UNRESVSP64: 217 case XFS_IOC_UNRESVSP64:
218 case XFS_IOC_FSGEOMETRY_V1:
179 break; 219 break;
180 220
181 /* xfs_bstat_t still has wrong u32 vs u64 alignment */ 221 /* xfs_bstat_t still has wrong u32 vs u64 alignment */