From 42c8a7d87be4a18b3b45bd3d9da1fb05e92d16a9 Mon Sep 17 00:00:00 2001 From: ngie Date: Sat, 31 Dec 2016 10:30:56 +0000 Subject: [PATCH] MFstable/11 r310899: MFC r310666,r310675: r310666: style(9) fixes - Clean up trailing whitespace - Fix variable type alignment in storage_OS_get_swap(..) r310675: Fix the build by moving the initializers for len/nswapdev down below the declarations Pointyhat to: ngie git-svn-id: svn://svn.freebsd.org/base/stable/10@310900 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- .../bsnmpd/modules/snmp_hostres/hostres_device_tbl.c | 2 +- usr.sbin/bsnmpd/modules/snmp_hostres/hostres_fs_tbl.c | 4 ++-- .../modules/snmp_hostres/hostres_partition_tbl.c | 2 +- .../bsnmpd/modules/snmp_hostres/hostres_scalars.c | 8 ++++---- usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c | 6 +++--- .../bsnmpd/modules/snmp_hostres/hostres_storage_tbl.c | 11 +++++++---- .../modules/snmp_hostres/hostres_swinstalled_tbl.c | 10 +++++----- 7 files changed, 23 insertions(+), 20 deletions(-) diff --git a/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_device_tbl.c b/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_device_tbl.c index 1741502b0..8216acce2 100644 --- a/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_device_tbl.c +++ b/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_device_tbl.c @@ -123,7 +123,7 @@ device_entry_create(const char *name, const char *location, const char *descr) if (map == NULL) { /* new object - get a new index */ if (next_device_index > INT_MAX) { - syslog(LOG_ERR, + syslog(LOG_ERR, "%s: hrDeviceTable index wrap", __func__); /* There isn't much we can do here. * If the next_swins_index is consumed diff --git a/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_fs_tbl.c b/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_fs_tbl.c index 91505d594..94706779c 100644 --- a/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_fs_tbl.c +++ b/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_fs_tbl.c @@ -131,7 +131,7 @@ static const struct { const struct asn_oid *oid; /* the OID to return */ } fs_type_map[] = { { "ufs", &OIDX_hrFSBerkeleyFFS_c }, - { "zfs", &OIDX_hrFSOther_c }, + { "zfs", &OIDX_hrFSOther_c }, { "cd9660", &OIDX_hrFSiso9660_c }, { "nfs", &OIDX_hrFSNFS_c }, { "ext2fs", &OIDX_hrFSLinuxExt2_c }, @@ -167,7 +167,7 @@ fs_entry_create(const char *name) /* new object - get a new index */ if (next_fs_index > INT_MAX) { /* Unrecoverable error - die clean and quicly*/ - syslog(LOG_ERR, "%s: hrFSTable index wrap", __func__); + syslog(LOG_ERR, "%s: hrFSTable index wrap", __func__); errx(EX_SOFTWARE, "hrFSTable index wrap"); } diff --git a/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_partition_tbl.c b/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_partition_tbl.c index 65c0012f8..fa0d2bd06 100644 --- a/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_partition_tbl.c +++ b/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_partition_tbl.c @@ -177,7 +177,7 @@ partition_entry_create(int32_t ds_index, const char *chunk_name) if (next_partition_index > INT_MAX) { /* Unrecoverable error - die clean and quicly*/ - syslog(LOG_ERR, "%s: hrPartitionTable index wrap", + syslog(LOG_ERR, "%s: hrPartitionTable index wrap", __func__); errx(EX_SOFTWARE, "hrPartitionTable index wrap"); } diff --git a/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_scalars.c b/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_scalars.c index ee7d4b1b9..f5c2e1107 100644 --- a/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_scalars.c +++ b/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_scalars.c @@ -193,7 +193,7 @@ OS_getSystemInitialLoadParameters(u_char **params) syslog(LOG_ERR, "malloc failed"); return (SNMP_ERR_GENERR); } - if (sysctl(mib, 2, buf, &buf_len, NULL, 0)) { + if (sysctl(mib, 2, buf, &buf_len, NULL, 0)) { syslog(LOG_ERR, "sysctl({CTL_KERN,KERN_BOOTFILE}) failed: %m"); free(buf); @@ -296,7 +296,7 @@ OS_getMemorySize(uint32_t *ms) *ms = UINT32_MAX; else *ms = phys_mem_size; - return (SNMP_ERR_NOERROR); + return (SNMP_ERR_NOERROR); } /* @@ -360,7 +360,7 @@ OS_setSystemDate(const struct timeval *timeval_to_set) if (settimeofday(timeval_to_set, NULL) == -1) { syslog(LOG_ERR, "settimeofday failed: %m"); return (SNMP_ERR_GENERR); - } + } return (SNMP_ERR_NOERROR); } @@ -378,7 +378,7 @@ op_hrSystem(struct snmp_context *ctx, struct snmp_value *value, switch (curr_op) { - case SNMP_OP_GET: + case SNMP_OP_GET: switch (value->var.subs[sub - 1]) { case LEAF_hrSystemUptime: diff --git a/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c b/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c index 26bd91920..4709c9aab 100644 --- a/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c +++ b/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c @@ -163,7 +163,7 @@ hostres_start(void) start_processor_tbl(hostres_module); start_network_tbl(); - HRDBG("done."); + HRDBG("done."); } /* this identifies the HOST RESOURCES mib module */ @@ -175,8 +175,8 @@ const struct snmp_module config = { NULL, NULL, hostres_start, - NULL, /* proxy a PDU */ - hostres_ctree, /* see the generated hostres_tree.h */ + NULL, /* proxy a PDU */ + hostres_ctree, /* see the generated hostres_tree.h */ hostres_CTREE_SIZE, /* see the generated hostres_tree.h */ NULL }; diff --git a/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_storage_tbl.c b/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_storage_tbl.c index ced7e8dd0..f7b6537c2 100644 --- a/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_storage_tbl.c +++ b/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_storage_tbl.c @@ -153,7 +153,7 @@ storage_entry_create(const char *name) if (map == NULL) { /* new object - get a new index */ if (next_storage_index > INT_MAX) { - syslog(LOG_ERR, + syslog(LOG_ERR, "%s: hrStorageTable index wrap", __func__); errx(EX_SOFTWARE, "hrStorageTable index wrap"); } @@ -188,7 +188,7 @@ storage_entry_create(const char *name) syslog(LOG_WARNING, "%s: %m", __func__); return (NULL); } - memset(entry, 0, sizeof(*entry)); + memset(entry, 0, sizeof(*entry)); entry->index = map->hrIndex; @@ -374,10 +374,13 @@ storage_OS_get_memstat(void) static void storage_OS_get_swap(void) { - int nswapdev = 0; - size_t len = sizeof(nswapdev); struct storage_entry *entry; char swap_w_prefix[SE_DESC_MLEN]; + size_t len; + int nswapdev; + + len = sizeof(nswapdev); + nswapdev = 0; if (sysctlbyname("vm.nswapdev", &nswapdev, &len, NULL,0 ) < 0) { syslog(LOG_ERR, diff --git a/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_swinstalled_tbl.c b/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_swinstalled_tbl.c index 5fa5b4ce2..c7eecc5c1 100644 --- a/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_swinstalled_tbl.c +++ b/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_swinstalled_tbl.c @@ -50,7 +50,7 @@ #include "hostres_oid.h" #include "hostres_tree.h" -#define CONTENTS_FNAME "+CONTENTS" +#define CONTENTS_FNAME "+CONTENTS" enum SWInstalledType { SWI_UNKNOWN = 1, @@ -136,7 +136,7 @@ swins_entry_create(const char *name) size_t name_len; /* new object - get a new index */ if (next_swins_index > INT_MAX) { - syslog(LOG_ERR, "%s: hrSWInstalledTable index wrap", + syslog(LOG_ERR, "%s: hrSWInstalledTable index wrap", __func__ ); /* There isn't much we can do here. * If the next_swins_index is consumed @@ -292,7 +292,7 @@ swins_get_packages(void) struct stat sb; DIR *p_dir; struct dirent *ent; - struct tm k_ts; + struct tm k_ts; char *pkg_file; struct swins_entry *entry; int ret = 0; @@ -327,7 +327,7 @@ swins_get_packages(void) return (-1); } - while (errno = 0, (ent = readdir(p_dir)) != NULL) { + while (errno = 0, (ent = readdir(p_dir)) != NULL) { HRDBG(" pkg file: %s", ent->d_name); /* check that the contents file is a regular file */ @@ -371,7 +371,7 @@ swins_get_packages(void) entry->type = (int32_t)SWI_APPLICATION; entry->date_len = make_date_time(entry->date, &k_ts, 0); - } + } if (errno != 0) { syslog(LOG_ERR, "hrSWInstalledTable: readdir_r(\"%s\") failed:" -- 2.45.0