mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-23 10:54:35 +03:00
Use cstyle -cpP in make cstyle check
Enable picky cstyle checks and resolve the new warnings. The vast
majority of the changes needed were to handle minor issues with
whitespace formatting. This patch contains no functional changes.
Non-whitespace changes are as follows:
* 8 times ; to { } in for/while loop
* fix missing ; in cmd/zed/agents/zfs_diagnosis.c
* comment (confim -> confirm)
* change endline , to ; in cmd/zpool/zpool_main.c
* a number of /* BEGIN CSTYLED */ /* END CSTYLED */ blocks
* /* CSTYLED */ markers
* change == 0 to !
* ulong to unsigned long in module/zfs/dsl_scan.c
* rearrangement of module_param lines in module/zfs/metaslab.c
* add { } block around statement after for_each_online_node
Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Reviewed-by: Håkan Johansson <f96hajo@chalmers.se>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #5465
This commit is contained in:
@@ -378,7 +378,7 @@ zfs_case_solve(fmd_hdl_t *hdl, zfs_case_t *zcp, const char *faultname,
|
||||
boolean_t serialize;
|
||||
nvlist_t *fru = NULL;
|
||||
#ifdef _HAS_FMD_TOPO
|
||||
nvlist_t *fmri
|
||||
nvlist_t *fmri;
|
||||
topo_hdl_t *thp;
|
||||
int err;
|
||||
#endif
|
||||
|
||||
@@ -343,7 +343,7 @@ zfs_process_add(zpool_handle_t *zhp, nvlist_t *vdev, boolean_t labeled)
|
||||
list_insert_tail(&g_device_list, device);
|
||||
|
||||
zed_log_msg(LOG_INFO, " zpool_label_disk: async '%s' (%llu)",
|
||||
leafname, (u_longlong_t) guid);
|
||||
leafname, (u_longlong_t)guid);
|
||||
|
||||
return; /* resumes at EC_DEV_ADD.ESC_DISK for partition */
|
||||
|
||||
@@ -373,7 +373,7 @@ zfs_process_add(zpool_handle_t *zhp, nvlist_t *vdev, boolean_t labeled)
|
||||
}
|
||||
|
||||
zed_log_msg(LOG_INFO, " zpool_label_disk: resume '%s' (%llu)",
|
||||
physpath, (u_longlong_t) guid);
|
||||
physpath, (u_longlong_t)guid);
|
||||
|
||||
(void) snprintf(devpath, sizeof (devpath), "%s%s",
|
||||
DEV_BYID_PATH, new_devid);
|
||||
|
||||
@@ -417,11 +417,11 @@ zfs_retire_recv(fmd_hdl_t *hdl, fmd_event_t *ep, nvlist_t *nvl,
|
||||
|
||||
/*
|
||||
* Note: on zfsonlinux statechange events are more than just
|
||||
* healthy ones so we need to confim the actual state value.
|
||||
* healthy ones so we need to confirm the actual state value.
|
||||
*/
|
||||
if (strcmp(class, "resource.fs.zfs.statechange") == 0 &&
|
||||
nvlist_lookup_uint64(nvl, FM_EREPORT_PAYLOAD_ZFS_VDEV_STATE,
|
||||
&state) == 0 && state == VDEV_STATE_HEALTHY) {;
|
||||
&state) == 0 && state == VDEV_STATE_HEALTHY) {
|
||||
zfs_vdev_repair(hdl, nvl);
|
||||
return;
|
||||
}
|
||||
|
||||
+1
-1
@@ -255,7 +255,7 @@ main(int argc, char *argv[])
|
||||
|
||||
zed_log_msg(LOG_NOTICE,
|
||||
"ZFS Event Daemon %s-%s (PID %d)",
|
||||
ZFS_META_VERSION, ZFS_META_RELEASE, (int) getpid());
|
||||
ZFS_META_VERSION, ZFS_META_RELEASE, (int)getpid());
|
||||
|
||||
if (zed_conf_open_state(zcp) < 0)
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
+3
-3
@@ -513,7 +513,7 @@ zed_conf_write_pid(struct zed_conf *zcp)
|
||||
/*
|
||||
* Write PID file.
|
||||
*/
|
||||
n = snprintf(buf, sizeof (buf), "%d\n", (int) getpid());
|
||||
n = snprintf(buf, sizeof (buf), "%d\n", (int)getpid());
|
||||
if ((n < 0) || (n >= sizeof (buf))) {
|
||||
errno = ERANGE;
|
||||
zed_log_msg(LOG_ERR, "Failed to write PID file \"%s\": %s",
|
||||
@@ -637,7 +637,7 @@ zed_conf_read_state(struct zed_conf *zcp, uint64_t *eidp, int64_t etime[])
|
||||
"Failed to read state file: %s", strerror(errno));
|
||||
return (-1);
|
||||
}
|
||||
if (lseek(zcp->state_fd, 0, SEEK_SET) == (off_t) -1) {
|
||||
if (lseek(zcp->state_fd, 0, SEEK_SET) == (off_t)-1) {
|
||||
zed_log_msg(LOG_WARNING,
|
||||
"Failed to reposition state file offset: %s",
|
||||
strerror(errno));
|
||||
@@ -687,7 +687,7 @@ zed_conf_write_state(struct zed_conf *zcp, uint64_t eid, int64_t etime[])
|
||||
"Failed to write state file: %s", strerror(errno));
|
||||
return (-1);
|
||||
}
|
||||
if (lseek(zcp->state_fd, 0, SEEK_SET) == (off_t) -1) {
|
||||
if (lseek(zcp->state_fd, 0, SEEK_SET) == (off_t)-1) {
|
||||
zed_log_msg(LOG_WARNING,
|
||||
"Failed to reposition state file offset: %s",
|
||||
strerror(errno));
|
||||
|
||||
@@ -283,7 +283,7 @@ zed_udev_monitor(void *arg)
|
||||
if (strcmp(class, EC_DEV_STATUS) == 0 &&
|
||||
udev_device_get_property_value(dev, "DM_UUID") &&
|
||||
udev_device_get_property_value(dev, "MPATH_SBIN_PATH")) {
|
||||
tmp = (char *) udev_device_get_devnode(dev);
|
||||
tmp = (char *)udev_device_get_devnode(dev);
|
||||
tmp2 = zfs_get_underlying_path(tmp);
|
||||
if (tmp && tmp2 && (strcmp(tmp, tmp2) != 0)) {
|
||||
/*
|
||||
|
||||
+11
-11
@@ -489,7 +489,7 @@ _zed_event_add_int64_array(uint64_t eid, zed_strings_t *zsp,
|
||||
name = nvpair_name(nvp);
|
||||
(void) nvpair_value_int64_array(nvp, &i64p, &nelem);
|
||||
for (i = 0, p = buf; (i < nelem) && (buflen > 0); i++) {
|
||||
n = snprintf(p, buflen, "%lld ", (u_longlong_t) i64p[i]);
|
||||
n = snprintf(p, buflen, "%lld ", (u_longlong_t)i64p[i]);
|
||||
if ((n < 0) || (n >= buflen))
|
||||
return (_zed_event_add_array_err(eid, name));
|
||||
p += n;
|
||||
@@ -521,7 +521,7 @@ _zed_event_add_uint64_array(uint64_t eid, zed_strings_t *zsp,
|
||||
fmt = _zed_event_value_is_hex(name) ? "0x%.16llX " : "%llu ";
|
||||
(void) nvpair_value_uint64_array(nvp, &u64p, &nelem);
|
||||
for (i = 0, p = buf; (i < nelem) && (buflen > 0); i++) {
|
||||
n = snprintf(p, buflen, fmt, (u_longlong_t) u64p[i]);
|
||||
n = snprintf(p, buflen, fmt, (u_longlong_t)u64p[i]);
|
||||
if ((n < 0) || (n >= buflen))
|
||||
return (_zed_event_add_array_err(eid, name));
|
||||
p += n;
|
||||
@@ -603,7 +603,7 @@ _zed_event_add_nvpair(uint64_t eid, zed_strings_t *zsp, nvpair_t *nvp)
|
||||
_zed_event_add_var(eid, zsp, prefix, name, "%d", i8);
|
||||
break;
|
||||
case DATA_TYPE_INT8:
|
||||
(void) nvpair_value_int8(nvp, (int8_t *) &i8);
|
||||
(void) nvpair_value_int8(nvp, (int8_t *)&i8);
|
||||
_zed_event_add_var(eid, zsp, prefix, name, "%d", i8);
|
||||
break;
|
||||
case DATA_TYPE_UINT8:
|
||||
@@ -611,7 +611,7 @@ _zed_event_add_nvpair(uint64_t eid, zed_strings_t *zsp, nvpair_t *nvp)
|
||||
_zed_event_add_var(eid, zsp, prefix, name, "%u", i8);
|
||||
break;
|
||||
case DATA_TYPE_INT16:
|
||||
(void) nvpair_value_int16(nvp, (int16_t *) &i16);
|
||||
(void) nvpair_value_int16(nvp, (int16_t *)&i16);
|
||||
_zed_event_add_var(eid, zsp, prefix, name, "%d", i16);
|
||||
break;
|
||||
case DATA_TYPE_UINT16:
|
||||
@@ -619,7 +619,7 @@ _zed_event_add_nvpair(uint64_t eid, zed_strings_t *zsp, nvpair_t *nvp)
|
||||
_zed_event_add_var(eid, zsp, prefix, name, "%u", i16);
|
||||
break;
|
||||
case DATA_TYPE_INT32:
|
||||
(void) nvpair_value_int32(nvp, (int32_t *) &i32);
|
||||
(void) nvpair_value_int32(nvp, (int32_t *)&i32);
|
||||
_zed_event_add_var(eid, zsp, prefix, name, "%d", i32);
|
||||
break;
|
||||
case DATA_TYPE_UINT32:
|
||||
@@ -627,15 +627,15 @@ _zed_event_add_nvpair(uint64_t eid, zed_strings_t *zsp, nvpair_t *nvp)
|
||||
_zed_event_add_var(eid, zsp, prefix, name, "%u", i32);
|
||||
break;
|
||||
case DATA_TYPE_INT64:
|
||||
(void) nvpair_value_int64(nvp, (int64_t *) &i64);
|
||||
(void) nvpair_value_int64(nvp, (int64_t *)&i64);
|
||||
_zed_event_add_var(eid, zsp, prefix, name,
|
||||
"%lld", (longlong_t) i64);
|
||||
"%lld", (longlong_t)i64);
|
||||
break;
|
||||
case DATA_TYPE_UINT64:
|
||||
(void) nvpair_value_uint64(nvp, &i64);
|
||||
_zed_event_add_var(eid, zsp, prefix, name,
|
||||
(_zed_event_value_is_hex(name) ? "0x%.16llX" : "%llu"),
|
||||
(u_longlong_t) i64);
|
||||
(u_longlong_t)i64);
|
||||
/*
|
||||
* shadow readable strings for vdev state pairs
|
||||
*/
|
||||
@@ -653,9 +653,9 @@ _zed_event_add_nvpair(uint64_t eid, zed_strings_t *zsp, nvpair_t *nvp)
|
||||
_zed_event_add_var(eid, zsp, prefix, name, "%g", d);
|
||||
break;
|
||||
case DATA_TYPE_HRTIME:
|
||||
(void) nvpair_value_hrtime(nvp, (hrtime_t *) &i64);
|
||||
(void) nvpair_value_hrtime(nvp, (hrtime_t *)&i64);
|
||||
_zed_event_add_var(eid, zsp, prefix, name,
|
||||
"%llu", (u_longlong_t) i64);
|
||||
"%llu", (u_longlong_t)i64);
|
||||
break;
|
||||
case DATA_TYPE_NVLIST:
|
||||
_zed_event_add_var(eid, zsp, prefix, name,
|
||||
@@ -889,7 +889,7 @@ zed_event_service(struct zed_conf *zcp)
|
||||
_zed_event_add_env_preserve(eid, zsp);
|
||||
|
||||
_zed_event_add_var(eid, zsp, ZED_VAR_PREFIX, "PID",
|
||||
"%d", (int) getpid());
|
||||
"%d", (int)getpid());
|
||||
_zed_event_add_var(eid, zsp, ZED_VAR_PREFIX, "ZEDLET_DIR",
|
||||
"%s", zcp->zedlet_dir);
|
||||
subclass = _zed_event_get_subclass(class);
|
||||
|
||||
+3
-3
@@ -54,7 +54,7 @@ _zed_exec_create_env(zed_strings_t *zsp)
|
||||
if (!buf)
|
||||
return (NULL);
|
||||
|
||||
pp = (char **) buf;
|
||||
pp = (char **)buf;
|
||||
p = buf + (num_ptrs * sizeof (char *));
|
||||
i = 0;
|
||||
for (q = zed_strings_first(zsp); q; q = zed_strings_next(zsp)) {
|
||||
@@ -66,7 +66,7 @@ _zed_exec_create_env(zed_strings_t *zsp)
|
||||
}
|
||||
pp[i] = NULL;
|
||||
assert(buf + buflen == p);
|
||||
return ((char **) buf);
|
||||
return ((char **)buf);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -131,7 +131,7 @@ _zed_exec_fork_child(uint64_t eid, const char *dir, const char *prog,
|
||||
*/
|
||||
for (n = 0; n < 1000; n++) {
|
||||
wpid = waitpid(pid, &status, WNOHANG);
|
||||
if (wpid == (pid_t) -1) {
|
||||
if (wpid == (pid_t)-1) {
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
zed_log_msg(LOG_WARNING,
|
||||
|
||||
+8
-8
@@ -66,11 +66,11 @@ zed_log_pipe_open(void)
|
||||
{
|
||||
if ((_ctx.pipe_fd[0] != -1) || (_ctx.pipe_fd[1] != -1))
|
||||
zed_log_die("Invalid use of zed_log_pipe_open in PID %d",
|
||||
(int) getpid());
|
||||
(int)getpid());
|
||||
|
||||
if (pipe(_ctx.pipe_fd) < 0)
|
||||
zed_log_die("Failed to create daemonize pipe in PID %d: %s",
|
||||
(int) getpid(), strerror(errno));
|
||||
(int)getpid(), strerror(errno));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -85,12 +85,12 @@ zed_log_pipe_close_reads(void)
|
||||
if (_ctx.pipe_fd[0] < 0)
|
||||
zed_log_die(
|
||||
"Invalid use of zed_log_pipe_close_reads in PID %d",
|
||||
(int) getpid());
|
||||
(int)getpid());
|
||||
|
||||
if (close(_ctx.pipe_fd[0]) < 0)
|
||||
zed_log_die(
|
||||
"Failed to close reads on daemonize pipe in PID %d: %s",
|
||||
(int) getpid(), strerror(errno));
|
||||
(int)getpid(), strerror(errno));
|
||||
|
||||
_ctx.pipe_fd[0] = -1;
|
||||
}
|
||||
@@ -110,12 +110,12 @@ zed_log_pipe_close_writes(void)
|
||||
if (_ctx.pipe_fd[1] < 0)
|
||||
zed_log_die(
|
||||
"Invalid use of zed_log_pipe_close_writes in PID %d",
|
||||
(int) getpid());
|
||||
(int)getpid());
|
||||
|
||||
if (close(_ctx.pipe_fd[1]) < 0)
|
||||
zed_log_die(
|
||||
"Failed to close writes on daemonize pipe in PID %d: %s",
|
||||
(int) getpid(), strerror(errno));
|
||||
(int)getpid(), strerror(errno));
|
||||
|
||||
_ctx.pipe_fd[1] = -1;
|
||||
}
|
||||
@@ -135,7 +135,7 @@ zed_log_pipe_wait(void)
|
||||
|
||||
if (_ctx.pipe_fd[0] < 0)
|
||||
zed_log_die("Invalid use of zed_log_pipe_wait in PID %d",
|
||||
(int) getpid());
|
||||
(int)getpid());
|
||||
|
||||
for (;;) {
|
||||
n = read(_ctx.pipe_fd[0], &c, sizeof (c));
|
||||
@@ -144,7 +144,7 @@ zed_log_pipe_wait(void)
|
||||
continue;
|
||||
zed_log_die(
|
||||
"Failed to read from daemonize pipe in PID %d: %s",
|
||||
(int) getpid(), strerror(errno));
|
||||
(int)getpid(), strerror(errno));
|
||||
}
|
||||
if (n == 0) {
|
||||
break;
|
||||
|
||||
@@ -206,7 +206,7 @@ zed_strings_first(zed_strings_t *zsp)
|
||||
if (!zsp->iteratorp)
|
||||
return (NULL);
|
||||
|
||||
return (((zed_strings_node_t *) zsp->iteratorp)->val);
|
||||
return (((zed_strings_node_t *)zsp->iteratorp)->val);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -17,16 +17,11 @@
|
||||
|
||||
typedef struct zed_strings zed_strings_t;
|
||||
|
||||
zed_strings_t * zed_strings_create(void);
|
||||
|
||||
zed_strings_t *zed_strings_create(void);
|
||||
void zed_strings_destroy(zed_strings_t *zsp);
|
||||
|
||||
int zed_strings_add(zed_strings_t *zsp, const char *key, const char *s);
|
||||
|
||||
const char * zed_strings_first(zed_strings_t *zsp);
|
||||
|
||||
const char * zed_strings_next(zed_strings_t *zsp);
|
||||
|
||||
const char *zed_strings_first(zed_strings_t *zsp);
|
||||
const char *zed_strings_next(zed_strings_t *zsp);
|
||||
int zed_strings_count(zed_strings_t *zsp);
|
||||
|
||||
#endif /* !ZED_STRINGS_H */
|
||||
|
||||
Reference in New Issue
Block a user