Re: [PATCH] docs: debugfs: do not recommend debugfs_remove_recursive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2025-04-30 at 09:30 +0200, gregkh@xxxxxxxxxxxxxxxxxxx wrote:
> > added back in 2019, and why was that functionality *added* to
> > debugfs_remove?
> 
> So we didn't have 2 functions that did the same thing and no one wanted
> to sweep the tree and rename everything at that time?  I honestly don't
> remember, that was tens of thousands of patches ago :)

I get that, but it seems pretty clear that at the time, the intent was to
replace debugfs_remove_recursive() with debugfs_remove().  The C function is
named debugfs_remove() and the macro is called debugfs_remove_recursive().

What you're saying now is that the C function should be renamed to
debugfs_remove_recursive() and the macro should be swapped.  I don't think
that's a good idea.

> > I recently added a patch to Nouveau that used debugfs_remove() to clean up
> > all debugfs entries
> > specifically because it operates recursively.
> 
> That's great, I'm not objecting to that, just that we need to stick with
> one or the other and I'd prefer the "recursive" name as that makes it
> blindingly obvious what is happening here while without it, people can
> get confused.

Well, wouldn't you think it's confusing to call a function named
debugfs_remove_recursive() in order to remove a single file?

If you want, I can change the documentation to say, "please use
debugfs_remove_recursive() to remove directories, and debugfs_remove() to
remove files".  

We could also modify debugfs_remove_recursive() to issue a WARN if it is
called on a file.








[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux