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 361193 2020-05-18 09:23:18Z 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)
39361193Shselasky#define	lockdep_set_subclass(lock, sub)
40328653Shselasky#define	lockdep_set_class_and_name(lock, key, name)
41330849Shselasky#define	lockdep_set_current_reclaim_state(g) do { } while (0)
42330849Shselasky#define	lockdep_clear_current_reclaim_state() do { } while (0)
43270710Shselasky
44361191Shselasky#ifdef INVARIANTS
45361191Shselasky#define	lockdep_assert_held(m) do {					\
46361191Shselasky	struct lock_object *__lock = (struct lock_object *)(m);		\
47361191Shselasky	LOCK_CLASS(__lock)->lc_assert(__lock, LA_LOCKED);		\
48361191Shselasky} while (0)
49328653Shselasky
50361191Shselasky#define	lockdep_assert_held_once(m) do {				\
51361191Shselasky	struct lock_object *__lock = (struct lock_object *)(m);		\
52361191Shselasky	LOCK_CLASS(__lock)->lc_assert(__lock, LA_LOCKED | LA_NOTRECURSED); \
53361191Shselasky} while (0)
54328653Shselasky
55361191Shselaskystatic __inline bool
56361191Shselaskylockdep_is_held(void *__m)
57361191Shselasky{
58361191Shselasky	struct lock_object *__lock;
59361191Shselasky	struct thread *__td;
60328653Shselasky
61361191Shselasky	__lock = __m;
62361191Shselasky	return (LOCK_CLASS(__lock)->lc_owner(__lock, &__td) != 0);
63361191Shselasky}
64361193Shselasky#define	lockdep_is_held_type(_m, _t) lockdep_is_held(_m)
65361191Shselasky
66361191Shselasky#else
67361191Shselasky#define	lockdep_assert_held(m) do { } while (0)
68361191Shselasky
69361191Shselasky#define	lockdep_assert_held_once(m) do { } while (0)
70361191Shselasky
71361191Shselasky#define	lockdep_is_held(m)	1
72361193Shselasky#define	lockdep_is_held_type(_m, _t)	1
73361191Shselasky#endif
74361191Shselasky
75328653Shselasky#define	might_lock(m)	do { } while (0)
76329964Shselasky#define	might_lock_read(m) do { } while (0)
77328653Shselasky
78329964Shselasky#define	lock_acquire(...) do { } while (0)
79329964Shselasky#define	lock_release(...) do { } while (0)
80329964Shselasky#define	lock_acquire_shared_recursive(...) do { } while (0)
81329964Shselasky
82361193Shselasky#define	mutex_acquire(...) do { } while (0)
83361193Shselasky#define	mutex_release(...) do { } while (0)
84361193Shselasky
85328653Shselasky#endif /* _LINUX_LOCKDEP_H_ */
86