diff -urpN p1-driver-name/drivers/block/Kconfig p2-procfs/drivers/block/Kconfig --- p1-driver-name/drivers/block/Kconfig 2006-10-01 16:13:14.000000000 +0200 +++ p2-procfs/drivers/block/Kconfig 2006-10-01 16:39:47.000000000 +0200 @@ -458,6 +458,21 @@ config CDROM_PKTCDVD_WCACHE this option is dangerous unless the CD-RW media is known good, as we don't do deferred write error handling yet. +config CDROM_PKTCDVD_PROCINTF + bool "Enable procfs interface" + depends on CDROM_PKTCDVD + default y + help + Enable the proc filesystem interface for pktcdvd. + The files can be found as: + + /proc/driver/pktcdvd/pktcdvd + + Also a misc device is added with a dynamic minor device id. + See the entry in /proc/misc for the minor number. + The misc pktcdvd driver supports ioctl calls, needed + by the pktsetup tool found in udftools package. + source "drivers/s390/block/Kconfig" config ATA_OVER_ETH diff -urpN p1-driver-name/drivers/block/pktcdvd.c p2-procfs/drivers/block/pktcdvd.c --- p1-driver-name/drivers/block/pktcdvd.c 2006-10-01 16:11:31.000000000 +0200 +++ p2-procfs/drivers/block/pktcdvd.c 2006-10-01 18:11:35.000000000 +0200 @@ -1,6 +1,7 @@ /* * Copyright (C) 2000 Jens Axboe * Copyright (C) 2001-2004 Peter Osterlund + * Copyright (C) 2006 Thomas Maier * * May be copied or modified under the terms of the GNU General Public * License. See linux/COPYING for more information. @@ -51,15 +52,18 @@ #include #include #include -#include #include -#include #include #include #include #include #include +#if PKT_USE_PROCFS +#include +#include +#endif + #include #define DRIVER_NAME "pktcdvd" @@ -81,7 +85,9 @@ #define ZONE(sector, pd) (((sector) + (pd)->offset) & ~((pd)->settings.size - 1)) static struct pktcdvd_device *pkt_devs[MAX_WRITERS]; +#if PKT_USE_PROCFS static struct proc_dir_entry *pkt_proc; +#endif static int pkt_major; static struct mutex ctl_mutex; /* Serialize open/close/setup/teardown */ static mempool_t *psd_pool; @@ -2241,6 +2247,7 @@ static void pkt_init_queue(struct pktcdv q->queuedata = pd; } +#if PKT_USE_PROCFS static int pkt_seq_show(struct seq_file *m, void *p) { struct pktcdvd_device *pd = m->private; @@ -2311,13 +2318,13 @@ static struct file_operations pkt_proc_f .llseek = seq_lseek, .release = single_release }; +#endif /* PKT_USE_PROCFS */ static int pkt_new_dev(struct pktcdvd_device *pd, dev_t dev) { int i; int ret = 0; char b[BDEVNAME_SIZE]; - struct proc_dir_entry *proc; struct block_device *bdev; if (pd->pkt_dev == dev) { @@ -2361,11 +2368,16 @@ static int pkt_new_dev(struct pktcdvd_de goto out_mem; } - proc = create_proc_entry(pd->name, 0, pkt_proc); - if (proc) { - proc->data = pd; - proc->proc_fops = &pkt_proc_fops; +#if PKT_USE_PROCFS + { + struct proc_dir_entry *proc = create_proc_entry(pd->name, + 0, pkt_proc); + if (proc) { + proc->data = pd; + proc->proc_fops = &pkt_proc_fops; + } } +#endif DPRINTK(DRIVER_NAME": writer %s mapped to %s\n", pd->name, bdevname(bdev, b)); return 0; @@ -2534,7 +2546,9 @@ static int pkt_remove_dev(struct pkt_ctr blkdev_put(pd->bdev); +#if PKT_USE_PROCFS remove_proc_entry(pd->name, pkt_proc); +#endif DPRINTK(DRIVER_NAME": writer %s unmapped\n", pd->name); del_gendisk(pd->disk); @@ -2550,6 +2564,7 @@ static int pkt_remove_dev(struct pkt_ctr return 0; } +#if PKT_USE_PROCFS static void pkt_get_status(struct pkt_ctrl_command *ctrl_cmd) { struct pktcdvd_device *pd = pkt_find_dev_from_minor(ctrl_cmd->dev_index); @@ -2615,11 +2630,14 @@ static struct miscdevice pkt_misc = { .name = DRIVER_NAME, .fops = &pkt_ctl_fops }; +#endif /* PKT_USE_PROCFS */ static int __init pkt_init(void) { int ret; + mutex_init(&ctl_mutex); + psd_pool = mempool_create_kmalloc_pool(PSD_POOL_SIZE, sizeof(struct packet_stacked_data)); if (!psd_pool) @@ -2633,15 +2651,14 @@ static int __init pkt_init(void) if (!pkt_major) pkt_major = ret; +#if PKT_USE_PROCFS ret = misc_register(&pkt_misc); if (ret) { printk(DRIVER_NAME": Unable to register misc device\n"); goto out; } - - mutex_init(&ctl_mutex); - pkt_proc = proc_mkdir(DRIVER_NAME, proc_root_driver); +#endif return 0; @@ -2654,14 +2671,17 @@ out2: static void __exit pkt_exit(void) { +#if PKT_USE_PROCFS remove_proc_entry(DRIVER_NAME, proc_root_driver); misc_deregister(&pkt_misc); +#endif unregister_blkdev(pkt_major, DRIVER_NAME); mempool_destroy(psd_pool); } MODULE_DESCRIPTION("Packet writing layer for CD/DVD drives"); -MODULE_AUTHOR("Jens Axboe "); +MODULE_AUTHOR("Jens Axboe ,Peter Osterlund ," + "Thomas Maier "); MODULE_LICENSE("GPL"); module_init(pkt_init); diff -urpN p1-driver-name/include/linux/pktcdvd.h p2-procfs/include/linux/pktcdvd.h --- p1-driver-name/include/linux/pktcdvd.h 2006-10-01 16:13:14.000000000 +0200 +++ p2-procfs/include/linux/pktcdvd.h 2006-10-01 17:38:22.000000000 +0200 @@ -112,6 +112,13 @@ struct pkt_ctrl_command { #include #include +/* use (old) procfs interface? */ +#ifdef CONFIG_CDROM_PKTCDVD_PROCINTF +#define PKT_USE_PROCFS 1 +#else +#define PKT_USE_PROCFS 0 +#endif + struct packet_settings { __u32 size; /* packet size in (512 byte) sectors */