Module Name: src Committed By: riz Date: Thu Jul 22 20:36:23 UTC 2010
Modified Files: src/sys/netsmb [netbsd-4]: 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 #1398): sys/netsmb/subr_mchain.c: revision 1.19 via patch sys/netsmb/smb_subr.c: revision 1.35 sys/netsmb/smb_subr.h: revision 1.19 sys/netsmb/mchain.h: revision 1.9 via patch 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.6 -r1.6.24.1 src/sys/netsmb/mchain.h cvs rdiff -u -r1.6 -r1.6.12.1 src/sys/netsmb/smb_dev.h cvs rdiff -u -r1.29 -r1.29.2.1 src/sys/netsmb/smb_subr.c cvs rdiff -u -r1.16 -r1.16.6.1 src/sys/netsmb/smb_subr.h cvs rdiff -u -r1.13 -r1.13.18.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.6 src/sys/netsmb/mchain.h:1.6.24.1 --- src/sys/netsmb/mchain.h:1.6 Sun Dec 11 00:06:21 2005 +++ src/sys/netsmb/mchain.h Thu Jul 22 20:36:22 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); -caddr_t mb_reserve(struct mbchain *mbp, int size); +caddr_t 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, caddr_t target, int size, int type); +int md_get_mem(struct mdchain *mdp, caddr_t 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.12.1 --- src/sys/netsmb/smb_dev.h:1.6 Sun May 14 21:20:13 2006 +++ src/sys/netsmb/smb_dev.h Thu Jul 22 20:36:22 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.12.1 2010/07/22 20:36:22 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.29 src/sys/netsmb/smb_subr.c:1.29.2.1 --- src/sys/netsmb/smb_subr.c:1.29 Thu Nov 16 01:33:51 2006 +++ src/sys/netsmb/smb_subr.c Thu Jul 22 20:36:22 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: smb_subr.c,v 1.29 2006/11/16 01:33:51 christos Exp $ */ +/* $NetBSD: smb_subr.c,v 1.29.2.1 2010/07/22 20:36:22 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.29 2006/11/16 01:33:51 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: smb_subr.c,v 1.29.2.1 2010/07/22 20:36:22 riz Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -93,7 +93,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); @@ -108,10 +108,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)) @@ -131,7 +131,7 @@ * duplicate memory block from a user space. */ void * -smb_memdupin(void *umem, int len) +smb_memdupin(void *umem, size_t len) { char *p; @@ -157,7 +157,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); @@ -176,12 +176,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); } @@ -312,7 +312,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.16 src/sys/netsmb/smb_subr.h:1.16.6.1 --- src/sys/netsmb/smb_subr.h:1.16 Thu Aug 17 17:11:29 2006 +++ src/sys/netsmb/smb_subr.h Thu Jul 22 20:36:22 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: smb_subr.h,v 1.16 2006/08/17 17:11:29 christos Exp $ */ +/* $NetBSD: smb_subr.h,v 1.16.6.1 2010/07/22 20:36:22 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.13 src/sys/netsmb/subr_mchain.c:1.13.18.1 --- src/sys/netsmb/subr_mchain.c:1.13 Wed Mar 1 12:38:32 2006 +++ src/sys/netsmb/subr_mchain.c Thu Jul 22 20:36:22 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_mchain.c,v 1.13 2006/03/01 12:38:32 yamt Exp $ */ +/* $NetBSD: subr_mchain.c,v 1.13.18.1 2010/07/22 20:36:22 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.13 2006/03/01 12:38:32 yamt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_mchain.c,v 1.13.18.1 2010/07/22 20:36:22 riz Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -55,12 +55,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); @@ -115,7 +113,7 @@ m_fixhdr(struct mbuf *m0) { struct mbuf *m = m0; - int len = 0; + size_t len = 0; while (m) { len += m->m_len; @@ -178,13 +176,13 @@ * Note: size should be <= MLEN */ caddr_t -mb_reserve(struct mbchain *mbp, int size) +mb_reserve(struct mbchain *mbp, size_t size) { struct mbuf *m, *mn; caddr_t 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); @@ -251,12 +249,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; @@ -326,9 +325,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; @@ -517,11 +516,11 @@ } int -md_get_mem(struct mdchain *mdp, caddr_t target, int size, int type) +md_get_mem(struct mdchain *mdp, caddr_t target, size_t size, int type) { struct mbuf *m = mdp->md_cur; int error; - u_int count; + size_t count; u_char *s; while (size > 0) { @@ -578,10 +577,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;