X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=ui%2Fncurses%2Fnc-sysinfo.c;h=fb1954f44f0fc7d2ce498764a665e419089c9cf7;hp=4cba9a9c393cfaa9ac83b232d1c5ec55ffe72cbb;hb=df46fcfe4867fd16729bb10dfb82dcd43595c6c2;hpb=651940467773d2e679f9210e02f4654fb05cd449 diff --git a/ui/ncurses/nc-sysinfo.c b/ui/ncurses/nc-sysinfo.c index 4cba9a9..fb1954f 100644 --- a/ui/ncurses/nc-sysinfo.c +++ b/ui/ncurses/nc-sysinfo.c @@ -127,28 +127,10 @@ static __attribute__((format(printf, 2, 3))) void sysinfo_screen_append_line( screen->n_lines++; } -static void mac_str(struct interface_info *info, char *buf, unsigned int buflen) +static void if_info_mac_str(struct interface_info *info, + char *buf, unsigned int buflen) { - unsigned int i; - char *pos; - - assert(buflen > sizeof("unknown")); - - if (!info->hwaddr_size || info->hwaddr_size * 3 + 1 > buflen) { - strcpy(buf, "unknown"); - return; - } - - pos = buf; - - for (i = 0; i < info->hwaddr_size; i++) { - snprintf(pos, 4, "%02x:", info->hwaddr[i]); - pos += 3; - } - - *(pos - 1) = '\0'; - - return; + return mac_str(info->hwaddr, info->hwaddr_size, buf, buflen); } static void sysinfo_screen_populate(struct sysinfo_screen *screen, @@ -167,18 +149,34 @@ static void sysinfo_screen_populate(struct sysinfo_screen *screen, line("%-12s %s", "System type:", sysinfo->type ?: ""); line("%-12s %s", "System id:", sysinfo->identifier ?: ""); - line(NULL); - if (sysinfo->n_interfaces) + if (sysinfo->n_blockdevs) { + line(NULL); + line("Storage devices"); + } + + for (i = 0; i < sysinfo->n_blockdevs; i++) { + struct blockdev_info *info = sysinfo->blockdevs[i]; + + line("%s:", info->name); + line(" UUID: %s", info->uuid); + line(" mounted at: %s", info->mountpoint); + line(NULL); + } + + if (sysinfo->n_interfaces) { + line(NULL); line("Network interfaces"); + } for (i = 0; i < sysinfo->n_interfaces; i++) { struct interface_info *info = sysinfo->interfaces[i]; char macbuf[32]; - mac_str(info, macbuf, sizeof(macbuf)); + if_info_mac_str(info, macbuf, sizeof(macbuf)); line("%s:", info->name); - line(" MAC: %s", macbuf); + line(" MAC: %s", macbuf); + line(" link: %s", info->link ? "up" : "down"); line(NULL); }