Deleted Added
sdiff udiff text old ( 216615 ) new ( 217248 )
full compact
1/*-
2 * Copyright (c) 2010 Lawrence Stewart <lstewart@freebsd.org>
3 * Copyright (c) 2010 The FreeBSD Foundation
4 * All rights reserved.
5 *
6 * This software was developed by Lawrence Stewart while studying at the Centre
7 * for Advanced Internet Architectures, Swinburne University, made possible in
8 * part by grants from the FreeBSD Foundation and Cisco University Research

--- 21 unchanged lines hidden (view full) ---

30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 */
36
37#include <sys/cdefs.h>
38__FBSDID("$FreeBSD: head/sys/kern/kern_hhook.c 216615 2010-12-21 13:45:29Z lstewart $");
39
40#include <sys/param.h>
41#include <sys/kernel.h>
42#include <sys/hhook.h>
43#include <sys/khelp.h>
44#include <sys/malloc.h>
45#include <sys/module.h>
46#include <sys/module_khelp.h>

--- 104 unchanged lines hidden (view full) ---

151 error = EEXIST;
152 break;
153 }
154 }
155
156 if (!error) {
157 STAILQ_INSERT_TAIL(&hhh->hhh_hooks, hhk, hhk_next);
158 hhh->hhh_nhooks++;
159 }
160 else
161 free(hhk, M_HHOOK);
162
163 HHH_WUNLOCK(hhh);
164
165 return (error);
166}
167
168/*

--- 158 unchanged lines hidden (view full) ---

327 * Remove a helper hook point via a hhook_head lookup.
328 */
329int
330hhook_head_deregister_lookup(int32_t hhook_type, int32_t hhook_id)
331{
332 struct hhook_head *hhh;
333 int error;
334
335 error = 0;
336 hhh = hhook_head_get(hhook_type, hhook_id);
337 error = hhook_head_deregister(hhh);
338
339 if (error == EBUSY)
340 hhook_head_release(hhh);
341
342 return (error);
343}

--- 7 unchanged lines hidden (view full) ---

351{
352 struct hhook_head *hhh;
353
354 /* XXXLAS: Pick hhook_head_list based on hhook_head flags. */
355 HHHLIST_LOCK();
356 LIST_FOREACH(hhh, &V_hhook_head_list, hhh_next) {
357 if (hhh->hhh_type == hhook_type && hhh->hhh_id == hhook_id) {
358 refcount_acquire(&hhh->hhh_refcount);
359 HHHLIST_UNLOCK();
360 return (hhh);
361 }
362 }
363 HHHLIST_UNLOCK();
364
365 return (NULL);
366}
367
368void
369hhook_head_release(struct hhook_head *hhh)
370{
371
372 refcount_release(&hhh->hhh_refcount);
373}

--- 84 unchanged lines hidden ---