Patch against 2.1.105.
===================================================================
RCS file: linux/drivers/cdrom/cdrom.c,v
retrieving revision 1.1
diff -u -r1.1 linux/drivers/cdrom/cdrom.c
--- linux/drivers/cdrom/cdrom.c 1998/06/12 16:46:05 1.1
+++ linux/drivers/cdrom/cdrom.c 1998/06/12 20:04:03
@@ -71,6 +71,9 @@
of bytes not copied. I was returning whatever non-zero stuff came back from
the copy_*_user functions directly, which would result in strange errors.
+ Jun 12, 1998 -- Andrea Arcangeli <arcangeli@mbox.queen.it>
+ -- Fixed the procfs-unload-module bug with the fill_inode procfs callback.
+
-------------------------------------------------------------------------*/
#define REVISION "Revision: 2.12"
@@ -104,6 +107,7 @@
#include <linux/malloc.h>
#include <linux/cdrom.h>
#include <linux/sysctl.h>
+#include <linux/proc_fs.h>
#include <asm/fcntl.h>
#include <asm/segment.h>
#include <asm/uaccess.h>
@@ -1028,9 +1032,26 @@
static struct ctl_table_header *cdrom_sysctl_header;
+/*
+ * This is called as the fill_inode function when an inode
+ * is going into (fill = 1) or out of service (fill = 0).
+ * We use it here to manage the module use counts.
+ *
+ * Note: only the top-level directory needs to do this; if
+ * a lower level is referenced, the parent will be as well.
+ */
+static void cdrom_procfs_modcount(struct inode *inode, int fill)
+{
+ if (fill)
+ MOD_INC_USE_COUNT;
+ else
+ MOD_DEC_USE_COUNT;
+}
+
static void cdrom_sysctl_register(void)
{
cdrom_sysctl_header = register_sysctl_table(cdrom_root_table, 0);
+ cdrom_root_table->de->fill_inode = &cdrom_procfs_modcount;
}
static void cdrom_sysctl_unregister(void)
Andrea[s] Arcangeli
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu