[sheepdog] [PATCH] fix printf format string
MORITA Kazutaka
morita.kazutaka at lab.ntt.co.jp
Thu Apr 18 01:50:27 CEST 2013
The correct format strings are:
- %zd for ssize_t
- %zu for size_t
- %PRIu64 for uint64_t
Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
sheep/group.c | 2 +-
sheep/journal.c | 5 +++--
sheep/sheep.c | 2 +-
sheep/store.c | 2 +-
sheep/work.c | 4 ++--
shepherd/shepherd.c | 2 +-
6 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/sheep/group.c b/sheep/group.c
index 98b916f..050d0bd 100644
--- a/sheep/group.c
+++ b/sheep/group.c
@@ -921,7 +921,7 @@ void sd_notify_handler(const struct sd_node *sender, void *data,
int ret = msg->rsp.result;
struct request *req = NULL;
- sd_dprintf("op %s, size: %zd, from: %s", op_name(op), data_len,
+ sd_dprintf("op %s, size: %zu, from: %s", op_name(op), data_len,
node_to_str(sender));
if (node_is_local(sender)) {
diff --git a/sheep/journal.c b/sheep/journal.c
index aafa6c2..92f7fa1 100644
--- a/sheep/journal.c
+++ b/sheep/journal.c
@@ -180,7 +180,8 @@ static int replay_journal_entry(struct journal_descriptor *jd)
memcpy(buf, p, jd->size);
size = xpwrite(fd, buf, jd->size, jd->offset);
if (size != jd->size) {
- sd_eprintf("write %zd, size %zu, errno %m", size, jd->size);
+ sd_eprintf("write %zd, size %" PRIu64 ", errno %m", size,
+ jd->size);
ret = -1;
goto out;
}
@@ -399,7 +400,7 @@ static int journal_file_write(struct journal_descriptor *jd, const char *buf)
*/
written = xpwrite(jfile.fd, wbuffer, wsize, woff);
if (written != wsize) {
- sd_eprintf("failed, written %zd, len %zu", written, wsize);
+ sd_eprintf("failed, written %zd, len %zd", written, wsize);
/* FIXME: teach journal file handle EIO gracefully */
ret = SD_RES_EIO;
goto out;
diff --git a/sheep/sheep.c b/sheep/sheep.c
index 0cbf4e9..95bfa9a 100644
--- a/sheep/sheep.c
+++ b/sheep/sheep.c
@@ -636,7 +636,7 @@ int main(int argc, char **argv)
if (!strlen(jpath))
/* internal journal */
memcpy(jpath, dir, strlen(dir));
- sd_dprintf("%s, %zu, %d", jpath, jsize, jskip);
+ sd_dprintf("%s, %zd, %d", jpath, jsize, jskip);
ret = journal_file_init(jpath, jsize, jskip);
if (ret)
exit(1);
diff --git a/sheep/store.c b/sheep/store.c
index cbc6f1c..750b725 100644
--- a/sheep/store.c
+++ b/sheep/store.c
@@ -40,7 +40,7 @@ int update_epoch_log(uint32_t epoch, struct sd_node *nodes, size_t nr_nodes)
time_t t;
char path[PATH_MAX], *buf;
- sd_dprintf("update epoch: %d, %zd", epoch, nr_nodes);
+ sd_dprintf("update epoch: %d, %zu", epoch, nr_nodes);
/* Piggyback the epoch creation time for 'collie cluster info' */
time(&t);
diff --git a/sheep/work.c b/sheep/work.c
index 2e1c8f0..7f1ff6f 100644
--- a/sheep/work.c
+++ b/sheep/work.c
@@ -127,7 +127,7 @@ static int create_worker_threads(struct worker_info *wi, size_t nr_threads)
pthread_mutex_unlock(&wi->startup_lock);
return -1;
}
- sd_dprintf("create thread %s %zd", wi->name, wi->nr_threads);
+ sd_dprintf("create thread %s %zu", wi->name, wi->nr_threads);
}
pthread_mutex_unlock(&wi->startup_lock);
@@ -201,7 +201,7 @@ static void *worker_routine(void *arg)
wi->nr_threads--;
pthread_mutex_unlock(&wi->pending_lock);
pthread_detach(pthread_self());
- sd_dprintf("destroy thread %s %d, %zd", wi->name,
+ sd_dprintf("destroy thread %s %d, %zu", wi->name,
gettid(), wi->nr_threads);
break;
}
diff --git a/shepherd/shepherd.c b/shepherd/shepherd.c
index 7ce25a3..6f0c30a 100644
--- a/shepherd/shepherd.c
+++ b/shepherd/shepherd.c
@@ -211,7 +211,7 @@ static void remove_handler(int fd, int events, void *data)
if (ret < 0)
panic("eventfd_read() failed: %m");
- sd_dprintf("removed sheeps: %lu", val);
+ sd_dprintf("removed sheeps: %" PRIu64, val);
assert(0 < val);
--
1.8.1.3.566.gaa39828
More information about the sheepdog
mailing list