| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: smbfs_subr.c,v 1.14 2007/06/30 09:37:57 pooka Exp $ */ | | 1 | /* $NetBSD: smbfs_subr.c,v 1.15 2011/06/09 02:59:22 rmind Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2000-2001, Boris Popov | | 4 | * Copyright (c) 2000-2001, Boris Popov |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -25,27 +25,27 @@ | | | @@ -25,27 +25,27 @@ |
25 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | | 25 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
28 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 28 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
29 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 29 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
32 | * SUCH DAMAGE. | | 32 | * SUCH DAMAGE. |
33 | * | | 33 | * |
34 | * FreeBSD: src/sys/fs/smbfs/smbfs_subr.c,v 1.1 2001/04/10 07:59:05 bp Exp | | 34 | * FreeBSD: src/sys/fs/smbfs/smbfs_subr.c,v 1.1 2001/04/10 07:59:05 bp Exp |
35 | */ | | 35 | */ |
36 | | | 36 | |
37 | #include <sys/cdefs.h> | | 37 | #include <sys/cdefs.h> |
38 | __KERNEL_RCSID(0, "$NetBSD: smbfs_subr.c,v 1.14 2007/06/30 09:37:57 pooka Exp $"); | | 38 | __KERNEL_RCSID(0, "$NetBSD: smbfs_subr.c,v 1.15 2011/06/09 02:59:22 rmind Exp $"); |
39 | | | 39 | |
40 | #include <sys/param.h> | | 40 | #include <sys/param.h> |
41 | #include <sys/systm.h> | | 41 | #include <sys/systm.h> |
42 | #include <sys/kernel.h> | | 42 | #include <sys/kernel.h> |
43 | #include <sys/malloc.h> | | 43 | #include <sys/malloc.h> |
44 | #include <sys/mount.h> | | 44 | #include <sys/mount.h> |
45 | #include <sys/time.h> | | 45 | #include <sys/time.h> |
46 | #include <sys/vnode.h> | | 46 | #include <sys/vnode.h> |
47 | #include <sys/sysctl.h> | | 47 | #include <sys/sysctl.h> |
48 | #include <netsmb/iconv.h> | | 48 | #include <netsmb/iconv.h> |
49 | | | 49 | |
50 | #include <netsmb/smb.h> | | 50 | #include <netsmb/smb.h> |
51 | #include <netsmb/smb_conn.h> | | 51 | #include <netsmb/smb_conn.h> |
| @@ -258,46 +258,46 @@ smb_dos2unixtime(u_int dd, u_int dt, u_i | | | @@ -258,46 +258,46 @@ smb_dos2unixtime(u_int dd, u_int dt, u_i |
258 | } | | 258 | } |
259 | smb_time_server2local(seconds + lastseconds, tzoff, tsp); | | 259 | smb_time_server2local(seconds + lastseconds, tzoff, tsp); |
260 | tsp->tv_nsec = (dh % 100) * 10000000; | | 260 | tsp->tv_nsec = (dh % 100) * 10000000; |
261 | } | | 261 | } |
262 | | | 262 | |
263 | static int | | 263 | static int |
264 | smb_fphelp(struct mbchain *mbp, struct smb_vc *vcp, struct smbnode *np, | | 264 | smb_fphelp(struct mbchain *mbp, struct smb_vc *vcp, struct smbnode *np, |
265 | int caseopt) | | 265 | int caseopt) |
266 | { | | 266 | { |
267 | struct smbmount *smp= np->n_mount; | | 267 | struct smbmount *smp= np->n_mount; |
268 | struct smbnode **npp = smp->sm_npstack; | | 268 | struct smbnode **npp = smp->sm_npstack; |
269 | int i, error = 0; | | 269 | int i, error = 0; |
270 | | | 270 | |
271 | /* simple_lock(&smp->sm_npslock);*/ | | 271 | /* mutex_enter(&smp->sm_npslock);*/ |
272 | i = 0; | | 272 | i = 0; |
273 | while (np->n_parent) { | | 273 | while (np->n_parent) { |
274 | if (i++ == SMBFS_MAXPATHCOMP) { | | 274 | if (i++ == SMBFS_MAXPATHCOMP) { |
275 | /* simple_unlock(&smp->sm_npslock);*/ | | 275 | /* mutex_exit(&smp->sm_npslock);*/ |
276 | return ENAMETOOLONG; | | 276 | return ENAMETOOLONG; |
277 | } | | 277 | } |
278 | *npp++ = np; | | 278 | *npp++ = np; |
279 | np = VTOSMB(np->n_parent); | | 279 | np = VTOSMB(np->n_parent); |
280 | } | | 280 | } |
281 | while (i--) { | | 281 | while (i--) { |
282 | np = *--npp; | | 282 | np = *--npp; |
283 | error = mb_put_uint8(mbp, '\\'); | | 283 | error = mb_put_uint8(mbp, '\\'); |
284 | if (error) | | 284 | if (error) |
285 | break; | | 285 | break; |
286 | error = smb_put_dmem(mbp, vcp, np->n_name, np->n_nmlen, caseopt); | | 286 | error = smb_put_dmem(mbp, vcp, np->n_name, np->n_nmlen, caseopt); |
287 | if (error) | | 287 | if (error) |
288 | break; | | 288 | break; |
289 | } | | 289 | } |
290 | /* simple_unlock(&smp->sm_npslock);*/ | | 290 | /* mutex_exit(&smp->sm_npslock);*/ |
291 | return error; | | 291 | return error; |
292 | } | | 292 | } |
293 | | | 293 | |
294 | int | | 294 | int |
295 | smbfs_fullpath(struct mbchain *mbp, struct smb_vc *vcp, struct smbnode *dnp, | | 295 | smbfs_fullpath(struct mbchain *mbp, struct smb_vc *vcp, struct smbnode *dnp, |
296 | const char *name, int nmlen) | | 296 | const char *name, int nmlen) |
297 | { | | 297 | { |
298 | int caseopt = SMB_CS_NONE; | | 298 | int caseopt = SMB_CS_NONE; |
299 | int error; | | 299 | int error; |
300 | | | 300 | |
301 | if (SMB_DIALECT(vcp) < SMB_DIALECT_LANMAN1_0) | | 301 | if (SMB_DIALECT(vcp) < SMB_DIALECT_LANMAN1_0) |
302 | caseopt |= SMB_CS_UPPER; | | 302 | caseopt |= SMB_CS_UPPER; |
303 | if (dnp != NULL) { | | 303 | if (dnp != NULL) { |