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

Re: [libvirt] [PATCH] 3/4 Add SMBIOS QEmu driver



On 10/21/2010 02:23 PM, Daniel Veillard wrote:
The main trouble here is that the QEmu command uses names which are
similar to the official names for the entries used by the DMTF, but
that mean we cant base on name equality. I was tempted to use

s/cant/can't/

something like strcasestr to go fishing on the names but since we
never used this in libvirt yet, and I'm not sure it's available in
gnulib, I did the patch using strstr, assuming entries provided by the

Gnulib provides strcasestr() as LGPLv2+ (but beware - it only does what you want in unibyte locales); it also provides the c-strcasestr module (which is probably exactly what you want!), but it is currently LGPLv3+, although I can request on the gnulib list to have it relaxed if you'd like.

users would contain the word in lower case usually except maybe for the
first character. The matching glue is certainly perfectible.

c_strcasestr() would certainly make it easier.

Or, is this something where STRCASEEQ() would be good enough? That is, do we expect a user to always provide the full DMTF name "BIOS Version", or is the substring matching important because we want to all the user the shortcut of "Version"?

Also decided that if we can't associate an entry with an existing
QEmu SMBIOS command we would ignore it. On the ther hand if a block

s/ther/other/

other than type 0 or 1 is used in the XML definition we would emit
a warning, but still not fail.

+    /*
+     * QEmu accepts only a limited set of System informations, and
+     * use command line arguments shortcuts from the DMTF real names
+     * so go fishing for those
+     */
+    cur = def->entries;
+    while (cur != NULL) {
+        /* 0:Vendor */
+        if ((def->type == 0)&&  (strstr(cur->name, "endor")))
+            virBufferVSprintf(&buf, ",vendor=\"%s\"", cur->value);
+        /* 0:BIOS Version */
+        else if ((def->type == 0)&&  (strstr(cur->name, "ersion")))
+            virBufferVSprintf(&buf, ",version=\"%s\"", cur->value);
+        /* 0:BIOS Release Date */
+        else if ((def->type == 0)&&  (strstr(cur->name, "ate")))
+            virBufferVSprintf(&buf, ",date=\"%s\"", cur->value);
+        /* 0:System BIOS Major Release and 0:System BIOS Minor Release */
+        else if ((def->type == 0)&&  (strstr(cur->name, "elease")))
+            virBufferVSprintf(&buf, ",date=\"%s\"", cur->value);

If the user provides both "Date" and "Major Release" names, does qemu complain about the doubled-up date="" option?

--
Eric Blake   eblake redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org


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