]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
machine-info: rename VENDOR=/MODEL= → HARDWARE_VENDOR=/HARDWARE_MODEL=
authorLennart Poettering <lennart@poettering.net>
Thu, 24 Mar 2022 16:48:11 +0000 (17:48 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 24 Mar 2022 20:29:13 +0000 (21:29 +0100)
Let's be more precise here. Otherwise people might think this describes
the software system or so. We already expose this via hostnamed as
HardwareVendor/HardwareModel hence use the exact same wording.

(Note that the relevant props on the dmi device are just VENDOR/MODEL,
but that's OK given that DMI really is about hardware anyway,
unconditionally, hence no chance of confusion there.)

Follow-up for 4fc7e4f374bf4401330e90e267227267abf1dcac

NEWS
man/machine-info.xml
src/hostname/hostnamed.c

diff --git a/NEWS b/NEWS
index 22aff768310b93289d741364cd3b7742a909d20f..2d34d88a4701378d5adc5fdf0af81c628ace2601 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -183,8 +183,8 @@ CHANGES WITH 251 in spe:
 
           'portablectl attach --extension=' now also accepts directory paths.
 
-        * VENDOR= and MODEL= can be set in /etc/machine-info to override the
-          values gleaned from the hwdb.
+        * HARDWARE_VENDOR= and HARDWARE_MODEL= can be set in /etc/machine-info
+          to override the values gleaned from the hwdb.
 
         * A ID_CHASSIS property can be set in the hwdb (for the DMI device
           /sys/class/dmi/id) to override the chassis that is reported by
index fddcfb6a6c451d1af013ebd4778a6de35a220c52..4e6b72cea24fb111880808b65551285e00e57d0e 100644 (file)
       </varlistentry>
 
       <varlistentry>
-        <term><varname>VENDOR=</varname></term>
+        <term><varname>HARDWARE_VENDOR=</varname></term>
 
-        <listitem><para>Specifies the hardware vendor. If unspecified, the hardware vendor set in DMI
-        or hwdb will be used.</para></listitem>
+        <listitem><para>Specifies the hardware vendor. If unspecified, the hardware vendor set in DMI or
+        <citerefentry><refentrytitle>hwdb</refentrytitle><manvolnum>7</manvolnum></citerefentry> will be
+        used.</para></listitem>
       </varlistentry>
 
       <varlistentry>
-        <term><varname>MODEL=</varname></term>
+        <term><varname>HARDWARE_MODEL=</varname></term>
 
         <listitem><para>Specifies the hardware model. If unspecified, the hardware model set in DMI or
-        hwdb will be used.</para></listitem>
+        <citerefentry><refentrytitle>hwdb</refentrytitle><manvolnum>7</manvolnum></citerefentry> will be
+        used.</para></listitem>
       </varlistentry>
     </variablelist>
   </refsect1>
index 10015a513bb5dcc7e45a0fd07747a6ff36cc442e..01ac5bb80522e93662d20821d0fe9b7dcdd44348 100644 (file)
@@ -53,8 +53,8 @@ typedef enum {
         PROP_CHASSIS,
         PROP_DEPLOYMENT,
         PROP_LOCATION,
-        PROP_VENDOR,
-        PROP_MODEL,
+        PROP_HARDWARE_VENDOR,
+        PROP_HARDWARE_MODEL,
 
         /* Read from /etc/os-release (or /usr/lib/os-release) */
         PROP_OS_PRETTY_NAME,
@@ -136,8 +136,8 @@ static void context_read_machine_info(Context *c) {
                            "CHASSIS", &c->data[PROP_CHASSIS],
                            "DEPLOYMENT", &c->data[PROP_DEPLOYMENT],
                            "LOCATION", &c->data[PROP_LOCATION],
-                           "VENDOR", &c->data[PROP_VENDOR],
-                           "MODEL", &c->data[PROP_MODEL]);
+                           "HARDWARE_VENDOR", &c->data[PROP_HARDWARE_VENDOR],
+                           "HARDWARE_MODEL", &c->data[PROP_HARDWARE_MODEL]);
         if (r < 0 && r != -ENOENT)
                 log_warning_errno(r, "Failed to read /etc/machine-info, ignoring: %m");
 
@@ -563,7 +563,7 @@ static int property_get_hardware_property(
 
         assert(reply);
         assert(c);
-        assert(IN_SET(prop, PROP_VENDOR, PROP_MODEL));
+        assert(IN_SET(prop, PROP_HARDWARE_VENDOR, PROP_HARDWARE_MODEL));
         assert(getter);
 
         context_read_machine_info(c);
@@ -583,7 +583,7 @@ static int property_get_hardware_vendor(
                 void *userdata,
                 sd_bus_error *error) {
 
-        return property_get_hardware_property(reply, userdata, PROP_VENDOR, get_hardware_vendor);
+        return property_get_hardware_property(reply, userdata, PROP_HARDWARE_VENDOR, get_hardware_vendor);
 }
 
 static int property_get_hardware_model(
@@ -595,7 +595,7 @@ static int property_get_hardware_model(
                 void *userdata,
                 sd_bus_error *error) {
 
-        return property_get_hardware_property(reply, userdata, PROP_MODEL, get_hardware_model);
+        return property_get_hardware_property(reply, userdata, PROP_HARDWARE_MODEL, get_hardware_model);
 }
 
 static int property_get_hostname(
@@ -1179,9 +1179,9 @@ static int method_describe(sd_bus_message *m, void *userdata, sd_bus_error *erro
 
         assert_se(uname(&u) >= 0);
 
-        if (isempty(c->data[PROP_VENDOR]))
+        if (isempty(c->data[PROP_HARDWARE_VENDOR]))
                 (void) get_hardware_vendor(&vendor);
-        if (isempty(c->data[PROP_MODEL]))
+        if (isempty(c->data[PROP_HARDWARE_MODEL]))
                 (void) get_hardware_model(&model);
 
         if (privileged) {
@@ -1206,8 +1206,8 @@ static int method_describe(sd_bus_message *m, void *userdata, sd_bus_error *erro
                                        JSON_BUILD_PAIR("OperatingSystemPrettyName", JSON_BUILD_STRING(c->data[PROP_OS_PRETTY_NAME])),
                                        JSON_BUILD_PAIR("OperatingSystemCPEName", JSON_BUILD_STRING(c->data[PROP_OS_CPE_NAME])),
                                        JSON_BUILD_PAIR("OperatingSystemHomeURL", JSON_BUILD_STRING(c->data[PROP_OS_HOME_URL])),
-                                       JSON_BUILD_PAIR("HardwareVendor", JSON_BUILD_STRING(vendor ?: c->data[PROP_VENDOR])),
-                                       JSON_BUILD_PAIR("HardwareModel", JSON_BUILD_STRING(model ?: c->data[PROP_MODEL])),
+                                       JSON_BUILD_PAIR("HardwareVendor", JSON_BUILD_STRING(vendor ?: c->data[PROP_HARDWARE_VENDOR])),
+                                       JSON_BUILD_PAIR("HardwareModel", JSON_BUILD_STRING(model ?: c->data[PROP_HARDWARE_MODEL])),
                                        JSON_BUILD_PAIR("HardwareSerial", JSON_BUILD_STRING(serial)),
                                        JSON_BUILD_PAIR_CONDITION(!sd_id128_is_null(product_uuid), "ProductUUID", JSON_BUILD_ID128(product_uuid)),
                                        JSON_BUILD_PAIR_CONDITION(sd_id128_is_null(product_uuid), "ProductUUID", JSON_BUILD_NULL)));