* [PATCH -next] xfs: remove "%Ld" which doesn't meet C standard @ 2022-08-30 13:54 Zeng Heng 2022-08-30 14:51 ` Eric Sandeen 0 siblings, 1 reply; 3+ messages in thread From: Zeng Heng @ 2022-08-30 13:54 UTC (permalink / raw) To: djwong; +Cc: linux-xfs, linux-kernel, zengheng4 The "%Ld" specifier, which represents long long unsigned, doesn't meet C language standard, and even more, it makes people easily mistake with "%ld", which represent long unsigned. So replace "%Ld" with "lld". Do the same with "%Lu". Signed-off-by: Zeng Heng <zengheng4@huawei.com> --- fs/xfs/xfs_inode_item_recover.c | 4 ++-- fs/xfs/xfs_stats.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/xfs/xfs_inode_item_recover.c b/fs/xfs/xfs_inode_item_recover.c index d28ffaebd067..0e5dba2343ea 100644 --- a/fs/xfs/xfs_inode_item_recover.c +++ b/fs/xfs/xfs_inode_item_recover.c @@ -321,7 +321,7 @@ xlog_recover_inode_commit_pass2( */ if (XFS_IS_CORRUPT(mp, !xfs_verify_magic16(bp, dip->di_magic))) { xfs_alert(mp, - "%s: Bad inode magic number, dip = "PTR_FMT", dino bp = "PTR_FMT", ino = %Ld", + "%s: Bad inode magic number, dip = "PTR_FMT", dino bp = "PTR_FMT", ino = %lld", __func__, dip, bp, in_f->ilf_ino); error = -EFSCORRUPTED; goto out_release; @@ -329,7 +329,7 @@ xlog_recover_inode_commit_pass2( ldip = item->ri_buf[1].i_addr; if (XFS_IS_CORRUPT(mp, ldip->di_magic != XFS_DINODE_MAGIC)) { xfs_alert(mp, - "%s: Bad inode log record, rec ptr "PTR_FMT", ino %Ld", + "%s: Bad inode log record, rec ptr "PTR_FMT", ino %lld", __func__, item, in_f->ilf_ino); error = -EFSCORRUPTED; goto out_release; diff --git a/fs/xfs/xfs_stats.c b/fs/xfs/xfs_stats.c index 70d38b77682b..90a77cd3ebad 100644 --- a/fs/xfs/xfs_stats.c +++ b/fs/xfs/xfs_stats.c @@ -74,7 +74,7 @@ int xfs_stats_format(struct xfsstats __percpu *stats, char *buf) defer_relog += per_cpu_ptr(stats, i)->s.defer_relog; } - len += scnprintf(buf + len, PATH_MAX-len, "xpc %Lu %Lu %Lu\n", + len += scnprintf(buf + len, PATH_MAX-len, "xpc %llu %llu %llu\n", xs_xstrat_bytes, xs_write_bytes, xs_read_bytes); len += scnprintf(buf + len, PATH_MAX-len, "defer_relog %llu\n", defer_relog); -- 2.25.1 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH -next] xfs: remove "%Ld" which doesn't meet C standard 2022-08-30 13:54 [PATCH -next] xfs: remove "%Ld" which doesn't meet C standard Zeng Heng @ 2022-08-30 14:51 ` Eric Sandeen 2022-08-31 2:01 ` Zeng Heng 0 siblings, 1 reply; 3+ messages in thread From: Eric Sandeen @ 2022-08-30 14:51 UTC (permalink / raw) To: Zeng Heng, djwong; +Cc: linux-xfs, linux-kernel On 8/30/22 8:54 AM, Zeng Heng wrote: > The "%Ld" specifier, which represents long long unsigned, > doesn't meet C language standard, and even more, > it makes people easily mistake with "%ld", which represent > long unsigned. So replace "%Ld" with "lld". > > Do the same with "%Lu". > > Signed-off-by: Zeng Heng <zengheng4@huawei.com> I think this probably makes sense, but there are many more instances of %Ld and %Lu in the xfs code, so why change just these 3? $ cd fs/xfs $ grep -r "%Lu\|%Ld" . ./libxfs/xfs_inode_fork.c: "corrupt inode %Lu (bad size %d for local fork, size = %zd).", ./libxfs/xfs_inode_fork.c: xfs_warn(mp, "corrupt inode %Lu (btree).", ./libxfs/xfs_bmap.c: xfs_warn(mp, "%s: thispa(%d) == pp(%d) %Ld", ./xfs_inode.c: "%s: Bad inode %Lu magic number 0x%x, ptr "PTR_FMT, ./xfs_inode.c: "%s: Bad regular inode %Lu, ptr "PTR_FMT, ./xfs_inode.c: "%s: Bad directory inode %Lu, ptr "PTR_FMT, ./xfs_inode.c: "%s: bad inode %Lu, forkoff 0x%x, ptr "PTR_FMT, ./xfs_stats.c: len += scnprintf(buf + len, PATH_MAX-len, "xpc %Lu %Lu %Lu\n", ./cscope/csdb:, "corrupt inode %Lu (btree).", ./cscope/csdb:", dino bp = "PTR_FMT", ino = %Ld", ./cscope/csdb:", ino %Ld", ./cscope/csdb:-len, "xpc %Lu %Lu %Lu\n", ./xfs_inode_item_recover.c: "%s: Bad inode magic number, dip = "PTR_FMT", dino bp = "PTR_FMT", ino = %Ld", ./xfs_inode_item_recover.c: "%s: Bad inode log record, rec ptr "PTR_FMT", ino %Ld", > --- > fs/xfs/xfs_inode_item_recover.c | 4 ++-- > fs/xfs/xfs_stats.c | 2 +- > 2 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/fs/xfs/xfs_inode_item_recover.c b/fs/xfs/xfs_inode_item_recover.c > index d28ffaebd067..0e5dba2343ea 100644 > --- a/fs/xfs/xfs_inode_item_recover.c > +++ b/fs/xfs/xfs_inode_item_recover.c > @@ -321,7 +321,7 @@ xlog_recover_inode_commit_pass2( > */ > if (XFS_IS_CORRUPT(mp, !xfs_verify_magic16(bp, dip->di_magic))) { > xfs_alert(mp, > - "%s: Bad inode magic number, dip = "PTR_FMT", dino bp = "PTR_FMT", ino = %Ld", > + "%s: Bad inode magic number, dip = "PTR_FMT", dino bp = "PTR_FMT", ino = %lld", > __func__, dip, bp, in_f->ilf_ino); > error = -EFSCORRUPTED; > goto out_release; > @@ -329,7 +329,7 @@ xlog_recover_inode_commit_pass2( > ldip = item->ri_buf[1].i_addr; > if (XFS_IS_CORRUPT(mp, ldip->di_magic != XFS_DINODE_MAGIC)) { > xfs_alert(mp, > - "%s: Bad inode log record, rec ptr "PTR_FMT", ino %Ld", > + "%s: Bad inode log record, rec ptr "PTR_FMT", ino %lld", > __func__, item, in_f->ilf_ino); > error = -EFSCORRUPTED; > goto out_release; > diff --git a/fs/xfs/xfs_stats.c b/fs/xfs/xfs_stats.c > index 70d38b77682b..90a77cd3ebad 100644 > --- a/fs/xfs/xfs_stats.c > +++ b/fs/xfs/xfs_stats.c > @@ -74,7 +74,7 @@ int xfs_stats_format(struct xfsstats __percpu *stats, char *buf) > defer_relog += per_cpu_ptr(stats, i)->s.defer_relog; > } > > - len += scnprintf(buf + len, PATH_MAX-len, "xpc %Lu %Lu %Lu\n", > + len += scnprintf(buf + len, PATH_MAX-len, "xpc %llu %llu %llu\n", > xs_xstrat_bytes, xs_write_bytes, xs_read_bytes); > len += scnprintf(buf + len, PATH_MAX-len, "defer_relog %llu\n", > defer_relog); ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH -next] xfs: remove "%Ld" which doesn't meet C standard 2022-08-30 14:51 ` Eric Sandeen @ 2022-08-31 2:01 ` Zeng Heng 0 siblings, 0 replies; 3+ messages in thread From: Zeng Heng @ 2022-08-31 2:01 UTC (permalink / raw) To: Eric Sandeen; +Cc: linux-xfs, linux-kernel, djwong You're right, I would take the opinion into v2 and loop you. 在 2022/8/30 22:51, Eric Sandeen 写道: > On 8/30/22 8:54 AM, Zeng Heng wrote: >> The "%Ld" specifier, which represents long long unsigned, >> doesn't meet C language standard, and even more, >> it makes people easily mistake with "%ld", which represent >> long unsigned. So replace "%Ld" with "lld". >> >> Do the same with "%Lu". >> >> Signed-off-by: Zeng Heng <zengheng4@huawei.com> > I think this probably makes sense, but there are many more instances of > %Ld and %Lu in the xfs code, so why change just these 3? > > $ cd fs/xfs > $ grep -r "%Lu\|%Ld" . > ./libxfs/xfs_inode_fork.c: "corrupt inode %Lu (bad size %d for local fork, size = %zd).", > ./libxfs/xfs_inode_fork.c: xfs_warn(mp, "corrupt inode %Lu (btree).", > ./libxfs/xfs_bmap.c: xfs_warn(mp, "%s: thispa(%d) == pp(%d) %Ld", > ./xfs_inode.c: "%s: Bad inode %Lu magic number 0x%x, ptr "PTR_FMT, > ./xfs_inode.c: "%s: Bad regular inode %Lu, ptr "PTR_FMT, > ./xfs_inode.c: "%s: Bad directory inode %Lu, ptr "PTR_FMT, > ./xfs_inode.c: "%s: bad inode %Lu, forkoff 0x%x, ptr "PTR_FMT, > ./xfs_stats.c: len += scnprintf(buf + len, PATH_MAX-len, "xpc %Lu %Lu %Lu\n", > ./cscope/csdb:, "corrupt inode %Lu (btree).", > ./cscope/csdb:", dino bp = "PTR_FMT", ino = %Ld", > ./cscope/csdb:", ino %Ld", > ./cscope/csdb:-len, "xpc %Lu %Lu %Lu\n", > ./xfs_inode_item_recover.c: "%s: Bad inode magic number, dip = "PTR_FMT", dino bp = "PTR_FMT", ino = %Ld", > ./xfs_inode_item_recover.c: "%s: Bad inode log record, rec ptr "PTR_FMT", ino %Ld", > > >> --- >> fs/xfs/xfs_inode_item_recover.c | 4 ++-- >> fs/xfs/xfs_stats.c | 2 +- >> 2 files changed, 3 insertions(+), 3 deletions(-) >> >> diff --git a/fs/xfs/xfs_inode_item_recover.c b/fs/xfs/xfs_inode_item_recover.c >> index d28ffaebd067..0e5dba2343ea 100644 >> --- a/fs/xfs/xfs_inode_item_recover.c >> +++ b/fs/xfs/xfs_inode_item_recover.c >> @@ -321,7 +321,7 @@ xlog_recover_inode_commit_pass2( >> */ >> if (XFS_IS_CORRUPT(mp, !xfs_verify_magic16(bp, dip->di_magic))) { >> xfs_alert(mp, >> - "%s: Bad inode magic number, dip = "PTR_FMT", dino bp = "PTR_FMT", ino = %Ld", >> + "%s: Bad inode magic number, dip = "PTR_FMT", dino bp = "PTR_FMT", ino = %lld", >> __func__, dip, bp, in_f->ilf_ino); >> error = -EFSCORRUPTED; >> goto out_release; >> @@ -329,7 +329,7 @@ xlog_recover_inode_commit_pass2( >> ldip = item->ri_buf[1].i_addr; >> if (XFS_IS_CORRUPT(mp, ldip->di_magic != XFS_DINODE_MAGIC)) { >> xfs_alert(mp, >> - "%s: Bad inode log record, rec ptr "PTR_FMT", ino %Ld", >> + "%s: Bad inode log record, rec ptr "PTR_FMT", ino %lld", >> __func__, item, in_f->ilf_ino); >> error = -EFSCORRUPTED; >> goto out_release; >> diff --git a/fs/xfs/xfs_stats.c b/fs/xfs/xfs_stats.c >> index 70d38b77682b..90a77cd3ebad 100644 >> --- a/fs/xfs/xfs_stats.c >> +++ b/fs/xfs/xfs_stats.c >> @@ -74,7 +74,7 @@ int xfs_stats_format(struct xfsstats __percpu *stats, char *buf) >> defer_relog += per_cpu_ptr(stats, i)->s.defer_relog; >> } >> >> - len += scnprintf(buf + len, PATH_MAX-len, "xpc %Lu %Lu %Lu\n", >> + len += scnprintf(buf + len, PATH_MAX-len, "xpc %llu %llu %llu\n", >> xs_xstrat_bytes, xs_write_bytes, xs_read_bytes); >> len += scnprintf(buf + len, PATH_MAX-len, "defer_relog %llu\n", >> defer_relog); ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-08-31 2:01 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-08-30 13:54 [PATCH -next] xfs: remove "%Ld" which doesn't meet C standard Zeng Heng 2022-08-30 14:51 ` Eric Sandeen 2022-08-31 2:01 ` Zeng Heng
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).