[PATCH] added support for bsoflags parameter

Cedric Milesi <[email protected]>
Newsgroups org.kernel.vger.stgt
Message-ID <[email protected]>
From: Cédric Milesi <[email protected]>

	This patch will allow one to use bsoflags with tgt-admin.

---
Signed-off-by: Cédric Milesi <[email protected]>
---
 scripts/tgt-admin | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/scripts/tgt-admin b/scripts/tgt-admin
index 5486507..7130a3d 100755
--- a/scripts/tgt-admin
+++ b/scripts/tgt-admin
@@ -493,6 +493,7 @@ sub add_backing_direct {
 		my $device_type;
 		my $bs_type;
 		my $bsopts;
+		my $bsoflags;
 		my $block_size;
 		my %luns;
 		my @added_luns;
@@ -548,6 +549,10 @@ sub add_backing_direct {
 							$bsopts = $result;
 							$params_added{$store_option} = 1;
 						}
+						if ($store_option eq "bsoflags") {
+							$bsoflags = $result;
+							$params_added{$store_option} = 1;
+						}
 						if ($store_option eq "block-size") {
 							$block_size = $result;
 							$params_added{$store_option} = 1;
@@ -704,6 +709,11 @@ sub add_backing_direct {
 				check_if_hash_array($$target_options_ref{"bsopts"}, "bsopts");
 				$bsopts = $$target_options_ref{"bsopts"};
 			}
+			# bsoflags
+			if ($params_added{"bsoflags"} ne 1) {
+				check_if_hash_array($$target_options_ref{"bsoflags"}, "bsoflags");
+				$bsoflags = $$target_options_ref{"bsoflags"};
+			}
 		} else {
 			print "If you got here, this means your config file is not supported.\n";
 			print "Please report it to stgt mailing list and attach your config files.\n";
@@ -713,8 +723,9 @@ sub add_backing_direct {
 		if (length $device_type) { $device_type = "--device-type $device_type" };
 		if (length $bs_type) { $bs_type = "--bstype $bs_type" };
 		if (length $bsopts) { $bsopts = "--bsopts $bsopts" };
+		if (length $bsoflags) { $bsoflags = "--bsoflags $bsoflags" };
 		if (length $block_size) { $block_size = "--blocksize $block_size" };
-		execute("tgtadm -C $control_port --lld $driver --op new --mode logicalunit --tid $next_tid --lun $lun -b $backing_store $device_type $bs_type $bsopts $block_size");
+		execute("tgtadm -C $control_port --lld $driver --op new --mode logicalunit --tid $next_tid --lun $lun -b $backing_store $device_type $bs_type $bsopts $bsoflags $block_size");
 
 		# Commands should be executed in order
 		my @execute_last;
-- 
1.8.3.2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.