Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Sep 2004 16:10:18 GMT
From:      Valentin Nechayev <netch@netch.kiev.ua>
To:        freebsd-ports-bugs@FreeBSD.org
Subject:   ports/45911: GEOM-related problem sysutils/diskcheckd does not work
Message-ID:  <200409211610.i8LGAI6e086089@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR ports/45911; it has been noted by GNATS.

From: Valentin Nechayev <netch@netch.kiev.ua>
To: bug-followup@freebsd.org
Cc: vova@sw.ru
Subject: ports/45911: GEOM-related problem sysutils/diskcheckd does not work
Date: Tue, 21 Sep 2004 19:06:53 +0300 (EEST)

 Following patch makes it at least starting and successfully testing.
 I can't provide now bad disk to check error reporting;), but here only
 logging problem can appear, not functioning problem.
 
 diff -rNu 0/ports/sysutils/diskcheckd/files/diskcheckd.c 1/ports/sysutils/diskcheckd/files/diskcheckd.c
 --- 0/ports/sysutils/diskcheckd/files/diskcheckd.c	Mon Oct 21 03:34:31 2002
 +++ 1/ports/sysutils/diskcheckd/files/diskcheckd.c	Tue Sep 21 18:59:13 2004
 @@ -27,7 +27,7 @@
  static const char rcsid[] =
  	"$FreeBSD: ports/sysutils/diskcheckd/files/diskcheckd.c,v 1.6 2002/10/21 00:34:31 kris Exp $";
  
 -#include <sys/types.h>
 +#include <sys/param.h>
  #include <sys/sysctl.h>
  
  #include <ctype.h>
 @@ -46,6 +46,7 @@
  
  #define DKTYPENAMES
  #define FSTYPENAMES
 +#include <sys/disk.h>
  #include <sys/disklabel.h>
  #include <sys/diskmbr.h>
  
 @@ -757,7 +758,23 @@
  void
  getdisksize(struct disk *dp) {
  	struct disklabel label;
 +#if __FreeBSD_version >= 500040
 +	off_t mediasize;
 +	u_int 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 = 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 @@
  
  	dp->secsize = label.d_secsize;
  	dp->size = (off_t)label.d_secperunit * label.d_secsize;
 +#endif
  
  	if (label.d_secsize != 512)
  		syslog(LOG_NOTICE,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200409211610.i8LGAI6e086089>