Skip to contentSkip to conversation

mkfs.minix: check for misalignment

PATCH In review Davidlohr Bueso 2 participants 2 messages Jun 21, 2011 – Jun 27, 2011 Util-Linux package

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mkfs.minix: check for misalignment

From: Davidlohr Bueso <[email protected]>
Date: Mon, 20 Jun 2011 23:10:13 -0400

Produce a warning if the device is misaligned.

---
 disk-utils/mkfs.minix.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
disk-utils/mkfs.minix.c +5 -0
index 405e241..bc7d941 100644
@@ -653,6 +653,11 @@ int main(int argc, char ** argv) {
 		DEV = open(device_name,O_RDWR | O_EXCL);
 	else
 		DEV = open(device_name,O_RDWR);
+
+	if (blkdev_is_misaligned(DEV))
+		warnx(_("warning: %s is misaligned"), device_name);
+
+
 	if (DEV<0)
 		err(MKFS_ERROR, _("%s: open failed"), device_name);
 	if (S_ISBLK(statbuf.st_mode)) {
Signature · 1 line
1.7.5.4
maintainer
#1 lore raw
Quoted 2 lines · Davidlohr Bueso
 disk-utils/mkfs.minix.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

Applied with a small change, thanks.

disk-utils/mkfs.minix.c int main(int argc, char ** argv) { · line 658

Quoted 7 lines
disk-utils/mkfs.minix.c +3 -0
@@ -653,6 +653,11 @@ int main(int argc, char ** argv) {
 		DEV = open(device_name,O_RDWR | O_EXCL);
 	else
 		DEV = open(device_name,O_RDWR);
+
+	if (blkdev_is_misaligned(DEV))
+		warnx(_("warning: %s is misaligned"), device_name);

It makes sense for block devices only.

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com