Whamcloud - gitweb
LU-8191 utils: remove unused, fix non-static functions 39/51439/8
authorTimothy Day <timday@amazon.com>
Sat, 20 Jan 2024 18:19:11 +0000 (18:19 +0000)
committerOleg Drokin <green@whamcloud.com>
Mon, 4 Mar 2024 20:01:55 +0000 (20:01 +0000)
Remove several functions which are never called.

Static analysis shows that a number of functions
could be made static. This patch declares several
functions in various Lustre utils static.

Some missing headers caused some functions being
incorrectly marked as possible candidates for
being made static. These missing headers have
been added.

Test-Parameters: trivial
Signed-off-by: Timothy Day <timday@amazon.com>
Change-Id: Id51f922be57c33c011ee2f9e509ca164cc480edf
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/51439
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
25 files changed:
lustre/utils/check_iam.c
lustre/utils/debug.c
lustre/utils/gss/gss_util.c
lustre/utils/gss/lgss_keyring.c
lustre/utils/gss/sk_utils.c
lustre/utils/gss/svcgssd.c
lustre/utils/gss/svcgssd.h
lustre/utils/gss/svcgssd_mech2file.c
lustre/utils/gss/svcgssd_proc.c
lustre/utils/l_getsepol.c
lustre/utils/lctl.c
lustre/utils/lfs.c
lustre/utils/libmount_utils_zfs.c
lustre/utils/ll_decode_linkea.c
lustre/utils/llog_reader.c
lustre/utils/llverdev.c
lustre/utils/lr_reader.c
lustre/utils/lsnapshot.c
lustre/utils/lustre_cfg.c
lustre/utils/mkfs_lustre.c
lustre/utils/mount_lustre.c
lustre/utils/mount_utils.c
lustre/utils/ofd_access_batch.c
lustre/utils/ofd_access_log_reader.c
lustre/utils/portals.c

index bee3c8c..938d819 100644 (file)
@@ -56,7 +56,7 @@ struct node_info {
        int node_type;
 };
 
-void usage(char *str)
+static void usage(char *str)
 {
        printf("Usage: %s [-hrv] iam_file\n", str);
 }
@@ -79,7 +79,7 @@ struct iam_params {
        int rc;
 };
 
-int check_idle_blocks(char *buf, struct iam_params *params)
+static int check_idle_blocks(char *buf, struct iam_params *params)
 {
        struct iam_idle_head *idle;
        int i;
index bf3e161..0bec2f2 100644 (file)
@@ -59,6 +59,8 @@
 #include <linux/lnet/lnetctl.h>
 #include <libcfs/util/string.h>
 
+#include "obdctl.h"
+
 static char rawbuf[8192];
 static char *buf = rawbuf;
 static int max = 8192;
index 4c983a5..1f254be 100644 (file)
@@ -80,6 +80,7 @@
 # include <com_err.h>
 #endif
 #include "lsupport.h"
+#include "svcgssd.h"
 
 #define GSSD_SERVICE_MGS                       "lustre_mgs"
 #define GSSD_SERVICE_MDS                       "lustre_mds"
index f08e633..825d1c3 100644 (file)
@@ -194,10 +194,10 @@ out_params:
        return rc;
 }
 
