mailarchive of the pengutronix oss-tools mailing list
 help / color / mirror / Atom feed
From: "Ulrich Ölmann" <u.oelmann@pengutronix.de>
To: Pengutronix Public Open-Source-Development <oss-tools@pengutronix.de>
Cc: "Ulrich Ölmann" <u.oelmann@pengutronix.de>, entwicklung@pengutronix.de
Subject: [OSS-Tools] [PATCH dt-utils 11/12] state: fix formatting of "off_t" variables
Date: Sun,  3 Feb 2019 22:48:06 +0100	[thread overview]
Message-ID: <20190203214807.13643-12-u.oelmann@pengutronix.de> (raw)
In-Reply-To: <20190203214807.13643-1-u.oelmann@pengutronix.de>

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>
---
 src/barebox-state/backend_bucket_circular.c | 32 ++++++++++-----------
 src/barebox-state/backend_storage.c         | 20 ++++++-------
 2 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/src/barebox-state/backend_bucket_circular.c b/src/barebox-state/backend_bucket_circular.c
index fc6911ac717c..e96849df9220 100644
--- a/src/barebox-state/backend_bucket_circular.c
+++ b/src/barebox-state/backend_bucket_circular.c
@@ -165,11 +165,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);
 
 
@@ -194,15 +194,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;
 	}
 
@@ -212,8 +212,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;
 }
@@ -270,8 +270,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) {
@@ -350,13 +350,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);
@@ -450,8 +450,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/src/barebox-state/backend_storage.c b/src/barebox-state/backend_storage.c
index f8c432b6a1be..3879a8d35666 100644
--- a/src/barebox-state/backend_storage.c
+++ b/src/barebox-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;
 		}
 
-- 
2.20.1


_______________________________________________
OSS-Tools mailing list
OSS-Tools@pengutronix.de

  parent reply	other threads:[~2019-02-03 21:48 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-03 21:47 [OSS-Tools] [PATCH dt-utils 00/12] Diverse patches mainly removing bugs and warnings Ulrich Ölmann
2019-02-03 21:47 ` [OSS-Tools] [PATCH dt-utils 01/12] common: align declarations of dev_add_param_*() functions with barebox Ulrich Ölmann
2019-02-03 21:47 ` [OSS-Tools] [PATCH dt-utils 02/12] of_get_devicepath: again correct comment Ulrich Ölmann
2019-02-03 21:47 ` [OSS-Tools] [PATCH dt-utils 03/12] barebox-state: fix usage of multiple state instances Ulrich Ölmann
2019-02-03 21:47 ` [OSS-Tools] [PATCH dt-utils 04/12] barebox-state: complete cmdline options Ulrich Ölmann
2019-02-03 21:48 ` [OSS-Tools] [PATCH dt-utils 05/12] barebox-state: add cmdline option "--version" Ulrich Ölmann
2019-02-03 21:48 ` [OSS-Tools] [PATCH dt-utils 06/12] barebox-state: remove declaration of __state_uint8_get() Ulrich Ölmann
2019-02-03 21:48 ` [OSS-Tools] [PATCH dt-utils 07/12] barebox-state: remove unused variables Ulrich Ölmann
2019-02-03 21:48 ` [OSS-Tools] [PATCH dt-utils 08/12] keystore-blob: remove unused variable Ulrich Ölmann
2019-02-03 21:48 ` [OSS-Tools] [PATCH dt-utils 09/12] base64: " Ulrich Ölmann
2019-02-03 21:48 ` [OSS-Tools] [PATCH dt-utils 10/12] base64: remove duplicate ‘const’ declaration specifier Ulrich Ölmann
2019-02-03 21:48 ` Ulrich Ölmann [this message]
2019-02-04  7:54   ` [OSS-Tools] [PATCH dt-utils 11/12] state: fix formatting of "off_t" variables Juergen Borleis
2019-02-04  9:06     ` Uwe Kleine-König
2019-02-06  6:25       ` Ulrich Ölmann
2019-02-03 21:48 ` [OSS-Tools] [PATCH dt-utils 12/12] state: fix formatting of "uint32_t" variables Ulrich Ölmann
2019-02-07 11:43 ` [OSS-Tools] [PATCH dt-utils 00/12] Diverse patches mainly removing bugs and warnings Roland Hieber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190203214807.13643-12-u.oelmann@pengutronix.de \
    --to=u.oelmann@pengutronix.de \
    --cc=entwicklung@pengutronix.de \
    --cc=oss-tools@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox