Module Name: src Committed By: riz Date: Fri Jul 16 18:47:10 UTC 2010
Modified Files: src/sys/netsmb [netbsd-5]: mchain.h smb_dev.h smb_subr.c smb_subr.h subr_mchain.c Log Message: Pull up following revision(s) (requested by christos in ticket #1426): sys/netsmb/subr_mchain.c: revision 1.19 sys/netsmb/smb_subr.c: revision 1.35 sys/netsmb/smb_subr.h: revision 1.19 sys/netsmb/mchain.h: revision 1.9 sys/netsmb/smb_dev.h: revision 1.7 Convert sizes/lengths to unsigned (size_t) or uint32_t (for binary compatibility). To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.7.52.1 src/sys/netsmb/mchain.h cvs rdiff -u -r1.6 -r1.6.74.1 src/sys/netsmb/smb_dev.h cvs rdiff -u -r1.32 -r1.32.6.1 src/sys/netsmb/smb_subr.c cvs rdiff -u -r1.18 -r1.18.6.1 src/sys/netsmb/smb_subr.h cvs rdiff -u -r1.15 -r1.15.6.1 src/sys/netsmb/subr_mchain.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/netsmb/mchain.h diff -u src/sys/netsmb/mchain.h:1.7 src/sys/netsmb/mchain.h:1.7.52.1 --- src/sys/netsmb/mchain.h:1.7 Sun Mar 4 06:03:35 2007 +++ src/sys/netsmb/mchain.h Fri Jul 16 18:47:10 2010 @@ -59,8 +59,8 @@ struct mbchain { struct mbuf * mb_top; /* head of mbufs chain */ struct mbuf * mb_cur; /* current mbuf */ - int mb_mleft; /* free space in the current mbuf */ - int mb_count; /* total number of bytes */ + size_t mb_mleft; /* free space in the current mbuf */ + size_t mb_count; /* total number of bytes */ mb_copy_t * mb_copy; /* user defined copy function */ void * mb_udata; /* user data */ }; @@ -78,7 +78,7 @@ void mb_done(struct mbchain *mbp); struct mbuf *mb_detach(struct mbchain *mbp); int mb_fixhdr(struct mbchain *mbp); -void *mb_reserve(struct mbchain *mbp, int size); +void *mb_reserve(struct mbchain *mbp, size_t size); int mb_put_uint8(struct mbchain *mbp, u_int8_t x); int mb_put_uint16be(struct mbchain *mbp, u_int16_t x); @@ -87,9 +87,9 @@ int mb_put_uint32le(struct mbchain *mbp, u_int32_t x); int mb_put_int64be(struct mbchain *mbp, int64_t x); int mb_put_int64le(struct mbchain *mbp, int64_t x); -int mb_put_mem(struct mbchain *mbp, const char * source, int size, int type); +int mb_put_mem(struct mbchain *mbp, const char * source, size_t size, int type); int mb_put_mbuf(struct mbchain *mbp, struct mbuf *m); -int mb_put_uio(struct mbchain *mbp, struct uio *uiop, int size); +int mb_put_uio(struct mbchain *mbp, struct uio *uiop, size_t size); int md_init(struct mdchain *mdp); void md_initm(struct mdchain *mbp, struct mbuf *m); @@ -106,9 +106,9 @@ int md_get_int64(struct mdchain *mdp, int64_t *x); int md_get_int64be(struct mdchain *mdp, int64_t *x); int md_get_int64le(struct mdchain *mdp, int64_t *x); -int md_get_mem(struct mdchain *mdp, void *target, int size, int type); +int md_get_mem(struct mdchain *mdp, void *target, size_t size, int type); int md_get_mbuf(struct mdchain *mdp, int size, struct mbuf **m); -int md_get_uio(struct mdchain *mdp, struct uio *uiop, int size); +int md_get_uio(struct mdchain *mdp, struct uio *uiop, size_t size); #endif /* ifdef _KERNEL */ Index: src/sys/netsmb/smb_dev.h diff -u src/sys/netsmb/smb_dev.h:1.6 src/sys/netsmb/smb_dev.h:1.6.74.1 --- src/sys/netsmb/smb_dev.h:1.6 Sun May 14 21:20:13 2006 +++ src/sys/netsmb/smb_dev.h Fri Jul 16 18:47:10 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: smb_dev.h,v 1.6 2006/05/14 21:20:13 elad Exp $ */ +/* $NetBSD: smb_dev.h,v 1.6.74.1 2010/07/16 18:47:10 riz Exp $ */ /* * Copyright (c) 2000-2001 Boris Popov @@ -67,9 +67,9 @@ struct smbioc_ossn { int ioc_opt; - int ioc_svlen; /* size of ioc_server address */ + uint32_t ioc_svlen; /* size of ioc_server address */ struct sockaddr*ioc_server; - int ioc_lolen; /* size of ioc_local address */ + uint32_t ioc_lolen; /* size of ioc_local address */ struct sockaddr*ioc_local; char ioc_srvname[SMB_MAXSRVNAMELEN + 1]; int ioc_timeout; Index: src/sys/netsmb/smb_subr.c diff -u src/sys/netsmb/smb_subr.c:1.32 src/sys/netsmb/smb_subr.c:1.32.6.1 --- src/sys/netsmb/smb_subr.c:1.32 Tue Jun 24 10:37:19 2008 +++ src/sys/netsmb/smb_subr.c Fri Jul 16 18:47:10 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: smb_subr.c,v 1.32 2008/06/24 10:37:19 gmcgarry Exp $ */ +/* $NetBSD: smb_subr.c,v 1.32.6.1 2010/07/16 18:47:10 riz Exp $ */ /* * Copyright (c) 2000-2001 Boris Popov @@ -35,7 +35,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: smb_subr.c,v 1.32 2008/06/24 10:37:19 gmcgarry Exp $"); +__KERNEL_RCSID(0, "$NetBSD: smb_subr.c,v 1.32.6.1 2010/07/16 18:47:10 riz Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -96,7 +96,7 @@ smb_strdup(const char *s) { char *p; - int len; + size_t len; len = s ? strlen(s) + 1 : 1; p = malloc(len, M_SMBSTR, M_WAITOK); @@ -111,10 +111,10 @@ * duplicate string from a user space. */ char * -smb_strdupin(char *s, int maxlen) +smb_strdupin(char *s, size_t maxlen) { char *p, bt; - int len = 0; + size_t len = 0; for (p = s; ;p++) { if (copyin(p, &bt, 1)) @@ -134,7 +134,7 @@ * duplicate memory block from a user space. */ void * -smb_memdupin(void *umem, int len) +smb_memdupin(void *umem, size_t len) { char *p; @@ -160,7 +160,7 @@ } void * -smb_zmalloc(unsigned long size, struct malloc_type *type, int flags) +smb_zmalloc(size_t size, struct malloc_type *type, int flags) { return malloc(size, type, flags | M_ZERO); @@ -179,12 +179,12 @@ void m_dumpm(struct mbuf *m) { char *p; - int len; + size_t len; printf("d="); while(m) { - p=mtod(m,char *); - len=m->m_len; - printf("(%d)",len); + p = mtod(m,char *); + len = m->m_len; + printf("(%zu)", len); while(len--){ printf("%02x ",((int)*(p++)) & 0xff); } @@ -315,7 +315,7 @@ int smb_put_dmem(struct mbchain *mbp, struct smb_vc *vcp, const char *src, - int size, int caseopt) + size_t size, int caseopt) { struct iconv_drv *dp = vcp->vc_toserver; Index: src/sys/netsmb/smb_subr.h diff -u src/sys/netsmb/smb_subr.h:1.18 src/sys/netsmb/smb_subr.h:1.18.6.1 --- src/sys/netsmb/smb_subr.h:1.18 Tue Jun 24 10:37:19 2008 +++ src/sys/netsmb/smb_subr.h Fri Jul 16 18:47:10 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: smb_subr.h,v 1.18 2008/06/24 10:37:19 gmcgarry Exp $ */ +/* $NetBSD: smb_subr.h,v 1.18.6.1 2010/07/16 18:47:10 riz Exp $ */ /* * Copyright (c) 2000-2001, Boris Popov @@ -109,18 +109,18 @@ kauth_cred_t cred); int smb_proc_intr(struct lwp *); char *smb_strdup(const char *s); -char *smb_strdupin(char *s, int maxlen); -void *smb_memdupin(void *umem, int len); +char *smb_strdupin(char *s, size_t maxlen); +void *smb_memdupin(void *umem, size_t len); void smb_strtouni(u_int16_t *dst, const char *src); void smb_strfree(char *s); void smb_memfree(void *s); -void *smb_zmalloc(unsigned long size, struct malloc_type *type, int flags); +void *smb_zmalloc(size_t size, struct malloc_type *type, int flags); int smb_encrypt(const u_char *apwd, u_char *C8, u_char *RN); int smb_ntencrypt(const u_char *apwd, u_char *C8, u_char *RN); int smb_maperror(int eclass, int eno); int smb_put_dmem(struct mbchain *mbp, struct smb_vc *vcp, - const char *src, int len, int caseopt); + const char *src, size_t len, int caseopt); int smb_put_dstring(struct mbchain *mbp, struct smb_vc *vcp, const char *src, int caseopt); int smb_put_string(struct smb_rq *rqp, const char *src); Index: src/sys/netsmb/subr_mchain.c diff -u src/sys/netsmb/subr_mchain.c:1.15 src/sys/netsmb/subr_mchain.c:1.15.6.1 --- src/sys/netsmb/subr_mchain.c:1.15 Tue Jun 24 10:37:19 2008 +++ src/sys/netsmb/subr_mchain.c Fri Jul 16 18:47:10 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_mchain.c,v 1.15 2008/06/24 10:37:19 gmcgarry Exp $ */ +/* $NetBSD: subr_mchain.c,v 1.15.6.1 2010/07/16 18:47:10 riz Exp $ */ /* * Copyright (c) 2000, 2001 Boris Popov @@ -35,7 +35,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: subr_mchain.c,v 1.15 2008/06/24 10:37:19 gmcgarry Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_mchain.c,v 1.15.6.1 2010/07/16 18:47:10 riz Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -52,12 +52,10 @@ #ifdef __NetBSD__ static struct mbuf * -m_getm(struct mbuf *m, int len, int how, int type) +m_getm(struct mbuf *m, size_t len, int how, int type) { struct mbuf *top, *tail, *mp, *mtail = NULL; - KASSERT(len >= 0); - mp = m_get(how, type); if (mp == NULL) return (NULL); @@ -112,7 +110,7 @@ m_fixhdr(struct mbuf *m0) { struct mbuf *m = m0; - int len = 0; + size_t len = 0; while (m) { len += m->m_len; @@ -175,13 +173,13 @@ * Note: size should be <= MLEN */ void * -mb_reserve(struct mbchain *mbp, int size) +mb_reserve(struct mbchain *mbp, size_t size) { struct mbuf *m, *mn; void *bpos; if (size > MLEN) - panic("mb_reserve: size = %d", size); + panic("mb_reserve: size = %zu", size); m = mbp->mb_cur; if (mbp->mb_mleft < size) { mn = m_get(M_WAIT, MT_DATA); @@ -248,12 +246,13 @@ } int -mb_put_mem(struct mbchain *mbp, const char *source, int size, int type) +mb_put_mem(struct mbchain *mbp, const char *source, size_t size, int type) { struct mbuf *m; char *dst; const char *src; - int cplen, error, mleft, count; + int error; + size_t cplen, mleft, count; m = mbp->mb_cur; mleft = mbp->mb_mleft; @@ -323,9 +322,9 @@ * copies a uio scatter/gather list to an mbuf chain. */ int -mb_put_uio(struct mbchain *mbp, struct uio *uiop, int size) +mb_put_uio(struct mbchain *mbp, struct uio *uiop, size_t size) { - long left; + size_t left; int mtype, error; mtype = VMSPACE_IS_KERNEL_P(uiop->uio_vmspace) ? MB_MSYSTEM : MB_MUSER; @@ -514,12 +513,12 @@ } int -md_get_mem(struct mdchain *mdp, void *targetv, int size, int type) +md_get_mem(struct mdchain *mdp, void *targetv, size_t size, int type) { char *target = targetv; struct mbuf *m = mdp->md_cur; int error; - u_int count; + size_t count; u_char *s; while (size > 0) { @@ -576,10 +575,10 @@ } int -md_get_uio(struct mdchain *mdp, struct uio *uiop, int size) +md_get_uio(struct mdchain *mdp, struct uio *uiop, size_t size) { char *uiocp; - long left; + size_t left; int mtype, error; mtype = VMSPACE_IS_KERNEL_P(uiop->uio_vmspace) ? MB_MSYSTEM : MB_MUSER;