From 7b09a1e08986c8ca8acf3cc377cdcbd805efd756 Mon Sep 17 00:00:00 2001 From: yamt Date: Wed, 8 Sep 2004 12:00:28 +0000 Subject: [PATCH] m_copyback, m_copyback_cow, m_copydata: - caddr_t -> void * - constify. partly from openbsd. --- sys/kern/uipc_mbuf.c | 13 ++++++++----- sys/sys/mbuf.h | 8 ++++---- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index 4addb06b60dc..196762b4eba0 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -115,7 +115,7 @@ struct pool_allocator mclpool_allocator = { static struct mbuf *m_copym0(struct mbuf *, int, int, int, int); static struct mbuf *m_split0(struct mbuf *, int, int, int); -static int m_copyback0(struct mbuf **, int, int, caddr_t, int, int); +static int m_copyback0(struct mbuf **, int, int, const void *, int, int); /* flags for m_copyback0 */ #define M_COPYBACK0_COPYBACK 0x0001 /* copyback from cp */ @@ -665,9 +665,10 @@ nospace: * continuing for "len" bytes, into the indicated buffer. */ void -m_copydata(struct mbuf *m, int off, int len, caddr_t cp) +m_copydata(struct mbuf *m, int off, int len, void *vp) { unsigned count; + char *cp = vp; if (off < 0 || len < 0) panic("m_copydata"); @@ -1062,7 +1063,7 @@ m_devget(char *buf, int totlen, int off0, struct ifnet *ifp, * chain if necessary. */ void -m_copyback(struct mbuf *m0, int off, int len, caddr_t cp) +m_copyback(struct mbuf *m0, int off, int len, const void *cp) { #if defined(DEBUG) struct mbuf *origm = m0; @@ -1085,7 +1086,7 @@ m_copyback(struct mbuf *m0, int off, int len, caddr_t cp) } struct mbuf * -m_copyback_cow(struct mbuf *m0, int off, int len, caddr_t cp, int how) +m_copyback_cow(struct mbuf *m0, int off, int len, const void *cp, int how) { int error; @@ -1141,12 +1142,14 @@ m_makewritable(struct mbuf **mp, int off, int len, int how) } int -m_copyback0(struct mbuf **mp0, int off, int len, caddr_t cp, int flags, int how) +m_copyback0(struct mbuf **mp0, int off, int len, const void *vp, int flags, + int how) { int mlen; struct mbuf *m, *n; struct mbuf **mp; int totlen = 0; + const char *cp = vp; KASSERT(mp0 != NULL); KASSERT(*mp0 != NULL); diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h index bac06897e3d2..90ce6d877003 100644 --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -1,4 +1,4 @@ -/* $NetBSD: mbuf.h,v 1.97 2004/09/08 11:59:01 yamt Exp $ */ +/* $NetBSD: mbuf.h,v 1.98 2004/09/08 12:00:28 yamt Exp $ */ /*- * Copyright (c) 1996, 1997, 1999, 2001 The NetBSD Foundation, Inc. @@ -815,10 +815,10 @@ void m_claimm(struct mbuf *, struct mowner *); #endif void m_clget(struct mbuf *, int); int m_mballoc(int, int); -void m_copyback(struct mbuf *, int, int, caddr_t); -struct mbuf *m_copyback_cow(struct mbuf *, int, int, caddr_t, 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, caddr_t); +void m_copydata(struct mbuf *, int, int, void *); void m_freem(struct mbuf *); void m_reclaim(void *, int); void mbinit(void);