Use the same values for different status codes
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 6 Apr 2017 18:37:44 +0000 (14:37 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sun, 28 May 2017 16:57:40 +0000 (12:57 -0400)
The weird values are based on the Linux error numbers
(EAGAIN, EINVAL, etc.).

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
include/babeltrace/graph/component-status.h
include/babeltrace/graph/graph.h
include/babeltrace/graph/notification-iterator.h
lib/graph/iterator.c
plugins/ctf/fs/fs.c

index dca7e8aaf78d161a1528aa1e2a8779801556eb36..b86db77eca6ab968d9564a55ede83a6518d37a02 100644 (file)
@@ -43,19 +43,19 @@ enum bt_component_status {
         * Component can't process a notification at this time
         * (e.g. would block), try again later.
         */
-       BT_COMPONENT_STATUS_AGAIN                       = 2,
+       BT_COMPONENT_STATUS_AGAIN                       = 11,
        /** Refuse port connection. */
-       BT_COMPONENT_STATUS_REFUSE_PORT_CONNECTION      = 3,
+       BT_COMPONENT_STATUS_REFUSE_PORT_CONNECTION      = 111,
        /** General error. */
        BT_COMPONENT_STATUS_ERROR                       = -1,
        /** Unsupported component feature. */
        BT_COMPONENT_STATUS_UNSUPPORTED                 = -2,
        /** Invalid arguments. */
-       BT_COMPONENT_STATUS_INVALID                     = -3,
+       BT_COMPONENT_STATUS_INVALID                     = -22,
        /** Memory allocation failure. */
-       BT_COMPONENT_STATUS_NOMEM                       = -4,
+       BT_COMPONENT_STATUS_NOMEM                       = -12,
        /** Element not found. */
-       BT_COMPONENT_STATUS_NOT_FOUND                   = -5,
+       BT_COMPONENT_STATUS_NOT_FOUND                   = -19,
 };
 
 #ifdef __cplusplus
index 884ba5f1c52c6cd6fd14ac2e18a930abf359f33b..07ff3939727224477a619f45fa7c9dabb73edc84 100644 (file)
@@ -38,20 +38,18 @@ struct bt_connection;
 
 enum bt_graph_status {
        /** No sink can consume at the moment. */
-       BT_GRAPH_STATUS_AGAIN = 2,
+       BT_GRAPH_STATUS_AGAIN = 11,
        /** Downstream component does not support multiple inputs. */
        BT_GRAPH_STATUS_END = 1,
        BT_GRAPH_STATUS_OK = 0,
-       /** Downstream component does not support multiple inputs. */
-       BT_GRAPH_STATUS_MULTIPLE_INPUTS_UNSUPPORTED = -1,
        /** Component is already part of another graph. */
        BT_GRAPH_STATUS_ALREADY_IN_A_GRAPH = -2,
        /** Invalid arguments. */
-       BT_GRAPH_STATUS_INVALID = -3,
+       BT_GRAPH_STATUS_INVALID = -22,
        /** No sink in graph. */
-       BT_GRAPH_STATUS_NO_SINK = -4,
+       BT_GRAPH_STATUS_NO_SINK = -6,
        /** General error. */
-       BT_GRAPH_STATUS_ERROR = -5,
+       BT_GRAPH_STATUS_ERROR = -1,
 };
 
 typedef void (*bt_graph_port_added_listener)(struct bt_port *port,
index 56a2e0e0a44bbcaaf127251786b6ede277dcae2f..d8554316794a9608e1244bdbbef4fa68940f9ad5 100644 (file)
@@ -41,19 +41,19 @@ struct bt_notification_iterator;
  */
 enum bt_notification_iterator_status {
        /** Try again. */
-       BT_NOTIFICATION_ITERATOR_STATUS_AGAIN = 2,
+       BT_NOTIFICATION_ITERATOR_STATUS_AGAIN = 11,
        /** No more notifications to be delivered. */
        BT_NOTIFICATION_ITERATOR_STATUS_END = 1,
        /** No error, okay. */
        BT_NOTIFICATION_ITERATOR_STATUS_OK = 0,
        /** Invalid arguments. */
-       BT_NOTIFICATION_ITERATOR_STATUS_INVAL = -1,
+       BT_NOTIFICATION_ITERATOR_STATUS_INVALID = -22,
        /** General error. */
-       BT_NOTIFICATION_ITERATOR_STATUS_ERROR = -2,
+       BT_NOTIFICATION_ITERATOR_STATUS_ERROR = -1,
        /** Out of memory. */
-       BT_NOTIFICATION_ITERATOR_STATUS_NOMEM = -3,
+       BT_NOTIFICATION_ITERATOR_STATUS_NOMEM = -12,
        /** Unsupported iterator feature. */
-       BT_NOTIFICATION_ITERATOR_STATUS_UNSUPPORTED = -4,
+       BT_NOTIFICATION_ITERATOR_STATUS_UNSUPPORTED = -2,
 
 };
 
index 29562955dd72e4baa3b8e455df24cefb8098fc04..491dddf38a32e5f30ecd05607af04c8ad40d13a6 100644 (file)
@@ -122,7 +122,7 @@ enum bt_notification_iterator_status bt_notification_iterator_validate(
                        BT_NOTIFICATION_ITERATOR_STATUS_OK;
 
        if (!iterator) {
-               ret = BT_NOTIFICATION_ITERATOR_STATUS_INVAL;
+               ret = BT_NOTIFICATION_ITERATOR_STATUS_INVALID;
                goto end;
        }
 end:
@@ -149,7 +149,7 @@ bt_private_notification_iterator_set_user_data(
                bt_notification_iterator_from_private(private_iterator);
 
        if (!iterator) {
-               ret = BT_NOTIFICATION_ITERATOR_STATUS_INVAL;
+               ret = BT_NOTIFICATION_ITERATOR_STATUS_INVALID;
                goto end;
        }
 
@@ -179,12 +179,13 @@ bt_notification_iterator_next(struct bt_notification_iterator *iterator)
        struct bt_private_notification_iterator *priv_iterator =
                bt_private_notification_iterator_from_notification_iterator(iterator);
        bt_component_class_notification_iterator_next_method next_method = NULL;
-       struct bt_notification_iterator_next_return next_return;
-       enum bt_notification_iterator_status status =
-               BT_NOTIFICATION_ITERATOR_STATUS_OK;
+       struct bt_notification_iterator_next_return next_return = {
+               .status = BT_NOTIFICATION_ITERATOR_STATUS_OK,
+               .notification = NULL,
+       };
 
        if (!iterator) {
-               status = BT_NOTIFICATION_ITERATOR_STATUS_INVAL;
+               next_return.status = BT_NOTIFICATION_ITERATOR_STATUS_INVALID;
                goto end;
        }
 
@@ -221,7 +222,8 @@ bt_notification_iterator_next(struct bt_notification_iterator *iterator)
        next_return = next_method(priv_iterator);
        if (next_return.status == BT_NOTIFICATION_ITERATOR_STATUS_OK) {
                if (!next_return.notification) {
-                       status = BT_NOTIFICATION_ITERATOR_STATUS_ERROR;
+                       next_return.status =
+                               BT_NOTIFICATION_ITERATOR_STATUS_ERROR;
                        goto end;
                }
 
index 6ea15530a31fd6d3bfcc96917e37f1c72dcb6e8c..808f9ccfeb3bf1f437f3b29e88d5b8dd2befa5dc 100644 (file)
@@ -86,13 +86,13 @@ enum bt_notification_iterator_status ctf_fs_iterator_init(
 
        ctf_fs = bt_private_component_get_user_data(priv_comp);
        if (!ctf_fs) {
-               ret = BT_NOTIFICATION_ITERATOR_STATUS_INVAL;
+               ret = BT_NOTIFICATION_ITERATOR_STATUS_INVALID;
                goto error;
        }
 
        port_data = bt_private_port_get_user_data(port);
        if (!port_data) {
-               ret = BT_NOTIFICATION_ITERATOR_STATUS_INVAL;
+               ret = BT_NOTIFICATION_ITERATOR_STATUS_INVALID;
                goto error;
        }
 
This page took 0.027866 seconds and 4 git commands to generate.