[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: FreeBSD 5.x fixes
From: |
Yoshinori K. Okuji |
Subject: |
Re: FreeBSD 5.x fixes |
Date: |
Sat, 24 Jan 2004 12:21:43 +0100 |
User-agent: |
KMail/1.5.3 |
On Friday 23 January 2004 21:44, Sergey Matveychuk wrote:
> See:
> http://savannah.gnu.org/bugs/?func=detailitem&item_id=7399
I think there are some bugs in your patch.
+ u_int u;
+
+ if (ioctl(fd, DIOCGFWSECTORS, &u) == 0)
+ hdg.d_nsectors = u;
+ else
+ hdg.d_nsectors = 63;
+ if (ioctl(fd, DIOCGFWHEADS, &u) == 0)
+ hdg.d_ntracks = u;
+ else if (hdg.d_secperunit <= 63*1*1024)
+ hdg.d_ntracks = 1;
+ else if (hdg.d_secperunit <= 63*16*1024)
+ hdg.d_ntracks = 16;
+ else
+ hdg.d_ntracks = 255;
Here, you use hdg.d_secperunit, but this is uninitialized. If my
understanding is correct, you need this kind of code to get it:
uint_t sector_size;
off_t media_size;
if (ioctl(fd, DIOCGSECTORSIZE, §or_size) != 0)
sector_size = 512;
if (ioctl(fd, DIOCGMEDIASIZE, &media_size) != 0)
/* this is fatal */
hdg.d_secperunit = media_size / sector_size;
Another problem might be this:
# if __FreeBSD__ >= 4
- sprintf (name, "/dev/rad%d", unit);
+ sprintf (name, "/dev/ad%d", unit);
# else /* __FreeBSD__ <= 3 */
sprintf (name, "/dev/rwd%d", unit);
# endif /* __FreeBSD__ <= 3 */
@@ -274,7 +304,7 @@
sprintf (name, "/dev/sd%d", unit);
#elif defined(__FreeBSD__)
/* FreeBSD */
- sprintf (name, "/dev/rda%d", unit);
+ sprintf (name, "/dev/da%d", unit);
Here, you change the device names regardless of the version of FreeBSD,
but I guess you need additional "#if __FreeBSD__ ...".
Thanks,
Okuji
- FreeBSD 5.x fixes, Sergey Matveychuk, 2004/01/23
- Re: FreeBSD 5.x fixes,
Yoshinori K. Okuji <=