mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: "Ulrich Ölmann" <u.oelmann@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 2/7] common: state: fix formatting of "off_t" variables
Date: Fri,  8 Feb 2019 08:15:21 +0100	[thread overview]
Message-ID: <20190208071526.19150-3-u.oelmann@pengutronix.de> (raw)
In-Reply-To: <20190208071526.19150-1-u.oelmann@pengutronix.de>

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>
---
 common/state/backend_bucket_circular.c | 32 +++++++++++++-------------
 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 5a85650f4004..ae15fa2529c2 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 c6ebe86244ab..8cd822eec486 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;
 		}
 
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2019-02-08  7:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-08  7:15 [PATCH 0/7] Harmonize barebox' and dt-utils' state code Ulrich Ölmann
2019-02-08  7:15 ` [PATCH 1/7] common: state: fix compiler warnings about wrong type conversion in messages Ulrich Ölmann
2019-02-08  7:15 ` Ulrich Ölmann [this message]
2019-02-08  7:15 ` [PATCH 3/7] common: state: fix formatting of "uint32_t" variables Ulrich Ölmann
2019-02-08  7:15 ` [PATCH 4/7] common: state: harmonize code with dt-utils Ulrich Ölmann
2019-02-08  7:15 ` [PATCH 5/7] " Ulrich Ölmann
2019-02-08  7:15 ` [PATCH 6/7] " Ulrich Ölmann
2019-02-08  7:15 ` [PATCH 7/7] " Ulrich Ölmann
2019-02-11  8:12 ` [PATCH 0/7] Harmonize barebox' and dt-utils' state code Sascha Hauer

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=20190208071526.19150-3-u.oelmann@pengutronix.de \
    --to=u.oelmann@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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