Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Sep 2004 19:00:48 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:  <200409211900.i8LJ0mpk005691@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:  
Subject: ports/45911: GEOM-related problem sysutils/diskcheckd does not work
Date: Tue, 21 Sep 2004 22:00:23 +0300 (EEST)

 Resend previous patch with minor fix. This seems to be working and correctly
 reporting. Previous erroneosuly warned for incorrect sector size.
 
 (Note that code in logreaderror() is strictly bounded to DOS partitioning
 scheme and BSD labels in primary slices. This isn't too bad for now, but
 may confuse when using another schemes, e.g. GPT.)
 
 --- 0/ports/sysutils/diskcheckd/files/diskcheckd.c	Mon Oct 21 03:34:31 2002
 +++ 1/ports/sysutils/diskcheckd/files/diskcheckd.c	Tue Sep 21 21:48: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;
 +	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 @@
  
  	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?200409211900.i8LJ0mpk005691>