Skip to content

Commit

Permalink
Mark functions as static
Browse files Browse the repository at this point in the history
Mark functions used only in the same translation unit as static. This
only includes functions that do not have a prototype in a header file
either.

Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
Closes openzfs#10470
  • Loading branch information
nivedita76 authored and behlendorf committed Jun 18, 2020
1 parent 1fa5c7a commit 65c7cc4
Show file tree
Hide file tree
Showing 62 changed files with 157 additions and 176 deletions.
4 changes: 2 additions & 2 deletions cmd/raidz_test/raidz_bench.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ run_gen_bench_impl(const char *impl)
}
}

void
static void
run_gen_bench(void)
{
char **impl_name;
Expand Down Expand Up @@ -197,7 +197,7 @@ run_rec_bench_impl(const char *impl)
}
}

void
static void
run_rec_bench(void)
{
char **impl_name;
Expand Down
2 changes: 1 addition & 1 deletion cmd/zed/agents/zfs_mod.c
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ zfs_iter_vdev(zpool_handle_t *zhp, nvlist_t *nvl, void *data)
(dp->dd_func)(zhp, nvl, dp->dd_islabeled);
}

void
static void
zfs_enable_ds(void *arg)
{
unavailpool_t *pool = (unavailpool_t *)arg;
Expand Down
2 changes: 1 addition & 1 deletion cmd/zed/zed_strings.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ _zed_strings_node_destroy(zed_strings_node_t *np)
* If [key] is specified, it will be used to index the node; otherwise,
* the string [val] will be used.
*/
zed_strings_node_t *
static zed_strings_node_t *
_zed_strings_node_create(const char *key, const char *val)
{
zed_strings_node_t *np;
Expand Down
2 changes: 1 addition & 1 deletion cmd/zfs/zfs_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ safe_malloc(size_t size)
return (data);
}

void *
static void *
safe_realloc(void *data, size_t size)
{
void *newp;
Expand Down
2 changes: 1 addition & 1 deletion cmd/zfs_ids_to_path/zfs_ids_to_path.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

libzfs_handle_t *g_zfs;

void
static void
usage(int err)
{
fprintf(stderr, "Usage: [-v] zfs_ids_to_path <pool> <objset id> "
Expand Down
2 changes: 1 addition & 1 deletion cmd/zinject/zinject.c
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ register_handler(const char *pool, int flags, zinject_record_t *record,
return (0);
}

int
static int
perform_action(const char *pool, zinject_record_t *record, int cmd)
{
zfs_cmd_t zc = {"\0"};
Expand Down
22 changes: 11 additions & 11 deletions cmd/zpool/zpool_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ print_prop_cb(int prop, void *cb)
* that command. Otherwise, iterate over the entire command table and display
* a complete usage message.
*/
void
static void
usage(boolean_t requested)
{
FILE *fp = requested ? stdout : stderr;
Expand Down Expand Up @@ -1689,7 +1689,7 @@ typedef struct export_cbdata {
/*
* Export one pool
*/
int
static int
zpool_export_one(zpool_handle_t *zhp, void *data)
{
export_cbdata_t *cb = data;
Expand Down Expand Up @@ -3711,7 +3711,7 @@ default_column_width(iostat_cbdata_t *cb, enum iostat_type type)
* If force_column_width is set, use it for the column width. If not set, use
* the default column width.
*/
void
static void
print_iostat_labels(iostat_cbdata_t *cb, unsigned int force_column_width,
const name_and_columns_t labels[][IOSTAT_MAX_LABELS])
{
Expand Down Expand Up @@ -3783,7 +3783,7 @@ print_iostat_labels(iostat_cbdata_t *cb, unsigned int force_column_width,
* sdc - - 0 0 5 473 val1 val2
* ---------- ----- ----- ----- ----- ----- ----- ---- ----
*/
void
static void
print_cmd_columns(vdev_cmd_data_list_t *vcdl, int use_dashes)
{
int i, j;
Expand Down Expand Up @@ -4633,7 +4633,7 @@ refresh_iostat(zpool_handle_t *zhp, void *data)
/*
* Callback to print out the iostats for the given pool.
*/
int
static int
print_iostat(zpool_handle_t *zhp, void *data)
{
iostat_cbdata_t *cb = data;
Expand Down Expand Up @@ -5787,7 +5787,7 @@ print_one_column(zpool_prop_t prop, uint64_t value, const char *str,
* print static default line per vdev
* not compatible with '-o' <proplist> option
*/
void
static void
print_list_stats(zpool_handle_t *zhp, const char *name, nvlist_t *nv,
list_cbdata_t *cb, int depth, boolean_t isspare)
{
Expand Down Expand Up @@ -5954,7 +5954,7 @@ print_list_stats(zpool_handle_t *zhp, const char *name, nvlist_t *nv,
/*
* Generic callback function to list a pool.
*/
int
static int
list_callback(zpool_handle_t *zhp, void *data)
{
list_cbdata_t *cbp = data;
Expand Down Expand Up @@ -6858,7 +6858,7 @@ zpool_has_checkpoint(zpool_handle_t *zhp)
return (B_FALSE);
}

int
static int
scrub_callback(zpool_handle_t *zhp, void *data)
{
scrub_cbdata_t *cb = data;
Expand Down Expand Up @@ -7583,7 +7583,7 @@ print_dedup_stats(nvlist_t *config)
* When given the '-v' option, we print out the complete config. If the '-e'
* option is specified, then we print out error rate information as well.
*/
int
static int
status_callback(zpool_handle_t *zhp, void *data)
{
status_cbdata_t *cbp = data;
Expand Down Expand Up @@ -9448,7 +9448,7 @@ typedef struct set_cbdata {
boolean_t cb_any_successful;
} set_cbdata_t;

int
static int
set_callback(zpool_handle_t *zhp, void *data)
{
int error;
Expand Down Expand Up @@ -9698,7 +9698,7 @@ print_wait_status_row(wait_data_t *wd, zpool_handle_t *zhp, int row)
(void) fflush(stdout);
}

void *
static void *
wait_status_thread(void *arg)
{
wait_data_t *wd = (wait_data_t *)arg;
Expand Down
2 changes: 1 addition & 1 deletion cmd/zpool/zpool_vdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1173,7 +1173,7 @@ is_grouping(const char *type, int *mindev, int *maxdev)
* Note: we don't bother freeing anything in the error paths
* because the program is just going to exit anyway.
*/
nvlist_t *
static nvlist_t *
construct_spec(nvlist_t *props, int argc, char **argv)
{
nvlist_t *nvroot, *nv, **top, **spares, **l2cache;
Expand Down
18 changes: 9 additions & 9 deletions cmd/ztest/ztest.c
Original file line number Diff line number Diff line change
Expand Up @@ -1584,7 +1584,7 @@ ztest_bt_bonus(dmu_buf_t *db)
* helps ensure that all dnode traversal code properly skips the
* interior regions of large dnodes.
*/
void
static void
ztest_fill_unused_bonus(dmu_buf_t *db, void *end, uint64_t obj,
objset_t *os, uint64_t gen)
{
Expand All @@ -1603,7 +1603,7 @@ ztest_fill_unused_bonus(dmu_buf_t *db, void *end, uint64_t obj,
* Verify that the unused area of a bonus buffer is filled with the
* expected tokens.
*/
void
static void
ztest_verify_unused_bonus(dmu_buf_t *db, void *end, uint64_t obj,
objset_t *os, uint64_t gen)
{
Expand Down Expand Up @@ -2259,7 +2259,7 @@ ztest_lr_alloc(size_t lrsize, char *name)
return (lr);
}

void
static void
ztest_lr_free(void *lr, size_t lrsize, char *name)
{
size_t namesize = name ? strlen(name) + 1 : 0;
Expand Down Expand Up @@ -3609,7 +3609,7 @@ ztest_device_removal(ztest_ds_t *zd, uint64_t id)
/*
* Callback function which expands the physical size of the vdev.
*/
vdev_t *
static vdev_t *
grow_vdev(vdev_t *vd, void *arg)
{
spa_t *spa __maybe_unused = vd->vdev_spa;
Expand Down Expand Up @@ -3638,7 +3638,7 @@ grow_vdev(vdev_t *vd, void *arg)
* Callback function which expands a given vdev by calling vdev_online().
*/
/* ARGSUSED */
vdev_t *
static vdev_t *
online_vdev(vdev_t *vd, void *arg)
{
spa_t *spa = vd->vdev_spa;
Expand Down Expand Up @@ -3698,7 +3698,7 @@ online_vdev(vdev_t *vd, void *arg)
* If a NULL callback is passed, then we just return back the first
* leaf vdev we encounter.
*/
vdev_t *
static vdev_t *
vdev_walk_tree(vdev_t *vd, vdev_t *(*func)(vdev_t *, void *), void *arg)
{
uint_t c;
Expand Down Expand Up @@ -4151,7 +4151,7 @@ ztest_dmu_snapshot_create_destroy(ztest_ds_t *zd, uint64_t id)
/*
* Cleanup non-standard snapshots and clones.
*/
void
static void
ztest_dsl_dataset_cleanup(char *osname, uint64_t id)
{
char *snap1name;
Expand Down Expand Up @@ -4605,7 +4605,7 @@ ztest_dmu_read_write(ztest_ds_t *zd, uint64_t id)
umem_free(od, size);
}

void
static void
compare_and_update_pbbufs(uint64_t s, bufwad_t *packbuf, bufwad_t *bigbuf,
uint64_t bigsize, uint64_t n, uint64_t chunksize, uint64_t txg)
{
Expand Down Expand Up @@ -7269,7 +7269,7 @@ ztest_run(ztest_shared_t *zs)
mutex_destroy(&ztest_checkpoint_lock);
}

void
static void
print_time(hrtime_t t, char *timebuf)
{
hrtime_t s = t / NANOSEC;
Expand Down
17 changes: 2 additions & 15 deletions include/os/freebsd/spl/sys/console.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,7 @@
#ifndef _SPL_CONSOLE_H
#define _SPL_CONSOLE_H

static inline void
console_vprintf(const char *fmt, va_list args)
{
vprintf(fmt, args);
}

static inline void
console_printf(const char *fmt, ...)
{
va_list args;

va_start(args, fmt);
console_vprintf(fmt, args);
va_end(args);
}
#define console_vprintf vprintf
#define console_printf printf

#endif /* _SPL_CONSOLE_H */
17 changes: 2 additions & 15 deletions include/os/linux/spl/sys/console.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,7 @@
#ifndef _SPL_CONSOLE_H
#define _SPL_CONSOLE_H

void
console_vprintf(const char *fmt, va_list args)
{
vprintk(fmt, args);
}

void
console_printf(const char *fmt, ...)
{
va_list args;

va_start(args, fmt);
console_vprintf(fmt, args);
va_end(args);
}
#define console_vprintf vprintk
#define console_printf printk

#endif /* _SPL_CONSOLE_H */
8 changes: 4 additions & 4 deletions lib/libzfs/libzfs_dataset.c
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ libzfs_mnttab_init(libzfs_handle_t *hdl)
sizeof (mnttab_node_t), offsetof(mnttab_node_t, mtn_node));
}

int
static int
libzfs_mnttab_update(libzfs_handle_t *hdl)
{
struct mnttab entry;
Expand Down Expand Up @@ -1620,7 +1620,7 @@ zfs_valid_proplist(libzfs_handle_t *hdl, zfs_type_t type, nvlist_t *nvl,
return (NULL);
}

int
static int
zfs_add_synthetic_resv(zfs_handle_t *zhp, nvlist_t *nvl)
{
uint64_t old_volsize;
Expand Down Expand Up @@ -2551,7 +2551,7 @@ struct get_clones_arg {
char buf[ZFS_MAX_DATASET_NAME_LEN];
};

int
static int
get_clones_cb(zfs_handle_t *zhp, void *arg)
{
struct get_clones_arg *gca = arg;
Expand Down Expand Up @@ -3129,7 +3129,7 @@ zfs_prop_get_int(zfs_handle_t *zhp, zfs_prop_t prop)
return (val);
}

int
static int
zfs_prop_set_int(zfs_handle_t *zhp, zfs_prop_t prop, uint64_t val)
{
char buf[64];
Expand Down
2 changes: 1 addition & 1 deletion lib/libzfs/libzfs_iter.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

#include "libzfs_impl.h"

int
static int
zfs_iter_clones(zfs_handle_t *zhp, zfs_iter_f func, void *data)
{
nvlist_t *nvl = zfs_get_clones_nvl(zhp);
Expand Down
2 changes: 1 addition & 1 deletion lib/libzfs/libzfs_mount.c
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ zfs_unshare_smb(zfs_handle_t *zhp, const char *mountpoint)
/*
* Same as zfs_unmountall(), but for NFS and SMB unshares.
*/
int
static int
zfs_unshareall_proto(zfs_handle_t *zhp, zfs_share_proto_t *proto)
{
prop_changelist_t *clp;
Expand Down
4 changes: 2 additions & 2 deletions lib/libzfs/libzfs_pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ bootfs_name_valid(const char *pool, const char *bootfs)
return (B_FALSE);
}

boolean_t
static boolean_t
zpool_is_bootable(zpool_handle_t *zhp)
{
char bootfs[ZFS_MAX_DATASET_NAME_LEN];
Expand Down Expand Up @@ -2141,7 +2141,7 @@ xlate_init_err(int err)
* Begin, suspend, or cancel the initialization (initializing of all free
* blocks) for the given vdevs in the given pool.
*/
int
static int
zpool_initialize_impl(zpool_handle_t *zhp, pool_initialize_func_t cmd_type,
nvlist_t *vds, boolean_t wait)
{
Expand Down
4 changes: 2 additions & 2 deletions lib/libzfs/libzfs_sendrecv.c
Original file line number Diff line number Diff line change
Expand Up @@ -2296,7 +2296,7 @@ zfs_send(zfs_handle_t *zhp, const char *fromsnap, const char *tosnap,
return (err);
}

zfs_handle_t *
static zfs_handle_t *
name_to_dir_handle(libzfs_handle_t *hdl, const char *snapname)
{
char dirname[ZFS_MAX_DATASET_NAME_LEN];
Expand Down Expand Up @@ -2877,7 +2877,7 @@ typedef struct guid_to_name_data {
uint64_t num_redact_snaps;
} guid_to_name_data_t;

boolean_t
static boolean_t
redact_snaps_match(zfs_handle_t *zhp, guid_to_name_data_t *gtnd)
{
uint64_t *bmark_snaps;
Expand Down
2 changes: 1 addition & 1 deletion lib/libzfs/libzfs_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -1773,7 +1773,7 @@ typedef struct expand_data {
zfs_type_t type;
} expand_data_t;

int
static int
zprop_expand_list_cb(int prop, void *cb)
{
zprop_list_t *entry;
Expand Down
Loading

0 comments on commit 65c7cc4

Please sign in to comment.