| Server IP : 82.208.35.60 / Your IP : 216.73.216.89 Web Server : Apache/2.4.55 (FreeBSD) OpenSSL/1.1.1q-freebsd PHP/7.3.31 System : FreeBSD server7.d2m.cz 12.4-RELEASE-p9 FreeBSD 12.4-RELEASE-p9 GENERIC amd64 User : studiokobylisy_cz ( 1008) PHP Version : 7.3.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /usr/ports/sysutils/gpart/files/ |
Upload File : |
--- ./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,9 @@ #if defined(__FreeBSD__) #include <errno.h> +#include <sys/param.h> #include <sys/disklabel.h> +#include <sys/disk.h> #endif @@ -61,12 +63,26 @@ #endif #if defined(__FreeBSD__) - 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 */ + + if (ioctl(d->d_fd, DIOCGFWSECTORS, &u) == 0) + g.d_s = u; + else + pr(FATAL, EM_IOCTLFAILED, "DIOCGFWSECTORS", strerror(errno)); + // loclab.d_nsectors = 63; + if (ioctl(d->d_fd, DIOCGFWHEADS, &u) == 0) + g.d_h = u; + else + pr(FATAL, EM_IOCTLFAILED, "DIOCGFWHEADS", strerror(errno)); + 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)); + + g.d_c = o / u / g.d_h / g.d_s; #endif return (&g);