From: ebiederm@xmission.com (Eric W. Biederman) Subject: Re: [PATCH 01/20] sysfs: Implement sysfs_rename_link Date: Thu, 21 May 2009 03:29:20 -0700 Message-ID: References: <1242865694-2100-1-git-send-email-ebiederm@xmission.com> <4A14E836.5090302@kernel.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Tejun Heo , Andrew Morton , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Cornelia Huck , linux-fsdevel@vger.kernel.org, Benjamin Thery , Daniel Lezcano , "Eric W. Biederman" To: Kay Sievers Return-path: Received: from out02.mta.xmission.com ([166.70.13.232]:48533 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751780AbZEUK32 convert rfc822-to-8bit (ORCPT ); Thu, 21 May 2009 06:29:28 -0400 In-Reply-To: (Kay Sievers's message of "Thu\, 21 May 2009 12\:06\:18 +0200") Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Kay Sievers writes: > On Thu, May 21, 2009 at 07:35, Tejun Heo wrote: >> Eric W. Biederman wrote: >>> +int sysfs_rename_link(struct kobject *kobj, struct kobject *targ, >>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 const char *old, const char *new) >>> +{ >>> + =C2=A0 =C2=A0 sysfs_remove_link(kobj, old); >>> + =C2=A0 =C2=A0 return sysfs_create_link(kobj, targ, new); >>> +} >>> + >> >> Removal and creation are done in the reverse order compared to the o= ne >> used in device rename. =C2=A0The important difference is that previo= usly >> failed operation was noop whereas it now would remove the current >> link. =C2=A0I 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-fsdevel= " in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html