diff options
-rw-r--r-- | lib/evms/ChangeLog | 5 | ||||
-rw-r--r-- | lib/evms/Makefile.in | 8 | ||||
-rw-r--r-- | lib/evms/common.h | 280 | ||||
-rw-r--r-- | lib/evms/dlist.h | 8 | ||||
-rw-r--r-- | lib/evms/enginestructs.h | 20 | ||||
-rw-r--r-- | lib/evms/evms_common.h | 161 | ||||
-rw-r--r-- | lib/evms/evms_ioctl.h | 297 | ||||
-rw-r--r-- | lib/evms/evms_user.h | 28 | ||||
-rw-r--r-- | lib/evms/fs_ext2.c | 50 | ||||
-rw-r--r-- | lib/evms/options.h | 4 | ||||
-rw-r--r-- | lib/evms/plugfuncs.h | 562 |
11 files changed, 646 insertions, 777 deletions
diff --git a/lib/evms/ChangeLog b/lib/evms/ChangeLog index bc353409..42bb840f 100644 --- a/lib/evms/ChangeLog +++ b/lib/evms/ChangeLog @@ -1,3 +1,8 @@ +2002-08-17 Theodore Ts'o <tytso@mit.edu> + + * common.h, dlist.h, enginestructs.h, options.h, plugfuncs.c, + fs_ext2.c: Synchronize with ABI of EVMS 1.1. + 2002-06-01 <tytso@thunk.org> * fs_ext2.c (fs_init_task): Fix minor bugs pointed out by Steve diff --git a/lib/evms/Makefile.in b/lib/evms/Makefile.in index cd3ced96..0248c3f0 100644 --- a/lib/evms/Makefile.in +++ b/lib/evms/Makefile.in @@ -6,7 +6,7 @@ my_dir = lib/evms INSTALL = @INSTALL@ MAJOR_VERSION = 1 -MINOR_VERSION = 0 +MINOR_VERSION = 1 PATCH_LEVEL = 0 EXTRAVERSION = @@ -49,10 +49,8 @@ distclean:: clean # the Makefile.in file # fs_ext2.o: $(srcdir)/fs_ext2.c $(srcdir)/plugin.h $(srcdir)/dlist.h \ - $(srcdir)/common.h $(srcdir)/evms_user.h $(srcdir)/evms_common.h \ - $(srcdir)/evms_ioctl.h $(srcdir)/options.h $(srcdir)/enginestructs.h \ + $(srcdir)/common.h $(srcdir)/options.h $(srcdir)/enginestructs.h \ $(srcdir)/plugfuncs.h $(srcdir)/fsimext2.h fsimext2.o: $(srcdir)/fsimext2.c $(srcdir)/plugin.h $(srcdir)/dlist.h \ - $(srcdir)/common.h $(srcdir)/evms_user.h $(srcdir)/evms_common.h \ - $(srcdir)/evms_ioctl.h $(srcdir)/options.h $(srcdir)/enginestructs.h \ + $(srcdir)/common.h $(srcdir)/options.h $(srcdir)/enginestructs.h \ $(srcdir)/plugfuncs.h $(srcdir)/fsimext2.h diff --git a/lib/evms/common.h b/lib/evms/common.h index bf3af43a..f134389f 100644 --- a/lib/evms/common.h +++ b/lib/evms/common.h @@ -22,17 +22,158 @@ #ifndef EVMS_COMMON_H_INCLUDED #define EVMS_COMMON_H_INCLUDED 1 +#include <stdlib.h> +#include <stdint.h> #include <linux/types.h> /* will pull in platform specific data type info from linux/include/asm */ - -/* Need these to satisfy dependencies in evms_user.h - * on systems running a 2.5.8 or newer kernel. +#include <linux/major.h> /* For EVMS_MAJOR */ + +typedef __u8 u8; +typedef __u16 u16; +typedef __u32 u32; +typedef __u64 u64; + +/* version info */ +#define EVMS_MAJOR_VERSION 1 +#define EVMS_MINOR_VERSION 1 +#define EVMS_PATCHLEVEL_VERSION 0 + +#define MAX_EVMS_VOLUMES 256 /* There are 256 minors */ +#define EVMS_VOLUME_NAME_SIZE 127 + +#define IBM_OEM_ID 8112 // could be anything, but used + // I=8, B=1, M=12 +// this one going away as well. +#define EVMS_OEM_IBM IBM_OEM_ID + +#define EVMS_INITIAL_CRC 0xFFFFFFFF +#define EVMS_MAGIC_CRC 0x31415926 + +#define EVMS_VSECTOR_SIZE 512 +#define EVMS_VSECTOR_SIZE_SHIFT 9 + +#define DEV_PATH "/dev" +#define EVMS_DIR_NAME "evms" +#define EVMS_DEV_NAME "block_device" +#define EVMS_DEV_NODE_PATH DEV_PATH "/" EVMS_DIR_NAME "/" +#define EVMS_DEVICE_NAME DEV_PATH "/" EVMS_DIR_NAME "/" EVMS_DEV_NAME + +/* EVMS will always use 64-bit fields */ +typedef u_int64_t evms_sector_t; + +/* EVMS specific device handle type definition */ +typedef u_int64_t evms_dev_handle_t; + +typedef struct evms_version { + /* major changes when incompatible differences are introduced */ + u_int32_t major; + /* minor changes when additions are made */ + u_int32_t minor; + /* patchlevel changes when bugs are fixed */ + u_int32_t patchlevel; +} evms_version_t; + +typedef enum evms_plugin_code { + EVMS_NO_PLUGIN, // 0 + EVMS_DEVICE_MANAGER, // 1 + EVMS_SEGMENT_MANAGER, // 2 + EVMS_REGION_MANAGER, // 3 + EVMS_FEATURE, // 4 + EVMS_ASSOCIATIVE_FEATURE, // 5 + EVMS_FILESYSTEM_INTERFACE_MODULE, // 6 + EVMS_CLUSTER_MANAGER_INTERFACE_MODULE, // 7 + EVMS_DISTRIBUTED_LOCK_MANAGER_INTERFACE_MODULE // 8 +} evms_plugin_code_t; + +#define SetPluginID(oem, type, id) ((oem << 16) | (type << 12) | id) +#define GetPluginOEM(pluginid) (pluginid >> 16) +#define GetPluginType(pluginid) ((pluginid >> 12) & 0xf) +#define GetPluginID(pluginid) (pluginid & 0xfff) + +/* bit definitions for the flags field in + * the EVMS LOGICAL NODE (kernel) and + * the EVMS LOGICAL VOLUME (user) structures. */ -typedef __u8 u8; -typedef __u16 u16; -typedef __u32 u32; -typedef __u64 u64; - -#include <evms/evms_user.h> +#define EVMS_FLAGS_WIDTH 32 +#define EVMS_VOLUME_FLAG (1<<0) +#define EVMS_VOLUME_PARTIAL_FLAG (1<<1) +#define EVMS_VOLUME_PARTIAL (1<<1) +#define EVMS_VOLUME_SET_READ_ONLY (1<<2) +#define EVMS_VOLUME_READ_ONLY (1<<2) + +/* queued flags bits */ +#define EVMS_REQUESTED_DELETE (1<<5) +#define EVMS_REQUESTED_QUIESCE (1<<6) +#define EVMS_REQUESTED_VFS_QUIESCE (1<<7) + +/* this bit indicates corruption */ +#define EVMS_VOLUME_CORRUPT (1<<8) + +/* these bits define the source of the corruption */ +#define EVMS_VOLUME_SOFT_DELETED (1<<9) +#define EVMS_DEVICE_UNAVAILABLE (1<<10) + +/* these bits define volume status */ +#define EVMS_MEDIA_CHANGED (1<<20) +#define EVMS_DEVICE_UNPLUGGED (1<<21) + +/* these bits used for removable status */ +#define EVMS_DEVICE_MEDIA_PRESENT (1<<24) +#define EVMS_DEVICE_PRESENT (1<<25) +#define EVMS_DEVICE_LOCKABLE (1<<26) +#define EVMS_DEVICE_REMOVABLE (1<<27) + +/* version info for evms_feature_header_t */ +#define EVMS_FEATURE_HEADER_MAJOR 3 +#define EVMS_FEATURE_HEADER_MINOR 0 +#define EVMS_FEATURE_HEADER_PATCHLEVEL 0 + +/* bit definitions of FEATURE HEADER bits in the FLAGS field */ +#define EVMS_FEATURE_ACTIVE (1<<0) +#define EVMS_FEATURE_VOLUME_COMPLETE (1<<1) + +/* bit definitions for VOLUME bits in the FLAGS field */ +#define EVMS_VOLUME_DATA_OBJECT (1<<16) +#define EVMS_VOLUME_DATA_STOP (1<<17) + +#define EVMS_FEATURE_HEADER_SIGNATURE 0x54414546 // "FEAT" +typedef struct evms_feature_header { +/* 0*/ + u_int32_t signature; +/* 4*/ u_int32_t crc; +/* 8*/ evms_version_t version; + /* structure version */ +/* 20*/ evms_version_t engine_version; + /* version of the Engine that */ + /* wrote this feature header */ +/* 32*/ u_int32_t flags; +/* 36*/ u_int32_t feature_id; +/* 40*/ u_int64_t sequence_number; +/* 48*/ u_int64_t alignment_padding; + //required: starting lsn to 1st copy of feature's metadata. +/* 56*/ evms_sector_t feature_data1_start_lsn; +/* 64*/ evms_sector_t feature_data1_size; + //in 512 byte units + //optional: starting lsn to 2nd copy of feature's metadata. + // if unused set size field to 0. +/* 72*/ evms_sector_t feature_data2_start_lsn; +/* 80*/ evms_sector_t feature_data2_size; + //in 512 byte units +/* 88*/ u_int64_t volume_serial_number; +/* 96*/ u_int32_t volume_system_id; + /* the minor is stored here */ +/*100*/ u_int32_t object_depth; + /* depth of object in the volume tree */ +/*104*/ char object_name[EVMS_VOLUME_NAME_SIZE + 1]; +/*232*/ char volume_name[EVMS_VOLUME_NAME_SIZE + 1]; +/*360*/ unsigned char pad[152]; +/*512*/ +} evms_feature_header_t; + +/* EVMS specific error codes */ +#define EVMS_FEATURE_FATAL_ERROR 257 +#define EVMS_VOLUME_FATAL_ERROR 258 + +#define EVMS_FEATURE_INCOMPLETE_ERROR 259 /* Defines for storage object names */ #define EVMS_NAME_SIZE EVMS_VOLUME_NAME_SIZE @@ -48,6 +189,7 @@ typedef __u64 u64; #define SOFLAG_BIOS_READABLE (1<<7) #define SOFLAG_MUST_BE_VOLUME (1<<8) #define SOFLAG_NOT_CLAIMED (1<<9) +#define SOFLAG_WRITE_STOP_DATA (1<<10) /* Defines for flags in the storage_container_t structure */ #define SCFLAG_DIRTY (1<<0) @@ -67,11 +209,12 @@ typedef __u64 u64; #define VOLFLAG_EXPAND_FS (1<<10) #define VOLFLAG_SHRINK_FS (1<<11) #define VOLFLAG_SYNC_FS (1<<12) +#define VOLFLAG_PROBE_FS (1<<13) /* A BOOLEAN variable is one which is either TRUE or FALSE. */ #ifndef BOOLEAN_DEFINED #define BOOLEAN_DEFINED 1 - typedef u_int8_t BOOLEAN; +typedef unsigned char BOOLEAN; #endif #ifndef TRUE @@ -82,14 +225,13 @@ typedef __u64 u64; #endif /* - * Logical Sector Number: This is a physical sector address on a - * system drive. + * Logical Sector Number: This is a physical sector address on a system drive. */ typedef u_int64_t lsn_t; /* - * Logical Block Address: This is a sector address on a volume which - * will be translated to a Logical Sector Number. + * Logical Block Address: This is a sector address on a volume which will be + * translated to a Logical Sector Number. */ typedef u_int64_t lba_t; @@ -106,7 +248,7 @@ typedef u_int64_t sector_count_t; typedef void * module_handle_t; /* - * The standard data type for Engine handles. + * The standard data type for Engine handles */ typedef u_int32_t engine_handle_t; @@ -131,7 +273,7 @@ typedef u_int32_t plugin_id_t; typedef u_int8_t plugin_type_t; /* - * The various modes in which the Engine can be. + * The various modes in which the Engine can be */ typedef enum { ENGINE_CLOSED = 0, @@ -151,6 +293,76 @@ typedef struct geometry_s { u_int64_t block_size; } geometry_t; + +/* + * Definitions and structures for progress indicators. + */ +typedef enum { + DISPLAY_PERCENT = 0, /* Display the progress as a percentage. */ + /* This is the default display mode. */ + DISPLAY_COUNT, /* Display the progress as a count. */ + INDETERMINATE /* Progress cannot be measured with a count */ + /* of items. Progress is simply "working". */ +} progress_type_t; + +typedef struct progress_s { + /* + * The plug-in MUST set id to zero on the first call. An id of zero + * tells the UI to start a new progress indicator. The UI MUST set the + * id field to a nonzero number that is unique from any other progress + * indicators that may be in effect. + */ + uint id; + + /* Short title for the progress indicator */ + char * title; + + /* Longer description of the task that is in progress */ + char * description; + + /* Type of progress indicator */ + progress_type_t type; + + /* + * Current number of items completed. The plug-in should set count to + * zero on the first call. + */ + uint count; + + /* + * Total number of items to be completed. The UI uses count/total_count + * to calculate the percent complete. On the plug-in's last call to + * update the progress it MUST set count >= total_count. When the UI + * gets a call for progress and count >= total_count, it knows it is the + * last call and closes the progress indicator. + */ + uint total_count; + + /* + * The plug-in may provide an estimate of how many seconds it will take + * to complete the operation, but it is not required. If the plug-in is + * not providing a time estimate it MUST set remaining_seconds to zero. + * + * The plug-in may update remaining_seconds on subsequent calls for + * progress. If the plug-in does not provide a time estimate, the UI + * may provide one based on the time elapsed between the calls to update + * the progress and the numbers in the count and total_count fields. + */ + uint remaining_seconds; + + /* + * A place for the plug-in to store any data relating to this progress + * indicator. + */ + void * plugin_private_data; + + /* + * A place for the UI to store any data relating to this progress + * indicator. + */ + void * ui_private_data; +} progress_t; + /* * The data types which a storage object can be. */ @@ -226,34 +438,34 @@ typedef enum { WARNING = 3, /* - * Use DEFAULT for informational messages that do not indicate problems, or - * that a problem occurred but there was a work-around. DEFAULT messages - * should be things that the user would usually want to know during any run - * of the Engine, such as how many volumes were discovered on the system, - * and not necessarily what a developer would want to know (use DETAILS or - * DEBUG for that). Since DEFAULT is the default debug level, be careful - * not to put DEFAULT messages in loops or frequently executed code as they - * will bloat the log file. + * Use DEFAULT for informational messages that do not indicate problems, + * or that a problem occurred but there was a work-around. DEFAULT + * messages should be things that the user would usually want to know + * during any run of the Engine, such as how many volumes were discovered + * on the system, and not necessarily what a developer would want to know + * (use DETAILS or DEBUG for that). Since DEFAULT is the default debug + * level, be careful not to put DEFAULT messages in loops or frequently + * executed code as they will bloat the log file. */ DEFAULT = 5, /* - * Use DETAILS to provide more detailed information about the system. The - * message may provide additional information about the progress of the - * system. It may contain more information about a DEFAULT message or more - * information about an error condition. + * Use DETAILS to provide more detailed information about the system. + * The message may provide additional information about the progress of + * the system. It may contain more information about a DEFAULT message + * or more information about an error condition. */ DETAILS = 6, /* - * Use DEBUG for messages that would help debug a problem, such as tracing - * code paths or dumping the contents of variables. + * Use DEBUG for messages that would help debug a problem, such as + * tracing code paths or dumping the contents of variables. */ DEBUG = 7, /* - * Use EXTRA to provided more information than your standard debug messages - * provide. + * Use EXTRA to provided more information than your standard debug + * messages provide. */ EXTRA = 8, @@ -264,8 +476,8 @@ typedef enum { ENTRY_EXIT = 9, /* - * Use EVERYTHING for all manner of verbose output. Feel free to bloat the - * log file with any messages that would help you debug a problem. + * Use EVERYTHING for all manner of verbose output. Feel free to bloat + * the log file with any messages that would help you debug a problem. */ EVERYTHING = 10 diff --git a/lib/evms/dlist.h b/lib/evms/dlist.h index fd20a72a..a5aa2036 100644 --- a/lib/evms/dlist.h +++ b/lib/evms/dlist.h @@ -147,12 +147,12 @@ #define DLISTHANDLER 1 -#include <linux/types.h> /* will pull in platform specific data type info from linux/include/asm */ +#include <stdlib.h> #include <errno.h> #ifndef BOOLEAN_DEFINED #define BOOLEAN_DEFINED 1 - typedef u_int8_t BOOLEAN; + typedef unsigned char BOOLEAN; #endif typedef void * ADDRESS; @@ -292,8 +292,8 @@ typedef enum _Insertion_Modes { /* */ /*********************************************************************/ dlist_t CreateList(uint InitialPoolSize, - uint MaximumPoolSize, - uint PoolIncrement); + uint MaximumPoolSize, + uint PoolIncrement); #else diff --git a/lib/evms/enginestructs.h b/lib/evms/enginestructs.h index f74d5bbb..c0c8a8db 100644 --- a/lib/evms/enginestructs.h +++ b/lib/evms/enginestructs.h @@ -26,7 +26,6 @@ #include <dlist.h> #include <common.h> #include <options.h> -#include <evms/evms_user.h> struct plugin_functions_s; struct fsim_functions_s; @@ -48,8 +47,23 @@ typedef struct plugin_record_s { /* used only by the Engine */ plugin_id_t id; /* Plug-in's ID */ evms_version_t version; /* Plug-in's version */ +#ifdef ABI_EVMS_1_0 evms_version_t required_api_version; /* Version of the Engine plug-in API */ /* that the plug-in requires */ +#else + evms_version_t required_engine_api_version; + /* Version of the Engine services API */ + /* that the plug-in requires */ + union { + evms_version_t plugin; /* Version of the Engine plug-in API */ + /* that the plug-in requires */ + evms_version_t fsim; /* Version of the Engine FSIM API */ + /* that the FSIM plug-in requires */ + } required_plugin_api_version; + evms_version_t required_container_api_version; + /* Version of the Engine container API */ + /* that the plug-in requires */ +#endif so_record_t * so_record; /* Record for the shared object from */ /* which the plug-in was loaded */ char * short_name; @@ -146,6 +160,10 @@ typedef struct logical_volume_s { u_int64_t serial_number; /* Volume's serial number */ u_int32_t flags; /* Defined by VOLFLAG_???? defines */ void * private_data; /* Private data pointer for FSIMs. */ +#ifndef ABI_EVMS_1_0 + void * original_fsim_private_data; + /* Private data of original FSIM. */ +#endif char name[EVMS_VOLUME_NAME_SIZE+1]; /* Volume name, filled in by the Engine */ #ifndef ABI_EVMS_1_0 diff --git a/lib/evms/evms_common.h b/lib/evms/evms_common.h deleted file mode 100644 index 28249eac..00000000 --- a/lib/evms/evms_common.h +++ /dev/null @@ -1,161 +0,0 @@ -/* -*- linux-c -*- */ -/* - * - * Copyright (c) International Business Machines Corp., 2000 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -/* - * linux/include/linux/evms/evms_common.h - * - * EVMS common (kernel and user) header file - * - */ - -#ifndef __EVMS_COMMON_INCLUDED__ -#define __EVMS_COMMON_INCLUDED__ - -/* version info */ -#define EVMS_MAJOR 63 /* use experimental major 63 for now */ -#define EVMS_MAJOR_VERSION 1 -#define EVMS_MINOR_VERSION 1 -#define EVMS_PATCHLEVEL_VERSION 0 - -#define MAX_EVMS_VOLUMES 256 /* There are 256 minors */ -#define EVMS_VOLUME_NAME_SIZE 127 - -#define IBM_OEM_ID 8112 // could be anything, but used - // I=8, B=1, M=12 -// this one going away as well. -#define EVMS_OEM_IBM IBM_OEM_ID - -#define EVMS_INITIAL_CRC 0xFFFFFFFF -#define EVMS_MAGIC_CRC 0x31415926 - -#define EVMS_VSECTOR_SIZE 512 -#define EVMS_VSECTOR_SIZE_SHIFT 9 - -#define DEV_PATH "/dev" -#define EVMS_DIR_NAME "evms" -#define EVMS_DEV_NAME "block_device" -#define EVMS_DEV_NODE_PATH DEV_PATH "/" EVMS_DIR_NAME "/" -#define EVMS_DEVICE_NAME DEV_PATH "/" EVMS_DIR_NAME "/" EVMS_DEV_NAME - -/* EVMS will always use 64-bit fields */ -typedef u_int64_t evms_sector_t; - -/* EVMS specific device handle type definition */ -typedef u_int64_t evms_dev_handle_t; - -typedef struct evms_version_s { - /* major changes when incompatible differences are introduced */ - u_int32_t major; - /* minor changes when additions are made */ - u_int32_t minor; - /* patchlevel changes when bugs are fixed */ - u_int32_t patchlevel; -} evms_version_t; - -typedef enum evms_plugin_code_s { - EVMS_NO_PLUGIN, // 0 - EVMS_DEVICE_MANAGER, // 1 - EVMS_SEGMENT_MANAGER, // 2 - EVMS_REGION_MANAGER, // 3 - EVMS_FEATURE, // 4 - EVMS_ASSOCIATIVE_FEATURE, // 5 - EVMS_FILESYSTEM_INTERFACE_MODULE, // 6 - EVMS_CLUSTER_MANAGER_INTERFACE_MODULE, // 7 - EVMS_DISTRIBUTED_LOCK_MANAGER_INTERFACE_MODULE // 8 -} evms_plugin_code_t; - -#define SetPluginID(oem, type, id) ((oem << 16) | (type << 12) | id) -#define GetPluginOEM(pluginid) (pluginid >> 16) -#define GetPluginType(pluginid) ((pluginid >> 12) & 0xf) -#define GetPluginID(pluginid) (pluginid & 0xfff) - -/* bit definitions for the flags field in - * the EVMS LOGICAL NODE (kernel) and - * the EVMS LOGICAL VOLUME (user) structures. - */ -#define EVMS_FLAGS_WIDTH 32 -#define EVMS_VOLUME_FLAG (1<<0) -#define EVMS_VOLUME_PARTIAL_FLAG (1<<1) -#define EVMS_VOLUME_PARTIAL (1<<1) -#define EVMS_VOLUME_SET_READ_ONLY (1<<2) -#define EVMS_VOLUME_READ_ONLY (1<<2) -/* queued flags bits */ -#define EVMS_REQUESTED_DELETE (1<<5) -#define EVMS_REQUESTED_QUIESCE (1<<6) -#define EVMS_REQUESTED_VFS_QUIESCE (1<<7) -/* this bit indicates corruption */ -#define EVMS_VOLUME_CORRUPT (1<<8) -/* these bits define the source of the corruption */ -#define EVMS_VOLUME_SOFT_DELETED (1<<9) -#define EVMS_DEVICE_UNAVAILABLE (1<<10) -/* these bits define volume status */ -#define EVMS_MEDIA_CHANGED (1<<20) -#define EVMS_DEVICE_UNPLUGGED (1<<21) -/* these bits used for removable status */ -#define EVMS_DEVICE_MEDIA_PRESENT (1<<24) -#define EVMS_DEVICE_PRESENT (1<<25) -#define EVMS_DEVICE_LOCKABLE (1<<26) -#define EVMS_DEVICE_REMOVABLE (1<<27) - -/* version info for evms_feature_header_t */ -#define EVMS_FEATURE_HEADER_MAJOR 3 -#define EVMS_FEATURE_HEADER_MINOR 0 -#define EVMS_FEATURE_HEADER_PATCHLEVEL 0 - -/* bit definitions of FEATURE HEADER bits in the FLAGS field */ -#define EVMS_FEATURE_ACTIVE (1<<0) -#define EVMS_FEATURE_VOLUME_COMPLETE (1<<1) -/* bit definitions for VOLUME bits in the FLAGS field */ -#define EVMS_VOLUME_DATA_OBJECT (1<<16) -#define EVMS_VOLUME_DATA_STOP (1<<17) - -#define EVMS_FEATURE_HEADER_SIGNATURE 0x54414546 //FEAT -typedef struct evms_feature_header_s { -/* 0*/ u_int32_t signature; -/* 4*/ u_int32_t crc; -/* 8*/ evms_version_t version; /* structure version */ -/* 20*/ evms_version_t engine_version; /* version of the Engine that */ - /* wrote this feature header */ -/* 32*/ u_int32_t flags; -/* 36*/ u_int32_t feature_id; -/* 40*/ u_int64_t sequence_number; -/* 48*/ u_int64_t alignment_padding; - //required: starting lsn to 1st copy of feature's metadata. -/* 56*/ evms_sector_t feature_data1_start_lsn; -/* 64*/ evms_sector_t feature_data1_size; //in 512 byte units - //optional: starting lsn to 2nd copy of feature's metadata. - // if unused set size field to 0. -/* 72*/ evms_sector_t feature_data2_start_lsn; -/* 80*/ evms_sector_t feature_data2_size; //in 512 byte units -/* 88*/ u_int64_t volume_serial_number; -/* 96*/ u_int32_t volume_system_id; /* the minor is stored here */ -/*100*/ u_int32_t object_depth; /* depth of object in the volume tree */ -/*104*/ char object_name[EVMS_VOLUME_NAME_SIZE+1]; -/*232*/ char volume_name[EVMS_VOLUME_NAME_SIZE+1]; -/*360*/ unsigned char pad[152]; -/*512*/ -} evms_feature_header_t; - -/* EVMS specific error codes */ -#define EVMS_FEATURE_FATAL_ERROR 257 -#define EVMS_VOLUME_FATAL_ERROR 258 - -#define EVMS_FEATURE_INCOMPLETE_ERROR 259 - -#endif diff --git a/lib/evms/evms_ioctl.h b/lib/evms/evms_ioctl.h deleted file mode 100644 index 11315494..00000000 --- a/lib/evms/evms_ioctl.h +++ /dev/null @@ -1,297 +0,0 @@ -/* -*- linux-c -*- */ -/* - * - * Copyright (c) International Business Machines Corp., 2000 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -/* - * linux/include/linux/evms.h - * - * EVMS public kernel header file - * - */ - -#ifndef __EVMS_IOCTL_INCLUDED__ -#define __EVMS_IOCTL_INCLUDED__ - -#include <linux/hdreg.h> - -/* IOCTL interface version definitions */ -#define EVMS_IOCTL_INTERFACE_MAJOR 10 -#define EVMS_IOCTL_INTERFACE_MINOR 0 -#define EVMS_IOCTL_INTERFACE_PATCHLEVEL 0 - -/* IOCTL definitions */ -typedef enum evms_ioctl_cmds_s { - /* version commands */ - EVMS_GET_IOCTL_VERSION_NUMBER = 0, - EVMS_GET_VERSION_NUMBER, -#ifdef __KERNEL__ - /* EVMS internal commands */ - EVMS_GET_DISK_LIST_NUMBER = 0x40, - EVMS_CHECK_MEDIA_CHANGE_NUMBER, - EVMS_REVALIDATE_DISK_NUMBER, - EVMS_OPEN_VOLUME_NUMBER, - EVMS_CLOSE_VOLUME_NUMBER, - EVMS_QUIESCE_VOLUME_NUMBER, - EVMS_CHECK_DEVICE_STATUS_NUMBER, -#endif - /* configuration commands */ - EVMS_GET_INFO_LEVEL_NUMBER = 0x80, - EVMS_SET_INFO_LEVEL_NUMBER, - EVMS_REDISCOVER_VOLUMES_NUMBER, - EVMS_DELETE_VOLUME_NUMBER, - EVMS_PLUGIN_IOCTL_NUMBER, - EVMS_PROCESS_NOTIFY_EVENT_NUMBER, - /* query info commands */ - EVMS_GET_LOGICAL_DISK_NUMBER = 0xC0, - EVMS_GET_LOGICAL_DISK_INFO_NUMBER, - EVMS_SECTOR_IO_NUMBER, - EVMS_GET_MINOR_NUMBER, - EVMS_GET_VOLUME_DATA_NUMBER, - EVMS_GET_PLUGIN_NUMBER, - EVMS_COMPUTE_CSUM_NUMBER, - EVMS_GET_BMAP_NUMBER, -} evms_ioctl_cmds_t; - -/* version commands */ -#define EVMS_GET_IOCTL_VERSION_STRING "EVMS_GET_IOCTL_VERSION" -#define EVMS_GET_IOCTL_VERSION _IOR(EVMS_MAJOR, EVMS_GET_IOCTL_VERSION_NUMBER, evms_version_t) - -#define EVMS_GET_VERSION_STRING "EVMS_GET_VERSION" -#define EVMS_GET_VERSION _IOR(EVMS_MAJOR, EVMS_GET_VERSION_NUMBER, evms_version_t) - -#ifdef __KERNEL__ - -/* EVMS internal commands */ -#define EVMS_GET_DISK_LIST_STRING "EVMS_GET_DISK_LIST" -#define EVMS_GET_DISK_LIST _IOWR(EVMS_MAJOR, EVMS_GET_DISK_LIST_NUMBER, evms_list_node_t **) - -#define EVMS_CHECK_MEDIA_CHANGE_STRING "EVMS_CHECK_MEDIA_CHANGE" -#define EVMS_CHECK_MEDIA_CHANGE _IO(EVMS_MAJOR, EVMS_CHECK_MEDIA_CHANGE_NUMBER) - -#define EVMS_REVALIDATE_DISK_STRING "EVMS_REVALIDATE_DISK" -#define EVMS_REVALIDATE_DISK _IO(EVMS_MAJOR, EVMS_REVALIDATE_DISK_NUMBER) - -#define EVMS_OPEN_VOLUME_STRING "EVMS_OPEN_VOLUME" -#define EVMS_OPEN_VOLUME _IO(EVMS_MAJOR, EVMS_OPEN_VOLUME_NUMBER) - -#define EVMS_CLOSE_VOLUME_STRING "EVMS_CLOSE_VOLUME" -#define EVMS_CLOSE_VOLUME _IO(EVMS_MAJOR, EVMS_CLOSE_VOLUME_NUMBER) - -/* field: command: defines */ -#define EVMS_UNQUIESCE 0 -#define EVMS_QUIESCE 1 - -/* field: do_vfs: defines */ -/* see evms_delete_volume */ -typedef struct evms_quiesce_volume_s { - int command; /* 0 = unquiesce, 1 = quiesce */ - int minor; /* minor device number of target volume */ - int do_vfs; /* 0 = do nothing, 1 = also perform equivalent VFS operation */ - int status; /* 0 = success */ -} evms_quiesce_volume_t; - -#define EVMS_QUIESCE_VOLUME_STRING "EVMS_QUIESCE_VOLUME" -#define EVMS_QUIESCE_VOLUME _IOR(EVMS_MAJOR, EVMS_QUIESCE_VOLUME_NUMBER, evms_quiesce_volume_t) - -#define EVMS_CHECK_DEVICE_STATUS_STRING "EVMS_CHECK_DEVICE_STATUS" -#define EVMS_CHECK_DEVICE_STATUS _IOR(EVMS_MAJOR, EVMS_CHECK_DEVICE_STATUS_NUMBER, int) - -#endif - -/* configuration commands */ -#define EVMS_GET_INFO_LEVEL_STRING "EVMS_GET_INFO_LEVEL" -#define EVMS_GET_INFO_LEVEL _IOR(EVMS_MAJOR, EVMS_GET_INFO_LEVEL_NUMBER, int) - -#define EVMS_SET_INFO_LEVEL_STRING "EVMS_SET_INFO_LEVEL" -#define EVMS_SET_INFO_LEVEL _IOW(EVMS_MAJOR, EVMS_SET_INFO_LEVEL_NUMBER, int) - -/* field: drive_count: defines */ -#define REDISCOVER_ALL_DEVICES 0xFFFFFFFF -typedef struct evms_rediscover_s { - int status; - unsigned int drive_count; /* 0xffffffff = rediscover all known disks */ - unsigned long *drive_array; -} evms_rediscover_t; - -#define EVMS_REDISCOVER_VOLUMES_STRING "EVMS_REDISCOVER_VOLUMES" -#define EVMS_REDISCOVER_VOLUMES _IOWR(EVMS_MAJOR, EVMS_REDISCOVER_VOLUMES_NUMBER, evms_rediscover_t) - -/* field: command: defines */ -#define EVMS_SOFT_DELETE 0 -#define EVMS_HARD_DELETE 1 - -/* field: do_vfs: defines */ -#define EVMS_VFS_DO_NOTHING 0 -#define EVMS_VFS_DO 1 -typedef struct evms_delete_volume_s { - int command; /* 0 = "temp", 1 = "permanent" */ - int minor; /* minor device number of target volume */ - int do_vfs; /* 0 = do nothing, 1 = perform VFS operations */ - int associative_minor; /* optional minor of associative volume */ - /* must be 0 when not in use */ - int status; /* 0 = success, other is error */ -} evms_delete_volume_t; - -#define EVMS_DELETE_VOLUME_STRING "EVMS_DELETE_VOLUME" -#define EVMS_DELETE_VOLUME _IOR(EVMS_MAJOR, EVMS_DELETE_VOLUME_NUMBER, evms_delete_volume_t) - -typedef struct evms_plugin_ioctl_s { - unsigned long feature_id; /* ID of feature to receive this ioctl */ - int feature_command; /* feature specific ioctl command */ - int status; /* 0 = completed, non-0 = error */ - void *feature_ioctl_data; /* ptr to feature specific struct */ -} evms_plugin_ioctl_t; - -#define EVMS_PLUGIN_IOCTL_STRING "EVMS_PLUGIN_IOCTL" -#define EVMS_PLUGIN_IOCTL _IOR(EVMS_MAJOR, EVMS_PLUGIN_IOCTL_NUMBER, evms_plugin_ioctl_t) - -/* field: eventid: defines */ -#define EVMS_EVENT_END_OF_DISCOVERY 0 -typedef struct evms_event_s { - int pid; /* PID to act on */ - int eventid; /* event id to respond to */ - int signo; /* signal # to send when event occurs */ -} evms_event_t; - -/* field: command: defines */ -#define EVMS_EVENT_UNREGISTER 0 -#define EVMS_EVENT_REGISTER 1 -typedef struct evms_notify_s { - int command; /* 0 = unregister, 1 = register */ - evms_event_t eventry; /* event structure */ - int status; /* return status */ -} evms_notify_t; - -#define EVMS_PROCESS_NOTIFY_EVENT_STRING "EVMS_PROCESS_NOTIFY_EVENT" -#define EVMS_PROCESS_NOTIFY_EVENT _IOWR(EVMS_MAJOR, EVMS_PROCESS_NOTIFY_EVENT_NUMBER, evms_notify_t) - -/* query info commands */ - -/* field: command: defines */ -#define EVMS_FIRST_DISK 0 -#define EVMS_NEXT_DISK 1 - -/* field: status: defines */ -#define EVMS_DISK_INVALID 0 -#define EVMS_DISK_VALID 1 -typedef struct evms_user_disk_s { - int command; /* 0 = first disk, 1 = next disk */ - int status; /* 0 = no more disks, 1 = valid disk info */ - unsigned long disk_handle; /* only valid when status == 1 */ -} evms_user_disk_t; - -#define EVMS_GET_LOGICAL_DISK_STRING "EVMS_GET_LOGICAL_DISK" -#define EVMS_GET_LOGICAL_DISK _IOWR(EVMS_MAJOR, EVMS_GET_LOGICAL_DISK_NUMBER, evms_user_disk_t) - -/* flags fields described in evms_common.h */ -typedef struct evms_user_disk_info_s { - unsigned int status; - unsigned int flags; - unsigned long disk_handle; - unsigned int disk_dev; - struct hd_geometry geometry; - unsigned int block_size; - unsigned int hardsect_size; - u_int64_t total_sectors; - char disk_name[EVMS_VOLUME_NAME_SIZE]; -} evms_user_disk_info_t; - -#define EVMS_GET_LOGICAL_DISK_INFO_STRING "EVMS_GET_LOGICAL_DISK_INFO" -#define EVMS_GET_LOGICAL_DISK_INFO _IOWR(EVMS_MAJOR, EVMS_GET_LOGICAL_DISK_INFO_NUMBER, evms_user_disk_info_t) - -/* field: io_flag: defines */ -#define EVMS_SECTOR_IO_READ 0 -#define EVMS_SECTOR_IO_WRITE 1 -typedef struct evms_sector_io_s { - unsigned long disk_handle; /* valid disk handle */ - int io_flag; /* 0 = READ, 1 = WRITE */ - evms_sector_t starting_sector; /* disk relative LBA */ - evms_sector_t sector_count; /* number of sectors in IO */ - unsigned char *buffer_address; /* IO address */ - int status; /* 0 = success, not 0 = error */ -} evms_sector_io_t; - -#define EVMS_SECTOR_IO_STRING "EVMS_SECTOR_IO" -#define EVMS_SECTOR_IO _IOWR(EVMS_MAJOR, EVMS_SECTOR_IO_NUMBER, evms_sector_io_t) - -/* field: command: defines */ -#define EVMS_FIRST_VOLUME 0 -#define EVMS_NEXT_VOLUME 1 - -/* field: status: defines */ -#define EVMS_VOLUME_INVALID 0 -#define EVMS_VOLUME_VALID 1 -typedef struct evms_user_minor_s { - int command; /* 0 = first volume, 1 = next volume */ - int status; /* 0 = no more, 1 = valid info */ - int minor; /* only valid when status == 1 */ -} evms_user_minor_t; - -#define EVMS_GET_MINOR_STRING "EVMS_GET_MINOR" -#define EVMS_GET_MINOR _IOWR(EVMS_MAJOR, EVMS_GET_MINOR_NUMBER, evms_user_minor_t) - -/* flags field described in evms_common.h */ -typedef struct evms_volume_data_s { - int minor; /* minor of target volume */ - int flags; - char volume_name[EVMS_VOLUME_NAME_SIZE + 1]; - int status; -} evms_volume_data_t; - -#define EVMS_GET_VOLUME_DATA_STRING "EVMS_GET_VOLUME_DATA" -#define EVMS_GET_VOLUME_DATA _IOWR(EVMS_MAJOR, EVMS_GET_VOLUME_DATA_NUMBER, evms_volume_data_t) - -/* field: command: defines */ -#define EVMS_FIRST_PLUGIN 0 -#define EVMS_NEXT_PLUGIN 1 - -/* field: status: defines */ -#define EVMS_PLUGIN_INVALID 0 -#define EVMS_PLUGIN_VALID 1 -typedef struct evms_kernel_plugin_s { - int command; /* 0 = first item, 1 = next item */ - u_int32_t id; /* returned plugin id */ - evms_version_t version; /* maj,min,patch of plugin */ - int status; /* 0 = no more, 1 = valid info */ -} evms_kernel_plugin_t; - -#define EVMS_GET_PLUGIN_STRING "EVMS_GET_PLUGIN" -#define EVMS_GET_PLUGIN _IOWR(EVMS_MAJOR, EVMS_GET_PLUGIN_NUMBER, evms_kernel_plugin_t) - -typedef struct evms_compute_csum_s { - unsigned char *buffer_address; /* IO address */ - int buffer_size; /* byte size of buffer */ - unsigned int insum; /* previous csum to be factored in */ - unsigned int outsum; /* resulting csum value of buffer */ - int status; /* 0 = success, not 0 = error */ -} evms_compute_csum_t; - -#define EVMS_COMPUTE_CSUM_STRING "EVMS_COMPUTE_CSUM" -#define EVMS_COMPUTE_CSUM _IOWR(EVMS_MAJOR, EVMS_COMPUTE_CSUM_NUMBER, evms_compute_csum_t) - -typedef struct evms_get_bmap_s { - u_int64_t rsector; /* input: volume relative rsector value */ - /* output: disk relative rsector value */ - u_int32_t dev; /* output = physical device */ - int status; /* 0 = success, not 0 = error */ -} evms_get_bmap_t; - -#define EVMS_GET_BMAP_STRING "EVMS_GET_BMAP" -#define EVMS_GET_BMAP _IOWR(EVMS_MAJOR, EVMS_GET_BMAP_NUMBER, evms_get_bmap_t) - -#endif diff --git a/lib/evms/evms_user.h b/lib/evms/evms_user.h deleted file mode 100644 index cd13a81e..00000000 --- a/lib/evms/evms_user.h +++ /dev/null @@ -1,28 +0,0 @@ -/* -*- linux-c -*- */ -/* - * - * Copyright (c) International Business Machines Corp., 2000 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -/* - * linux/include/linux/evms_user.h - * - * EVMS (master) user header file - * - */ - -#include <evms/evms_common.h> -#include <evms/evms_ioctl.h> diff --git a/lib/evms/fs_ext2.c b/lib/evms/fs_ext2.c index 88a1485f..e54d7e1c 100644 --- a/lib/evms/fs_ext2.c +++ b/lib/evms/fs_ext2.c @@ -1168,7 +1168,12 @@ static int fs_get_plugin_info( char * descriptor_name, extended_info_array_t * * extended_info_array_t *Info; extended_info_t *iptr; char version_string[64]; +#ifdef ABI_EVMS_1_0 char required_version_string[64]; +#else + char required_engine_api_version_string[64]; + char required_fsim_api_version_string[64]; +#endif LOGENTRY(); @@ -1177,7 +1182,7 @@ static int fs_get_plugin_info( char * descriptor_name, extended_info_array_t * * if (descriptor_name == NULL) { *info = NULL; /* init to no info returned */ - Info = EngFncs->engine_alloc( sizeof(extended_info_array_t) + (8*sizeof(extended_info_t)) ); + Info = EngFncs->engine_alloc( sizeof(extended_info_array_t) + (9*sizeof(extended_info_t)) ); if (Info) { Info->count = 0; @@ -1187,10 +1192,22 @@ static int fs_get_plugin_info( char * descriptor_name, extended_info_array_t * * MINOR_VERSION, PATCH_LEVEL ); +#ifdef ABI_EVMS_1_0 sprintf(required_version_string, "%d.%d.%d", pMyPluginRecord->required_api_version.major, pMyPluginRecord->required_api_version.minor, pMyPluginRecord->required_api_version.patchlevel ); +#else + sprintf(required_engine_api_version_string, "%d.%d.%d", + pMyPluginRecord->required_engine_api_version.major, + pMyPluginRecord->required_engine_api_version.minor, + pMyPluginRecord->required_engine_api_version.patchlevel ); + + sprintf(required_fsim_api_version_string, "%d.%d.%d", + pMyPluginRecord->required_plugin_api_version.fsim.major, + pMyPluginRecord->required_plugin_api_version.fsim.minor, + pMyPluginRecord->required_plugin_api_version.fsim.patchlevel ); +#endif iptr = &Info->info[Info->count++]; SET_STRING_FIELD( iptr->name, "Short Name" ); @@ -1232,6 +1249,7 @@ static int fs_get_plugin_info( char * descriptor_name, extended_info_array_t * * iptr->collection_type = EVMS_Collection_None; memset( &iptr->group, 0, sizeof(group_info_t)); +#ifdef ABI_EVMS_1_0 iptr = &Info->info[Info->count++]; SET_STRING_FIELD( iptr->name, "Required Version" ); SET_STRING_FIELD( iptr->title, "Required Engine Version" ); @@ -1241,7 +1259,28 @@ static int fs_get_plugin_info( char * descriptor_name, extended_info_array_t * * SET_STRING_FIELD( iptr->value.s, required_version_string ); iptr->collection_type = EVMS_Collection_None; memset( &iptr->group, 0, sizeof(group_info_t)); +#else + iptr = &Info->info[Info->count++]; + SET_STRING_FIELD( iptr->name, "Required Engine Services Version" ); + SET_STRING_FIELD( iptr->title, "Required Engine Services Version" ); + SET_STRING_FIELD( iptr->desc, "This is the version of the Engine services that this plug-in requires. It will not run on older versions of the Engine services."); + iptr->type = EVMS_Type_String; + iptr->unit = EVMS_Unit_None; + SET_STRING_FIELD( iptr->value.s, required_engine_api_version_string ); + iptr->collection_type = EVMS_Collection_None; + memset( &iptr->group, 0, sizeof(group_info_t)); + iptr = &Info->info[Info->count++]; + SET_STRING_FIELD( iptr->name, "Required Engine FSIM API Version" ); + SET_STRING_FIELD( iptr->title, "Required Engine FSIM API Version" ); + SET_STRING_FIELD( iptr->desc, "This is the version of the Engine FSIM API that this plug-in requires. It will not run on older versions of the Engine FSIM API."); + iptr->type = EVMS_Type_String; + iptr->unit = EVMS_Unit_None; + SET_STRING_FIELD( iptr->value.s, required_fsim_api_version_string ); + iptr->collection_type = EVMS_Collection_None; + memset( &iptr->group, 0, sizeof(group_info_t)); +#endif + #if defined(PACKAGE) && defined(VERSION) iptr = &Info->info[Info->count++]; SET_STRING_FIELD( iptr->name, "E2fsprogs Version" ); @@ -1367,9 +1406,18 @@ static fsim_functions_t fsim_ops = { plugin_record_t ext2_plugrec = { id: SetPluginID(EVMS_OEM_IBM, EVMS_FILESYSTEM_INTERFACE_MODULE, FS_TYPE_EXT2 ), version: {MAJOR_VERSION, MINOR_VERSION, PATCH_LEVEL}, +#ifdef ABI_EVMS_1_0 required_api_version: {ENGINE_PLUGIN_API_MAJOR_VERION, ENGINE_PLUGIN_API_MINOR_VERION, ENGINE_PLUGIN_API_PATCH_LEVEL}, +#else + required_engine_api_version: {8, + 0, + 0}, + required_plugin_api_version: {fsim: {8, + 0, + 0} }, +#endif short_name: "Ext2/3", long_name: "Ext2 File System Interface Module", oem_name: "IBM", diff --git a/lib/evms/options.h b/lib/evms/options.h index b109231b..158981d2 100644 --- a/lib/evms/options.h +++ b/lib/evms/options.h @@ -72,6 +72,10 @@ typedef enum { typedef struct function_info_s { task_action_t function; /* Plugin function number */ +#ifndef ABI_EVMS_1_0 + char * name; /* Short, unique (within the plug-in) name for the function */ + /* e.g., "addspare" */ +#endif char * title; /* Short title for the function */ /* e.g. "Add a spare" */ /* Example usage: A UI might put this in */ diff --git a/lib/evms/plugfuncs.h b/lib/evms/plugfuncs.h index 9b887efa..63130099 100644 --- a/lib/evms/plugfuncs.h +++ b/lib/evms/plugfuncs.h @@ -27,17 +27,17 @@ #include <options.h> #include <enginestructs.h> -#ifdef ABI_EVMS_1_0 -#define ENGINE_PLUGIN_API_MAJOR_VERION 3 -#else -#define ENGINE_PLUGIN_API_MAJOR_VERION 7 -#endif -#define ENGINE_PLUGIN_API_MINOR_VERION 0 -#define ENGINE_PLUGIN_API_PATCH_LEVEL 0 /* Maximum length of a user message. */ #define MAX_USER_MESSAGE_LEN 10240 + +#ifndef ABI_EVMS_1_0 +#define ENGINE_SERVICES_API_MAJOR_VERION 8 +#define ENGINE_SERVICES_API_MINOR_VERION 0 +#define ENGINE_SERVICES_API_PATCH_LEVEL 0 +#endif + /* * For all can_????() functions, the function returns 0 if "yes", else a reason code. */ @@ -364,6 +364,14 @@ typedef struct engine_functions_s { char * message_text, option_desc_array_t * options); +#ifndef ABI_EVMS_1_0 /* New for version 8 */ + /* + * Start, update, or close a progress indicator for the user. See the + * description in common.h for how the progress_t structures are used. + */ + int (*progress)(progress_t * progress); +#endif + /* * Can this object be renamed? The Engine will figure out if there are any * restrictions that would prevent the object from being renamed, e.g., the @@ -388,249 +396,41 @@ typedef struct engine_functions_s { BOOLEAN (*is_mounted)(char * volume_name, char * * mount_name); -} engine_functions_t; - - -typedef struct fsim_functions_s { - int (*setup_evms_plugin)(engine_mode_t mode, - engine_functions_t * functions); - - void (*cleanup_evms_plugin)(void); - - /* - * Does this FSIM manage the file system on this volume? - * Return 0 for "yes", else a reason code. - */ - int (*is_this_yours)(logical_volume_t * volume); - - /* - * Get the current size of the file system on this volume. - */ - int (*get_fs_size)(logical_volume_t * volume, - sector_count_t * fs_size); - - /* - * Get the file system size limits for this volume. - */ - int (*get_fs_limits)(logical_volume_t * volume, - sector_count_t * fs_min_size, - sector_count_t * fs_max_size, - sector_count_t * vol_max_size); - - /* - * Can you install your file system on this volume? - */ - int (*can_mkfs)(logical_volume_t * volume); - - /* - * Can you remove your file system from this volume? - */ - int (*can_unmkfs)(logical_volume_t * volume); - - /* - * Can you fsck this volume? - */ - int (*can_fsck)(logical_volume_t * volume); - - /* - * Can you defrag this volume? - */ - int (*can_defrag)(logical_volume_t * volume); - - /* - * Can you expand this volume by the amount specified? - * If your file system cannot handle expansion at all, return an - * error code that indicates why it cannot be expanded.. - * If your file system can expand but cannot handle having unused - * space after the end of your file system, adjust the *delta_size - * to the maximum you allow and return 0. - * If your file system cannot fill the resulting size but your file - * system can handle extra unused space after the end of the file - * system, then do not change the *delta_size and return 0. - */ - int (*can_expand_by)(logical_volume_t * volume, - sector_count_t * delta_size); - - /* - * Can you shrink this volume by the amount specified? - * If your file system cannot handle shrinking at all, return an - * error code that indicates why it cannot be shrunk. - * If your file system can shrink but the *delta_size is too much to - * shrink by, adjust the *delta_size to the maximum shrinkage you allow and - * return 0. - */ - int (*can_shrink_by)(logical_volume_t * volume, - sector_count_t * delta_size); - - /* - * Install your file system on the volume. - */ - int (*mkfs)(logical_volume_t * volume, - option_array_t * options); - - /* - * Remove your file system from the volume. This could be as simple as - * wiping out critical sectors, such as a superblock, so that you will - * no longer detect that your file system is installed on the volume. - */ - int (*unmkfs)(logical_volume_t * volume); - - /* - * Run fsck on the volume. - */ - int (*fsck)(logical_volume_t * volume, - option_array_t * options); - - /* - * Defragment on the volume. - */ - int (*defrag)(logical_volume_t * volume, - option_array_t * options); - - /* - * Expand the volume to new_size. If the volume is not expanded exactly to - * new_size, set new_sie to the new_size of the volume. - */ - int (*expand)(logical_volume_t * volume, - sector_count_t * new_size); - - /* - * Shrink the volume to new_size. If the volume is not expanded exactly to - * new_size, set new_size to the new_size of the volume. - */ - int (*shrink)(logical_volume_t * volume, - sector_count_t requested_size, - sector_count_t * new_size); - - /* - * Return the total number of supported options for the specified task. - */ - int (*get_option_count)(task_context_t * context); - - /* - * Fill in the initial list of acceptable objects. Fill in the minimum and - * maximum number of objects that must/can be selected. Set up all initial - * values in the option_descriptors in the context record for the given - * task. Some fields in the option_descriptor may be dependent on a - * selected object. Leave such fields blank for now, and fill in during the - * set_objects call. - */ - int (*init_task)(task_context_t * context); - - /* - * Examine the specified value, and determine if it is valid for the task - * and option_descriptor index. If it is acceptable, set that value in the - * appropriate entry in the option_descriptor. The value may be adjusted - * if necessary/allowed. If so, set the effect return value accordingly. - */ - int (*set_option)(task_context_t * context, - u_int32_t index, - value_t * value, - task_effect_t * effect); - - /* - * Validate the volumes in the selected_objects dlist in the task context. - * Remove from the selected objects lists any volumes which are not - * acceptable. For unacceptable volumes, create a declined_handle_t - * structure with the reason why it is not acceptable, and add it to the - * declined_volumes dlist. Modify the acceptable_objects dlist in the task - * context as necessary based on the selected objects and the current - * settings of the options. Modify any option settings as necessary based - * on the selected objects. Return the appropriate task_effect_t settings - * if the object list(s), minimum or maximum objects selected, or option - * settings have changed. - */ - int (*set_volumes)(task_context_t * context, - dlist_t declined_volumes, /* of type declined_handle_t */ - task_effect_t * effect); - - - /* - * Return any additional information that you wish to provide about the - * volume. The Engine provides an external API to get the information - * stored in the logical_volume_t. This call is to get any other - * information about the volume that is not specified in the - * logical_volume_t. Any piece of information you wish to provide must be - * in an extended_info_t structure. Use the Engine's engine_alloc() to - * allocate the memory for the extended_info_t. Also use engine_alloc() to - * allocate any strings that may go into the extended_info_t. Then use - * engine_alloc() to allocate an extended_info_array_t with enough entries - * for the number of extended_info_t structures you are returning. Fill - * in the array and return it in *info. - * If you have extended_info_t descriptors that themselves may have more - * extended information, set the EVMS_EINFO_FLAGS_MORE_INFO_AVAILABLE flag - * in the extended_info_t flags field. If the caller wants more information - * about a particular extended_info_t item, this API will be called with a - * pointer to the storage_object_t and with a pointer to the name of the - * extended_info_t item. In that case, return an extended_info_array_t with - * further information about the item. Each of those items may have the - * EVMS_EINFO_FLAGS_MORE_INFO_AVAILABLE flag set if you desire. It is your - * responsibility to give the items unique names so that you know which item - * the caller is asking additional information for. If info_name is NULL, - * the caller just wants top level information about the object. - */ - int (*get_volume_info)(logical_volume_t * volume, - char * info_name, - extended_info_array_t * * info); - - /* - * Apply the settings of the options to the given volume. - */ - int (*set_volume_info)(logical_volume_t * volume, - option_array_t * options); - - /* - * Return any additional information that you wish to provide about your - * plug-in. The Engine provides an external API to get the information - * stored in the plugin_record_t. This call is to get any other - * information about the plug-in that is not specified in the - * plugin_record_t. Any piece of information you wish to provide must be - * in an extended_info_t structure. Use the Engine's engine_alloc() to - * allocate the memory for the extended_info_t. Also use engine_alloc() to - * allocate any strings that may go into the extended_info_t. Then use - * engine_alloc() to allocate an extended_info_array_t with enough entries - * for the number of extended_info_t structures you are returning. Fill - * in the array and return it in *info. - * If you have extended_info_t descriptors that themselves may have more - * extended information, set the EVMS_EINFO_FLAGS_MORE_INFO_AVAILABLE flag - * in the extended_info_t flags field. If the caller wants more information - * about a particular extended_info_t item, this API will be called with a - * pointer to the storage_object_t and with a pointer to the name of the - * extended_info_t item. In that case, return an extended_info_array_t with - * further information about the item. Each of those items may have the - * EVMS_EINFO_FLAGS_MORE_INFO_AVAILABLE flag set if you desire. It is your - * responsibility to give the items unique names so that you know which item - * the caller is asking additional information for. If info_name is NULL, - * the caller just wants top level information about the object. - */ - int (*get_plugin_info)(char * info_name, - extended_info_array_t * * info); - -#ifndef ABI_EVMS_1_0 - /* - * Return an array of private actions that you support for this volume. +#ifndef ABI_EVMS_1_0 /* New for version 8 */ + /* + * Assign an FSIM to a volume. FSIMs can use this service to claim control + * of a volume. For example, an FSIM for a journaling file system may want + * to claim another volume for an external log. + * The Engine will return an error code if there is any reason the FSIM + * cannot be assigned to the volume, such as the volume already being owned + * by another FSIM. + * An FSIM does not use this service as part of the processing of a call to + * the FSIM's is_this_yours() function. The Engine will automatically + * assign the FSIM to a volume if it returns 0 on a call to is_this_yours(). + * */ - int (*get_plugin_functions)(logical_volume_t * volume, - function_info_array_t * * actions); + int (*assign_fsim_to_volume)(plugin_record_t * fsim, + logical_volume_t * volume); /* - * Execute the private action on the volume. + * Unassign an FSIM from a volume. FSIMs can use this service to release + * control of a volume. For example, on unmkfs_setup() an FSIM for a + * journaling file system may want to release its claim on another volume + * that it used for an external log. */ - int (*plugin_function)(logical_volume_t * volume, - task_action_t action, - dlist_t objects, - option_array_t * options); + int (*unassign_fsim_from_volume)(logical_volume_t * volume); #endif - /* - * Generic method for communicating with your plug-in. - */ - int (*direct_plugin_communication)(void * thing, - BOOLEAN target_kernel_plugin, - void * arg); +} engine_functions_t; -} fsim_functions_t; +#ifdef ABI_EVMS_1_0 +#define ENGINE_PLUGIN_API_MAJOR_VERION 3 +#else +#define ENGINE_PLUGIN_API_MAJOR_VERION 8 +#endif +#define ENGINE_PLUGIN_API_MINOR_VERION 0 +#define ENGINE_PLUGIN_API_PATCH_LEVEL 0 typedef struct plugin_functions_s { int (*setup_evms_plugin)(engine_mode_t mode, @@ -964,13 +764,13 @@ typedef struct plugin_functions_s { #ifndef ABI_EVMS_1_0 /* - * Return an array of private actions that you support for this object. + * Return an array of plug-in functions that you support for this object. */ int (*get_plugin_functions)(storage_object_t * object, function_info_array_t * * actions); /* - * Execute the private action on the object. + * Execute the plug-in function on the object. */ int (*plugin_function)(storage_object_t * object, task_action_t action, @@ -988,6 +788,276 @@ typedef struct plugin_functions_s { } plugin_functions_t; +#ifndef ABI_EVMS_1_0 +#define ENGINE_FSIM_API_MAJOR_VERION 8 +#define ENGINE_FSIM_API_MINOR_VERION 0 +#define ENGINE_FSIM_API_PATCH_LEVEL 0 +#endif + +typedef struct fsim_functions_s { + int (*setup_evms_plugin)(engine_mode_t mode, + engine_functions_t * functions); + + void (*cleanup_evms_plugin)(void); + + /* + * Does this FSIM manage the file system on this volume? + * Return 0 for "yes", else a reason code. + */ + int (*is_this_yours)(logical_volume_t * volume); + + /* + * Get the current size of the file system on this volume. + */ + int (*get_fs_size)(logical_volume_t * volume, + sector_count_t * fs_size); + + /* + * Get the file system size limits for this volume. + */ + int (*get_fs_limits)(logical_volume_t * volume, + sector_count_t * fs_min_size, + sector_count_t * fs_max_size, + sector_count_t * vol_max_size); + + /* + * Can you install your file system on this volume? + */ + int (*can_mkfs)(logical_volume_t * volume); + + /* + * Can you remove your file system from this volume? + */ + int (*can_unmkfs)(logical_volume_t * volume); + + /* + * Can you fsck this volume? + */ + int (*can_fsck)(logical_volume_t * volume); + + /* + * Can you defrag this volume? + */ + int (*can_defrag)(logical_volume_t * volume); + + /* + * Can you expand this volume by the amount specified? + * If your file system cannot handle expansion at all, return an + * error code that indicates why it cannot be expanded.. + * If your file system can expand but cannot handle having unused + * space after the end of your file system, adjust the *delta_size + * to the maximum you allow and return 0. + * If your file system cannot fill the resulting size but your file + * system can handle extra unused space after the end of the file + * system, then do not change the *delta_size and return 0. + */ + int (*can_expand_by)(logical_volume_t * volume, + sector_count_t * delta_size); + + /* + * Can you shrink this volume by the amount specified? + * If your file system cannot handle shrinking at all, return an + * error code that indicates why it cannot be shrunk. + * If your file system can shrink but the *delta_size is too much to + * shrink by, adjust the *delta_size to the maximum shrinkage you allow and + * return 0. + */ + int (*can_shrink_by)(logical_volume_t * volume, + sector_count_t * delta_size); + +#ifndef ABI_EVMS_1_0 /* New for version 8 */ + /* + * mkfs has been scheduled. Do any setup work such as claiming another + * volume for an external log. + */ + int (*mkfs_setup)(logical_volume_t * volume, + option_array_t * options); +#endif + + /* + * Install your file system on the volume. + */ + int (*mkfs)(logical_volume_t * volume, + option_array_t * options); + +#ifndef ABI_EVMS_1_0 /* New for version 8 */ + /* + * unmkfs has been scheduled. Do any setup work such as releasing another + * volume that was used for an external log. + */ + int (*unmkfs_setup)(logical_volume_t * volume); +#endif + + /* + * Remove your file system from the volume. This could be as simple as + * wiping out critical sectors, such as a superblock, so that you will + * no longer detect that your file system is installed on the volume. + */ + int (*unmkfs)(logical_volume_t * volume); + + /* + * Run fsck on the volume. + */ + int (*fsck)(logical_volume_t * volume, + option_array_t * options); + + /* + * Defragment on the volume. + */ + int (*defrag)(logical_volume_t * volume, + option_array_t * options); + + /* + * Expand the volume to new_size. If the volume is not expanded exactly to + * new_size, set new_sie to the new_size of the volume. + */ + int (*expand)(logical_volume_t * volume, + sector_count_t * new_size); + + /* + * Shrink the volume to new_size. If the volume is not expanded exactly to + * new_size, set new_size to the new_size of the volume. + */ + int (*shrink)(logical_volume_t * volume, + sector_count_t requested_size, + sector_count_t * new_size); + + /* + * Return the total number of supported options for the specified task. + */ + int (*get_option_count)(task_context_t * context); + + /* + * Fill in the initial list of acceptable objects. Fill in the minimum and + * maximum number of objects that must/can be selected. Set up all initial + * values in the option_descriptors in the context record for the given + * task. Some fields in the option_descriptor may be dependent on a + * selected object. Leave such fields blank for now, and fill in during the + * set_objects call. + */ + int (*init_task)(task_context_t * context); + + /* + * Examine the specified value, and determine if it is valid for the task + * and option_descriptor index. If it is acceptable, set that value in the + * appropriate entry in the option_descriptor. The value may be adjusted + * if necessary/allowed. If so, set the effect return value accordingly. + */ + int (*set_option)(task_context_t * context, + u_int32_t index, + value_t * value, + task_effect_t * effect); + + /* + * Validate the volumes in the selected_objects dlist in the task context. + * Remove from the selected objects lists any volumes which are not + * acceptable. For unacceptable volumes, create a declined_handle_t + * structure with the reason why it is not acceptable, and add it to the + * declined_volumes dlist. Modify the acceptable_objects dlist in the task + * context as necessary based on the selected objects and the current + * settings of the options. Modify any option settings as necessary based + * on the selected objects. Return the appropriate task_effect_t settings + * if the object list(s), minimum or maximum objects selected, or option + * settings have changed. + */ + int (*set_volumes)(task_context_t * context, + dlist_t declined_volumes, /* of type declined_handle_t */ + task_effect_t * effect); + + + /* + * Return any additional information that you wish to provide about the + * volume. The Engine provides an external API to get the information + * stored in the logical_volume_t. This call is to get any other + * information about the volume that is not specified in the + * logical_volume_t. Any piece of information you wish to provide must be + * in an extended_info_t structure. Use the Engine's engine_alloc() to + * allocate the memory for the extended_info_t. Also use engine_alloc() to + * allocate any strings that may go into the extended_info_t. Then use + * engine_alloc() to allocate an extended_info_array_t with enough entries + * for the number of extended_info_t structures you are returning. Fill + * in the array and return it in *info. + * If you have extended_info_t descriptors that themselves may have more + * extended information, set the EVMS_EINFO_FLAGS_MORE_INFO_AVAILABLE flag + * in the extended_info_t flags field. If the caller wants more information + * about a particular extended_info_t item, this API will be called with a + * pointer to the storage_object_t and with a pointer to the name of the + * extended_info_t item. In that case, return an extended_info_array_t with + * further information about the item. Each of those items may have the + * EVMS_EINFO_FLAGS_MORE_INFO_AVAILABLE flag set if you desire. It is your + * responsibility to give the items unique names so that you know which item + * the caller is asking additional information for. If info_name is NULL, + * the caller just wants top level information about the object. + */ + int (*get_volume_info)(logical_volume_t * volume, + char * info_name, + extended_info_array_t * * info); + + /* + * Apply the settings of the options to the given volume. + */ + int (*set_volume_info)(logical_volume_t * volume, + option_array_t * options); + + /* + * Return any additional information that you wish to provide about your + * plug-in. The Engine provides an external API to get the information + * stored in the plugin_record_t. This call is to get any other + * information about the plug-in that is not specified in the + * plugin_record_t. Any piece of information you wish to provide must be + * in an extended_info_t structure. Use the Engine's engine_alloc() to + * allocate the memory for the extended_info_t. Also use engine_alloc() to + * allocate any strings that may go into the extended_info_t. Then use + * engine_alloc() to allocate an extended_info_array_t with enough entries + * for the number of extended_info_t structures you are returning. Fill + * in the array and return it in *info. + * If you have extended_info_t descriptors that themselves may have more + * extended information, set the EVMS_EINFO_FLAGS_MORE_INFO_AVAILABLE flag + * in the extended_info_t flags field. If the caller wants more information + * about a particular extended_info_t item, this API will be called with a + * pointer to the storage_object_t and with a pointer to the name of the + * extended_info_t item. In that case, return an extended_info_array_t with + * further information about the item. Each of those items may have the + * EVMS_EINFO_FLAGS_MORE_INFO_AVAILABLE flag set if you desire. It is your + * responsibility to give the items unique names so that you know which item + * the caller is asking additional information for. If info_name is NULL, + * the caller just wants top level information about the object. + */ + int (*get_plugin_info)(char * info_name, + extended_info_array_t * * info); + +#ifndef ABI_EVMS_1_0 + /* + * Return an array of plug-in functions that you support for this volume. + */ + int (*get_plugin_functions)(logical_volume_t * volume, + function_info_array_t * * actions); + + /* + * Execute the plug-in function on the volume. + */ + int (*plugin_function)(logical_volume_t * volume, + task_action_t action, + dlist_t objects, + option_array_t * options); +#endif + + /* + * Generic method for communicating with your plug-in. + */ + int (*direct_plugin_communication)(void * thing, + BOOLEAN target_kernel_plugin, + void * arg); + +} fsim_functions_t; + + +#ifndef ABI_EVMS_1_0 +#define ENGINE_CONTAINER_API_MAJOR_VERION 8 +#define ENGINE_CONTAINER_API_MINOR_VERION 0 +#define ENGINE_CONTAINER_API_PATCH_LEVEL 0 +#endif + typedef struct container_functions_s { /* @@ -1108,13 +1178,13 @@ typedef struct container_functions_s { #ifndef ABI_EVMS_1_0 /* - * Return an array of private actions that you support for this container. + * Return an array of plug-in functions that you support for this container. */ int (*get_plugin_functions)(storage_container_t * container, function_info_array_t * * actions); /* - * Execute the private action on the container. + * Execute the plug-in function on the container. */ int (*plugin_function)(storage_container_t * container, task_action_t action, |