diff options
author | Jonathan Earl Brassow <jbrassow@redhat.com> | 2009-09-22 16:26:59 +0000 |
---|---|---|
committer | Jonathan Earl Brassow <jbrassow@redhat.com> | 2009-09-22 16:26:59 +0000 |
commit | 3c74075fb13ed8adb06ced45a707be3f24ea958f (patch) | |
tree | b814461383824f9a4a699073f82cc9dfaa13499d | |
parent | 3545e55a01c563a9513d03e512a530065fa8fc24 (diff) | |
download | lvm2-3c74075fb13ed8adb06ced45a707be3f24ea958f.tar.gz lvm2-3c74075fb13ed8adb06ced45a707be3f24ea958f.tar.xz lvm2-3c74075fb13ed8adb06ced45a707be3f24ea958f.zip |
'_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'.
-rw-r--r-- | libdm/libdm-deptree.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c index ccabca95..b6fdfef4 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)) |