diff options
author | Ulrich Ölmann <u.oelmann@pengutronix.de> | 2019-02-08 08:15:21 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2019-02-11 09:12:36 +0100 |
commit | 0019513c41b0641c6582668f0356663a65ad36d4 (patch) | |
tree | 4f3567e9b77504fe2e2dfe62240f8adfa43b5c60 /common | |
parent | b34b27edaea649b22d17c9be8d8d9f0b0b077471 (diff) | |
download | barebox-0019513c41b0641c6582668f0356663a65ad36d4.tar.gz barebox-0019513c41b0641c6582668f0356663a65ad36d4.tar.xz |
common: state: fix formatting of "off_t" variables
To harmonize the common codebase this ports the following dt-utils commit:
| commit 89d033284cb69f834c1f2195c9e99a3d7f585cf1
| Author: Ulrich Ölmann <u.oelmann@pengutronix.de>
| Date: Sun Feb 3 22:48:06 2019 +0100
|
| state: fix formatting of "off_t" variables
|
| Explicitely casting an "off_t" variable to "long long" and formatting it via
| "%lld" or "%llx" respectively makes 32- as well as 64-bit compilers
| happy (tested with gcc-8.2.1 and clang-7.0.1).
|
| Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
| Signed-off-by: Roland Hieber <rhi@pengutronix.de>
Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r-- | common/state/backend_bucket_circular.c | 32 | ||||
-rw-r--r-- | common/state/backend_storage.c | 20 |
2 files changed, 26 insertions, 26 deletions
diff --git a/common/state/backend_bucket_circular.c b/common/state/backend_bucket_circular.c index 5a85650f40..ae15fa2529 100644 --- a/common/state/backend_bucket_circular.c +++ b/common/state/backend_bucket_circular.c @@ -161,11 +161,11 @@ static int state_mtd_peb_read(struct state_backend_storage_bucket_circular *circ ret = lseek(circ->fd, offset, SEEK_SET); if (ret < 0) { dev_err(circ->dev, "Failed to set circular read position to %lld, %d\n", - offset, ret); + (long long) offset, ret); return ret; } - dev_dbg(circ->dev, "Read state from %ld length %d\n", offset, + dev_dbg(circ->dev, "Read state from %lld length %d\n", (long long) offset, len); @@ -189,15 +189,15 @@ static int state_mtd_peb_write(struct state_backend_storage_bucket_circular *cir ret = lseek(circ->fd, offset, SEEK_SET); if (ret < 0) { - dev_err(circ->dev, "Failed to set position for circular write %ld, %d\n", - offset, ret); + dev_err(circ->dev, "Failed to set position for circular write %lld, %d\n", + (long long) offset, ret); return ret; } ret = write_full(circ->fd, buf, len); if (ret < 0) { - dev_err(circ->dev, "Failed to write circular to %ld length %d, %d\n", - offset, len, ret); + dev_err(circ->dev, "Failed to write circular to %lld length %d, %d\n", + (long long) offset, len, ret); return ret; } @@ -207,8 +207,8 @@ static int state_mtd_peb_write(struct state_backend_storage_bucket_circular *cir */ flush(circ->fd); - dev_dbg(circ->dev, "Written state to offset %ld length %d data length %d\n", - offset, len, len); + dev_dbg(circ->dev, "Written state to offset %lld length %d data length %d\n", + (long long) offset, len, len); return 0; } @@ -265,8 +265,8 @@ static int state_backend_bucket_circular_read(struct state_backend_storage_bucke if (!buf) return -ENOMEM; - dev_dbg(circ->dev, "Read state from PEB %u global offset %ld length %zd\n", - circ->eraseblock, offset, read_len); + dev_dbg(circ->dev, "Read state from PEB %u global offset %lld length %zd\n", + circ->eraseblock, (long long) offset, read_len); ret = state_mtd_peb_read(circ, buf, offset, read_len); if (ret < 0 && ret != -EUCLEAN) { @@ -345,13 +345,13 @@ static int state_backend_bucket_circular_write(struct state_backend_storage_buck ret = state_mtd_peb_write(circ, write_buf, offset, written_length); if (ret < 0 && ret != -EUCLEAN) { - dev_err(circ->dev, "Failed to write circular to %ld length %d, %d\n", - offset, written_length, ret); + dev_err(circ->dev, "Failed to write circular to %lld length %d, %d\n", + (long long) offset, written_length, ret); goto out_free; } - dev_dbg(circ->dev, "Written state to PEB %u offset %ld length %d data length %zd\n", - circ->eraseblock, offset, written_length, len); + dev_dbg(circ->dev, "Written state to PEB %u offset %lld length %d data length %zd\n", + circ->eraseblock, (long long) offset, written_length, len); out_free: free(write_buf); @@ -445,8 +445,8 @@ static int bucket_circular_is_block_bad(struct state_backend_storage_bucket_circ ret = ioctl(circ->fd, MEMGETBADBLOCK, &offs); if (ret < 0) - dev_err(circ->dev, "Failed to use ioctl to check for bad block at offset %ld, %d\n", - offs, ret); + dev_err(circ->dev, "Failed to use ioctl to check for bad block at offset %lld, %d\n", + (long long) offs, ret); return ret; } diff --git a/common/state/backend_storage.c b/common/state/backend_storage.c index c6ebe86244..8cd822eec4 100644 --- a/common/state/backend_storage.c +++ b/common/state/backend_storage.c @@ -111,11 +111,11 @@ refresh: ret = bucket->write(bucket, buf, len); if (ret) { - dev_warn(storage->dev, "Failed to restore bucket %d@0x%08lx\n", - bucket->num, bucket->offset); + dev_warn(storage->dev, "Failed to restore bucket %d@0x%08llx\n", + bucket->num, (long long) bucket->offset); } else { - dev_info(storage->dev, "restored bucket %d@0x%08lx\n", - bucket->num, bucket->offset); + dev_info(storage->dev, "restored bucket %d@0x%08llx\n", + bucket->num, (long long) bucket->offset); bucket->needs_refresh = 0; } @@ -166,7 +166,7 @@ int state_storage_read(struct state_backend_storage *storage, if (!ret && !bucket_used) bucket_used = bucket; if (ret) - dev_info(storage->dev, "Ignoring broken bucket %d@0x%08lx...\n", bucket->num, bucket->offset); + dev_info(storage->dev, "Ignoring broken bucket %d@0x%08llx...\n", bucket->num, (long long) bucket->offset); } dev_dbg(storage->dev, "Checking redundant buckets finished.\n"); @@ -177,7 +177,7 @@ int state_storage_read(struct state_backend_storage *storage, return -ENOENT; } - dev_info(storage->dev, "Using bucket %d@0x%08lx\n", bucket_used->num, bucket_used->offset); + dev_info(storage->dev, "Using bucket %d@0x%08llx\n", bucket_used->num, (long long) bucket_used->offset); /* * Restore/refresh all buckets except the one we currently use (in case @@ -252,8 +252,8 @@ static int state_storage_mtd_buckets_init(struct state_backend_storage *storage, end = meminfo->size; if (!IS_ALIGNED(storage->offset, meminfo->erasesize)) { - dev_err(storage->dev, "Offset within the device is not aligned to eraseblocks. Offset is %ld, erasesize %u\n", - storage->offset, meminfo->erasesize); + dev_err(storage->dev, "Offset within the device is not aligned to eraseblocks. Offset is %lld, erasesize %u\n", + (long long) storage->offset, meminfo->erasesize); return -EINVAL; } @@ -326,8 +326,8 @@ static int state_storage_file_buckets_init(struct state_backend_storage *storage &bucket, offset, stridesize); if (ret) { - dev_warn(storage->dev, "Failed to create direct bucket at '%s' offset %ld\n", - storage->path, offset); + dev_warn(storage->dev, "Failed to create direct bucket at '%s' offset %lld\n", + storage->path, (long long) offset); continue; } |