Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/sbin/gpt



On Nov 29,  8:46am, "Christos Zoulas" wrote:
}
} This is a multi-part message in MIME format.
} 
} --_----------=_1448804783204230
} Content-Disposition: inline
} Content-Transfer-Encoding: 8bit
} Content-Type: text/plain; charset="US-ASCII"
} 
} Module Name:	src
} Committed By:	christos
} Date:		Sun Nov 29 13:46:23 UTC 2015
} 
} Modified Files:
} 	src/sbin/gpt: gpt.c
} 
} Log Message:
} Only use the ioctl's if we have them.

     Why did you leave out the call to getdisksize() for when the
ioctls don't exist?  Actually, why did you even bother with this
patch, since it is pretty much equivalent to what was there before,
minus the missing functionality?

} To generate a diff of this commit:
} cvs rdiff -u -r1.43 -r1.44 src/sbin/gpt/gpt.c
} 
} Please note that diffs are not public domain; they are subject to the
} copyright notices on the relevant files.
} 
} 
} --_----------=_1448804783204230
} Content-Disposition: inline
} Content-Length: 1887
} Content-Transfer-Encoding: binary
} Content-Type: text/x-diff; charset=us-ascii
} 
} Modified files:
} 
} Index: src/sbin/gpt/gpt.c
} diff -u src/sbin/gpt/gpt.c:1.43 src/sbin/gpt/gpt.c:1.44
} --- src/sbin/gpt/gpt.c:1.43	Sun Nov 29 08:24:28 2015
} +++ src/sbin/gpt/gpt.c	Sun Nov 29 08:46:23 2015
} @@ -35,7 +35,7 @@
}  __FBSDID("$FreeBSD: src/sbin/gpt/gpt.c,v 1.16 2006/07/07 02:44:23 marcel Exp $");
}  #endif
}  #ifdef __RCSID
} -__RCSID("$NetBSD: gpt.c,v 1.43 2015/11/29 13:24:28 jnemeth Exp $");
} +__RCSID("$NetBSD: gpt.c,v 1.44 2015/11/29 13:46:23 christos Exp $");
}  #endif
}  
}  #include <sys/param.h>
} @@ -486,24 +486,38 @@ gpt_open(const char *dev, int flags)
}  	}
}  
}  	if ((sb.st_mode & S_IFMT) != S_IFREG) {
} +		if (secsz == 0) {
}  #ifdef DIOCGSECTORSIZE
} -		if ((secsz == 0 && ioctl(fd, DIOCGSECTORSIZE, &secsz) == -1) ||
} -		  (mediasz == 0 && ioctl(fd, DIOCGMEDIASIZE, &mediasz) == -1)) {
} -			if (!quiet)
} -				warn("Cannot get sector/media size for `%s'",
} -				    device_name);
} -			goto close;
} -		}
} -#else
} -		if (getdisksize(device_name, &secsz, &mediasz) == -1) {
} -			if (!quiet)
} -				warn("Cannot get sector/media size for `%s'",
} -				    device_name);
} -			goto close;
} +			if (ioctl(fd, DIOCGSECTORSIZE, &secsz) == -1) {
} +				if (!quiet)
} +					warn("Cannot get sector size for `%s'",
} +					    device_name);
} +				goto close;
} +			}
} +#endif
} +			if (secsz == 0) {
} +				if (!quiet)
} +					warnx("Sector size for `%s' can't be 0",
} +					    device_name);
} +				goto close;
} +			}
}  		}
} +		if (mediasz == 0) {
} +#ifdef DIOCGMEDIASIZE
} +			if (ioctl(fd, DIOCGMEDIASIZE, &mediasz) == -1) {
} +				if (!quiet)
} +					warn("Cannot get media size for `%s'",
} +					device_name);
} +				goto close;
} +			}
}  #endif
} -		if (secsz == 0 || mediasz == 0)
} -			errx(1, "Please specify sector/media size");
} +			if (mediasz == 0) {
} +				if (!quiet)
} +					warnx("Media size for `%s' can't be 0",
} +					    device_name);
} +				goto close;
} +			}
} +		}
}  	} else {
}  		if (secsz == 0)
}  			secsz = 512;	/* Fixed size for files. */
} 
} 
} --_----------=_1448804783204230--
} 
}-- End of excerpt from "Christos Zoulas"




Home | Main Index | Thread Index | Old Index