misc: use libmnt_cache reference counting
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
0105691d54
commit
6195f9e6fa
|
@ -1576,7 +1576,7 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
status |= wait_many(FLAG_WAIT_ALL);
|
||||
free(fsck_path);
|
||||
mnt_free_cache(mntcache);
|
||||
mnt_unref_cache(mntcache);
|
||||
mnt_free_table(fstab);
|
||||
mnt_free_table(mtab);
|
||||
return status;
|
||||
|
|
|
@ -1497,7 +1497,7 @@ leave:
|
|||
tt_free_table(tt);
|
||||
|
||||
mnt_free_table(tb);
|
||||
mnt_free_cache(cache);
|
||||
mnt_unref_cache(cache);
|
||||
free(tabfiles);
|
||||
#ifdef HAVE_LIBUDEV
|
||||
udev_unref(udev);
|
||||
|
|
|
@ -1606,7 +1606,7 @@ leave:
|
|||
tt_free_table(lsblk->tt);
|
||||
mnt_free_table(mtab);
|
||||
mnt_free_table(swaps);
|
||||
mnt_free_cache(mntcache);
|
||||
mnt_unref_cache(mntcache);
|
||||
#ifdef HAVE_LIBUDEV
|
||||
udev_unref(udev);
|
||||
#endif
|
||||
|
|
|
@ -729,7 +729,8 @@ static int device_get_mountpoint(char **devname, char **mnt)
|
|||
if (!mtab)
|
||||
err(EXIT_FAILURE, _("failed to initialize libmount table"));
|
||||
|
||||
cache = mnt_new_cache();
|
||||
if (!cache)
|
||||
cache = mnt_new_cache();
|
||||
mnt_table_set_cache(mtab, cache);
|
||||
|
||||
if (p_option)
|
||||
|
@ -1147,7 +1148,7 @@ int main(int argc, char **argv)
|
|||
free(mountpoint);
|
||||
|
||||
mnt_free_table(mtab);
|
||||
mnt_free_cache(cache);
|
||||
mnt_unref_cache(cache);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -163,7 +163,7 @@ static void print_all(struct libmnt_context *cxt, char *pattern, int show_label)
|
|||
free(xsrc);
|
||||
}
|
||||
|
||||
mnt_free_cache(cache);
|
||||
mnt_unref_cache(cache);
|
||||
mnt_free_iter(itr);
|
||||
}
|
||||
|
||||
|
@ -990,8 +990,7 @@ int main(int argc, char **argv)
|
|||
* make a connection between the fstab and the canonicalization
|
||||
* cache.
|
||||
*/
|
||||
struct libmnt_cache *cache = mnt_context_get_cache(cxt);
|
||||
mnt_table_set_cache(fstab, cache);
|
||||
mnt_table_set_cache(fstab, mnt_context_get_cache(cxt));
|
||||
}
|
||||
|
||||
if (!mnt_context_get_source(cxt) &&
|
||||
|
|
|
@ -83,6 +83,7 @@ static int dir_to_device(const char *spec, dev_t *dev)
|
|||
/* to canonicalize all necessary paths */
|
||||
cache = mnt_new_cache();
|
||||
mnt_table_set_cache(tb, cache);
|
||||
mnt_unref_cache(cache);
|
||||
|
||||
fs = mnt_table_find_target(tb, spec, MNT_ITER_BACKWARD);
|
||||
if (fs && mnt_fs_get_target(fs)) {
|
||||
|
@ -91,7 +92,6 @@ static int dir_to_device(const char *spec, dev_t *dev)
|
|||
}
|
||||
|
||||
mnt_free_table(tb);
|
||||
mnt_free_cache(cache);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
|
@ -190,7 +190,7 @@ int main(int argc, char *argv[])
|
|||
status |= swapoff_all();
|
||||
|
||||
free_tables();
|
||||
mnt_free_cache(mntcache);
|
||||
mnt_unref_cache(mntcache);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
|
|
@ -816,7 +816,7 @@ int main(int argc, char *argv[])
|
|||
status |= do_swapon(*argv++, priority, discard, !CANONIC);
|
||||
|
||||
free_tables();
|
||||
mnt_free_cache(mntcache);
|
||||
mnt_unref_cache(mntcache);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue