Skip to contentSkip to conversation

erofs-utils: lib: get rid of unused erofs_ftype_to_dtype()

PATCH New Gao Xiang 1 participant 2 messages Oct 7 Library code

lore
Share & tools
lore

Gao Xiang

author
#0 lore raw

PATCH 1/2 erofs-utils: lib: get rid of unused erofs_ftype_to_dtype()

It has been unused since commit 9fd2a2250fa9 ("erofs-utils: fuse: switch to FUSE 2/3 lowlevel APIs").

---
 include/erofs/inode.h |  1 -
 lib/inode.c           | 19 -------------------
 2 files changed, 20 deletions(-)
include/erofs/inode.h +0 -1
index 23848e8..5b67b95 100644
@@ -28,7 +28,6 @@ struct erofs_importer;
 u32 erofs_new_encode_dev(dev_t dev);
 unsigned char erofs_mode_to_ftype(umode_t mode);
 umode_t erofs_ftype_to_mode(unsigned int ftype, unsigned int perm);
-unsigned char erofs_ftype_to_dtype(unsigned int filetype);
 void erofs_inode_manager_init(void);
 void erofs_insert_ihash(struct erofs_inode *inode);
 void erofs_remove_ihash(struct erofs_inode *inode);
lib/inode.c +0 -19
index d819659..da29b5a 100644
@@ -54,17 +54,6 @@ unsigned char erofs_mode_to_ftype(umode_t mode)
 	return erofs_ftype_by_mode[(mode & S_IFMT) >> S_SHIFT];
 }
 
-static const unsigned char erofs_dtype_by_ftype[EROFS_FT_MAX] = {
-	[EROFS_FT_UNKNOWN]	= DT_UNKNOWN,
-	[EROFS_FT_REG_FILE]	= DT_REG,
-	[EROFS_FT_DIR]		= DT_DIR,
-	[EROFS_FT_CHRDEV]	= DT_CHR,
-	[EROFS_FT_BLKDEV]	= DT_BLK,
-	[EROFS_FT_FIFO]		= DT_FIFO,
-	[EROFS_FT_SOCK]		= DT_SOCK,
-	[EROFS_FT_SYMLINK]	= DT_LNK
-};
-
 static const umode_t erofs_dtype_by_umode[EROFS_FT_MAX] = {
 	[EROFS_FT_UNKNOWN]	= S_IFMT,
 	[EROFS_FT_REG_FILE]	= S_IFREG,
@@ -84,14 +73,6 @@ umode_t erofs_ftype_to_mode(unsigned int ftype, unsigned int perm)
 	return erofs_dtype_by_umode[ftype] | perm;
 }
 
-unsigned char erofs_ftype_to_dtype(unsigned int filetype)
-{
-	if (filetype >= EROFS_FT_MAX)
-		return DT_UNKNOWN;
-
-	return erofs_dtype_by_ftype[filetype];
-}
-
 static struct list_head erofs_ihash[65536];
 static erofs_rwsem_t erofs_ihashlock;
 
Signature · 1 line
2.50.1 (Apple Git-155)
author
#1 lore raw

PATCH 2/2 erofs-utils: tar: Fix printing uninitialized memory from xattr value

From: Andrew Gunnerson <[email protected]>

---
 lib/tar.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
lib/tar.c +4 -4
index f24ad95..560036e 100644
@@ -416,12 +416,12 @@ int tarerofs_apply_xattrs(struct erofs_inode *inode, struct list_head *xattrs)
 			continue;
 		}
 		item->kv[item->namelen] = '\0';
-		erofs_dbg("Recording xattr(%s)=\"%s\" (of %u bytes) to file %s",
-			  item->kv, v, vsz, inode->i_srcpath);
+		erofs_dbg("Recording xattr(%s)=\"%.*s\" (of %u bytes) to file %s",
+			  item->kv, vsz, v, vsz, inode->i_srcpath);
 		ret = erofs_vfs_setxattr(inode, item->kv, v, vsz);
 		if (ret == -ENODATA)
-			erofs_err("Failed to set xattr(%s)=%s to file %s",
-				  item->kv, v, inode->i_srcpath);
+			erofs_err("Failed to set xattr(%s)=%.*s to file %s",
+				  item->kv, vsz, v, inode->i_srcpath);
 		else if (ret)
 			return ret;
 	}
Signature · 1 line
2.50.1 (Apple Git-155)