Deleted Added
full compact
ctx.c (150802) ctx.c (250236)
1/*
2 * Copyright (c) 2000-2002, Boris Popov
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 16 unchanged lines hidden (view full) ---

25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 *
32 * $Id: ctx.c,v 1.24 2002/04/13 14:35:28 bp Exp $
1/*
2 * Copyright (c) 2000-2002, Boris Popov
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 16 unchanged lines hidden (view full) ---

25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 *
32 * $Id: ctx.c,v 1.24 2002/04/13 14:35:28 bp Exp $
33 * $FreeBSD: head/contrib/smbfs/lib/smb/ctx.c 150802 2005-10-02 08:32:49Z bp $
33 * $FreeBSD: head/contrib/smbfs/lib/smb/ctx.c 250236 2013-05-04 14:03:18Z davide $
34 */
35#include <sys/param.h>
36#include <sys/sysctl.h>
37#include <sys/ioctl.h>
38#include <sys/time.h>
39#include <sys/mount.h>
40#include <fcntl.h>
41#include <ctype.h>

--- 555 unchanged lines hidden (view full) ---

597}
598
599static int
600smb_ctx_gethandle(struct smb_ctx *ctx)
601{
602 int fd, i;
603 char buf[20];
604
34 */
35#include <sys/param.h>
36#include <sys/sysctl.h>
37#include <sys/ioctl.h>
38#include <sys/time.h>
39#include <sys/mount.h>
40#include <fcntl.h>
41#include <ctype.h>

--- 555 unchanged lines hidden (view full) ---

597}
598
599static int
600smb_ctx_gethandle(struct smb_ctx *ctx)
601{
602 int fd, i;
603 char buf[20];
604
605 /*
606 * First, try to open as cloned device
607 */
608 fd = open("/dev/"NSMB_NAME, O_RDWR);
609 if (fd >= 0) {
610 ctx->ct_fd = fd;
611 return 0;
612 }
605 fd = open("/dev/"NSMB_NAME, O_RDWR);
606 if (fd >= 0) {
607 ctx->ct_fd = fd;
608 return 0;
609 }
613 /*
614 * well, no clone capabilities available - we have to scan
615 * all devices in order to get free one
616 */
617 for (i = 0; i < 1024; i++) {
618 snprintf(buf, sizeof(buf), "/dev/%s%d", NSMB_NAME, i);
619 fd = open(buf, O_RDWR);
620 if (fd >= 0) {
621 ctx->ct_fd = fd;
622 return 0;
623 }
624 }
625 /*
626 * This is a compatibility with old /dev/net/nsmb device
627 */
628 for (i = 0; i < 1024; i++) {
629 snprintf(buf, sizeof(buf), "/dev/net/%s%d", NSMB_NAME, i);
630 fd = open(buf, O_RDWR);
631 if (fd >= 0) {
632 ctx->ct_fd = fd;
633 return 0;
634 }
635 if (errno == ENOENT)
636 return ENOENT;
637 }
638 return ENOENT;
610 return ENOENT;
639}
640
641int
642smb_ctx_lookup(struct smb_ctx *ctx, int level, int flags)
643{
644 struct smbioc_lookup rq;
645 int error;
646

--- 166 unchanged lines hidden ---
611}
612
613int
614smb_ctx_lookup(struct smb_ctx *ctx, int level, int flags)
615{
616 struct smbioc_lookup rq;
617 int error;
618

--- 166 unchanged lines hidden ---