client/server: bool conversion
authorJens Axboe <axboe@kernel.dk>
Thu, 22 Jun 2017 20:10:23 +0000 (14:10 -0600)
committerJens Axboe <axboe@kernel.dk>
Thu, 22 Jun 2017 20:12:39 +0000 (14:12 -0600)
Signed-off-by: Jens Axboe <axboe@kernel.dk>
client.c
client.h
server.c
server.h

index 81119c2eee19a298efc1b9d62d21678500f019fd..7a986aae8110942f2cf175015e24f7f2447d3add 100644 (file)
--- a/client.c
+++ b/client.c
@@ -318,7 +318,7 @@ struct fio_client *fio_client_add_explicit(struct client_ops *ops,
        client->hostname = strdup(hostname);
 
        if (type == Fio_client_socket)
        client->hostname = strdup(hostname);
 
        if (type == Fio_client_socket)
-               client->is_sock = 1;
+               client->is_sock = true;
        else {
                int ipv6;
 
        else {
                int ipv6;
 
@@ -728,7 +728,7 @@ static int __fio_client_send_remote_ini(struct fio_client *client,
        strcpy((char *) pdu->file, filename);
        pdu->client_type = cpu_to_le16((uint16_t) client->type);
 
        strcpy((char *) pdu->file, filename);
        pdu->client_type = cpu_to_le16((uint16_t) client->type);
 
-       client->sent_job = 1;
+       client->sent_job = true;
        ret = fio_net_send_cmd(client->fd, FIO_NET_CMD_LOAD_FILE, pdu, p_size,NULL, NULL);
        free(pdu);
        return ret;
        ret = fio_net_send_cmd(client->fd, FIO_NET_CMD_LOAD_FILE, pdu, p_size,NULL, NULL);
        free(pdu);
        return ret;
@@ -781,7 +781,7 @@ static int __fio_client_send_local_ini(struct fio_client *client,
        pdu->buf_len = __cpu_to_le32(sb.st_size);
        pdu->client_type = cpu_to_le32(client->type);
 
        pdu->buf_len = __cpu_to_le32(sb.st_size);
        pdu->client_type = cpu_to_le32(client->type);
 
-       client->sent_job = 1;
+       client->sent_job = true;
        ret = fio_net_send_cmd(client->fd, FIO_NET_CMD_JOB, pdu, p_size, NULL, NULL);
        free(pdu);
        close(fd);
        ret = fio_net_send_cmd(client->fd, FIO_NET_CMD_JOB, pdu, p_size, NULL, NULL);
        free(pdu);
        close(fd);
@@ -799,7 +799,7 @@ int fio_client_send_ini(struct fio_client *client, const char *filename,
                ret = __fio_client_send_remote_ini(client, filename);
 
        if (!ret)
                ret = __fio_client_send_remote_ini(client, filename);
 
        if (!ret)
-               client->sent_job = 1;
+               client->sent_job = true;
 
        return ret;
 }
 
        return ret;
 }
@@ -1003,7 +1003,7 @@ static void handle_ts(struct fio_client *client, struct fio_net_cmd *cmd)
                opt_list = &client->opt_lists[p->ts.thread_number - 1];
 
        tsobj = show_thread_status(&p->ts, &p->rs, opt_list, NULL);
                opt_list = &client->opt_lists[p->ts.thread_number - 1];
 
        tsobj = show_thread_status(&p->ts, &p->rs, opt_list, NULL);
-       client->did_stat = 1;
+       client->did_stat = true;
        if (tsobj) {
                json_object_add_client_info(tsobj, client);
                json_array_add_value_object(clients_array, tsobj);
        if (tsobj) {
                json_object_add_client_info(tsobj, client);
                json_array_add_value_object(clients_array, tsobj);
@@ -1125,7 +1125,7 @@ static void handle_du(struct fio_client *client, struct fio_net_cmd *cmd)
        struct cmd_du_pdu *du = (struct cmd_du_pdu *) cmd->payload;
 
        if (!client->disk_stats_shown) {
        struct cmd_du_pdu *du = (struct cmd_du_pdu *) cmd->payload;
 
        if (!client->disk_stats_shown) {
-               client->disk_stats_shown = 1;
+               client->disk_stats_shown = true;
                log_info("\nDisk stats (read/write):\n");
        }
 
                log_info("\nDisk stats (read/write):\n");
        }
 
index fc9c19693a9ff0c60bfcee6429755344b72cdfdf..394b685df70f608a9a7bb3535c2a4a92239684f5 100644 (file)
--- a/client.h
+++ b/client.h
@@ -6,6 +6,7 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 
 #include <netinet/in.h>
 #include <arpa/inet.h>
 
+#include "lib/types.h"
 #include "stat.h"
 
 struct fio_net_cmd;
 #include "stat.h"
 
 struct fio_net_cmd;
@@ -45,16 +46,16 @@ struct fio_client {
 
        int state;
 
 
        int state;
 
-       int skip_newline;
-       int is_sock;
-       int disk_stats_shown;
+       bool skip_newline;
+       bool is_sock;
+       bool disk_stats_shown;
        unsigned int jobs;
        unsigned int nr_stat;
        int error;
        int signal;
        int ipv6;
        unsigned int jobs;
        unsigned int nr_stat;
        int error;
        int signal;
        int ipv6;
-       int sent_job;
-       int did_stat;
+       bool sent_job;
+       bool did_stat;
        uint32_t type;
 
        uint32_t thread_number;
        uint32_t type;
 
        uint32_t thread_number;
index b0a6e876a465c6cd82582ede3f45a525aeba3c69..8b36e3837f9dc0a17e5a29b567a48e46c8bbb951 100644 (file)
--- a/server.c
+++ b/server.c
@@ -2270,7 +2270,7 @@ int fio_server_parse_host(const char *host, int ipv6, struct in_addr *inp,
  * For local domain sockets:
  *     *ptr is the filename, *is_sock is 1.
  */
  * For local domain sockets:
  *     *ptr is the filename, *is_sock is 1.
  */
-int fio_server_parse_string(const char *str, char **ptr, int *is_sock,
+int fio_server_parse_string(const char *str, char **ptr, bool *is_sock,
                            int *port, struct in_addr *inp,
                            struct in6_addr *inp6, int *ipv6)
 {
                            int *port, struct in_addr *inp,
                            struct in6_addr *inp6, int *ipv6)
 {
@@ -2279,13 +2279,13 @@ int fio_server_parse_string(const char *str, char **ptr, int *is_sock,
        int lport = 0;
 
        *ptr = NULL;
        int lport = 0;
 
        *ptr = NULL;
-       *is_sock = 0;
+       *is_sock = false;
        *port = fio_net_port;
        *ipv6 = 0;
 
        if (!strncmp(str, "sock:", 5)) {
                *ptr = strdup(str + 5);
        *port = fio_net_port;
        *ipv6 = 0;
 
        if (!strncmp(str, "sock:", 5)) {
                *ptr = strdup(str + 5);
-               *is_sock = 1;
+               *is_sock = true;
 
                return 0;
        }
 
                return 0;
        }
@@ -2364,7 +2364,8 @@ int fio_server_parse_string(const char *str, char **ptr, int *is_sock,
 static int fio_handle_server_arg(void)
 {
        int port = fio_net_port;
 static int fio_handle_server_arg(void)
 {
        int port = fio_net_port;
-       int is_sock, ret = 0;
+       bool is_sock;
+       int ret = 0;
 
        saddr_in.sin_addr.s_addr = htonl(INADDR_ANY);
 
 
        saddr_in.sin_addr.s_addr = htonl(INADDR_ANY);
 
index 468fd32c217069c0baf02f909685916e79ec35c9..7f235f3dceb43222290a1acf3273b7864ee1dcdd 100644 (file)
--- a/server.h
+++ b/server.h
@@ -212,7 +212,7 @@ extern int fio_server_text_output(int, const char *, size_t);
 extern int fio_net_send_cmd(int, uint16_t, const void *, off_t, uint64_t *, struct flist_head *);
 extern int fio_net_send_simple_cmd(int, uint16_t, uint64_t, struct flist_head *);
 extern void fio_server_set_arg(const char *);
 extern int fio_net_send_cmd(int, uint16_t, const void *, off_t, uint64_t *, struct flist_head *);
 extern int fio_net_send_simple_cmd(int, uint16_t, uint64_t, struct flist_head *);
 extern void fio_server_set_arg(const char *);
-extern int fio_server_parse_string(const char *, char **, int *, int *, struct in_addr *, struct in6_addr *, int *);
+extern int fio_server_parse_string(const char *, char **, bool *, int *, struct in_addr *, struct in6_addr *, int *);
 extern int fio_server_parse_host(const char *, int, struct in_addr *, struct in6_addr *);
 extern const char *fio_server_op(unsigned int);
 extern void fio_server_got_signal(int);
 extern int fio_server_parse_host(const char *, int, struct in_addr *, struct in6_addr *);
 extern const char *fio_server_op(unsigned int);
 extern void fio_server_got_signal(int);