diff options
author | sf <sf@FreeBSD.org> | 2004-10-28 13:18:33 +0800 |
---|---|---|
committer | sf <sf@FreeBSD.org> | 2004-10-28 13:18:33 +0800 |
commit | 7961f5174c73a952eb0330cd44ca943f5c271f44 (patch) | |
tree | 2a35bc17198d813afa2aaa0098b5b008a9f1000d /sysutils | |
parent | 9ae74b8129a68cd9d3f952c0d23a388dc5ec4fe0 (diff) | |
download | freebsd-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')
-rw-r--r-- | sysutils/diskcheckd/Makefile | 4 | ||||
-rw-r--r-- | sysutils/diskcheckd/files/diskcheckd.c | 20 |
2 files changed, 20 insertions, 4 deletions
diff --git a/sysutils/diskcheckd/Makefile b/sysutils/diskcheckd/Makefile index f40d883ac746..32111d927478 100644 --- a/sysutils/diskcheckd/Makefile +++ b/sysutils/diskcheckd/Makefile @@ -8,7 +8,7 @@ PORTNAME= diskcheckd PORTVERSION= 20010823 -PORTREVISION= 3 +PORTREVISION= 4 CATEGORIES= sysutils MASTER_SITES= # part of port DISTFILES= # part of port @@ -30,8 +30,6 @@ CFLAGS+= -D_PATH_CONF='\"${PREFIX}/etc/diskcheckd.conf\"' .if ${OSVERSION} < 500000 IGNORE= "Not tested on anything less than 5.0, use at discretion" -.else -IGNORE= "Does not work on 5.x, see PR ports/45911" .endif do-extract: 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, §orsize) < 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, |