diff options
author | alc <alc@FreeBSD.org> | 2003-03-16 07:19:12 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2003-03-16 07:19:12 +0000 |
commit | 4641d3d127dcdaae61daa54f6eee3d51be117e44 (patch) | |
tree | b0b84c7d63f3af90789b77ca4c9413356ecd7a01 | |
parent | c1838df6038e28d81384d7cf1c41a66c07de573c (diff) | |
download | FreeBSD-src-4641d3d127dcdaae61daa54f6eee3d51be117e44.zip FreeBSD-src-4641d3d127dcdaae61daa54f6eee3d51be117e44.tar.gz |
Pass the sf buf to MEXTADD() as the optional argument. This permits
the simplification of socow_iodone() and sf_buf_free(); they don't
have to reverse engineer the sf buf from the data's address.
-rw-r--r-- | sys/kern/uipc_cow.c | 9 | ||||
-rw-r--r-- | sys/kern/uipc_syscalls.c | 8 |
2 files changed, 6 insertions, 11 deletions
diff --git a/sys/kern/uipc_cow.c b/sys/kern/uipc_cow.c index dfe2c86..2258aca 100644 --- a/sys/kern/uipc_cow.c +++ b/sys/kern/uipc_cow.c @@ -77,9 +77,6 @@ struct netsend_cow_stats { static struct netsend_cow_stats socow_stats = {0,0,0,0,0,0,0,0,0,0,0}; -extern struct sf_buf *sf_bufs; -extern vm_offset_t sf_base; -#define dtosf(x) (&sf_bufs[((uintptr_t)(x) - (uintptr_t)sf_base) >> PAGE_SHIFT]) static void socow_iodone(void *addr, void *args); static void @@ -89,7 +86,7 @@ socow_iodone(void *addr, void *args) struct sf_buf *sf; vm_page_t pp; - sf = dtosf(addr); + sf = args; pp = sf->m; s = splvm(); /* remove COW mapping */ @@ -98,7 +95,7 @@ socow_iodone(void *addr, void *args) vm_page_unlock_queues(); splx(s); /* note that sf_buf_free() unwires the page for us*/ - sf_buf_free(addr, NULL); + sf_buf_free(addr, args); socow_stats.iodone++; } @@ -153,7 +150,7 @@ socow_setup(struct mbuf *m0, struct uio *uio) */ m0->m_data = (caddr_t)sf->kva; m0->m_len = PAGE_SIZE; - MEXTADD(m0, sf->kva, PAGE_SIZE, socow_iodone, NULL, 0, EXT_SFBUF); + MEXTADD(m0, sf->kva, PAGE_SIZE, socow_iodone, sf, 0, EXT_SFBUF); socow_stats.success++; iov = uio->uio_iov; diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index 285eaca..6773452 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -1661,8 +1661,6 @@ sf_buf_alloc() return (sf); } -#define dtosf(x) (&sf_bufs[((uintptr_t)(x) - (uintptr_t)sf_base) >> PAGE_SHIFT]) - /* * Detatch mapped page and release resources back to the system. */ @@ -1672,7 +1670,7 @@ sf_buf_free(void *addr, void *args) struct sf_buf *sf; struct vm_page *m; - sf = dtosf(addr); + sf = args; pmap_qremove((vm_offset_t)addr, 1); m = sf->m; vm_page_lock_queues(); @@ -1955,14 +1953,14 @@ retry_lookup: MGETHDR(m, M_TRYWAIT, MT_DATA); if (m == NULL) { error = ENOBUFS; - sf_buf_free((void *)sf->kva, NULL); + sf_buf_free((void *)sf->kva, sf); sbunlock(&so->so_snd); goto done; } /* * Setup external storage for mbuf. */ - MEXTADD(m, sf->kva, PAGE_SIZE, sf_buf_free, NULL, M_RDONLY, + MEXTADD(m, sf->kva, PAGE_SIZE, sf_buf_free, sf, M_RDONLY, EXT_SFBUF); m->m_data = (char *) sf->kva + pgoff; m->m_pkthdr.len = m->m_len = xfsize; |