1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-28 20:25:38 +03:00
Commit Graph

115 Commits

Author SHA1 Message Date
David Zeuthen
7f4954d040 Export ID_WWN_VENDOR_EXTENSION and ID_WWN_WITH_EXTENSION
Some SCSI devices use the same WWN and have a WWN extension that we
need to take into account when creating the /dev/disk/by-id/wwn
symlinks. Thus, introduce ID_WWN_WITH_EXTENSION. This property will
contain either the WWN (if no extension is present) or the WWN with
the vendor extension appended.

Example:

 # /lib/udev/ata_id/ata_id --export /dev/sda |grep WWN
 ID_WWN=0x5001517387d61905
 ID_WWN_WITH_EXTENSION=0x5001517387d61905

 # /lib/udev/scsi_id --whitelisted --export -d /dev/sdb |grep WWN
 ID_WWN=0x600508b400105df7
 ID_WWN_VENDOR_EXTENSION=0x0000e00000d80000
 ID_WWN_WITH_EXTENSION=0x600508b400105df70000e00000d80000

 # /lib/udev/scsi_id --whitelisted --export -d /dev/sdc |grep WWN
 ID_WWN=0x600508b400105df7
 ID_WWN_VENDOR_EXTENSION=0x0000e00000db0000
 ID_WWN_WITH_EXTENSION=0x600508b400105df70000e00000db0000

Signed-off-by: David Zeuthen <davidz@redhat.com>
2009-12-04 11:40:00 -05:00
David Zeuthen
4e9fdfccbd scsi_id: Export WWN and Unit Serial Number
Since the Unit Serial Number and the WWN are useful bits of
information export them as properties in the udev database. These
bits of information are often printed on the physical disk, see

http://people.freedesktop.org/~david/FUJITSU-MAY2036RC-sas-disk-picture.jpg

and displaying them separately in the UI (or in /dev/disk) might help
users identify the physical disk. This patch exports these bits of
information as ID_WWN and ID_SCSI_SERIAL.

Note that ata_id also use the ID_WWN property since commit
66094a4a7f (2009-11-04).

Also print out ID_SCSI=1 so users of the udev database knows the disk
speaks SCSI.

Here's the scsi_id output from one of my SAS disks with these changes:

 ID_SCSI=1
 ID_VENDOR=FUJITSU
 ID_VENDOR_ENC=FUJITSU\x20
 ID_MODEL=MAY2036RC
 ID_MODEL_ENC=MAY2036RC\x20\x20\x20\x20\x20\x20\x20
 ID_REVISION=0103
 ID_TYPE=disk
 ID_SERIAL=3500000e01b83f520
 ID_SERIAL_SHORT=500000e01b83f520
 ID_WWN=0x500000e01b83f520
 ID_SCSI_SERIAL=B3G1P8500RWT

Unfortunately we can't overload ID_SERIAL for two reasons

 1. ID_SERIAL (and ID_SERIAL_SHORT) exported by scsi_id isn't really
    the unit serial number (as defined by SCSI) - it is sometimes the
    WWN (since it is more unique than the Unit Serial Number) and
    complex rules (to make the serial unique) govern what value to
    use.

 2. It would break existing setups if the value of ID_SERIAL changed

Signed-off-by: David Zeuthen <davidz@redhat.com>
2009-11-23 21:38:21 +01:00
Harald Hoyer
676cea155a scsi_id: prevent buffer overflow in check_fill_0x83_prespc3()
see https://bugzilla.redhat.com/show_bug.cgi?id=516920
2009-09-17 00:06:03 +02:00
Kay Sievers
24355313dc scsi_id: delete copy of bsg.h
It's provided by the kernel since 2.6.23.
2009-09-14 14:33:26 +02:00
Kay Sievers
78715f65c9 fix randonm findings from llvm-clang-analyzer
Thanks to Lennart for the log file!
2009-09-08 22:11:04 +02:00
Daniel Mierswa
959e8b5dec use nanosleep() instead of usleep()
POSIX.1-2001 declares usleep() function obsolete and POSIX.1-2008
removes it.

[Kay Sievers]
  - include time.h
  - use const for timespec
  - scsi_id: drop rand() in retry loop
  - modem-probe: rename msuspend() to msleep()
2009-08-30 23:58:57 +02:00
Alan Jenkins
214a6c791c fix spelling
Fix spelling in docbook comments, code comments, and a local variable
name.  Thanks to "ispell -h" for docbook HTML and "scspell" for source
code.

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2009-08-08 15:42:05 +02:00
Diego Elio 'Flameeyes' Pettenò
59d93adb29 Merge libudev, udev, and the unconditional extras in a single Makefile.am.
Instead of using multiple recursive Makefile.am files, use a single
Makefile.am that sets and builds all the basic suite of libraries and
binaries for udev. This reduces the number of files in the source tree, and
also reduces drastically the build time when using parallel-make.

