erofs-utils: mkfs: twist calculation of shared_xattr_id
PATCH 1/1 erofs-utils: mkfs: twist calculation of shared_xattr_id
The on-disk format specifies that share xattr can be addressed by:
xattr offset = xattr_blkaddr * block_size + 4 * shared_xattr_id
That is, the shared_xattr_id is calculated from the xattr offset (starting from xattr_blkaddr) divided by 4. Make this semantics explicitly by calculating the divisor from 'sizeof(__le32)'.
It has no logic change.
--- lib/xattr.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
lib/xattr.c +1 -2
@@ -643,8 +643,7 @@ int erofs_build_shared_xattrs_from_path(const char *path) .e_value_size = cpu_to_le16(item->len[1]) }; - item->shared_xattr_id = (off + p) / -sizeof (struct erofs_xattr_entry ); + item->shared_xattr_id = (off + p) /sizeof (__le32);memcpy (buf + p, &entry,sizeof (entry)); p +=sizeof (struct erofs_xattr_entry );
Signature · 1 line
2.19.1.6.gb485710b
Quoted 11 lines · Jingbo Xu
The on-disk format specifies that share xattr can be addressed by:
xattr offset =
xattr_blkaddr*block_size+ 4 *shared_xattr_idThat is, the
shared_xattr_idis calculated from the xattr offset (starting fromxattr_blkaddr) divided by 4. Make this semantics explicitly by calculating the divisor from 'sizeof(__le32)'.It has no logic change.
Signed-off-by Jingbo Xu <[email protected]>
Thanks,
Gao Xiang