fstrim: use MNT_EX_* from libmount
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
e3a7a5f8f0
commit
8e9039afe4
|
@ -184,11 +184,11 @@ static int fstrim_all(struct fstrim_range *rangetpl, int verbose)
|
||||||
|
|
||||||
itr = mnt_new_iter(MNT_ITER_BACKWARD);
|
itr = mnt_new_iter(MNT_ITER_BACKWARD);
|
||||||
if (!itr)
|
if (!itr)
|
||||||
err(MOUNT_EX_FAIL, _("failed to initialize libmount iterator"));
|
err(MNT_EX_FAIL, _("failed to initialize libmount iterator"));
|
||||||
|
|
||||||
tab = mnt_new_table_from_file(_PATH_PROC_MOUNTINFO);
|
tab = mnt_new_table_from_file(_PATH_PROC_MOUNTINFO);
|
||||||
if (!tab)
|
if (!tab)
|
||||||
err(MOUNT_EX_FAIL, _("failed to parse %s"), _PATH_PROC_MOUNTINFO);
|
err(MNT_EX_FAIL, _("failed to parse %s"), _PATH_PROC_MOUNTINFO);
|
||||||
|
|
||||||
/* de-duplicate by mountpoints */
|
/* de-duplicate by mountpoints */
|
||||||
mnt_table_uniq_fs(tab, 0, uniq_fs_target_cmp);
|
mnt_table_uniq_fs(tab, 0, uniq_fs_target_cmp);
|
||||||
|
@ -237,9 +237,9 @@ static int fstrim_all(struct fstrim_range *rangetpl, int verbose)
|
||||||
mnt_free_iter(itr);
|
mnt_free_iter(itr);
|
||||||
|
|
||||||
if (cnt && cnt == cnt_err)
|
if (cnt && cnt == cnt_err)
|
||||||
return MOUNT_EX_FAIL; /* all failed */
|
return MNT_EX_FAIL; /* all failed */
|
||||||
if (cnt && cnt_err)
|
if (cnt && cnt_err)
|
||||||
return MOUNT_EX_SOMEOK; /* some ok */
|
return MNT_EX_SOMEOK; /* some ok */
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue