From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kara Subject: Re: [PATCH] Implement renaming for debugfs Date: Fri, 4 May 2007 16:14:28 +0200 Message-ID: <20070504141428.GA20516@duck.suse.cz> References: <20070430175536.GK28367@duck.suse.cz> <20070502032627.GA7845@kroah.com> <20070503095452.GC12229@duck.suse.cz> <20070504001602.GA14552@kroah.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org To: Greg KH Return-path: Received: from styx.suse.cz ([82.119.242.94]:41338 "EHLO duck.suse.cz" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755308AbXEDOEq (ORCPT ); Fri, 4 May 2007 10:04:46 -0400 Content-Disposition: inline In-Reply-To: <20070504001602.GA14552@kroah.com> Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Thu 03-05-07 17:16:02, Greg KH wrote: > On Thu, May 03, 2007 at 11:54:52AM +0200, Jan Kara wrote: > > On Tue 01-05-07 20:26:27, Greg KH wrote: > > > On Mon, Apr 30, 2007 at 07:55:36PM +0200, Jan Kara wrote: > > > > Hello, > > > > > > > > attached patch implements renaming for debugfs. I was asked for this > > > > feature by WLAN guys and I guess it makes sence (they have some debug info > > > > in the directory identified by interface name and that can change...). > > > > Could someone have a look at what I wrote whether it looks reasonable? > > > > Thanks. > > > > > > > > Honza > > > > > > > > -- > > > > Jan Kara > > > > SuSE CR Labs > > > > > > > Implement debugfs_rename() to allow renaming files/directories in debugfs. > > > > > > I think you are going to need more infrastructure here, the caller > > > doesn't want to have to allocate a new dentry themselves, they just want > > > to pass in the new filename :) > > Actually, I wanted the call to be in the spirit of other debugfs calls. > > So we have for example: > > void debugfs_remove(struct dentry *dentry) > > That is because 'debugfs_create' returns a dentry. > > > struct dentry *debugfs_create_dir(const char *name, struct dentry *parent) > > etc. > > Same here, you already have a dentry to place this directory into, _and_ > all the user needs to provide is a name for the new directory. They > don't ever create a dentry themselves, which is what your function > required them to do. > > Try using your function and you'll see what I mean :) I've tried it when testing the function :). The code looked like: dir1 = debugfs_create_dir("dir1", NULL); dir2 = debugfs_create_dir("dir2", NULL); file1 = debugfs_create_file("file1", 0644, dir1, NULL, NULL); file2 = debugfs_rename(dir1, file1, dir2, "new_name"); No new dentries needed to be created... > > So it seemed to me that the interface with dentries was perfectly > > appropriate... One possibility would be to take filename of a file to > > rename instead of old_dentry. But dirs should IMHO remain to be dentries... > > Sure, they should be dentries, but the caller should just provide a > name. Hmm, I'm not sure I understand... So you prefer debugfs_rename() to be: struct dentry *debugfs_rename(struct dentry *old_dir, const char *old_name, struct dentry *new_dir, const char *new_name); Right? Honza