public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] attrmulti cleanup
@ 2008-05-31  8:01 Christoph Hellwig
  2008-06-20  5:45 ` Timothy Shimmin
  0 siblings, 1 reply; 2+ messages in thread
From: Christoph Hellwig @ 2008-05-31  8:01 UTC (permalink / raw)
  To: xfs

xfs_attrmulti_by_handle currently request the size based on
sizeof(attr_multiop_t) but should be using sizeof(xfs_attr_multiop_t)
because that is what it is dealing with.  Despite beeing wrong this
actually harmless in practice because both structures are the same size
on all platforms.

But this sizeof was the only user of struct attr_multiop so we can just
kill it.  Also move the ATTR_OP_* defines xfs_attr.h into the
struct xfs_attr_multiop defintion in xfs_fs.h because they are only used
with that structure, and are part of the user ABI for the
XFS_IOC_ATTRMULTI_BY_HANDLE ioctl.


Signed-off-by: Christoph Hellwig <hch@lst.de>

Index: linux-2.6-xfs/fs/xfs/linux-2.6/xfs_ioctl.c
===================================================================
--- linux-2.6-xfs.orig/fs/xfs/linux-2.6/xfs_ioctl.c	2008-05-28 17:42:18.000000000 +0200
+++ linux-2.6-xfs/fs/xfs/linux-2.6/xfs_ioctl.c	2008-05-28 17:42:36.000000000 +0200
@@ -598,7 +598,7 @@ xfs_attrmulti_by_handle(
 		goto out;
 
 	error = E2BIG;
-	size = am_hreq.opcount * sizeof(attr_multiop_t);
+	size = am_hreq.opcount * sizeof(xfs_attr_multiop_t);
 	if (!size || size > 16 * PAGE_SIZE)
 		goto out_vn_rele;
 
Index: linux-2.6-xfs/fs/xfs/xfs_attr.h
===================================================================
--- linux-2.6-xfs.orig/fs/xfs/xfs_attr.h	2008-05-28 17:41:06.000000000 +0200
+++ linux-2.6-xfs/fs/xfs/xfs_attr.h	2008-05-28 17:42:36.000000000 +0200
@@ -100,22 +100,6 @@ typedef struct attrlist_ent {	/* data fr
 	 &((char *)buffer)[ ((attrlist_t *)(buffer))->al_offset[index] ])
 
 /*
- * Multi-attribute operation vector.
- */
-typedef struct attr_multiop {
-	int	am_opcode;	/* operation to perform (ATTR_OP_GET, etc.) */
-	int	am_error;	/* [out arg] result of this sub-op (an errno) */
-	char	*am_attrname;	/* attribute name to work with */
-	char	*am_attrvalue;	/* [in/out arg] attribute value (raw bytes) */
-	int	am_length;	/* [in/out arg] length of value */
-	int	am_flags;	/* bitwise OR of attr API flags defined above */
-} attr_multiop_t;
-
-#define ATTR_OP_GET	1	/* return the indicated attr's value */
-#define ATTR_OP_SET	2	/* set/create the indicated attr/value pair */
-#define ATTR_OP_REMOVE	3	/* remove the indicated attr */
-
-/*
  * Kernel-internal version of the attrlist cursor.
  */
 typedef struct attrlist_cursor_kern {
Index: linux-2.6-xfs/fs/xfs/xfs_fs.h
===================================================================
--- linux-2.6-xfs.orig/fs/xfs/xfs_fs.h	2008-05-28 17:41:06.000000000 +0200
+++ linux-2.6-xfs/fs/xfs/xfs_fs.h	2008-05-28 17:42:36.000000000 +0200
@@ -372,6 +372,9 @@ typedef struct xfs_fsop_attrlist_handler
 
 typedef struct xfs_attr_multiop {
 	__u32		am_opcode;
+#define ATTR_OP_GET	1	/* return the indicated attr's value */
+#define ATTR_OP_SET	2	/* set/create the indicated attr/value pair */
+#define ATTR_OP_REMOVE	3	/* remove the indicated attr */
 	__s32		am_error;
 	void		__user *am_attrname;
 	void		__user *am_attrvalue;

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] attrmulti cleanup
  2008-05-31  8:01 [PATCH] attrmulti cleanup Christoph Hellwig
@ 2008-06-20  5:45 ` Timothy Shimmin
  0 siblings, 0 replies; 2+ messages in thread
