From 44d2710c67992229a9845263e6c522392e25f8a9 Mon Sep 17 00:00:00 2001 From: Rachita Kothiyal Date: Sun, 14 Oct 2007 14:25:09 -0400 Subject: [PATCH] Make discard_odf a no-op for non odf --- scaffold | 46 +++++++++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/scaffold b/scaffold index c43afe7..321673f 100644 --- a/scaffold +++ b/scaffold @@ -212,8 +212,12 @@ function check_hierarchy { return $ERR } +# Initialize the ODF. Does the following: +# Creates and mounts ODF_DEV +# Populates ODF_DIR with the required dirs (fill_odf) +# Creates the superblock(sb) for ODF using the branch config passed in function init_odf { - # Noop for Non ODF unionfs + # Do nothing for Non ODF unionfs if [ $ODF -eq 0 ]; then return fi @@ -272,26 +276,31 @@ function mount_union { exit 1 fi - if [ -z "$1" ] ; then - OPTION="dirs=" - else - if [ -z "$2" ] ; then - OPTION="$1" - else - OPTION="$1,dirs=" + if [ $ODF -eq 1 ]; then + OPTION="odf=$ODF_DIR" + if [ ! -e $ODF_DIR/sb ]; then + OPTION=$OPTION",dirs=" fi - fi + else + OPTION="dirs=" + fi + + if [ -n "$1" ]; then + OPTION=$1","$OPTION + fi shift - while [ "$#" -gt 0 ] - do - OPTION="$OPTION$1" - if [ "$#" -ne "1" ] ; then - OPTION="$OPTION"":" - fi - shift - done + if [ $ODF -eq 0 ] || [ ! -e $ODF_DIR/sb ]; then + while [ "$#" -gt 0 ] + do + OPTION="$OPTION$1" + if [ "$#" -ne "1" ] ; then + OPTION="$OPTION"":" + fi + shift + done + fi mount -t unionfs -o $OPTION none $MOUNTPOINT @@ -302,6 +311,9 @@ function mount_union { function discard_odf { + if [ $ODF -eq 0 ]; then + return + fi runcmd umount $ODF_DIR runcmd losetup -d $ODF_DEV -- 2.43.0