]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
s390/sysinfo: show partition extended name and UUID if available
authorViktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
Thu, 10 Nov 2016 13:32:59 +0000 (14:32 +0100)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Wed, 7 Dec 2016 11:29:47 +0000 (12:29 +0100)
Extract extended name and UUID from SYSIB 2.2.2 data.
As the code to convert the raw extended name into printable format
can be reused by stsi_2_2_2 we're moving the conversion code into a
separate function convert_ext_name.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/include/asm/sysinfo.h
arch/s390/kernel/sysinfo.c

index 2728114d5484e847479cdda90d9887c50137976d..229326c942c72d3e6ad3e296b1aad62df380e28e 100644 (file)
@@ -107,6 +107,11 @@ struct sysinfo_2_2_2 {
        char reserved_3[5];
        unsigned short cpus_dedicated;
        unsigned short cpus_shared;
+       char reserved_4[3];
+       unsigned char vsne;
+       uuid_be uuid;
+       char reserved_5[160];
+       char ext_name[256];
 };
 
 #define LPAR_CHAR_DEDICATED    (1 << 7)
@@ -127,7 +132,7 @@ struct sysinfo_3_2_2 {
                unsigned int caf;
                char cpi[16];
                char reserved_1[3];
-               char ext_name_encoding;
+               unsigned char evmne;
                unsigned int reserved_2;
                uuid_be uuid;
        } vm[8];
index bfda6aa402800c565445888afc7683d3c5d35b28..24021c1e3ecb98c371a7c1267ec29c9697ea1249 100644 (file)
@@ -56,6 +56,20 @@ int stsi(void *sysinfo, int fc, int sel1, int sel2)
 }
 EXPORT_SYMBOL(stsi);
 
+static bool convert_ext_name(unsigned char encoding, char *name, size_t len)
+{
+       switch (encoding) {
+       case 1: /* EBCDIC */
+               EBCASC(name, len);
+               break;
+       case 2: /* UTF-8 */
+               break;
+       default:
+               return false;
+       }
+       return true;
+}
+
 static void stsi_1_1_1(struct seq_file *m, struct sysinfo_1_1_1 *info)
 {
        int i;
@@ -207,24 +221,19 @@ static void stsi_2_2_2(struct seq_file *m, struct sysinfo_2_2_2 *info)
                seq_printf(m, "LPAR CPUs S-MTID:     %d\n", info->mt_stid);
                seq_printf(m, "LPAR CPUs PS-MTID:    %d\n", info->mt_psmtid);
        }
+       if (convert_ext_name(info->vsne, info->ext_name, sizeof(info->ext_name))) {
+               seq_printf(m, "LPAR Extended Name:   %-.256s\n", info->ext_name);
+               seq_printf(m, "LPAR UUID:            %pUb\n", &info->uuid);
+       }
 }
 
 static void print_ext_name(struct seq_file *m, int lvl,
                           struct sysinfo_3_2_2 *info)
 {
-       if (info->vm[lvl].ext_name_encoding == 0)
-               return;
-       if (info->ext_names[lvl][0] == 0)
-               return;
-       switch (info->vm[lvl].ext_name_encoding) {
-       case 1: /* EBCDIC */
-               EBCASC(info->ext_names[lvl], sizeof(info->ext_names[lvl]));
-               break;
-       case 2: /* UTF-8 */
-               break;
-       default:
+       size_t len = sizeof(info->ext_names[lvl]);
+
+       if (!convert_ext_name(info->vm[lvl].evmne, info->ext_names[lvl], len))
                return;
-       }
        seq_printf(m, "VM%02d Extended Name:   %-.256s\n", lvl,
                   info->ext_names[lvl]);
 }