diff mbox series

[v2,1/2] common: Provide blocksize and ecclength to udf fsck

Message ID 20230120155034.22349-1-jack@suse.cz (mailing list archive)
State New, archived
Headers show
Series fstests: Fix checking of UDF filesystems | expand

Commit Message

Jan Kara Jan. 20, 2023, 3:50 p.m. UTC
udf_test program used for verifying filesystem is not able to determine
filesystem blocksize. Provide it in the options together with disabling
ecclength as it is not used on harddrives.

Signed-off-by: Jan Kara <jack@suse.cz>
---
 common/rc | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

David Disseldorp Jan. 20, 2023, 4:34 p.m. UTC | #1
On Fri, 20 Jan 2023 16:50:29 +0100, Jan Kara wrote:

> udf_test program used for verifying filesystem is not able to determine
> filesystem blocksize. Provide it in the options together with disabling
> ecclength as it is not used on harddrives.
> 
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
>  common/rc | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/common/rc b/common/rc
> index 8060c03b7d18..bf3effa4c1ed 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -3075,9 +3075,13 @@ _check_udf_filesystem()
>      fi
>  
>      local device=$1
> -    local opt_arg=""
> +    local blksz=`echo $MKFS_OPTIONS | sed -rn 's/.*(-b|--blocksize)[ =]?+([0-9]+).*/\2/p'`
> +    if [ -z "$blksz" ]; then
> +	blksz=512
> +    fi
> +    local opt_arg="-ecclength 1 -blocksize $blksz"
>      if [ $# -eq 2 ]; then
> -	opt_arg="-lastvalidblock $(( $2 - 1 ))"
> +	opt_arg+=" -lastvalidblock $(( $2 - 1 ))"
>      fi
>  
>      rm -f $seqres.checkfs

Looks fine - I suppose it's safe to assume the --media-type=hd default
blksz value.
Reviewed-by: David Disseldorp <ddiss@suse.de>
Jan Kara Jan. 20, 2023, 4:47 p.m. UTC | #2
On Fri 20-01-23 17:34:54, David Disseldorp wrote:
> On Fri, 20 Jan 2023 16:50:29 +0100, Jan Kara wrote:
> 
> > udf_test program used for verifying filesystem is not able to determine
> > filesystem blocksize. Provide it in the options together with disabling
> > ecclength as it is not used on harddrives.
> > 
> > Signed-off-by: Jan Kara <jack@suse.cz>
> > ---
> >  common/rc | 8 ++++++--
> >  1 file changed, 6 insertions(+), 2 deletions(-)
> > 
> > diff --git a/common/rc b/common/rc
> > index 8060c03b7d18..bf3effa4c1ed 100644
> > --- a/common/rc
> > +++ b/common/rc
> > @@ -3075,9 +3075,13 @@ _check_udf_filesystem()
> >      fi
> >  
> >      local device=$1
> > -    local opt_arg=""
> > +    local blksz=`echo $MKFS_OPTIONS | sed -rn 's/.*(-b|--blocksize)[ =]?+([0-9]+).*/\2/p'`
> > +    if [ -z "$blksz" ]; then
> > +	blksz=512
> > +    fi
> > +    local opt_arg="-ecclength 1 -blocksize $blksz"
> >      if [ $# -eq 2 ]; then
> > -	opt_arg="-lastvalidblock $(( $2 - 1 ))"
> > +	opt_arg+=" -lastvalidblock $(( $2 - 1 ))"
> >      fi
> >  
> >      rm -f $seqres.checkfs
> 
> Looks fine - I suppose it's safe to assume the --media-type=hd default
> blksz value.
> Reviewed-by: David Disseldorp <ddiss@suse.de>

Thanks for review! Yeah, I didn't really find a value in trying to handle
anything else. If a real usecase comes, we can always tweak this.

								Honza
diff mbox series

Patch

diff --git a/common/rc b/common/rc
index 8060c03b7d18..bf3effa4c1ed 100644
--- a/common/rc
+++ b/common/rc
@@ -3075,9 +3075,13 @@  _check_udf_filesystem()
     fi
 
     local device=$1
-    local opt_arg=""
+    local blksz=`echo $MKFS_OPTIONS | sed -rn 's/.*(-b|--blocksize)[ =]?+([0-9]+).*/\2/p'`
+    if [ -z "$blksz" ]; then
+	blksz=512
+    fi
+    local opt_arg="-ecclength 1 -blocksize $blksz"
     if [ $# -eq 2 ]; then
-	opt_arg="-lastvalidblock $(( $2 - 1 ))"
+	opt_arg+=" -lastvalidblock $(( $2 - 1 ))"
     fi
 
     rm -f $seqres.checkfs