Skip to contentSkip to conversation

staging: lustre: Replace typedef with struct

PATCH Superseded Gargi Sharma 4 participants 7 messages Feb 28, 2017 – Mar 3, 2017 Staging

lore
Share & tools
lore
#0 lore raw

PATCH v2 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. To find the occurences of the structures grep was used and no uses were found.

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
;

---
Changes in v2:
- Improved the commit message.

---
 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
index 1e71a86..c198eda 100644
@@ -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
#1 lore raw
Quoted 4 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. To find the occurences of the structures grep was used and no uses were found.

Actually, I'm not sure to understand. No uses of the structures were found at all? If so, they should just be dropped. Or are there uses, but they already have the word "struct" in front of them?

julia

Quoted 72 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
;

---
Changes in v2:
- Improved the commit message.

---
 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
index 1e71a86..c198eda 100644
@@ -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/1488265307-24641-1-git-send-email-gs051095%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#2 lore raw
Quoted 5 lines · Julia Lawall

On Tue, 28 Feb 2017, Gargi Sharma wrote:

Quoted 8 lines
Quoted 4 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. To find the occurences of the structures grep was used and no uses were found.

Actually, I'm not sure to understand. No uses of the structures were found at all? If so, they should just be dropped. Or are there uses, but they already have the word "struct" in front of them?

The first structure "ext_acl_xattr_entry" is used as one of the fields in the
other structure "ext_acl_xattr_header". I could not find any uses of the structure
"ext_acl_xattr_header" inside the staging directory. Should I drop these two structures then?

gargi

Quoted 37 lines

julia

Quoted 34 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
;

---
Changes in v2:
- Improved the commit message.

---
 drivers/staging/lustre/lustre/include/lustre_eacl.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
Quoted 1 line

Review

