Re: [RFC PATCH]debugfs:Fix terminology inconsistency of dir name to mount debugfs filesystem.

From: Steven Rostedt
Date: Tue May 26 2009 - 22:38:21 EST

On Wed, 27 May 2009, GeunSik Lim wrote:

> On Wed, May 27, 2009 at 6:15 AM, Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
> >
> > On Tue, 26 May 2009, Greg KH wrote:
> >> >
> >> > The filesystem Nazi's out there will argue that the proper place to mount
> >> > the debugfs filesystem is /sys/kernel/debug. I personally find that
> >> > location annoying.
> >>
> >> Why?
> >
> > Because it is too much to type ;-)
> I think so. But, when we consider many developers that use linux kernel
> source all over the world, I think that a regular rules or consistency
> is important
> as greg k-h explained.
> Recently, I read "ftrace-world.odp" presentation file of steven rostedt.
> For example, about Mounting debugfs...
> #> mount -t debugfs nodev /sys/kernel/debug
> OR
> #> mkdir /debug
> #> mount -t debugfs nodev /debug
> I want that we will reach a consensus about mount directory name of
> debugfs filesystem to avoid confusing among the kernel developers.
> /debug/ ?
> or /sys/kernel/debug/?
> .....
> Frankly speaking, I like /sys/kernel/debug/ rule is better than /debug/ rule
> for consistency.

And this is why I always mention that directory.

> >
> >>
> >> When I created debugfs, I was told that I had to pick a place to mount
> >> it so that everyone could write scripts that "knew" where it would be.
> >>
> >> So we picked /sys/kernel/debug/ and the code creates the mount point to
> >> put it there. ÂNow distros actually mount debugfs at that location.
> >>
> >> So, now you don't like this? ÂAfter it's become a standard? ÂIck.
> >>
> >> Becides, /debug/ is pretty presumptious, it's as if debugging the kernel
> >> is a system-wide thing :)
> >>
> >> So please, don't use /debug/ use the standard, defined, and ACTUALLY
> >> USED BY DISTROS TODAY mount point of /sys/kernel/debug/
> >>
> >> If you want to create your own symlink from /debug/ to that location to
> >> make it easier to type, feel free, but do not hard code any scripts to
> >> use that location, or they are going to break.
> >
> > All my scripts search /proc/mounts to find where debugfs is mounted, then
> > it uses that.
> >
> > Hmm, Not sure what packages in the distros use the default. I don't see
> > the debugfs in /etc/fstab in any of my machines.
> >
> Yes.. In my case, I use linux distributions like Ubuntu 8.10, Fedora
> 9/10, CENTOS 5.3 currently. This distributions use proc , tmpfs,
> devpts, sysfs for official release
> by default.

The key thing is not to have scripts depend on a path. When debugfs is
enabled in a kernel, you automatically get /sys/kernel/debug, so that is a
natural place to mount it.

I have also suggested to people (as Greg suggested earlier to me) that you
can mount it there and then make a soft link to it. Which also works.

I personally just mount it at /debug.

To handle the scripts problem, all my scripts start with:

# grep debugfs /proc/mounts | cut -d ' ' -f 2

I also have a C function to do a search for debugfs in /proc/mounts.

If you look in Documentation/trace/ftrace.txt I have:

To mount the debugfs system:

# mkdir /debug
# mount -t debugfs nodev /debug

( Note: it is more common to mount at /sys/kernel/debug, but for
simplicity this document will use /debug)

Thus it is a personal preference of mine to put it at /debug. But I do not
hide the fact that it is recommended to be in /sys/kernel/debug. Heck, I'm
the one that brought to light that path in this thread. I just curse it
everytime I have to say it ;-)

-- Steve