diff options
author | Davide Italiano <davide@FreeBSD.org> | 2013-05-04 14:03:18 +0000 |
---|---|---|
committer | Davide Italiano <davide@FreeBSD.org> | 2013-05-04 14:03:18 +0000 |
commit | 92a4d9bcc8361aabe232a0d731002564c6809bbd (patch) | |
tree | 58f50a43b89521ebbbf95593be5439c98bbdde90 /contrib | |
parent | b48b774f99f8984c3e2bd9bb8a01dee0c5aa2058 (diff) | |
download | src-92a4d9bcc8361aabe232a0d731002564c6809bbd.tar.gz src-92a4d9bcc8361aabe232a0d731002564c6809bbd.zip |
Completely rewrite the interface to smbdev switching from dev_clone
to cdevpriv(9). This commit changes the semantic of mount_smbfs
in userland as well, which now passes file descriptor in order to
to mount a specific filesystem istance.
Reviewed by: attilio, ed
Tested by: martymac
Notes
Notes:
svn path=/head/; revision=250236
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/smbfs/lib/smb/ctx.c | 30 | ||||
-rw-r--r-- | contrib/smbfs/mount_smbfs/mount_smbfs.c | 8 |
2 files changed, 5 insertions, 33 deletions
diff --git a/contrib/smbfs/lib/smb/ctx.c b/contrib/smbfs/lib/smb/ctx.c index 0709b6b9a9b5..c7b3ecaba663 100644 --- a/contrib/smbfs/lib/smb/ctx.c +++ b/contrib/smbfs/lib/smb/ctx.c @@ -602,40 +602,12 @@ smb_ctx_gethandle(struct smb_ctx *ctx) int fd, i; char buf[20]; - /* - * First, try to open as cloned device - */ fd = open("/dev/"NSMB_NAME, O_RDWR); if (fd >= 0) { ctx->ct_fd = fd; return 0; } - /* - * well, no clone capabilities available - we have to scan - * all devices in order to get free one - */ - for (i = 0; i < 1024; i++) { - snprintf(buf, sizeof(buf), "/dev/%s%d", NSMB_NAME, i); - fd = open(buf, O_RDWR); - if (fd >= 0) { - ctx->ct_fd = fd; - return 0; - } - } - /* - * This is a compatibility with old /dev/net/nsmb device - */ - for (i = 0; i < 1024; i++) { - snprintf(buf, sizeof(buf), "/dev/net/%s%d", NSMB_NAME, i); - fd = open(buf, O_RDWR); - if (fd >= 0) { - ctx->ct_fd = fd; - return 0; - } - if (errno == ENOENT) - return ENOENT; - } - return ENOENT; + return ENOENT; } int diff --git a/contrib/smbfs/mount_smbfs/mount_smbfs.c b/contrib/smbfs/mount_smbfs/mount_smbfs.c index 3025c797612b..8f159ce68e00 100644 --- a/contrib/smbfs/mount_smbfs/mount_smbfs.c +++ b/contrib/smbfs/mount_smbfs/mount_smbfs.c @@ -82,7 +82,7 @@ main(int argc, char *argv[]) struct xvfsconf vfc; #endif char *next; - int opt, error, mntflags, caseopt, dev; + int opt, error, mntflags, caseopt, fd; uid_t uid; gid_t gid; mode_t dir_mode, file_mode; @@ -90,7 +90,7 @@ main(int argc, char *argv[]) iov = NULL; iovlen = 0; - dev = 0; + fd = 0; uid = (uid_t)-1; gid = (gid_t)-1; caseopt = 0; @@ -266,11 +266,11 @@ main(int argc, char *argv[]) exit(1); } - dev = ctx->ct_fd; + fd = ctx->ct_fd; build_iovec(&iov, &iovlen, "fstype", strdup("smbfs"), -1); build_iovec(&iov, &iovlen, "fspath", mount_point, -1); - build_iovec_argf(&iov, &iovlen, "dev", "%d", dev); + build_iovec_argf(&iov, &iovlen, "fd", "%d", fd); build_iovec(&iov, &iovlen, "mountpoint", mount_point, -1); build_iovec_argf(&iov, &iovlen, "uid", "%d", uid); build_iovec_argf(&iov, &iovlen, "gid", "%d", gid); |