diff --git a/include/libzfs.h b/include/libzfs.h index d9f0d7259..64a0a2035 100644 --- a/include/libzfs.h +++ b/include/libzfs.h @@ -313,7 +313,7 @@ extern nvlist_t *zpool_find_vdev(zpool_handle_t *, const char *, boolean_t *, boolean_t *, boolean_t *); extern nvlist_t *zpool_find_vdev_by_physpath(zpool_handle_t *, const char *, boolean_t *, boolean_t *, boolean_t *); -extern int zpool_label_disk(libzfs_handle_t *, zpool_handle_t *, char *); +extern int zpool_label_disk(libzfs_handle_t *, zpool_handle_t *, const char *); extern uint64_t zpool_vdev_path_to_guid(zpool_handle_t *zhp, const char *path); const char *zpool_get_state_str(zpool_handle_t *); diff --git a/include/os/freebsd/spl/sys/ccompile.h b/include/os/freebsd/spl/sys/ccompile.h index 0bb0e637c..f9b09d430 100644 --- a/include/os/freebsd/spl/sys/ccompile.h +++ b/include/os/freebsd/spl/sys/ccompile.h @@ -294,7 +294,9 @@ typedef long loff_t; typedef long rlim64_t; typedef int bool_t; typedef int enum_t; +#ifndef __cplusplus #define __init +#endif #define __exit #define FALSE 0 #define TRUE 1 diff --git a/include/sys/abd.h b/include/sys/abd.h index be37b4a81..3b490005c 100644 --- a/include/sys/abd.h +++ b/include/sys/abd.h @@ -38,8 +38,8 @@ extern "C" { struct abd; /* forward declaration */ typedef struct abd abd_t; -typedef int abd_iter_func_t(void *buf, size_t len, void *private); -typedef int abd_iter_func2_t(void *bufa, void *bufb, size_t len, void *private); +typedef int abd_iter_func_t(void *buf, size_t len, void *priv); +typedef int abd_iter_func2_t(void *bufa, void *bufb, size_t len, void *priv); extern int zfs_abd_scatter_enabled; extern abd_t *abd_zero_scatter; diff --git a/include/sys/arc.h b/include/sys/arc.h index f500e1d45..f358bc9ae 100644 --- a/include/sys/arc.h +++ b/include/sys/arc.h @@ -70,9 +70,9 @@ typedef struct arc_prune arc_prune_t; * parameter will be NULL. */ typedef void arc_read_done_func_t(zio_t *zio, const zbookmark_phys_t *zb, - const blkptr_t *bp, arc_buf_t *buf, void *private); -typedef void arc_write_done_func_t(zio_t *zio, arc_buf_t *buf, void *private); -typedef void arc_prune_func_t(int64_t bytes, void *private); + const blkptr_t *bp, arc_buf_t *buf, void *priv); +typedef void arc_write_done_func_t(zio_t *zio, arc_buf_t *buf, void *priv); +typedef void arc_prune_func_t(int64_t bytes, void *priv); /* Shared module parameters */ extern int zfs_arc_average_blocksize; @@ -280,16 +280,16 @@ int arc_referenced(arc_buf_t *buf); #endif int arc_read(zio_t *pio, spa_t *spa, const blkptr_t *bp, - arc_read_done_func_t *done, void *private, zio_priority_t priority, + arc_read_done_func_t *done, void *priv, zio_priority_t priority, int flags, arc_flags_t *arc_flags, const zbookmark_phys_t *zb); zio_t *arc_write(zio_t *pio, spa_t *spa, uint64_t txg, blkptr_t *bp, arc_buf_t *buf, boolean_t l2arc, const zio_prop_t *zp, arc_write_done_func_t *ready, arc_write_done_func_t *child_ready, arc_write_done_func_t *physdone, arc_write_done_func_t *done, - void *private, zio_priority_t priority, int zio_flags, + void *priv, zio_priority_t priority, int zio_flags, const zbookmark_phys_t *zb); -arc_prune_t *arc_add_prune_callback(arc_prune_func_t *func, void *private); +arc_prune_t *arc_add_prune_callback(arc_prune_func_t *func, void *priv); void arc_remove_prune_callback(arc_prune_t *p); void arc_freed(spa_t *spa, const blkptr_t *bp); diff --git a/include/sys/ddt.h b/include/sys/ddt.h index 21b76f7ba..0d7c4f927 100644 --- a/include/sys/ddt.h +++ b/include/sys/ddt.h @@ -182,15 +182,15 @@ typedef struct ddt_ops { #define DDT_NAMELEN 80 extern void ddt_object_name(ddt_t *ddt, enum ddt_type type, - enum ddt_class class, char *name); + enum ddt_class clazz, char *name); extern int ddt_object_walk(ddt_t *ddt, enum ddt_type type, - enum ddt_class class, uint64_t *walk, ddt_entry_t *dde); + enum ddt_class clazz, uint64_t *walk, ddt_entry_t *dde); extern int ddt_object_count(ddt_t *ddt, enum ddt_type type, - enum ddt_class class, uint64_t *count); + enum ddt_class clazz, uint64_t *count); extern int ddt_object_info(ddt_t *ddt, enum ddt_type type, - enum ddt_class class, dmu_object_info_t *); + enum ddt_class clazz, dmu_object_info_t *); extern boolean_t ddt_object_exists(ddt_t *ddt, enum ddt_type type, - enum ddt_class class); + enum ddt_class clazz); extern void ddt_bp_fill(const ddt_phys_t *ddp, blkptr_t *bp, uint64_t txg); @@ -246,7 +246,7 @@ extern void ddt_unload(spa_t *spa); extern void ddt_sync(spa_t *spa, uint64_t txg); extern int ddt_walk(spa_t *spa, ddt_bookmark_t *ddb, ddt_entry_t *dde); extern int ddt_object_update(ddt_t *ddt, enum ddt_type type, - enum ddt_class class, ddt_entry_t *dde, dmu_tx_t *tx); + enum ddt_class clazz, ddt_entry_t *dde, dmu_tx_t *tx); extern const ddt_ops_t ddt_zap_ops; diff --git a/include/sys/dsl_dataset.h b/include/sys/dsl_dataset.h index 9db39d5f8..9de9a88d8 100644 --- a/include/sys/dsl_dataset.h +++ b/include/sys/dsl_dataset.h @@ -273,7 +273,7 @@ typedef struct dsl_dataset { static inline dsl_dataset_phys_t * dsl_dataset_phys(dsl_dataset_t *ds) { - return (ds->ds_dbuf->db_data); + return ((dsl_dataset_phys_t *)ds->ds_dbuf->db_data); } typedef struct dsl_dataset_promote_arg { @@ -417,10 +417,10 @@ void dsl_dataset_space(dsl_dataset_t *ds, uint64_t *refdbytesp, uint64_t *availbytesp, uint64_t *usedobjsp, uint64_t *availobjsp); uint64_t dsl_dataset_fsid_guid(dsl_dataset_t *ds); -int dsl_dataset_space_written(dsl_dataset_t *oldsnap, dsl_dataset_t *new, +int dsl_dataset_space_written(dsl_dataset_t *oldsnap, dsl_dataset_t *newds, uint64_t *usedp, uint64_t *compp, uint64_t *uncompp); int dsl_dataset_space_written_bookmark(struct zfs_bookmark_phys *bmp, - dsl_dataset_t *new, uint64_t *usedp, uint64_t *compp, uint64_t *uncompp); + dsl_dataset_t *newds, uint64_t *usedp, uint64_t *compp, uint64_t *uncompp); int dsl_dataset_space_wouldfree(dsl_dataset_t *firstsnap, dsl_dataset_t *last, uint64_t *usedp, uint64_t *compp, uint64_t *uncompp); diff --git a/include/sys/range_tree.h b/include/sys/range_tree.h index b0a9a1dad..fef3d4d7b 100644 --- a/include/sys/range_tree.h +++ b/include/sys/range_tree.h @@ -160,11 +160,11 @@ rs_get_fill_raw(const range_seg_t *rs, const range_tree_t *rt) ASSERT3U(rt->rt_type, <=, RANGE_SEG_NUM_TYPES); switch (rt->rt_type) { case RANGE_SEG32: { - const range_seg32_t *r32 = rs; + const range_seg32_t *r32 = (const range_seg32_t *)rs; return (r32->rs_end - r32->rs_start); } case RANGE_SEG64: { - const range_seg64_t *r64 = rs; + const range_seg64_t *r64 = (const range_seg64_t *)rs; return (r64->rs_end - r64->rs_start); } case RANGE_SEG_GAP: diff --git a/include/sys/spa.h b/include/sys/spa.h index 6e844f5ee..a03319e2b 100644 --- a/include/sys/spa.h +++ b/include/sys/spa.h @@ -891,7 +891,7 @@ typedef struct spa_history_kstat { uint64_t count; uint64_t size; kstat_t *kstat; - void *private; + void *priv; list_t list; } spa_history_kstat_t; @@ -1131,10 +1131,10 @@ extern const char *spa_state_to_name(spa_t *spa); /* error handling */ struct zbookmark_phys; extern void spa_log_error(spa_t *spa, const zbookmark_phys_t *zb); -extern int zfs_ereport_post(const char *class, spa_t *spa, vdev_t *vd, +extern int zfs_ereport_post(const char *clazz, spa_t *spa, vdev_t *vd, const zbookmark_phys_t *zb, zio_t *zio, uint64_t stateoroffset, uint64_t length); -extern boolean_t zfs_ereport_is_valid(const char *class, spa_t *spa, vdev_t *vd, +extern boolean_t zfs_ereport_is_valid(const char *clazz, spa_t *spa, vdev_t *vd, zio_t *zio); extern nvlist_t *zfs_event_create(spa_t *spa, vdev_t *vd, const char *type, const char *name, nvlist_t *aux); diff --git a/include/sys/vdev.h b/include/sys/vdev.h index c4ef479b5..d93ef78f1 100644 --- a/include/sys/vdev.h +++ b/include/sys/vdev.h @@ -178,7 +178,7 @@ extern nvlist_t *vdev_label_read_config(vdev_t *vd, uint64_t txg); extern void vdev_uberblock_load(vdev_t *, struct uberblock *, nvlist_t **); extern void vdev_config_generate_stats(vdev_t *vd, nvlist_t *nv); extern void vdev_label_write(zio_t *zio, vdev_t *vd, int l, abd_t *buf, uint64_t - offset, uint64_t size, zio_done_func_t *done, void *private, int flags); + offset, uint64_t size, zio_done_func_t *done, void *priv, int flags); extern int vdev_label_read_bootenv(vdev_t *, nvlist_t *); extern int vdev_label_write_bootenv(vdev_t *, char *); diff --git a/include/sys/zfs_context.h b/include/sys/zfs_context.h index 00642175d..72fcd74ca 100644 --- a/include/sys/zfs_context.h +++ b/include/sys/zfs_context.h @@ -28,6 +28,10 @@ #ifndef _SYS_ZFS_CONTEXT_H #define _SYS_ZFS_CONTEXT_H +#ifdef __cplusplus +extern "C" { +#endif + #ifdef __KERNEL__ #include #include @@ -355,9 +359,6 @@ extern void kstat_set_raw_ops(kstat_t *ksp, * procfs list manipulation */ -struct seq_file { }; -void seq_printf(struct seq_file *m, const char *fmt, ...); - typedef struct procfs_list { void *pl_private; kmutex_t pl_lock; @@ -366,6 +367,10 @@ typedef struct procfs_list { size_t pl_node_offset; } procfs_list_t; +#ifndef __cplusplus +struct seq_file { }; +void seq_printf(struct seq_file *m, const char *fmt, ...); + typedef struct procfs_list_node { list_node_t pln_link; uint64_t pln_id; @@ -382,6 +387,7 @@ void procfs_list_install(const char *module, void procfs_list_uninstall(procfs_list_t *procfs_list); void procfs_list_destroy(procfs_list_t *procfs_list); void procfs_list_add(procfs_list_t *procfs_list, void *p); +#endif /* * Kernel memory @@ -742,4 +748,9 @@ extern int kmem_cache_reap_active(void); #define ____cacheline_aligned #endif /* _KERNEL */ + +#ifdef __cplusplus +}; +#endif + #endif /* _SYS_ZFS_CONTEXT_H */ diff --git a/include/sys/zio.h b/include/sys/zio.h index 368d8c149..dc4942a5d 100644 --- a/include/sys/zio.h +++ b/include/sys/zio.h @@ -525,24 +525,24 @@ enum blk_verify_flag { extern int zio_bookmark_compare(const void *, const void *); extern zio_t *zio_null(zio_t *pio, spa_t *spa, vdev_t *vd, - zio_done_func_t *done, void *private, enum zio_flag flags); + zio_done_func_t *done, void *priv, enum zio_flag flags); extern zio_t *zio_root(spa_t *spa, - zio_done_func_t *done, void *private, enum zio_flag flags); + zio_done_func_t *done, void *priv, enum zio_flag flags); extern zio_t *zio_read(zio_t *pio, spa_t *spa, const blkptr_t *bp, - struct abd *data, uint64_t lsize, zio_done_func_t *done, void *private, + struct abd *data, uint64_t lsize, zio_done_func_t *done, void *priv, zio_priority_t priority, enum zio_flag flags, const zbookmark_phys_t *zb); extern zio_t *zio_write(zio_t *pio, spa_t *spa, uint64_t txg, blkptr_t *bp, struct abd *data, uint64_t size, uint64_t psize, const zio_prop_t *zp, zio_done_func_t *ready, zio_done_func_t *children_ready, zio_done_func_t *physdone, zio_done_func_t *done, - void *private, zio_priority_t priority, enum zio_flag flags, + void *priv, zio_priority_t priority, enum zio_flag flags, const zbookmark_phys_t *zb); extern zio_t *zio_rewrite(zio_t *pio, spa_t *spa, uint64_t txg, blkptr_t *bp, - struct abd *data, uint64_t size, zio_done_func_t *done, void *private, + struct abd *data, uint64_t size, zio_done_func_t *done, void *priv, zio_priority_t priority, enum zio_flag flags, zbookmark_phys_t *zb); extern void zio_write_override(zio_t *zio, blkptr_t *bp, int copies, @@ -552,23 +552,23 @@ extern void zio_free(spa_t *spa, uint64_t txg, const blkptr_t *bp); extern zio_t *zio_claim(zio_t *pio, spa_t *spa, uint64_t txg, const blkptr_t *bp, - zio_done_func_t *done, void *private, enum zio_flag flags); + zio_done_func_t *done, void *priv, enum zio_flag flags); extern zio_t *zio_ioctl(zio_t *pio, spa_t *spa, vdev_t *vd, int cmd, - zio_done_func_t *done, void *private, enum zio_flag flags); + zio_done_func_t *done, void *priv, enum zio_flag flags); extern zio_t *zio_trim(zio_t *pio, vdev_t *vd, uint64_t offset, uint64_t size, - zio_done_func_t *done, void *private, zio_priority_t priority, + zio_done_func_t *done, void *priv, zio_priority_t priority, enum zio_flag flags, enum trim_flag trim_flags); extern zio_t *zio_read_phys(zio_t *pio, vdev_t *vd, uint64_t offset, uint64_t size, struct abd *data, int checksum, - zio_done_func_t *done, void *private, zio_priority_t priority, + zio_done_func_t *done, void *priv, zio_priority_t priority, enum zio_flag flags, boolean_t labels); extern zio_t *zio_write_phys(zio_t *pio, vdev_t *vd, uint64_t offset, uint64_t size, struct abd *data, int checksum, - zio_done_func_t *done, void *private, zio_priority_t priority, + zio_done_func_t *done, void *priv, zio_priority_t priority, enum zio_flag flags, boolean_t labels); extern zio_t *zio_free_sync(zio_t *pio, spa_t *spa, uint64_t txg, @@ -606,11 +606,11 @@ extern void zio_resubmit_stage_async(void *); extern zio_t *zio_vdev_child_io(zio_t *zio, blkptr_t *bp, vdev_t *vd, uint64_t offset, struct abd *data, uint64_t size, int type, zio_priority_t priority, enum zio_flag flags, - zio_done_func_t *done, void *private); + zio_done_func_t *done, void *priv); extern zio_t *zio_vdev_delegated_io(vdev_t *vd, uint64_t offset, struct abd *data, uint64_t size, zio_type_t type, zio_priority_t priority, - enum zio_flag flags, zio_done_func_t *done, void *private); + enum zio_flag flags, zio_done_func_t *done, void *priv); extern void zio_vdev_io_bypass(zio_t *zio); extern void zio_vdev_io_reissue(zio_t *zio); diff --git a/lib/libspl/include/assert.h b/lib/libspl/include/assert.h index 1b8f6befb..6f80f1334 100644 --- a/lib/libspl/include/assert.h +++ b/lib/libspl/include/assert.h @@ -50,7 +50,8 @@ libspl_assert(const char *buf, const char *file, const char *func, int line) /* printf version of libspl_assert */ static inline void -libspl_assertf(const char *file, const char *func, int line, char *format, ...) +libspl_assertf(const char *file, const char *func, int line, + const char *format, ...) { va_list args; diff --git a/lib/libspl/include/umem.h b/lib/libspl/include/umem.h index 59dc93144..a92dce9b2 100644 --- a/lib/libspl/include/umem.h +++ b/lib/libspl/include/umem.h @@ -145,7 +145,7 @@ umem_cache_create( { umem_cache_t *cp; - cp = umem_alloc(sizeof (umem_cache_t), UMEM_DEFAULT); + cp = (umem_cache_t *)umem_alloc(sizeof (umem_cache_t), UMEM_DEFAULT); if (cp) { strlcpy(cp->cache_name, name, UMEM_CACHE_NAMELEN); cp->cache_bufsize = bufsize; diff --git a/lib/libzfs/os/freebsd/libzfs_compat.c b/lib/libzfs/os/freebsd/libzfs_compat.c index e1c6ef93d..3cb844ddb 100644 --- a/lib/libzfs/os/freebsd/libzfs_compat.c +++ b/lib/libzfs/os/freebsd/libzfs_compat.c @@ -247,7 +247,7 @@ zpool_relabel_disk(libzfs_handle_t *hdl, const char *path, const char *msg) } int -zpool_label_disk(libzfs_handle_t *hdl, zpool_handle_t *zhp, char *name) +zpool_label_disk(libzfs_handle_t *hdl, zpool_handle_t *zhp, const char *name) { return (0); } diff --git a/lib/libzfs/os/linux/libzfs_pool_os.c b/lib/libzfs/os/linux/libzfs_pool_os.c index e1250f121..5c6da5338 100644 --- a/lib/libzfs/os/linux/libzfs_pool_os.c +++ b/lib/libzfs/os/linux/libzfs_pool_os.c @@ -212,7 +212,7 @@ zpool_label_name(char *label_name, int label_size) * stripped of any leading /dev path. */ int -zpool_label_disk(libzfs_handle_t *hdl, zpool_handle_t *zhp, char *name) +zpool_label_disk(libzfs_handle_t *hdl, zpool_handle_t *zhp, const char *name) { char path[MAXPATHLEN]; struct dk_gpt *vtoc; diff --git a/module/os/linux/zfs/spa_stats.c b/module/os/linux/zfs/spa_stats.c index 0d7f540d1..eae9c3f22 100644 --- a/module/os/linux/zfs/spa_stats.c +++ b/module/os/linux/zfs/spa_stats.c @@ -478,11 +478,11 @@ spa_tx_assign_update(kstat_t *ksp, int rw) if (rw == KSTAT_WRITE) { for (i = 0; i < shk->count; i++) - ((kstat_named_t *)shk->private)[i].value.ui64 = 0; + ((kstat_named_t *)shk->priv)[i].value.ui64 = 0; } for (i = shk->count; i > 0; i--) - if (((kstat_named_t *)shk->private)[i-1].value.ui64 != 0) + if (((kstat_named_t *)shk->priv)[i-1].value.ui64 != 0) break; ksp->ks_ndata = i; @@ -504,12 +504,12 @@ spa_tx_assign_init(spa_t *spa) shk->count = 42; /* power of two buckets for 1ns to 2,199s */ shk->size = shk->count * sizeof (kstat_named_t); - shk->private = kmem_alloc(shk->size, KM_SLEEP); + shk->priv = kmem_alloc(shk->size, KM_SLEEP); name = kmem_asprintf("zfs/%s", spa_name(spa)); for (i = 0; i < shk->count; i++) { - ks = &((kstat_named_t *)shk->private)[i]; + ks = &((kstat_named_t *)shk->priv)[i]; ks->data_type = KSTAT_DATA_UINT64; ks->value.ui64 = 0; (void) snprintf(ks->name, KSTAT_STRLEN, "%llu ns", @@ -522,7 +522,7 @@ spa_tx_assign_init(spa_t *spa) if (ksp) { ksp->ks_lock = &shk->lock; - ksp->ks_data = shk->private; + ksp->ks_data = shk->priv; ksp->ks_ndata = shk->count; ksp->ks_data_size = shk->size; ksp->ks_private = spa; @@ -542,7 +542,7 @@ spa_tx_assign_destroy(spa_t *spa) if (ksp) kstat_delete(ksp); - kmem_free(shk->private, shk->size); + kmem_free(shk->priv, shk->size); mutex_destroy(&shk->lock); } @@ -555,7 +555,7 @@ spa_tx_assign_add_nsecs(spa_t *spa, uint64_t nsecs) while (((1ULL << idx) < nsecs) && (idx < shk->size - 1)) idx++; - atomic_inc_64(&((kstat_named_t *)shk->private)[idx].value.ui64); + atomic_inc_64(&((kstat_named_t *)shk->priv)[idx].value.ui64); } /*