Discussion:
[PATCH] blockdev: BLKRAGET returns 512-byte sectors.
(too old to reply)
enh
2018-09-27 23:11:28 UTC
Permalink
Bug: https://github.com/landley/toybox/issues/104
---
toys/other/blockdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/toys/other/blockdev.c b/toys/other/blockdev.c
index e5fd0c3..c2e10a2 100644
--- a/toys/other/blockdev.c
+++ b/toys/other/blockdev.c
@@ -65,7 +65,7 @@ void blockdev_main(void)
xioctl(fd, cmds[i], &val);

flag &= FLAG_setbsz|FLAG_setro|FLAG_flushbufs|FLAG_rereadpt|FLAG_setrw|FLAG_setbsz;
- if (!flag) printf("%lld\n", (toys.optflags &
(FLAG_getsz|FLAG_getra)) ? val >> 9: val);
+ if (!flag) printf("%lld\n", (toys.optflags & FLAG_getsz) ? val
9: val);
}
xclose(fd);
}
--
2.19.0.605.g01d371f741-goog
enh
2018-09-27 23:12:00 UTC
Permalink
proof of claim:
https://elixir.bootlin.com/linux/latest/source/block/ioctl.c#L537 (see
line 541).
Post by enh
Bug: https://github.com/landley/toybox/issues/104
---
toys/other/blockdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/toys/other/blockdev.c b/toys/other/blockdev.c
index e5fd0c3..c2e10a2 100644
--- a/toys/other/blockdev.c
+++ b/toys/other/blockdev.c
@@ -65,7 +65,7 @@ void blockdev_main(void)
xioctl(fd, cmds[i], &val);
flag &= FLAG_setbsz|FLAG_setro|FLAG_flushbufs|FLAG_rereadpt|FLAG_setrw|FLAG_setbsz;
- if (!flag) printf("%lld\n", (toys.optflags &
(FLAG_getsz|FLAG_getra)) ? val >> 9: val);
+ if (!flag) printf("%lld\n", (toys.optflags & FLAG_getsz) ? val
Post by enh
9: val);
}
xclose(fd);
}
--
2.19.0.605.g01d371f741-goog
Loading...