diff options
author | Ryan Harper <ryanh@us.ibm.com> | 2010-06-23 22:19:57 -0500 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2010-08-05 13:05:30 +0930 |
commit | a5eb9e4ff18a33e43557d44b205f953b0c1efade (patch) | |
tree | 5b7a1bf70763c08ded665a341ea3cf2d9def9ef6 /samples | |
parent | 10bc310c27af1ed358e62351e7ac1d0110c3da27 (diff) |
virtio_blk: Add 'serial' attribute to virtio-blk devices (v2)
Create a new attribute for virtio-blk devices that will fetch the serial number
of the block device. This attribute can be used by udev to create disk/by-id
symlinks for devices that don't have a UUID (filesystem) associated with them.
ATA_IDENTIFY strings are special in that they can be up to 20 chars long
and aren't required to be nul-terminated. The buffer is also zero-padded
meaning that if the serial is 19 chars or less that we get a nul-terminated
string. When copying this value into a string buffer, we must be careful to
copy up to the nul (if it present) and only 20 if it is longer and not to
attempt to nul terminate; this isn't needed.
Changes since v1:
- Added BUILD_BUG_ON() for PAGE_SIZE check
- Removed min() since BUILD_BUG_ON() handles the check
- Replaced serial_sysfs() by copying id directly to buffer
Signed-off-by: Ryan Harper <ryanh@us.ibm.com>
Signed-off-by: john cooper <john.cooper@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'samples')
0 files changed, 0 insertions, 0 deletions