[libblockdev 1/3] Add the s390 plugin.
Samantha N. Bueno
sbueno+anaconda at redhat.com
Wed May 13 18:16:22 UTC 2015
Make some of the basic changes so that libblockdev will recognize the
new plugin.
---
Sconscript | 9 ++++++++-
docs/libblockdev-docs.xml | 1 +
docs/libblockdev-sections.txt | 12 ++++++++++++
features.rst | 10 +++++++++-
src/lib/blockdev.c | 16 +++++++++++++---
src/lib/plugins.h | 1 +
6 files changed, 44 insertions(+), 5 deletions(-)
diff --git a/Sconscript b/Sconscript
index 717198a..ce3ba1d 100644
--- a/Sconscript
+++ b/Sconscript
@@ -7,7 +7,7 @@ MAIN_VERSION = "0.1.0"
MAJOR_MINOR = MAIN_VERSION.rsplit(".", 1)[0]
MAJOR_VERSION = MAIN_VERSION.split(".", 1)[0]
LIB_FILES = ["src/lib/blockdev.c", "src/lib/blockdev.h", "src/lib/plugins.h"]
-PLUGIN_NAMES = ["crypto", "dm", "loop", "lvm", "mpath", "swap", "btrfs", "mdraid"]
+PLUGIN_NAMES = ["crypto", "dm", "loop", "lvm", "mpath", "swap", "btrfs", "mdraid", "s390"]
PLUGIN_HEADER_FILES = ["build/plugin_apis/"+name+".h" for name in PLUGIN_NAMES]
UTILS_FILES = ["src/utils/exec.c", "src/utils/sizes.c", "src/utils/exec.h", "src/utils/sizes.h"]
@@ -78,6 +78,12 @@ swap_env.Append(LIBPATH=".")
swap_env.Append(LIBS="bd_utils")
plugins.append(swap_env.SharedLibrary("bd_swap", ["src/plugins/swap.c"]))
+s390_env = glib_warnall_env.Clone()
+s390_env.Append(CPPPATH="src/utils")
+s390_env.Append(LIBPATH=".")
+s390_env.Append(LIBS="bd_utils")
+plugins.append(s390_env.SharedLibrary("bd_s390", ["src/plugins/s390.c"]))
+
## boilerplate code generation
bpg_builder = Builder(action=generate_boilerplate_files)
@@ -93,6 +99,7 @@ boiler_code.append(bpg_env.BpG(["plugin_apis/loop.h", "plugin_apis/loop.c"], "sr
boiler_code.append(bpg_env.BpG(["plugin_apis/mdraid.h", "plugin_apis/mdraid.c"], "src/lib/plugin_apis/mdraid.api"))
boiler_code.append(bpg_env.BpG(["plugin_apis/mpath.h", "plugin_apis/mpath.c"], "src/lib/plugin_apis/mpath.api"))
boiler_code.append(bpg_env.BpG(["plugin_apis/swap.h", "plugin_apis/swap.c"], "src/lib/plugin_apis/swap.api"))
+boiler_code.append(bpg_env.BpG(["plugin_apis/s390.h", "plugin_apis/s390.c"], "src/lib/plugin_apis/s390.api"))
## the library itself
diff --git a/docs/libblockdev-docs.xml b/docs/libblockdev-docs.xml
index 32b712a..db3bacc 100644
--- a/docs/libblockdev-docs.xml
+++ b/docs/libblockdev-docs.xml
@@ -30,6 +30,7 @@
<xi:include href="xml/mpath.xml"/>
<xi:include href="xml/plugins.xml"/>
<xi:include href="xml/swap.xml"/>
+ <xi:include href="xml/s390.xml"/>
<xi:include href="xml/utils.xml"/>
</chapter>
diff --git a/docs/libblockdev-sections.txt b/docs/libblockdev-sections.txt
index 0e33ddb..d6f8fa8 100644
--- a/docs/libblockdev-sections.txt
+++ b/docs/libblockdev-sections.txt
@@ -259,3 +259,15 @@ bd_swap_swapoff
bd_swap_swapstatus
</SECTION>
+<SECTION>
+<FILE>s390</FILE>
+bd_s390_error_quark
+BDS390Error
+bd_s390_dasd_format
+bd_s390_dasd_needs_format
+bd_s390_sanitize_dev_input
+bd_s390_dasd_online
+bd_s390_dasd_is_ldl
+bd_s390_zfcp_sanitize_wwpn_input
+bd_s390_zfcp_sanitize_lun_input
+</SECTION>
diff --git a/features.rst b/features.rst
index f2c6726..fff15e5 100644
--- a/features.rst
+++ b/features.rst
@@ -235,7 +235,15 @@ s390
DASD, zFCP
:functions:
- TBD by sbueno
+ * s390_dasd_format [DONE]
+ * s390_dasd_needs_format [DONE]
+ * s390_dasd_online [DONE]
+ * s390_dasd_is_ldl [DONE]
+ * s390_sanitize_dev_input [DONE]
+ * s390_zfcp_sanitize_wwpn_input [DONE]
+ * s390_zfcp_sanitize_lun_input [DONE]
+ * s390_zfcp_online
+ * s390_zfcp_offline
KBD (Kernel Block Devices)
diff --git a/src/lib/blockdev.c b/src/lib/blockdev.c
index 44f987a..5297ef9 100644
--- a/src/lib/blockdev.c
+++ b/src/lib/blockdev.c
@@ -19,6 +19,8 @@
#include "plugin_apis/dm.h"
#include "plugin_apis/mdraid.h"
#include "plugin_apis/mdraid.c"
+#include "plugin_apis/s390.h"
+#include "plugin_apis/s390.c"
/**
* SECTION: blockdev
@@ -41,7 +43,8 @@ static gchar * default_plugin_so[BD_PLUGIN_UNDEF] = {
"libbd_lvm.so."MAJOR_VER, "libbd_btrfs.so."MAJOR_VER,
"libbd_swap.so."MAJOR_VER, "libbd_loop.so."MAJOR_VER,
"libbd_crypto.so."MAJOR_VER, "libbd_mpath.so."MAJOR_VER,
- "libbd_dm.so."MAJOR_VER, "libbd_mdraid.so."MAJOR_VER
+ "libbd_dm.so."MAJOR_VER, "libbd_mdraid.so."MAJOR_VER,
+ "libbd_s390.so."MAJOR_VER, "libbd_s390.so."MAJOR_VER
};
static BDPluginStatus plugins[BD_PLUGIN_UNDEF] = {
{{BD_PLUGIN_LVM, NULL}, NULL},
@@ -51,10 +54,11 @@ static BDPluginStatus plugins[BD_PLUGIN_UNDEF] = {
{{BD_PLUGIN_CRYPTO, NULL}, NULL},
{{BD_PLUGIN_MPATH, NULL}, NULL},
{{BD_PLUGIN_DM, NULL}, NULL},
- {{BD_PLUGIN_MDRAID, NULL}, NULL}
+ {{BD_PLUGIN_MDRAID, NULL}, NULL},
+ {{BD_PLUGIN_S390, NULL}, NULL}
};
static gchar* plugin_names[BD_PLUGIN_UNDEF] = {
- "lvm", "btrfs", "swap", "loop", "crypto", "mpath", "dm", "mdraid"
+ "lvm", "btrfs", "swap", "loop", "crypto", "mpath", "dm", "mdraid", "s390"
};
static void set_plugin_so_name (BDPlugin name, gchar *so_name) {
@@ -93,6 +97,10 @@ static void unload_plugins () {
if (plugins[BD_PLUGIN_MDRAID].handle && !unload_mdraid (plugins[BD_PLUGIN_MDRAID].handle))
g_warning ("Failed to close the mdraid plugin");
plugins[BD_PLUGIN_MDRAID].handle = NULL;
+
+ if (plugins[BD_PLUGIN_S390].handle && !unload_s390 (plugins[BD_PLUGIN_S390].handle))
+ g_warning ("Failed to close the s390 plugin");
+ plugins[BD_PLUGIN_S390].handle = NULL;
}
static gboolean load_plugins (BDPluginSpec **require_plugins, gboolean reload) {
@@ -137,6 +145,8 @@ static gboolean load_plugins (BDPluginSpec **require_plugins, gboolean reload) {
plugins[BD_PLUGIN_DM].handle = load_dm_from_plugin(plugins[BD_PLUGIN_DM].spec.so_name);
if (!plugins[BD_PLUGIN_MDRAID].handle && plugins[BD_PLUGIN_MDRAID].spec.so_name)
plugins[BD_PLUGIN_MDRAID].handle = load_mdraid_from_plugin(plugins[BD_PLUGIN_MDRAID].spec.so_name);
+ if (!plugins[BD_PLUGIN_S390].handle && plugins[BD_PLUGIN_S390].spec.so_name)
+ plugins[BD_PLUGIN_S390].handle = load_s390_from_plugin(plugins[BD_PLUGIN_S390].spec.so_name);
for (i=0; (i < BD_PLUGIN_UNDEF) && requested_loaded; i++)
if (plugins[i].spec.so_name)
diff --git a/src/lib/plugins.h b/src/lib/plugins.h
index 0320b9b..a6f60fc 100644
--- a/src/lib/plugins.h
+++ b/src/lib/plugins.h
@@ -13,6 +13,7 @@ typedef enum {
BD_PLUGIN_MPATH,
BD_PLUGIN_DM,
BD_PLUGIN_MDRAID,
+ BD_PLUGIN_S390,
BD_PLUGIN_UNDEF
} BDPlugin;
--
2.4.0
More information about the anaconda-patches
mailing list