Re: [RFC][PATCH 3 of 4] Configfs is really sysfs

Stephen Hemminger
2005-08-30T23:06:31Z

On Wed, 31 Aug 2005 08:59:55 +1000
Daniel Phillips <phillips@istop.com> wrote:

> Configfs rewritten as a single file and updated to use kobjects instead of its
> own clone of kobjects (config_items).
>

Some style issues:
Mixed case in labels
Bad identation

> +static int sysfs_create(struct dentry *dentry, int mode, int (*init) (struct inode *))
> +{
> + int error = 0;
> + struct inode *inode = NULL;
> + if (dentry) {
> + if (!dentry->d_inode) {
> + if ((inode = sysfs_new_inode(mode))) {
> + if (dentry->d_parent
> + && dentry->d_parent->d_inode) {
> + struct inode *p_inode =
> + dentry->d_parent->d_inode;
> + p_inode->i_mtime = p_inode->i_ctime =
> + CURRENT_TIME;
> + }
> + goto Proceed;
> + } else
> + error = -ENOMEM;
> + } else
> + error = -EEXIST;
> + } else
> + error = -ENOENT;
> + goto Done;
> +
> + Proceed:
> + if (init)
> + error = init(inode);
> + if (!error) {
> + d_instantiate(dentry, inode);
> + if (S_ISDIR(mode) || S_ISLNK(mode)) /* pin link and directory dentries */
> + dget(dentry);
> + } else
> + iput(inode);
> + Done:

Why the mixed case label?

> + return error;
> +}

> +/*
> + * configfs client helpers
> + */
> +
> +void config_group_init_type_name(struct kset *group, const char *name, struct kobj_type *type)
> +{
> + kobject_set_name(&group->kobj, name);
> + group->kobj.ktype = type;
> + config_group_init(group);
> +}

Use tabs not one space for indent.

> +void config_group_init(struct kset *group)
> +{
> + kobject_init(&group->kobj);
> + INIT_LIST_HEAD(&group->cg_children);
> +}
> +
> +void kobject_init_type_name(struct kobject *kobj, const char *name, struct kobj_type *type)
> +{
> + kobject_set_name(kobj, name);
> + kobj->ktype = type;
> + kobject_init(kobj);
> +}
> +
> +EXPORT_SYMBOL(configfs_register_subsystem);
> +EXPORT_SYMBOL(configfs_unregister_subsystem);
> +EXPORT_SYMBOL(config_group_init_type_name);
> +EXPORT_SYMBOL(config_group_init);
> +EXPORT_SYMBOL(kobject_init_type_name);
>