lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 07 Jan 2020 20:29:40 -0500
From:   "Martin K. Petersen" <martin.petersen@...cle.com>
To:     Guenter Roeck <linux@...ck-us.net>
Cc:     "Martin K. Petersen" <martin.petersen@...cle.com>,
        linux-hwmon@...r.kernel.org, Jean Delvare <jdelvare@...e.com>,
        Linus Walleij <linus.walleij@...aro.org>,
        Bart Van Assche <bvanassche@....org>,
        linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-scsi@...r.kernel.org, linux-ide@...r.kernel.org,
        Chris Healy <cphealy@...il.com>
Subject: Re: [PATCH v2] hwmon: Driver for temperature sensors on SATA drives


Guenter,

> "scsi-8-140" is created by libsensors, so any change in that would
> have to be made there, not in the kernel driver.

Yes. Something like the patch below which will produce actual SCSI
device instance names:

	drivetemp-scsi-7:0:29:0
	drivetemp-scsi-8:0:30:0
	drivetemp-scsi-8:0:15:0
	drivetemp-scsi-7:0:24:0

Instead of the current:

	drivetemp-scsi-7-1d0
	drivetemp-scsi-8-1e0
	drivetemp-scsi-8-f0
	drivetemp-scsi-7-180

Other question: Does hwmon have any notion of sensor topology? As I
mentioned earlier, SCSI installations typically rely on SAF-TE or SES
instead of the physical drive sensors. SES also includes monitoring of
fans, power supplies, etc. And more importantly, it provides a
representation of the location of a given component. E.g.: Tray number
#4, disk drive bay #5.

So it would be helpful if libsensors had a way to represent sensors in a
way that mimics the physical device layout reported by SES.

-- 
Martin K. Petersen	Oracle Linux Engineering


diff --git a/lib/data.c b/lib/data.c
index c5aea42967a6..06cfa86f353b 100644
--- a/lib/data.c
+++ b/lib/data.c
@@ -202,8 +202,9 @@ int sensors_snprintf_chip_name(char *str, size_t size,
 		return snprintf(str, size, "%s-mdio-%x", chip->prefix,
 				chip->addr);
 	case SENSORS_BUS_TYPE_SCSI:
-		return snprintf(str, size, "%s-scsi-%hd-%x", chip->prefix,
-				chip->bus.nr, chip->addr);
+		return snprintf(str, size, "%s-scsi-%u:%u:%u:%lu", chip->prefix,
+				chip->bus.nr, chip->addr, chip->sub_addr,
+				chip->sub_sub_addr);
 	}
 
 	return -SENSORS_ERR_CHIP_NAME;
diff --git a/lib/sensors.h b/lib/sensors.h
index 94f6f23051d2..f468cccabc72 100644
--- a/lib/sensors.h
+++ b/lib/sensors.h
@@ -65,6 +65,8 @@ typedef struct sensors_chip_name {
 	char *prefix;
 	sensors_bus_id bus;
 	int addr;
+	unsigned int sub_addr;
+	unsigned long sub_sub_addr;
 	char *path;
 } sensors_chip_name;
 
diff --git a/lib/sysfs.c b/lib/sysfs.c
index e63688b72aba..f76b4a99aa7d 100644
--- a/lib/sysfs.c
+++ b/lib/sysfs.c
@@ -620,6 +620,7 @@ static int classify_device(const char *dev_name,
                            sensors_chip_features *entry)
 {
 	int domain, bus, slot, fn, vendor, product, id;
+	unsigned long lun;
 	char bus_path[NAME_MAX];
 	char *bus_attr;
 	int ret = 1;
@@ -687,11 +688,13 @@ static int classify_device(const char *dev_name,
 		entry->chip.bus.nr = 0;
 	} else
 	if (subsys && !strcmp(subsys, "scsi") &&
-	    sscanf(dev_name, "%d:%d:%d:%x", &domain, &bus, &slot, &fn) == 4) {
+	    sscanf(dev_name, "%u:%u:%u:%lu", &domain, &bus, &id, &lun) == 4) {
 		/* adapter(host), channel(bus), id(target), lun */
-		entry->chip.addr = (bus << 8) + (slot << 4) + fn;
-		entry->chip.bus.type = SENSORS_BUS_TYPE_SCSI;
 		entry->chip.bus.nr = domain;
+		entry->chip.addr = bus;
+		entry->chip.sub_addr = id;
+		entry->chip.sub_sub_addr = lun;
+		entry->chip.bus.type = SENSORS_BUS_TYPE_SCSI;
 	} else {
 		/* Unknown device */
 		ret = 0;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