smbfs_node.c (107890) | smbfs_node.c (109623) |
---|---|
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 --- 15 unchanged lines hidden (view full) --- 24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 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 * | 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 --- 15 unchanged lines hidden (view full) --- 24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 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 * $FreeBSD: head/sys/fs/smbfs/smbfs_node.c 107890 2002-12-15 04:32:41Z tjr $ | 32 * $FreeBSD: head/sys/fs/smbfs/smbfs_node.c 109623 2003-01-21 08:56:16Z alfred $ |
33 */ 34#include <sys/param.h> 35#include <sys/systm.h> 36#include <sys/kernel.h> 37#include <sys/lock.h> 38#include <sys/malloc.h> 39#include <sys/mount.h> 40#include <sys/proc.h> --- 68 unchanged lines hidden (view full) --- 109 110static char * 111smbfs_name_alloc(const u_char *name, int nmlen) 112{ 113 u_char *cp; 114 115 nmlen++; 116#ifdef SMBFS_NAME_DEBUG | 33 */ 34#include <sys/param.h> 35#include <sys/systm.h> 36#include <sys/kernel.h> 37#include <sys/lock.h> 38#include <sys/malloc.h> 39#include <sys/mount.h> 40#include <sys/proc.h> --- 68 unchanged lines hidden (view full) --- 109 110static char * 111smbfs_name_alloc(const u_char *name, int nmlen) 112{ 113 u_char *cp; 114 115 nmlen++; 116#ifdef SMBFS_NAME_DEBUG |
117 cp = malloc(nmlen + 2 + sizeof(int), M_SMBNODENAME, M_WAITOK); | 117 cp = malloc(nmlen + 2 + sizeof(int), M_SMBNODENAME, 0); |
118 *(int*)cp = nmlen; 119 cp += sizeof(int); 120 cp[0] = 0xfc; 121 cp++; 122 bcopy(name, cp, nmlen - 1); 123 cp[nmlen] = 0xfe; 124#else | 118 *(int*)cp = nmlen; 119 cp += sizeof(int); 120 cp[0] = 0xfc; 121 cp++; 122 bcopy(name, cp, nmlen - 1); 123 cp[nmlen] = 0xfe; 124#else |
125 cp = malloc(nmlen, M_SMBNODENAME, M_WAITOK); | 125 cp = malloc(nmlen, M_SMBNODENAME, 0); |
126 bcopy(name, cp, nmlen - 1); 127#endif 128 cp[nmlen - 1] = 0; 129 return cp; 130} 131 132static void 133smbfs_name_free(u_char *name) --- 80 unchanged lines hidden (view full) --- 214 smbfs_hash_unlock(smp, td); 215 /* 216 * If we don't have node attributes, then it is an explicit lookup 217 * for an existing vnode. 218 */ 219 if (fap == NULL) 220 return ENOENT; 221 | 126 bcopy(name, cp, nmlen - 1); 127#endif 128 cp[nmlen - 1] = 0; 129 return cp; 130} 131 132static void 133smbfs_name_free(u_char *name) --- 80 unchanged lines hidden (view full) --- 214 smbfs_hash_unlock(smp, td); 215 /* 216 * If we don't have node attributes, then it is an explicit lookup 217 * for an existing vnode. 218 */ 219 if (fap == NULL) 220 return ENOENT; 221 |
222 MALLOC(np, struct smbnode *, sizeof *np, M_SMBNODE, M_WAITOK); | 222 MALLOC(np, struct smbnode *, sizeof *np, M_SMBNODE, 0); |
223 error = getnewvnode("smbfs", mp, smbfs_vnodeop_p, &vp); 224 if (error) { 225 FREE(np, M_SMBNODE); 226 return error; 227 } 228 vp->v_type = fap->fa_attr & SMB_FA_DIR ? VDIR : VREG; 229 bzero(np, sizeof(*np)); 230 vp->v_data = np; --- 185 unchanged lines hidden --- | 223 error = getnewvnode("smbfs", mp, smbfs_vnodeop_p, &vp); 224 if (error) { 225 FREE(np, M_SMBNODE); 226 return error; 227 } 228 vp->v_type = fap->fa_attr & SMB_FA_DIR ? VDIR : VREG; 229 bzero(np, sizeof(*np)); 230 vp->v_data = np; --- 185 unchanged lines hidden --- |