Skip to contentSkip to conversation

2.6.19-rc2-mm2 pktcdvd: add sysfs and debugfs interface

PATCH In review Thomas Maier 2 participants 3 messages Oct 22, 2006

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 2.6.19-rc2-mm2 pktcdvd: add sysfs and debugfs interface

Hello,

this patch adds a sysfs and debugfs interface to the pktcdvd driver.
The procfs interface is not modified!

Look into the 2 ABI/testing/* files in the patch for more infos.

Documentation/ABI/testing/debugfs-pktcdvd +20 -0
diff -urpN linux-2.6.19-rc2-mm2/Documentation/ABI/testing/debugfs-pktcdvd 1-sysfs-debugfs/Documentation/ABI/testing/debugfs-pktcdvd
@@ -0,0 +1,20 @@
+What:           /debug/pktcdvd/pktcdvd[0-7]
+Date:           Oct. 2006
+KernelVersion:  2.6.19
+Contact:        Thomas Maier <[email protected]>
+Description:
+
+debugfs interface
+-----------------
+
+The pktcdvd module (packet writing driver) creates
+these files in debugfs:
+
+/debug/pktcdvd/pktcdvd[0-7]/
+    info            (0444) Lots of human readable driver
+                           statistics and infos. Multiple lines!
+
+Example:
+-------
+
+cat /debug/pktcdvd/pktcdvd0/info
Documentation/ABI/testing/sysfs-class-pktcdvd +72 -0

72 lines not on this page · raw message

Documentation/cdrom/packet-writing.txt +36 -0
diff -urpN linux-2.6.19-rc2-mm2/Documentation/cdrom/packet-writing.txt 1-sysfs-debugfs/Documentation/cdrom/packet-writing.txt
@@ -8,6 +8,7 @@ Getting started quick
 
 - You need the udftools package (pktsetup, mkudffs, cdrwtool).
   Download from http://sourceforge.net/projects/linux-udf/
+  Note: pktsetup uses the pktcdvd procfs interface!
 
 - Grab a new CD-RW disc and format it (assuming CD-RW is hdc, substitute
   as appropriate):
@@ -90,6 +91,41 @@ Notes
   to create an ext2 filesystem on the disc.
 
 
+Using the pktcdvd sysfs interface
+---------------------------------
+
+Since Linux 2.6.19, the pktcdvd module has a sysfs interface
+and can be controlled by it. For example the "pktcdvd" tool uses
+this interface. (see http://people.freenet.de/BalaGi#pktcdvd )
+
+"pktcdvd" works similar to "pktsetup", e.g.:
+
+	# pktcdvd -a dev_name /dev/hdc
+	# mkudffs /dev/pktcdvd/dev_name
+	# mount -t udf -o rw,noatime /dev/pktcdvd/dev_name /dvdram
+	# cp files /dvdram
+	# umount /dvdram
+	# pktcdvd -r dev_name
+
+
+For a description of the sysfs interface look into the file:
+
+  Documentation/ABI/testing/sysfs-block-pktcdvd
+
+
+Using the pktcdvd debugfs interface
+-----------------------------------
+
+To read pktcdvd device infos in human readable form, do:
+
+	# cat /debug/pktcdvd/pktcdvd[0-7]/info
+
+For a description of the debugfs interface look into the file:
+
+  Documentation/ABI/testing/debugfs-pktcdvd
+
+
+
 Links
 -----
 
drivers/block/pktcdvd.c +439 -4

500 lines not on this page · raw message

include/linux/pktcdvd.h +17 -1
diff -urpN linux-2.6.19-rc2-mm2/include/linux/pktcdvd.h 1-sysfs-debugfs/include/linux/pktcdvd.h
@@ -111,7 +111,8 @@ struct pkt_ctrl_command {
 #include <linux/blkdev.h>
 #include <linux/completion.h>
 #include <linux/cdrom.h>
-
+#include <linux/kobject.h>
+#include <linux/sysfs.h>
 
 /* default bio write queue congestion marks */
 #define PKT_WRITE_CONGESTION_ON    10000
@@ -247,6 +248,14 @@ struct packet_stacked_data
 };
 #define PSD_POOL_SIZE		64
 
+struct pktcdvd_kobj
+{
+	struct kobject		kobj;
+	struct pktcdvd_device	*pd;
+};
+#define to_pktcdvdkobj(_k) \
+  ((struct pktcdvd_kobj*)container_of(_k,struct pktcdvd_kobj,kobj))
+
 struct pktcdvd_device
 {
 	struct block_device	*bdev;		/* dev attached */
@@ -280,6 +289,13 @@ struct pktcdvd_device
 
 	int			write_congestion_off;
 	int			write_congestion_on;
+	
+	struct class_device	*clsdev;	/* sysfs pktcdvd[0-7] class dev */ 
+	struct pktcdvd_kobj	*kobj_stat;	/* sysfs pktcdvd[0-7]/stat/     */
+	struct pktcdvd_kobj	*kobj_wqueue;	/* sysfs pktcdvd[0-7]/write_queue/ */
+	
+	struct dentry		*dfs_d_root;	/* debugfs: devname directory */
+	struct dentry		*dfs_f_info;	/* debugfs: info file */
 };
 
 #endif /* __KERNEL__ */
#1 lore raw
Quoted 3 lines · Thomas Maier

this patch adds a sysfs and debugfs interface
to the pktcdvd driver.
The procfs interface is not modified!

Calling the character device interface "procfs interface" is misleading, so I disagree with this part of the patch:

+ Note: pktsetup uses the pktcdvd procfs interface!

