[PATCH] mark ftape un-removable
From: Christoph Hellwig
Date: Wed Feb 18 2004 - 09:27:03 EST
I've just grepped over the tree for reamining MOD_INC_USE_COUNT users,
and ftape is a really horrible one, it relies on MOD_{INC,DEV}_USE_COUNT
in the most horrible places + it's own bookkepping and the <= 2.4 may
unload hooks. And although I don't have the hardware I can guarantee it
doesn't work as expected.
So let's just remove the module_exit handler and mark it unremovable,
if someone wants to fix up ftape later it's fine with me, but it's
a really scary driver..
--- 1.8/drivers/char/ftape/compressor/zftape-compress.c Mon Feb 3 21:19:37 2003
+++ edited/drivers/char/ftape/compressor/zftape-compress.c Sun Oct 5 16:13:32 2003
@@ -59,8 +59,6 @@
/* local variables
*/
-static int keep_module_locked = 1;
-
static void *zftc_wrk_mem = NULL;
static __u8 *zftc_buf = NULL;
static void *zftc_scratch_buf = NULL;
@@ -267,10 +265,6 @@
static void zftc_lock(void)
{
- MOD_INC_USE_COUNT; /* sets MOD_VISITED and MOD_USED_ONCE,
- * locking is done with can_unload()
- */
- keep_module_locked = 1;
}
/* this function is needed for zftape_reset_position in zftape-io.c
@@ -281,7 +275,6 @@
memset((void *)&cseg, '\0', sizeof(cseg));
zftc_stats();
- keep_module_locked = 0;
TRACE_EXIT;
}
@@ -554,10 +547,6 @@
int buf_pos_write = pos->seg_byte_pos;
TRACE_FUN(ft_t_flow);
- keep_module_locked = 1;
- MOD_INC_USE_COUNT; /* sets MOD_VISITED and MOD_USED_ONCE,
- * locking is done with can_unload()
- */
/* Note: we do not unlock the module because
* there are some values cached in that `cseg' variable. We
* don't don't want to use this information when being
@@ -675,10 +664,6 @@
int remaining = to_do;
TRACE_FUN(ft_t_flow);
- keep_module_locked = 1;
- MOD_INC_USE_COUNT; /* sets MOD_VISITED and MOD_USED_ONCE,
- * locking is done with can_unload()
- */
TRACE_CATCH(zft_allocate_cmpr_mem(volume->blk_sz),);
if (pos->seg_byte_pos == 0) {
/* new segment just read
@@ -799,10 +784,6 @@
int fast_seek_trials = 0;
TRACE_FUN(ft_t_flow);
- keep_module_locked = 1;
- MOD_INC_USE_COUNT; /* sets MOD_VISITED and MOD_USED_ONCE,
- * locking is done with can_unload()
- */
if (new_block_pos == 0) {
pos->seg_pos = volume->start_seg;
pos->seg_byte_pos = 0;
@@ -1221,31 +1202,7 @@
*/
int init_module(void)
{
- int result;
-
-#if 0 /* FIXME --RR */
- if (!mod_member_present(&__this_module, can_unload))
- return -EBUSY;
- __this_module.can_unload = can_unload;
-#endif
- result = zft_compressor_init();
- keep_module_locked = 0;
- return result;
+ return zft_compressor_init();
}
-/* Called by modules package when removing the driver
- */
-void cleanup_module(void)
-{
- TRACE_FUN(ft_t_flow);
-
- if (zft_cmpr_unregister() != &cmpr_ops) {
- TRACE(ft_t_info, "failed");
- } else {
- TRACE(ft_t_info, "successful");
- }
- zftc_cleanup();
- printk(KERN_INFO "zft-compressor successfully unloaded.\n");
- TRACE_EXIT;
-}
#endif /* MODULE */
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/