lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sat, 14 Nov 2009 15:28:26 +0000
From:	Alan Cox <alan@...rguk.ukuu.org.uk>
To:	Andrey Polovov <andrey.polovov@...il.com>
Cc:	linux-kernel@...r.kernel.org
Subject: Re: Getting HDD serial in kernel space

On Sat, 14 Nov 2009 14:34:54 +0300
Andrey Polovov <andrey.polovov@...il.com> wrote:

> 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)?

The identity when probed is all in the struct ata_device, although be
aware that it may not be unique per device and also that hotplug means
you need to be careful how you access it. Now and then you meet a device
where the serial number changes randomly each boot just to really annoy.

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