dm-log(2nd): cleanup dirty log external interface from members with only internal scope
PATCH 1/1 dm-log(2nd): cleanup dirty log external interface from members with only internal scope
From: Heinz Mauelshagen <[email protected]>
Alasdair,
this patch (overhauled based on our discussion) cleans the dirty log external interface up from members with only internal scope, such as list, name, module, ctr, dtr. It is based on your 'editing' header patches.
In order to keep the above members out of dm-log.h, I created a header dm-log-internal.h, which shall stay in drivers/md to be included by any external dirty log module, whereas dm-log.h shall be moved to include/linux.
Please apply,
Heinz
Signed-off-by Heinz Mauelshagen <[email protected]>
--- drivers/md/dm-log-internal.h | 52 ++++++++ drivers/md/dm-log.c | 264 +++++++++++++++++++++++++++--------------- drivers/md/dm-log.h | 33 ++---- drivers/md/dm-raid1.c | 42 ++++---- 4 files changed, 254 insertions(+), 137 deletions(-) create mode 100644 drivers/md/dm-log-internal.h
drivers/md/dm-log-internal.h new file +52 -0
@@ -0,0 +1,52 @@ +/* +* Copyright (C) 2008 Red Hat, Inc. All rights reserved. +* +* Device-Mapper dirty region log internal structures and uinterface. +* +* This file is released under the LGPL. +*/ + +#ifndef _LINUX_DM_DIRTY_LOG_INTERNAL_H +#define _LINUX_DM_DIRTY_LOG_INTERNAL_H + +#ifdef __KERNEL__ + +#include <linux/types.h> +#include <linux/device-mapper.h> +#include "dm-log.h" + +/* Operations for dirty log creation/destruction. */ +struct dm_dirty_log_type_ops { +int (*ctr)(struct dm_dirty_log *log,struct dm_target *ti, +unsigned argc,char **argv); +void (*dtr)(struct dm_dirty_log *log); +}; + +/* Registration relevant data. */ +struct dm_registry_type { +struct list_head list; +const char *name; +struct module *module; +unsigned use_count; +}; + +/* +* Internal dirty log type representation. +*/ +struct dirty_log_type { +struct dm_registry_type registry; + +/* Internal type operations (i.e. ctr and dtr). */ +struct dm_dirty_log_type_ops t_ops; + +/* External operations. */ +struct dm_dirty_log_ops l_ops; +}; + +/* Register/unregister a dirty log handler. */ +int dm_dirty_log_type_register (struct dirty_log_type *type); +int dm_dirty_log_type_unregister (const char *type_name); + + +#endif /* __KERNEL__ */ +#endif /* _LINUX_DM_DIRTY_LOG_INTERNAL_H */
drivers/md/dm-log.c +173 -91
453 lines not on this page · raw message
drivers/md/dm-log.h +8 -25
@@ -2,13 +2,13 @@* Copyright (C) 2003 Sistina Software * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. * -* Device-Mapper dirty region log. +* Device-Mapper dirty region log external structure and interface. * * This file is released under the LGPL. */ -#ifndef _LINUX_DM_DIRTY_LOG -#define _LINUX_DM_DIRTY_LOG +#ifndef _LINUX_DM_DIRTY_LOG_H +#define _LINUX_DM_DIRTY_LOG_H#ifdef __KERNEL__
@@ -17,23 +17,15 @@typedef sector_t region_t ; -struct dm_dirty_log_type ; - +/* A dirty log handle. */ struct dm_dirty_log { -struct dm_dirty_log_type *type; +struct dm_dirty_log_ops *l_ops;void *context; }; -struct dm_dirty_log_type { -struct list_head list; -const char *name; -struct module *module; -unsigned use_count; - -int (*ctr)(struct dm_dirty_log *log,struct dm_target *ti, -unsigned argc,char **argv); -void (*dtr)(struct dm_dirty_log *log); +/* Operations of a dirty log handler type. */ +struct dm_dirty_log_ops {/* * There are times when we don't want the log to touch * the disk.
@@ -117,23 +109,14 @@ struct dm_dirty_log_type { char *result, unsigned maxlen); }; -int dm_dirty_log_type_register (struct dm_dirty_log_type *type); -int dm_dirty_log_type_unregister (struct dm_dirty_log_type *type); -/* * Make sure you use these two functions, rather than calling -* type->constructor/destructor() directly. +* type_ops->ctr/dtr() directly. */ struct dm_dirty_log *dm_dirty_log_create (const char *type_name,struct dm_target *ti,unsigned argc,char **argv);void dm_dirty_log_destroy (struct dm_dirty_log *log); -/* -* init/exit functions. -*/ -int dm_dirty_log_init (void ); -void dm_dirty_log_exit (void ); -#endif /* __KERNEL__ */ #endif /* _LINUX_DM_DIRTY_LOG_H */
drivers/md/dm-raid1.c +21 -21
159 lines not on this page · raw message
Signature · 1 line
1.5.4.1