Skip to content

Commit 2b4a0dd

Browse files
robnbehlendorf
authored andcommitted
libspl: move callb stubs from zfs_context.h
Sponsored-by: https://despairlabs.com/sponsor/ Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Rob Norris <[email protected]> Closes #17861
1 parent 9d60909 commit 2b4a0dd

File tree

2 files changed

+28
-24
lines changed

2 files changed

+28
-24
lines changed

include/sys/zfs_context.h

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ extern "C" {
7979

8080
#define _SYS_VFS_H
8181
#define _SYS_SUNDDI_H
82-
#define _SYS_CALLB_H
8382

8483
#include <stdio.h>
8584
#include <stdlib.h>
@@ -131,6 +130,7 @@ extern "C" {
131130
#include <sys/systm.h>
132131
#include <sys/misc.h>
133132
#include <sys/random.h>
133+
#include <sys/callb.h>
134134

135135
#include <sys/zfs_context_os.h>
136136

@@ -211,27 +211,6 @@ typedef off_t loff_t;
211211
extern int highbit64(uint64_t i);
212212
extern int lowbit64(uint64_t i);
213213

214-
typedef struct callb_cpr {
215-
kmutex_t *cc_lockp;
216-
} callb_cpr_t;
217-
218-
#define CALLB_CPR_INIT(cp, lockp, func, name) { \
219-
(cp)->cc_lockp = lockp; \
220-
}
221-
222-
#define CALLB_CPR_SAFE_BEGIN(cp) { \
223-
ASSERT(MUTEX_HELD((cp)->cc_lockp)); \
224-
}
225-
226-
#define CALLB_CPR_SAFE_END(cp, lockp) { \
227-
ASSERT(MUTEX_HELD((cp)->cc_lockp)); \
228-
}
229-
230-
#define CALLB_CPR_EXIT(cp) { \
231-
ASSERT(MUTEX_HELD((cp)->cc_lockp)); \
232-
mutex_exit((cp)->cc_lockp); \
233-
}
234-
235214
#define zone_dataset_visible(x, y) (1)
236215
#define INGLOBALZONE(z) (1)
237216
extern uint32_t zone_get_hostid(void *zonep);

lib/libspl/include/sys/callb.h

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,36 @@
2121
* CDDL HEADER END
2222
*/
2323
/*
24-
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
25-
* Use is subject to license terms.
24+
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
25+
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
26+
* Copyright (c) 2012, 2018 by Delphix. All rights reserved.
27+
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
2628
*/
2729

2830
#ifndef _SYS_CALLB_H
2931
#define _SYS_CALLB_H
3032

33+
#include <sys/mutex.h>
34+
35+
typedef struct callb_cpr {
36+
kmutex_t *cc_lockp;
37+
} callb_cpr_t;
38+
39+
#define CALLB_CPR_INIT(cp, lockp, func, name) { \
40+
(cp)->cc_lockp = lockp; \
41+
}
42+
43+
#define CALLB_CPR_SAFE_BEGIN(cp) { \
44+
ASSERT(MUTEX_HELD((cp)->cc_lockp)); \
45+
}
46+
47+
#define CALLB_CPR_SAFE_END(cp, lockp) { \
48+
ASSERT(MUTEX_HELD((cp)->cc_lockp)); \
49+
}
50+
51+
#define CALLB_CPR_EXIT(cp) { \
52+
ASSERT(MUTEX_HELD((cp)->cc_lockp)); \
53+
mutex_exit((cp)->cc_lockp); \
54+
}
55+
3156
#endif

0 commit comments

Comments
 (0)