Lines 1-5
Link Here
|
1 |
--- lib/device.c.orig Sat Jan 24 01:52:56 2004 |
1 |
--- lib/device.c.orig Sat Jan 17 18:57:57 2004 |
2 |
+++ lib/device.c Sun Jan 25 00:07:02 2004 |
2 |
+++ lib/device.c Sat Jan 31 06:32:24 2004 |
3 |
@@ -78,6 +78,12 @@ |
3 |
@@ -78,6 +78,12 @@ |
4 |
# include <sys/ioctl.h> /* ioctl */ |
4 |
# include <sys/ioctl.h> /* ioctl */ |
5 |
# include <sys/disklabel.h> |
5 |
# include <sys/disklabel.h> |
Lines 13-19
Link Here
|
13 |
#endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ */ |
13 |
#endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ */ |
14 |
|
14 |
|
15 |
#ifdef HAVE_OPENDISK |
15 |
#ifdef HAVE_OPENDISK |
16 |
@@ -123,6 +129,7 @@ |
16 |
@@ -94,8 +100,16 @@ |
|
|
17 |
{ |
18 |
int fd; |
19 |
|
20 |
- fd = open (map[drive], O_RDONLY); |
21 |
- assert (fd >= 0); |
22 |
+#if defined(__FreeBSD__) |
23 |
+ if(geom->flags == -1) |
24 |
+ { |
25 |
+#endif |
26 |
+ fd = open (map[drive], O_RDONLY); |
27 |
+ assert (fd >= 0); |
28 |
+#if defined(__FreeBSD__) |
29 |
+ } else |
30 |
+ fd = geom->flags; |
31 |
+#endif |
32 |
|
33 |
#if defined(__linux__) |
34 |
/* Linux */ |
35 |
@@ -123,6 +137,7 @@ |
17 |
/* FreeBSD, NetBSD or OpenBSD */ |
36 |
/* FreeBSD, NetBSD or OpenBSD */ |
18 |
{ |
37 |
{ |
19 |
struct disklabel hdg; |
38 |
struct disklabel hdg; |
Lines 21-30
Link Here
|
21 |
if (ioctl (fd, DIOCGDINFO, &hdg)) |
40 |
if (ioctl (fd, DIOCGDINFO, &hdg)) |
22 |
goto fail; |
41 |
goto fail; |
23 |
|
42 |
|
24 |
@@ -131,6 +138,38 @@ |
43 |
@@ -131,7 +146,40 @@ |
25 |
geom->sectors = hdg.d_nsectors; |
44 |
geom->sectors = hdg.d_nsectors; |
26 |
geom->total_sectors = hdg.d_secperunit; |
45 |
geom->total_sectors = hdg.d_secperunit; |
27 |
|
46 |
|
|
|
47 |
- close (fd); |
28 |
+#else |
48 |
+#else |
29 |
+ u_int u, secsize; |
49 |
+ u_int u, secsize; |
30 |
+ off_t mediasize; |
50 |
+ off_t mediasize; |
Lines 57-66
Link Here
|
57 |
+ geom->sectors = hdg.d_nsectors; |
77 |
+ geom->sectors = hdg.d_nsectors; |
58 |
+ geom->total_sectors = hdg.d_secperunit; |
78 |
+ geom->total_sectors = hdg.d_secperunit; |
59 |
+#endif |
79 |
+#endif |
60 |
close (fd); |
80 |
+ if(geom->flags == -1) |
|
|
81 |
+ close (fd); |
61 |
return; |
82 |
return; |
62 |
} |
83 |
} |
63 |
@@ -233,7 +272,7 @@ |
84 |
|
|
|
85 |
@@ -203,7 +251,11 @@ |
86 |
sprintf (name, "/dev/fd%d", unit); |
87 |
#elif defined(__FreeBSD__) |
88 |
/* FreeBSD */ |
89 |
+#if __FreeBSD__ >= 4 |
90 |
+ sprintf (name, "/dev/fd%d", unit); |
91 |
+#else |
92 |
sprintf (name, "/dev/rfd%d", unit); |
93 |
+#endif |
94 |
#elif defined(__NetBSD__) |
95 |
/* NetBSD */ |
96 |
/* opendisk() doesn't work for floppies. */ |
97 |
@@ -233,7 +285,7 @@ |
64 |
#elif defined(__FreeBSD__) |
98 |
#elif defined(__FreeBSD__) |
65 |
/* FreeBSD */ |
99 |
/* FreeBSD */ |
66 |
# if __FreeBSD__ >= 4 |
100 |
# if __FreeBSD__ >= 4 |
Lines 69-75
Link Here
|
69 |
# else /* __FreeBSD__ <= 3 */ |
103 |
# else /* __FreeBSD__ <= 3 */ |
70 |
sprintf (name, "/dev/rwd%d", unit); |
104 |
sprintf (name, "/dev/rwd%d", unit); |
71 |
# endif /* __FreeBSD__ <= 3 */ |
105 |
# endif /* __FreeBSD__ <= 3 */ |
72 |
@@ -274,7 +313,11 @@ |
106 |
@@ -274,7 +326,11 @@ |
73 |
sprintf (name, "/dev/sd%d", unit); |
107 |
sprintf (name, "/dev/sd%d", unit); |
74 |
#elif defined(__FreeBSD__) |
108 |
#elif defined(__FreeBSD__) |
75 |
/* FreeBSD */ |
109 |
/* FreeBSD */ |