Getting HDD serial in kernel space

From: Andrey Polovov
Date: Sat Nov 14 2009 - 06:54:36 EST


Hello.

I had a necessity to get HDD serial number in my kernel module.
In user space I can do it so:

fd = open( "/dev/sda", O_RDONLY|O_NONBLOCK );
ioctl( fd, HDIO_GET_IDENTITY, &id );
printf( "Serial: %s", id.serial_no );

How can I do it in kernel space (it is one hdd in machine, plugged with
SATA)?

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/