xfs
[Top] [All Lists]

[PATCH 2/3] xfstests: Add new standard loop handling functions

To: xfs@xxxxxxxxxxx
Subject: [PATCH 2/3] xfstests: Add new standard loop handling functions
From: Tomas Racek <tracek@xxxxxxxxxx>
Date: Sun, 3 Feb 2013 11:19:57 +0100
Cc: lczerner@xxxxxxxxxx, Tomas Racek <tracek@xxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1359886798-8818-1-git-send-email-tracek@xxxxxxxxxx>
References: <1359886798-8818-1-git-send-email-tracek@xxxxxxxxxx>
Add _create_loop_device and _destroy_loop_device to uniformly handle
loopback devices.

Signed-off-by: Tomas Racek <tracek@xxxxxxxxxx>
---
 common.rc | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/common.rc b/common.rc
index 0cccb94..67a5e3a 100644
--- a/common.rc
+++ b/common.rc
@@ -1833,6 +1833,20 @@ _require_dumpe2fs()
        fi
 }
 
+_create_loop_device()
+{
+       file=$1
+       dev=`losetup -f`
+       losetup $dev $file || _fail "Cannot associate $file with $dev"
+       echo $dev
+}
+
+_destroy_loop_device()
+{
+       dev=$1
+       losetup -d $dev || _fail "Cannot destroy loop device $dev"
+}
+
 
################################################################################
 
 if [ "$iam" != new -a "$iam" != bench ]
-- 
1.7.11.7

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