diff --git a/isobusfs/isobusfs_cli_cm.c b/isobusfs/isobusfs_cli_cm.c index 8f346b0..5cece2b 100644 --- a/isobusfs/isobusfs_cli_cm.c +++ b/isobusfs/isobusfs_cli_cm.c @@ -2,6 +2,7 @@ // SPDX-FileCopyrightText: 2023 Oleksij Rempel #include +#include #include #include @@ -95,7 +96,7 @@ int isobusfs_cli_ccm_send(struct isobusfs_priv *priv) } if (time_diff < -ISOBUSFS_CM_F_FS_STATUS_RATE_JITTER) { - pr_warn("too late to send next fs status message: %ld ms", + pr_warn("too late to send next fs status message: %" PRId64 " ms", time_diff); } @@ -152,7 +153,7 @@ static int isobusfs_cli_rx_fs_status(struct isobusfs_priv *priv, int ret = 0; if (msg->len != sizeof(*fs_status)) { - pr_warn("wrong message length: %d", msg->len); + pr_warn("wrong message length: %zd", msg->len); return -EINVAL; } @@ -178,7 +179,7 @@ static int isobusfs_cli_rx_fs_property_res(struct isobusfs_priv *priv, } if (msg->len != sizeof(*fs_prop)) { - pr_warn("wrong message length: %d", msg->len); + pr_warn("wrong message length: %zd", msg->len); return -EINVAL; } diff --git a/isobusfs/isobusfs_cli_dh.c b/isobusfs/isobusfs_cli_dh.c index c7b5070..999dfe5 100644 --- a/isobusfs/isobusfs_cli_dh.c +++ b/isobusfs/isobusfs_cli_dh.c @@ -21,7 +21,7 @@ int isobusfs_cli_ccd_req(struct isobusfs_priv *priv, const char *name, int ret; if (name_len > ISOBUSFS_MAX_PATH_NAME_LENGTH) { - pr_warn("path name too long: %i, max is %i", name_len, + pr_warn("path name too long: %zu, max is %i", name_len, ISOBUSFS_MAX_PATH_NAME_LENGTH); return -EINVAL; } diff --git a/isobusfs/isobusfs_cli_fa.c b/isobusfs/isobusfs_cli_fa.c index 6bd1594..e271e1f 100644 --- a/isobusfs/isobusfs_cli_fa.c +++ b/isobusfs/isobusfs_cli_fa.c @@ -286,7 +286,7 @@ int isobusfs_cli_fa_of_req(struct isobusfs_priv *priv, const char *name, int ret; if (name_len > ISOBUSFS_MAX_PATH_NAME_LENGTH) { - pr_warn("path name too long: %i, max is %i", name_len, + pr_warn("path name too long: %zu, max is %i", name_len, ISOBUSFS_MAX_PATH_NAME_LENGTH); return -EINVAL; } diff --git a/isobusfs/isobusfs_cli_int.c b/isobusfs/isobusfs_cli_int.c index b2c4cd6..8347505 100644 --- a/isobusfs/isobusfs_cli_int.c +++ b/isobusfs/isobusfs_cli_int.c @@ -547,9 +547,9 @@ isobusfs_cli_ls_handle_seek_dir_sent(struct isobusfs_priv *priv, if (isobusfs_cli_int_is_error(priv, 0, res->error_code, res->tan)) goto error; - if (res->position != ctx->offset) { - pr_int("Failed to seek to position %zu, got %zu\n", - ctx->offset, res->position); + if (le32toh(res->position) != ctx->offset) { + pr_int("Failed to seek to position %zu, got %u\n", + ctx->offset, le32toh(res->position)); goto error; } @@ -868,7 +868,7 @@ static void isobusfs_cli_process_ls_command(struct isobusfs_priv *priv, ctx->handle, NULL, NULL); } - pr_int("Entries found: %i\n", ctx->entry_count); + pr_int("Entries found: %zu\n", ctx->entry_count); priv->int_busy = false; isobusfs_cli_ls_free_ctx(ctx); isobusfs_cli_promt(priv); diff --git a/isobusfs/isobusfs_cmn.c b/isobusfs/isobusfs_cmn.c index 3649827..1c906ce 100644 --- a/isobusfs/isobusfs_cmn.c +++ b/isobusfs/isobusfs_cmn.c @@ -443,8 +443,8 @@ void isobusfs_dump_tx_data(const struct isobusfs_buf_log *buffer) for (j = 0; j < ISOBUSFS_MIN_TRANSFER_LENGH; ++j) snprintf(data_str + j * 3, 4, "%02X ", entry->data[j]); - pr_debug("Entry %u: %s Timestamp: %ld.%09ld\n", i, data_str, - entry->ts.tv_sec, entry->ts.tv_nsec); + pr_debug("Entry %u: %s Timestamp: %lld.%09ld\n", i, data_str, + (long long)entry->ts.tv_sec, entry->ts.tv_nsec); } } diff --git a/isobusfs/isobusfs_cmn.h b/isobusfs/isobusfs_cmn.h index 23fa582..28a2362 100644 --- a/isobusfs/isobusfs_cmn.h +++ b/isobusfs/isobusfs_cmn.h @@ -322,7 +322,8 @@ typedef enum { } log_level_t; void isobusfs_log_level_set(log_level_t level); -void isobusfs_log(log_level_t level, const char *fmt, ...); +void isobusfs_log(log_level_t level, const char *fmt, ...) + __attribute__((format(printf, 2, 3))); void isobusfs_set_interactive(bool interactive); void isobusfs_print_log_buffer(void); diff --git a/isobusfs/isobusfs_srv_cm_fss.c b/isobusfs/isobusfs_srv_cm_fss.c index 45996be..156c02e 100644 --- a/isobusfs/isobusfs_srv_cm_fss.c +++ b/isobusfs/isobusfs_srv_cm_fss.c @@ -97,7 +97,7 @@ int isobusfs_srv_fss_send(struct isobusfs_srv_priv *priv) } if (time_diff < -ISOBUSFS_CM_F_FS_STATUS_RATE_JITTER) { - pr_warn("too late to send next fs status message: %ld ms", + pr_warn("too late to send next fs status message: %" PRId64 " ms", time_diff); } diff --git a/isobusfs/isobusfs_srv_dh.c b/isobusfs/isobusfs_srv_dh.c index b17dbc4..7a2aed4 100644 --- a/isobusfs/isobusfs_srv_dh.c +++ b/isobusfs/isobusfs_srv_dh.c @@ -132,7 +132,7 @@ int isobusfs_check_current_dir_access(struct isobusfs_srv_priv *priv, return ret; pr_debug("convert ISOBUS FS path to linux path: %.*s -> %s", - path_size, path, linux_path); + (int)path_size, path, linux_path); ret = isobusfs_cmn_dh_validate_dir_path(linux_path, false); if (ret < 0) diff --git a/isobusfs/isobusfs_srv_fa.c b/isobusfs/isobusfs_srv_fa.c index 06c50a0..675e84b 100644 --- a/isobusfs/isobusfs_srv_fa.c +++ b/isobusfs/isobusfs_srv_fa.c @@ -287,7 +287,7 @@ static int isobusfs_srv_fa_open_file(struct isobusfs_srv_priv *priv, return ret; pr_debug("convert ISOBUS FS path to linux path: %.*s -> %s", - path_len, path, linux_path); + (int)path_len, path, linux_path); /* Determine open flags based on the requested access type */ switch (flags & ISOBUSFS_FA_OPEN_MASK) { @@ -847,7 +847,7 @@ send_response: goto free_res; } - pr_debug("> tx: Read File Response. Error code: %d (%s), read size: %d", + pr_debug("> tx: Read File Response. Error code: %d (%s), read size: %zd", error_code, isobusfs_error_to_str(error_code), readed_size); free_res: