summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandre <andre@FreeBSD.org>2013-08-24 16:57:44 +0000
committerandre <andre@FreeBSD.org>2013-08-24 16:57:44 +0000
commitb148bf45e00854fc92a79e2434843fc0ced325ba (patch)
treed9cb73f9fc061a57daf8eba0e946e359dfddf04c
parentb7d376ce03e400fd642a642d69997ab017a9466e (diff)
downloadFreeBSD-src-b148bf45e00854fc92a79e2434843fc0ced325ba.zip
FreeBSD-src-b148bf45e00854fc92a79e2434843fc0ced325ba.tar.gz
Add an mbuf pointer parameter to (*ext_free) to give the external
free function access to the mbuf the external memory was attached to. Mechanically adjust all users to include the mbuf parameter. This fixes a long standing annoyance for external free functions. Before one had to sacrifice one of the argument pointers for this. Sponsored by: The FreeBSD Foundation
-rw-r--r--sys/dev/cas/if_cas.c4
-rw-r--r--sys/dev/hatm/if_hatm_intr.c8
-rw-r--r--sys/dev/iscsi_initiator/isc_soc.c2
-rw-r--r--sys/dev/lge/if_lge.c6
-rw-r--r--sys/dev/mwl/if_mwl.c2
-rw-r--r--sys/kern/subr_mbpool.c2
-rw-r--r--sys/kern/uipc_mbuf.c6
-rw-r--r--sys/kern/uipc_syscalls.c6
-rw-r--r--sys/sys/mbpool.h2
-rw-r--r--sys/sys/mbuf.h5
-rw-r--r--sys/sys/sf_buf.h3
11 files changed, 23 insertions, 23 deletions
diff --git a/sys/dev/cas/if_cas.c b/sys/dev/cas/if_cas.c
index eec8fa4..f9f28ca 100644
--- a/sys/dev/cas/if_cas.c
+++ b/sys/dev/cas/if_cas.c
@@ -132,7 +132,7 @@ static void cas_detach(struct cas_softc *sc);
static int cas_disable_rx(struct cas_softc *sc);
static int cas_disable_tx(struct cas_softc *sc);
static void cas_eint(struct cas_softc *sc, u_int status);
-static void cas_free(void *arg1, void* arg2);
+static void cas_free(struct mbuf *m, void *arg1, void* arg2);
static void cas_init(void *xsc);
static void cas_init_locked(struct cas_softc *sc);
static void cas_init_regs(struct cas_softc *sc);
@@ -1888,7 +1888,7 @@ cas_rint(struct cas_softc *sc)
}
static void
-cas_free(void *arg1, void *arg2)
+cas_free(struct mbuf *m, void *arg1, void *arg2)
{
struct cas_rxdsoft *rxds;
struct cas_softc *sc;
diff --git a/sys/dev/hatm/if_hatm_intr.c b/sys/dev/hatm/if_hatm_intr.c
index b6a5368..d23f119 100644
--- a/sys/dev/hatm/if_hatm_intr.c
+++ b/sys/dev/hatm/if_hatm_intr.c
@@ -261,7 +261,7 @@ hatm_mbuf_page_alloc(struct hatm_softc *sc, u_int group)
* Free an mbuf and put it onto the free list.
*/
static void
-hatm_mbuf0_free(void *buf, void *args)
+hatm_mbuf0_free(struct mbuf *m, void *buf, void *args)
{
struct hatm_softc *sc = args;
struct mbuf0_chunk *c = buf;
@@ -272,7 +272,7 @@ hatm_mbuf0_free(void *buf, void *args)
hatm_ext_free(&sc->mbuf_list[0], (struct mbufx_free *)c);
}
static void
-hatm_mbuf1_free(void *buf, void *args)
+hatm_mbuf1_free(struct mbuf *m, void *buf, void *args)
{
struct hatm_softc *sc = args;
struct mbuf1_chunk *c = buf;
@@ -461,7 +461,7 @@ hatm_rx_buffer(struct hatm_softc *sc, u_int group, u_int handle)
hatm_mbuf0_free, c0, sc, M_PKTHDR, EXT_EXTREF);
m->m_data += MBUF0_OFFSET;
} else
- hatm_mbuf0_free(c0, sc);
+ hatm_mbuf0_free(NULL, c0, sc);
} else {
struct mbuf1_chunk *c1;
@@ -485,7 +485,7 @@ hatm_rx_buffer(struct hatm_softc *sc, u_int group, u_int handle)
hatm_mbuf1_free, c1, sc, M_PKTHDR, EXT_EXTREF);
m->m_data += MBUF1_OFFSET;
} else
- hatm_mbuf1_free(c1, sc);
+ hatm_mbuf1_free(NULL, c1, sc);
}
return (m);
diff --git a/sys/dev/iscsi_initiator/isc_soc.c b/sys/dev/iscsi_initiator/isc_soc.c
index 94650fd..6507236 100644
--- a/sys/dev/iscsi_initiator/isc_soc.c
+++ b/sys/dev/iscsi_initiator/isc_soc.c
@@ -69,7 +69,7 @@ static int ou_refcnt = 0;
| function for freeing external storage for mbuf
*/
static void
-ext_free(void *a, void *b)
+ext_free(struct mbuf *m, void *a, void *b)
{
pduq_t *pq = b;
diff --git a/sys/dev/lge/if_lge.c b/sys/dev/lge/if_lge.c
index d994867..e57bbfb 100644
--- a/sys/dev/lge/if_lge.c
+++ b/sys/dev/lge/if_lge.c
@@ -122,7 +122,7 @@ static int lge_detach(device_t);
static int lge_alloc_jumbo_mem(struct lge_softc *);
static void lge_free_jumbo_mem(struct lge_softc *);
static void *lge_jalloc(struct lge_softc *);
-static void lge_jfree(void *, void *);
+static void lge_jfree(struct mbuf *, void *, void *);
static int lge_newbuf(struct lge_softc *, struct lge_rx_desc *, struct mbuf *);
static int lge_encap(struct lge_softc *, struct mbuf *, u_int32_t *);
@@ -847,9 +847,7 @@ lge_jalloc(sc)
* Release a jumbo buffer.
*/
static void
-lge_jfree(buf, args)
- void *buf;
- void *args;
+lge_jfree(struct mbuf *m, void *buf, void *args)
{
struct lge_softc *sc;
int i;
diff --git a/sys/dev/mwl/if_mwl.c b/sys/dev/mwl/if_mwl.c
index 1d2b6e3..ecc74a5 100644
--- a/sys/dev/mwl/if_mwl.c
+++ b/sys/dev/mwl/if_mwl.c
@@ -2622,7 +2622,7 @@ mwl_rxbuf_init(struct mwl_softc *sc, struct mwl_rxbuf *bf)
}
static void
-mwl_ext_free(void *data, void *arg)
+mwl_ext_free(struct mbuf *m, void *data, void *arg)
{
struct mwl_softc *sc = arg;
diff --git a/sys/kern/subr_mbpool.c b/sys/kern/subr_mbpool.c
index ab80a5e..b1ef11d 100644
--- a/sys/kern/subr_mbpool.c
+++ b/sys/kern/subr_mbpool.c
@@ -283,7 +283,7 @@ mbp_free(struct mbpool *p, void *ptr)
* Mbuf system external mbuf free routine
*/
void
-mbp_ext_free(void *buf, void *arg)
+mbp_ext_free(struct mbuf *m, void *buf, void *arg)
{
mbp_free(arg, buf);
}
diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c
index f02e8ce..4b356b7 100644
--- a/sys/kern/uipc_mbuf.c
+++ b/sys/kern/uipc_mbuf.c
@@ -247,8 +247,8 @@ m_freem(struct mbuf *mb)
*/
int
m_extadd(struct mbuf *mb, caddr_t buf, u_int size,
- void (*freef)(void *, void *), void *arg1, void *arg2, int flags, int type,
- int wait)
+ void (*freef)(struct mbuf *, void *, void *), void *arg1, void *arg2,
+ int flags, int type, int wait)
{
KASSERT(type != EXT_CLUSTER, ("%s: EXT_CLUSTER not allowed", __func__));
@@ -321,7 +321,7 @@ mb_free_ext(struct mbuf *m)
case EXT_EXTREF:
KASSERT(m->m_ext.ext_free != NULL,
("%s: ext_free not set", __func__));
- (*(m->m_ext.ext_free))(m->m_ext.ext_arg1,
+ (*(m->m_ext.ext_free))(m, m->m_ext.ext_arg1,
m->m_ext.ext_arg2);
break;
default:
diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c
index 4576440..7c19bc6 100644
--- a/sys/kern/uipc_syscalls.c
+++ b/sys/kern/uipc_syscalls.c
@@ -1855,7 +1855,7 @@ struct sendfile_sync {
* Detach mapped page and release resources back to the system.
*/
void
-sf_buf_mext(void *addr, void *args)
+sf_buf_mext(struct mbuf *mb, void *addr, void *args)
{
vm_page_t m;
struct sendfile_sync *sfs;
@@ -2315,14 +2315,14 @@ retry_space:
m0 = m_get((mnw ? M_NOWAIT : M_WAITOK), MT_DATA);
if (m0 == NULL) {
error = (mnw ? EAGAIN : ENOBUFS);
- sf_buf_mext(NULL, sf);
+ sf_buf_mext(NULL, NULL, sf);
break;
}
if (m_extadd(m0, (caddr_t )sf_buf_kva(sf), PAGE_SIZE,
sf_buf_mext, sfs, sf, M_RDONLY, EXT_SFBUF,
(mnw ? M_NOWAIT : M_WAITOK)) != 0) {
error = (mnw ? EAGAIN : ENOBUFS);
- sf_buf_mext(NULL, sf);
+ sf_buf_mext(NULL, NULL, sf);
m_freem(m0);
break;
}
diff --git a/sys/sys/mbpool.h b/sys/sys/mbpool.h
index f292f29..48fd89e 100644
--- a/sys/sys/mbpool.h
+++ b/sys/sys/mbpool.h
@@ -69,7 +69,7 @@ void *mbp_alloc(struct mbpool *, bus_addr_t *, uint32_t *);
void mbp_free(struct mbpool *, void *);
/* free a chunk that is an external mbuf */
-void mbp_ext_free(void *, void *);
+void mbp_ext_free(struct mbuf *, void *, void *);
/* free all buffers that are marked to be on the card */
void mbp_card_free(struct mbpool *);
diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h
index cafbbdf..c250c87 100644
--- a/sys/sys/mbuf.h
+++ b/sys/sys/mbuf.h
@@ -148,7 +148,7 @@ struct m_ext {
uint32_t ext_type:8, /* type of external storage */
ext_flags:24; /* external storage mbuf flags */
void (*ext_free) /* free routine if not the usual */
- (void *, void *);
+ (struct mbuf *, void *, void *);
void *ext_arg1; /* optional argument pointer */
void *ext_arg2; /* optional argument pointer */
};
@@ -822,7 +822,8 @@ int m_apply(struct mbuf *, int, int,
int m_append(struct mbuf *, int, c_caddr_t);
void m_cat(struct mbuf *, struct mbuf *);
int m_extadd(struct mbuf *, caddr_t, u_int,
- void (*)(void *, void *), void *, void *, int, int, int);
+ void (*)(struct mbuf *, void *, void *), void *, void *,
+ int, int, int);
struct mbuf *m_collapse(struct mbuf *, int, int);
void m_copyback(struct mbuf *, int, int, c_caddr_t);
void m_copydata(const struct mbuf *, int, int, caddr_t);
diff --git a/sys/sys/sf_buf.h b/sys/sys/sf_buf.h
index 1b62fd3..32aa304 100644
--- a/sys/sys/sf_buf.h
+++ b/sys/sys/sf_buf.h
@@ -55,6 +55,7 @@ struct sfstat { /* sendfile statistics */
#ifdef _KERNEL
#include <machine/sf_buf.h>
#include <sys/counter.h>
+struct mbuf; /* for sf_buf_mext() */
extern counter_u64_t sfstat[sizeof(struct sfstat) / sizeof(uint64_t)];
#define SFSTAT_ADD(name, val) \
@@ -66,6 +67,6 @@ extern counter_u64_t sfstat[sizeof(struct sfstat) / sizeof(uint64_t)];
struct sf_buf *
sf_buf_alloc(struct vm_page *m, int flags);
void sf_buf_free(struct sf_buf *sf);
-void sf_buf_mext(void *addr, void *args);
+void sf_buf_mext(struct mbuf *mb, void *addr, void *args);
#endif /* !_SYS_SF_BUF_H_ */
OpenPOWER on IntegriCloud