mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-05 08:00:30 +00:00
cam: Remove trailing spaces from serial numbers too
The SanDisk SD8SB8U1 and likely others pad their serial number with spaces on the end rather than the start (at least when connected to a SAS3008). This makes them difficult to wire unit numbers to with the serial because you have to specify the trailing spaces. Instead, strip out the trailing spaces. We already strip leading spaces both here. In addition, when glabel creates the devfs device nodes, leading and trailing spaces are removed already (so there will be no change there either). Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D32684
This commit is contained in:
parent
577f9aa266
commit
bd82711aff
|
@ -1615,6 +1615,14 @@ probedone(struct cam_periph *periph, union ccb *done_ccb)
|
|||
*/
|
||||
slen = 0;
|
||||
}
|
||||
/*
|
||||
* In apparent violation of the spec, some
|
||||
* devices pad their serial numbers with
|
||||
* trailing spaces. Remove them.
|
||||
*/
|
||||
while (slen > 0 &&
|
||||
serial_buf->serial_num[slen - 1] == ' ')
|
||||
slen--;
|
||||
memcpy(path->device->serial_num,
|
||||
&serial_buf->serial_num[start], slen);
|
||||
path->device->serial_num_len = slen;
|
||||
|
|
Loading…
Reference in a new issue