[patch] no-PROCFS and/or no-SYSCTL [was Re: [PARPORT] parport requires procfs for linux 2.1.123 to link]


Andrea Arcangeli (andrea@e-mind.com)
Mon, 12 Oct 1998 16:34:51 +0200 (CEST)


On Sat, 10 Oct 1998, David Campbell wrote:

>I have just noticed that parport in Linux 2.1.123 requires procfs to allow the
>kernel to link. Perhaps a few #ifdef in the following files are required:
>
>drivers/misc/parport_init.c
>drivers/misc/parport_pc.c
>drivers/misc/parport_ax.c
>
>I know that it is unlikely for anyone to build a kernel without /proc support but
>it could happen.

This patch should fix the no-PROCFS and/or no-SYSCTL cases.

It' s against clean 2.1.125.

Andrea Arcangeli

Index: linux/drivers/misc/parport_arc.c
diff -u linux/drivers/misc/parport_arc.c:1.1.1.1 linux/drivers/misc/parport_arc.c:1.1.1.1.10.1
--- linux/drivers/misc/parport_arc.c:1.1.1.1 Fri Oct 2 19:23:33 1998
+++ linux/drivers/misc/parport_arc.c Mon Oct 12 15:08:54 1998
@@ -136,7 +136,9 @@
 
         printk(KERN_INFO "%s: Archimedes on-board port, using irq %d\n",
                p->irq);
+#ifdef CONFIG_PROC_FS
         parport_proc_register(p);
+#endif
         p->flags |= PARPORT_FLAG_COMA;
 
         if (parport_probe_hook)
Index: linux/drivers/misc/parport_ax.c
diff -u linux/drivers/misc/parport_ax.c:1.1.1.1 linux/drivers/misc/parport_ax.c:1.1.1.1.10.1
--- linux/drivers/misc/parport_ax.c:1.1.1.1 Fri Oct 2 19:23:33 1998
+++ linux/drivers/misc/parport_ax.c Mon Oct 12 15:08:54 1998
@@ -588,7 +588,9 @@
                 printmode(ECPPS2);
         }
         printk("]\n");
+#ifdef CONFIG_PROC_FS
         parport_proc_register(p);
+#endif
         p->flags |= PARPORT_FLAG_COMA;
 
         p->ops->write_control(p, 0x0c);
@@ -631,7 +633,9 @@
                 if (p->modes & PARPORT_MODE_PCSPP) {
                         if (!(p->flags & PARPORT_FLAG_COMA))
                                 parport_quiesce(p);
+#ifdef CONFIG_PROC_FS
                         parport_proc_unregister(p);
+#endif
                         parport_unregister_port(p);
                 }
                 p = tmp;
Index: linux/drivers/misc/parport_init.c
diff -u linux/drivers/misc/parport_init.c:1.1.1.1 linux/drivers/misc/parport_init.c:1.1.1.1.10.1
--- linux/drivers/misc/parport_init.c:1.1.1.1 Fri Oct 2 19:23:33 1998
+++ linux/drivers/misc/parport_init.c Mon Oct 12 15:08:54 1998
@@ -98,13 +98,17 @@
 #ifdef MODULE
 int init_module(void)
 {
+#ifdef CONFIG_PROC_FS
         (void)parport_proc_init(); /* We can go on without it. */
+#endif
         return 0;
 }
 
 void cleanup_module(void)
 {
+#ifdef CONFIG_PROC_FS
         parport_proc_cleanup();
+#endif
 }
 #else
 __initfunc(int parport_init(void))
@@ -115,7 +119,9 @@
 #ifdef CONFIG_PNP_PARPORT
         parport_probe_hook = &parport_probe_one;
 #endif
+#ifdef CONFIG_PROC_FS
         parport_proc_init();
+#endif
 #ifdef CONFIG_PARPORT_PC
         parport_pc_init(io, irq, dma);
 #endif
@@ -139,8 +145,10 @@
 EXPORT_SYMBOL(parport_enumerate);
 EXPORT_SYMBOL(parport_ieee1284_nibble_mode_ok);
 EXPORT_SYMBOL(parport_wait_peripheral);
+#ifdef CONFIG_PROC_FS
 EXPORT_SYMBOL(parport_proc_register);
 EXPORT_SYMBOL(parport_proc_unregister);
+#endif
 EXPORT_SYMBOL(parport_probe_hook);
 EXPORT_SYMBOL(parport_parse_irqs);
 
Index: linux/drivers/misc/parport_pc.c
diff -u linux/drivers/misc/parport_pc.c:1.1.1.1 linux/drivers/misc/parport_pc.c:1.1.1.1.10.1
--- linux/drivers/misc/parport_pc.c:1.1.1.1 Fri Oct 2 19:23:33 1998
+++ linux/drivers/misc/parport_pc.c Mon Oct 12 15:08:54 1998
@@ -759,9 +759,11 @@
         }
 #undef printmode
         printk("]\n");
+#ifdef CONFIG_PROC_FS
         if (probedirq != PARPORT_IRQ_NONE)
                 printk("%s: detected irq %d; use procfs to enable interrupt-driven operation.\n", p->name, probedirq);
         parport_proc_register(p);
+#endif
         p->flags |= PARPORT_FLAG_COMA;
 
         /* Done probing. Now put the port into a sensible start-up state. */
@@ -825,7 +827,9 @@
                 if (p->modes & PARPORT_MODE_PCSPP) {
                         if (!(p->flags & PARPORT_FLAG_COMA))
                                 parport_quiesce(p);
+#ifdef CONFIG_PROC_FS
                         parport_proc_unregister(p);
+#endif
                         parport_unregister_port(p);
                 }
                 p = tmp;
