xfs: Remove typedef xfs_uu_t
PATCH 1/1 xfs: Remove typedef xfs_uu_t
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
)
--- fs/xfs/uuid.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/xfs/uuid.c +3 -3
@@ -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);
Signature · 1 line
1.9.1
Quoted 4 lines · Himangi Saraogi
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.