With this setup, all the compile steps will be executed in parallel, and
just the linking stage will be (partially) serialised on the libraries
creation.
2009-08-07 19:15:28 +02:00
Kay Sievers
2a827c959a make: build internal tools against libudev-private.la 2009-07-25 20:37:45 +02:00
Ian Campbell
c3eedf6567 scsi_id: correct error handling in prepend_vendor_model
The callers of prepend_vendor_model both expect < 0 to be returned on
error and the index to be returned otherwise. However
prepend_vendor_model actually returns 1 on error. Fix this by correctly
returning -1.

Older kernels (before e5b3cd42: "SCSI: sanitize INQUIRY strings")
truncated the model field in sysfs (or propagated bad results from the
target) to less than the expected/required 16 characters which meant
that the SCSI id was mangled into:
        # /sbin/scsi_id -g -s /block/sdg
        S146cee20VIRTUAL-DISK
when it should have been:
        # /sbin/scsi_id -g -s /block/sdg
        SIET     VIRTUAL-DISK   146cee20

Notice how the serial number has been pasted over the vendor+model at
index 1 instead of being added at the end.

In the former case:
        # cat /sys/devices/platform/host5/session1/target5:0:0/5:0:0:1/model | od -t c -t x1
        0000000   V   I   R   T   U   A   L   -   D   I   S   K  \n
                56 49 52 54 55 41 4c 2d 44 49 53 4b 0a
But it should have been:
        # cat /sys/devices/platform/host5/session1/target5:0:0/5:0:0:1/model | od -t c -t x1
        0000000   V   I   R   T   U   A   L   -   D   I   S   K
                56 49 52 54 55 41 4c 2d 44 49 53 4b 20 20 20 20
        0000020  \n
                0a

Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
2009-07-06 16:21:08 +02:00
Kay Sievers
84875aa6b3 scsi_id: delete no longer needed config file 2009-06-28 03:01:31 +02:00
Kay Sievers
a8916c3400 scsi_id: --reformat_serial - use udev_util_replace_whitespace() 2009-06-28 02:27:23 +02:00
Kay Sievers
6133f3432f cleanup ./configure installation directory options 2009-06-17 02:25:07 +02:00
Kay Sievers
9060b066d9 move syslog wrapper to libudev 2009-06-09 22:47:48 +02:00
Kay Sievers
48a9b173e8 libudev: move to top-level directory 2009-06-08 21:36:06 +02:00
Kay Sievers
065db05221 use more efficient string copying 2009-05-20 17:57:52 +02:00
David Zeuthen
ad88f9409a *_id: add model/vendor enc strings
So ID_MODEL and ID_VENDOR are pretty useful keys. However since we fix
them up (removing leading/trailing whitespace, converts spaces to
underscores) for use in device naming etc. we also force these fixups on
the desktop shell. And this looks pretty ugly.

The attached patch introduces the ID_MODEL_ENC and ID_VENDOR_ENC keys
that contains the encoded version of the raw strings obtained. It's
pretty similar in spirit to ID_FS_LABEL and its cousin ID_FS_LABEL_ENC.

With this patch a desktop shell can fix up these strings as it sees fit.
Note that some fixup is still needed though, for example

# /lib/udev/ata_id --export /dev/sda |grep ID_MODEL
ID_MODEL=INTEL_SSDSA2MH080G1GC
ID_MODEL_ENC=INTEL\x20SSDSA2MH080G1GC\x20\x20\x20\x20\x20\x20\x20\x20
\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20

Note the trailing and leading whitespace. Anyway with the attached patch
the desktop shell should be able to display "INTEL SSDSA2MH080G1GC"
rather than "INTEL_SSDSA2MH080G1GC" to the user.
2009-02-17 21:45:43 +01:00
Kay Sievers
5d89ef7bf9 make: do not delete autotools generated file with distclean
[...] running the command
`make maintainer-clean' should not delete `configure' even if
`configure' can be remade using a rule in the Makefile.  More
generally, `make maintainer-clean' should not delete anything that
needs to exist in order to run `configure' and then begin to build
the program.  This is the only exception; `maintainer-clean' should
delete everything else that can be rebuilt.
2008-12-06 04:03:08 +01:00
Kay Sievers
caf4c97a2c scsi_id: do not fail if no serial is found like for optical drives 2008-12-02 19:23:38 +01:00
Peter Breitenlohner
4435308844 man: fix typos 2008-11-21 10:50:12 +01:00
Kay Sievers
1340a9e9ec scsi_id: make sure, we do not have slashes in values 2008-11-20 07:57:17 +01:00
Alan Jenkins
0bf41e6c24 scsi_id: we don't use DEVPATH env var anymore, update man page
Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2008-11-13 01:37:25 +01:00
Kay Sievers
92f4313665 unify string replacement 2008-11-05 21:49:52 +01:00
Kay Sievers
1822e9b033 do not init string arrays, just clear first byte 2008-10-26 02:31:54 +01:00
Alan Jenkins
111e4f81ff replace strncpy() with strlcpy()
The problem was strncpy() doesn't stop after writing the terminating
NUL; by definition it goes on to zero the entire buffer.

