public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs: Remove typedef xfs_uu_t
@ 2014-08-06 14:13 Himangi Saraogi
  2014-08-06 14:28 ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: Himangi Saraogi @ 2014-08-06 14:13 UTC (permalink / raw)
  To: Dave Chinner, xfs, linux-kernel; +Cc: Julia Lawall

The Linux kernel coding style guidelines suggest not using typedefs
for structure types. This patch gets rid of the typedef for xfs_uu_t.
Also the names of the struct is changed to drop the _t, to make the
name look less typedef-like.

The following Coccinelle semantic patch detects the case.

@tn1@
type td;
@@

typedef struct { ... } td;

@script:python tf@
td << tn1.td;
tdres;
@@

coccinelle.tdres = td;

@@
type tn1.td;
identifier tf.tdres;
@@

-typedef
 struct 
+  tdres
   { ... }
-td
 ;

@@
type tn1.td;
identifier tf.tdres;
@@

(
-td
+ struct tdres
|
 const
- td
+ struct tdres
)

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
---
 fs/xfs/uuid.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/xfs/uuid.c b/fs/xfs/uuid.c
index b83f76b..1f21d8f 100644
--- a/fs/xfs/uuid.c
+++ b/fs/xfs/uuid.c
@@ -18,13 +18,13 @@
 #include <xfs.h>
 
 /* IRIX interpretation of an uuid_t */
-typedef struct {
+struct xfs_uu {
 	__be32	uu_timelow;
 	__be16	uu_timemid;
 	__be16	uu_timehi;
 	__be16	uu_clockseq;
 	__be16	uu_node[3];
-} xfs_uu_t;
+};
 
 /*
  * uuid_getnodeuniq - obtain the node unique fields of a UUID.
@@ -35,7 +35,7 @@ typedef struct {
 void
 uuid_getnodeuniq(uuid_t *uuid, int fsid [2])
 {
-	xfs_uu_t *uup = (xfs_uu_t *)uuid;
+	struct xfs_uu *uup = (struct xfs_uu *)uuid;
 
 	fsid[0] = (be16_to_cpu(uup->uu_clockseq) << 16) |
 		   be16_to_cpu(uup->uu_timemid);
-- 
1.9.1

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

* Re: [PATCH] xfs: Remove typedef xfs_uu_t
  2014-08-06 14:13 [PATCH] xfs: Remove typedef xfs_uu_t Himangi Saraogi
@ 2014-08-06 14:28 ` Christoph Hellwig
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2014-08-06 14:28 UTC (permalink / raw)
  To: Himangi Saraogi; +Cc: Julia Lawall, linux-kernel, xfs

On Wed, Aug 06, 2014 at 07:43:43PM +0530, Himangi Saraogi wrote:
> The Linux kernel coding style guidelines suggest not using typedefs
> for structure types. This patch gets rid of the typedef for xfs_uu_t.
> Also the names of the struct is changed to drop the _t, to make the
> name look less typedef-like.

The right fix is to just kill the type, and read the values directly
from the uuid_t type using get_unaligned_be16.

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

end of thread, other threads:[~2014-08-06 14:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-06 14:13 [PATCH] xfs: Remove typedef xfs_uu_t Himangi Saraogi
2014-08-06 14:28 ` Christoph Hellwig

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