-int do_nego_rpc(struct lgss_nego_data *lnd,
-               gss_buffer_desc *gss_token,
-               struct lgss_init_res *gr,
-               int req_fd[2], int reply_fd[2])
+static int do_nego_rpc(struct lgss_nego_data *lnd,
+                      gss_buffer_desc *gss_token,
+                      struct lgss_init_res *gr,
+                      int req_fd[2], int reply_fd[2])
 {
        struct lgssd_ioctl_param param;
        struct passwd *pw;
@@ -535,7 +535,7 @@ static int lgssc_init_nego_data(struct lgss_nego_data *lnd,
         return 0;
 }
 
-void lgssc_fini_nego_data(struct lgss_nego_data *lnd)
+static void lgssc_fini_nego_data(struct lgss_nego_data *lnd)
 {
         OM_uint32       maj_stat, min_stat;
 
index efcef1e..0dc46dd 100644 (file)
@@ -1297,9 +1297,9 @@ void sk_free_cred(struct sk_cred *skc)
  *
  * If the size is smaller it will take copy the first N bytes necessary to
  * fill the derived key. */
-int sk_kdf(gss_buffer_desc *derived_key , gss_buffer_desc *origin_key,
-          gss_buffer_desc *key_binding_bufs, int numbufs,
-          enum cfs_crypto_hash_alg hmac_alg)
+static int sk_kdf(gss_buffer_desc *derived_key, gss_buffer_desc *origin_key,
+                 gss_buffer_desc *key_binding_bufs, int numbufs,
+                 enum cfs_crypto_hash_alg hmac_alg)
 {
        size_t remain;
        size_t bytes;
@@ -1458,9 +1458,9 @@ int sk_compute_keys(struct sk_cred *skc)
        return 0;
 }
 
-uint32_t __sk_compute_dh_key(struct sk_cred *skc,
-                            const gss_buffer_desc *pub_key,
-                            size_t *expected_len)
+static uint32_t __sk_compute_dh_key(struct sk_cred *skc,
+                                   const gss_buffer_desc *pub_key,
+                                   size_t *expected_len)
 {
        gss_buffer_desc *dh_shared = &skc->sc_dh_shared_key;
        uint32_t rc = GSS_S_FAILURE;
index 3b6cf2e..18c36ae 100644 (file)
@@ -65,7 +65,7 @@ int null_enabled;
 int krb_enabled;
 int sk_enabled;
 
-void
+static void
 closeall(int min)
 {
        DIR *dir = opendir("/proc/self/fd");
@@ -168,7 +168,7 @@ release_parent()
        }
 }
 
-void
+static void
 sig_die(int signal)
 {
        /* destroy krb5 machine creds */
@@ -181,7 +181,7 @@ sig_die(int signal)
        exit(1);
 }
 
-void
+static void
 sig_hup(int signal)
 {
        /* don't exit on SIGHUP */
index 936267d..36e8b95 100644 (file)
@@ -31,6 +31,7 @@
 #ifndef _RPC_SVCGSSD_H_
 #define _RPC_SVCGSSD_H_
 
+#include <stdio.h>
 #include <sys/types.h>
 #include <sys/queue.h>
 #include <gssapi/gssapi.h>
index 43c0d78..8e2b7af 100644 (file)
 
 */
 
-#include "config.h"
-
 #include <gssapi/gssapi.h>
 #include <string.h>
 
+#include "svcgssd.h"
+#include "config.h"
 
 #define g_OID_equal(o1,o2) \
    (((o1)->length == (o2)->length) && \
index 88e061a..0595469 100644 (file)
@@ -491,7 +491,7 @@ out_free:
        return res;
 }
 
-int handle_sk(struct svc_nego_data *snd)
+static int handle_sk(struct svc_nego_data *snd)
 {
 #ifdef HAVE_OPENSSL_SSK
        struct sk_cred *skc = NULL;
@@ -752,7 +752,7 @@ out_err:
        return -1;
 }
 
-int handle_null(struct svc_nego_data *snd)
+static int handle_null(struct svc_nego_data *snd)
 {
        struct svc_cred cred;
        uint64_t tmp;
index 990d016..9e06852 100644 (file)
@@ -152,7 +152,7 @@ out:
        return rc;
 }
 
-int get_opts(int argc, char *const argv[])
+static int get_opts(int argc, char *const argv[])
 {
        static struct option long_opts[] = {
                { .val = 'o', .name =  "obd_type",
index e62fc65..720fb33 100644 (file)
@@ -600,7 +600,7 @@ static int jt_pcc(int argc, char **argv)
        return rc < 0 ? -rc : rc;
 }
 
-int lctl_main(int argc, char **argv)
+static int lctl_main(int argc, char **argv)
 {
        int rc;
 
index db45753..2242bc4 100644 (file)
@@ -749,7 +749,8 @@ out:
        return rc;
 }
 
-struct timespec timespec_sub(struct timespec *before, struct timespec *after)
+static struct timespec timespec_sub(struct timespec *before,
+                                   struct timespec *after)
 {
        struct timespec ret;
 
@@ -8130,7 +8131,7 @@ static inline __u64 lustre_stoqb(size_t space)
 #define lustre_stoqb   toqb
 #endif
 
-int lfs_setquota_times(int argc, char **argv, struct if_quotactl *qctl)
+static int lfs_setquota_times(int argc, char **argv, struct if_quotactl *qctl)
 {
        int c, rc;
        char *mnt, *obd_type = (char *)qctl->obd_type;
@@ -11040,7 +11041,7 @@ static const char *const ladvise_names[] = LU_LADVISE_NAMES;
 
 static const char *const lock_mode_names[] = LOCK_MODE_NAMES;
 
-int lfs_get_mode(const char *string)
+static int lfs_get_mode(const char *string)
 {
        enum lock_mode_user mode;
 
index cb0a539..f47568d 100644 (file)
@@ -320,7 +320,7 @@ static int osd_check_zfs_setup(void)
 }
 
 /* Write the server config as properties associated with the dataset */
-int zfs_write_ldd(struct mkfs_opts *mop)
+static int zfs_write_ldd(struct mkfs_opts *mop)
 {
        struct lustre_disk_data *ldd = &mop->mo_ldd;
        char *ds = mop->mo_device;
@@ -367,7 +367,7 @@ out:
 }
 
 /* Mark a property to be removed by the form of "key=" */
-int zfs_erase_ldd(struct mkfs_opts *mop, char *param)
+static int zfs_erase_ldd(struct mkfs_opts *mop, char *param)
 {
        char key[ZFS_MAXPROPLEN] = "";
 
@@ -470,7 +470,7 @@ static int zfs_get_prop_params(zfs_handle_t *zhp, char *param)
  * Read the server config as properties associated with the dataset.
  * Missing entries as not treated error and are simply skipped.
  */
-int zfs_read_ldd(char *ds,  struct lustre_disk_data *ldd)
+static int zfs_read_ldd(char *ds,  struct lustre_disk_data *ldd)
 {
        zfs_handle_t *zhp;
        struct zfs_ldd_prop_bridge *bridge;
@@ -519,7 +519,7 @@ out:
 }
 
 /* Print ldd params */
-void zfs_print_ldd_params(struct mkfs_opts *mop)
+static void zfs_print_ldd_params(struct mkfs_opts *mop)
 {
        char *from = mop->mo_ldd.ldd_params;
        char *to;
@@ -554,7 +554,7 @@ void zfs_print_ldd_params(struct mkfs_opts *mop)
        }
 }
 
-int zfs_is_lustre(char *ds, unsigned *mount_type)
+static int zfs_is_lustre(char *ds, unsigned int *mount_type)
 {
        struct lustre_disk_data tmp_ldd;
        int ret;
@@ -637,7 +637,7 @@ static int zfs_create_vdev(struct mkfs_opts *mop, char *vdev)
        return ret;
 }
 
-int zfs_make_lustre(struct mkfs_opts *mop)
+static int zfs_make_lustre(struct mkfs_opts *mop)
 {
        zfs_handle_t *zhp;
        zpool_handle_t *php;
@@ -818,14 +818,14 @@ out:
        return ret;
 }
 
-int zfs_enable_quota(struct mkfs_opts *mop)
+static int zfs_enable_quota(struct mkfs_opts *mop)
 {
        fprintf(stderr, "this option is not only valid for zfs\n");
        return ENOSYS;
 }
 
-int zfs_prepare_lustre(struct mkfs_opts *mop,
-                      char *wanted_mountopts, size_t len)
+static int zfs_prepare_lustre(struct mkfs_opts *mop,
+                             char *wanted_mountopts, size_t len)
 {
        if (osd_check_zfs_setup() == 0)
                return EINVAL;
@@ -846,7 +846,7 @@ int zfs_prepare_lustre(struct mkfs_opts *mop,
        return 0;
 }
 
-int zfs_tune_lustre(char *dev, struct mount_opts *mop)
+static int zfs_tune_lustre(char *dev, struct mount_opts *mop)
 {
        if (osd_check_zfs_setup() == 0)
                return EINVAL;
@@ -854,7 +854,7 @@ int zfs_tune_lustre(char *dev, struct mount_opts *mop)
        return 0;
 }
 
-int zfs_label_lustre(struct mount_opts *mop)
+static int zfs_label_lustre(struct mount_opts *mop)
 {
        zfs_handle_t *zhp;
        int ret;
@@ -872,7 +872,7 @@ int zfs_label_lustre(struct mount_opts *mop)
        return ret;
 }
 
-int zfs_rename_fsname(struct mkfs_opts *mop, const char *oldname)
+static int zfs_rename_fsname(struct mkfs_opts *mop, const char *oldname)
 {
        struct mount_opts opts;
        char mntpt[] = "/tmp/mntXXXXXX";
@@ -936,7 +936,7 @@ out_rmdir:
        return ret;
 }
 
-int zfs_init(void)
+static int zfs_init(void)
 {
        int ret = 0;
 
index 9327428..9e84ff8 100644 (file)
@@ -56,7 +56,7 @@ static void print_name(const char *cp, int len)
        }
 }
 
-int decode_linkea(const char *fname)
+static int decode_linkea(const char *fname)
 {
        char buf[BUFFER_SIZE];
        struct link_ea_header *leh;
index dac7b5d..05c8fcf 100644 (file)
@@ -106,7 +106,7 @@ char *portals_command[17] = {
        ""
 };
 
-int is_fstype_ext(int fd)
+static int is_fstype_ext(int fd)
 {
        struct statfs st;
        int rc;
@@ -523,7 +523,7 @@ static void print_setup_cfg(struct lustre_cfg *lcfg)
        }
 }
 
-void print_lustre_cfg(struct lustre_cfg *lcfg, int *skip)
+static void print_lustre_cfg(struct lustre_cfg *lcfg, int *skip)
 {
        enum lcfg_command_type cmd = __le32_to_cpu(lcfg->lcfg_command);
 
@@ -738,7 +738,7 @@ static void print_hsm_action(struct llog_agent_req_rec *larr)
               hai_dump_data_field(&larr->arr_hai, buf, sizeof(buf)));
 }
 
-void print_changelog_rec(struct llog_changelog_rec *rec)
+static void print_changelog_rec(struct llog_changelog_rec *rec)
 {
        time_t secs;
        struct tm ts;
@@ -906,7 +906,7 @@ static const char *update_op_str(__u16 opc)
                return "unknown";
 }
 
-char *buf2str(void *buf, unsigned int size)
+static char *buf2str(void *buf, unsigned int size)
 {
        const char *hex = "0123456789ABCDEF";
        char *buf_c = buf;
@@ -944,7 +944,7 @@ object_update_param_size(const struct object_update_param *param)
        return roundup(sizeof(*param) + param->oup_len, sizeof(__u64));
 }
 
-void print_update_rec(struct llog_update_record *lur)
+static void print_update_rec(struct llog_update_record *lur)
 {
        struct update_records *rec = &lur->lur_update_rec;
        unsigned int i, j, up_count, pm_count;
index 9b6c1b6..2e9158f 100644 (file)
@@ -128,7 +128,7 @@ static struct option const long_opts[] = {
  * Usage: displays help information, whenever user supply --help option in
  * command or enters incorrect command line.
  */
-void usage(int status)
+static void usage(int status)
 {
        if (status != 0) {
                printf("\nUsage: %s [OPTION]... <device-name> ...\n",
@@ -222,9 +222,11 @@ out:
  * Verify_chunk: Verifies test pattern in each 4kB (BLOCKSIZE) is correct.
  * Returns 0 if test offset and timestamp is correct otherwise 1.
  */
-int verify_chunk(char *chunk_buf, const size_t chunksize,
-                unsigned long long chunk_off, const unsigned long long time_st,
-                const unsigned long long inode_st, const char *file)
+static int verify_chunk(char *chunk_buf, const size_t chunksize,
+                       unsigned long long chunk_off,
+                       const unsigned long long time_st,
+                       const unsigned long long inode_st,
+                       const char *file)
 {
        struct block_data *bd;
        char *chunk_end;
@@ -252,8 +254,8 @@ int verify_chunk(char *chunk_buf, const size_t chunksize,
  * and offset. The test pattern is filled at the beginning of
  * each 4kB(BLOCKSIZE) blocks in chunk_buf.
  */
-void fill_chunk(char *chunk_buf, size_t chunksize, loff_t chunk_off,
-               const time_t time_st, const ino_t inode_st)
+static void fill_chunk(char *chunk_buf, size_t chunksize, loff_t chunk_off,
+                      const time_t time_st, const ino_t inode_st)
 {
        struct block_data *bd;
        char *chunk_end;
@@ -268,7 +270,8 @@ void fill_chunk(char *chunk_buf, size_t chunksize, loff_t chunk_off,
        }
 }
 
-void show_rate(char *op, unsigned long long offset, unsigned long long count)
+static void show_rate(char *op, unsigned long long offset,
+                     unsigned long long count)
 {
        static unsigned long long subtot, total;
        static time_t start, last;
@@ -321,8 +324,8 @@ void show_rate(char *op, unsigned long long offset, unsigned long long count)
  *
  * Returns 0 on success, or -ve errno on failure.
  */
-size_t write_retry(int fd, const char *chunk_buf, size_t nrequested,
-                  unsigned long long offset, const char *file)
+static size_t write_retry(int fd, const char *chunk_buf, size_t nrequested,
+                         unsigned long long offset, const char *file)
 {
        long nwritten;
 
@@ -357,10 +360,10 @@ retry:
  *
  * Returns 0 on success, or -ve error number on failure.
  */
-int write_chunks(int fd, unsigned long long offset,
-                unsigned long long *write_end, char *chunk_buf,
-                size_t chunksize, const time_t time_st,
-                const ino_t inode_st, const char *file)
+static int write_chunks(int fd, unsigned long long offset,
+                       unsigned long long *write_end, char *chunk_buf,
+                       size_t chunksize, const time_t time_st,
+                       const ino_t inode_st, const char *file)
 {
        unsigned long long stride;
 
@@ -394,9 +397,10 @@ int write_chunks(int fd, unsigned long long offset,
  * read_chunk: reads the chunk_buf from the device. The number of read
  * operations are based on the parameters read_end, offset, and chunksize.
  */
-int read_chunks(int fd, unsigned long long offset, unsigned long long read_end,
-               char *chunk_buf, size_t chunksize, const time_t time_st,
-               const ino_t inode_st, const char *file)
+static int read_chunks(int fd, unsigned long long offset,
+                      unsigned long long read_end, char *chunk_buf,
+                      size_t chunksize, const time_t time_st,
+                      const ino_t inode_st, const char *file)
 {
        unsigned long long stride;
 
@@ -450,8 +454,8 @@ read_more:
        return 0;
 }
 
-int parse_size(const char *optarg, unsigned long long *size,
-              unsigned long long size_units)
+static int parse_size(const char *optarg, unsigned long long *size,
+                     unsigned long long size_units)
 {
        char *end;
 
index fde01a7..3c07de4 100644 (file)
@@ -72,7 +72,7 @@ static struct option const long_opts[] = {
        { .val = 'C',   .name = "last_rcvd",    .has_arg = required_argument },
        { .name = NULL } };
 
-void dump_log(int fd)
+static void dump_log(int fd)
 {
        char buf[128];
        int n;
@@ -85,7 +85,7 @@ void dump_log(int fd)
        fprintf(stderr, "\n");
 }
 
-FILE *open_debugfs_file(char *filename, char *tmpdir, char *dev)
+static FILE *open_debugfs_file(char *filename, char *tmpdir, char *dev)
 {
        char log[] = "/tmp/run_command_logXXXXXX";
        char filepnm[128];
@@ -142,7 +142,7 @@ out:
        return fp;
 }
 
-int print_last_rcvd(FILE *fp, int opt_client)
+static int print_last_rcvd(FILE *fp, int opt_client)
 {
        struct lr_server_data lsd = {};
        int rc = 0;
@@ -252,7 +252,7 @@ int print_last_rcvd(FILE *fp, int opt_client)
        return 0;
 }
 
-int print_reply_data(FILE *fp)
+static int print_reply_data(FILE *fp)
 {
        struct lsd_reply_header lrh = {};
        unsigned long long slot;
@@ -358,7 +358,7 @@ int print_reply_data(FILE *fp)
        return 0;
 }
 
-void display_usage(void)
+static void display_usage(void)
 {
        printf("Usage: %s [OPTIONS] devicename\n", progname);
        printf("Usage: %s [OPTIONS] -C <last_rcvd_file> -R <reply_data_file>\n",
index 00716e9..7dacf66 100644 (file)
@@ -149,7 +149,7 @@ do {                                                                        \
 #define PIMPORT(st) snapshot_path, \
                (st)->st_dir ? (st)->st_dir : "/dev -d /tmp", (st)->st_pool
 
-char *snapshot_fgets(FILE *fp, char *buf, int buflen)
+static char *snapshot_fgets(FILE *fp, char *buf, int buflen)
 {
        char *ptr;
 
index ceec0a3..928ea30 100644 (file)
@@ -445,7 +445,7 @@ int jt_lcfg_param(int argc, char **argv)
        return jt_lcfg_ioctl(&bufs, argv[0], LCFG_PARAM);
 }
 
-int lcfg_setparam_perm(char *func, char *buf)
+static int lcfg_setparam_perm(char *func, char *buf)
 {
        int rc = 0;
        struct lustre_cfg_bufs bufs;
@@ -535,7 +535,7 @@ static int jt_lcfg_setparam_perm(int argc, char **argv,
        return rc;
 }
 
-int lcfg_conf_param(char *func, char *buf)
+static int lcfg_conf_param(char *func, char *buf)
 {
        int rc;
        struct lustre_cfg_bufs bufs;
@@ -901,7 +901,7 @@ write_param(const char *path, const char *param_name, struct param_opts *popt,
        return rc;
 }
 
-void print_obd_line(char *s)
+static void print_obd_line(char *s)
 {
        const char *param = "osc/%s/ost_conn_uuid";
        char obd_name[MAX_OBD_NAME];
@@ -951,7 +951,7 @@ fail_print:
        printf("%s%s%s\n", s, buf[0] ? " " : "", buf);
 }
 
-int yaml_get_device_index(char *source)
+static int yaml_get_device_index(char *source)
 {
        yaml_emitter_t request;
        yaml_parser_t reply;
@@ -1840,7 +1840,7 @@ static enum paramtype construct_param(enum paramtype confset, const char *param,
        return PT_NONE;
 }
 
-int lcfg_apply_param_yaml(char *func, char *filename)
+static int lcfg_apply_param_yaml(char *func, char *filename)
 {
        FILE *file;
        yaml_parser_t parser;
index f906230..db5be76 100644 (file)
@@ -95,7 +95,7 @@ static int print_only;
 
 #define FSLIST FSLIST_LDISKFS FSLIST_ZFS
 
-void usage(FILE *out)
+static void usage(FILE *out)
 {
        fprintf(out, "usage: %s <target type> [--backfstype="FSLIST"] "
                "--fsname=<filesystem name>\n"
@@ -173,7 +173,7 @@ void usage(FILE *out)
 
 /* ==================== Lustre config functions =============*/
 
-void print_ldd(char *str, struct mkfs_opts *mop)
+static void print_ldd(char *str, struct mkfs_opts *mop)
 {
        struct lustre_disk_data *ldd = &mop->mo_ldd;
 
@@ -205,7 +205,7 @@ void print_ldd(char *str, struct mkfs_opts *mop)
        printf("\n");
 }
 
-void set_defaults(struct mkfs_opts *mop)
+static void set_defaults(struct mkfs_opts *mop)
 {
        mop->mo_ldd.ldd_magic = LDD_MAGIC;
        mop->mo_ldd.ldd_config_ver = 1;
@@ -323,8 +323,8 @@ static int erase_param(const char *const buf, const char *const param,
 }
 #endif
 
-int parse_opts(int argc, char *const argv[], struct mkfs_opts *mop,
-              char **mountopts, char *old_fsname)
+static int parse_opts(int argc, char *const argv[], struct mkfs_opts *mop,
+                     char **mountopts, char *old_fsname)
 {
        static struct option long_opts[] = {
        { .val = 'B',   .name =  "backfs-mount-opts",
@@ -793,7 +793,7 @@ int parse_opts(int argc, char *const argv[], struct mkfs_opts *mop,
  * Returns 0 if all is found good.
  * Returns 1 if invalid args is detected
  */
-int chk_args(int argc, char *const argv[])
+static int chk_args(int argc, char *const argv[])
 {
        /* If no argument is given to mkfs.lustre, bail out */
        if (argc < 2)
index 970643a..78dd13c 100644 (file)
@@ -66,7 +66,7 @@ int   verbose;
 int    version;
 char   *progname;
 
-void usage(FILE *out)
+static void usage(FILE *out)
 {
        fprintf(out,
                "\nThis mount helper should only be invoked via the mount (8) command,\ne.g. mount -t lustre dev dir\n\n");
@@ -250,8 +250,8 @@ out_err:
  * Replace options with subset of Lustre-specific options, and
  * fill in mount flags
  */
-int parse_options(struct mount_opts *mop, char *orig_options,
-                 int *flagp, size_t options_len)
+static int parse_options(struct mount_opts *mop, char *orig_options,
+                        int *flagp, size_t options_len)
 {
        char *options, *opt, *nextopt, *arg, *val;
        int rc = 0;
index 0686159..89842be 100644 (file)
@@ -634,7 +634,7 @@ struct module_backfs_ops *load_backfs_module(enum ldd_mount_type mount_type)
  * Unload plugin and free backfs_ops structure. Must be called the same number
  * of times as load_backfs_module is.
  */
-void unload_backfs_module(struct module_backfs_ops *ops)
+static void unload_backfs_module(struct module_backfs_ops *ops)
 {
 #ifdef PLUGIN_DIR
        if (!ops)
@@ -646,7 +646,7 @@ void unload_backfs_module(struct module_backfs_ops *ops)
 }
 
 /* Return true if backfs_ops has operations for the given mount_type. */
-int backfs_mount_type_okay(enum ldd_mount_type mount_type)
+static int backfs_mount_type_okay(enum ldd_mount_type mount_type)
 {
        if (mount_type >= LDD_MT_LAST || mount_type < 0) {
                fatal();
index 0138ad0..7bfee69 100644 (file)
@@ -80,32 +80,15 @@ static inline void fhn_replace_init(struct fid_hash_node *old_fhn,
        list_del_init(&old_fhn->fhn_node);
 }
 
-void fid_hash_add(struct list_head *head, unsigned int shift,
-               struct fid_hash_node *fhn)
+static void fid_hash_add(struct list_head *head, unsigned int shift,
+                        struct fid_hash_node *fhn)
 {
        assert(!fhn_is_hashed(fhn));
 
        list_add(&fhn->fhn_node, &head[llapi_fid_hash(&fhn->fhn_fid, shift)]);
 }
 
-struct fid_hash_node *
-fid_hash_find(struct list_head *head, unsigned int shift, const struct lu_fid *fid)
-{
-       struct list_head *hash_list;
-       struct fid_hash_node *fhn, *next;
-
-       hash_list = &head[llapi_fid_hash(fid, shift)];
-       list_for_each_entry_safe(fhn, next, hash_list, fhn_node) {
-               assert(fhn_is_hashed(fhn));
-
-               if (fid_eq(fid, &fhn->fhn_fid))
-                       return fhn;
-       }
-
-       return NULL;
-}
-
-struct fid_hash_node *
+static struct fid_hash_node *
 fid_hash_insert(struct list_head *head, unsigned int shift, struct fid_hash_node *new_fhn)
 {
        struct list_head *list;
@@ -124,7 +107,8 @@ fid_hash_insert(struct list_head *head, unsigned int shift, struct fid_hash_node
        return new_fhn;
 }
 
-int fid_hash_init(struct list_head **phead, unsigned int *pshift, unsigned int shift)
+static int fid_hash_init(struct list_head **phead, unsigned int *pshift,
+                        unsigned int shift)
 {
        struct list_head *new_head;
        unsigned int i;
@@ -142,7 +126,8 @@ int fid_hash_init(struct list_head **phead, unsigned int *pshift, unsigned int s
        return 0;
 }
 
-int fid_hash_resize(struct list_head **phead, unsigned int *pshift, unsigned int new_shift)
+static int fid_hash_resize(struct list_head **phead, unsigned int *pshift,
+                          unsigned int new_shift)
 {
        struct list_head *new_head;
        unsigned int i;
@@ -261,7 +246,7 @@ out:
        return rc;
 }
 
-int sort_compare(const void *a1, const void *a2)
+static int sort_compare(const void *a1, const void *a2)
 {
        int l = *(const int*)a1;
        int r = *(const int *)a2;
index 051b76f..277cbcb 100644 (file)
@@ -681,7 +681,7 @@ static struct alr_dev *alr_dev_create(int epoll_fd, int fd, const char *name,
        return alr;
 }
 
-void usage(void)
+static void usage(void)
 {
        printf("Usage: %s: [OPTION]...\n"
 "Discover, read, batch, and write Lustre access logs\n"
index c29c334..e9b7129 100644 (file)
@@ -48,6 +48,8 @@
 #include <lustre/lustreapi.h>
 #include <lustre_ioctl_old.h>
 
+#include "obdctl.h"
+
 unsigned int libcfs_debug;
 unsigned int libcfs_printk = D_CANTMASK;
 
@@ -60,7 +62,7 @@ static char local_buf[IOC_BUF_SIZE];
 static char *ioc_buf = local_buf;
 
 /* Convert a string boolean to an int; "enable" -> 1 */
-int
+static int
 lnet_parse_bool (int *b, char *str)
 {
        if (!strcasecmp(str, "no") ||
@@ -86,7 +88,7 @@ lnet_parse_bool (int *b, char *str)
        return -1;
 }
 
-int
+static int
 lnet_parse_port(int *port, char *str)
 {
        char *end;
@@ -100,7 +102,7 @@ lnet_parse_port(int *port, char *str)
        return -1;
 }
 
-int
+static int
 lnet_parse_ipquad(__u32 *ipaddrp, char *str)
 {
        int a, b, c, d;
@@ -116,7 +118,7 @@ lnet_parse_ipquad(__u32 *ipaddrp, char *str)
        return -1;
 }
 
-int
+static int
 lnet_parse_ipaddr(__u32 *ipaddrp, char *str)
 {
        struct addrinfo *ai = NULL;
@@ -175,7 +177,7 @@ out:
        return rc;
 }
 
-char *
+static char *
 ptl_ipaddr_2_str(__u32 ipaddr, char *str, size_t strsize, int lookup)
 {
        struct sockaddr_in srcaddr;
@@ -197,7 +199,7 @@ out:
        return str;
 }
 
-int
+static int
 lnet_parse_time(time_t *t, char *str)
 {
        char *end;
@@ -226,7 +228,7 @@ lnet_parse_time(time_t *t, char *str)
        return 0;
 }
 
-int
+static int
 lnet_parse_nid(char *nid_str, struct lnet_processid *id_ptr)
 {
        id_ptr->pid = LNET_PID_ANY;
@@ -2681,26 +2683,6 @@ jt_ptl_delay_list(int argc, char **argv)
        return fault_simul_rule_list(LNET_CTL_DELAY_LIST, "delay", argc, argv);
 }
 
-double
-get_cycles_per_usec()
-{
-       FILE *f = fopen("/proc/cpuinfo", "r");
-       double mhz;
-       char line[64];
-
-       if (f) {
-               while (fgets(line, sizeof(line), f))
-                       if (sscanf(line, "cpu MHz : %lf", &mhz) == 1) {
-                               fclose(f);
-                               return mhz;
-                       }
-               fclose(f);
-       }
-
-       fprintf(stderr, "Can't read/parse /proc/cpuinfo\n");
-       return 1000.0;
-}
-
 int jt_ptl_testprotocompat(int argc, char **argv)
 {
        struct libcfs_ioctl_data  data;