smb_dev.c (130585) | smb_dev.c (130640) |
---|---|
1/* 2 * Copyright (c) 2000-2001 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 --- 17 unchanged lines hidden (view full) --- 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 33#include <sys/cdefs.h> | 1/* 2 * Copyright (c) 2000-2001 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 --- 17 unchanged lines hidden (view full) --- 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 33#include <sys/cdefs.h> |
34__FBSDID("$FreeBSD: head/sys/netsmb/smb_dev.c 130585 2004-06-16 09:47:26Z phk $"); | 34__FBSDID("$FreeBSD: head/sys/netsmb/smb_dev.c 130640 2004-06-17 17:16:53Z phk $"); |
35 36#include <sys/param.h> 37#include <sys/kernel.h> 38#include <sys/module.h> 39#include <sys/systm.h> 40#include <sys/conf.h> 41#include <sys/fcntl.h> 42#include <sys/ioccom.h> --- 55 unchanged lines hidden (view full) --- 98 99static eventhandler_tag nsmb_dev_tag; 100 101static void 102nsmb_dev_clone(void *arg, char *name, int namelen, struct cdev **dev) 103{ 104 int u; 105 | 35 36#include <sys/param.h> 37#include <sys/kernel.h> 38#include <sys/module.h> 39#include <sys/systm.h> 40#include <sys/conf.h> 41#include <sys/fcntl.h> 42#include <sys/ioccom.h> --- 55 unchanged lines hidden (view full) --- 98 99static eventhandler_tag nsmb_dev_tag; 100 101static void 102nsmb_dev_clone(void *arg, char *name, int namelen, struct cdev **dev) 103{ 104 int u; 105 |
106 if (*dev != NODEV) | 106 if (*dev != NULL) |
107 return; 108 if (dev_stdclone(name, NULL, NSMB_NAME, &u) != 1) 109 return; 110 *dev = make_dev(&nsmb_cdevsw, unit2minor(u), 0, 0, 0600, 111 NSMB_NAME"%d", u); 112} 113 114static int --- 277 unchanged lines hidden (view full) --- 392 if (fp == NULL) 393 return EBADF; 394 vp = fp->f_vnode; 395 if (vp == NULL) { 396 fdrop(fp, curthread); 397 return EBADF; 398 } 399 dev = vn_todev(vp); | 107 return; 108 if (dev_stdclone(name, NULL, NSMB_NAME, &u) != 1) 109 return; 110 *dev = make_dev(&nsmb_cdevsw, unit2minor(u), 0, 0, 0600, 111 NSMB_NAME"%d", u); 112} 113 114static int --- 277 unchanged lines hidden (view full) --- 392 if (fp == NULL) 393 return EBADF; 394 vp = fp->f_vnode; 395 if (vp == NULL) { 396 fdrop(fp, curthread); 397 return EBADF; 398 } 399 dev = vn_todev(vp); |
400 if (dev == NODEV) { | 400 if (dev == NULL) { |
401 fdrop(fp, curthread); 402 return EBADF; 403 } 404 SMB_CHECKMINOR(dev); 405 ssp = sdp->sd_share; 406 if (ssp == NULL) { 407 fdrop(fp, curthread); 408 return ENOTCONN; 409 } 410 error = smb_share_get(ssp, LK_EXCLUSIVE, scred); 411 if (error == 0) 412 *sspp = ssp; 413 fdrop(fp, curthread); 414 return error; 415} 416 | 401 fdrop(fp, curthread); 402 return EBADF; 403 } 404 SMB_CHECKMINOR(dev); 405 ssp = sdp->sd_share; 406 if (ssp == NULL) { 407 fdrop(fp, curthread); 408 return ENOTCONN; 409 } 410 error = smb_share_get(ssp, LK_EXCLUSIVE, scred); 411 if (error == 0) 412 *sspp = ssp; 413 fdrop(fp, curthread); 414 return error; 415} 416 |