Skip to contentSkip to conversation

debugfs for 2.6.10-rc3

PATCH In review Greg KH 3 participants 5 messages Dec 16, 2004 – Dec 18, 2004

Subsystems (4)
lore
Share & tools
lore

Greg KH

author
#0 lore raw

PATCH 1/1 debugfs for 2.6.10-rc3

I've added debugfs to my bk driver tree (located at bk://kernel.bkbits.net/gregkh/linux/driver-2.6) so it will show up in the next -mm release. For those who want to see the patch version, or want to put it in any other kernel tree (Fedora perhaps?) I've included it below. I haven't added the kobject interface yet, I'll try to get to that next week.

thanks,

greg k-h

----------------------------

debugfs: add debugfs

debugfs is a filesystem that is just for debug data. Start moving stuff out of proc and sysfs now :)

Documentation/DocBook/kernel-api.tmpl +9 -0
diff -Nru a/Documentation/DocBook/kernel-api.tmpl b/Documentation/DocBook/kernel-api.tmpl
@@ -105,6 +105,15 @@
      </sect1>
   </chapter>
 
+  <chapter id="debugfs">
+     <title>The debugfs filesystem</title>
+ 
+     <sect1><title>debugfs interface</title>
+!Efs/debugfs/inode.c
+!Efs/debugfs/file.c
+     </sect1>
+  </chapter>
+
   <chapter id="vfs">
      <title>The Linux VFS</title>
      <sect1><title>The Directory Cache</title>
fs/Makefile +1 -0
diff -Nru a/fs/Makefile b/fs/Makefile
@@ -94,3 +94,4 @@
 obj-$(CONFIG_BEFS_FS)		+= befs/
 obj-$(CONFIG_HOSTFS)		+= hostfs/
 obj-$(CONFIG_HPPFS)		+= hppfs/
+obj-$(CONFIG_DEBUG_FS)		+= debugfs/
fs/debugfs/Makefile new file +4 -0
diff -Nru a/fs/debugfs/Makefile b/fs/debugfs/Makefile
@@ -0,0 +1,4 @@
+debugfs-objs	:= inode.o file.o
+
+obj-$(CONFIG_DEBUG_FS)	+= debugfs.o
+
fs/debugfs/file.c new file +262 -0

262 lines not on this page · raw message

fs/debugfs/inode.c new file +315 -0

315 lines not on this page · raw message

include/linux/debugfs.h new file +90 -0

90 lines not on this page · raw message

lib/Kconfig.debug +10 -0
diff -Nru a/lib/Kconfig.debug b/lib/Kconfig.debug
@@ -107,6 +107,16 @@
         If you're truly short on disk space or don't expect to report any
         bugs back to the UML developers, say N, otherwise say Y.
 
+config DEBUG_FS
+	bool "Debug Filesystem"
+	depends on DEBUG_KERNEL
+	help
+	  debugfs is a virtual file system that kernel developers use to put
+	  debugging files into.  Enable this option to be able to read and
+	  write to these files.
+
+	  If unsure, say N.
+
 if !X86_64
 config FRAME_POINTER
 	bool "Compile the kernel with frame pointers"
#1 lore raw
Quoted 9 lines · Greg KH

I've added debugfs to my bk driver tree (located at bk://kernel.bkbits.net/gregkh/linux/driver-2.6) so it will show up in the next -mm release. For those who want to see the patch version, or want to put it in any other kernel tree (Fedora perhaps?) I've included it below. I haven't added the kobject interface yet, I'll try to get to that next week.

thanks,

Quoted 8 lines

greg k-h

----------------------------

debugfs: add debugfs

debugfs is a filesystem that is just for debug data. Start moving stuff out of proc and sysfs now :)

Hi Greg

Is there any reason why this shouldn't be buildable as module? I saw no apparent reason and added "|| defined(MODULE)" to debugfs.h and made the Kconfig option tristate. This allowed it to be built as a working module (yay, i didn't have to restart to try it out!).

Also I saw there was no debugfs_create_u64() for us on 64bit machines ;)

Thanks
Alexander

author
#2 lore raw
Quoted 19 lines · Alexander Nyberg
Quoted 9 lines · Greg KH

I've added debugfs to my bk driver tree (located at bk://kernel.bkbits.net/gregkh/linux/driver-2.6) so it will show up in the next -mm release. For those who want to see the patch version, or want to put it in any other kernel tree (Fedora perhaps?) I've included it below. I haven't added the kobject interface yet, I'll try to get to that next week.

thanks,

Quoted 8 lines

greg k-h

----------------------------

debugfs: add debugfs

debugfs is a filesystem that is just for debug data. Start moving stuff out of proc and sysfs now :)

Quoted 6 lines

Hi Greg

Is there any reason why this shouldn't be buildable as module? I saw no apparent reason and added "|| defined(MODULE)" to debugfs.h and made the Kconfig option tristate. This allowed it to be built as a working module (yay, i didn't have to restart to try it out!).

If debugfs calls are used by any code that is built into the kernel, then the build would fail if debugfs is a module. As that would soon get _real_ messy from a Kbuild standpoint, I took the easy way out and just made it a Y/N type option :)

Quoted 1 line

Also I saw there was no debugfs_create_u64() for us on 64bit machines ;)

If you have a need for it, I'll be glad to add it :)

thanks,

greg k-h

#3 lore raw
In reply to Greg KH
Quoted 3 lines · Greg KH

I've added debugfs to my bk driver tree (located at bk://kernel.bkbits.net/gregkh/linux/driver-2.6) so it will show up in the next -mm release.

Debugfs is a very natural name, but it will undoubtedly cause confusion since we already have debugfs(8) in e2fsprogs. One is a filesystem, and the other is a user-mode command, so it's not a total name collision, but it could cause some communication mixups.

On the other hand, I couldn't think of a better name, so perhaps we should just live with it. I did want to point out the potential problem now while there's still a chance to change it, though....

- Ted

author
#4 lore raw
Quoted 5 lines · Theodore Ts'o
Quoted 3 lines · Greg KH

I've added debugfs to my bk driver tree (located at bk://kernel.bkbits.net/gregkh/linux/driver-2.6) so it will show up in the next -mm release.

Quoted 8 lines

Debugfs is a very natural name, but it will undoubtedly cause confusion since we already have debugfs(8) in e2fsprogs. One is a filesystem, and the other is a user-mode command, so it's not a total name collision, but it could cause some communication mixups.

On the other hand, I couldn't think of a better name, so perhaps we should just live with it. I did want to point out the potential problem now while there's still a chance to change it, though....

I agree about the name clash (I pointed it out in my original debugfs post) and like you, I couldn't think of a better name either.

Think of it like a trademark, they both have the same name, yet they live in different locations, hence they are both allowed to exist :)

thanks,

greg k-h