On Mon, Aug 31, 2015 at 01:04:37PM +0800, Zhao Lei wrote:
> +mount_test_dev()
> +{
> +     local loop_opt
> +     if [[ -b "$TEST_DEV" ]]; then
> +             loop_opt=()
> +     elif [[ -f "$TEST_DEV" ]]; then
> +             loop_opt=(-o loop)
> +     else
> +             _fail "Invalid \$TEST_DEV: $TEST_DEV"
> +     fi
> +
> +     [[ -d "$TEST_MNT" ]] || {
> +             _fail "Invalid \$TEST_MNT: $TEST_MNT"
> +     }
> +
> +     mount "${loop_opt[@]}" "$TEST_DEV" "$TEST_MNT" || _fail "mount 
> $TEST_DEV to $TEST_MNT failed"

This needs the root helper, besides I don't see a reason why to use the
array to pass the loop options.

On newer systems the option 'loop' is not necessary and mount works with
that but I don't mind adding support for systems where this does not
work. However, this should not break current behaviour.

One thing that I find important is that the full commands are logged via
the run_check helpers. So I suggest to add run_check_mount_test_dev
helper that would wrapp all the commands. The combination of shell
functions does not work in all cases.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to