aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2006-10-26 21:00:46 +0000
committerBill Nottingham <notting@redhat.com>2006-10-26 21:00:46 +0000
commit5fc16f7cb8d20acd561c5fe2f0aebceb2bd77bba (patch)
treedb47162dba2802e6e1699d7c0f3cea5c8c0b794b
parent776145695f6fe3cb7abd7c8bc5c960418e2af403 (diff)
downloadinitscripts-5fc16f7cb8d20acd561c5fe2f0aebceb2bd77bba.tar
initscripts-5fc16f7cb8d20acd561c5fe2f0aebceb2bd77bba.tar.gz
initscripts-5fc16f7cb8d20acd561c5fe2f0aebceb2bd77bba.tar.bz2
initscripts-5fc16f7cb8d20acd561c5fe2f0aebceb2bd77bba.tar.xz
initscripts-5fc16f7cb8d20acd561c5fe2f0aebceb2bd77bba.zip
use SUBCHANNELS as the primary key for s390 network devices (#204803)
-rw-r--r--src/rename_device.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/rename_device.c b/src/rename_device.c
index 9acdebb7..c845b7ab 100644
--- a/src/rename_device.c
+++ b/src/rename_device.c
@@ -80,9 +80,20 @@ struct netdev *get_devs() {
}
g_free(contents);
contents = NULL;
+#if defined(__s390__) || defined(__s390x__)
+ if (asprintf(&path,"/sys/class/net/%s/device",entry->d_name) == -1)
+ continue;
+ char *tmp = canonicalize_file_name(path);
+ if (!tmp)
+ continue;
+ contents = strdup(basename(tmp));
+ printf("found device %s\n",contents);
+ free(tmp);
+#else
if (asprintf(&path,"/sys/class/net/%s/address",entry->d_name) == -1)
continue;
g_file_get_contents(path, &contents, NULL, NULL);
+#endif /* mainframe */
if (!contents) continue;
contents = g_strstrip(contents);
tmpdev = calloc(1, sizeof(struct netdev));
@@ -146,9 +157,19 @@ struct netdev *get_configs() {
if (strchr(devname,':'))
devname = NULL;
}
+#if defined(__s390__) || defined(__s390x__)
+ if (g_str_has_prefix(lines[i],"SUBCHANNELS=")) {
+ char *tmp = lines[i] + 12;
+ hwaddr = tmp;
+ while (*tmp && *tmp != ',') tmp++;
+ *tmp = '\0';
+ printf("got hwaddr %s\n",hwaddr);
+ }
+#else
if (g_str_has_prefix(lines[i],"HWADDR=")) {
hwaddr = lines[i] + 7;
}
+#endif
}
if (!devname || !hwaddr) {
g_free(contents);