Skip to contentSkip to conversation

signed char cleanup/fixes (10/11)

PATCH New OGAWA Hirofumi 1 participant 1 message Jul 21, 2003 VFAT/FAT/msdos filesystem

lore
Share & tools
lore

OGAWA Hirofumi

author maintainer
#0 lore raw

PATCH 1/1 signed char cleanup/fixes (10/11)

This changes char type of filename to unsigned char more.

 fs/fat/dir.c             |   20 +++++++++----------
 fs/fat/inode.c           |    6 ++---
 fs/fat/misc.c            |    5 ++--
 fs/msdos/namei.c         |   46 ++++++++++++++++++++++-----------------------
 fs/vfat/namei.c          |   48 ++++++++++++++++++++++++++---------------------
 include/linux/msdos_fs.h |   15 +++++++-------
 6 files changed, 74 insertions(+), 66 deletions(-)
fs/fat/dir.c renamed from fs/fat/dir.c~fat_char-to-unsigned_char +10 -10
diff -puN fs/fat/dir.c~fat_char-to-unsigned_char fs/fat/dir.c
@@ -152,7 +152,7 @@ fat_strnicmp(struct nls_table *t, const 
 }
 
 static inline int
-fat_shortname2uni(struct nls_table *nls, char *buf, int buf_size,
+fat_shortname2uni(struct nls_table *nls, unsigned char *buf, int buf_size,
 		  wchar_t *uni_buf, unsigned short opt, int lower)
 {
 	int len = 0;
@@ -176,8 +176,8 @@ fat_shortname2uni(struct nls_table *nls,
  * Return values: negative -> error, 0 -> not found, positive -> found,
  * value is the total amount of slots, including the shortname entry.
  */
-int fat_search_long(struct inode *inode, const char *name, int name_len,
-			int anycase, loff_t *spos, loff_t *lpos)
+int fat_search_long(struct inode *inode, const unsigned char *name,
+		    int name_len, int anycase, loff_t *spos, loff_t *lpos)
 {
 	struct super_block *sb = inode->i_sb;
 	struct buffer_head *bh = NULL;
@@ -187,7 +187,7 @@ int fat_search_long(struct inode *inode,
 	wchar_t bufuname[14];
 	unsigned char xlate_len, long_slots;
 	wchar_t *unicode = NULL;
-	char work[8], bufname[260];	/* 256 + 4 */
+	unsigned char work[8], bufname[260];	/* 256 + 4 */
 	int uni_xlate = MSDOS_SB(sb)->options.unicode_xlate;
 	int utf8 = MSDOS_SB(sb)->options.utf8;
 	unsigned short opt_shortname = MSDOS_SB(sb)->options.shortname;
@@ -199,7 +199,7 @@ int fat_search_long(struct inode *inode,
 			goto EODir;
 parse_record:
 		long_slots = 0;
-		if (de->name[0] == (__s8) DELETED_FLAG)
+		if (de->name[0] == DELETED_FLAG)
 			continue;
 		if (de->attr != ATTR_EXT && (de->attr & ATTR_VOLUME))
 			continue;
@@ -258,7 +258,7 @@ parse_long:
 				if (ds->alias_checksum != alias_checksum)
 					goto parse_long;
 			}
-			if (de->name[0] == (__s8) DELETED_FLAG)
+			if (de->name[0] == DELETED_FLAG)
 				continue;
 			if (de->attr ==  ATTR_EXT)
 				goto parse_long;
@@ -351,7 +351,7 @@ static int fat_readdirx(struct inode *in
 	wchar_t bufuname[14];
 	unsigned char long_slots;
 	wchar_t *unicode = NULL;
-	char c, work[8], bufname[56], *ptname = bufname;
+	unsigned char c, work[8], bufname[56], *ptname = bufname;
 	unsigned long lpos, dummy, *furrfu = &lpos;
 	int uni_xlate = MSDOS_SB(sb)->options.unicode_xlate;
 	int isvfat = MSDOS_SB(sb)->options.isvfat;
@@ -392,7 +392,7 @@ GetNew:
 		goto EODir;
 	/* Check for long filename entry */
 	if (isvfat) {
-		if (de->name[0] == (__s8) DELETED_FLAG)
+		if (de->name[0] == DELETED_FLAG)
 			goto RecEnd;
 		if (de->attr != ATTR_EXT && (de->attr & ATTR_VOLUME))
 			goto RecEnd;
@@ -458,7 +458,7 @@ ParseLong:
 			if (ds->alias_checksum != alias_checksum)
 				goto ParseLong;
 		}
-		if (de->name[0] == (__s8) DELETED_FLAG)
+		if (de->name[0] == DELETED_FLAG)
 			goto RecEnd;
 		if (de->attr ==  ATTR_EXT)
 			goto ParseLong;
@@ -555,7 +555,7 @@ ParseLong:
 			    (de->attr & ATTR_DIR) ? DT_DIR : DT_REG) < 0)
 			goto FillFailed;
 	} else {
-		char longname[275];
+		unsigned char longname[275];
 		int long_len = utf8
 			? utf8_wcstombs(longname, unicode, sizeof(longname))
 			: uni16_to_x8(longname, unicode, uni_xlate,
fs/fat/inode.c renamed from fs/fat/inode.c~fat_char-to-unsigned_char +3 -3
diff -puN fs/fat/inode.c~fat_char-to-unsigned_char fs/fat/inode.c
@@ -734,7 +734,7 @@ int fat_fill_super(struct super_block *s
 	struct msdos_sb_info *sbi;
 	int logical_sector_size, fat_clusters, debug, cp, first;
 	unsigned int total_sectors, rootdir_sectors;
-	unsigned char media;
+	unsigned int media;
 	long error;
 	char buf[50];
 
@@ -1037,9 +1037,9 @@ int fat_statfs(struct super_block *sb, s
 	return 0;
 }
 
-static int is_exec(char *extension)
+static int is_exec(unsigned char *extension)
 {
-	char *exe_extensions = "EXECOMBAT", *walk;
+	unsigned char *exe_extensions = "EXECOMBAT", *walk;
 
 	for (walk = exe_extensions; *walk; walk += 3)
 		if (!strncmp(extension, walk, 3))
fs/fat/misc.c renamed from fs/fat/misc.c~fat_char-to-unsigned_char +3 -2
diff -puN fs/fat/misc.c~fat_char-to-unsigned_char fs/fat/misc.c
@@ -346,8 +346,9 @@ int fat_subdirs(struct inode *dir)
  * Scans a directory for a given file (name points to its formatted name).
  * Returns an error code or zero.
  */
-int fat_scan(struct inode *dir, const char *name, struct buffer_head **bh,
-	     struct msdos_dir_entry **de, loff_t *i_pos)
+int fat_scan(struct inode *dir, const unsigned char *name,
+	     struct buffer_head **bh, struct msdos_dir_entry **de,
+	     loff_t *i_pos)
 {
 	loff_t cpos;
 
fs/msdos/namei.c renamed from fs/msdos/namei.c~fat_char-to-unsigned_char +23 -23

119 lines not on this page · raw message

fs/vfat/namei.c renamed from fs/vfat/namei.c~fat_char-to-unsigned_char +27 -21

125 lines not on this page · raw message

include/linux/msdos_fs.h renamed from include/linux/msdos_fs.h~fat_char-to-unsigned_char +8 -7
diff -puN include/linux/msdos_fs.h~fat_char-to-unsigned_char include/linux/msdos_fs.h
@@ -44,7 +44,7 @@ struct statfs;
 #define CASE_LOWER_EXT  16	/* extension is lower case */
 
 #define DELETED_FLAG 0xe5 /* marks file as deleted when in name[0] */
-#define IS_FREE(n) (!*(n) || *(const unsigned char *) (n) == DELETED_FLAG)
+#define IS_FREE(n) (!*(n) || *(n) == DELETED_FLAG)
 
 #define MSDOS_VALID_MODE (S_IFREG | S_IFDIR | S_IRWXU | S_IRWXG | S_IRWXO)
 	/* valid file mode bits */
@@ -113,8 +113,8 @@ struct statfs;
 #define CT_LE_L(v) cpu_to_le32(v)
 
 struct fat_boot_sector {
-	__s8	ignored[3];	/* Boot strap short or near jump */
-	__s8	system_id[8];	/* Name - can be used to special case
+	__u8	ignored[3];	/* Boot strap short or near jump */
+	__u8	system_id[8];	/* Name - can be used to special case
 				   partition manager volumes */
 	__u8	sector_size[2];	/* bytes per logical sector */
 	__u8	cluster_size;	/* sectors/cluster */
@@ -149,7 +149,7 @@ struct fat_boot_fsinfo {
 };
 
 struct msdos_dir_entry {
-	__s8	name[8],ext[3];	/* name and extension */
+	__u8	name[8],ext[3];	/* name and extension */
 	__u8	attr;		/* attribute bits */
 	__u8    lcase;		/* Case for base and extension */
 	__u8	ctime_ms;	/* Creation time, milliseconds */
@@ -243,8 +243,9 @@ extern int fat_free(struct inode *inode,
 
 /* fat/dir.c */
 extern struct file_operations fat_dir_operations;
-extern int fat_search_long(struct inode *inode, const char *name, int name_len,
-			   int anycase, loff_t *spos, loff_t *lpos);
+extern int fat_search_long(struct inode *inode, const unsigned char *name,
+			   int name_len, int anycase,
+			   loff_t *spos, loff_t *lpos);
 extern int fat_readdir(struct file *filp, void *dirent, filldir_t filldir);
 extern int fat_dir_ioctl(struct inode * inode, struct file * filp,
 			 unsigned int cmd, unsigned long arg);
@@ -304,7 +305,7 @@ static __inline__ int fat_get_entry(stru
 	return fat__get_entry(dir, pos, bh, de, i_pos);
 }
 extern int fat_subdirs(struct inode *dir);
-extern int fat_scan(struct inode *dir, const char *name,
+extern int fat_scan(struct inode *dir, const unsigned char *name,
 		    struct buffer_head **res_bh,
 		    struct msdos_dir_entry **res_de, loff_t *i_pos);
 

_

Signature · 1 line
OGAWA Hirofumi <[email protected]>