qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 15/19] s390x: print CPU definitions in sorted


From: David Hildenbrand
Subject: Re: [Qemu-devel] [PATCH v2 15/19] s390x: print CPU definitions in sorted order
Date: Thu, 7 Sep 2017 22:04:09 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0

>> +    CPUListState *s = user_data;
>> +    const S390CPUClass *scc = S390_CPU_CLASS((ObjectClass *)data);
>> +    char *name = g_strdup(object_class_get_name((ObjectClass *)data));
>>  
>>      /* strip off the -s390-cpu */
>>      g_strrstr(name, "-" TYPE_S390_CPU)[0] = 0;
>> -    (*info->print)(info->f, "s390 %-15s %-35s %s\n", name, scc->desc,
>> -                   details);
>> +    (*s->cpu_fprintf)(s->file, "s390 %-15s %-35s (%smigration-safe)\n", 
>> name,
>> +                      scc->desc, scc->is_static ? "static, " : "");
> 
> Hm, that now prints 's390 host' as 'migration safe'...

Very good point, will fix, thanks!

> 
>>      g_free(name);
>>  }
>>  
>> +static gint s390_cpu_list_compare(gconstpointer a, gconstpointer b)
>> +{
>> +    const S390CPUClass *cc_a = S390_CPU_CLASS((ObjectClass *)a);
>> +    const S390CPUClass *cc_b = S390_CPU_CLASS((ObjectClass *)b);
>> +    const char *name_a = object_class_get_name((ObjectClass *)a);
>> +    const char *name_b = object_class_get_name((ObjectClass *)b);
>> +
>> +    /* move qemu and host to the top of the list, qemu first, host second */
>> +    if (name_a[0] == 'q') {
>> +        return -1;
>> +    } else if (name_b[0] == 'q') {
>> +        return 1;
>> +    } else if (name_a[0] == 'h') {
>> +        return -1;
>> +    } else if (name_b[0] == 'h') {
>> +        return 1;
>> +    }
> 
> Are we sure that there will never be models starting with q or h? But
> we can worry about that later.

Could be but unlikely. In the worst case sorting would be wrong, I think
we can live with that :)


-- 

Thanks,

David



reply via email to

[Prev in Thread] Current Thread [Next in Thread]