[PATCH mtd-utils 2/2] fsck.ubifs: use the appropriate format specifiers for ino_t and loff_t

Yuta Hayama hayama at lineo.co.jp
Thu Nov 13 00:32:35 PST 2025


On architectures such as armv7-a, ino_t is unsigned long long rather than
unsigned long. In such cases, the printf format specifier "%lu" is not
appropriate and causes an incorrect address offset.

  mtd-utils/ubifs-utils/fsck.ubifs/problem.c:224
  		log_out(c, "problem: %s, ino %lu, unreachable dentry %s, type %s%s",
  			problem->desc, ifp->file->inum,
  			c->encrypted && !ifp->file->ino.is_xattr ? "<encrypted>" : dent_node->name,
  			ubifs_get_type_name(dent_node->type),
  			key_type(c, &dent_node->key) == UBIFS_XENT_KEY ? "(xattr)" : "");

  fsck.ubifs[484] (/dev/ubi0_0,danger mode): problem: Dentry is unreachable, ino 917, unreachable dentry (null), type checksum_typefile

Furthermore, running fsck.ubifs with the --debug=4 option will almost
certainly cause a SEGV at the following point.

  mtd-utils/ubifs-utils/fsck.ubifs/check_files.c:103
  	dbg_fsck("construct file(%lu) for %s node, TNC location %d:%d, in %s",
  		 inum, ubifs_get_key_name(key_type(c, key)), sn->lnum, sn->offs,
  		 c->dev_name);

To ensure functionality regardless of environment, cast ino_t to unsigned
long long and output using "%lld". Apply the same fix for loff_t.

Signed-off-by: Yuta Hayama <hayama at lineo.co.jp>
---
 ubifs-utils/fsck.ubifs/check_files.c         |  11 +-
 ubifs-utils/fsck.ubifs/extract_files.c       | 179 ++++++++++---------
 ubifs-utils/fsck.ubifs/handle_disconnected.c |  10 +-
 ubifs-utils/fsck.ubifs/problem.c             |  36 ++--
 ubifs-utils/fsck.ubifs/rebuild_fs.c          |   8 +-
 ubifs-utils/libubifs/dir.c                   |   8 +-
 6 files changed, 127 insertions(+), 125 deletions(-)

diff --git a/ubifs-utils/fsck.ubifs/check_files.c b/ubifs-utils/fsck.ubifs/check_files.c
index 54300a3..53f3860 100644
--- a/ubifs-utils/fsck.ubifs/check_files.c
+++ b/ubifs-utils/fsck.ubifs/check_files.c
@@ -97,9 +97,9 @@ static int construct_file(struct ubifs_info *c, union ubifs_key *key,
 		ubifs_assert(c, 0);
 	}
 
-	dbg_fsck("construct file(%lu) for %s node, TNC location %d:%d, in %s",
-		 inum, ubifs_get_key_name(key_type(c, key)), sn->lnum, sn->offs,
-		 c->dev_name);
+	dbg_fsck("construct file(%llu) for %s node, TNC location %d:%d, in %s",
+		 (unsigned long long)inum, ubifs_get_key_name(key_type(c, key)),
+		 sn->lnum, sn->offs, c->dev_name);
 	return insert_or_update_file(c, tree, sn, key_type(c, key), inum);
 }
 
