staging: lustre: Replace typedef with struct
PATCH 1/1 staging: lustre: Replace typedef with struct
As per the Linux kernel coding style guidelines, using typedef for a structure type is not recommended. Hence, occurences of typedefs have been removed.
Coccinelle script:
@r1@
type T;
@@
typedef struct { ... } T;
@script:python c1@
T2;
T << r1.T;
@@
coccinelle.T2=T;
@@
type r1.T;
identifier c1.T2;
@@
-typedef
struct
+ T2
{ ... }
-T
;
--- drivers/staging/lustre/lustre/include/lustre_eacl.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/staging/lustre/lustre/include/lustre_eacl.h +6 -6
@@ -49,17 +49,17 @@#include <linux/fs.h> #include <linux/posix_acl_xattr.h> -typedef struct { +struct ext_acl_xattr_entry {__u16 e_tag;__u16 e_perm;__u32 e_id;__u32 e_stat; -}ext_acl_xattr_entry ; +}; -typedef struct { -__u32 a_count; -ext_acl_xattr_entry a_entries[0 ]; -}ext_acl_xattr_header ; +struct ext_acl_xattr_header { +__u32 a_count; +struct ext_acl_xattr_entry a_entries[0 ]; +};#define CFS_ACL_XATTR_SIZE (count, prefix) \ (sizeof(prefix ## _header) + (count) * sizeof(prefix ## _entry))
Signature · 1 line
2.7.4
Quoted 3 lines · Gargi Sharma
As per the Linux kernel coding style guidelines, using typedef for a structure type is not recommended. Hence, occurences of typedefs have been removed.
You have only changed the type definitions and not any uses. Were there no uses?
julia
Quoted 69 lines
Coccinelle script:
@r1@
type T;
@@typedef struct { ... } T;
@script:python c1@
T2;
T << r1.T;
@@
coccinelle.T2=T;@@
type r1.T;
identifier c1.T2;
@@
-typedef
struct
+ T2
{ ... }
-T
;Signed-off-by Gargi Sharma <[email protected]>--- drivers/staging/lustre/lustre/include/lustre_eacl.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)drivers/staging/lustre/lustre/include/lustre_eacl.h +6
-7@@ -49,17 +49,17 @@#include <linux/fs.h> #include <linux/posix_acl_xattr.h> -typedef struct { +struct ext_acl_xattr_entry {__u16 e_tag;__u16 e_perm;__u32 e_id;__u32 e_stat; -}ext_acl_xattr_entry ; +}; -typedef struct { -__u32 a_count; -ext_acl_xattr_entry a_entries[0 ]; -}ext_acl_xattr_header ; +struct ext_acl_xattr_header { +__u32 a_count; +struct ext_acl_xattr_entry a_entries[0 ]; +};#define CFS_ACL_XATTR_SIZE (count, prefix) \ (sizeof(prefix ## _header) + (count) * sizeof(prefix ## _entry)) --2.7.4
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1488259405-19730-1-git-send-email-gs051095%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Quoted 5 lines · Julia Lawall
On Tue, 28 Feb 2017, Gargi Sharma wrote:
Quoted 7 lines
Quoted 3 lines
As per the Linux kernel coding style guidelines, using typedef for a structure type is not recommended. Hence, occurences of typedefs have been removed.
You have only changed the type definitions and not any uses. Were there no uses?
I used grep for both the structures and did not find any uses. I also compiled the
kernel after making these changes and it compiled without any errors/warnings.
thanks,
gargi
Quoted 29 lines
julia
Quoted 26 lines
Coccinelle script:
@r1@
type T;
@@typedef struct { ... } T;
@script:python c1@
T2;
T << r1.T;
@@
coccinelle.T2=T;@@
type r1.T;
identifier c1.T2;
@@
-typedef
struct
+ T2
{ ... }
-T
;
Quoted 6 lines
Review
Quoted 6 lines
Signed-off-by Gargi Sharma <[email protected]>--- drivers/staging/lustre/lustre/include/lustre_eacl.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)(quoted diff) +0
-0
b/drivers/staging/lustre/lustre/include/lustre_eacl.h
Quoted 25 lines
Quoted 25 lines
index 1e71a86..c198eda 100644
drivers/staging/lustre/lustre/include/lustre_eacl.h +6
-6@@ -49,17 +49,17 @@#include <linux/fs.h> #include <linux/posix_acl_xattr.h> -typedef struct { +struct ext_acl_xattr_entry {__u16 e_tag;__u16 e_perm;__u32 e_id;__u32 e_stat; -}ext_acl_xattr_entry ; +}; -typedef struct { -__u32 a_count; -ext_acl_xattr_entry a_entries[0 ]; -}ext_acl_xattr_header ; +struct ext_acl_xattr_header { +__u32 a_count; +struct ext_acl_xattr_entry a_entries[0 ]; +};
Quoted 7 lines
Quoted 7 lines
drivers/staging/lustre/lustre/include/lustre_eacl.h +0
-1#define CFS_ACL_XATTR_SIZE (count, prefix) \ (sizeof(prefix ## _header) + (count) * sizeof(prefix ## _entry)) --2.7.4
--
You received this message because you are subscribed to the Google
Groups "outreachy-kernel" group.
Quoted 1 line
Quoted 1 line
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected].
Quoted 2 lines
Quoted 2 lines
To post to this group, send email to [email protected]. To view this discussion on the web visit
Quoted 5 lines
Quoted 2 lines
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"outreachy-kernel" group.
Quoted 1 line
To unsubscribe from this group and stop receiving emails from it, send an
email to [email protected].
Quoted 2 lines
To post to this group, send email to [email protected]. To view this discussion on the web visit
https://groups.google.com/d/msgid/outreachy-kernel/alpine.DEB.2.20.1702280744060.2078%40hadrien
.
Quoted 1 line
For more options, visit https://groups.google.com/d/optout.
Quoted 10 lines · Gargi Sharma
Quoted 9 lines · Julia Lawall
Quoted 3 lines · Gargi Sharma
As per the Linux kernel coding style guidelines, using typedef for a structure type is not recommended. Hence, occurences of typedefs have been removed.
Quoted 6 lines
Quoted 2 lines
You have only changed the type definitions and not any uses. Were there no uses?
I used grep for both the structures and did not find any uses. I also compiled the
kernel after making these changes and it compiled without any errors/warnings.
OK, it could be nice to mention this in the commit log, because it would improve the reader's understanding of why the change is correct.
julia
Quoted 101 lines
thanks,
gargiQuoted 29 lines
julia
Quoted 26 lines
Coccinelle script:
@r1@
type T;
@@typedef struct { ... } T;
@script:python c1@
T2;
T << r1.T;
@@
coccinelle.T2=T;@@
type r1.T;
identifier c1.T2;
@@
-typedef
struct
+ T2
{ ... }
-T
;Quoted 6 lines
Review
Quoted 6 lines
Signed-off-by Gargi Sharma <[email protected]>---
drivers/staging/lustre/lustre/include/lustre_eacl.h | 12 ++++++------1 file changed, 6 insertions(+), 6 deletions(-)(quoted diff) +0
-0
b/drivers/staging/lustre/lustre/include/lustre_eacl.hQuoted 25 lines
Quoted 25 lines
index 1e71a86..c198eda 100644
drivers/staging/lustre/lustre/include/lustre_eacl.h +6
-6@@ -49,17 +49,17 @@ #include <linux/fs.h> #include <linux/posix_acl_xattr.h> -typedef struct { +struct ext_acl_xattr_entry { __u16 e_tag; __u16 e_perm; __u32 e_id; __u32 e_stat; -}ext_acl_xattr_entry ; +}; -typedef struct { - __u32 a_count; - ext_acl_xattr_entry a_entries[0]; -}ext_acl_xattr_header ; +struct ext_acl_xattr_header { + __u32 a_count; + struct ext_acl_xattr_entry a_entries[0]; +};Quoted 7 lines
Quoted 7 lines
drivers/staging/lustre/lustre/include/lustre_eacl.h +0
-1#define CFS_ACL_XATTR_SIZE(count, prefix) \ (sizeof(prefix ## _header) + (count) * sizeof(prefix ## _entry)) --2.7.4
--
You received this message because you are subscribed to the GoogleGroups "outreachy-kernel" group.
Quoted 1 line
Quoted 1 line
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected].
Quoted 2 lines
Quoted 2 lines
To post to this group, send email to [email protected].
To view this discussion on the web visithttps://groups.google.com/d/msgid/outreachy-kernel/1488259405-19730-1-git-send-email-gs051095%40gmail.com.
Quoted 5 lines
Quoted 2 lines
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups"outreachy-kernel" group.
Quoted 1 line
To unsubscribe from this group and stop receiving emails from it, send an
email to [email protected].
Quoted 2 lines
To post to this group, send email to [email protected].
To view this discussion on the web visithttps://groups.google.com/d/msgid/outreachy-kernel/alpine.DEB.2.20.1702280744060.2078%40hadrien.
Quoted 1 line
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visithttps://groups.google.com/d/msgid/outreachy-kernel/CAOCi2DF%2BFk0NBasd6QD4m fkpEY1o4r0HAyewQVgdfMd%3DOAyW9w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.