X Tutup
Skip to content

Commit 0924ea2

Browse files
committed
machine-info: rename VENDOR=/MODEL= → HARDWARE_VENDOR=/HARDWARE_MODEL=
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 4fc7e4f
1 parent a73c7a8 commit 0924ea2

File tree

3 files changed

+20
-18
lines changed

3 files changed

+20
-18
lines changed

NEWS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,8 @@ CHANGES WITH 251 in spe:
183183

184184
'portablectl attach --extension=' now also accepts directory paths.
185185

186-
* VENDOR= and MODEL= can be set in /etc/machine-info to override the
187-
values gleaned from the hwdb.
186+
* HARDWARE_VENDOR= and HARDWARE_MODEL= can be set in /etc/machine-info
187+
to override the values gleaned from the hwdb.
188188

189189
* A ID_CHASSIS property can be set in the hwdb (for the DMI device
190190
/sys/class/dmi/id) to override the chassis that is reported by

man/machine-info.xml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,17 +130,19 @@
130130
</varlistentry>
131131

132132
<varlistentry>
133-
<term><varname>VENDOR=</varname></term>
133+
<term><varname>HARDWARE_VENDOR=</varname></term>
134134

135-
<listitem><para>Specifies the hardware vendor. If unspecified, the hardware vendor set in DMI
136-
or hwdb will be used.</para></listitem>
135+
<listitem><para>Specifies the hardware vendor. If unspecified, the hardware vendor set in DMI or
136+
<citerefentry><refentrytitle>hwdb</refentrytitle><manvolnum>7</manvolnum></citerefentry> will be
137+
used.</para></listitem>
137138
</varlistentry>
138139

139140
<varlistentry>
140-
<term><varname>MODEL=</varname></term>
141+
<term><varname>HARDWARE_MODEL=</varname></term>
141142

142143
<listitem><para>Specifies the hardware model. If unspecified, the hardware model set in DMI or
143-
hwdb will be used.</para></listitem>
144+
<citerefentry><refentrytitle>hwdb</refentrytitle><manvolnum>7</manvolnum></citerefentry> will be
145+
used.</para></listitem>
144146
</varlistentry>
145147
</variablelist>
146148
</refsect1>

src/hostname/hostnamed.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ typedef enum {
5353
PROP_CHASSIS,
5454
PROP_DEPLOYMENT,
5555
PROP_LOCATION,
56-
PROP_VENDOR,
57-
PROP_MODEL,
56+
PROP_HARDWARE_VENDOR,
57+
PROP_HARDWARE_MODEL,
5858

5959
/* Read from /etc/os-release (or /usr/lib/os-release) */
6060
PROP_OS_PRETTY_NAME,
@@ -136,8 +136,8 @@ static void context_read_machine_info(Context *c) {
136136
"CHASSIS", &c->data[PROP_CHASSIS],
137137
"DEPLOYMENT", &c->data[PROP_DEPLOYMENT],
138138
"LOCATION", &c->data[PROP_LOCATION],
139-
"VENDOR", &c->data[PROP_VENDOR],
140-
"MODEL", &c->data[PROP_MODEL]);
139+
"HARDWARE_VENDOR", &c->data[PROP_HARDWARE_VENDOR],
140+
"HARDWARE_MODEL", &c->data[PROP_HARDWARE_MODEL]);
141141
if (r < 0 && r != -ENOENT)
142142
log_warning_errno(r, "Failed to read /etc/machine-info, ignoring: %m");
143143

@@ -563,7 +563,7 @@ static int property_get_hardware_property(
563563

564564
assert(reply);
565565
assert(c);
566-
assert(IN_SET(prop, PROP_VENDOR, PROP_MODEL));
566+
assert(IN_SET(prop, PROP_HARDWARE_VENDOR, PROP_HARDWARE_MODEL));
567567
assert(getter);
568568

569569
context_read_machine_info(c);
@@ -583,7 +583,7 @@ static int property_get_hardware_vendor(
583583
void *userdata,
584584
sd_bus_error *error) {
585585

586-
return property_get_hardware_property(reply, userdata, PROP_VENDOR, get_hardware_vendor);
586+
return property_get_hardware_property(reply, userdata, PROP_HARDWARE_VENDOR, get_hardware_vendor);
587587
}
588588

589589
static int property_get_hardware_model(
@@ -595,7 +595,7 @@ static int property_get_hardware_model(
595595
void *userdata,
596596
sd_bus_error *error) {
597597

598-
return property_get_hardware_property(reply, userdata, PROP_MODEL, get_hardware_model);
598+
return property_get_hardware_property(reply, userdata, PROP_HARDWARE_MODEL, get_hardware_model);
599599
}
600600

601601
static int property_get_hostname(
@@ -1179,9 +1179,9 @@ static int method_describe(sd_bus_message *m, void *userdata, sd_bus_error *erro
11791179

11801180
assert_se(uname(&u) >= 0);
11811181

1182-
if (isempty(c->data[PROP_VENDOR]))
1182+
if (isempty(c->data[PROP_HARDWARE_VENDOR]))
11831183
(void) get_hardware_vendor(&vendor);
1184-
if (isempty(c->data[PROP_MODEL]))
1184+
if (isempty(c->data[PROP_HARDWARE_MODEL]))
11851185
(void) get_hardware_model(&model);
11861186

11871187
if (privileged) {
@@ -1206,8 +1206,8 @@ static int method_describe(sd_bus_message *m, void *userdata, sd_bus_error *erro
12061206
JSON_BUILD_PAIR("OperatingSystemPrettyName", JSON_BUILD_STRING(c->data[PROP_OS_PRETTY_NAME])),
12071207
JSON_BUILD_PAIR("OperatingSystemCPEName", JSON_BUILD_STRING(c->data[PROP_OS_CPE_NAME])),
12081208
JSON_BUILD_PAIR("OperatingSystemHomeURL", JSON_BUILD_STRING(c->data[PROP_OS_HOME_URL])),
1209-
JSON_BUILD_PAIR("HardwareVendor", JSON_BUILD_STRING(vendor ?: c->data[PROP_VENDOR])),
1210-
JSON_BUILD_PAIR("HardwareModel", JSON_BUILD_STRING(model ?: c->data[PROP_MODEL])),
1209+
JSON_BUILD_PAIR("HardwareVendor", JSON_BUILD_STRING(vendor ?: c->data[PROP_HARDWARE_VENDOR])),
1210+
JSON_BUILD_PAIR("HardwareModel", JSON_BUILD_STRING(model ?: c->data[PROP_HARDWARE_MODEL])),
12111211
JSON_BUILD_PAIR("HardwareSerial", JSON_BUILD_STRING(serial)),
12121212
JSON_BUILD_PAIR_CONDITION(!sd_id128_is_null(product_uuid), "ProductUUID", JSON_BUILD_ID128(product_uuid)),
12131213
JSON_BUILD_PAIR_CONDITION(sd_id128_is_null(product_uuid), "ProductUUID", JSON_BUILD_NULL)));

0 commit comments

Comments
 (0)
X Tutup