aboutsummaryrefslogtreecommitdiff
path: root/sysutils/diskcheckd
diff options
context:
space:
mode:
authorFUJISHIMA Satsuki <sf@FreeBSD.org>2004-10-28 05:18:33 +0000
committerFUJISHIMA Satsuki <sf@FreeBSD.org>2004-10-28 05:18:33 +0000
commit285c532311506f269b69f2cc0589c6d2dddb0b53 (patch)
treebb19ab286a7049723d96db06d661b4eee77eb8ca /sysutils/diskcheckd
parent6fa57456f7259972265be90ea16df7168eafd804 (diff)
downloadports-285c532311506f269b69f2cc0589c6d2dddb0b53.tar.gz
ports-285c532311506f269b69f2cc0589c6d2dddb0b53.zip
Notes
Diffstat (limited to 'sysutils/diskcheckd')
-rw-r--r--sysutils/diskcheckd/Makefile4
-rw-r--r--sysutils/diskcheckd/files/diskcheckd.c20
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, &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,