Re: [patch 1/3] Fix XFS_IOC_FSGEOMETRY_V1 in compat mode
On Tue, Jun 19, 2007 at 03:25:50PM +0200, [EMAIL PROTECTED] wrote: > i386 struct xfs_fsop_geom_v1 has no padding after the last member, so > the size is different. Looks good. Added to my qa tree... Cheers, Dave. -- Dave Chinner Principal Engineer SGI Australian Software Group - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch 1/3] Fix XFS_IOC_FSGEOMETRY_V1 in compat mode
On Tue, Jun 19, 2007 at 03:25:50PM +0200, [EMAIL PROTECTED] wrote: i386 struct xfs_fsop_geom_v1 has no padding after the last member, so the size is different. Looks good. Added to my qa tree... Cheers, Dave. -- Dave Chinner Principal Engineer SGI Australian Software Group - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[patch 1/3] Fix XFS_IOC_FSGEOMETRY_V1 in compat mode
i386 struct xfs_fsop_geom_v1 has no padding after the last member, so the size is different. Signed-off-by: Michal Marek <[EMAIL PROTECTED]> --- fs/xfs/linux-2.6/xfs_ioctl32.c | 42 - 1 file changed, 41 insertions(+), 1 deletion(-) --- linux-2.6.orig/fs/xfs/linux-2.6/xfs_ioctl32.c +++ linux-2.6/fs/xfs/linux-2.6/xfs_ioctl32.c @@ -75,6 +75,42 @@ xfs_ioctl32_flock( return (unsigned long)p; } +typedef struct compat_xfs_fsop_geom_v1 { + __u32 blocksize; /* filesystem (data) block size */ + __u32 rtextsize; /* realtime extent size */ + __u32 agblocks; /* fsblocks in an AG*/ + __u32 agcount;/* number of allocation groups */ + __u32 logblocks; /* fsblocks in the log */ + __u32 sectsize; /* (data) sector size, bytes*/ + __u32 inodesize; /* inode size in bytes */ + __u32 imaxpct;/* max allowed inode space(%) */ + __u64 datablocks; /* fsblocks in data subvolume */ + __u64 rtblocks; /* fsblocks in realtime subvol */ + __u64 rtextents; /* rt extents in realtime subvol*/ + __u64 logstart; /* starting fsblock of the log */ + unsigned char uuid[16]; /* unique id of the filesystem */ + __u32 sunit; /* stripe unit, fsblocks*/ + __u32 swidth; /* stripe width, fsblocks */ + __s32 version;/* structure version*/ + __u32 flags; /* superblock version flags */ + __u32 logsectsize;/* log sector size, bytes */ + __u32 rtsectsize; /* realtime sector size, bytes */ + __u32 dirblocksize; /* directory block size, bytes */ +} __attribute__((packed)) compat_xfs_fsop_geom_v1_t; + +#define XFS_IOC_FSGEOMETRY_V1_32 \ + _IOR ('X', 100, struct compat_xfs_fsop_geom_v1) + +STATIC unsigned long xfs_ioctl32_geom_v1(unsigned long arg) +{ + compat_xfs_fsop_geom_v1_t __user *p32 = (void __user *)arg; + xfs_fsop_geom_v1_t __user *p = compat_alloc_user_space(sizeof(*p)); + + if (copy_in_user(p, p32, sizeof(*p32))) + return -EFAULT; + return (unsigned long)p; +} + #else typedef struct xfs_fsop_bulkreq32 { @@ -118,7 +154,6 @@ xfs_compat_ioctl( switch (cmd) { case XFS_IOC_DIOINFO: - case XFS_IOC_FSGEOMETRY_V1: case XFS_IOC_FSGEOMETRY: case XFS_IOC_GETVERSION: case XFS_IOC_GETXFLAGS: @@ -166,6 +201,10 @@ xfs_compat_ioctl( arg = xfs_ioctl32_flock(arg); cmd = _NATIVE_IOC(cmd, struct xfs_flock64); break; + case XFS_IOC_FSGEOMETRY_V1_32: + arg = xfs_ioctl32_geom_v1(arg); + cmd = _NATIVE_IOC(cmd, struct xfs_fsop_geom_v1); + break; #else /* These are handled fine if no alignment issues */ case XFS_IOC_ALLOCSP: @@ -176,6 +215,7 @@ xfs_compat_ioctl( case XFS_IOC_FREESP64: case XFS_IOC_RESVSP64: case XFS_IOC_UNRESVSP64: + case XFS_IOC_FSGEOMETRY_V1: break; /* xfs_bstat_t still has wrong u32 vs u64 alignment */ -- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[patch 1/3] Fix XFS_IOC_FSGEOMETRY_V1 in compat mode
i386 struct xfs_fsop_geom_v1 has no padding after the last member, so the size is different. Signed-off-by: Michal Marek [EMAIL PROTECTED] --- fs/xfs/linux-2.6/xfs_ioctl32.c | 42 - 1 file changed, 41 insertions(+), 1 deletion(-) --- linux-2.6.orig/fs/xfs/linux-2.6/xfs_ioctl32.c +++ linux-2.6/fs/xfs/linux-2.6/xfs_ioctl32.c @@ -75,6 +75,42 @@ xfs_ioctl32_flock( return (unsigned long)p; } +typedef struct compat_xfs_fsop_geom_v1 { + __u32 blocksize; /* filesystem (data) block size */ + __u32 rtextsize; /* realtime extent size */ + __u32 agblocks; /* fsblocks in an AG*/ + __u32 agcount;/* number of allocation groups */ + __u32 logblocks; /* fsblocks in the log */ + __u32 sectsize; /* (data) sector size, bytes*/ + __u32 inodesize; /* inode size in bytes */ + __u32 imaxpct;/* max allowed inode space(%) */ + __u64 datablocks; /* fsblocks in data subvolume */ + __u64 rtblocks; /* fsblocks in realtime subvol */ + __u64 rtextents; /* rt extents in realtime subvol*/ + __u64 logstart; /* starting fsblock of the log */ + unsigned char uuid[16]; /* unique id of the filesystem */ + __u32 sunit; /* stripe unit, fsblocks*/ + __u32 swidth; /* stripe width, fsblocks */ + __s32 version;/* structure version*/ + __u32 flags; /* superblock version flags */ + __u32 logsectsize;/* log sector size, bytes */ + __u32 rtsectsize; /* realtime sector size, bytes */ + __u32 dirblocksize; /* directory block size, bytes */ +} __attribute__((packed)) compat_xfs_fsop_geom_v1_t; + +#define XFS_IOC_FSGEOMETRY_V1_32 \ + _IOR ('X', 100, struct compat_xfs_fsop_geom_v1) + +STATIC unsigned long xfs_ioctl32_geom_v1(unsigned long arg) +{ + compat_xfs_fsop_geom_v1_t __user *p32 = (void __user *)arg; + xfs_fsop_geom_v1_t __user *p = compat_alloc_user_space(sizeof(*p)); + + if (copy_in_user(p, p32, sizeof(*p32))) + return -EFAULT; + return (unsigned long)p; +} + #else typedef struct xfs_fsop_bulkreq32 { @@ -118,7 +154,6 @@ xfs_compat_ioctl( switch (cmd) { case XFS_IOC_DIOINFO: - case XFS_IOC_FSGEOMETRY_V1: case XFS_IOC_FSGEOMETRY: case XFS_IOC_GETVERSION: case XFS_IOC_GETXFLAGS: @@ -166,6 +201,10 @@ xfs_compat_ioctl( arg = xfs_ioctl32_flock(arg); cmd = _NATIVE_IOC(cmd, struct xfs_flock64); break; + case XFS_IOC_FSGEOMETRY_V1_32: + arg = xfs_ioctl32_geom_v1(arg); + cmd = _NATIVE_IOC(cmd, struct xfs_fsop_geom_v1); + break; #else /* These are handled fine if no alignment issues */ case XFS_IOC_ALLOCSP: @@ -176,6 +215,7 @@ xfs_compat_ioctl( case XFS_IOC_FREESP64: case XFS_IOC_RESVSP64: case XFS_IOC_UNRESVSP64: + case XFS_IOC_FSGEOMETRY_V1: break; /* xfs_bstat_t still has wrong u32 vs u64 alignment */ -- - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch 1/3] Fix XFS_IOC_FSGEOMETRY_V1 in compat mode
Arnd Bergmann wrote: > On Wednesday 30 May 2007, Chris Wedgwood wrote: >> On Wed, May 30, 2007 at 02:59:55PM +0200, Michal Marek wrote: >> >>> +typedef struct xfs_fsop_geom_v132 { >> wouldn't xfs_fsop_geom_v1_32 ... >> and xfs_fsop_geom_v1_32_t >> ^ >> >> read better there? > > Actually, the current convention would be struct compat_xfs_fsop_geom_v1 > and compat_xfs_fsop_geom_v1_t. I see. I'll change it to struct compat_xfs_*. Michal - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch 1/3] Fix XFS_IOC_FSGEOMETRY_V1 in compat mode
Arnd Bergmann wrote: On Wednesday 30 May 2007, Chris Wedgwood wrote: On Wed, May 30, 2007 at 02:59:55PM +0200, Michal Marek wrote: +typedef struct xfs_fsop_geom_v132 { wouldn't xfs_fsop_geom_v1_32 ... and xfs_fsop_geom_v1_32_t ^ read better there? Actually, the current convention would be struct compat_xfs_fsop_geom_v1 and compat_xfs_fsop_geom_v1_t. I see. I'll change it to struct compat_xfs_*. Michal - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch 1/3] Fix XFS_IOC_FSGEOMETRY_V1 in compat mode
On Wed, May 30, 2007 at 02:59:55PM +0200, Michal Marek wrote: > i386 struct xfs_fsop_geom_v1 has no padding after the last member, so > the size is different. That's a pain - it's kind of clunky having to redefine the entire structure just pack it differently. Oh well, not much that we can do about it... > > Signed-off-by: Michal Marek <[EMAIL PROTECTED]> > --- > fs/xfs/linux-2.6/xfs_ioctl32.c | 40 > +++- > 1 file changed, 39 insertions(+), 1 deletion(-) > > --- linux-2.6.orig/fs/xfs/linux-2.6/xfs_ioctl32.c > +++ linux-2.6/fs/xfs/linux-2.6/xfs_ioctl32.c > @@ -75,6 +75,40 @@ xfs_ioctl32_flock( > return (unsigned long)p; > } > > +typedef struct xfs_fsop_geom_v132 { xfs_fsop_geom_v1_32 > + __u32 blocksize; /* filesystem (data) block size */ > + __u32 rtextsize; /* realtime extent size */ > + __u32 agblocks; /* fsblocks in an AG*/ > + __u32 agcount;/* number of allocation groups */ > + __u32 logblocks; /* fsblocks in the log */ > + __u32 sectsize; /* (data) sector size, bytes*/ > + __u32 inodesize; /* inode size in bytes */ > + __u32 imaxpct;/* max allowed inode space(%) */ > + __u64 datablocks; /* fsblocks in data subvolume */ > + __u64 rtblocks; /* fsblocks in realtime subvol */ > + __u64 rtextents; /* rt extents in realtime subvol*/ > + __u64 logstart; /* starting fsblock of the log */ > + unsigned char uuid[16]; /* unique id of the filesystem */ > + __u32 sunit; /* stripe unit, fsblocks*/ > + __u32 swidth; /* stripe width, fsblocks */ > + __s32 version;/* structure version*/ > + __u32 flags; /* superblock version flags */ > + __u32 logsectsize;/* log sector size, bytes */ > + __u32 rtsectsize; /* realtime sector size, bytes */ > + __u32 dirblocksize; /* directory block size, bytes */ > +} __attribute__((packed)) xfs_fsop_geom_v132_t; xfs_fsop_geom_v1_32_t > +#define XFS_IOC_FSGEOMETRY_V1_32 _IOR ('X', 100, struct > xfs_fsop_geom_v132) > + > +STATIC unsigned long xfs_ioctl32_geom_v1(unsigned long arg) > +{ > + xfs_fsop_geom_v132_t __user *p32 = (void __user *)arg; > + xfs_fsop_geom_v1_t __user *p = compat_alloc_user_space(sizeof(*p)); > + > + if (copy_in_user(p, p32, sizeof(*p32))) > + return -EFAULT; > + return (unsigned long)p; > +} > + > #else > > typedef struct xfs_fsop_bulkreq32 { > @@ -118,7 +152,6 @@ xfs_compat_ioctl( > > switch (cmd) { > case XFS_IOC_DIOINFO: > - case XFS_IOC_FSGEOMETRY_V1: > case XFS_IOC_FSGEOMETRY: > case XFS_IOC_GETVERSION: > case XFS_IOC_GETXFLAGS: > @@ -166,6 +199,10 @@ xfs_compat_ioctl( > arg = xfs_ioctl32_flock(arg); > cmd = _NATIVE_IOC(cmd, struct xfs_flock64); > break; /* xfs_fsop_geom_v1 changes size */ > + case XFS_IOC_FSGEOMETRY_V1_32: > + arg = xfs_ioctl32_geom_v1(arg); > + cmd = XFS_IOC_FSGEOMETRY_V1; > + break; cmd = _NATIVE_IOC(cmd, struct xfs_fsop_geom_v1); Cheers, Dave. -- Dave Chinner Principal Engineer SGI Australian Software Group - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch 1/3] Fix XFS_IOC_FSGEOMETRY_V1 in compat mode
On Wednesday 30 May 2007, Chris Wedgwood wrote: > > On Wed, May 30, 2007 at 02:59:55PM +0200, Michal Marek wrote: > > > +typedef struct xfs_fsop_geom_v132 { > > wouldn't xfs_fsop_geom_v1_32 > ^ > > > + __u32 blocksize; /* filesystem (data) block size */ > > [...] > > > + __u32 dirblocksize; /* directory block size, bytes */ > > +} __attribute__((packed)) xfs_fsop_geom_v132_t; > > and xfs_fsop_geom_v1_32_t > ^ > > read better there? Actually, the current convention would be struct compat_xfs_fsop_geom_v1 and compat_xfs_fsop_geom_v1_t. Arnd <>< - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch 1/3] Fix XFS_IOC_FSGEOMETRY_V1 in compat mode
On Wed, May 30, 2007 at 02:59:55PM +0200, Michal Marek wrote: > +typedef struct xfs_fsop_geom_v132 { wouldn't xfs_fsop_geom_v1_32 ^ > + __u32 blocksize; /* filesystem (data) block size */ [...] > + __u32 dirblocksize; /* directory block size, bytes */ > +} __attribute__((packed)) xfs_fsop_geom_v132_t; and xfs_fsop_geom_v1_32_t ^ read better there? - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[patch 1/3] Fix XFS_IOC_FSGEOMETRY_V1 in compat mode
i386 struct xfs_fsop_geom_v1 has no padding after the last member, so the size is different. Signed-off-by: Michal Marek <[EMAIL PROTECTED]> --- fs/xfs/linux-2.6/xfs_ioctl32.c | 40 +++- 1 file changed, 39 insertions(+), 1 deletion(-) --- linux-2.6.orig/fs/xfs/linux-2.6/xfs_ioctl32.c +++ linux-2.6/fs/xfs/linux-2.6/xfs_ioctl32.c @@ -75,6 +75,40 @@ xfs_ioctl32_flock( return (unsigned long)p; } +typedef struct xfs_fsop_geom_v132 { + __u32 blocksize; /* filesystem (data) block size */ + __u32 rtextsize; /* realtime extent size */ + __u32 agblocks; /* fsblocks in an AG*/ + __u32 agcount;/* number of allocation groups */ + __u32 logblocks; /* fsblocks in the log */ + __u32 sectsize; /* (data) sector size, bytes*/ + __u32 inodesize; /* inode size in bytes */ + __u32 imaxpct;/* max allowed inode space(%) */ + __u64 datablocks; /* fsblocks in data subvolume */ + __u64 rtblocks; /* fsblocks in realtime subvol */ + __u64 rtextents; /* rt extents in realtime subvol*/ + __u64 logstart; /* starting fsblock of the log */ + unsigned char uuid[16]; /* unique id of the filesystem */ + __u32 sunit; /* stripe unit, fsblocks*/ + __u32 swidth; /* stripe width, fsblocks */ + __s32 version;/* structure version*/ + __u32 flags; /* superblock version flags */ + __u32 logsectsize;/* log sector size, bytes */ + __u32 rtsectsize; /* realtime sector size, bytes */ + __u32 dirblocksize; /* directory block size, bytes */ +} __attribute__((packed)) xfs_fsop_geom_v132_t; +#define XFS_IOC_FSGEOMETRY_V1_32 _IOR ('X', 100, struct xfs_fsop_geom_v132) + +STATIC unsigned long xfs_ioctl32_geom_v1(unsigned long arg) +{ + xfs_fsop_geom_v132_t __user *p32 = (void __user *)arg; + xfs_fsop_geom_v1_t __user *p = compat_alloc_user_space(sizeof(*p)); + + if (copy_in_user(p, p32, sizeof(*p32))) + return -EFAULT; + return (unsigned long)p; +} + #else typedef struct xfs_fsop_bulkreq32 { @@ -118,7 +152,6 @@ xfs_compat_ioctl( switch (cmd) { case XFS_IOC_DIOINFO: - case XFS_IOC_FSGEOMETRY_V1: case XFS_IOC_FSGEOMETRY: case XFS_IOC_GETVERSION: case XFS_IOC_GETXFLAGS: @@ -166,6 +199,10 @@ xfs_compat_ioctl( arg = xfs_ioctl32_flock(arg); cmd = _NATIVE_IOC(cmd, struct xfs_flock64); break; + case XFS_IOC_FSGEOMETRY_V1_32: + arg = xfs_ioctl32_geom_v1(arg); + cmd = XFS_IOC_FSGEOMETRY_V1; + break; #else /* These are handled fine if no alignment issues */ case XFS_IOC_ALLOCSP: @@ -176,6 +213,7 @@ xfs_compat_ioctl( case XFS_IOC_FREESP64: case XFS_IOC_RESVSP64: case XFS_IOC_UNRESVSP64: + case XFS_IOC_FSGEOMETRY_V1: break; /* xfs_bstat_t still has wrong u32 vs u64 alignment */ -- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch 1/3] Fix XFS_IOC_FSGEOMETRY_V1 in compat mode
On Wednesday 30 May 2007, Chris Wedgwood wrote: On Wed, May 30, 2007 at 02:59:55PM +0200, Michal Marek wrote: +typedef struct xfs_fsop_geom_v132 { wouldn't xfs_fsop_geom_v1_32 ^ + __u32 blocksize; /* filesystem (data) block size */ [...] + __u32 dirblocksize; /* directory block size, bytes */ +} __attribute__((packed)) xfs_fsop_geom_v132_t; and xfs_fsop_geom_v1_32_t ^ read better there? Actually, the current convention would be struct compat_xfs_fsop_geom_v1 and compat_xfs_fsop_geom_v1_t. Arnd - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch 1/3] Fix XFS_IOC_FSGEOMETRY_V1 in compat mode
On Wed, May 30, 2007 at 02:59:55PM +0200, Michal Marek wrote: i386 struct xfs_fsop_geom_v1 has no padding after the last member, so the size is different. That's a pain - it's kind of clunky having to redefine the entire structure just pack it differently. Oh well, not much that we can do about it... Signed-off-by: Michal Marek [EMAIL PROTECTED] --- fs/xfs/linux-2.6/xfs_ioctl32.c | 40 +++- 1 file changed, 39 insertions(+), 1 deletion(-) --- linux-2.6.orig/fs/xfs/linux-2.6/xfs_ioctl32.c +++ linux-2.6/fs/xfs/linux-2.6/xfs_ioctl32.c @@ -75,6 +75,40 @@ xfs_ioctl32_flock( return (unsigned long)p; } +typedef struct xfs_fsop_geom_v132 { xfs_fsop_geom_v1_32 + __u32 blocksize; /* filesystem (data) block size */ + __u32 rtextsize; /* realtime extent size */ + __u32 agblocks; /* fsblocks in an AG*/ + __u32 agcount;/* number of allocation groups */ + __u32 logblocks; /* fsblocks in the log */ + __u32 sectsize; /* (data) sector size, bytes*/ + __u32 inodesize; /* inode size in bytes */ + __u32 imaxpct;/* max allowed inode space(%) */ + __u64 datablocks; /* fsblocks in data subvolume */ + __u64 rtblocks; /* fsblocks in realtime subvol */ + __u64 rtextents; /* rt extents in realtime subvol*/ + __u64 logstart; /* starting fsblock of the log */ + unsigned char uuid[16]; /* unique id of the filesystem */ + __u32 sunit; /* stripe unit, fsblocks*/ + __u32 swidth; /* stripe width, fsblocks */ + __s32 version;/* structure version*/ + __u32 flags; /* superblock version flags */ + __u32 logsectsize;/* log sector size, bytes */ + __u32 rtsectsize; /* realtime sector size, bytes */ + __u32 dirblocksize; /* directory block size, bytes */ +} __attribute__((packed)) xfs_fsop_geom_v132_t; xfs_fsop_geom_v1_32_t +#define XFS_IOC_FSGEOMETRY_V1_32 _IOR ('X', 100, struct xfs_fsop_geom_v132) + +STATIC unsigned long xfs_ioctl32_geom_v1(unsigned long arg) +{ + xfs_fsop_geom_v132_t __user *p32 = (void __user *)arg; + xfs_fsop_geom_v1_t __user *p = compat_alloc_user_space(sizeof(*p)); + + if (copy_in_user(p, p32, sizeof(*p32))) + return -EFAULT; + return (unsigned long)p; +} + #else typedef struct xfs_fsop_bulkreq32 { @@ -118,7 +152,6 @@ xfs_compat_ioctl( switch (cmd) { case XFS_IOC_DIOINFO: - case XFS_IOC_FSGEOMETRY_V1: case XFS_IOC_FSGEOMETRY: case XFS_IOC_GETVERSION: case XFS_IOC_GETXFLAGS: @@ -166,6 +199,10 @@ xfs_compat_ioctl( arg = xfs_ioctl32_flock(arg); cmd = _NATIVE_IOC(cmd, struct xfs_flock64); break; /* xfs_fsop_geom_v1 changes size */ + case XFS_IOC_FSGEOMETRY_V1_32: + arg = xfs_ioctl32_geom_v1(arg); + cmd = XFS_IOC_FSGEOMETRY_V1; + break; cmd = _NATIVE_IOC(cmd, struct xfs_fsop_geom_v1); Cheers, Dave. -- Dave Chinner Principal Engineer SGI Australian Software Group - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[patch 1/3] Fix XFS_IOC_FSGEOMETRY_V1 in compat mode
i386 struct xfs_fsop_geom_v1 has no padding after the last member, so the size is different. Signed-off-by: Michal Marek [EMAIL PROTECTED] --- fs/xfs/linux-2.6/xfs_ioctl32.c | 40 +++- 1 file changed, 39 insertions(+), 1 deletion(-) --- linux-2.6.orig/fs/xfs/linux-2.6/xfs_ioctl32.c +++ linux-2.6/fs/xfs/linux-2.6/xfs_ioctl32.c @@ -75,6 +75,40 @@ xfs_ioctl32_flock( return (unsigned long)p; } +typedef struct xfs_fsop_geom_v132 { + __u32 blocksize; /* filesystem (data) block size */ + __u32 rtextsize; /* realtime extent size */ + __u32 agblocks; /* fsblocks in an AG*/ + __u32 agcount;/* number of allocation groups */ + __u32 logblocks; /* fsblocks in the log */ + __u32 sectsize; /* (data) sector size, bytes*/ + __u32 inodesize; /* inode size in bytes */ + __u32 imaxpct;/* max allowed inode space(%) */ + __u64 datablocks; /* fsblocks in data subvolume */ + __u64 rtblocks; /* fsblocks in realtime subvol */ + __u64 rtextents; /* rt extents in realtime subvol*/ + __u64 logstart; /* starting fsblock of the log */ + unsigned char uuid[16]; /* unique id of the filesystem */ + __u32 sunit; /* stripe unit, fsblocks*/ + __u32 swidth; /* stripe width, fsblocks */ + __s32 version;/* structure version*/ + __u32 flags; /* superblock version flags */ + __u32 logsectsize;/* log sector size, bytes */ + __u32 rtsectsize; /* realtime sector size, bytes */ + __u32 dirblocksize; /* directory block size, bytes */ +} __attribute__((packed)) xfs_fsop_geom_v132_t; +#define XFS_IOC_FSGEOMETRY_V1_32 _IOR ('X', 100, struct xfs_fsop_geom_v132) + +STATIC unsigned long xfs_ioctl32_geom_v1(unsigned long arg) +{ + xfs_fsop_geom_v132_t __user *p32 = (void __user *)arg; + xfs_fsop_geom_v1_t __user *p = compat_alloc_user_space(sizeof(*p)); + + if (copy_in_user(p, p32, sizeof(*p32))) + return -EFAULT; + return (unsigned long)p; +} + #else typedef struct xfs_fsop_bulkreq32 { @@ -118,7 +152,6 @@ xfs_compat_ioctl( switch (cmd) { case XFS_IOC_DIOINFO: - case XFS_IOC_FSGEOMETRY_V1: case XFS_IOC_FSGEOMETRY: case XFS_IOC_GETVERSION: case XFS_IOC_GETXFLAGS: @@ -166,6 +199,10 @@ xfs_compat_ioctl( arg = xfs_ioctl32_flock(arg); cmd = _NATIVE_IOC(cmd, struct xfs_flock64); break; + case XFS_IOC_FSGEOMETRY_V1_32: + arg = xfs_ioctl32_geom_v1(arg); + cmd = XFS_IOC_FSGEOMETRY_V1; + break; #else /* These are handled fine if no alignment issues */ case XFS_IOC_ALLOCSP: @@ -176,6 +213,7 @@ xfs_compat_ioctl( case XFS_IOC_FREESP64: case XFS_IOC_RESVSP64: case XFS_IOC_UNRESVSP64: + case XFS_IOC_FSGEOMETRY_V1: break; /* xfs_bstat_t still has wrong u32 vs u64 alignment */ -- - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch 1/3] Fix XFS_IOC_FSGEOMETRY_V1 in compat mode
On Wed, May 30, 2007 at 02:59:55PM +0200, Michal Marek wrote: +typedef struct xfs_fsop_geom_v132 { wouldn't xfs_fsop_geom_v1_32 ^ + __u32 blocksize; /* filesystem (data) block size */ [...] + __u32 dirblocksize; /* directory block size, bytes */ +} __attribute__((packed)) xfs_fsop_geom_v132_t; and xfs_fsop_geom_v1_32_t ^ read better there? - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/