* On failure, returns -errno (not mounted yields -EINVAL)
* Is noisy on failures, expects to be given a mounted device.
*/
-static int get_btrfs_mount(const char *dev, char *mp, size_t mp_size) {
+int get_btrfs_mount(const char *dev, char *mp, size_t mp_size)
+{
int ret;
int fd = -1;
ret = check_mounted_where(fd, dev, mp, mp_size, NULL);
if (!ret) {
- fprintf(stderr, "%s is not a mounted btrfs device\n", dev);
ret = -EINVAL;
} else { /* mounted, all good */
ret = 0;
out:
if (fd != -1)
close(fd);
- if (ret)
- fprintf(stderr, "Could not get mountpoint for %s\n", dev);
return ret;
}
int ask_user(char *question);
int lookup_ino_rootid(int fd, u64 *rootid);
int btrfs_scan_lblkid(int update_kernel);
+int get_btrfs_mount(const char *dev, char *mp, size_t mp_size);
#endif