aboutsummaryrefslogtreecommitdiffstats
path: root/src/rename_device.c
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2006-10-26 21:01:13 +0000
committerBill Nottingham <notting@redhat.com>2006-10-26 21:01:13 +0000
commit0c44c0e9ccbea789390c7367db5f018686523658 (patch)
tree7884b75d5cbd13c1e15bbc86f709f0db74e75e63 /src/rename_device.c
parentc3f014d2be64f0fb4d9a5e4f14a65a6599dd8002 (diff)
downloadinitscripts-0c44c0e9ccbea789390c7367db5f018686523658.tar
initscripts-0c44c0e9ccbea789390c7367db5f018686523658.tar.gz
initscripts-0c44c0e9ccbea789390c7367db5f018686523658.tar.bz2
initscripts-0c44c0e9ccbea789390c7367db5f018686523658.tar.xz
initscripts-0c44c0e9ccbea789390c7367db5f018686523658.zip
use SUBCHANNELS as the primary key for s390 network devices (#204803)
Diffstat (limited to 'src/rename_device.c')
-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);