Re: Tentative patch: modularized disk partition systems in 2.3.99-pre2-5

From: Pavel Machek (pavel@suse.cz)
Date: Sun Mar 19 2000 - 15:44:17 EST


Hi!

> This patch should allow the disk partition handlers to be
> compiled as loadable modules. The patch also has the side effect
> of simplifying fs/partitions/Makefile. At this point, I can

That side effect is nice, but the patch itself is ugly.

> +static struct partition_ops initial_part_ops[] = {
> #ifdef CONFIG_ACORN_PARTITION
> - acorn_partition,
> + {acorn_partition, NULL},
> #endif

Killing this ugly static table, and

> --- /dev/null Sat Jul 17 14:59:27 1999
> +++ linux/fs/partitions/partition_module.c Sat Mar 18 18:50:15 2000
> @@ -0,0 +1,27 @@
> +/* Copyright 2000 Yggdrasil Computing, Inc.
> + Written by Adam J. Richter
> +
> + This file may be copied under the terms and conditions of version
> + 2 of the GNU General Public License, as published by the Free
> + Software Foundation (Cambridge, Massachussetts, USA).
> +*/
> +
> +#ifdef MODULE
> +static struct partition_ops ops = {
> + partition_check,
> + NULL
> +};
> +
> +int
> +init_module(void)
> +{
> + register_partition_ops(&ops);
> + return 0;
> +}
> +
> +void
> +cleanup_module(void)
> +{
> + unregister_partition_ops(&ops);
> +}
> +#endif /* MODULE */

Using this even for non-modular case? Take a look at acm.c driver, how
this is nicely possible. Oh, and you better hide partition_module.c
into some header file, and add "PARTITION_MODULE(name)" onto end of
each partition module, instead of using ugly including of C files.
                                                                Pavel

-- 
I'm pavel@ucw.cz. "In my country we have almost anarchy and I don't care."
Panos Katsaloulis describing me w.r.t. patents me at discuss@linmodems.org

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Mar 23 2000 - 21:00:29 EST