Skip to content

Commit 4e3b889

Browse files
robnbehlendorf
authored andcommitted
libzpool: separate driver-side include
Sponsored-by: https://despairlabs.com/sponsor/ Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Rob Norris <[email protected]> Closes #17861
1 parent 0c6be03 commit 4e3b889

File tree

9 files changed

+58
-6
lines changed

9 files changed

+58
-6
lines changed

cmd/raidz_test/raidz_test.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include <sys/vdev_raidz_impl.h>
3434
#include <assert.h>
3535
#include <stdio.h>
36+
#include <libzpool.h>
3637
#include "raidz_test.h"
3738

3839
static int *rand_data;

cmd/zdb/zdb.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
#include <sys/zstd/zstd.h>
9090
#include <sys/backtrace.h>
9191

92+
#include <libzpool.h>
9293
#include <libnvpair.h>
9394
#include <libzutil.h>
9495
#include <libzfs_core.h>

cmd/zhack.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
#include <zfeature_common.h>
5656
#include <libzutil.h>
5757
#include <sys/metaslab_impl.h>
58+
#include <libzpool.h>
5859

5960
static importargs_t g_importargs;
6061
static char *g_pool;

cmd/ztest.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@
139139
#include <sys/crypto/icp.h>
140140
#include <sys/zfs_impl.h>
141141
#include <sys/backtrace.h>
142+
#include <libzpool.h>
142143

143144
static int ztest_fd_data = -1;
144145
static int ztest_fd_rand = -1;

include/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ USER_H = \
191191
libzfs.h \
192192
libzfs_core.h \
193193
libzfsbootenv.h \
194+
libzpool.h \
194195
libzutil.h \
195196
thread_pool.h
196197

include/libzpool.h

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// SPDX-License-Identifier: CDDL-1.0
2+
/*
3+
* CDDL HEADER START
4+
*
5+
* The contents of this file are subject to the terms of the
6+
* Common Development and Distribution License (the "License").
7+
* You may not use this file except in compliance with the License.
8+
*
9+
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10+
* or https://opensource.org/licenses/CDDL-1.0.
11+
* See the License for the specific language governing permissions
12+
* and limitations under the License.
13+
*
14+
* When distributing Covered Code, include this CDDL HEADER in each
15+
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16+
* If applicable, add the following below this CDDL HEADER, with the
17+
* fields enclosed by brackets "[]" replaced with your own identifying
18+
* information: Portions Copyright [yyyy] [name of copyright owner]
19+
*
20+
* CDDL HEADER END
21+
*/
22+
/*
23+
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
24+
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
25+
* Copyright (c) 2012, 2018 by Delphix. All rights reserved.
26+
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
27+
*/
28+
29+
#ifndef _LIBZPOOL_H
30+
#define _LIBZPOOL_H extern __attribute__((visibility("default")))
31+
32+
#include <sys/zfs_context.h>
33+
34+
#ifdef __cplusplus
35+
extern "C" {
36+
#endif
37+
38+
_LIBZPOOL_H void kernel_init(int mode);
39+
_LIBZPOOL_H void kernel_fini(void);
40+
41+
struct spa;
42+
_LIBZPOOL_H void show_pool_stats(struct spa *);
43+
_LIBZPOOL_H int handle_tunable_option(const char *, boolean_t);
44+
45+
#ifdef __cplusplus
46+
}
47+
#endif
48+
49+
#endif

include/sys/zfs_context.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -230,15 +230,9 @@ random_in_range(uint32_t range)
230230
return (r % range);
231231
}
232232

233-
extern void kernel_init(int mode);
234-
extern void kernel_fini(void);
235233
extern void random_init(void);
236234
extern void random_fini(void);
237235

238-
struct spa;
239-
extern void show_pool_stats(struct spa *);
240-
extern int handle_tunable_option(const char *, boolean_t);
241-
242236
typedef struct callb_cpr {
243237
kmutex_t *cc_lockp;
244238
} callb_cpr_t;

lib/libzpool/kernel.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@
4545
#include <sys/time.h>
4646
#include <sys/tsd.h>
4747
#include <sys/utsname.h>
48+
49+
#include <libspl.h>
50+
#include <libzpool.h>
4851
#include <sys/zfs_context.h>
4952
#include <sys/zfs_onexit.h>
5053
#include <sys/zfs_vfsops.h>

lib/libzpool/util.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#include <sys/zfs_ioctl.h>
3939
#include <sys/tunables.h>
4040
#include <libzutil.h>
41+
#include <libzpool.h>
4142

4243
/*
4344
* Routines needed by more than one client of libzpool.

0 commit comments

Comments
 (0)