Change the first argument of m_copydata() to "const struct mbuf *" (which

doesn't require any implementation changes). This will allow us to get
rid off a lot of nasty type casts.
This commit is contained in:
tron 2005-06-02 10:34:59 +00:00
parent fea4b15e35
commit c54394a240
2 changed files with 9 additions and 9 deletions

View File

@ -668,24 +668,24 @@ nospace:
* continuing for "len" bytes, into the indicated buffer.
*/
void
m_copydata(struct mbuf *m, int off, int len, void *vp)
m_copydata(const struct mbuf *m, int off, int len, void *vp)
{
unsigned count;
char *cp = vp;
unsigned count;
caddr_t *cp = vp;
if (off < 0 || len < 0)
panic("m_copydata: off %d, len %d", off, len);
while (off > 0) {
if (m == 0)
panic("m_copydata: m == 0, off %d", off);
if (m == NULL)
panic("m_copydata: m == NULL, off %d", off);
if (off < m->m_len)
break;
off -= m->m_len;
m = m->m_next;
}
while (len > 0) {
if (m == 0)
panic("m_copydata: m == 0, len %d", len);
if (m == NULL)
panic("m_copydata: m == NULL, len %d", len);
count = min(m->m_len - off, len);
memcpy(cp, mtod(m, caddr_t) + off, count);
len -= count;

View File

@ -1,4 +1,4 @@
/* $NetBSD: mbuf.h,v 1.108 2005/06/01 18:03:50 drochner Exp $ */
/* $NetBSD: mbuf.h,v 1.109 2005/06/02 10:34:59 tron Exp $ */
/*-
* Copyright (c) 1996, 1997, 1999, 2001 The NetBSD Foundation, Inc.
@ -833,7 +833,7 @@ int m_mballoc(int, int);
void m_copyback(struct mbuf *, int, int, const void *);
struct mbuf *m_copyback_cow(struct mbuf *, int, int, const void *, int);
int m_makewritable(struct mbuf **, int, int, int);
void m_copydata(struct mbuf *, int, int, void *);
void m_copydata(const struct mbuf *, int, int, void *);
void m_freem(struct mbuf *);
void m_reclaim(void *, int);
void mbinit(void);