Util-Linux package development
 help / color / mirror / Atom feed
* [PATCH] mkfs.minix: check for misalignment
@ 2011-06-21  3:11 Davidlohr Bueso
  2011-06-27 14:23 ` Karel Zak
  0 siblings, 1 reply; 2+ messages in thread
From: Davidlohr Bueso @ 2011-06-21  3:11 UTC (permalink / raw)
  To: Karel Zak; +Cc: util-linux

From: Davidlohr Bueso <dave@gnu.org>
Date: Mon, 20 Jun 2011 23:10:13 -0400

Produce a warning if the device is misaligned.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
---
 disk-utils/mkfs.minix.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/disk-utils/mkfs.minix.c b/disk-utils/mkfs.minix.c
index 405e241..bc7d941 100644
--- a/disk-utils/mkfs.minix.c
+++ b/disk-utils/mkfs.minix.c
@@ -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)) {
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mkfs.minix: check for misalignment
  2011-06-21  3:11 [PATCH] mkfs.minix: check for misalignment Davidlohr Bueso
@ 2011-06-27 14:23 ` Karel Zak
  0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2011-06-27 14:23 UTC (permalink / raw)
  To: Davidlohr Bueso; +Cc: util-linux

On Mon, Jun 20, 2011 at 11:11:46PM -0400, Davidlohr Bueso wrote:
>  disk-utils/mkfs.minix.c |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)

 Applied with a small change, thanks.

> @@ -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

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-06-27 14:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-21  3:11 [PATCH] mkfs.minix: check for misalignment Davidlohr Bueso
2011-06-27 14:23 ` Karel Zak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox