[Ocfs2-tools-commits] jlbec commits r1397 - in branches/cman-based/libo2cb: . include

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Mon Aug 20 00:33:15 PDT 2007


Author: jlbec
Date: 2007-08-20 00:33:13 -0700 (Mon, 20 Aug 2007)
New Revision: 1397

Modified:
   branches/cman-based/libo2cb/include/o2cb_abi.h
   branches/cman-based/libo2cb/o2cb_abi.c
Log:

Provide nicer error codes for the other two cman functions.



Modified: branches/cman-based/libo2cb/include/o2cb_abi.h
===================================================================
--- branches/cman-based/libo2cb/include/o2cb_abi.h	2007-08-18 01:42:33 UTC (rev 1396)
+++ branches/cman-based/libo2cb/include/o2cb_abi.h	2007-08-20 07:33:13 UTC (rev 1397)
@@ -1,7 +1,7 @@
 /* -*- mode: c; c-basic-offset: 8; -*-
  * vim: noexpandtab sw=8 ts=8 sts=0:
  *
- * o2cb_abi.c
+ * o2cb_abi.h
  *
  * Layout of configfs paths for O2CB cluster configuration.
  *

Modified: branches/cman-based/libo2cb/o2cb_abi.c
===================================================================
--- branches/cman-based/libo2cb/o2cb_abi.c	2007-08-18 01:42:33 UTC (rev 1396)
+++ branches/cman-based/libo2cb/o2cb_abi.c	2007-08-20 07:33:13 UTC (rev 1397)
@@ -1449,7 +1449,7 @@
 
 	if (controld_fd == -1) {
 		/* fprintf(stderr, "Join not started!\n"); */
-		rc = -EINVAL;
+		err = O2CB_ET_SERVICE_UNAVAILABLE;
 		goto out;
 	}
 
@@ -1458,6 +1458,7 @@
 	if (rc) {
 		/* fprintf(stderr, "Unable to send MRESULT message: %s\n",
 			strerror(-rc)); */
+		err = O2CB_ET_IO;
 		goto out;
 	}
 
@@ -1465,6 +1466,7 @@
 	if (rc < 0) {
 		/* fprintf(stderr, "Error reading from daemon: %s\n",
 			strerror(-rc)); */
+		err = O2CB_ET_IO;
 		goto out;
 	}
 
@@ -1480,6 +1482,7 @@
 				/* fprintf(stderr,
 					"Error %d from daemon: %s\n",
 					error, error_msg); */
+				err = O2CB_ET_CONFIGURATION_ERROR;
 			}
 			break;
 
@@ -1487,6 +1490,7 @@
 			/* fprintf(stderr,
 				"Unexpected message %s from daemon\n",
 				message_to_string(message)); */
+			err = O2CB_ET_INTERNAL_FAILURE;
 			goto out;
 			break;
 	}
@@ -1515,7 +1519,7 @@
 
 	if (controld_fd != -1) {
 		/* fprintf(stderr, "Join in progress!\n"); */
-		rc = -EINPROGRESS;
+		err = O2CB_ET_INTERNAL_FAILURE;
 		goto out;
 	}
 
@@ -1523,6 +1527,16 @@
 	if (rc < 0) {
 		/* fprintf(stderr, "Unable to connect to ocfs2_controld: %s\n",
 			strerror(-rc)); */
+		switch (rc) {
+			case -EACCES:
+			case -EPERM:
+				err = O2CB_ET_PERMISSION_DENIED;
+				break;
+
+			default:
+				err = O2CB_ET_SERVICE_UNAVAILABLE;
+				break;
+		}
 		goto out;
 	}
 	controld_fd = rc;
@@ -1532,6 +1546,7 @@
 	if (rc) {
 		/* fprintf(stderr, "Unable to send UNMOUNT message: %s\n",
 			strerror(-rc)); */
+		err = O2CB_ET_IO;
 		goto out;
 	}
 
@@ -1539,6 +1554,7 @@
 	if (rc < 0) {
 		/* fprintf(stderr, "Error reading from daemon: %s\n",
 			strerror(-rc)); */
+		err = O2CB_ET_IO;
 		goto out;
 	}
 
@@ -1554,6 +1570,7 @@
 				/* fprintf(stderr,
 					"Error %d from daemon: %s\n",
 					error, error_msg); */
+				err = O2CB_ET_CONFIGURATION_ERROR;
 				goto out;
 			}
 			break;
@@ -1562,6 +1579,7 @@
 			/* fprintf(stderr,
 				"Unexpected message %s from daemon\n",
 				message_to_string(message)); */
+			err = O2CB_ET_INTERNAL_FAILURE;
 			goto out;
 			break;
 	}




More information about the Ocfs2-tools-commits mailing list