I spy another use of strncpy in udev_device_add_property_from_string(),
which is responsible for another ~1% user cpu time...

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2008-10-21 23:55:13 +02:00
Kay Sievers
f183b6ed76 libudev: add global property list 2008-10-16 13:51:29 +02:00
Kay Sievers
e598c5738c libudev: get rid of selinux
"Hello world!" linked against libselinux parses /proc/mounts and
whatever else on startup, even when the lib is not needed at all.
Not funny! Get rid of that thing where it's not absolutely needed.
2008-10-02 18:48:40 +02:00
Kay Sievers
033e9f8cde use no_argument, required_argument, optional_argument in longopts 2008-10-02 16:49:05 +02:00
Kay Sievers
4aa0b15efb fix dbg() callers 2008-09-29 19:03:08 +02:00
Kay Sievers
38f27948cd always include config.h from Makefile 2008-09-19 23:03:49 -07:00
Alan Jenkins
a4354f9385 scsi_id: compiler warning on 32-bit
The sg_io_v4 interface passes pointers as u64s.  It turns out GCC
disapproves of us casting a u64 straight to a 32 bit pointer.

cc1: warnings being treated as errors
scsi_serial.c: In function ‘sg_err_category4’:
scsi_serial.c:159: warning: cast to pointer from integer of different size
scsi_serial.c: In function ‘scsi_dump_v4’:
scsi_serial.c:303: warning: cast to pointer from integer of different size
2008-09-19 22:14:46 -07:00
Kay Sievers
7525097713 extras: use libudev code 2008-09-10 18:24:39 +02:00
Kay Sievers
b2946df419 libudev: rename libudev-utils.c libudev-util.c 2008-09-10 17:12:33 +02:00
Kay Sievers
7a01f11afb libudev: get rid of udev_utils.c 2008-09-10 17:08:24 +02:00
Kay Sievers
b21b95d722 libudev: get rid of udev_sysfs.c 2008-09-10 14:29:07 +02:00
Kay Sievers
4f4b12c203 libudev: add selinux 2008-09-10 00:46:17 +02:00
Kay Sievers
7d563a17f3 use libudev code, unify logging, pass udev context around everywhere 2008-09-06 15:45:31 +02:00
Kay Sievers
01618658fd use autotools 2008-07-30 01:45:23 +02:00
Kay Sievers
726687ad48 delete all Makefiles and move udev source to udev/ 2008-07-30 00:39:15 +02:00
Kay Sievers
05364975af scsi_id: the fallback fix broke error handling 2008-07-10 22:22:10 +02:00
Marco d'Itri
52b375bc3b scsi_id: man page fix
minus signs need to be escaped and the program is not in the $PATH anymore
2008-07-10 00:17:24 +02:00
Thomas Koeller
629e57e0d4 scsi_id: include sys/stat.h
I could not build scsi_id because of a missing #include
for sys/stat.h, so I had to add that.

Signed-off-by: Thomas Koeller <thomas@koeller.dyndns.org>
2008-07-10 00:08:32 +02:00
Kay Sievers
24dabba541 scsi_id: fix fallback to sg v3 for sg nodes 2008-07-07 11:18:49 +02:00
Harald Hoyer
1ecb086460 scsi_id: retry open() on -EBUSY 2008-06-11 23:26:18 +02:00
Kay Sievers
53ba69a0c2 scsi_id: add bsg.h 2008-05-16 12:52:42 +02:00
Kay Sievers
025570aa3e scsi_id: add --sg-version= option 2008-05-14 15:02:17 +02:00
Kay Sievers
2d05764a77 scsi_id: remove bus_id option 2008-05-14 13:59:25 +02:00
Kay Sievers
138cf75e4e scsi_id: update man page 2008-05-14 13:59:11 +02:00
Hannes Reinecke
78d9ecfd4f scsi_id: add SGv4 support
Fall back to SGv3, if SGv3 returns a failure/is not available.
2008-05-14 13:55:49 +02:00
Hannes Reinecke
753417db2b scsi_id: remove all sysfs dependencies 2008-05-14 13:42:41 +02:00