summaryrefslogtreecommitdiffstats
path: root/contrib/smbfs
diff options
context:
space:
mode:
authordavide <davide@FreeBSD.org>2013-05-04 14:03:18 +0000
committerdavide <davide@FreeBSD.org>2013-05-04 14:03:18 +0000
commit49171951e3c2ee391cc14135ca9389ecb4e38f47 (patch)
tree58f50a43b89521ebbbf95593be5439c98bbdde90 /contrib/smbfs
parent6473a2540f9533d31ae4872e4485cd1f7eb2e402 (diff)
downloadFreeBSD-src-49171951e3c2ee391cc14135ca9389ecb4e38f47.zip
FreeBSD-src-49171951e3c2ee391cc14135ca9389ecb4e38f47.tar.gz
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
Diffstat (limited to 'contrib/smbfs')
-rw-r--r--contrib/smbfs/lib/smb/ctx.c30
-rw-r--r--contrib/smbfs/mount_smbfs/mount_smbfs.c8
2 files changed, 5 insertions, 33 deletions
diff --git a/contrib/smbfs/lib/smb/ctx.c b/contrib/smbfs/lib/smb/ctx.c
index 0709b6b..c7b3ecab 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 3025c79..8f159ce 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);
OpenPOWER on IntegriCloud