X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=lib%2Ftrace-ir%2Fclock-class.c;h=273d8f58a544d39b788fb5f7e9750066091bc910;hb=8c41fd73456a0645bb1798174e49b882d4f7bff7;hp=a2465b41396bebe7b0e05261c32960b320b723bc;hpb=6a84831f119d0bbc3339783e87818429f755ab1a;p=babeltrace.git diff --git a/lib/trace-ir/clock-class.c b/lib/trace-ir/clock-class.c index a2465b41..273d8f58 100644 --- a/lib/trace-ir/clock-class.c +++ b/lib/trace-ir/clock-class.c @@ -26,6 +26,8 @@ #include #include +#include +#include #include #include #include @@ -160,8 +162,8 @@ const char *bt_clock_class_get_name(const struct bt_clock_class *clock_class) return clock_class->name.value; } -int bt_clock_class_set_name(struct bt_clock_class *clock_class, - const char *name) +enum bt_clock_class_status bt_clock_class_set_name( + struct bt_clock_class *clock_class, const char *name) { BT_ASSERT_PRE_NON_NULL(clock_class, "Clock class"); BT_ASSERT_PRE_NON_NULL(name, "Name"); @@ -169,7 +171,7 @@ int bt_clock_class_set_name(struct bt_clock_class *clock_class, g_string_assign(clock_class->name.str, name); clock_class->name.value = clock_class->name.str->str; BT_LIB_LOGV("Set clock class's name: %!+K", clock_class); - return 0; + return BT_CLOCK_CLASS_STATUS_OK; } const char *bt_clock_class_get_description( @@ -179,8 +181,8 @@ const char *bt_clock_class_get_description( return clock_class->description.value; } -int bt_clock_class_set_description(struct bt_clock_class *clock_class, - const char *descr) +enum bt_clock_class_status bt_clock_class_set_description( + struct bt_clock_class *clock_class, const char *descr) { BT_ASSERT_PRE_NON_NULL(clock_class, "Clock class"); BT_ASSERT_PRE_NON_NULL(descr, "Description"); @@ -189,7 +191,7 @@ int bt_clock_class_set_description(struct bt_clock_class *clock_class, clock_class->description.value = clock_class->description.str->str; BT_LIB_LOGV("Set clock class's description: %!+K", clock_class); - return 0; + return BT_CLOCK_CLASS_STATUS_OK; } uint64_t bt_clock_class_get_frequency(const struct bt_clock_class *clock_class) @@ -302,7 +304,7 @@ void _bt_clock_class_freeze(const struct bt_clock_class *clock_class) ((struct bt_clock_class *) clock_class)->frozen = 1; } -int bt_clock_class_cycles_to_ns_from_origin( +enum bt_clock_class_status bt_clock_class_cycles_to_ns_from_origin( const struct bt_clock_class *clock_class, uint64_t cycles, int64_t *ns) { @@ -312,6 +314,7 @@ int bt_clock_class_cycles_to_ns_from_origin( BT_ASSERT_PRE_NON_NULL(ns, "Nanoseconds (output)"); ret = bt_util_ns_from_origin(clock_class, cycles, ns); if (ret) { + ret = BT_CLOCK_CLASS_STATUS_OVERFLOW; BT_LIB_LOGW("Cannot convert cycles to nanoseconds " "from origin for given clock class: " "value overflows the signed 64-bit integer range: "