From 0c44c0e9ccbea789390c7367db5f018686523658 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Thu, 26 Oct 2006 21:01:13 +0000 Subject: use SUBCHANNELS as the primary key for s390 network devices (#204803) --- src/rename_device.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) 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); -- cgit v1.2.1