Quoted 1 line
(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 https://groups.google.com/d/

msgid/outreachy-kernel/1488265307-24641-1-git-send- email-gs051095%40gmail.com.

Quoted 2 lines
Quoted 2 lines

For more options, visit https://groups.google.com/d/optout.

maintainer
#3 lore raw
Quoted 15 lines · Gargi Sharma
Quoted 5 lines · Julia Lawall

On Tue, 28 Feb 2017, Gargi Sharma wrote:

Quoted 8 lines
Quoted 4 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. To find the occurences of the structures grep was used and no uses were found.

Actually, I'm not sure to understand.� No uses of the structures were found at all?� If so, they should just be dropped.� Or are there uses, but they already have the word "struct" in front of them?

Quoted 5 lines

The first structure "ext_acl_xattr_entry" is used as one of the fields in the� other structure "ext_acl_xattr_header". I could not find any uses of the structure
"ext_acl_xattr_header" inside the staging directory. Should I drop these two structures then?

I think so, we shouldn't keep around structures that are not actually used.

Unless the Lustre maintainers are hiding something somewhere else that uses these?

thanks,

greg k-h

#4 lore raw
Quoted 23 lines · Greg KH
Quoted 15 lines · Gargi Sharma
Quoted 5 lines · Julia Lawall

On Tue, 28 Feb 2017, Gargi Sharma wrote:

Quoted 8 lines
Quoted 4 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. To find the occurences of the structures grep was used and no uses were found.

Actually, I'm not sure to understand. No uses of the structures were found at all? If so, they should just be dropped. Or are there uses, but they already have the word "struct" in front of them?

Quoted 5 lines

The first structure "ext_acl_xattr_entry" is used as one of the fields in the other structure "ext_acl_xattr_header". I could not find any uses of the structure
"ext_acl_xattr_header" inside the staging directory. Should I drop these two structures then?

Quoted 5 lines

I think so, we shouldn't keep around structures that are not actually used.

Unless the Lustre maintainers are hiding something somewhere else that uses these?

Looks like this is left over from 341f1f0affed1c24712f37c95bb654b3b33ab2c6 "staging: lustre: remove remote client support". The ext_acl_xattr_{entry,header} structs were accessed from CFS_ACL_XATTR_SIZE() and CFS_ACL_XATTR_COUNT() macros, along with posix_acl_xattr_{entry,header} but it looks like all of that was deleted (and good riddance). The CFS_ACL_XATTR_* macros should be removed also.

That leaves the lustre_eacl.h header empty, so it could just be deleted entirely, and removed from llite/llite_internal.h (where posix_acl_xattr.h is already included) and llite/xattr.h (which includes llite_internal.h).

Cheers, Andreas

#5 lore raw
Quoted 5 lines · Andreas
Quoted 3 lines · Greg KH
Quoted 1 line · Gargi Sharma

On Tue, Feb 28, 2017 at 12:36 PM, Julia Lawall <[email protected]>

Quoted 5 lines · wrote:
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines · Gargi Sharma
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 4 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. To find the occurences of the structures grep was used and no uses were found.

Actually, I'm not sure to understand. No uses of the structures were found at all? If so, they should just be dropped. Or are there

uses, but

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

they already have the word "struct" in front of them?

The first structure "ext_acl_xattr_entry" is used as one of the fields

in the

Quoted 1 line
Quoted 1 line
Quoted 1 line

other structure "ext_acl_xattr_header". I could not find any uses of

the

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

structure
"ext_acl_xattr_header" inside the staging directory. Should I drop

these two

Quoted 10 lines
Quoted 7 lines
Quoted 1 line

structures then?

I think so, we shouldn't keep around structures that are not actually used.

Unless the Lustre maintainers are hiding something somewhere else that uses these?

Looks like this is left over from 341f1f0affed1c24712f37c95bb654b3b33ab2c6 "staging: lustre: remove remote client support". The

ext_acl_xattr_{entry,header}

Quoted 1 line

structs were accessed from CFS_ACL_XATTR_SIZE() and CFS_ACL_XATTR_COUNT()

macros,

Quoted 1 line

along with posix_acl_xattr_{entry,header} but it looks like all of that

was deleted

Quoted 2 lines

(and good riddance). The CFS_ACL_XATTR_* macros should be removed also.

Hi,

Quoted 2 lines

That leaves the lustre_eacl.h header empty, so it could just be deleted

entirely,

Quoted 1 line

and removed from llite/llite_internal.h (where posix_acl_xattr.h is

already included)

Quoted 1 line

and llite/xattr.h (which includes llite_internal.h).

Okay, that makes sense. So should I send a v3 where I delete the header file and places it
has been referred, or an entirely new patch?

thanks,
gargi

#6 lore raw
Quoted 42 lines · Gargi Sharma
Quoted 28 lines · Andreas
Quoted 26 lines · Greg KH
Quoted 15 lines · Gargi Sharma
Quoted 5 lines · Julia Lawall

On Tue, 28 Feb 2017, Gargi Sharma wrote:

Quoted 8 lines
Quoted 4 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. To find the occurences of the structures grep was used and no uses were found.

Actually, I'm not sure to understand. No uses of the structures were found at all? If so, they should just be dropped. Or are there uses, but they already have the word "struct" in front of them?

Quoted 5 lines

The first structure "ext_acl_xattr_entry" is used as one of the fields in the other structure "ext_acl_xattr_header". I could not find any uses of the structure
"ext_acl_xattr_header" inside the staging directory. Should I drop these two structures then?

I think so, we shouldn't keep around structures that are not actually used.

Quoted 9 lines
Quoted 2 lines

Unless the Lustre maintainers are hiding something somewhere else that uses these?

Looks like this is left over from 341f1f0affed1c24712f37c95bb654b3b33ab2c6 "staging: lustre: remove remote client support". The ext_acl_xattr_{entry,header} structs were accessed from CFS_ACL_XATTR_SIZE() and CFS_ACL_XATTR_COUNT() macros, along with posix_acl_xattr_{entry,header} but it looks like all of that was deleted (and good riddance). The CFS_ACL_XATTR_* macros should be removed also.

Hi,

Quoted 1 line
Quoted 6 lines
Quoted 3 lines

That leaves the lustre_eacl.h header empty, so it could just be deleted entirely, and removed from llite/llite_internal.h (where posix_acl_xattr.h is already included) and llite/xattr.h (which includes llite_internal.h).

Okay, that makes sense. So should I send a v3 where I delete the header file and places it has been referred, or an entirely new patch?

If the whole header is being deleted, there isn't any point to have the earlier patch. It makes the most sense to just have a single patch that deletes the unused header.

Cheers, Andreas
--
Andreas Dilger