All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Thomas Maier" <balagi@justmail.de>
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: "petero2@telia.com" <petero2@telia.com>, akpm@osdl.org
Subject: [PATCH 2/4] 2.6.18-mm2 pktcdvd: make procfs interface optional
Date: Sun, 01 Oct 2006 20:54:01 +0200	[thread overview]
Message-ID: <op.tgrasbjeiudtyh@master> (raw)

[-- Attachment #1: Type: text/plain, Size: 662 bytes --]

Hi,

this patch 2/4 for pktcdvd against Linux 2.6.18 (stable)
or 2.6.18-mm2 makes the procfs interface optional. A new kernel
config parameter is added: CDROM_PKTCDVD_PROCINTF
(Of course, you can not use pktcdvd if there is no procfs
interface. Wait for patch 4/4 that adds the sysfs interface ;)

You must first apply patch 1/4 !

Sorry, my mail client damages the patch, so please use the (text) attachment
or get the patch from
http://people.freenet.de/BalaGi/download/2-procfs-pktcdvd-patch-2.6.18

The merged patch (parts 1 to 4) is available at:
http://people.freenet.de/BalaGi/download/pktcdvd-patch-2.6.18

Signed-off-by: Thomas Maier<balagi@justmail.de>

[-- Attachment #2: 2-procfs-pktcdvd-patch-2.6.18 --]
[-- Type: application/octet-stream, Size: 5692 bytes --]

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<idx>
+	  
+	  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 <axboe@suse.de>
  * Copyright (C) 2001-2004 Peter Osterlund <petero2@telia.com>
+ * Copyright (C) 2006 Thomas Maier <balagi@justmail.de>
  *
  * 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 <linux/errno.h>
 #include <linux/spinlock.h>
 #include <linux/file.h>
-#include <linux/proc_fs.h>
 #include <linux/seq_file.h>
-#include <linux/miscdevice.h>
 #include <linux/suspend.h>
 #include <linux/mutex.h>
 #include <scsi/scsi_cmnd.h>
 #include <scsi/scsi_ioctl.h>
 #include <scsi/scsi.h>
 
+#if PKT_USE_PROCFS
+#include <linux/proc_fs.h>
+#include <linux/miscdevice.h>
+#endif
+
 #include <asm/uaccess.h>
 
 #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 <axboe@suse.de>");
+MODULE_AUTHOR("Jens Axboe <axboe@suse.de>,Peter Osterlund <petero2@telia.com>,"
+              "Thomas Maier <balagi@justmail.de>");
 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 <linux/completion.h>
 #include <linux/cdrom.h>
 
+/* 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 */

             reply	other threads:[~2006-10-01 18:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-01 18:54 Thomas Maier [this message]
2006-10-02 21:55 ` [PATCH 2/4] 2.6.18-mm2 pktcdvd: make procfs interface optional Peter Osterlund

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=op.tgrasbjeiudtyh@master \
    --to=balagi@justmail.de \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=petero2@telia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.