public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/3 V2] Add new standard loop handling functions
@ 2013-02-12  9:21 Tomas Racek
  0 siblings, 0 replies; only message in thread
From: Tomas Racek @ 2013-02-12  9:21 UTC (permalink / raw)
  To: xfs; +Cc: lczerner, Tomas Racek

Add _create_loop_device and _destroy_loop_device to uniformly handle
loopback devices.

V1->V2: Fix possible race

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

diff --git a/common.rc b/common.rc
index 0cccb94..2f4a9f4 100644
--- a/common.rc
+++ b/common.rc
@@ -1833,6 +1833,19 @@ _require_dumpe2fs()
 	fi
 }
 
+_create_loop_device()
+{
+	file=$1
+	dev=`losetup -f --show $file` || _fail "Cannot assign $file to a loop device"
+	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

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-02-12  9:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-12  9:21 [PATCH 2/3 V2] Add new standard loop handling functions Tomas Racek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox