Package: s390-dasd
Version: 0.0.34
Severity: normal
Tags: d-i patch

If you have configured one ore more DASDs, the s390-dasd shows
them as "(configured)".  If you then leave the module, for example,
with "Finish", and re-enter the module again, the DASDs show up as
"online" again.

The patch below enhances the detect_channels_driver() function
to check if a configuration file exists, that means, if DASDs
are already online and configured.

Kind regards,
  Hendrik
>From ba645de637b74de9a58e4296dae0f4bd6a785c07 Mon Sep 17 00:00:00 2001
From: Hendrik Brueckner <brueck...@linux.vnet.ibm.com>
Date: Mon, 15 Feb 2016 17:44:29 +0100
Subject: [PATCH 4/4] dasd: detect if a DASD is already configured

If the s390-dasd module is started twice, already configured DASDs
appear as "online".  Enhance the detect_channels_driver() function
to check if a configuration file exists, that means, if DASDs are
already online and configured.

Signed-off-by: Hendrik Brueckner <brueck...@linux.vnet.ibm.com>
Reviewed-by: Viktor Mihajlovski <mihaj...@linux.vnet.ibm.com>
---
 dasd-config.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/dasd-config.c b/dasd-config.c
index 6194da7..e085534 100644
--- a/dasd-config.c
+++ b/dasd-config.c
@@ -1,6 +1,7 @@
 #include <ctype.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -111,6 +112,7 @@ static enum state_wanted setup ()
 
 static enum state_wanted detect_channels_driver (struct sysfs_driver *driver, 
int type)
 {
+       char path[PATH_MAX];
        struct dlist *devices;
        struct sysfs_device *device;
 
@@ -141,6 +143,10 @@ static enum state_wanted detect_channels_driver (struct 
sysfs_driver *driver, in
                if (strtol (attr_online->value, NULL, 10) > 0)
                        current->online = true;
 
+               /* Check if the current DASD is already configured */
+               snprintf (path, sizeof (path), SYSCONFIG_DIR "config-ccw-%s", 
current->name);
+               current->configured = !access (path, F_OK);
+
                di_tree_insert (channels, current, current);
        }
 
-- 
2.7.0

Reply via email to