mirror of
https://github.com/armbian/linux.git
synced 2026-01-06 10:13:00 -08:00
[PATCH] pktcdvd: add sysfs and debugfs interface
Add a sysfs and debugfs interface to the pktcdvd driver. Look into the Documentation/ABI/testing/* files in the patch for more info. Signed-off-by: Thomas Maier <balagi@justmail.de> Signed-off-by: Peter Osterlund <petero2@telia.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
committed by
Linus Torvalds
parent
0a0fc9601d
commit
32694850a9
20
Documentation/ABI/testing/debugfs-pktcdvd
Normal file
20
Documentation/ABI/testing/debugfs-pktcdvd
Normal file
@@ -0,0 +1,20 @@
|
||||
What: /debug/pktcdvd/pktcdvd[0-7]
|
||||
Date: Oct. 2006
|
||||
KernelVersion: 2.6.19
|
||||
Contact: Thomas Maier <balagi@justmail.de>
|
||||
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
|
||||
72
Documentation/ABI/testing/sysfs-class-pktcdvd
Normal file
72
Documentation/ABI/testing/sysfs-class-pktcdvd
Normal file
@@ -0,0 +1,72 @@
|
||||
What: /sys/class/pktcdvd/
|
||||
Date: Oct. 2006
|
||||
KernelVersion: 2.6.19
|
||||
Contact: Thomas Maier <balagi@justmail.de>
|
||||
Description:
|
||||
|
||||
sysfs interface
|
||||
---------------
|
||||
|
||||
The pktcdvd module (packet writing driver) creates
|
||||
these files in the sysfs:
|
||||
(<devid> is in format major:minor )
|
||||
|
||||
/sys/class/pktcdvd/
|
||||
add (0200) Write a block device id (major:minor)
|
||||
to create a new pktcdvd device and map
|
||||
it to the block device.
|
||||
|
||||
remove (0200) Write the pktcdvd device id (major:minor)
|
||||
to it to remove the pktcdvd device.
|
||||
|
||||
device_map (0444) Shows the device mapping in format:
|
||||
pktcdvd[0-7] <pktdevid> <blkdevid>
|
||||
|
||||
/sys/class/pktcdvd/pktcdvd[0-7]/
|
||||
dev (0444) Device id
|
||||
uevent (0200) To send an uevent.
|
||||
|
||||
/sys/class/pktcdvd/pktcdvd[0-7]/stat/
|
||||
packets_started (0444) Number of started packets.
|
||||
packets_finished (0444) Number of finished packets.
|
||||
|
||||
kb_written (0444) kBytes written.
|
||||
kb_read (0444) kBytes read.
|
||||
kb_read_gather (0444) kBytes read to fill write packets.
|
||||
|
||||
reset (0200) Write any value to it to reset
|
||||
pktcdvd device statistic values, like
|
||||
bytes read/written.
|
||||
|
||||
/sys/class/pktcdvd/pktcdvd[0-7]/write_queue/
|
||||
size (0444) Contains the size of the bio write
|
||||
queue.
|
||||
|
||||
congestion_off (0644) If bio write queue size is below
|
||||
this mark, accept new bio requests
|
||||
from the block layer.
|
||||
|
||||
congestion_on (0644) If bio write queue size is higher
|
||||
as this mark, do no longer accept
|
||||
bio write requests from the block
|
||||
layer and wait till the pktcdvd
|
||||
device has processed enough bio's
|
||||
so that bio write queue size is
|
||||
below congestion off mark.
|
||||
A value of <= 0 disables congestion
|
||||
control.
|
||||
|
||||
|
||||
Example:
|
||||
--------
|
||||
To use the pktcdvd sysfs interface directly, you can do:
|
||||
|
||||
# create a new pktcdvd device mapped to /dev/hdc
|
||||
echo "22:0" >/sys/class/pktcdvd/add
|
||||
cat /sys/class/pktcdvd/device_map
|
||||
# assuming device pktcdvd0 was created, look at stat's
|
||||
cat /sys/class/pktcdvd/pktcdvd0/stat/kb_written
|
||||
# print the device id of the mapped block device
|
||||
fgrep pktcdvd0 /sys/class/pktcdvd/device_map
|
||||
# remove device, using pktcdvd0 device id 253:0
|
||||
echo "253:0" >/sys/class/pktcdvd/remove
|
||||
@@ -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
|
||||
-----
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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__ */
|
||||
|
||||
Reference in New Issue
Block a user