Re: [PATCH 1/5] sysfs: relay channel buffers as sysfs attributes

From: Maneesh Soni
Date: Thu Feb 23 2006 - 05:59:55 EST


On Sun, Feb 19, 2006 at 11:07:57PM +0200, Paul Mundt wrote:


> +
> +static struct dentry *
> +sysfs_create_buf_file(const char *filename, struct dentry *dentry, int mode,
> + struct rchan_buf *buf, int *is_global)
> +{
> + struct relay_attribute *attr = (struct relay_attribute *)dentry;
> + struct dentry *parent = attr->kobj->dentry;
> + int ret;
> +
> + attr->attr.mode = mode;
> + attr->rchan_buf = buf;
> +
> + ret = sysfs_add_file(parent, &attr->attr, SYSFS_KOBJ_RELAY_ATTR);
> + if (unlikely(ret != 0))
> + return NULL;
> +
> + dentry = lookup_one_len(filename, parent, strlen(filename));

lookup_one_len() needs parent's i_mutex.


> + if (IS_ERR(dentry))
> + sysfs_hash_and_remove(parent, filename);

Also wondering if you have considered the case of -EEXIST?

> +
> + return dentry;
> +}


Thanks
Maneesh


--
Maneesh Soni
Linux Technology Center,
IBM India Software Labs,
Bangalore, India
email: maneesh@xxxxxxxxxx
Phone: 91-80-25044990
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/