From: Timothy Shimmin @ 2008-06-20  5:45 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs

Cool.
I'll run thru qa and check it in.
Funny how we had two versions.

--Tim

Christoph Hellwig wrote:
> xfs_attrmulti_by_handle currently request the size based on
> sizeof(attr_multiop_t) but should be using sizeof(xfs_attr_multiop_t)
> because that is what it is dealing with.  Despite beeing wrong this
> actually harmless in practice because both structures are the same size
> on all platforms.
> 
> But this sizeof was the only user of struct attr_multiop so we can just
> kill it.  Also move the ATTR_OP_* defines xfs_attr.h into the
> struct xfs_attr_multiop defintion in xfs_fs.h because they are only used
> with that structure, and are part of the user ABI for the
> XFS_IOC_ATTRMULTI_BY_HANDLE ioctl.
> 
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> 
> Index: linux-2.6-xfs/fs/xfs/linux-2.6/xfs_ioctl.c
> ===================================================================
> --- linux-2.6-xfs.orig/fs/xfs/linux-2.6/xfs_ioctl.c	2008-05-28 17:42:18.000000000 +0200
> +++ linux-2.6-xfs/fs/xfs/linux-2.6/xfs_ioctl.c	2008-05-28 17:42:36.000000000 +0200
> @@ -598,7 +598,7 @@ xfs_attrmulti_by_handle(
>  		goto out;
>  
>  	error = E2BIG;
> -	size = am_hreq.opcount * sizeof(attr_multiop_t);
> +	size = am_hreq.opcount * sizeof(xfs_attr_multiop_t);
>  	if (!size || size > 16 * PAGE_SIZE)
>  		goto out_vn_rele;
>  
> Index: linux-2.6-xfs/fs/xfs/xfs_attr.h
> ===================================================================
> --- linux-2.6-xfs.orig/fs/xfs/xfs_attr.h	2008-05-28 17:41:06.000000000 +0200
> +++ linux-2.6-xfs/fs/xfs/xfs_attr.h	2008-05-28 17:42:36.000000000 +0200
> @@ -100,22 +100,6 @@ typedef struct attrlist_ent {	/* data fr
>  	 &((char *)buffer)[ ((attrlist_t *)(buffer))->al_offset[index] ])
>  
>  /*
> - * Multi-attribute operation vector.
> - */
> -typedef struct attr_multiop {
> -	int	am_opcode;	/* operation to perform (ATTR_OP_GET, etc.) */
> -	int	am_error;	/* [out arg] result of this sub-op (an errno) */
> -	char	*am_attrname;	/* attribute name to work with */
> -	char	*am_attrvalue;	/* [in/out arg] attribute value (raw bytes) */
> -	int	am_length;	/* [in/out arg] length of value */
> -	int	am_flags;	/* bitwise OR of attr API flags defined above */
> -} attr_multiop_t;
> -
> -#define ATTR_OP_GET	1	/* return the indicated attr's value */
> -#define ATTR_OP_SET	2	/* set/create the indicated attr/value pair */
> -#define ATTR_OP_REMOVE	3	/* remove the indicated attr */
> -
> -/*
>   * Kernel-internal version of the attrlist cursor.
>   */
>  typedef struct attrlist_cursor_kern {
> Index: linux-2.6-xfs/fs/xfs/xfs_fs.h
> ===================================================================
> --- linux-2.6-xfs.orig/fs/xfs/xfs_fs.h	2008-05-28 17:41:06.000000000 +0200
> +++ linux-2.6-xfs/fs/xfs/xfs_fs.h	2008-05-28 17:42:36.000000000 +0200
> @@ -372,6 +372,9 @@ typedef struct xfs_fsop_attrlist_handler
>  
>  typedef struct xfs_attr_multiop {
>  	__u32		am_opcode;
> +#define ATTR_OP_GET	1	/* return the indicated attr's value */
> +#define ATTR_OP_SET	2	/* set/create the indicated attr/value pair */
> +#define ATTR_OP_REMOVE	3	/* remove the indicated attr */
>  	__s32		am_error;
>  	void		__user *am_attrname;
>  	void		__user *am_attrvalue;
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-06-20  5:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-31  8:01 [PATCH] attrmulti cleanup Christoph Hellwig
2008-06-20  5:45 ` Timothy Shimmin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox