Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src-draft/trunk]: src/sys/dev/scsipi use powerof2() rather than rolling our ...
details: https://anonhg.NetBSD.org/src-all/rev/528b448910cb
branches: trunk
changeset: 939091:528b448910cb
user: Jonathan A. Kollasch <jakllsch%NetBSD.org@localhost>
date: Fri Sep 25 08:42:57 2020 -0500
description:
use powerof2() rather than rolling our own versions
diffstat:
sys/dev/scsipi/sd.c | 9 ++-------
1 files changed, 2 insertions(+), 7 deletions(-)
diffs (25 lines):
diff -r f749e81d9536 -r 528b448910cb sys/dev/scsipi/sd.c
--- a/sys/dev/scsipi/sd.c Fri Sep 25 06:49:13 2020 +0000
+++ b/sys/dev/scsipi/sd.c Fri Sep 25 08:42:57 2020 -0500
@@ -1310,19 +1310,14 @@
sd_validate_blksize(struct scsipi_periph *periph, int len)
{
- switch (len) {
- case 256:
- case 512:
- case 1024:
- case 2048:
- case 4096:
+ if (len >= 256 && powerof2(len) && len <= 4096) {
return 1;
}
if (periph) {
scsipi_printaddr(periph);
printf("%s sector size: 0x%x. Defaulting to %d bytes.\n",
- (len ^ (1 << (ffs(len) - 1))) ?
+ !powerof2(len) ?
"preposterous" : "unsupported",
len, SD_DEFAULT_BLKSIZE);
}
Home |
Main Index |
Thread Index |
Old Index