Mon Jun 22 21:13:50 2009 UTC ()
Fix compilation with SMB_*_DEBUG options.


(njoly)
diff -r1.32 -r1.33 src/sys/fs/smbfs/smbfs_io.c
diff -r1.67 -r1.68 src/sys/fs/smbfs/smbfs_vnops.c

cvs diff -r1.32 -r1.33 src/sys/fs/smbfs/Attic/smbfs_io.c (expand / switch to unified diff)

--- src/sys/fs/smbfs/Attic/smbfs_io.c 2009/03/18 16:00:21 1.32
+++ src/sys/fs/smbfs/Attic/smbfs_io.c 2009/06/22 21:13:50 1.33
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: smbfs_io.c,v 1.32 2009/03/18 16:00:21 cegger Exp $ */ 1/* $NetBSD: smbfs_io.c,v 1.33 2009/06/22 21:13:50 njoly 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.
@@ -26,27 +26,27 @@ @@ -26,27 +26,27 @@
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_io.c,v 1.7 2001/12/02 08:56:58 bp Exp 34 * FreeBSD: src/sys/fs/smbfs/smbfs_io.c,v 1.7 2001/12/02 08:56:58 bp Exp
35 * 35 *
36 */ 36 */
37 37
38#include <sys/cdefs.h> 38#include <sys/cdefs.h>
39__KERNEL_RCSID(0, "$NetBSD: smbfs_io.c,v 1.32 2009/03/18 16:00:21 cegger Exp $"); 39__KERNEL_RCSID(0, "$NetBSD: smbfs_io.c,v 1.33 2009/06/22 21:13:50 njoly Exp $");
40 40
41#include <sys/param.h> 41#include <sys/param.h>
42#include <sys/systm.h> 42#include <sys/systm.h>
43#include <sys/resourcevar.h> /* defines plimit structure in proc struct */ 43#include <sys/resourcevar.h> /* defines plimit structure in proc struct */
44#include <sys/kernel.h> 44#include <sys/kernel.h>
45#include <sys/proc.h> 45#include <sys/proc.h>
46#include <sys/fcntl.h> 46#include <sys/fcntl.h>
47#include <sys/buf.h> 47#include <sys/buf.h>
48#include <sys/mount.h> 48#include <sys/mount.h>
49#include <sys/malloc.h> 49#include <sys/malloc.h>
50#include <sys/namei.h> 50#include <sys/namei.h>
51#include <sys/vnode.h> 51#include <sys/vnode.h>
52#include <sys/dirent.h> 52#include <sys/dirent.h>
@@ -244,27 +244,27 @@ smbfs_writevnode(struct vnode *vp, struc @@ -244,27 +244,27 @@ smbfs_writevnode(struct vnode *vp, struc
244{ 244{
245 struct smbmount *smp = VTOSMBFS(vp); 245 struct smbmount *smp = VTOSMBFS(vp);
246 struct smbnode *np = VTOSMB(vp); 246 struct smbnode *np = VTOSMB(vp);
247 struct smb_cred scred; 247 struct smb_cred scred;
248 struct lwp *l = curlwp; 248 struct lwp *l = curlwp;
249 struct proc *p = l->l_proc; 249 struct proc *p = l->l_proc;
250 int error = 0; 250 int error = 0;
251 int extended = 0; 251 int extended = 0;
252 size_t resid = uiop->uio_resid; 252 size_t resid = uiop->uio_resid;
253 253
254 /* vn types other than VREG unsupported */ 254 /* vn types other than VREG unsupported */
255 KASSERT(vp->v_type == VREG); 255 KASSERT(vp->v_type == VREG);
256 256
257 SMBVDEBUG("ofs=%lld,resid=%d\n", 257 SMBVDEBUG("ofs=%lld,resid=%zu\n",
258 (long long int) uiop->uio_offset, 258 (long long int) uiop->uio_offset,
259 uiop->uio_resid); 259 uiop->uio_resid);
260 if (uiop->uio_offset < 0) 260 if (uiop->uio_offset < 0)
261 return EINVAL; 261 return EINVAL;
262/* if (uiop->uio_offset + uiop->uio_resid > smp->nm_maxfilesize) 262/* if (uiop->uio_offset + uiop->uio_resid > smp->nm_maxfilesize)
263 return (EFBIG);*/ 263 return (EFBIG);*/
264 if (ioflag & (IO_APPEND | IO_SYNC)) { 264 if (ioflag & (IO_APPEND | IO_SYNC)) {
265 if (np->n_flag & NMODIFIED) { 265 if (np->n_flag & NMODIFIED) {
266 smbfs_attr_cacheremove(vp); 266 smbfs_attr_cacheremove(vp);
267 error = smbfs_vinvalbuf(vp, V_SAVE, cred, l, 1); 267 error = smbfs_vinvalbuf(vp, V_SAVE, cred, l, 1);
268 if (error) 268 if (error)
269 return error; 269 return error;
270 } 270 }
@@ -281,27 +281,28 @@ smbfs_writevnode(struct vnode *vp, struc @@ -281,27 +281,28 @@ smbfs_writevnode(struct vnode *vp, struc
281 uiop->uio_offset = np->n_size; 281 uiop->uio_offset = np->n_size;
282 } 282 }
283 } 283 }
284 if (uiop->uio_resid == 0) 284 if (uiop->uio_resid == 0)
285 return 0; 285 return 0;
286 if (p && uiop->uio_offset + uiop->uio_resid > p->p_rlimit[RLIMIT_FSIZE].rlim_cur) { 286 if (p && uiop->uio_offset + uiop->uio_resid > p->p_rlimit[RLIMIT_FSIZE].rlim_cur) {
287 mutex_enter(proc_lock); 287 mutex_enter(proc_lock);
288 psignal(p, SIGXFSZ); 288 psignal(p, SIGXFSZ);
289 mutex_exit(proc_lock); 289 mutex_exit(proc_lock);
290 return EFBIG; 290 return EFBIG;
291 } 291 }
292 smb_makescred(&scred, l, cred); 292 smb_makescred(&scred, l, cred);
293 error = smb_write(smp->sm_share, np->n_fid, uiop, &scred); 293 error = smb_write(smp->sm_share, np->n_fid, uiop, &scred);
294 SMBVDEBUG("after: ofs=%lld,resid=%d,err=%d\n",(long long int)uiop->uio_offset, uiop->uio_resid, error); 294 SMBVDEBUG("after: ofs=%lld,resid=%zu,err=%d\n",
 295 (long long int)uiop->uio_offset, uiop->uio_resid, error);
295 if (!error) { 296 if (!error) {
296 if (uiop->uio_offset > np->n_size) { 297 if (uiop->uio_offset > np->n_size) {
297 np->n_size = uiop->uio_offset; 298 np->n_size = uiop->uio_offset;
298 uvm_vnp_setsize(vp, np->n_size); 299 uvm_vnp_setsize(vp, np->n_size);
299 extended = 1; 300 extended = 1;
300 } 301 }
301 302
302 } 303 }
303 if (resid > uiop->uio_resid) 304 if (resid > uiop->uio_resid)
304 VN_KNOTE(vp, NOTE_WRITE | (extended ? NOTE_EXTEND : 0)); 305 VN_KNOTE(vp, NOTE_WRITE | (extended ? NOTE_EXTEND : 0));
305 return error; 306 return error;
306} 307}
307 308

cvs diff -r1.67 -r1.68 src/sys/fs/smbfs/Attic/smbfs_vnops.c (expand / switch to unified diff)

--- src/sys/fs/smbfs/Attic/smbfs_vnops.c 2009/05/07 19:30:30 1.67
+++ src/sys/fs/smbfs/Attic/smbfs_vnops.c 2009/06/22 21:13:50 1.68
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: smbfs_vnops.c,v 1.67 2009/05/07 19:30:30 elad Exp $ */ 1/* $NetBSD: smbfs_vnops.c,v 1.68 2009/06/22 21:13:50 njoly Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2003 The NetBSD Foundation, Inc. 4 * Copyright (c) 2003 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jaromir Dolecek. 8 * by Jaromir Dolecek.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -54,27 +54,27 @@ @@ -54,27 +54,27 @@
54 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 54 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
55 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 55 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
56 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 56 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
57 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 57 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
58 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 58 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
59 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 59 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
60 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 60 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
61 * SUCH DAMAGE. 61 * SUCH DAMAGE.
62 * 62 *
63 * FreeBSD: src/sys/fs/smbfs/smbfs_vnops.c,v 1.15 2001/12/20 15:56:45 bp Exp 63 * FreeBSD: src/sys/fs/smbfs/smbfs_vnops.c,v 1.15 2001/12/20 15:56:45 bp Exp
64 */ 64 */
65 65
66#include <sys/cdefs.h> 66#include <sys/cdefs.h>
67__KERNEL_RCSID(0, "$NetBSD: smbfs_vnops.c,v 1.67 2009/05/07 19:30:30 elad Exp $"); 67__KERNEL_RCSID(0, "$NetBSD: smbfs_vnops.c,v 1.68 2009/06/22 21:13:50 njoly Exp $");
68 68
69#include <sys/param.h> 69#include <sys/param.h>
70#include <sys/systm.h> 70#include <sys/systm.h>
71#include <sys/namei.h> 71#include <sys/namei.h>
72#include <sys/kernel.h> 72#include <sys/kernel.h>
73#include <sys/proc.h> 73#include <sys/proc.h>
74#include <sys/buf.h> 74#include <sys/buf.h>
75#include <sys/fcntl.h> 75#include <sys/fcntl.h>
76#include <sys/mount.h> 76#include <sys/mount.h>
77#include <sys/unistd.h> 77#include <sys/unistd.h>
78#include <sys/vnode.h> 78#include <sys/vnode.h>
79#include <sys/lockf.h> 79#include <sys/lockf.h>
80#include <sys/kauth.h> 80#include <sys/kauth.h>
@@ -515,27 +515,28 @@ smbfs_read(void *v) @@ -515,27 +515,28 @@ smbfs_read(void *v)
515 515
516int 516int
517smbfs_write(void *v) 517smbfs_write(void *v)
518{ 518{
519 struct vop_write_args /* { 519 struct vop_write_args /* {
520 struct vnode *a_vp; 520 struct vnode *a_vp;
521 struct uio *a_uio; 521 struct uio *a_uio;
522 int a_ioflag; 522 int a_ioflag;
523 kauth_cred_t a_cred; 523 kauth_cred_t a_cred;
524 } */ *ap = v; 524 } */ *ap = v;
525 struct vnode *vp = ap->a_vp; 525 struct vnode *vp = ap->a_vp;
526 struct uio *uio = ap->a_uio; 526 struct uio *uio = ap->a_uio;
527 527
528 SMBVDEBUG("%d,ofs=%lld,sz=%u\n",vp->v_type, (long long int)uio->uio_offset, uio->uio_resid); 528 SMBVDEBUG("%d,ofs=%lld,sz=%zu\n",vp->v_type,
 529 (long long int)uio->uio_offset, uio->uio_resid);
529 if (vp->v_type != VREG) 530 if (vp->v_type != VREG)
530 return (EPERM); 531 return (EPERM);
531 return smbfs_writevnode(vp, uio, ap->a_cred, ap->a_ioflag); 532 return smbfs_writevnode(vp, uio, ap->a_cred, ap->a_ioflag);
532} 533}
533/* 534/*
534 * smbfs_create call 535 * smbfs_create call
535 * Create a regular file. On entry the directory to contain the file being 536 * Create a regular file. On entry the directory to contain the file being
536 * created is locked. We must release before we return. We must also free 537 * created is locked. We must release before we return. We must also free
537 * the pathname buffer pointed at by cnp->cn_pnbuf, always on error, or 538 * the pathname buffer pointed at by cnp->cn_pnbuf, always on error, or
538 * only if the SAVESTART bit in cn_flags is clear on success. 539 * only if the SAVESTART bit in cn_flags is clear on success.
539 */ 540 */
540int 541int
541smbfs_create(void *v) 542smbfs_create(void *v)