Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F106179598
D23132.id66612.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D23132.id66612.diff
View Options
Index: cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
===================================================================
--- cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
+++ cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
@@ -769,6 +769,7 @@
extern boolean_t is_mounted(libzfs_handle_t *, const char *special, char **);
extern boolean_t zfs_is_mounted(zfs_handle_t *, char **);
extern int zfs_mount(zfs_handle_t *, const char *, int);
+extern int zfs_mount_at(zfs_handle_t *, const char *, int, const char *);
extern int zfs_unmount(zfs_handle_t *, const char *, int);
extern int zfs_unmountall(zfs_handle_t *, int);
Index: cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c
===================================================================
--- cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c
+++ cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c
@@ -301,6 +301,17 @@
return (is_mounted(zhp->zfs_hdl, zfs_get_name(zhp), where));
}
+static boolean_t
+zfs_is_mountable_internal(zfs_handle_t *zhp, const char *mountpoint)
+{
+
+ if (zfs_prop_get_int(zhp, ZFS_PROP_ZONED) &&
+ getzoneid() == GLOBAL_ZONEID)
+ return (B_FALSE);
+
+ return (B_TRUE);
+}
+
/*
* Returns true if the given dataset is mountable, false otherwise. Returns the
* mountpoint in 'buf'.
@@ -325,8 +336,7 @@
if (zfs_prop_get_int(zhp, ZFS_PROP_CANMOUNT) == ZFS_CANMOUNT_OFF)
return (B_FALSE);
- if (zfs_prop_get_int(zhp, ZFS_PROP_ZONED) &&
- getzoneid() == GLOBAL_ZONEID)
+ if (!zfs_is_mountable_internal(zhp, buf))
return (B_FALSE);
if (source)
@@ -341,8 +351,19 @@
int
zfs_mount(zfs_handle_t *zhp, const char *options, int flags)
{
- struct stat buf;
char mountpoint[ZFS_MAXPROPLEN];
+
+ if (!zfs_is_mountable(zhp, mountpoint, sizeof (mountpoint), NULL))
+ return (0);
+
+ return (zfs_mount_at(zhp, options, flags, mountpoint));
+}
+
+int
+zfs_mount_at(zfs_handle_t *zhp, const char *options, int flags,
+ const char *mountpoint)
+{
+ struct stat buf;
char mntopts[MNT_LINE_MAX];
libzfs_handle_t *hdl = zhp->zfs_hdl;
@@ -357,8 +378,8 @@
if (zpool_get_prop_int(zhp->zpool_hdl, ZPOOL_PROP_READONLY, NULL))
flags |= MS_RDONLY;
- if (!zfs_is_mountable(zhp, mountpoint, sizeof (mountpoint), NULL))
- return (0);
+ if (!zfs_is_mountable_internal(zhp, mountpoint))
+ return (B_FALSE);
/* Create the directory if it doesn't already exist */
if (lstat(mountpoint, &buf) != 0) {
Index: lib/libbe/be_access.c
===================================================================
--- lib/libbe/be_access.c
+++ lib/libbe/be_access.c
@@ -122,8 +122,7 @@
}
opt = '\0';
- if ((err = zmount(zfs_get_name(zfs_hdl), tmp, info->mntflags,
- __DECONST(char *, MNTTYPE_ZFS), NULL, 0, &opt, 1)) != 0) {
+ if ((err = zfs_mount_at(zfs_hdl, NULL, info->mntflags, tmp)) != 0) {
switch (errno) {
case ENAMETOOLONG:
return (set_error(info->lbh, BE_ERR_PATHLEN));
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Dec 27, 5:10 PM (8 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15616080
Default Alt Text
D23132.id66612.diff (2 KB)
Attached To
Mode
D23132: libzfs: add zfs_mount_at, switch libbe to it
Attached
Detach File
Event Timeline
Log In to Comment