The only connection pktsetup has with procfs is that it reads the character device minor number from /proc/misc. If that number was available somewhere else or if udev created /dev/pktcdvd/control automatically, pktsetup wouldn't need /proc at all.

Actually, checking my FC5 installation, /dev/pktcdvd/control is created automatically when the driver is loaded, so the /proc code in pktsetup is only needed to cope with older distributions.

Signature · 2 lines
Peter Osterlund - [email protected]
http://web.telia.com/~u89404340
#2 lore raw
Quoted 10 lines · Peter Osterlund
Quoted 3 lines · Thomas Maier

this patch adds a sysfs and debugfs interface
to the pktcdvd driver.
The procfs interface is not modified!

Calling the character device interface "procfs interface" is misleading, so I disagree with this part of the patch:

+ Note: pktsetup uses the pktcdvd procfs interface!

Other than that, and some trailing whitespace, the patch looks good. Thanks a lot. Andrew, please apply:

This patch adds a sysfs and debugfs interface to the pktcdvd driver.

Look into the Documentation/ABI/testing/* files in the patch for more info.

---

 Documentation/ABI/testing/debugfs-pktcdvd     |   20 +
 Documentation/ABI/testing/sysfs-class-pktcdvd |   72 ++++
 Documentation/cdrom/packet-writing.txt        |   35 ++
 drivers/block/pktcdvd.c                       |  443 +++++++++++++++++++++++++
 include/linux/pktcdvd.h                       |   18 +
 5 files changed, 583 insertions(+), 5 deletions(-)
Documentation/ABI/testing/debugfs-pktcdvd new file +20 -0
new file mode 100644
index 0000000..03dbd88
@@ -0,0 +1,20 @@
+What:           /debug/pktcdvd/pktcdvd[0-7]
+Date:           Oct. 2006
+KernelVersion:  2.6.19
+Contact:        Thomas Maier <[email protected]>
+Description:
+
+debugfs interface
+-----------------
+
+The pktcdvd module (packet writing driver) creates
+these files in debugfs:
+
+/debug/pktcdvd/pktcdvd[0-7]/
+    info            (0444) Lots of human readable driver
+                           statistics and infos. Multiple lines!
+
+Example:
+-------
+
+cat /debug/pktcdvd/pktcdvd0/info
Documentation/ABI/testing/sysfs-class-pktcdvd new file +72 -0

72 lines not on this page · raw message

Documentation/cdrom/packet-writing.txt +35 -0
index 3d44c56..7715d22 100644
@@ -90,6 +90,41 @@ Notes
   to create an ext2 filesystem on the disc.
 
 
+Using the pktcdvd sysfs interface
+---------------------------------
+
+Since Linux 2.6.19, the pktcdvd module has a sysfs interface
+and can be controlled by it. For example the "pktcdvd" tool uses
+this interface. (see http://people.freenet.de/BalaGi#pktcdvd )
+
+"pktcdvd" works similar to "pktsetup", e.g.:
+
+	# pktcdvd -a dev_name /dev/hdc
+	# mkudffs /dev/pktcdvd/dev_name
+	# mount -t udf -o rw,noatime /dev/pktcdvd/dev_name /dvdram
+	# cp files /dvdram
+	# umount /dvdram
+	# pktcdvd -r dev_name
+
+
+For a description of the sysfs interface look into the file:
+
+  Documentation/ABI/testing/sysfs-block-pktcdvd
+
+
+Using the pktcdvd debugfs interface
+-----------------------------------
+
+To read pktcdvd device infos in human readable form, do:
+
+	# cat /debug/pktcdvd/pktcdvd[0-7]/info
+
+For a description of the debugfs interface look into the file:
+
+  Documentation/ABI/testing/debugfs-pktcdvd
+
+
+
 Links
 -----
 
drivers/block/pktcdvd.c +439 -4

500 lines not on this page · raw message

include/linux/pktcdvd.h +17 -1
index 9b1a185..5ea4f05 100644
@@ -111,7 +111,8 @@ #ifdef __KERNEL__
 #include <linux/blkdev.h>
 #include <linux/completion.h>
 #include <linux/cdrom.h>
-
+#include <linux/kobject.h>
+#include <linux/sysfs.h>
 
 /* default bio write queue congestion marks */
 #define PKT_WRITE_CONGESTION_ON    10000
@@ -247,6 +248,14 @@ struct packet_stacked_data
 };
 #define PSD_POOL_SIZE		64
 
+struct pktcdvd_kobj
+{
+	struct kobject		kobj;
+	struct pktcdvd_device	*pd;
+};
+#define to_pktcdvdkobj(_k) \
+  ((struct pktcdvd_kobj*)container_of(_k,struct pktcdvd_kobj,kobj))
+
 struct pktcdvd_device
 {
 	struct block_device	*bdev;		/* dev attached */
@@ -280,6 +289,13 @@ struct pktcdvd_device
 
 	int			write_congestion_off;
 	int			write_congestion_on;
+
+	struct class_device	*clsdev;	/* sysfs pktcdvd[0-7] class dev */
+	struct pktcdvd_kobj	*kobj_stat;	/* sysfs pktcdvd[0-7]/stat/     */
+	struct pktcdvd_kobj	*kobj_wqueue;	/* sysfs pktcdvd[0-7]/write_queue/ */
+
+	struct dentry		*dfs_d_root;	/* debugfs: devname directory */
+	struct dentry		*dfs_f_info;	/* debugfs: info file */
 };
 
 #endif /* __KERNEL__ */
Signature · 2 lines
Peter Osterlund - [email protected]
http://web.telia.com/~u89404340