Re: [PATCH 1/3] vfs: fixed some CamelCase coding style issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 07/30/2013 10:50 PM, Dong Fang wrote:
---
  fs/binfmt_misc.c |   39 ++++++++++++++++++++-------------------
  1 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index 1c740e1..e02b857 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -45,7 +45,7 @@ enum {Enabled, Magic};
  #define MISC_FMT_OPEN_BINARY (1<<30)
  #define MISC_FMT_CREDENTIALS (1<<29)

-typedef struct {
+struct bm_node {
  	struct list_head list;
  	unsigned long flags;		/* type, status, etc. */
  	int offset;			/* offset of magic */
@@ -55,7 +55,7 @@ typedef struct {
  	char *interpreter;		/* filename of interpreter */
  	char *name;
  	struct dentry *dentry;
-} Node;
+};

  static DEFINE_RWLOCK(entries_lock);
  static struct file_system_type bm_fs_type;
@@ -67,13 +67,13 @@ static int entry_count;
   * if we do, return the node, else NULL
   * locking is done in load_misc_binary
   */
-static Node *check_file(struct linux_binprm *bprm)
+static struct bm_node *check_file(struct linux_binprm *bprm)
  {
+	struct bm_node *e;
  	char *p = strrchr(bprm->interp, '.');
-	struct list_head *l;

-	list_for_each(l, &entries) {
-		Node *e = list_entry(l, Node, list);
+
+	list_for_each_entry(e, &entries, list) {
  		char *s;
  		int j;

@@ -107,7 +107,7 @@ static Node *check_file(struct linux_binprm *bprm)
   */
  static int load_misc_binary(struct linux_binprm *bprm)
  {
-	Node *fmt;
+	struct bm_node *fmt;
  	struct file * interp_file = NULL;
  	char iname[BINPRM_BUF_SIZE];
  	const char *iname_addr = iname;
@@ -235,7 +235,7 @@ static char *scanarg(char *s, char del)
  	return s;
  }

-static char * check_special_flags (char * sfs, Node * e)
+static char *check_special_flags(char *sfs, struct bm_node *e)
  {
  	char * p = sfs;
  	int cont = 1;
@@ -270,9 +270,9 @@ static char * check_special_flags (char * sfs, Node * e)
   * ':name:type:offset:magic:mask:interpreter:flags'
   * where the ':' is the IFS, that can be chosen with the first char
   */
-static Node *create_entry(const char __user *buffer, size_t count)
+static struct bm_node *create_entry(const char __user *buffer, size_t count)
  {
-	Node *e;
+	struct bm_node *e;
  	int memsize, err;
  	char *buf, *p;
  	char del;
@@ -283,14 +283,14 @@ static Node *create_entry(const char __user *buffer, size_t count)
  		goto out;

  	err = -ENOMEM;
-	memsize = sizeof(Node) + count + 8;
+	memsize = sizeof(struct bm_node) + count + 8;
  	e = kmalloc(memsize, GFP_USER);
  	if (!e)
  		goto out;

-	p = buf = (char *)e + sizeof(Node);
+	p = buf = (char *)e + sizeof(*e);

-	memset(e, 0, sizeof(Node));
+	memset(e, 0, sizeof(*e));
  	if (copy_from_user(buf, buffer, count))
  		goto Efault;

@@ -415,7 +415,7 @@ static int parse_command(const char __user *buffer, size_t count)

  /* generic stuff */

-static void entry_status(Node *e, char *page)
+static void entry_status(struct bm_node *e, char *page)
  {
  	char *dp;
  	char *status = "disabled";
@@ -490,7 +490,7 @@ static void bm_evict_inode(struct inode *inode)
  	kfree(inode->i_private);
  }

-static void kill_node(Node *e)
+static void kill_node(struct bm_node *e)
  {
  	struct dentry *dentry;

@@ -515,7 +515,7 @@ static void kill_node(Node *e)
  static ssize_t
  bm_entry_read(struct file * file, char __user * buf, size_t nbytes, loff_t *ppos)
  {
-	Node *e = file_inode(file)->i_private;
+	struct bm_node *e = file_inode(file)->i_private;
  	ssize_t res;
  	char *page;

@@ -534,7 +534,7 @@ static ssize_t bm_entry_write(struct file *file, const char __user *buffer,
  				size_t count, loff_t *ppos)
  {
  	struct dentry *root;
-	Node *e = file_inode(file)->i_private;
+	struct bm_node *e = file_inode(file)->i_private;
  	int res = parse_command(buffer, count);

  	switch (res) {
@@ -566,7 +566,7 @@ static const struct file_operations bm_entry_operations = {
  static ssize_t bm_register_write(struct file *file, const char __user *buffer,
  			       size_t count, loff_t *ppos)
  {
-	Node *e;
+	struct bm_node *e;
  	struct inode *inode;
  	struct dentry *root, *dentry;
  	struct super_block *sb = file->f_path.dentry->d_sb;
@@ -652,7 +652,8 @@ static ssize_t bm_status_write(struct file * file, const char __user * buffer,
  			mutex_lock(&root->d_inode->i_mutex);

  			while (!list_empty(&entries))
-				kill_node(list_entry(entries.next, Node, list));
+				kill_node(list_entry(entries.next,
+						     struct bm_node, list));

  			mutex_unlock(&root->d_inode->i_mutex);
  			dput(root);

can anyone give me some suggestion? dan?

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux