Author: aschnell Date: Tue Feb 14 20:44:53 2012 New Revision: 67426 URL: http://svn.opensuse.org/viewcvs/yast?rev=67426&view=rev Log: - use switch statement Modified: trunk/s390/src/modules/DASDController.ycp trunk/s390/src/modules/ZFCPController.ycp Modified: trunk/s390/src/modules/DASDController.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/s390/src/modules/DASDController.ycp?rev=67426&r1=67425&r2=67426&view=diff ============================================================================== --- trunk/s390/src/modules/DASDController.ycp (original) +++ trunk/s390/src/modules/DASDController.ycp Tue Feb 14 20:44:53 2012 @@ -399,6 +399,7 @@ UI::CloseDialog (); } + /** * Report error occured during device activation * @param id integer chanel id of the device @@ -406,51 +407,72 @@ */ void ReportActivationError(any id, integer ret) { - if (ret != 0) + switch (ret) { - if (ret == 1) + case 0: + break; + + case 1: Report::Error (sformat ( // error report, %1 is device identification _("%1: sysfs not mounted."), id)); - else if (ret == 2) + break; + + case 2: Report::Error (sformat ( // error report, %1 is device identification _("%1: Invalid status for <online>."), id)); - else if (ret == 3) + break; + + case 3: Report::Error (sformat ( // error report, %1 is device identification _("%1: No device found for <ccwid>."), id)); - else if (ret == 4) + break; + + case 4: Report::Error (sformat ( // error report, %1 is device identification _("%1: Could not change state of the device."), id)); - else if (ret == 5) + break; + + case 5: // https://bugzilla.novell.com/show_bug.cgi?id=446998#c15 Report::Error (sformat ( // error report, %1 is device identification _("%1: Device is not a DASD."), id)); - else if (ret == 6) + break; + + case 6: // https://bugzilla.novell.com/show_bug.cgi?id=446998#c15 Report::Error (sformat ( // error report, %1 is device identification _("%1: Could not load module."), id)); - else if (ret == 7) - //bugzilla.novell.com/show_bug.cgi?id=561876#c8 + break; + + case 7: + // http://bugzilla.novell.com/show_bug.cgi?id=561876#c8 Report::Error (sformat ( // error report, %1 is device identification _("%1: Failed to activate DASD."), id)); - else if (ret == 8) - //bugzilla.novell.com/show_bug.cgi?id=561876#c8 + break; + + case 8: + // http://bugzilla.novell.com/show_bug.cgi?id=561876#c8 Report::Error (sformat ( // error report, %1 is device identification _("%1: DASD is not formatted."), id)); - else + break; + + default: Report::Error (sformat ( // error report, %1 is device identification, %2 is integer code _("%1: Unknown error %2."), id, ret)); + break; } } + /** * Activate selected Disks * @param channel string Name of the disk to activate Modified: trunk/s390/src/modules/ZFCPController.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/s390/src/modules/ZFCPController.ycp?rev=67426&r1=67425&r2=67426&view=diff ============================================================================== --- trunk/s390/src/modules/ZFCPController.ycp (original) +++ trunk/s390/src/modules/ZFCPController.ycp Tue Feb 14 20:44:53 2012 @@ -328,6 +328,7 @@ UI::CloseDialog(); } + /** * Report error occured during device activation * @param id integer chanel id of the device @@ -335,51 +336,74 @@ */ void ReportActivationError(any id, integer ret) { - if (ret != 0) + switch (ret) { - if (ret == 1) + case 0: + break; + + case 1: Report::Error (sformat ( // error report, %1 is device identification _("%1: sysfs not mounted."), id)); - else if (ret == 2) + break; + + case 2: Report::Error (sformat ( // error report, %1 is device identification _("%1: Invalid status for <online>."), id)); - else if (ret == 3) + break; + + case 3: Report::Error (sformat ( // error report, %1 is device identification _("%1: No device found for <ccwid>."), id)); - else if (ret == 4) + break; + + case 4: Report::Error (sformat ( // error report, %1 is device identification _("%1: WWPN invalid."), id)); - else if (ret == 5) + break; + + case 5: Report::Error (sformat ( // error report, %1 is device identification _("%1: Could not activate WWPN for adapter %1."), id)); - else if (ret == 6) + break; + + case 6: Report::Error (sformat ( // error report, %1 is device identification _("%1: Could not activate ZFCP device."), id)); - else if (ret == 7) + break; + + case 7: Report::Error (sformat ( // error report, %1 is device identification _("%1: SCSI disk could not be deactivated."), id)); - else if (ret == 8) + break; + + case 8: Report::Error (sformat ( // error report, %1 is device identification _("%1: ZFCP LUN could not be unregistered."), id)); - else if (ret == 9) + break; + + case 9: Report::Error (sformat ( // error report, %1 is device identification _("%1: ZFCP WWPN could not be unregistered."), id)); - else + break; + + default: Report::Error (sformat ( // error report, %1 is device identification, %2 is integer code _("%1: Unknown error %2."), id, ret)); + break; } } + /** * Report error occured during device activation * @param id integer chanel id of the device @@ -387,39 +411,56 @@ */ void ReportControllerActivationError(any id, integer ret) { - if (ret != 0) + switch (ret) { - if (ret == 1) + case 0: + break; + + case 1: Report::Error (sformat ( // error report, %1 is device identification _("%1: sysfs not mounted."), id)); - else if (ret == 2) + break; + + case 2: Report::Error (sformat ( // error report, %1 is device identification _("%1: Invalid status for <online>."), id)); - else if (ret == 3) + break; + + case 3: Report::Error (sformat ( // error report, %1 is device identification _("%1: Device <ccwid> does not exist."), id)); - else if (ret == 4) + break; + + case 4: Report::Error (sformat ( // error report, %1 is device identification _("%1: Module zfcp could not be loaded."), id)); - else if (ret == 5) + break; + + case 5: Report::Error (sformat ( // error report, %1 is device identification _("%1: Adapter status could not be changed."), id)); - else if (ret == 6) + break; + + case 6: Report::Error (sformat ( // error report, %1 is device identification _("%1: WWPN ports still active."), id)); - else + break; + + default: Report::Error (sformat ( // error report, %1 is device identification, %2 is integer code _("%1: Unknown error %2."), id, ret)); + break; } } + /** * Activate a disk * @param channel string channel id -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org