Re: [gtk-list] [OT] a question about ioctrl



On Fri, 17 Sep 1999 10:06:26 -0600, Jiang XU wrote:
> I have a linux question , I wonder whether I can find answer here.

Ehm, this *is* off topic. There seems to be a Linux C programming list,
to which I tried to subscribe to this morning, but until now without
success.

> I try to get the harddisk information by calling ioctl()
> 
> I did like this:
> 
>     fd=open("/dev/hda7",O_RDWR);
>     ioctl(fd,HDIO_GET_IDENTITY,diskinfo);
> 
> It can successfully open the hd, which means I get fd, but it turns
> wrong when calling ioctl(..).
> I print out the error message, it said :"Invalid Arguments".
> 
> I don't know where is wrong?

My guess is that you can only get the identity from a harddisk, not from a
harddisk *partition*. Try opening /dev/hda instead of /dev/hda7. BTW: Why
don't you just read the information from /proc/ide/ide0/hda/geometry ?


Erik

-- 
J.A.K. (Erik) Mouw, Information and Communication Theory Group, Department
of Electrical Engineering, Faculty of Information Technology and Systems,
Delft University of Technology, PO BOX 5031,  2600 GA Delft, The Netherlands
Phone: +31-15-2785859  Fax: +31-15-2781843  Email J.A.K.Mouw@its.tudelft.nl
WWW: http://www-ict.its.tudelft.nl/~erik/




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]