@@ -340,8 +340,9 @@ void update_files_size(struct ubifs_info *c)
 			file = lookup_file(&FSCK(c)->scanned_files, e->inum);
 			if (file && file->ino.header.exist &&
 			    file->ino.size < e->d_size) {
-				dbg_fsck("update file(%lu) size %llu->%llu, in %s",
-					 e->inum, file->ino.size,
+				dbg_fsck("update file(%llu) size %llu->%llu, in %s",
+					 (unsigned long long)e->inum,
+					 file->ino.size,
 					 (unsigned long long)e->d_size,
 					 c->dev_name);
 				file->ino.size = e->d_size;
diff --git a/ubifs-utils/fsck.ubifs/extract_files.c b/ubifs-utils/fsck.ubifs/extract_files.c
index 000ef5d..2bbcc86 100644
--- a/ubifs-utils/fsck.ubifs/extract_files.c
+++ b/ubifs-utils/fsck.ubifs/extract_files.c
@@ -77,22 +77,22 @@ bool parse_ino_node(struct ubifs_info *c, int lnum, int offs, void *node,
 
 	if (!inum || inum > INUM_WATERMARK) {
 		if (FSCK(c)->mode == REBUILD_MODE)
-			dbg_fsck("bad inode node(bad inum %lu) at %d:%d, in %s",
-				 inum, lnum, offs, c->dev_name);
+			dbg_fsck("bad inode node(bad inum %llu) at %d:%d, in %s",
+				 (unsigned long long)inum, lnum, offs, c->dev_name);
 		else
-			log_out(c, "bad inode node(bad inum %lu) at %d:%d",
-				inum, lnum, offs);
+			log_out(c, "bad inode node(bad inum %llu) at %d:%d",
+				(unsigned long long)inum, lnum, offs);
 		goto out;
 	}
 
 	if (ch->node_type != key_type(c, key)) {
 		if (FSCK(c)->mode == REBUILD_MODE)
-			dbg_fsck("bad inode node %lu(inconsistent node type %d vs key_type %d) at %d:%d, in %s",
-				 inum, ch->node_type, key_type(c, key),
+			dbg_fsck("bad inode node %llu(inconsistent node type %d vs key_type %d) at %d:%d, in %s",
+				 (unsigned long long)inum, ch->node_type, key_type(c, key),
 				 lnum, offs, c->dev_name);
 		else
-			log_out(c, "bad inode node %lu(inconsistent node type %d vs key_type %d) at %d:%d",
-				inum, ch->node_type, key_type(c, key),
+			log_out(c, "bad inode node %llu(inconsistent node type %d vs key_type %d) at %d:%d",
+				(unsigned long long)inum, ch->node_type, key_type(c, key),
 				lnum, offs);
 		goto out;
 	}
@@ -113,99 +113,99 @@ bool parse_ino_node(struct ubifs_info *c, int lnum, int offs, void *node,
 
 	if (inum == UBIFS_ROOT_INO && !S_ISDIR(ino_node->mode)) {
 		if (FSCK(c)->mode == REBUILD_MODE)
-			dbg_fsck("bad inode node %lu(root inode is not dir, tyoe %u) at %d:%d, in %s",
-				 inum, ino_node->mode & S_IFMT, lnum, offs,
+			dbg_fsck("bad inode node %llu(root inode is not dir, tyoe %u) at %d:%d, in %s",
+				 (unsigned long long)inum, ino_node->mode & S_IFMT, lnum, offs,
 				 c->dev_name);
 		else
-			log_out(c, "bad inode node %lu(root inode is not dir, tyoe %u) at %d:%d",
-				inum, ino_node->mode & S_IFMT, lnum, offs);
+			log_out(c, "bad inode node %llu(root inode is not dir, tyoe %u) at %d:%d",
+				(unsigned long long)inum, ino_node->mode & S_IFMT, lnum, offs);
 		goto out;
 	}
 
 	if (ino_node->size > c->max_inode_sz) {
 		if (FSCK(c)->mode == REBUILD_MODE)
-			dbg_fsck("bad inode node %lu(size %llu is too large) at %d:%d, in %s",
-				 inum, ino_node->size, lnum, offs, c->dev_name);
+			dbg_fsck("bad inode node %llu(size %llu is too large) at %d:%d, in %s",
+				 (unsigned long long)inum, ino_node->size, lnum, offs, c->dev_name);
 		else
-			log_out(c, "bad inode node %lu(size %llu is too large) at %d:%d",
-				inum, ino_node->size, lnum, offs);
+			log_out(c, "bad inode node %llu(size %llu is too large) at %d:%d",
+				(unsigned long long)inum, ino_node->size, lnum, offs);
 		goto out;
 	}
 
 	if (le16_to_cpu(ino->compr_type) >= UBIFS_COMPR_TYPES_CNT) {
 		if (FSCK(c)->mode == REBUILD_MODE)
-			dbg_fsck("bad inode node %lu(unknown compression type %d) at %d:%d, in %s",
-				 inum, le16_to_cpu(ino->compr_type), lnum, offs,
+			dbg_fsck("bad inode node %llu(unknown compression type %d) at %d:%d, in %s",
+				 (unsigned long long)inum, le16_to_cpu(ino->compr_type), lnum, offs,
 				 c->dev_name);
 		else
-			log_out(c, "bad inode node %lu(unknown compression type %d) at %d:%d",
-				inum, le16_to_cpu(ino->compr_type), lnum, offs);
+			log_out(c, "bad inode node %llu(unknown compression type %d) at %d:%d",
+				(unsigned long long)inum, le16_to_cpu(ino->compr_type), lnum, offs);
 		goto out;
 	}
 
 	if (ino_node->xnms + ino_node->xcnt > XATTR_LIST_MAX) {
 		if (FSCK(c)->mode == REBUILD_MODE)
-			dbg_fsck("bad inode node %lu(too big xnames %u xcount %u) at %d:%d, in %s",
-				 inum, ino_node->xnms, ino_node->xcnt,
+			dbg_fsck("bad inode node %llu(too big xnames %u xcount %u) at %d:%d, in %s",
+				 (unsigned long long)inum, ino_node->xnms, ino_node->xcnt,
 				 lnum, offs, c->dev_name);
 		else
-			log_out(c, "bad inode node %lu(too big xnames %u xcount %u) at %d:%d",
-				inum, ino_node->xnms, ino_node->xcnt,
+			log_out(c, "bad inode node %llu(too big xnames %u xcount %u) at %d:%d",
+				(unsigned long long)inum, ino_node->xnms, ino_node->xcnt,
 				lnum, offs);
 		goto out;
 	}
 
 	if (data_len < 0 || data_len > UBIFS_MAX_INO_DATA) {
 		if (FSCK(c)->mode == REBUILD_MODE)
-			dbg_fsck("bad inode node %lu(invalid data len %d) at %d:%d, in %s",
-				 inum, data_len, lnum, offs, c->dev_name);
+			dbg_fsck("bad inode node %llu(invalid data len %d) at %d:%d, in %s",
+				 (unsigned long long)inum, data_len, lnum, offs, c->dev_name);
 		else
-			log_out(c, "bad inode node %lu(invalid data len %d) at %d:%d",
-				inum, data_len, lnum, offs);
+			log_out(c, "bad inode node %llu(invalid data len %d) at %d:%d",
+				(unsigned long long)inum, data_len, lnum, offs);
 		goto out;
 	}
 
 	if (UBIFS_INO_NODE_SZ + data_len != node_len) {
 		if (FSCK(c)->mode == REBUILD_MODE)
-			dbg_fsck("bad inode node %lu(inconsistent data len %d vs node len %d) at %d:%d, in %s",
-				 inum, data_len, node_len, lnum, offs, c->dev_name);
+			dbg_fsck("bad inode node %llu(inconsistent data len %d vs node len %d) at %d:%d, in %s",
+				 (unsigned long long)inum, data_len, node_len, lnum, offs, c->dev_name);
 		else
-			log_out(c, "bad inode node %lu(inconsistent data len %d vs node len %d) at %d:%d",
-				inum, data_len, node_len, lnum, offs);
+			log_out(c, "bad inode node %llu(inconsistent data len %d vs node len %d) at %d:%d",
+				(unsigned long long)inum, data_len, node_len, lnum, offs);
 		goto out;
 	}
 
 	if (ino_node->is_xattr) {
 		if (!S_ISREG(ino_node->mode)) {
 			if (FSCK(c)->mode == REBUILD_MODE)
-				dbg_fsck("bad inode node %lu(bad type %u for xattr) at %d:%d, in %s",
-					 inum, ino_node->mode & S_IFMT,
+				dbg_fsck("bad inode node %llu(bad type %u for xattr) at %d:%d, in %s",
+					 (unsigned long long)inum, ino_node->mode & S_IFMT,
 					 lnum, offs, c->dev_name);
 			else
-				log_out(c, "bad inode node %lu(bad type %u for xattr) at %d:%d",
-					inum, ino_node->mode & S_IFMT,
+				log_out(c, "bad inode node %llu(bad type %u for xattr) at %d:%d",
+					(unsigned long long)inum, ino_node->mode & S_IFMT,
 					lnum, offs);
 			goto out;
 		}
 		if (data_len != ino_node->size) {
 			if (FSCK(c)->mode == REBUILD_MODE)
-				dbg_fsck("bad inode node %lu(inconsistent data_len %d vs size %llu for xattr) at %d:%d, in %s",
-					 inum, data_len, ino_node->size,
+				dbg_fsck("bad inode node %llu(inconsistent data_len %d vs size %llu for xattr) at %d:%d, in %s",
+					 (unsigned long long)inum, data_len, ino_node->size,
 					 lnum, offs, c->dev_name);
 			else
-				log_out(c, "bad inode node %lu(inconsistent data_len %d vs size %llu for xattr) at %d:%d",
-					inum, data_len, ino_node->size,
+				log_out(c, "bad inode node %llu(inconsistent data_len %d vs size %llu for xattr) at %d:%d",
+					(unsigned long long)inum, data_len, ino_node->size,
 					lnum, offs);
 			goto out;
 		}
 		if (ino_node->xcnt || ino_node->xsz || ino_node->xnms) {
 			if (FSCK(c)->mode == REBUILD_MODE)
-				dbg_fsck("bad inode node %lu(non zero xattr count %u xattr size %u xattr names %u for xattr) at %d:%d, in %s",
-					 inum, ino_node->xcnt, ino_node->xsz,
+				dbg_fsck("bad inode node %llu(non zero xattr count %u xattr size %u xattr names %u for xattr) at %d:%d, in %s",
+					 (unsigned long long)inum, ino_node->xcnt, ino_node->xsz,
 					 ino_node->xnms, lnum, offs, c->dev_name);
 			else
-				log_out(c, "bad inode node %lu(non zero xattr count %u xattr size %u xattr names %u for xattr) at %d:%d",
-					inum, ino_node->xcnt, ino_node->xsz,
+				log_out(c, "bad inode node %llu(non zero xattr count %u xattr size %u xattr names %u for xattr) at %d:%d",
+					(unsigned long long)inum, ino_node->xcnt, ino_node->xsz,
 					ino_node->xnms, lnum, offs);
 			goto out;
 		}
@@ -215,22 +215,22 @@ bool parse_ino_node(struct ubifs_info *c, int lnum, int offs, void *node,
 	case S_IFREG:
 		if (!ino_node->is_xattr && data_len != 0) {
 			if (FSCK(c)->mode == REBUILD_MODE)
-				dbg_fsck("bad inode node %lu(bad data len %d for reg file) at %d:%d, in %s",
-					 inum, data_len, lnum, offs, c->dev_name);
+				dbg_fsck("bad inode node %llu(bad data len %d for reg file) at %d:%d, in %s",
+					 (unsigned long long)inum, data_len, lnum, offs, c->dev_name);
 			else
-				log_out(c, "bad inode node %lu(bad data len %d for reg file) at %d:%d",
-					inum, data_len, lnum, offs);
+				log_out(c, "bad inode node %llu(bad data len %d for reg file) at %d:%d",
+					(unsigned long long)inum, data_len, lnum, offs);
 			goto out;
 		}
 		break;
 	case S_IFDIR:
 		if (data_len != 0) {
 			if (FSCK(c)->mode == REBUILD_MODE)
-				dbg_fsck("bad inode node %lu(bad data len %d for dir file) at %d:%d, in %s",
-					 inum, data_len, lnum, offs, c->dev_name);
+				dbg_fsck("bad inode node %llu(bad data len %d for dir file) at %d:%d, in %s",
+					 (unsigned long long)inum, data_len, lnum, offs, c->dev_name);
 			else
-				log_out(c, "bad inode node %lu(bad data len %d for dir file) at %d:%d",
-					inum, data_len, lnum, offs);
+				log_out(c, "bad inode node %llu(bad data len %d for dir file) at %d:%d",
+					(unsigned long long)inum, data_len, lnum, offs);
 			goto out;
 		}
 		break;
@@ -248,11 +248,11 @@ bool parse_ino_node(struct ubifs_info *c, int lnum, int offs, void *node,
 			 * exceptions are found.
 			 */
 			if (FSCK(c)->mode == REBUILD_MODE)
-				dbg_fsck("bad symlink inode node %lu(bad data len %d) at %d:%d, in %s",
-					 inum, data_len, lnum, offs, c->dev_name);
+				dbg_fsck("bad symlink inode node %llu(bad data len %d) at %d:%d, in %s",
+					 (unsigned long long)inum, data_len, lnum, offs, c->dev_name);
 			else
-				log_out(c, "bad symlink inode node %lu(bad data len %d) at %d:%d",
-					inum, data_len, lnum, offs);
+				log_out(c, "bad symlink inode node %llu(bad data len %d) at %d:%d",
+					(unsigned long long)inum, data_len, lnum, offs);
 			goto out;
 		}
 		break;
@@ -265,12 +265,12 @@ bool parse_ino_node(struct ubifs_info *c, int lnum, int offs, void *node,
 
 		if (data_len != sz_new && data_len != sz_huge) {
 			if (FSCK(c)->mode == REBUILD_MODE)
-				dbg_fsck("bad inode node %lu(bad data len %d for char/block file, expect %d or %d) at %d:%d, in %s",
-					 inum, data_len, sz_new, sz_huge, lnum,
+				dbg_fsck("bad inode node %llu(bad data len %d for char/block file, expect %d or %d) at %d:%d, in %s",
+					 (unsigned long long)inum, data_len, sz_new, sz_huge, lnum,
 					 offs, c->dev_name);
 			else
-				log_out(c, "bad inode node %lu(bad data len %d for char/block file, expect %d or %d) at %d:%d",
-					inum, data_len, sz_new, sz_huge, lnum,
+				log_out(c, "bad inode node %llu(bad data len %d for char/block file, expect %d or %d) at %d:%d",
+					(unsigned long long)inum, data_len, sz_new, sz_huge, lnum,
 					offs);
 			goto out;
 		}
@@ -281,33 +281,33 @@ bool parse_ino_node(struct ubifs_info *c, int lnum, int offs, void *node,
 	case S_IFIFO:
 		if (data_len != 0) {
 			if (FSCK(c)->mode == REBUILD_MODE)
-				dbg_fsck("bad inode node %lu(bad data len %d for fifo/sock file) at %d:%d, in %s",
-					 inum, data_len, lnum, offs, c->dev_name);
+				dbg_fsck("bad inode node %llu(bad data len %d for fifo/sock file) at %d:%d, in %s",
+					 (unsigned long long)inum, data_len, lnum, offs, c->dev_name);
 			else
-				log_out(c, "bad inode node %lu(bad data len %d for fifo/sock file) at %d:%d",
-					inum, data_len, lnum, offs);
+				log_out(c, "bad inode node %llu(bad data len %d for fifo/sock file) at %d:%d",
+					(unsigned long long)inum, data_len, lnum, offs);
 			goto out;
 		}
 		break;
 	default:
 		/* invalid file type. */
 		if (FSCK(c)->mode == REBUILD_MODE)
-			dbg_fsck("bad inode node %lu(unknown type %u) at %d:%d, in %s",
-				 inum, ino_node->mode & S_IFMT, lnum, offs, c->dev_name);
+			dbg_fsck("bad inode node %llu(unknown type %u) at %d:%d, in %s",
+				 (unsigned long long)inum, ino_node->mode & S_IFMT, lnum, offs, c->dev_name);
 		else
-			log_out(c, "bad inode node %lu(unknown type %u) at %d:%d",
-				inum, ino_node->mode & S_IFMT, lnum, offs);
+			log_out(c, "bad inode node %llu(unknown type %u) at %d:%d",
+				(unsigned long long)inum, ino_node->mode & S_IFMT, lnum, offs);
 		goto out;
 	}
 
 	if (ino_node->is_encrypted && !inode_can_be_encrypted(c, ino_node)) {
 		if (FSCK(c)->mode == REBUILD_MODE)
-			dbg_fsck("bad inode node %lu(encrypted but cannot be encrypted, type %u, is_xattr %d, fs_encrypted %d) at %d:%d, in %s",
-				 inum, ino_node->mode & S_IFMT, ino_node->is_xattr,
+			dbg_fsck("bad inode node %llu(encrypted but cannot be encrypted, type %u, is_xattr %d, fs_encrypted %d) at %d:%d, in %s",
+				 (unsigned long long)inum, ino_node->mode & S_IFMT, ino_node->is_xattr,
 				 c->encrypted, lnum, offs, c->dev_name);
 		else
-			log_out(c, "bad inode node %lu(encrypted but cannot be encrypted, type %u, is_xattr %d, fs_encrypted %d) at %d:%d",
-				inum, ino_node->mode & S_IFMT, ino_node->is_xattr,
+			log_out(c, "bad inode node %llu(encrypted but cannot be encrypted, type %u, is_xattr %d, fs_encrypted %d) at %d:%d",
+				(unsigned long long)inum, ino_node->mode & S_IFMT, ino_node->is_xattr,
 				c->encrypted, lnum, offs);
 		goto out;
 	}
@@ -355,14 +355,14 @@ bool parse_dent_node(struct ubifs_info *c, int lnum, int offs, void *node,
 	     strnlen((const char *)dent->name, nlen) != nlen) ||
 	    inum > INUM_WATERMARK || key_type != ch->node_type) {
 		if (FSCK(c)->mode == REBUILD_MODE)
-			dbg_fsck("bad %s node(len %d nlen %d type %d inum %lu key_type %d node_type %d) at %d:%d, in %s",
+			dbg_fsck("bad %s node(len %d nlen %d type %d inum %llu key_type %d node_type %d) at %d:%d, in %s",
 				 ch->node_type == UBIFS_XENT_NODE ? "xattr entry" : "directory entry",
-				 node_len, nlen, dent->type, inum, key_type,
+				 node_len, nlen, dent->type, (unsigned long long)inum, key_type,
 				 ch->node_type, lnum, offs, c->dev_name);
 		else
-			log_out(c, "bad %s node(len %d nlen %d type %d inum %lu key_type %d node_type %d) at %d:%d",
+			log_out(c, "bad %s node(len %d nlen %d type %d inum %llu key_type %d node_type %d) at %d:%d",
 				ch->node_type == UBIFS_XENT_NODE ? "xattr entry" : "directory entry",
-				node_len, nlen, dent->type, inum, key_type,
+				node_len, nlen, dent->type, (unsigned long long)inum, key_type,
 				ch->node_type, lnum, offs);
 		goto out;
 	}
@@ -418,11 +418,11 @@ bool parse_data_node(struct ubifs_info *c, int lnum, int offs, void *node,
 
 	if (!inum || inum > INUM_WATERMARK) {
 		if (FSCK(c)->mode == REBUILD_MODE)
-			dbg_fsck("bad data node(bad inum %lu) at %d:%d, in %s",
-				 inum, lnum, offs, c->dev_name);
+			dbg_fsck("bad data node(bad inum %llu) at %d:%d, in %s",
+				 (unsigned long long)inum, lnum, offs, c->dev_name);
 		else
-			log_out(c, "bad data node(bad inum %lu) at %d:%d",
-				inum, lnum, offs);
+			log_out(c, "bad data node(bad inum %llu) at %d:%d",
+				(unsigned long long)inum, lnum, offs);
 		goto out;
 	}
 
@@ -484,8 +484,8 @@ bool parse_trun_node(struct ubifs_info *c, int lnum, int offs, void *node,
 	ino_t inum = le32_to_cpu(trun->inum);
 
 	if (!inum || inum > INUM_WATERMARK) {
-		dbg_fsck("bad truncation node(bad inum %lu) at %d:%d, in %s",
-			 inum, lnum, offs, c->dev_name);
+		dbg_fsck("bad truncation node(bad inum %llu) at %d:%d, in %s",
+			 (unsigned long long)inum, lnum, offs, c->dev_name);
 		goto out;
 	}
 
@@ -496,8 +496,9 @@ bool parse_trun_node(struct ubifs_info *c, int lnum, int offs, void *node,
 	if (old_size < 0 || old_size > c->max_inode_sz ||
 	    new_size < 0 || new_size > c->max_inode_sz ||
 	    old_size <= new_size) {
-		dbg_fsck("bad truncation node(new size %ld old size %ld inum %lu) at %d:%d, in %s",
-			 new_size, old_size, inum, lnum, offs, c->dev_name);
+		dbg_fsck("bad truncation node(new size %lld old size %lld inum %llu) at %d:%d, in %s",
+			 (long long)new_size, (long long)old_size,
+			 (unsigned long long)inum, lnum, offs, c->dev_name);
 		goto out;
 	}
 
@@ -1007,7 +1008,7 @@ int file_is_valid(struct ubifs_info *c, struct scanned_file *file,
 	struct scanned_data_node *data_node;
 	LIST_HEAD(drop_list);
 
-	dbg_fsck("check validation of file %lu, in %s", file->inum, c->dev_name);
+	dbg_fsck("check validation of file %llu, in %s", (unsigned long long)file->inum, c->dev_name);
 
 	if (!file->ino.header.exist) {
 		handle_invalid_file(c, FILE_HAS_NO_INODE, file, NULL);
@@ -1275,12 +1276,12 @@ retry:
 			handle_invalid_file(c, FILE_IS_DISCONNECTED, file, NULL);
 		else
 			handle_invalid_file(c, FILE_HAS_NO_DENT, file, NULL);
-		dbg_fsck("file %lu is unreachable, in %s", file->inum, c->dev_name);
+		dbg_fsck("file %llu is unreachable, in %s", (unsigned long long)file->inum, c->dev_name);
 		return false;
 	}
 
 reachable:
-	dbg_fsck("file %lu is reachable, in %s", file->inum, c->dev_name);
+	dbg_fsck("file %llu is reachable, in %s", (unsigned long long)file->inum, c->dev_name);
 	return true;
 }
 
@@ -1497,8 +1498,8 @@ static int correct_file_info(struct ubifs_info *c, struct scanned_file *file)
 
 	handle_invalid_file(c, FILE_IS_INCONSISTENT, file, NULL);
 	lnum = file->ino.header.lnum;
-	dbg_fsck("correct file(inum:%lu type:%s), nlink %u->%u, xattr cnt %u->%u, xattr size %u->%u, xattr names %u->%u, size %llu->%llu, at %d:%d, in %s",
-		 file->inum, file->ino.is_xattr ? "xattr" :
+	dbg_fsck("correct file(inum:%llu type:%s), nlink %u->%u, xattr cnt %u->%u, xattr size %u->%u, xattr names %u->%u, size %llu->%llu, at %d:%d, in %s",
+		 (unsigned long long)file->inum, file->ino.is_xattr ? "xattr" :
 		 ubifs_get_type_name(ubifs_get_dent_type(file->ino.mode)),
 		 file->ino.nlink, file->calc_nlink,
 		 file->ino.xcnt, file->calc_xcnt,
diff --git a/ubifs-utils/fsck.ubifs/handle_disconnected.c b/ubifs-utils/fsck.ubifs/handle_disconnected.c
index be62522..15fd14e 100644
--- a/ubifs-utils/fsck.ubifs/handle_disconnected.c
+++ b/ubifs-utils/fsck.ubifs/handle_disconnected.c
@@ -117,7 +117,7 @@ static int handle_disonnected_file(struct ubifs_info *c,
 			struct ubifs_inode *target_ui;
 
 			err = snprintf(file_name, sizeof(file_name),
-				       "INO_%lu_%u", file->inum, index);
+				       "INO_%llu_%u", (unsigned long long)file->inum, index);
 			if (err < 0)
 				goto free_ui;
 			fname_name(&nm) = file_name;
@@ -137,8 +137,8 @@ static int handle_disonnected_file(struct ubifs_info *c,
 			err = 0;
 			kfree(ui);
 			kfree(lost_found_ui);
-			log_out(c, "Too many duplicated names(%u) in lost+found for inum %lu",
-				index, file->inum);
+			log_out(c, "Too many duplicated names(%u) in lost+found for inum %llu",
+				index, (unsigned long long)file->inum);
 			goto delete_file;
 		}
 
@@ -149,8 +149,8 @@ static int handle_disonnected_file(struct ubifs_info *c,
 			log_out(c, "No free space to recover disconnected file");
 			goto delete_file;
 		}
-		dbg_fsck("recover disconnected file %lu, in %s",
-			 file->inum, c->dev_name);
+		dbg_fsck("recover disconnected file %llu, in %s",
+			 (unsigned long long)file->inum, c->dev_name);
 
 free_ui:
 		kfree(ui);
diff --git a/ubifs-utils/fsck.ubifs/problem.c b/ubifs-utils/fsck.ubifs/problem.c
index 916c976..bb2fa72 100644
--- a/ubifs-utils/fsck.ubifs/problem.c
+++ b/ubifs-utils/fsck.ubifs/problem.c
@@ -147,7 +147,7 @@ static void print_problem(const struct ubifs_info *c,
 	{
 		const struct invalid_file_problem *ifp = (const struct invalid_file_problem *)priv;
 
-		log_out(c, "problem: %s, ino %lu", problem->desc, ifp->file->inum);
+		log_out(c, "problem: %s, ino %llu", problem->desc, (unsigned long long)ifp->file->inum);
 		break;
 	}
 	case FILE_HAS_INCONSIST_TYPE:
@@ -155,8 +155,8 @@ static void print_problem(const struct ubifs_info *c,
 		const struct invalid_file_problem *ifp = (const struct invalid_file_problem *)priv;
 		const struct scanned_dent_node *dent_node = (const struct scanned_dent_node *)ifp->priv;
 
-		log_out(c, "problem: %s, ino %lu, inode type %s%s, dentry %s has type %s%s",
-			problem->desc, ifp->file->inum,
+		log_out(c, "problem: %s, ino %llu, inode type %s%s, dentry %s has type %s%s",
+			problem->desc, (unsigned long long)ifp->file->inum,
 			ubifs_get_type_name(ubifs_get_dent_type(ifp->file->ino.mode)),
 			ifp->file->ino.is_xattr ? "(xattr)" : "",
 			c->encrypted && !ifp->file->ino.is_xattr ? "<encrypted>" : dent_node->name,
@@ -170,8 +170,8 @@ static void print_problem(const struct ubifs_info *c,
 		const struct invalid_file_problem *ifp = (const struct invalid_file_problem *)priv;
 		const struct scanned_dent_node *dent_node = (const struct scanned_dent_node *)ifp->priv;
 
-		log_out(c, "problem: %s, ino %lu, type %s%s, dentry %s",
-			problem->desc, ifp->file->inum,
+		log_out(c, "problem: %s, ino %llu, type %s%s, dentry %s",
+			problem->desc, (unsigned long long)ifp->file->inum,
 			ubifs_get_type_name(ubifs_get_dent_type(ifp->file->ino.mode)),
 			ifp->file->ino.is_xattr ? "(xattr)" : "",
 			c->encrypted && !ifp->file->ino.is_xattr ? "<encrypted>" : dent_node->name);
@@ -182,8 +182,8 @@ static void print_problem(const struct ubifs_info *c,
 		const struct invalid_file_problem *ifp = (const struct invalid_file_problem *)priv;
 		const struct scanned_data_node *data_node = (const struct scanned_data_node *)ifp->priv;
 
-		log_out(c, "problem: %s, ino %lu, type %s%s, data block %u",
-			problem->desc, ifp->file->inum,
+		log_out(c, "problem: %s, ino %llu, type %s%s, data block %u",
+			problem->desc, (unsigned long long)ifp->file->inum,
 			ubifs_get_type_name(ubifs_get_dent_type(ifp->file->ino.mode)),
 			ifp->file->ino.is_xattr ? "(xattr)" : "",
 			key_block(c, &data_node->key));
@@ -197,8 +197,8 @@ static void print_problem(const struct ubifs_info *c,
 	{
 		const struct invalid_file_problem *ifp = (const struct invalid_file_problem *)priv;
 
-		log_out(c, "problem: %s, ino %lu type %s%s", problem->desc,
-			ifp->file->inum,
+		log_out(c, "problem: %s, ino %llu type %s%s", problem->desc,
+			(unsigned long long)ifp->file->inum,
 			ubifs_get_type_name(ubifs_get_dent_type(ifp->file->ino.mode)),
 			ifp->file->ino.is_xattr ? "(xattr)" : "");
 		break;
@@ -208,10 +208,10 @@ static void print_problem(const struct ubifs_info *c,
 		const struct invalid_file_problem *ifp = (const struct invalid_file_problem *)priv;
 		const struct scanned_file *host = (const struct scanned_file *)ifp->priv;
 
-		log_out(c, "problem: %s, ino %lu type %s%s, host ino %lu type %s%s",
-			problem->desc, ifp->file->inum,
+		log_out(c, "problem: %s, ino %llu type %s%s, host ino %llu type %s%s",
+			problem->desc, (unsigned long long)ifp->file->inum,
 			ubifs_get_type_name(ubifs_get_dent_type(ifp->file->ino.mode)),
-			ifp->file->ino.is_xattr ? "(xattr)" : "", host->inum,
+			ifp->file->ino.is_xattr ? "(xattr)" : "", (unsigned long long)host->inum,
 			ubifs_get_type_name(ubifs_get_dent_type(host->ino.mode)),
 			host->ino.is_xattr ? "(xattr)" : "");
 		break;
@@ -221,8 +221,8 @@ static void print_problem(const struct ubifs_info *c,
 		const struct invalid_file_problem *ifp = (const struct invalid_file_problem *)priv;
 		const struct scanned_dent_node *dent_node = (const struct scanned_dent_node *)ifp->priv;
 
-		log_out(c, "problem: %s, ino %lu, unreachable dentry %s, type %s%s",
-			problem->desc, ifp->file->inum,
+		log_out(c, "problem: %s, ino %llu, unreachable dentry %s, type %s%s",
+			problem->desc, (unsigned long long)ifp->file->inum,
 			c->encrypted && !ifp->file->ino.is_xattr ? "<encrypted>" : dent_node->name,
 			ubifs_get_type_name(dent_node->type),
 			key_type(c, &dent_node->key) == UBIFS_XENT_KEY ? "(xattr)" : "");
@@ -233,9 +233,9 @@ static void print_problem(const struct ubifs_info *c,
 		const struct invalid_file_problem *ifp = (const struct invalid_file_problem *)priv;
 		const struct scanned_file *file = ifp->file;
 
-		log_out(c, "problem: %s, ino %lu type %s, nlink %u xcnt %u xsz %u xnms %u size %llu, "
+		log_out(c, "problem: %s, ino %llu type %s, nlink %u xcnt %u xsz %u xnms %u size %llu, "
 			"should be nlink %u xcnt %u xsz %u xnms %u size %llu",
-			problem->desc, file->inum,
+			problem->desc, (unsigned long long)file->inum,
 			file->ino.is_xattr ? "xattr" : ubifs_get_type_name(ubifs_get_dent_type(file->ino.mode)),
 			file->ino.nlink, file->ino.xcnt, file->ino.xsz,
 			file->ino.xnms, file->ino.size,
@@ -298,8 +298,8 @@ static void print_problem(const struct ubifs_info *c,
 	{
 		const struct scanned_file *file = (const struct scanned_file *)priv;
 
-		log_out(c, "problem: %s, ino %lu, size %llu", problem->desc,
-			file->inum, file->ino.size);
+		log_out(c, "problem: %s, ino %llu, size %llu", problem->desc,
+			(unsigned long long)file->inum, file->ino.size);
 		break;
 	}
 	default:
diff --git a/ubifs-utils/fsck.ubifs/rebuild_fs.c b/ubifs-utils/fsck.ubifs/rebuild_fs.c
index b82d728..076cbe5 100644
--- a/ubifs-utils/fsck.ubifs/rebuild_fs.c
+++ b/ubifs-utils/fsck.ubifs/rebuild_fs.c
@@ -696,8 +696,8 @@ static void extract_dentry_tree(struct ubifs_info *c)
 	while (!list_empty(&unreachable)) {
 		file = list_entry(unreachable.next, struct scanned_file, list);
 
-		dbg_fsck("remove unreachable file %lu, in %s",
-			 file->inum, c->dev_name);
+		dbg_fsck("remove unreachable file %llu, in %s",
+			 (unsigned long long)file->inum, c->dev_name);
 		list_del(&file->list);
 		destroy_file_content(c, file);
 		rb_erase(&file->rb, tree);
@@ -1096,8 +1096,8 @@ static int record_file_used_lebs(struct ubifs_info *c,
 	struct scanned_dent_node *dent_node;
 	struct scanned_data_node *data_node;
 
-	dbg_fsck("recovered file(inum:%lu name:%s type:%s), in %s",
-		 file->inum, get_file_name(c, file),
+	dbg_fsck("recovered file(inum:%llu name:%s type:%s), in %s",
+		 (unsigned long long)file->inum, get_file_name(c, file),
 		 file->ino.is_xattr ? "xattr" :
 		 ubifs_get_type_name(ubifs_get_dent_type(file->ino.mode)),
 		 c->dev_name);
diff --git a/ubifs-utils/libubifs/dir.c b/ubifs-utils/libubifs/dir.c
index 89f77eb..50cb818 100644
--- a/ubifs-utils/libubifs/dir.c
+++ b/ubifs-utils/libubifs/dir.c
@@ -248,8 +248,8 @@ int ubifs_mkdir(struct ubifs_info *c, struct ubifs_inode *dir_ui,
 	 * Budget request settings: new inode, new direntry and changing parent
 	 * directory inode.
 	 */
-	dbg_gen("dent '%s', mode %#hx in dir ino %lu",
-		fname_name(nm), mode, dir->inum);
+	dbg_gen("dent '%s', mode %#hx in dir ino %llu",
+		fname_name(nm), mode, (unsigned long long)dir->inum);
 
 	/* New dir is not allowed to be created under an encrypted directory. */
 	ubifs_assert(c, !(dir_ui->flags & UBIFS_CRYPT_FL));
@@ -314,8 +314,8 @@ int ubifs_link_recovery(struct ubifs_info *c, struct ubifs_inode *dir_ui,
 	 * Budget request settings: new direntry, changing the target inode,
 	 * changing the parent inode.
 	 */
-	dbg_gen("dent '%s' to ino %lu (nlink %d) in dir ino %lu",
-		fname_name(nm), inode->inum, inode->nlink, dir->inum);
+	dbg_gen("dent '%s' to ino %llu (nlink %d) in dir ino %llu",
+		fname_name(nm), (unsigned long long)inode->inum, inode->nlink, (unsigned long long)dir->inum);
 
 	/* New dir is not allowed to be created under an encrypted directory. */
 	ubifs_assert(c, !(dir_ui->flags & UBIFS_CRYPT_FL));
-- 
2.43.0





More information about the linux-mtd mailing list