Hi!
On Wed, 2015-06-03 at 16:27 +0200, Cyril Hrubis wrote:
> Hi!
> > +sub()
> > +{
> > + minuend=$(echo $1 | sed -r 's/([[:digit:]]{1,}).*/\1/')
> > + if echo $1 | grep -q -E "m|M"; then
> > + minuend=$((minuend*1024*1024))
> > + flag=m
> > + elif echo $1 | grep -q -E "k|K"; then
> > + minuend=$((minuend*1024))
> > + flag=k
> > + else
> > + flag=0
> > + fi
> > +
> > + subtrahend=$(echo $2 | sed -r 's/([[:digit:]]{1,}).*/\1/')
> > + if echo $2 | grep -q -E "m|M"; then
> > + subtrahend=$((subtrahend*1024*1024))
> > + elif echo $2 | grep -q -E "k|K"; then
> > + subtrahend=$((subtrahend*1024))
> > + fi
> > +
> > + rest=$((minuend - subtrahend))
> > + if [ $flag == m ]; then
> > + echo $((rest/1024/1024))
> > + elif [ $flag == k ]; then
> > + echo $((rest/1024))
> > + else
> > + echo $rest
> > + fi
>
> I don't get why we multiply the numbers, substract them and then divide
> them again. Can't we just substract them?
This is for the conversion of measurement units.
For example:
We may get the output from 'df', 172k as subtrahend and 11M as minuend.
If we want to do subtract. We should convert them to the same unit
first.
>
>
> Also does this work for other filesystems than ext2? It may be a good
> idea to run the test for a few more filesystems as well. We may add a
> parameter which fs to use and add entries as:
>
Hmm, this is a good idea.
Nowadays, I am thinking about ext3 and ext4, but I know very few about
other filesystems. Are you OK that I send you the new patches about
them(ext2, ext3 and ext4)?
And thanks for your review again. :)
Best regards,
Zeng
> df01 -f ext2
> df01 -f ext3
> ...
>
> to the runtest file.
>
> Otherwise it looks good.
>
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list