storagetm: ensure we pass dev_t* to sd_device_get_devnum
On MIPS32 OABI, st_rdev is unsigned long, not dev_t. Use a temporary variable to avoid an incompatible pointer. Bug: https://bugs.gentoo.org/920576 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=21278 Fixes: https://github.com/systemd/systemd/issues/30626
This commit is contained in:
committed by
Yu Watanabe
parent
e40a67809b
commit
049f178b80
@@ -950,9 +950,14 @@ static int device_added(Context *c, sd_device *device) {
|
||||
.st_mode = S_IFBLK,
|
||||
};
|
||||
|
||||
r = sd_device_get_devnum(device, &lookup_key.st_rdev);
|
||||
/* MIPS OABI declares st_rdev as unsigned long instead of dev_t.
|
||||
* Use a temp var to avoid passing an incompatible pointer.
|
||||
* https://sourceware.org/bugzilla/show_bug.cgi?id=21278 */
|
||||
dev_t devnum;
|
||||
r = sd_device_get_devnum(device, &devnum);
|
||||
if (r < 0)
|
||||
return log_device_error_errno(device, r, "Failed to get major/minor from device: %m");
|
||||
lookup_key.st_rdev = devnum;
|
||||
|
||||
if (hashmap_contains(c->subsystems, &lookup_key)) {
|
||||
log_debug("Device '%s' already seen.", devname);
|
||||
@@ -1006,9 +1011,14 @@ static int device_removed(Context *c, sd_device *device) {
|
||||
.st_mode = S_IFBLK,
|
||||
};
|
||||
|
||||
r = sd_device_get_devnum(device, &lookup_key.st_rdev);
|
||||
/* MIPS OABI declares st_rdev as unsigned long instead of dev_t.
|
||||
* Use a temp var to avoid passing an incompatible pointer.
|
||||
* https://sourceware.org/bugzilla/show_bug.cgi?id=21278 */
|
||||
dev_t devnum;
|
||||
r = sd_device_get_devnum(device, &devnum);
|
||||
if (r < 0)
|
||||
return log_device_error_errno(device, r, "Failed to get major/minor from device: %m");
|
||||
lookup_key.st_rdev = devnum;
|
||||
|
||||
NvmeSubsystem *s = hashmap_remove(c->subsystems, &lookup_key);
|
||||
if (!s)
|
||||
|
||||
Reference in New Issue
Block a user