Index: linux/drivers/pci/pcisyms.c
diff -u linux/drivers/pci/pcisyms.c:1.1.1.1 linux/drivers/pci/pcisyms.c:1.1.1.1.10.1
--- linux/drivers/pci/pcisyms.c:1.1.1.1 Fri Oct 2 19:23:27 1998
+++ linux/drivers/pci/pcisyms.c Mon Oct 12 15:08:57 1998
@@ -28,8 +28,10 @@
 EXPORT_SYMBOL(pci_find_device);
 EXPORT_SYMBOL(pci_find_slot);
 EXPORT_SYMBOL(pci_set_master);
+#ifdef CONFIG_PROC_FS
 EXPORT_SYMBOL(pci_proc_attach_device);
 EXPORT_SYMBOL(pci_proc_detach_device);
+#endif
 
 /* Backward compatibility */
 
Index: linux/fs/proc/procfs_syms.c
diff -u linux/fs/proc/procfs_syms.c:1.1.1.1 linux/fs/proc/procfs_syms.c:1.1.1.1.10.1
--- linux/fs/proc/procfs_syms.c:1.1.1.1 Fri Oct 2 19:22:36 1998
+++ linux/fs/proc/procfs_syms.c Mon Oct 12 15:44:16 1998
@@ -13,7 +13,9 @@
 extern struct inode_operations proc_scsi_inode_operations;
 extern struct proc_dir_entry proc_sys_root;
 
+#ifdef CONFIG_SYSCTL
 EXPORT_SYMBOL(proc_sys_root);
+#endif
 EXPORT_SYMBOL(proc_register);
 EXPORT_SYMBOL(proc_unregister);
 EXPORT_SYMBOL(create_proc_entry);
Index: linux/kernel/sysctl.c
diff -u linux/kernel/sysctl.c:1.1.1.2 linux/kernel/sysctl.c:1.1.1.2.2.1
--- linux/kernel/sysctl.c:1.1.1.2 Fri Oct 9 17:44:10 1998
+++ linux/kernel/sysctl.c Mon Oct 12 15:08:58 1998
@@ -34,7 +34,7 @@
 #include <linux/nfs_fs.h>
 #endif
 
-#if defined(CONFIG_SYSCTL) && defined(CONFIG_PROC_FS)
+#if defined(CONFIG_SYSCTL)
 
 /* External variables not in a header file. */
 extern int panic_timeout;
@@ -125,11 +125,11 @@
 
 extern struct proc_dir_entry proc_sys_root;
 
-extern int inodes_stat[];
-extern int dentry_stat[];
 static void register_proc_table(ctl_table *, struct proc_dir_entry *);
 static void unregister_proc_table(ctl_table *, struct proc_dir_entry *);
 #endif
+extern int inodes_stat[];
+extern int dentry_stat[];
 
 /* The default sysctl tables: */
 
@@ -866,14 +866,14 @@
 
 #else /* CONFIG_PROC_FS */
 
-int proc_dointvec_jiffies(ctl_table *table, int write, struct file *filp,
- void *buffer, size_t *lenp)
+int proc_dostring(ctl_table *table, int write, struct file *filp,
+ void *buffer, size_t *lenp)
 {
- return -ENOSYS;
+ return -ENOSYS;
 }
 
-int proc_dostring(ctl_table *table, int write, struct file *filp,
- void *buffer, size_t *lenp)
+static int proc_doutsstring(ctl_table *table, int write, struct file *filp,
+ void *buffer, size_t *lenp)
 {
         return -ENOSYS;
 }
@@ -1053,7 +1053,7 @@
 }
 
 
-#else /* CONFIG_PROC_FS && CONFIG_SYSCTL */
+#else /* CONFIG_SYSCTL */
 
 
 extern asmlinkage int sys_sysctl(struct __sysctl_args *args)
@@ -1108,8 +1108,5 @@
 void unregister_sysctl_table(struct ctl_table_header * table)
 {
 }
-
-#endif /* CONFIG_PROC_FS && CONFIG_SYSCTL */
-
-
 
+#endif /* CONFIG_SYSCTL */
Index: linux/net/ipv4/ip_masq.c
diff -u linux/net/ipv4/ip_masq.c:1.1.1.2 linux/net/ipv4/ip_masq.c:1.1.1.2.2.1
--- linux/net/ipv4/ip_masq.c:1.1.1.2 Fri Oct 9 17:44:21 1998
+++ linux/net/ipv4/ip_masq.c Mon Oct 12 15:08:59 1998
@@ -2149,6 +2149,14 @@
         return ret;
 }
 
+/*
+ * Wrapper over inet_select_addr()
+ */
+u32 ip_masq_select_addr(struct device *dev, u32 dst, int scope)
+{
+ return inet_select_addr(dev, dst, scope);
+}
+
 #ifdef CONFIG_PROC_FS
 static struct proc_dir_entry *proc_net_ip_masq = NULL;
 
@@ -2175,14 +2183,6 @@
         IP_MASQ_DEBUG(1, "unregistering \"/proc/net/ip_masq/%s\" entry\n",
                         ent->name);
         proc_unregister(proc_net_ip_masq, ent->low_ino);
-}
-
-/*
- * Wrapper over inet_select_addr()
- */
-u32 ip_masq_select_addr(struct device *dev, u32 dst, int scope)
-{
- return inet_select_addr(dev, dst, scope);
 }
 
 __initfunc(static void masq_proc_init(void))

-- To unsubscribe, send mail to: linux-parport-request@torque.net --
-- with the single word "unsubscribe" in the body of the message. --



This archive was generated by hypermail 2.0b3 on Wed 30 Dec 1998 - 10:18:34 EST