Re: [PATCH 01/20] sysfs: Implement sysfs_rename_link

From: Eric W. Biederman
Date: Thu May 21 2009 - 06:29:43 EST


Kay Sievers <kay.sievers@xxxxxxxx> writes:

> On Thu, May 21, 2009 at 07:35, Tejun Heo <tj@xxxxxxxxxx> wrote:
>> Eric W. Biederman wrote:
>>> +int sysfs_rename_link(struct kobject *kobj, struct kobject *targ,
>>> + Â Â Â Â Â Â Â Â Â Â const char *old, const char *new)
>>> +{
>>> + Â Â sysfs_remove_link(kobj, old);
>>> + Â Â return sysfs_create_link(kobj, targ, new);
>>> +}
>>> +
>>
>> Removal and creation are done in the reverse order compared to the one
>> used in device rename. ÂThe important difference is that previously
>> failed operation was noop whereas it now would remove the current
>> link. ÂI think the old order is correct.
>
> The target string is composed on-demand, and it always points to the
> same kobject and *targ is not needed, right?
>
> Can't we just change the name of the link, instead of removing and
> re-creating the entire thing, and all these issues go away?

Good point. It looks like I can generalize sysfs_mv_dir into simply
being sysfs_rename. All of the existing logic looks like it can handle
that. I will look at doing an incremental patch for that.

Eric
--
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/