1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

dmsetup: update _display_info

Handle error code.
This commit is contained in:
Zdenek Kabelac 2018-03-12 11:56:54 +01:00
parent 7ac7cc0ac8
commit 3f351466f7

View File

@ -863,11 +863,6 @@ static int _display_info_cols(struct dm_task *dmt, struct dm_info *info)
int selected; int selected;
char *device_name; char *device_name;
if (!info->exists) {
fprintf(stderr, "Device does not exist.\n");
return 0;
}
obj.task = dmt; obj.task = dmt;
obj.info = info; obj.info = info;
obj.deps_task = NULL; obj.deps_task = NULL;
@ -971,11 +966,6 @@ static void _display_info_long(struct dm_task *dmt, struct dm_info *info)
const char *uuid; const char *uuid;
uint32_t read_ahead; uint32_t read_ahead;
if (!info->exists) {
fprintf(stderr, "Device does not exist.\n");
return;
}
printf("Name: %s\n", dm_task_get_name(dmt)); printf("Name: %s\n", dm_task_get_name(dmt));
printf("State: %s%s%s\n", printf("State: %s%s%s\n",
@ -1013,17 +1003,22 @@ static void _display_info_long(struct dm_task *dmt, struct dm_info *info)
static int _display_info(struct dm_task *dmt) static int _display_info(struct dm_task *dmt)
{ {
struct dm_info info; struct dm_info info;
int r = 1;
if (!dm_task_get_info(dmt, &info)) if (!dm_task_get_info(dmt, &info))
return_0; return_0;
if (!info.exists) {
log_error("Device does not exist.");
return 0;
}
if (!_switches[COLS_ARG]) if (!_switches[COLS_ARG])
_display_info_long(dmt, &info); _display_info_long(dmt, &info);
else else
/* FIXME return code */ r = _display_info_cols(dmt, &info);
_display_info_cols(dmt, &info);
return info.exists ? 1 : 0; return r;
} }
static int _set_task_device(struct dm_task *dmt, const char *name, int optional) static int _set_task_device(struct dm_task *dmt, const char *name, int optional)