lockdep.h revision 361191
1219820Sjeff/*-
2219820Sjeff * Copyright (c) 2010 Isilon Systems, Inc.
3219820Sjeff * Copyright (c) 2010 iX Systems, Inc.
4219820Sjeff * Copyright (c) 2010 Panasas, Inc.
5270710Shselasky * Copyright (c) 2013, 2014 Mellanox Technologies, Ltd.
6219820Sjeff * All rights reserved.
7219820Sjeff *
8219820Sjeff * Redistribution and use in source and binary forms, with or without
9219820Sjeff * modification, are permitted provided that the following conditions
10219820Sjeff * are met:
11219820Sjeff * 1. Redistributions of source code must retain the above copyright
12219820Sjeff *    notice unmodified, this list of conditions, and the following
13219820Sjeff *    disclaimer.
14219820Sjeff * 2. Redistributions in binary form must reproduce the above copyright
15219820Sjeff *    notice, this list of conditions and the following disclaimer in the
16219820Sjeff *    documentation and/or other materials provided with the distribution.
17219820Sjeff *
18219820Sjeff * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19219820Sjeff * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20219820Sjeff * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21219820Sjeff * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22219820Sjeff * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23219820Sjeff * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24219820Sjeff * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25219820Sjeff * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26219820Sjeff * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27219820Sjeff * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28289644Shselasky *
29289644Shselasky * $FreeBSD: stable/11/sys/compat/linuxkpi/common/include/linux/lockdep.h 361191 2020-05-18 09:22:17Z hselasky $
30219820Sjeff */
31328653Shselasky
32328653Shselasky#ifndef _LINUX_LOCKDEP_H_
33219820Sjeff#define	_LINUX_LOCKDEP_H_
34219820Sjeff
35219820Sjeffstruct lock_class_key {
36219820Sjeff};
37219820Sjeff
38328653Shselasky#define	lockdep_set_class(lock, key)
39328653Shselasky#define	lockdep_set_class_and_name(lock, key, name)
40330849Shselasky#define	lockdep_set_current_reclaim_state(g) do { } while (0)
41330849Shselasky#define	lockdep_clear_current_reclaim_state() do { } while (0)
42270710Shselasky
43361191Shselasky#ifdef INVARIANTS
44361191Shselasky#define	lockdep_assert_held(m) do {					\
45361191Shselasky	struct lock_object *__lock = (struct lock_object *)(m);		\
46361191Shselasky	LOCK_CLASS(__lock)->lc_assert(__lock, LA_LOCKED);		\
47361191Shselasky} while (0)
48328653Shselasky
49361191Shselasky#define	lockdep_assert_held_once(m) do {				\
50361191Shselasky	struct lock_object *__lock = (struct lock_object *)(m);		\
51361191Shselasky	LOCK_CLASS(__lock)->lc_assert(__lock, LA_LOCKED | LA_NOTRECURSED); \
52361191Shselasky} while (0)
53328653Shselasky
54361191Shselaskystatic __inline bool
55361191Shselaskylockdep_is_held(void *__m)
56361191Shselasky{
57361191Shselasky	struct lock_object *__lock;
58361191Shselasky	struct thread *__td;
59328653Shselasky
60361191Shselasky	__lock = __m;
61361191Shselasky	return (LOCK_CLASS(__lock)->lc_owner(__lock, &__td) != 0);
62361191Shselasky}
63361191Shselasky
64361191Shselasky#else
65361191Shselasky#define	lockdep_assert_held(m) do { } while (0)
66361191Shselasky
67361191Shselasky#define	lockdep_assert_held_once(m) do { } while (0)
68361191Shselasky
69361191Shselasky#define	lockdep_is_held(m)	1
70361191Shselasky#endif
71361191Shselasky
72328653Shselasky#define	might_lock(m)	do { } while (0)
73329964Shselasky#define	might_lock_read(m) do { } while (0)
74328653Shselasky
75329964Shselasky#define	lock_acquire(...) do { } while (0)
76329964Shselasky#define	lock_release(...) do { } while (0)
77329964Shselasky#define	lock_acquire_shared_recursive(...) do { } while (0)
78329964Shselasky
79328653Shselasky#endif /* _LINUX_LOCKDEP_H_ */
80