* [PATCH 1/8] fs/configfs: checkpatch cleanup
2013-01-03 10:10 [PATCH 0/8] configfs checkpatch cleanup Andrzej Pietrasiewicz
@ 2013-01-03 10:10 ` Andrzej Pietrasiewicz
2013-01-03 10:31 ` devendra.aaru
2013-01-03 10:10 ` [PATCH 2/8] " Andrzej Pietrasiewicz
` (6 subsequent siblings)
7 siblings, 1 reply; 10+ messages in thread
From: Andrzej Pietrasiewicz @ 2013-01-03 10:10 UTC (permalink / raw)
To: linux-kernel
Cc: Andrzej Pietrasiewicz, Kyungmin Park, Joel Becker, Marek Szyprowski
---
include/linux/configfs.h | 37 +++++++++++++++++++++++--------------
1 files changed, 23 insertions(+), 14 deletions(-)
diff --git a/include/linux/configfs.h b/include/linux/configfs.h
index 34025df..5d33a25 100644
--- a/include/linux/configfs.h
+++ b/include/linux/configfs.h
@@ -19,7 +19,7 @@
* Boston, MA 021110-1307, USA.
*
* Based on sysfs:
- * sysfs is Copyright (C) 2001, 2002, 2003 Patrick Mochel
+ * sysfs is Copyright (C) 2001, 2002, 2003 Patrick Mochel
*
* Based on kobject.h:
* Copyright (c) 2002-2003 Patrick Mochel
@@ -66,7 +66,7 @@ struct config_item {
extern int config_item_set_name(struct config_item *, const char *, ...);
-static inline char *config_item_name(struct config_item * item)
+static inline char *config_item_name(struct config_item *item)
{
return item->ci_name;
}
@@ -76,7 +76,7 @@ extern void config_item_init_type_name(struct config_item *item,
const char *name,
struct config_item_type *type);
-extern struct config_item * config_item_get(struct config_item *);
+extern struct config_item *config_item_get(struct config_item *);
extern void config_item_put(struct config_item *);
struct config_item_type {
@@ -93,7 +93,7 @@ struct config_item_type {
struct config_group {
struct config_item cg_item;
struct list_head cg_children;
- struct configfs_subsystem *cg_subsys;
+ struct configfs_subsystem *cg_subsys;
struct config_group **default_groups;
};
@@ -104,7 +104,7 @@ extern void config_group_init_type_name(struct config_group *group,
static inline struct config_group *to_config_group(struct config_item *item)
{
- return item ? container_of(item,struct config_group,cg_item) : NULL;
+ return item ? container_of(item, struct config_group, cg_item) : NULL;
}
static inline struct config_group *config_group_get(struct config_group *group)
@@ -123,7 +123,7 @@ extern struct config_item *config_group_find_item(struct config_group *,
struct configfs_attribute {
const char *ca_name;
- struct module *ca_owner;
+ struct module *ca_owner;
umode_t ca_mode;
};
@@ -223,17 +223,23 @@ static ssize_t _item##_attr_store(struct config_item *item, \
*/
struct configfs_item_operations {
void (*release)(struct config_item *);
- ssize_t (*show_attribute)(struct config_item *, struct configfs_attribute *,char *);
- ssize_t (*store_attribute)(struct config_item *,struct configfs_attribute *,const char *, size_t);
+ ssize_t (*show_attribute)(struct config_item *,
+ struct configfs_attribute *, char *);
+ ssize_t (*store_attribute)(struct config_item *,
+ struct configfs_attribute *,
+ const char *, size_t);
int (*allow_link)(struct config_item *src, struct config_item *target);
int (*drop_link)(struct config_item *src, struct config_item *target);
};
struct configfs_group_operations {
- struct config_item *(*make_item)(struct config_group *group, const char *name);
- struct config_group *(*make_group)(struct config_group *group, const char *name);
+ struct config_item *(*make_item)(struct config_group *group,
+ const char *name);
+ struct config_group *(*make_group)(struct config_group *group,
+ const char *name);
int (*commit_item)(struct config_item *item);
- void (*disconnect_notify)(struct config_group *group, struct config_item *item);
+ void (*disconnect_notify)(struct config_group *group,
+ struct config_item *item);
void (*drop_item)(struct config_group *group, struct config_item *item);
};
@@ -242,7 +248,8 @@ struct configfs_subsystem {
struct mutex su_mutex;
};
-static inline struct configfs_subsystem *to_configfs_subsystem(struct config_group *group)
+static inline struct configfs_subsystem
+*to_configfs_subsystem(struct config_group *group)
{
return group ?
container_of(group, struct configfs_subsystem, su_group) :
@@ -254,7 +261,9 @@ void configfs_unregister_subsystem(struct configfs_subsystem *subsys);
/* These functions can sleep and can alloc with GFP_KERNEL */
/* WARNING: These cannot be called underneath configfs callbacks!! */
-int configfs_depend_item(struct configfs_subsystem *subsys, struct config_item *target);
-void configfs_undepend_item(struct configfs_subsystem *subsys, struct config_item *target);
+int configfs_depend_item(struct configfs_subsystem *subsys,
+ struct config_item *target);
+void configfs_undepend_item(struct configfs_subsystem *subsys,
+ struct config_item *target);
#endif /* _CONFIGFS_H_ */
--
1.7.0.4
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH 1/8] fs/configfs: checkpatch cleanup
2013-01-03 10:10 ` [PATCH 1/8] fs/configfs: " Andrzej Pietrasiewicz
@ 2013-01-03 10:31 ` devendra.aaru
0 siblings, 0 replies; 10+ messages in thread
From: devendra.aaru @ 2013-01-03 10:31 UTC (permalink / raw)
To: Andrzej Pietrasiewicz
Cc: linux-kernel, Kyungmin Park, Joel Becker, Marek Szyprowski
On Thu, Jan 3, 2013 at 5:10 AM, Andrzej Pietrasiewicz
<andrzej.p@samsung.com> wrote:
> ---
> include/linux/configfs.h | 37 +++++++++++++++++++++++--------------
> 1 files changed, 23 insertions(+), 14 deletions(-)
Please use nice subject line other than the same line for all patches,
and a change log too.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 2/8] fs/configfs: checkpatch cleanup
2013-01-03 10:10 [PATCH 0/8] configfs checkpatch cleanup Andrzej Pietrasiewicz
2013-01-03 10:10 ` [PATCH 1/8] fs/configfs: " Andrzej Pietrasiewicz
@ 2013-01-03 10:10 ` Andrzej Pietrasiewicz
2013-01-03 10:10 ` [PATCH 3/8] " Andrzej Pietrasiewicz
` (5 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Andrzej Pietrasiewicz @ 2013-01-03 10:10 UTC (permalink / raw)
To: linux-kernel
Cc: Andrzej Pietrasiewicz, Kyungmin Park, Joel Becker, Marek Szyprowski
---
fs/configfs/configfs_internal.h | 54 +++++++++++++++++++++-----------------
1 files changed, 30 insertions(+), 24 deletions(-)
diff --git a/fs/configfs/configfs_internal.h b/fs/configfs/configfs_internal.h
index b5f0a3b..4ef5d4d 100644
--- a/fs/configfs/configfs_internal.h
+++ b/fs/configfs/configfs_internal.h
@@ -19,7 +19,7 @@
* Boston, MA 021110-1307, USA.
*
* Based on sysfs:
- * sysfs is Copyright (C) 2001, 2002, 2003 Patrick Mochel
+ * sysfs is Copyright (C) 2001, 2002, 2003 Patrick Mochel
*
* configfs Copyright (C) 2005 Oracle. All rights reserved.
*/
@@ -34,11 +34,11 @@ struct configfs_dirent {
struct list_head s_sibling;
struct list_head s_children;
struct list_head s_links;
- void * s_element;
+ void *s_element;
int s_type;
umode_t s_mode;
- struct dentry * s_dentry;
- struct iattr * s_iattr;
+ struct dentry *s_dentry;
+ struct iattr *s_iattr;
#ifdef CONFIG_LOCKDEP
int s_depth;
#endif
@@ -62,21 +62,26 @@ extern struct kmem_cache *configfs_dir_cachep;
extern int configfs_is_root(struct config_item *item);
-extern struct inode * configfs_new_inode(umode_t mode, struct configfs_dirent *, struct super_block *);
-extern int configfs_create(struct dentry *, umode_t mode, int (*init)(struct inode *));
+extern struct inode *configfs_new_inode(umode_t mode, struct configfs_dirent *,
+ struct super_block *);
+extern int configfs_create(struct dentry *, umode_t mode,
+ int (*init)(struct inode *));
extern int configfs_inode_init(void);
extern void configfs_inode_exit(void);
-extern int configfs_create_file(struct config_item *, const struct configfs_attribute *);
+extern int configfs_create_file(struct config_item *,
+ const struct configfs_attribute *);
extern int configfs_make_dirent(struct configfs_dirent *,
struct dentry *, void *, umode_t, int);
extern int configfs_dirent_is_ready(struct configfs_dirent *);
-extern int configfs_add_file(struct dentry *, const struct configfs_attribute *, int);
-extern void configfs_hash_and_remove(struct dentry * dir, const char * name);
+extern int configfs_add_file(struct dentry *,
+ const struct configfs_attribute *, int);
+extern void configfs_hash_and_remove(struct dentry *dir, const char *name);
-extern const unsigned char * configfs_get_name(struct configfs_dirent *sd);
-extern void configfs_drop_dentry(struct configfs_dirent *sd, struct dentry *parent);
+extern const unsigned char *configfs_get_name(struct configfs_dirent *sd);
+extern void configfs_drop_dentry(struct configfs_dirent *sd,
+ struct dentry *parent);
extern int configfs_setattr(struct dentry *dentry, struct iattr *iattr);
extern struct dentry *configfs_pin_fs(void);
@@ -104,27 +109,28 @@ extern int configfs_create_link(struct configfs_symlink *sl,
struct dentry *parent,
struct dentry *dentry);
-static inline struct config_item * to_item(struct dentry * dentry)
+static inline struct config_item *to_item(struct dentry *dentry)
{
- struct configfs_dirent * sd = dentry->d_fsdata;
- return ((struct config_item *) sd->s_element);
+ struct configfs_dirent *sd = dentry->d_fsdata;
+ return (struct config_item *) sd->s_element;
}
-static inline struct configfs_attribute * to_attr(struct dentry * dentry)
+static inline struct configfs_attribute *to_attr(struct dentry *dentry)
{
- struct configfs_dirent * sd = dentry->d_fsdata;
- return ((struct configfs_attribute *) sd->s_element);
+ struct configfs_dirent *sd = dentry->d_fsdata;
+ return (struct configfs_attribute *) sd->s_element;
}
-static inline struct config_item *configfs_get_config_item(struct dentry *dentry)
+static inline struct config_item
+*configfs_get_config_item(struct dentry *dentry)
{
- struct config_item * item = NULL;
+ struct config_item *item = NULL;
spin_lock(&dentry->d_lock);
if (!d_unhashed(dentry)) {
- struct configfs_dirent * sd = dentry->d_fsdata;
+ struct configfs_dirent *sd = dentry->d_fsdata;
if (sd->s_type & CONFIGFS_ITEM_LINK) {
- struct configfs_symlink * sl = sd->s_element;
+ struct configfs_symlink *sl = sd->s_element;
item = config_item_get(sl->sl_target);
} else
item = config_item_get(sd->s_element);
@@ -134,7 +140,7 @@ static inline struct config_item *configfs_get_config_item(struct dentry *dentry
return item;
}
-static inline void release_configfs_dirent(struct configfs_dirent * sd)
+static inline void release_configfs_dirent(struct configfs_dirent *sd)
{
if (!(sd->s_type & CONFIGFS_ROOT)) {
kfree(sd->s_iattr);
@@ -142,7 +148,7 @@ static inline void release_configfs_dirent(struct configfs_dirent * sd)
}
}
-static inline struct configfs_dirent * configfs_get(struct configfs_dirent * sd)
+static inline struct configfs_dirent *configfs_get(struct configfs_dirent *sd)
{
if (sd) {
WARN_ON(!atomic_read(&sd->s_count));
@@ -151,7 +157,7 @@ static inline struct configfs_dirent * configfs_get(struct configfs_dirent * sd)
return sd;
}
-static inline void configfs_put(struct configfs_dirent * sd)
+static inline void configfs_put(struct configfs_dirent *sd)
{
WARN_ON(!atomic_read(&sd->s_count));
if (atomic_dec_and_test(&sd->s_count))
--
1.7.0.4
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH 3/8] fs/configfs: checkpatch cleanup
2013-01-03 10:10 [PATCH 0/8] configfs checkpatch cleanup Andrzej Pietrasiewicz
2013-01-03 10:10 ` [PATCH 1/8] fs/configfs: " Andrzej Pietrasiewicz
2013-01-03 10:10 ` [PATCH 2/8] " Andrzej Pietrasiewicz
@ 2013-01-03 10:10 ` Andrzej Pietrasiewicz
2013-01-03 10:10 ` [PATCH 4/8] " Andrzej Pietrasiewicz
` (4 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Andrzej Pietrasiewicz @ 2013-01-03 10:10 UTC (permalink / raw)
To: linux-kernel
Cc: Andrzej Pietrasiewicz, Kyungmin Park, Joel Becker, Marek Szyprowski
Conflicts:
fs/configfs/dir.c
---
fs/configfs/dir.c | 282 +++++++++++++++++++++++++++-------------------------
1 files changed, 146 insertions(+), 136 deletions(-)
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
index 712b10f..afa37d2 100644
--- a/fs/configfs/dir.c
+++ b/fs/configfs/dir.c
@@ -19,7 +19,7 @@
* Boston, MA 021110-1307, USA.
*
* Based on sysfs:
- * sysfs is Copyright (C) 2001, 2002, 2003 Patrick Mochel
+ * sysfs is Copyright (C) 2001, 2002, 2003 Patrick Mochel
*
* configfs Copyright (C) 2005 Oracle. All rights reserved.
*/
@@ -50,8 +50,8 @@ DECLARE_RWSEM(configfs_rename_sem);
*/
DEFINE_SPINLOCK(configfs_dirent_lock);
-static void configfs_d_iput(struct dentry * dentry,
- struct inode * inode)
+static void configfs_d_iput(struct dentry *dentry,
+ struct inode *inode)
{
struct configfs_dirent *sd = dentry->d_fsdata;
@@ -170,10 +170,10 @@ configfs_adjust_dir_dirent_depth_after_populate(struct configfs_dirent *sd)
/*
* Allocates a new configfs_dirent and links it to the parent configfs_dirent
*/
-static struct configfs_dirent *configfs_new_dirent(struct configfs_dirent *parent_sd,
- void *element, int type)
+static struct configfs_dirent
+*configfs_new_dirent(struct configfs_dirent *parent_sd, void *element, int type)
{
- struct configfs_dirent * sd;
+ struct configfs_dirent *sd;
sd = kmem_cache_zalloc(configfs_dir_cachep, GFP_KERNEL);
if (!sd)
@@ -207,7 +207,7 @@ static struct configfs_dirent *configfs_new_dirent(struct configfs_dirent *paren
static int configfs_dirent_exists(struct configfs_dirent *parent_sd,
const unsigned char *new)
{
- struct configfs_dirent * sd;
+ struct configfs_dirent *sd;
list_for_each_entry(sd, &parent_sd->s_children, s_sibling) {
if (sd->s_element) {
@@ -223,11 +223,11 @@ static int configfs_dirent_exists(struct configfs_dirent *parent_sd,
}
-int configfs_make_dirent(struct configfs_dirent * parent_sd,
- struct dentry * dentry, void * element,
+int configfs_make_dirent(struct configfs_dirent *parent_sd,
+ struct dentry *dentry, void *element,
umode_t mode, int type)
{
- struct configfs_dirent * sd;
+ struct configfs_dirent *sd;
sd = configfs_new_dirent(parent_sd, element, type);
if (IS_ERR(sd))
@@ -241,7 +241,7 @@ int configfs_make_dirent(struct configfs_dirent * parent_sd,
return 0;
}
-static int init_dir(struct inode * inode)
+static int init_dir(struct inode *inode)
{
inode->i_op = &configfs_dir_inode_operations;
inode->i_fop = &configfs_dir_operations;
@@ -251,14 +251,14 @@ static int init_dir(struct inode * inode)
return 0;
}
-static int configfs_init_file(struct inode * inode)
+static int configfs_init_file(struct inode *inode)
{
inode->i_size = PAGE_SIZE;
inode->i_fop = &configfs_file_operations;
return 0;
}
-static int init_symlink(struct inode * inode)
+static int init_symlink(struct inode *inode)
{
inode->i_op = &configfs_symlink_inode_operations;
return 0;
@@ -267,7 +267,7 @@ static int init_symlink(struct inode * inode)
static int create_dir(struct config_item *k, struct dentry *d)
{
int error;
- umode_t mode = S_IFDIR| S_IRWXU | S_IRUGO | S_IXUGO;
+ umode_t mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO;
struct dentry *p = d->d_parent;
BUG_ON(!k);
@@ -275,7 +275,8 @@ static int create_dir(struct config_item *k, struct dentry *d)
error = configfs_dirent_exists(p->d_fsdata, d->d_name.name);
if (!error)
error = configfs_make_dirent(p->d_fsdata, d, k, mode,
- CONFIGFS_DIR | CONFIGFS_USET_CREATING);
+ CONFIGFS_DIR |
+ CONFIGFS_USET_CREATING);
if (!error) {
configfs_set_dir_dirent_depth(p->d_fsdata, d->d_fsdata);
error = configfs_create(d, mode, init_dir);
@@ -304,7 +305,7 @@ static int create_dir(struct config_item *k, struct dentry *d)
* until it is validated by configfs_dir_set_ready()
*/
-static int configfs_create_dir(struct config_item * item, struct dentry *dentry)
+static int configfs_create_dir(struct config_item *item, struct dentry *dentry)
{
int error = create_dir(item, dentry);
if (!error)
@@ -374,10 +375,10 @@ int configfs_create_link(struct configfs_symlink *sl,
return err;
}
-static void remove_dir(struct dentry * d)
+static void remove_dir(struct dentry *d)
{
- struct dentry * parent = dget(d->d_parent);
- struct configfs_dirent * sd;
+ struct dentry *parent = dget(d->d_parent);
+ struct configfs_dirent *sd;
sd = d->d_fsdata;
spin_lock(&configfs_dirent_lock);
@@ -385,9 +386,9 @@ static void remove_dir(struct dentry * d)
spin_unlock(&configfs_dirent_lock);
configfs_put(sd);
if (d->d_inode)
- simple_rmdir(parent->d_inode,d);
+ simple_rmdir(parent->d_inode, d);
- pr_debug(" o %s removing done (%d)\n",d->d_name.name, d->d_count);
+ pr_debug(" o %s removing done (%d)\n", d->d_name.name, d->d_count);
dput(parent);
}
@@ -403,9 +404,9 @@ static void remove_dir(struct dentry * d)
* Caller holds the mutex of the item's inode
*/
-static void configfs_remove_dir(struct config_item * item)
+static void configfs_remove_dir(struct config_item *item)
{
- struct dentry * dentry = dget(item->ci_dentry);
+ struct dentry *dentry = dget(item->ci_dentry);
if (!dentry)
return;
@@ -421,9 +422,10 @@ static void configfs_remove_dir(struct config_item * item)
/* attaches attribute's configfs_dirent to the dentry corresponding to the
* attribute file
*/
-static int configfs_attach_attr(struct configfs_dirent * sd, struct dentry * dentry)
+static int configfs_attach_attr(struct configfs_dirent *sd,
+ struct dentry *dentry)
{
- struct configfs_attribute * attr = sd->s_element;
+ struct configfs_attribute *attr = sd->s_element;
int error;
dentry->d_fsdata = configfs_get(sd);
@@ -440,12 +442,12 @@ static int configfs_attach_attr(struct configfs_dirent * sd, struct dentry * den
return 0;
}
-static struct dentry * configfs_lookup(struct inode *dir,
- struct dentry *dentry,
- unsigned int flags)
+static struct dentry *configfs_lookup(struct inode *dir,
+ struct dentry *dentry,
+ unsigned int flags)
{
- struct configfs_dirent * parent_sd = dentry->d_parent->d_fsdata;
- struct configfs_dirent * sd;
+ struct configfs_dirent *parent_sd = dentry->d_parent->d_fsdata;
+ struct configfs_dirent *sd;
int found = 0;
int err;
@@ -463,7 +465,7 @@ static struct dentry * configfs_lookup(struct inode *dir,
list_for_each_entry(sd, &parent_sd->s_children, s_sibling) {
if (sd->s_type & CONFIGFS_NOT_PINNED) {
- const unsigned char * name = configfs_get_name(sd);
+ const unsigned char *name = configfs_get_name(sd);
if (strcmp(name, dentry->d_name.name))
continue;
@@ -497,7 +499,8 @@ out:
* If there is an error, the caller will reset the flags via
* configfs_detach_rollback().
*/
-static int configfs_detach_prep(struct dentry *dentry, struct mutex **wait_mutex)
+static int configfs_detach_prep(struct dentry *dentry,
+ struct mutex **wait_mutex)
{
struct configfs_dirent *parent_sd = dentry->d_fsdata;
struct configfs_dirent *sd;
@@ -519,7 +522,8 @@ static int configfs_detach_prep(struct dentry *dentry, struct mutex **wait_mutex
/* Abort if racing with mkdir() */
if (sd->s_type & CONFIGFS_USET_IN_MKDIR) {
if (wait_mutex)
- *wait_mutex = &sd->s_dentry->d_inode->i_mutex;
+ *wait_mutex =
+ &sd->s_dentry->d_inode->i_mutex;
return -EAGAIN;
}
@@ -556,11 +560,11 @@ static void configfs_detach_rollback(struct dentry *dentry)
configfs_detach_rollback(sd->s_dentry);
}
-static void detach_attrs(struct config_item * item)
+static void detach_attrs(struct config_item *item)
{
- struct dentry * dentry = dget(item->ci_dentry);
- struct configfs_dirent * parent_sd;
- struct configfs_dirent * sd, * tmp;
+ struct dentry *dentry = dget(item->ci_dentry);
+ struct configfs_dirent *parent_sd;
+ struct configfs_dirent *sd, *tmp;
if (!dentry)
return;
@@ -596,7 +600,8 @@ static int populate_attrs(struct config_item *item)
return -EINVAL;
if (t->ct_attrs) {
for (i = 0; (attr = t->ct_attrs[i]) != NULL; i++) {
- if ((error = configfs_create_file(item, attr)))
+ error = configfs_create_file(item, attr);
+ if (error)
break;
}
}
@@ -614,7 +619,7 @@ static void configfs_detach_group(struct config_item *item);
static void detach_groups(struct config_group *group)
{
- struct dentry * dentry = dget(group->cg_item.ci_dentry);
+ struct dentry *dentry = dget(group->cg_item.ci_dentry);
struct dentry *child;
struct configfs_dirent *parent_sd;
struct configfs_dirent *sd, *tmp;
@@ -774,7 +779,8 @@ static void unlink_group(struct config_group *group)
unlink_obj(&group->cg_item);
}
-static void link_group(struct config_group *parent_group, struct config_group *group)
+static void link_group(struct config_group *parent_group,
+ struct config_group *group)
{
int i;
struct config_group *new_group;
@@ -910,8 +916,8 @@ static void client_disconnect_notify(struct config_item *parent_item,
BUG_ON(!type);
if (type->ct_group_ops && type->ct_group_ops->disconnect_notify)
- type->ct_group_ops->disconnect_notify(to_config_group(parent_item),
- item);
+ type->ct_group_ops->
+ disconnect_notify(to_config_group(parent_item), item);
}
/*
@@ -942,9 +948,13 @@ static void client_drop_item(struct config_item *parent_item,
#ifdef DEBUG
static void configfs_dump_one(struct configfs_dirent *sd, int level)
{
- printk(KERN_INFO "%*s\"%s\":\n", level, " ", configfs_get_name(sd));
+ pr_info("%*s\"%s\":\n", level, " ", configfs_get_name(sd));
-#define type_print(_type) if (sd->s_type & _type) printk(KERN_INFO "%*s %s\n", level, " ", #_type);
+#define type_print(_type) \
+ do { \
+ if (sd->s_type & _type) \
+ pr_info("%*s %s\n", level, " ", #_type); \
+ } while (0)
type_print(CONFIGFS_ROOT);
type_print(CONFIGFS_DIR);
type_print(CONFIGFS_ITEM_ATTR);
@@ -1161,7 +1171,7 @@ void configfs_undepend_item(struct configfs_subsystem *subsys,
}
EXPORT_SYMBOL(configfs_undepend_item);
-static int configfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
+static int configfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mod)
{
int ret = 0;
int module_got = 0;
@@ -1228,7 +1238,8 @@ static int configfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode
mutex_lock(&subsys->su_mutex);
if (type->ct_group_ops->make_group) {
- group = type->ct_group_ops->make_group(to_config_group(parent_item), name);
+ group = type->ct_group_ops->
+ make_group(to_config_group(parent_item), name);
if (!group)
group = ERR_PTR(-ENOMEM);
if (!IS_ERR(group)) {
@@ -1237,7 +1248,8 @@ static int configfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode
} else
ret = PTR_ERR(group);
} else {
- item = type->ct_group_ops->make_item(to_config_group(parent_item), name);
+ item = type->ct_group_ops->
+ make_item(to_config_group(parent_item), name);
if (!item)
item = ERR_PTR(-ENOMEM);
if (!IS_ERR(item))
@@ -1448,10 +1460,10 @@ const struct inode_operations configfs_root_inode_operations = {
};
#if 0
-int configfs_rename_dir(struct config_item * item, const char *new_name)
+int configfs_rename_dir(struct config_item *item, const char *new_name)
{
int error = 0;
- struct dentry * new_dentry, * parent;
+ struct dentry *new_dentry, *parent;
if (!strcmp(config_item_name(item), new_name))
return -EINVAL;
@@ -1471,8 +1483,7 @@ int configfs_rename_dir(struct config_item * item, const char *new_name)
if (!error) {
d_add(new_dentry, NULL);
d_move(item->dentry, new_dentry);
- }
- else
+ } else
d_delete(new_dentry);
} else
error = -EEXIST;
@@ -1487,8 +1498,8 @@ int configfs_rename_dir(struct config_item * item, const char *new_name)
static int configfs_dir_open(struct inode *inode, struct file *file)
{
- struct dentry * dentry = file->f_path.dentry;
- struct configfs_dirent * parent_sd = dentry->d_fsdata;
+ struct dentry *dentry = file->f_path.dentry;
+ struct configfs_dirent *parent_sd = dentry->d_fsdata;
int err;
mutex_lock(&dentry->d_inode->i_mutex);
@@ -1511,8 +1522,8 @@ static int configfs_dir_open(struct inode *inode, struct file *file)
static int configfs_dir_close(struct inode *inode, struct file *file)
{
- struct dentry * dentry = file->f_path.dentry;
- struct configfs_dirent * cursor = file->private_data;
+ struct dentry *dentry = file->f_path.dentry;
+ struct configfs_dirent *cursor = file->private_data;
mutex_lock(&dentry->d_inode->i_mutex);
spin_lock(&configfs_dirent_lock);
@@ -1531,102 +1542,102 @@ static inline unsigned char dt_type(struct configfs_dirent *sd)
return (sd->s_mode >> 12) & 15;
}
-static int configfs_readdir(struct file * filp, void * dirent, filldir_t filldir)
+static int configfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
{
struct dentry *dentry = filp->f_path.dentry;
struct super_block *sb = dentry->d_sb;
- struct configfs_dirent * parent_sd = dentry->d_fsdata;
+ struct configfs_dirent *parent_sd = dentry->d_fsdata;
struct configfs_dirent *cursor = filp->private_data;
struct list_head *p, *q = &cursor->s_sibling;
ino_t ino = 0;
int i = filp->f_pos;
switch (i) {
- case 0:
- ino = dentry->d_inode->i_ino;
- if (filldir(dirent, ".", 1, i, ino, DT_DIR) < 0)
- break;
- filp->f_pos++;
- i++;
- /* fallthrough */
- case 1:
- ino = parent_ino(dentry);
- if (filldir(dirent, "..", 2, i, ino, DT_DIR) < 0)
- break;
- filp->f_pos++;
- i++;
- /* fallthrough */
- default:
- if (filp->f_pos == 2) {
- spin_lock(&configfs_dirent_lock);
- list_move(q, &parent_sd->s_children);
- spin_unlock(&configfs_dirent_lock);
- }
- for (p=q->next; p!= &parent_sd->s_children; p=p->next) {
- struct configfs_dirent *next;
- const char * name;
- int len;
- struct inode *inode = NULL;
+ case 0:
+ ino = dentry->d_inode->i_ino;
+ if (filldir(dirent, ".", 1, i, ino, DT_DIR) < 0)
+ break;
+ filp->f_pos++;
+ i++;
+ /* fallthrough */
+ case 1:
+ ino = parent_ino(dentry);
+ if (filldir(dirent, "..", 2, i, ino, DT_DIR) < 0)
+ break;
+ filp->f_pos++;
+ i++;
+ /* fallthrough */
+ default:
+ if (filp->f_pos == 2) {
+ spin_lock(&configfs_dirent_lock);
+ list_move(q, &parent_sd->s_children);
+ spin_unlock(&configfs_dirent_lock);
+ }
+ for (p = q->next; p != &parent_sd->s_children; p = p->next) {
+ struct configfs_dirent *next;
+ const char *name;
+ int len;
+ struct inode *inode = NULL;
+
+ next = list_entry(p, struct configfs_dirent,
+ s_sibling);
+ if (!next->s_element)
+ continue;
- next = list_entry(p, struct configfs_dirent,
- s_sibling);
- if (!next->s_element)
- continue;
-
- name = configfs_get_name(next);
- len = strlen(name);
-
- /*
- * We'll have a dentry and an inode for
- * PINNED items and for open attribute
- * files. We lock here to prevent a race
- * with configfs_d_iput() clearing
- * s_dentry before calling iput().
- *
- * Why do we go to the trouble? If
- * someone has an attribute file open,
- * the inode number should match until
- * they close it. Beyond that, we don't
- * care.
- */
- spin_lock(&configfs_dirent_lock);
- dentry = next->s_dentry;
- if (dentry)
- inode = dentry->d_inode;
- if (inode)
- ino = inode->i_ino;
- spin_unlock(&configfs_dirent_lock);
- if (!inode)
- ino = iunique(sb, 2);
+ name = configfs_get_name(next);
+ len = strlen(name);
- if (filldir(dirent, name, len, filp->f_pos, ino,
- dt_type(next)) < 0)
- return 0;
+ /*
+ * We'll have a dentry and an inode for
+ * PINNED items and for open attribute
+ * files. We lock here to prevent a race
+ * with configfs_d_iput() clearing
+ * s_dentry before calling iput().
+ *
+ * Why do we go to the trouble? If
+ * someone has an attribute file open,
+ * the inode number should match until
+ * they close it. Beyond that, we don't
+ * care.
+ */
+ spin_lock(&configfs_dirent_lock);
+ dentry = next->s_dentry;
+ if (dentry)
+ inode = dentry->d_inode;
+ if (inode)
+ ino = inode->i_ino;
+ spin_unlock(&configfs_dirent_lock);
+ if (!inode)
+ ino = iunique(sb, 2);
- spin_lock(&configfs_dirent_lock);
- list_move(q, p);
- spin_unlock(&configfs_dirent_lock);
- p = q;
- filp->f_pos++;
- }
+ if (filldir(dirent, name, len, filp->f_pos, ino,
+ dt_type(next)) < 0)
+ return 0;
+
+ spin_lock(&configfs_dirent_lock);
+ list_move(q, p);
+ spin_unlock(&configfs_dirent_lock);
+ p = q;
+ filp->f_pos++;
+ }
}
return 0;
}
static loff_t configfs_dir_lseek(struct file *file, loff_t offset, int whence)
{
- struct dentry * dentry = file->f_path.dentry;
+ struct dentry *dentry = file->f_path.dentry;
mutex_lock(&dentry->d_inode->i_mutex);
switch (whence) {
- case 1:
- offset += file->f_pos;
- case 0:
- if (offset >= 0)
- break;
- default:
- mutex_unlock(&file->f_path.dentry->d_inode->i_mutex);
- return -EINVAL;
+ case 1:
+ offset += file->f_pos;
+ case 0:
+ if (offset >= 0)
+ break;
+ default:
+ mutex_unlock(&file->f_path.dentry->d_inode->i_mutex);
+ return -EINVAL;
}
if (offset != file->f_pos) {
file->f_pos = offset;
@@ -1715,6 +1726,7 @@ int configfs_register_subsystem(struct configfs_subsystem *subsys)
return err;
}
+EXPORT_SYMBOL(configfs_register_subsystem);
void configfs_unregister_subsystem(struct configfs_subsystem *subsys)
{
@@ -1723,7 +1735,7 @@ void configfs_unregister_subsystem(struct configfs_subsystem *subsys)
struct dentry *root = dentry->d_sb->s_root;
if (dentry->d_parent != root) {
- printk(KERN_ERR "configfs: Tried to unregister non-subsystem!\n");
+ pr_err("configfs: Tried to unregister non-subsystem!\n");
return;
}
@@ -1732,9 +1744,9 @@ void configfs_unregister_subsystem(struct configfs_subsystem *subsys)
mutex_lock_nested(&dentry->d_inode->i_mutex, I_MUTEX_CHILD);
mutex_lock(&configfs_symlink_mutex);
spin_lock(&configfs_dirent_lock);
- if (configfs_detach_prep(dentry, NULL)) {
- printk(KERN_ERR "configfs: Tried to unregister non-empty subsystem!\n");
- }
+ if (configfs_detach_prep(dentry, NULL))
+ pr_err("configfs: Tried to unregister non-empty subsystem!\n");
+
spin_unlock(&configfs_dirent_lock);
mutex_unlock(&configfs_symlink_mutex);
configfs_detach_group(&group->cg_item);
@@ -1751,6 +1763,4 @@ void configfs_unregister_subsystem(struct configfs_subsystem *subsys)
unlink_group(group);
configfs_release_fs();
}
-
-EXPORT_SYMBOL(configfs_register_subsystem);
EXPORT_SYMBOL(configfs_unregister_subsystem);
--
1.7.0.4
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH 4/8] fs/configfs: checkpatch cleanup
2013-01-03 10:10 [PATCH 0/8] configfs checkpatch cleanup Andrzej Pietrasiewicz
` (2 preceding siblings ...)
2013-01-03 10:10 ` [PATCH 3/8] " Andrzej Pietrasiewicz
@ 2013-01-03 10:10 ` Andrzej Pietrasiewicz
2013-01-03 10:10 ` [PATCH 5/8] " Andrzej Pietrasiewicz
` (3 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Andrzej Pietrasiewicz @ 2013-01-03 10:10 UTC (permalink / raw)
To: linux-kernel
Cc: Andrzej Pietrasiewicz, Kyungmin Park, Joel Becker, Marek Szyprowski
---
fs/configfs/file.c | 112 ++++++++++++++++++++++++++++-----------------------
1 files changed, 61 insertions(+), 51 deletions(-)
diff --git a/fs/configfs/file.c b/fs/configfs/file.c
index 2b6cb23..18e2823 100644
--- a/fs/configfs/file.c
+++ b/fs/configfs/file.c
@@ -19,7 +19,7 @@
* Boston, MA 021110-1307, USA.
*
* Based on sysfs:
- * sysfs is Copyright (C) 2001, 2002, 2003 Patrick Mochel
+ * sysfs is Copyright (C) 2001, 2002, 2003 Patrick Mochel
*
* configfs Copyright (C) 2005 Oracle. All rights reserved.
*/
@@ -28,7 +28,7 @@
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/mutex.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
#include <linux/configfs.h>
#include "configfs_internal.h"
@@ -44,8 +44,8 @@
struct configfs_buffer {
size_t count;
loff_t pos;
- char * page;
- struct configfs_item_operations * ops;
+ char *page;
+ struct configfs_item_operations *ops;
struct mutex mutex;
int needs_read_fill;
};
@@ -61,11 +61,12 @@ struct configfs_buffer {
* data.
* This is called only once, on the file's first read.
*/
-static int fill_read_buffer(struct dentry * dentry, struct configfs_buffer * buffer)
+static int fill_read_buffer(struct dentry *dentry,
+ struct configfs_buffer *buffer)
{
- struct configfs_attribute * attr = to_attr(dentry);
- struct config_item * item = to_item(dentry->d_parent);
- struct configfs_item_operations * ops = buffer->ops;
+ struct configfs_attribute *attr = to_attr(dentry);
+ struct config_item *item = to_item(dentry->d_parent);
+ struct configfs_item_operations *ops = buffer->ops;
int ret = 0;
ssize_t count;
@@ -74,7 +75,7 @@ static int fill_read_buffer(struct dentry * dentry, struct configfs_buffer * buf
if (!buffer->page)
return -ENOMEM;
- count = ops->show_attribute(item,attr,buffer->page);
+ count = ops->show_attribute(item, attr, buffer->page);
buffer->needs_read_fill = 0;
BUG_ON(count > (ssize_t)SIMPLE_ATTR_SIZE);
if (count >= 0)
@@ -104,14 +105,16 @@ static int fill_read_buffer(struct dentry * dentry, struct configfs_buffer * buf
*/
static ssize_t
-configfs_read_file(struct file *file, char __user *buf, size_t count, loff_t *ppos)
+configfs_read_file(struct file *file, char __user *buf, size_t count,
+ loff_t *ppos)
{
- struct configfs_buffer * buffer = file->private_data;
+ struct configfs_buffer *buffer = file->private_data;
ssize_t retval = 0;
mutex_lock(&buffer->mutex);
if (buffer->needs_read_fill) {
- if ((retval = fill_read_buffer(file->f_path.dentry,buffer)))
+ retval = fill_read_buffer(file->f_path.dentry, buffer);
+ if (retval)
goto out;
}
pr_debug("%s: count = %zd, ppos = %lld, buf = %s\n",
@@ -135,7 +138,8 @@ out:
*/
static int
-fill_write_buffer(struct configfs_buffer * buffer, const char __user * buf, size_t count)
+fill_write_buffer(struct configfs_buffer *buffer, const char __user *buf,
+ size_t count)
{
int error;
@@ -146,7 +150,7 @@ fill_write_buffer(struct configfs_buffer * buffer, const char __user * buf, size
if (count >= SIMPLE_ATTR_SIZE)
count = SIMPLE_ATTR_SIZE - 1;
- error = copy_from_user(buffer->page,buf,count);
+ error = copy_from_user(buffer->page, buf, count);
buffer->needs_read_fill = 1;
/* if buf is assumed to contain a string, terminate it by \0,
* so e.g. sscanf() can scan the string easily */
@@ -167,13 +171,14 @@ fill_write_buffer(struct configfs_buffer * buffer, const char __user * buf, size
*/
static int
-flush_write_buffer(struct dentry * dentry, struct configfs_buffer * buffer, size_t count)
+flush_write_buffer(struct dentry *dentry, struct configfs_buffer *buffer,
+ size_t count)
{
- struct configfs_attribute * attr = to_attr(dentry);
- struct config_item * item = to_item(dentry->d_parent);
- struct configfs_item_operations * ops = buffer->ops;
+ struct configfs_attribute *attr = to_attr(dentry);
+ struct config_item *item = to_item(dentry->d_parent);
+ struct configfs_item_operations *ops = buffer->ops;
- return ops->store_attribute(item,attr,buffer->page,count);
+ return ops->store_attribute(item, attr, buffer->page, count);
}
@@ -184,7 +189,8 @@ flush_write_buffer(struct dentry * dentry, struct configfs_buffer * buffer, size
* @count: number of bytes
* @ppos: starting offset
*
- * Similar to configfs_read_file(), though working in the opposite direction.
+ * Similar to configfs_read_file(), though working in the opposite
+ * direction.
* We allocate and fill the data from the user in fill_write_buffer(),
* then push it to the config_item in flush_write_buffer().
* There is no easy way for us to know if userspace is only doing a partial
@@ -195,9 +201,10 @@ flush_write_buffer(struct dentry * dentry, struct configfs_buffer * buffer, size
*/
static ssize_t
-configfs_write_file(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
+configfs_write_file(struct file *file, const char __user *buf, size_t count,
+ loff_t *ppos)
{
- struct configfs_buffer * buffer = file->private_data;
+ struct configfs_buffer *buffer = file->private_data;
ssize_t len;
mutex_lock(&buffer->mutex);
@@ -210,27 +217,28 @@ configfs_write_file(struct file *file, const char __user *buf, size_t count, lof
return len;
}
-static int check_perm(struct inode * inode, struct file * file)
+static int check_perm(struct inode *inode, struct file *file)
{
- struct config_item *item = configfs_get_config_item(file->f_path.dentry->d_parent);
- struct configfs_attribute * attr = to_attr(file->f_path.dentry);
- struct configfs_buffer * buffer;
- struct configfs_item_operations * ops = NULL;
+ struct config_item *item =
+ configfs_get_config_item(file->f_path.dentry->d_parent);
+ struct configfs_attribute *attr = to_attr(file->f_path.dentry);
+ struct configfs_buffer *buffer;
+ struct configfs_item_operations *ops = NULL;
int error = 0;
if (!item || !attr)
- goto Einval;
+ goto einval;
/* Grab the module reference for this attribute if we have one */
if (!try_module_get(attr->ca_owner)) {
error = -ENODEV;
- goto Done;
+ goto done;
}
if (item->ci_type)
ops = item->ci_type->ct_item_ops;
else
- goto Eaccess;
+ goto eaccess;
/* File needs write support.
* The inode's perms must say it's ok,
@@ -239,7 +247,7 @@ static int check_perm(struct inode * inode, struct file * file)
if (file->f_mode & FMODE_WRITE) {
if (!(inode->i_mode & S_IWUGO) || !ops->store_attribute)
- goto Eaccess;
+ goto eaccess;
}
@@ -249,47 +257,47 @@ static int check_perm(struct inode * inode, struct file * file)
*/
if (file->f_mode & FMODE_READ) {
if (!(inode->i_mode & S_IRUGO) || !ops->show_attribute)
- goto Eaccess;
+ goto eaccess;
}
/* No error? Great, allocate a buffer for the file, and store it
* it in file->private_data for easy access.
*/
- buffer = kzalloc(sizeof(struct configfs_buffer),GFP_KERNEL);
+ buffer = kzalloc(sizeof(struct configfs_buffer), GFP_KERNEL);
if (!buffer) {
error = -ENOMEM;
- goto Enomem;
+ goto enomem;
}
mutex_init(&buffer->mutex);
buffer->needs_read_fill = 1;
buffer->ops = ops;
file->private_data = buffer;
- goto Done;
+ goto done;
- Einval:
+ einval:
error = -EINVAL;
- goto Done;
- Eaccess:
+ goto done;
+ eaccess:
error = -EACCES;
- Enomem:
+ enomem:
module_put(attr->ca_owner);
- Done:
+ done:
if (error && item)
config_item_put(item);
return error;
}
-static int configfs_open_file(struct inode * inode, struct file * filp)
+static int configfs_open_file(struct inode *inode, struct file *filp)
{
- return check_perm(inode,filp);
+ return check_perm(inode, filp);
}
-static int configfs_release(struct inode * inode, struct file * filp)
+static int configfs_release(struct inode *inode, struct file *filp)
{
- struct config_item * item = to_item(filp->f_path.dentry->d_parent);
- struct configfs_attribute * attr = to_attr(filp->f_path.dentry);
- struct module * owner = attr->ca_owner;
- struct configfs_buffer * buffer = filp->private_data;
+ struct config_item *item = to_item(filp->f_path.dentry->d_parent);
+ struct configfs_attribute *attr = to_attr(filp->f_path.dentry);
+ struct module *owner = attr->ca_owner;
+ struct configfs_buffer *buffer = filp->private_data;
if (item)
config_item_put(item);
@@ -314,14 +322,15 @@ const struct file_operations configfs_file_operations = {
};
-int configfs_add_file(struct dentry * dir, const struct configfs_attribute * attr, int type)
+int configfs_add_file(struct dentry *dir, const struct configfs_attribute *attr,
+ int type)
{
- struct configfs_dirent * parent_sd = dir->d_fsdata;
+ struct configfs_dirent *parent_sd = dir->d_fsdata;
umode_t mode = (attr->ca_mode & S_IALLUGO) | S_IFREG;
int error = 0;
mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_NORMAL);
- error = configfs_make_dirent(parent_sd, NULL, (void *) attr, mode, type);
+ error = configfs_make_dirent(parent_sd, NULL, (void *)attr, mode, type);
mutex_unlock(&dir->d_inode->i_mutex);
return error;
@@ -334,7 +343,8 @@ int configfs_add_file(struct dentry * dir, const struct configfs_attribute * att
* @attr: atrribute descriptor.
*/
-int configfs_create_file(struct config_item * item, const struct configfs_attribute * attr)
+int configfs_create_file(struct config_item *item,
+ const struct configfs_attribute *attr)
{
BUG_ON(!item || !item->ci_dentry || !attr);
--
1.7.0.4
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH 5/8] fs/configfs: checkpatch cleanup
2013-01-03 10:10 [PATCH 0/8] configfs checkpatch cleanup Andrzej Pietrasiewicz
` (3 preceding siblings ...)
2013-01-03 10:10 ` [PATCH 4/8] " Andrzej Pietrasiewicz
@ 2013-01-03 10:10 ` Andrzej Pietrasiewicz
2013-01-03 10:10 ` [PATCH 6/8] " Andrzej Pietrasiewicz
` (2 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Andrzej Pietrasiewicz @ 2013-01-03 10:10 UTC (permalink / raw)
To: linux-kernel
Cc: Andrzej Pietrasiewicz, Kyungmin Park, Joel Becker, Marek Szyprowski
---
fs/configfs/inode.c | 46 +++++++++++++++++++++++++---------------------
1 files changed, 25 insertions(+), 21 deletions(-)
diff --git a/fs/configfs/inode.c b/fs/configfs/inode.c
index a9d35b0..087fc73 100644
--- a/fs/configfs/inode.c
+++ b/fs/configfs/inode.c
@@ -19,7 +19,7 @@
* Boston, MA 021110-1307, USA.
*
* Based on sysfs:
- * sysfs is Copyright (C) 2001, 2002, 2003 Patrick Mochel
+ * sysfs is Copyright (C) 2001, 2002, 2003 Patrick Mochel
*
* configfs Copyright (C) 2005 Oracle. All rights reserved.
*
@@ -56,15 +56,15 @@ static struct backing_dev_info configfs_backing_dev_info = {
.capabilities = BDI_CAP_NO_ACCT_AND_WRITEBACK,
};
-static const struct inode_operations configfs_inode_operations ={
+static const struct inode_operations configfs_inode_operations = {
.setattr = configfs_setattr,
};
-int configfs_setattr(struct dentry * dentry, struct iattr * iattr)
+int configfs_setattr(struct dentry *dentry, struct iattr *iattr)
{
- struct inode * inode = dentry->d_inode;
- struct configfs_dirent * sd = dentry->d_fsdata;
- struct iattr * sd_iattr;
+ struct inode *inode = dentry->d_inode;
+ struct configfs_dirent *sd = dentry->d_fsdata;
+ struct iattr *sd_iattr;
unsigned int ia_valid = iattr->ia_valid;
int error;
@@ -81,7 +81,8 @@ int configfs_setattr(struct dentry * dentry, struct iattr * iattr)
sd_iattr->ia_mode = sd->s_mode;
sd_iattr->ia_uid = GLOBAL_ROOT_UID;
sd_iattr->ia_gid = GLOBAL_ROOT_GID;
- sd_iattr->ia_atime = sd_iattr->ia_mtime = sd_iattr->ia_ctime = CURRENT_TIME;
+ sd_iattr->ia_atime = sd_iattr->ia_mtime = sd_iattr->ia_ctime =
+ CURRENT_TIME;
sd->s_iattr = sd_iattr;
}
/* attributes were changed atleast once in past */
@@ -114,13 +115,13 @@ int configfs_setattr(struct dentry * dentry, struct iattr * iattr)
return error;
}
-static inline void set_default_inode_attr(struct inode * inode, umode_t mode)
+static inline void set_default_inode_attr(struct inode *inode, umode_t mode)
{
inode->i_mode = mode;
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
}
-static inline void set_inode_attr(struct inode * inode, struct iattr * iattr)
+static inline void set_inode_attr(struct inode *inode, struct iattr *iattr)
{
inode->i_mode = iattr->ia_mode;
inode->i_uid = iattr->ia_uid;
@@ -133,7 +134,7 @@ static inline void set_inode_attr(struct inode * inode, struct iattr * iattr)
struct inode *configfs_new_inode(umode_t mode, struct configfs_dirent *sd,
struct super_block *s)
{
- struct inode * inode = new_inode(s);
+ struct inode *inode = new_inode(s);
if (inode) {
inode->i_ino = get_next_ino();
inode->i_mapping->a_ops = &configfs_aops;
@@ -154,6 +155,8 @@ struct inode *configfs_new_inode(umode_t mode, struct configfs_dirent *sd,
#ifdef CONFIG_LOCKDEP
+static char *lockdep_msg =
+"configfs: Too many levels of inodes for the locking correctness validator.\n";
static void configfs_set_inode_lock_class(struct configfs_dirent *sd,
struct inode *inode)
{
@@ -168,9 +171,8 @@ static void configfs_set_inode_lock_class(struct configfs_dirent *sd,
* In practice the maximum level of locking depth is
* already reached. Just inform about possible reasons.
*/
- printk(KERN_INFO "configfs: Too many levels of inodes"
- " for the locking correctness validator.\n");
- printk(KERN_INFO "Spurious warnings may appear.\n");
+ pr_info(lockdep_msg);
+ pr_info("Spurious warnings may appear.\n");
}
}
}
@@ -184,7 +186,8 @@ static void configfs_set_inode_lock_class(struct configfs_dirent *sd,
#endif /* CONFIG_LOCKDEP */
-int configfs_create(struct dentry * dentry, umode_t mode, int (*init)(struct inode *))
+int configfs_create(struct dentry *dentry, umode_t mode,
+ int (*init)(struct inode *))
{
int error = 0;
struct inode *inode = NULL;
@@ -220,9 +223,10 @@ int configfs_create(struct dentry * dentry, umode_t mode, int (*init)(struct ino
}
/*
- * Get the name for corresponding element represented by the given configfs_dirent
+ * Get the name for corresponding element represented by the given
+ * configfs_dirent
*/
-const unsigned char * configfs_get_name(struct configfs_dirent *sd)
+const unsigned char *configfs_get_name(struct configfs_dirent *sd)
{
struct configfs_attribute *attr;
@@ -244,9 +248,9 @@ const unsigned char * configfs_get_name(struct configfs_dirent *sd)
* Unhashes the dentry corresponding to given configfs_dirent
* Called with parent inode's i_mutex held.
*/
-void configfs_drop_dentry(struct configfs_dirent * sd, struct dentry * parent)
+void configfs_drop_dentry(struct configfs_dirent *sd, struct dentry *parent)
{
- struct dentry * dentry = sd->s_dentry;
+ struct dentry *dentry = sd->s_dentry;
if (dentry) {
spin_lock(&dentry->d_lock);
@@ -260,10 +264,10 @@ void configfs_drop_dentry(struct configfs_dirent * sd, struct dentry * parent)
}
}
-void configfs_hash_and_remove(struct dentry * dir, const char * name)
+void configfs_hash_and_remove(struct dentry *dir, const char *name)
{
- struct configfs_dirent * sd;
- struct configfs_dirent * parent_sd = dir->d_fsdata;
+ struct configfs_dirent *sd;
+ struct configfs_dirent *parent_sd = dir->d_fsdata;
if (dir->d_inode == NULL)
/* no inode means this hasn't been made visible yet */
--
1.7.0.4
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH 6/8] fs/configfs: checkpatch cleanup
2013-01-03 10:10 [PATCH 0/8] configfs checkpatch cleanup Andrzej Pietrasiewicz
` (4 preceding siblings ...)
2013-01-03 10:10 ` [PATCH 5/8] " Andrzej Pietrasiewicz
@ 2013-01-03 10:10 ` Andrzej Pietrasiewicz
2013-01-03 10:10 ` [PATCH 7/8] " Andrzej Pietrasiewicz
2013-01-03 10:10 ` [PATCH 8/8] " Andrzej Pietrasiewicz
7 siblings, 0 replies; 10+ messages in thread
From: Andrzej Pietrasiewicz @ 2013-01-03 10:10 UTC (permalink / raw)
To: linux-kernel
Cc: Andrzej Pietrasiewicz, Kyungmin Park, Joel Becker, Marek Szyprowski
---
fs/configfs/item.c | 60 +++++++++++++++++++++++++--------------------------
1 files changed, 29 insertions(+), 31 deletions(-)
diff --git a/fs/configfs/item.c b/fs/configfs/item.c
index 50cee7f..05a08e1 100644
--- a/fs/configfs/item.c
+++ b/fs/configfs/item.c
@@ -19,7 +19,7 @@
* Boston, MA 021110-1307, USA.
*
* Based on kobject:
- * kobject is Copyright (c) 2002-2003 Patrick Mochel
+ * kobject is Copyright (c) 2002-2003 Patrick Mochel
*
* configfs Copyright (C) 2005 Oracle. All rights reserved.
*
@@ -35,9 +35,9 @@
#include <linux/configfs.h>
-static inline struct config_item * to_item(struct list_head * entry)
+static inline struct config_item *to_item(struct list_head *entry)
{
- return container_of(entry,struct config_item,ci_entry);
+ return container_of(entry, struct config_item, ci_entry);
}
/* Evil kernel */
@@ -47,11 +47,12 @@ static void config_item_release(struct kref *kref);
* config_item_init - initialize item.
* @item: item in question.
*/
-void config_item_init(struct config_item * item)
+void config_item_init(struct config_item *item)
{
kref_init(&item->ci_kref);
INIT_LIST_HEAD(&item->ci_entry);
}
+EXPORT_SYMBOL(config_item_init);
/**
* config_item_set_name - Set the name of an item
@@ -62,19 +63,19 @@ void config_item_init(struct config_item * item)
* dynamically allocated string that @item->ci_name points to.
* Otherwise, use the static @item->ci_namebuf array.
*/
-int config_item_set_name(struct config_item * item, const char * fmt, ...)
+int config_item_set_name(struct config_item *item, const char *fmt, ...)
{
int error = 0;
int limit = CONFIGFS_ITEM_NAME_LEN;
int need;
va_list args;
- char * name;
+ char *name;
/*
* First, try the static array
*/
- va_start(args,fmt);
- need = vsnprintf(item->ci_namebuf,limit,fmt,args);
+ va_start(args, fmt);
+ need = vsnprintf(item->ci_namebuf, limit, fmt, args);
va_end(args);
if (need < limit)
name = item->ci_namebuf;
@@ -83,20 +84,20 @@ int config_item_set_name(struct config_item * item, const char * fmt, ...)
* Need more space? Allocate it and try again
*/
limit = need + 1;
- name = kmalloc(limit,GFP_KERNEL);
+ name = kmalloc(limit, GFP_KERNEL);
if (!name) {
error = -ENOMEM;
- goto Done;
+ goto done;
}
- va_start(args,fmt);
- need = vsnprintf(name,limit,fmt,args);
+ va_start(args, fmt);
+ need = vsnprintf(name, limit, fmt, args);
va_end(args);
/* Still? Give up. */
if (need >= limit) {
kfree(name);
error = -EFAULT;
- goto Done;
+ goto done;
}
}
@@ -106,10 +107,9 @@ int config_item_set_name(struct config_item * item, const char * fmt, ...)
/* Now, set the new name */
item->ci_name = name;
- Done:
+ done:
return error;
}
-
EXPORT_SYMBOL(config_item_set_name);
void config_item_init_type_name(struct config_item *item,
@@ -131,20 +131,21 @@ void config_group_init_type_name(struct config_group *group, const char *name,
}
EXPORT_SYMBOL(config_group_init_type_name);
-struct config_item * config_item_get(struct config_item * item)
+struct config_item *config_item_get(struct config_item *item)
{
if (item)
kref_get(&item->ci_kref);
return item;
}
+EXPORT_SYMBOL(config_item_get);
-static void config_item_cleanup(struct config_item * item)
+static void config_item_cleanup(struct config_item *item)
{
- struct config_item_type * t = item->ci_type;
- struct config_group * s = item->ci_group;
- struct config_item * parent = item->ci_parent;
+ struct config_item_type *t = item->ci_type;
+ struct config_group *s = item->ci_group;
+ struct config_item *parent = item->ci_parent;
- pr_debug("config_item %s: cleaning up\n",config_item_name(item));
+ pr_debug("config_item %s: cleaning up\n", config_item_name(item));
if (item->ci_name != item->ci_namebuf)
kfree(item->ci_name);
item->ci_name = NULL;
@@ -167,11 +168,12 @@ static void config_item_release(struct kref *kref)
*
* Decrement the refcount, and if 0, call config_item_cleanup().
*/
-void config_item_put(struct config_item * item)
+void config_item_put(struct config_item *item)
{
if (item)
kref_put(&item->ci_kref, config_item_release);
}
+EXPORT_SYMBOL(config_item_put);
/**
* config_group_init - initialize a group for use
@@ -182,6 +184,7 @@ void config_group_init(struct config_group *group)
config_item_init(&group->cg_item);
INIT_LIST_HEAD(&group->cg_children);
}
+EXPORT_SYMBOL(config_group_init);
/**
* config_group_find_item - search for item in group.
@@ -195,11 +198,11 @@ void config_group_init(struct config_group *group)
struct config_item *config_group_find_item(struct config_group *group,
const char *name)
{
- struct list_head * entry;
- struct config_item * ret = NULL;
+ struct list_head *entry;
+ struct config_item *ret = NULL;
- list_for_each(entry,&group->cg_children) {
- struct config_item * item = to_item(entry);
+ list_for_each(entry, &group->cg_children) {
+ struct config_item *item = to_item(entry);
if (config_item_name(item) &&
!strcmp(config_item_name(item), name)) {
ret = config_item_get(item);
@@ -208,9 +211,4 @@ struct config_item *config_group_find_item(struct config_group *group,
}
return ret;
}
-
-EXPORT_SYMBOL(config_item_init);
-EXPORT_SYMBOL(config_group_init);
-EXPORT_SYMBOL(config_item_get);
-EXPORT_SYMBOL(config_item_put);
EXPORT_SYMBOL(config_group_find_item);
--
1.7.0.4
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH 7/8] fs/configfs: checkpatch cleanup
2013-01-03 10:10 [PATCH 0/8] configfs checkpatch cleanup Andrzej Pietrasiewicz
` (5 preceding siblings ...)
2013-01-03 10:10 ` [PATCH 6/8] " Andrzej Pietrasiewicz
@ 2013-01-03 10:10 ` Andrzej Pietrasiewicz
2013-01-03 10:10 ` [PATCH 8/8] " Andrzej Pietrasiewicz
7 siblings, 0 replies; 10+ messages in thread
From: Andrzej Pietrasiewicz @ 2013-01-03 10:10 UTC (permalink / raw)
To: linux-kernel
Cc: Andrzej Pietrasiewicz, Kyungmin Park, Joel Becker, Marek Szyprowski
---
fs/configfs/mount.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/fs/configfs/mount.c b/fs/configfs/mount.c
index aee0a7e..0815d62 100644
--- a/fs/configfs/mount.c
+++ b/fs/configfs/mount.c
@@ -19,7 +19,7 @@
* Boston, MA 021110-1307, USA.
*
* Based on sysfs:
- * sysfs is Copyright (C) 2001, 2002, 2003 Patrick Mochel
+ * sysfs is Copyright (C) 2001, 2002, 2003 Patrick Mochel
*
* configfs Copyright (C) 2005 Oracle. All rights reserved.
*/
@@ -37,9 +37,9 @@
/* Random magic number */
#define CONFIGFS_MAGIC 0x62656570
-static struct vfsmount *configfs_mount = NULL;
+static struct vfsmount *configfs_mount;
struct kmem_cache *configfs_dir_cachep;
-static int configfs_mnt_count = 0;
+static int configfs_mnt_count;
static const struct super_operations configfs_ops = {
.statfs = simple_statfs,
@@ -82,7 +82,7 @@ static int configfs_fill_super(struct super_block *sb, void *data, int silent)
if (inode) {
inode->i_op = &configfs_root_inode_operations;
inode->i_fop = &configfs_dir_operations;
- /* directory inodes start off with i_nlink == 2 (for "." entry) */
+ /* directory inodes start off with i_nlink == 2 (for the ".") */
inc_nlink(inode);
} else {
pr_debug("configfs: could not get root inode\n");
@@ -91,7 +91,7 @@ static int configfs_fill_super(struct super_block *sb, void *data, int silent)
root = d_make_root(inode);
if (!root) {
- pr_debug("%s: could not get root dentry!\n",__func__);
+ pr_debug("%s: could not get root dentry!\n", __func__);
return -ENOMEM;
}
config_group_init(&configfs_root_group);
@@ -154,7 +154,7 @@ static int __init configfs_init(void)
return 0;
out4:
- printk(KERN_ERR "configfs: Unable to register filesystem!\n");
+ pr_err("configfs: Unable to register filesystem!\n");
configfs_inode_exit();
out3:
kobject_put(config_kobj);
--
1.7.0.4
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH 8/8] fs/configfs: checkpatch cleanup
2013-01-03 10:10 [PATCH 0/8] configfs checkpatch cleanup Andrzej Pietrasiewicz
` (6 preceding siblings ...)
2013-01-03 10:10 ` [PATCH 7/8] " Andrzej Pietrasiewicz
@ 2013-01-03 10:10 ` Andrzej Pietrasiewicz
7 siblings, 0 replies; 10+ messages in thread
From: Andrzej Pietrasiewicz @ 2013-01-03 10:10 UTC (permalink / raw)
To: linux-kernel
Cc: Andrzej Pietrasiewicz, Kyungmin Park, Joel Becker, Marek Szyprowski
---
fs/configfs/symlink.c | 29 +++++++++++++++--------------
1 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/fs/configfs/symlink.c b/fs/configfs/symlink.c
index cc9f254..cb9169d 100644
--- a/fs/configfs/symlink.c
+++ b/fs/configfs/symlink.c
@@ -19,7 +19,7 @@
* Boston, MA 021110-1307, USA.
*
* Based on sysfs:
- * sysfs is Copyright (C) 2001, 2002, 2003 Patrick Mochel
+ * sysfs is Copyright (C) 2001, 2002, 2003 Patrick Mochel
*
* configfs Copyright (C) 2005 Oracle. All rights reserved.
*/
@@ -35,17 +35,17 @@
/* Protects attachments of new symlinks */
DEFINE_MUTEX(configfs_symlink_mutex);
-static int item_depth(struct config_item * item)
+static int item_depth(struct config_item *item)
{
- struct config_item * p = item;
+ struct config_item *p = item;
int depth = 0;
do { depth++; } while ((p = p->ci_parent) && !configfs_is_root(p));
return depth;
}
-static int item_path_length(struct config_item * item)
+static int item_path_length(struct config_item *item)
{
- struct config_item * p = item;
+ struct config_item *p = item;
int length = 1;
do {
length += strlen(config_item_name(p)) + 1;
@@ -54,9 +54,9 @@ static int item_path_length(struct config_item * item)
return length;
}
-static void fill_item_path(struct config_item * item, char * buffer, int length)
+static void fill_item_path(struct config_item *item, char *buffer, int length)
{
- struct config_item * p;
+ struct config_item *p;
--length;
for (p = item; p && !configfs_is_root(p); p = p->ci_parent) {
@@ -64,7 +64,7 @@ static void fill_item_path(struct config_item * item, char * buffer, int length)
/* back up enough to print this bus id with '/' */
length -= cur;
- strncpy(buffer + length,config_item_name(p),cur);
+ strncpy(buffer + length, config_item_name(p), cur);
*(buffer + --length) = '/';
}
}
@@ -132,7 +132,8 @@ static int get_target(const char *symname, struct path *path,
}
-int configfs_symlink(struct inode *dir, struct dentry *dentry, const char *symname)
+int configfs_symlink(struct inode *dir, struct dentry *dentry,
+ const char *symname)
{
int ret;
struct path path;
@@ -232,10 +233,10 @@ out:
return ret;
}
-static int configfs_get_target_path(struct config_item * item, struct config_item * target,
- char *path)
+static int configfs_get_target_path(struct config_item *item,
+ struct config_item *target, char *path)
{
- char * s;
+ char *s;
int depth, size;
depth = item_depth(item);
@@ -246,7 +247,7 @@ static int configfs_get_target_path(struct config_item * item, struct config_ite
pr_debug("%s: depth = %d, size = %d\n", __func__, depth, size);
for (s = path; depth--; s += 3)
- strcpy(s,"../");
+ strcpy(s, "../");
fill_item_path(target, path, size);
pr_debug("%s: path = '%s'\n", __func__, path);
@@ -254,7 +255,7 @@ static int configfs_get_target_path(struct config_item * item, struct config_ite
return 0;
}
-static int configfs_getlink(struct dentry *dentry, char * path)
+static int configfs_getlink(struct dentry *dentry, char *path)
{
struct config_item *item, *target_item;
int error = 0;
--
1.7.0.4
^ permalink raw reply [flat|nested] 10+ messages in thread