1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-03 06:04:53 +00:00

Remove FreeBSD < 500040 support, clean up cruft.

This commit is contained in:
Matthias Andree 2011-03-17 00:37:29 +00:00
parent cd20ee9a64
commit 0315109a34
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=271065

View File

@ -1,29 +1,25 @@
--- ./src/disku.c.orig 2001-02-07 20:04:07.000000000 +0100
+++ ./src/disku.c 2011-03-17 01:15:54.000000000 +0100
@@ -28,7 +28,11 @@
@@ -28,7 +28,9 @@
#if defined(__FreeBSD__)
#include <errno.h>
+#include <sys/param.h>
#include <sys/disklabel.h>
+#if __FreeBSD_version >= 500040
+#include <sys/disk.h>
+#endif
#endif
@@ -61,12 +65,45 @@
@@ -61,12 +63,26 @@
#endif
#if defined(__FreeBSD__)
+#if __FreeBSD_version < 500040
struct disklabel dl;
if (ioctl(d->d_fd,DIOCGDINFO,&dl) == -1)
pr(FATAL,EM_IOCTLFAILED,"DIOCGDINFO",strerror(errno));
g.d_c = dl.d_ncylinders;
g.d_h = dl.d_ntracks;
g.d_s = dl.d_nsectors;
+#else
- struct disklabel dl;
- if (ioctl(d->d_fd,DIOCGDINFO,&dl) == -1)
- pr(FATAL,EM_IOCTLFAILED,"DIOCGDINFO",strerror(errno));
- g.d_c = dl.d_ncylinders;
- g.d_h = dl.d_ntracks;
- g.d_s = dl.d_nsectors;
+ struct disklabel loclab;
+ u_int u;
+ off_t o; /* total disk size */
@ -37,24 +33,13 @@
+ g.d_h = u;
+ else
+ pr(FATAL, EM_IOCTLFAILED, "DIOCGFWHEADS", strerror(errno));
+#if 0
+ else if (loclab.d_secperunit <= 63*1*1024)
+ loclab.d_ntracks = 1;
+ else if (loclab.d_secperunit <= 63*16*1024)
+ loclab.d_ntracks = 16;
+ else
+ loclab.d_ntracks = 255;
+#endif
+ if (ioctl(d->d_fd, DIOCGSECTORSIZE, &u) == 0)
+ if (u != 512)
+ pr(FATAL, "sector size not a multiple of 512");
+ if (ioctl(d->d_fd, DIOCGMEDIASIZE, &o))
+ pr(FATAL, EM_IOCTLFAILED, "DIOCGMEDIASIZE", strerror(errno));
+ loclab.d_secpercyl = loclab.d_ntracks * loclab.d_nsectors;
+ loclab.d_ncylinders = loclab.d_secperunit / loclab.d_secpercyl;
+
+ g.d_c = o / u / g.d_h / g.d_s; // loclab.d_ncylinders;
+#endif
+ g.d_c = o / u / g.d_h / g.d_s;
#endif
return (&g);