[PATCH 14/21] dm: replace abbrev branching with goto

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 dm.c |   78 ++++++++++++++++++++++++++++++++++--------------------------------
 1 file changed, 40 insertions(+), 38 deletions(-)

diff --git a/dm.c b/dm.c
index 73a9b57..814d7d2 100644
--- a/dm.c
+++ b/dm.c
@@ -350,52 +350,54 @@ dm_known_ioctl(struct tcb *tcp, const unsigned int code, long arg)
 			}
 		}
 	}
-	if (abbrev(tcp))
+
+	if (abbrev(tcp)) {
 		tprints(", ...");
-	else
-		switch (code) {
-		case DM_DEV_WAIT:
-		case DM_TABLE_STATUS:
-			if (entering(tcp) || syserror(tcp))
-				break;
-			dm_decode_dm_target_spec(tcp, ioc, extra, extra_size);
-			break;
-		case DM_TABLE_LOAD:
-			if (!entering(tcp))
-				break;
-			dm_decode_dm_target_spec(tcp, ioc, extra, extra_size);
+		goto skip;
+	}
+
+	switch (code) {
+	case DM_DEV_WAIT:
+	case DM_TABLE_STATUS:
+		if (entering(tcp) || syserror(tcp))
 			break;
-		case DM_TABLE_DEPS:
-			if (entering(tcp) || syserror(tcp))
-				break;
-			dm_decode_dm_target_deps(ioc, extra, extra_size);
+		dm_decode_dm_target_spec(tcp, ioc, extra, extra_size);
+		break;
+	case DM_TABLE_LOAD:
+		if (!entering(tcp))
 			break;
-		case DM_LIST_DEVICES:
-			if (entering(tcp) || syserror(tcp))
-				break;
-			dm_decode_dm_name_list(ioc, extra, extra_size);
+		dm_decode_dm_target_spec(tcp, ioc, extra, extra_size);
+		break;
+	case DM_TABLE_DEPS:
+		if (entering(tcp) || syserror(tcp))
 			break;
-		case DM_LIST_VERSIONS:
-			if (entering(tcp) || syserror(tcp))
-				break;
-			dm_decode_dm_target_versions(ioc, extra, extra_size);
+		dm_decode_dm_target_deps(ioc, extra, extra_size);
+		break;
+	case DM_LIST_DEVICES:
+		if (entering(tcp) || syserror(tcp))
 			break;
-		case DM_TARGET_MSG:
-			if (entering(tcp)) {
-				dm_decode_dm_target_msg(ioc, extra,
-							extra_size);
-			} else if (!syserror(tcp) &&
-			    ioc->flags & DM_DATA_OUT_FLAG) {
-				dm_decode_string(ioc, extra, extra_size);
-			}
+		dm_decode_dm_name_list(ioc, extra, extra_size);
+		break;
+	case DM_LIST_VERSIONS:
+		if (entering(tcp) || syserror(tcp))
 			break;
-		case DM_DEV_RENAME:
-		case DM_DEV_SET_GEOMETRY:
-			if (!entering(tcp))
-				break;
+		dm_decode_dm_target_versions(ioc, extra, extra_size);
+		break;
+	case DM_TARGET_MSG:
+		if (entering(tcp)) {
+			dm_decode_dm_target_msg(ioc, extra,
+						extra_size);
+		} else if (!syserror(tcp) && ioc->flags & DM_DATA_OUT_FLAG) {
 			dm_decode_string(ioc, extra, extra_size);
-			break;
 		}
+		break;
+	case DM_DEV_RENAME:
+	case DM_DEV_SET_GEOMETRY:
+		if (!entering(tcp))
+			break;
+		dm_decode_string(ioc, extra, extra_size);
+		break;
+	}
 
  skip:
 	tprints("}");
-- 
1.7.10.4

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel



[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux