Merge branch 'linux-have-libdiskmgt' into refs/top-bases/linux-zfs-branch
This commit is contained in:
commit
b33947124c
|
@ -111,6 +111,7 @@ vdev_error(const char *fmt, ...)
|
|||
va_end(ap);
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBDISKMGT
|
||||
static void
|
||||
libdiskmgt_error(int error)
|
||||
{
|
||||
|
@ -272,6 +273,7 @@ check_device(const char *path, boolean_t force, boolean_t isspare)
|
|||
|
||||
return (check_slice(path, force, B_FALSE, isspare));
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Check that a file is valid. All we can do in this case is check that it's
|
||||
|
@ -287,6 +289,7 @@ check_file(const char *file, boolean_t force, boolean_t isspare)
|
|||
pool_state_t state;
|
||||
boolean_t inuse;
|
||||
|
||||
#ifdef HAVE_DM_INUSE_SWAP
|
||||
if (dm_inuse_swap(file, &err)) {
|
||||
if (err)
|
||||
libdiskmgt_error(err);
|
||||
|
@ -295,6 +298,7 @@ check_file(const char *file, boolean_t force, boolean_t isspare)
|
|||
"Please see swap(1M).\n"), file);
|
||||
return (-1);
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((fd = open(file, O_RDONLY)) < 0)
|
||||
return (0);
|
||||
|
@ -1061,11 +1065,15 @@ check_in_use(nvlist_t *config, nvlist_t *nv, int force, int isreplacing,
|
|||
return (0);
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBDISKMGT
|
||||
if (strcmp(type, VDEV_TYPE_DISK) == 0)
|
||||
ret = check_device(path, force, isspare);
|
||||
|
||||
if (strcmp(type, VDEV_TYPE_FILE) == 0)
|
||||
ret = check_file(path, force, isspare);
|
||||
#else
|
||||
ret = check_file(path, force, isspare);
|
||||
#endif
|
||||
|
||||
return (ret);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue