From 3c74075fb13ed8adb06ced45a707be3f24ea958f Mon Sep 17 00:00:00 2001 From: Jonathan Earl Brassow Date: Tue, 22 Sep 2009 16:26:59 +0000 Subject: [PATCH] '_emit_areas_line' returns 1 for success and 0 for failure. This always confuses me, so I've added a comment at the top of the function to remind me of this. I also found that 'mirror_emit_segment_line' was returning 0 (return_0) on failure /and/ success. It now returns 1 for success and 0 for failure - just like '_emit_areas_line' and its calling function, '_emit_segment_line'. --- libdm/libdm-deptree.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c index ccabca95f..b6fdfef4e 100644 --- a/libdm/libdm-deptree.c +++ b/libdm/libdm-deptree.c @@ -1258,6 +1258,11 @@ do {\ p += w;\ } while (0) +/* + * _emit_areas_line + * + * Returns: 1 on success, 0 on failure + */ static int _emit_areas_line(struct dm_task *dmt __attribute((unused)), struct load_segment *seg, char *params, size_t paramsize, int *pos) @@ -1279,6 +1284,11 @@ static int _emit_areas_line(struct dm_task *dmt __attribute((unused)), return 1; } +/* + * mirror_emit_segment_line + * + * Returns: 1 on success, 0 on failure + */ static int mirror_emit_segment_line(struct dm_task *dmt, uint32_t major, uint32_t minor, struct load_segment *seg, uint64_t *seg_start, char *params, @@ -1386,15 +1396,13 @@ static int mirror_emit_segment_line(struct dm_task *dmt, uint32_t major, EMIT_PARAMS(pos, " %u ", seg->mirror_area_count); - if ((r = _emit_areas_line(dmt, seg, params, paramsize, &pos)) <= 0) { - stack; - return r; - } + if ((r = _emit_areas_line(dmt, seg, params, paramsize, &pos)) <= 0) + return_0; if (handle_errors) EMIT_PARAMS(pos, " 1 handle_errors"); - return 0; + return 1; } static int _emit_segment_line(struct dm_task *dmt, uint32_t major, @@ -1415,8 +1423,8 @@ static int _emit_segment_line(struct dm_task *dmt, uint32_t major, /* Mirrors are pretty complicated - now in separate function */ r = mirror_emit_segment_line(dmt, major, minor, seg, seg_start, params, paramsize); - if (r) - return r; + if (!r) + return_0; break; case SEG_SNAPSHOT: if (!_build_dev_string(originbuf, sizeof(originbuf), seg->origin)) -- 2.43.5