aboutsummaryrefslogtreecommitdiffstats
path: root/sysutils/diskcheckd/files
diff options
context:
space:
mode:
authorsf <sf@FreeBSD.org>2004-10-28 13:18:33 +0800
committersf <sf@FreeBSD.org>2004-10-28 13:18:33 +0800
commit7961f5174c73a952eb0330cd44ca943f5c271f44 (patch)
tree2a35bc17198d813afa2aaa0098b5b008a9f1000d /sysutils/diskcheckd/files
parent9ae74b8129a68cd9d3f952c0d23a388dc5ec4fe0 (diff)
downloadfreebsd-ports-gnome-7961f5174c73a952eb0330cd44ca943f5c271f44.tar.gz
freebsd-ports-gnome-7961f5174c73a952eb0330cd44ca943f5c271f44.tar.zst
freebsd-ports-gnome-7961f5174c73a952eb0330cd44ca943f5c271f44.zip
fix for post-GEOM system.
PR: 45911 Submitted by: Valentin Nechayev <netch@netch.kiev.ua>
Diffstat (limited to 'sysutils/diskcheckd/files')
-rw-r--r--sysutils/diskcheckd/files/diskcheckd.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/sysutils/diskcheckd/files/diskcheckd.c b/sysutils/diskcheckd/files/diskcheckd.c
index f9032bea642a..76c8846f2395 100644
--- a/sysutils/diskcheckd/files/diskcheckd.c
+++ b/sysutils/diskcheckd/files/diskcheckd.c
@@ -27,7 +27,7 @@
static const char rcsid[] =
"$FreeBSD$";
-#include <sys/types.h>
+#include <sys/param.h>
#include <sys/sysctl.h>
#include <ctype.h>
@@ -46,6 +46,7 @@ static const char rcsid[] =
#define DKTYPENAMES
#define FSTYPENAMES
+#include <sys/disk.h>
#include <sys/disklabel.h>
#include <sys/diskmbr.h>
@@ -757,7 +758,23 @@ readconf(const char *conf_file) {
void
getdisksize(struct disk *dp) {
struct disklabel label;
+#if __FreeBSD_version >= 500040
+ off_t mediasize;
+ unsigned sectorsize;
+ if (ioctl(dp->fd, DIOCGSECTORSIZE, &sectorsize) < 0) {
+ syslog(LOG_NOTICE, "DIOCGSECTORSIZE on %s failed: %m",
+ dp->device);
+ exit(EXIT_FAILURE);
+ }
+ if (ioctl(dp->fd, DIOCGMEDIASIZE, &mediasize) < 0) {
+ syslog(LOG_NOTICE, "DIOCGMEDIASIZE on %s failed: %m",
+ dp->device);
+ exit(EXIT_FAILURE);
+ }
+ dp->secsize = label.d_secsize = sectorsize;
+ dp->size = mediasize;
+#else
if (ioctl(dp->fd, DIOCGDINFO, &label) < 0) {
syslog(LOG_NOTICE, "DIOCGDINFO on %s failed: %m",
dp->device);
@@ -766,6 +783,7 @@ getdisksize(struct disk *dp) {
dp->secsize = label.d_secsize;
dp->size = (off_t)label.d_secperunit * label.d_secsize;
+#endif
if (label.d_secsize != 512)
syslog(LOG_NOTICE,