xfs
[Top] [All Lists]

RE: [PATCH] mkfs: fix mkfs.xfs -dfile,name=$NAME for new files

To: "Eric Sandeen" <sandeen@xxxxxxxxxxx>
Subject: RE: [PATCH] mkfs: fix mkfs.xfs -dfile,name=$NAME for new files
From: "Alex Elder" <aelder@xxxxxxx>
Date: Fri, 15 Jan 2010 12:01:56 -0600
Cc: "xfs mailing list" <xfs@xxxxxxxxxxx>
In-reply-to: <4B4F9270.4070006@xxxxxxxxxxx>
Thread-index: AcqVZdz9pDml6LJaQpafYGsA9sEbNwApsYrQ
Thread-topic: [PATCH] mkfs: fix mkfs.xfs -dfile,name=$NAME for new files
Eric Sandeen wrote:
> # /sbin/mkfs.xfs -dfile,name=grrr,size=100g
> mkfs.xfs: Use the -f option to force overwrite.
> 
> check_overwrite is failing, because  blkid_new_probe_from_filename()
> is failing, because the (new) image file is 0 length.
> 
> We already return 0 (carry on!) for other internal failures,
> and nobody tests for a -1 return.  So let's just let this
> one pass too.

I discussed this with Eric.  He suggested that instead of
simply ignoring the case of not recognizing the underlying
file system type, we could report that, and then allow the
user to intentionally overwrite it by specifying "-f".

I thought that was a better approach, and he agreed to
re-submit a patch that does that.

                                        -Alex

> Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxxx>
> ---
> 
> (note, i'm open to comments if we want to differentiate
> 1/0/-1 in a cleaner fashion...)
> 
> diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
> index 9a8eff3..53568bc 100644
> --- a/mkfs/xfs_mkfs.c
> +++ b/mkfs/xfs_mkfs.c
> @@ -296,7 +296,7 @@ check_overwrite(
> 
>       pr = blkid_new_probe_from_filename(device);
>       if (!pr)
> -             return -1;
> +             return 0;
> 
>       if (blkid_probe_enable_partitions(pr, 1))
>               goto out_free_probe;
> 
> _______________________________________________
> xfs mailing list
> xfs@xxxxxxxxxxx
> http://oss.sgi.com/mailman/listinfo/xfs

<Prev in Thread] Current Thread [Next in Thread>