From: Ryan Harper Date: Thu, 24 Jun 2010 03:19:57 +0000 (-0500) Subject: virtio_blk: Add 'serial' attribute to virtio-blk devices (v2) X-Git-Tag: v2.6.36-rc1~550^2~1 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a5eb9e4ff18a33e43557d44b205f953b0c1efade;p=pandora-kernel.git 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 Signed-off-by: john cooper Signed-off-by: Rusty Russell --- Reading git-diff-tree failed