Commit 4b186721 authored by Valdis Kletnieks's avatar Valdis Kletnieks Committed by Greg Kroah-Hartman

staging: exfat: Clean up return codes - FFS_SUCCESS

Convert FFS_SUCCESS to 0.
Signed-off-by: default avatarValdis Kletnieks <Valdis.Kletnieks@vt.edu>
Link: https://lore.kernel.org/r/20191112021000.42091-8-Valdis.Kletnieks@vt.eduSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 97eab6ce
...@@ -208,9 +208,6 @@ static inline u16 get_row_index(u16 i) ...@@ -208,9 +208,6 @@ static inline u16 get_row_index(u16 i)
#define FM_REGULAR 0x00 #define FM_REGULAR 0x00
#define FM_SYMLINK 0x40 #define FM_SYMLINK 0x40
/* return values */
#define FFS_SUCCESS 0
#define NUM_UPCASE 2918 #define NUM_UPCASE 2918
#define DOS_CUR_DIR_NAME ". " #define DOS_CUR_DIR_NAME ". "
......
...@@ -462,7 +462,7 @@ u8 *FAT_getblk(struct super_block *sb, sector_t sec) ...@@ -462,7 +462,7 @@ u8 *FAT_getblk(struct super_block *sb, sector_t sec)
FAT_cache_insert_hash(sb, bp); FAT_cache_insert_hash(sb, bp);
if (sector_read(sb, sec, &bp->buf_bh, 1) != FFS_SUCCESS) { if (sector_read(sb, sec, &bp->buf_bh, 1) != 0) {
FAT_cache_remove_hash(bp); FAT_cache_remove_hash(bp);
bp->drv = -1; bp->drv = -1;
bp->sec = ~0; bp->sec = ~0;
...@@ -582,7 +582,7 @@ static u8 *__buf_getblk(struct super_block *sb, sector_t sec) ...@@ -582,7 +582,7 @@ static u8 *__buf_getblk(struct super_block *sb, sector_t sec)
buf_cache_insert_hash(sb, bp); buf_cache_insert_hash(sb, bp);
if (sector_read(sb, sec, &bp->buf_bh, 1) != FFS_SUCCESS) { if (sector_read(sb, sec, &bp->buf_bh, 1) != 0) {
buf_cache_remove_hash(bp); buf_cache_remove_hash(bp);
bp->drv = -1; bp->drv = -1;
bp->sec = ~0; bp->sec = ~0;
......
...@@ -102,7 +102,7 @@ void fs_set_vol_flags(struct super_block *sb, u32 new_flag) ...@@ -102,7 +102,7 @@ void fs_set_vol_flags(struct super_block *sb, u32 new_flag)
if (p_fs->vol_type == EXFAT) { if (p_fs->vol_type == EXFAT) {
if (!p_fs->pbr_bh) { if (!p_fs->pbr_bh) {
if (sector_read(sb, p_fs->PBR_sector, if (sector_read(sb, p_fs->PBR_sector,
&p_fs->pbr_bh, 1) != FFS_SUCCESS) &p_fs->pbr_bh, 1) != 0)
return; return;
} }
...@@ -139,7 +139,7 @@ void fs_error(struct super_block *sb) ...@@ -139,7 +139,7 @@ void fs_error(struct super_block *sb)
s32 clear_cluster(struct super_block *sb, u32 clu) s32 clear_cluster(struct super_block *sb, u32 clu)
{ {
sector_t s, n; sector_t s, n;
s32 ret = FFS_SUCCESS; s32 ret = 0;
struct buffer_head *tmp_bh = NULL; struct buffer_head *tmp_bh = NULL;
struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info); struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info);
struct bd_info_t *p_bd = &(EXFAT_SB(sb)->bd_info); struct bd_info_t *p_bd = &(EXFAT_SB(sb)->bd_info);
...@@ -154,12 +154,12 @@ s32 clear_cluster(struct super_block *sb, u32 clu) ...@@ -154,12 +154,12 @@ s32 clear_cluster(struct super_block *sb, u32 clu)
for (; s < n; s++) { for (; s < n; s++) {
ret = sector_read(sb, s, &tmp_bh, 0); ret = sector_read(sb, s, &tmp_bh, 0);
if (ret != FFS_SUCCESS) if (ret != 0)
return ret; return ret;
memset((char *)tmp_bh->b_data, 0x0, p_bd->sector_size); memset((char *)tmp_bh->b_data, 0x0, p_bd->sector_size);
ret = sector_write(sb, s, tmp_bh, 0); ret = sector_write(sb, s, tmp_bh, 0);
if (ret != FFS_SUCCESS) if (ret != 0)
break; break;
} }
...@@ -251,7 +251,7 @@ s32 exfat_alloc_cluster(struct super_block *sb, s32 num_alloc, ...@@ -251,7 +251,7 @@ s32 exfat_alloc_cluster(struct super_block *sb, s32 num_alloc,
} }
} }
if (set_alloc_bitmap(sb, new_clu - 2) != FFS_SUCCESS) if (set_alloc_bitmap(sb, new_clu - 2) != 0)
return -EIO; return -EIO;
num_clusters++; num_clusters++;
...@@ -370,7 +370,7 @@ void exfat_free_cluster(struct super_block *sb, struct chain_t *p_chain, ...@@ -370,7 +370,7 @@ void exfat_free_cluster(struct super_block *sb, struct chain_t *p_chain,
buf_release(sb, sector + i); buf_release(sb, sector + i);
} }
if (clr_alloc_bitmap(sb, clu - 2) != FFS_SUCCESS) if (clr_alloc_bitmap(sb, clu - 2) != 0)
break; break;
clu++; clu++;
...@@ -387,7 +387,7 @@ void exfat_free_cluster(struct super_block *sb, struct chain_t *p_chain, ...@@ -387,7 +387,7 @@ void exfat_free_cluster(struct super_block *sb, struct chain_t *p_chain,
buf_release(sb, sector + i); buf_release(sb, sector + i);
} }
if (clr_alloc_bitmap(sb, clu - 2) != FFS_SUCCESS) if (clr_alloc_bitmap(sb, clu - 2) != 0)
break; break;
if (FAT_read(sb, clu, &clu) == -1) if (FAT_read(sb, clu, &clu) == -1)
...@@ -552,7 +552,7 @@ s32 load_alloc_bitmap(struct super_block *sb) ...@@ -552,7 +552,7 @@ s32 load_alloc_bitmap(struct super_block *sb)
for (j = 0; j < p_fs->map_sectors; j++) { for (j = 0; j < p_fs->map_sectors; j++) {
p_fs->vol_amap[j] = NULL; p_fs->vol_amap[j] = NULL;
ret = sector_read(sb, sector + j, &p_fs->vol_amap[j], 1); ret = sector_read(sb, sector + j, &p_fs->vol_amap[j], 1);
if (ret != FFS_SUCCESS) { if (ret != 0) {
/* release all buffers and free vol_amap */ /* release all buffers and free vol_amap */
i = 0; i = 0;
while (i < j) while (i < j)
...@@ -565,7 +565,7 @@ s32 load_alloc_bitmap(struct super_block *sb) ...@@ -565,7 +565,7 @@ s32 load_alloc_bitmap(struct super_block *sb)
} }
p_fs->pbr_bh = NULL; p_fs->pbr_bh = NULL;
return FFS_SUCCESS; return 0;
} }
} }
...@@ -721,7 +721,7 @@ static s32 __load_upcase_table(struct super_block *sb, sector_t sector, ...@@ -721,7 +721,7 @@ static s32 __load_upcase_table(struct super_block *sb, sector_t sector,
while (sector < end_sector) { while (sector < end_sector) {
ret = sector_read(sb, sector, &tmp_bh, 1); ret = sector_read(sb, sector, &tmp_bh, 1);
if (ret != FFS_SUCCESS) { if (ret != 0) {
pr_debug("sector read (0x%llX)fail\n", pr_debug("sector read (0x%llX)fail\n",
(unsigned long long)sector); (unsigned long long)sector);
goto error; goto error;
...@@ -772,7 +772,7 @@ static s32 __load_upcase_table(struct super_block *sb, sector_t sector, ...@@ -772,7 +772,7 @@ static s32 __load_upcase_table(struct super_block *sb, sector_t sector,
if (index >= 0xFFFF && utbl_checksum == checksum) { if (index >= 0xFFFF && utbl_checksum == checksum) {
if (tmp_bh) if (tmp_bh)
brelse(tmp_bh); brelse(tmp_bh);
return FFS_SUCCESS; return 0;
} }
ret = -EINVAL; ret = -EINVAL;
error: error:
...@@ -833,7 +833,7 @@ static s32 __load_default_upcase_table(struct super_block *sb) ...@@ -833,7 +833,7 @@ static s32 __load_default_upcase_table(struct super_block *sb)
} }
if (index >= 0xFFFF) if (index >= 0xFFFF)
return FFS_SUCCESS; return 0;
error: error:
/* FATAL error: default upcase table has error */ /* FATAL error: default upcase table has error */
...@@ -878,9 +878,9 @@ s32 load_upcase_table(struct super_block *sb) ...@@ -878,9 +878,9 @@ s32 load_upcase_table(struct super_block *sb)
sector = START_SECTOR(tbl_clu); sector = START_SECTOR(tbl_clu);
num_sectors = ((tbl_size - 1) >> p_bd->sector_size_bits) + 1; num_sectors = ((tbl_size - 1) >> p_bd->sector_size_bits) + 1;
if (__load_upcase_table(sb, sector, num_sectors, if (__load_upcase_table(sb, sector, num_sectors,
GET32_A(ep->checksum)) != FFS_SUCCESS) GET32_A(ep->checksum)) != 0)
break; break;
return FFS_SUCCESS; return 0;
} }
if (FAT_read(sb, clu.dir, &clu.dir) != 0) if (FAT_read(sb, clu.dir, &clu.dir) != 0)
return -EIO; return -EIO;
...@@ -1251,7 +1251,7 @@ s32 fat_init_dir_entry(struct super_block *sb, struct chain_t *p_dir, s32 entry, ...@@ -1251,7 +1251,7 @@ s32 fat_init_dir_entry(struct super_block *sb, struct chain_t *p_dir, s32 entry,
init_dos_entry(dos_ep, type, start_clu); init_dos_entry(dos_ep, type, start_clu);
buf_modify(sb, sector); buf_modify(sb, sector);
return FFS_SUCCESS; return 0;
} }
s32 exfat_init_dir_entry(struct super_block *sb, struct chain_t *p_dir, s32 exfat_init_dir_entry(struct super_block *sb, struct chain_t *p_dir,
...@@ -1281,7 +1281,7 @@ s32 exfat_init_dir_entry(struct super_block *sb, struct chain_t *p_dir, ...@@ -1281,7 +1281,7 @@ s32 exfat_init_dir_entry(struct super_block *sb, struct chain_t *p_dir,
init_strm_entry(strm_ep, flags, start_clu, size); init_strm_entry(strm_ep, flags, start_clu, size);
buf_modify(sb, sector); buf_modify(sb, sector);
return FFS_SUCCESS; return 0;
} }
static s32 fat_init_ext_entry(struct super_block *sb, struct chain_t *p_dir, static s32 fat_init_ext_entry(struct super_block *sb, struct chain_t *p_dir,
...@@ -1332,7 +1332,7 @@ static s32 fat_init_ext_entry(struct super_block *sb, struct chain_t *p_dir, ...@@ -1332,7 +1332,7 @@ static s32 fat_init_ext_entry(struct super_block *sb, struct chain_t *p_dir,
buf_modify(sb, sector); buf_modify(sb, sector);
} }
return FFS_SUCCESS; return 0;
} }
static s32 exfat_init_ext_entry(struct super_block *sb, struct chain_t *p_dir, static s32 exfat_init_ext_entry(struct super_block *sb, struct chain_t *p_dir,
...@@ -1378,7 +1378,7 @@ static s32 exfat_init_ext_entry(struct super_block *sb, struct chain_t *p_dir, ...@@ -1378,7 +1378,7 @@ static s32 exfat_init_ext_entry(struct super_block *sb, struct chain_t *p_dir,
update_dir_checksum(sb, p_dir, entry); update_dir_checksum(sb, p_dir, entry);
return FFS_SUCCESS; return 0;
} }
void init_dos_entry(struct dos_dentry_t *ep, u32 type, u32 start_clu) void init_dos_entry(struct dos_dentry_t *ep, u32 type, u32 start_clu)
...@@ -1599,7 +1599,7 @@ static s32 _walk_fat_chain(struct super_block *sb, struct chain_t *p_dir, ...@@ -1599,7 +1599,7 @@ static s32 _walk_fat_chain(struct super_block *sb, struct chain_t *p_dir,
if (clu) if (clu)
*clu = cur_clu; *clu = cur_clu;
return FFS_SUCCESS; return 0;
} }
s32 find_location(struct super_block *sb, struct chain_t *p_dir, s32 entry, s32 find_location(struct super_block *sb, struct chain_t *p_dir, s32 entry,
...@@ -1618,7 +1618,7 @@ s32 find_location(struct super_block *sb, struct chain_t *p_dir, s32 entry, ...@@ -1618,7 +1618,7 @@ s32 find_location(struct super_block *sb, struct chain_t *p_dir, s32 entry,
*sector += p_fs->root_start_sector; *sector += p_fs->root_start_sector;
} else { } else {
ret = _walk_fat_chain(sb, p_dir, off, &clu); ret = _walk_fat_chain(sb, p_dir, off, &clu);
if (ret != FFS_SUCCESS) if (ret != 0)
return ret; return ret;
/* byte offset in cluster */ /* byte offset in cluster */
...@@ -1631,7 +1631,7 @@ s32 find_location(struct super_block *sb, struct chain_t *p_dir, s32 entry, ...@@ -1631,7 +1631,7 @@ s32 find_location(struct super_block *sb, struct chain_t *p_dir, s32 entry,
*sector = off >> p_bd->sector_size_bits; *sector = off >> p_bd->sector_size_bits;
*sector += START_SECTOR(clu); *sector += START_SECTOR(clu);
} }
return FFS_SUCCESS; return 0;
} }
struct dentry_t *get_entry_with_sector(struct super_block *sb, sector_t sector, struct dentry_t *get_entry_with_sector(struct super_block *sb, sector_t sector,
...@@ -1654,7 +1654,7 @@ struct dentry_t *get_entry_in_dir(struct super_block *sb, struct chain_t *p_dir, ...@@ -1654,7 +1654,7 @@ struct dentry_t *get_entry_in_dir(struct super_block *sb, struct chain_t *p_dir,
sector_t sec; sector_t sec;
u8 *buf; u8 *buf;
if (find_location(sb, p_dir, entry, &sec, &off) != FFS_SUCCESS) if (find_location(sb, p_dir, entry, &sec, &off) != 0)
return NULL; return NULL;
buf = buf_getblk(sb, sec); buf = buf_getblk(sb, sec);
...@@ -1708,7 +1708,7 @@ struct entry_set_cache_t *get_entry_set_in_dir(struct super_block *sb, ...@@ -1708,7 +1708,7 @@ struct entry_set_cache_t *get_entry_set_in_dir(struct super_block *sb,
byte_offset = entry << DENTRY_SIZE_BITS; byte_offset = entry << DENTRY_SIZE_BITS;
ret = _walk_fat_chain(sb, p_dir, byte_offset, &clu); ret = _walk_fat_chain(sb, p_dir, byte_offset, &clu);
if (ret != FFS_SUCCESS) if (ret != 0)
return NULL; return NULL;
/* byte offset in cluster */ /* byte offset in cluster */
...@@ -1903,7 +1903,7 @@ static s32 __write_partial_entries_in_entry_set(struct super_block *sb, ...@@ -1903,7 +1903,7 @@ static s32 __write_partial_entries_in_entry_set(struct super_block *sb,
} }
pr_debug("%s exited successfully\n", __func__); pr_debug("%s exited successfully\n", __func__);
return FFS_SUCCESS; return 0;
err_out: err_out:
pr_debug("%s failed\n", __func__); pr_debug("%s failed\n", __func__);
return -EINVAL; return -EINVAL;
...@@ -1942,7 +1942,7 @@ s32 write_partial_entries_in_entry_set(struct super_block *sb, ...@@ -1942,7 +1942,7 @@ s32 write_partial_entries_in_entry_set(struct super_block *sb,
byte_offset += ((void **)ep - &es->__buf) + es->offset; byte_offset += ((void **)ep - &es->__buf) + es->offset;
ret = _walk_fat_chain(sb, &dir, byte_offset, &clu); ret = _walk_fat_chain(sb, &dir, byte_offset, &clu);
if (ret != FFS_SUCCESS) if (ret != 0)
return ret; return ret;
/* byte offset in cluster */ /* byte offset in cluster */
...@@ -2086,7 +2086,7 @@ s32 find_empty_entry(struct inode *inode, struct chain_t *p_dir, s32 num_entries ...@@ -2086,7 +2086,7 @@ s32 find_empty_entry(struct inode *inode, struct chain_t *p_dir, s32 num_entries
if (ret < 1) if (ret < 1)
return -EIO; return -EIO;
if (clear_cluster(sb, clu.dir) != FFS_SUCCESS) if (clear_cluster(sb, clu.dir) != 0)
return -EIO; return -EIO;
/* (2) append to the FAT chain */ /* (2) append to the FAT chain */
...@@ -2597,7 +2597,7 @@ s32 get_num_entries_and_dos_name(struct super_block *sb, struct chain_t *p_dir, ...@@ -2597,7 +2597,7 @@ s32 get_num_entries_and_dos_name(struct super_block *sb, struct chain_t *p_dir,
*entries = num_entries; *entries = num_entries;
return FFS_SUCCESS; return 0;
} }
void get_uni_name_from_dos_entry(struct super_block *sb, void get_uni_name_from_dos_entry(struct super_block *sb,
...@@ -2833,7 +2833,7 @@ s32 fat_generate_dos_name(struct super_block *sb, struct chain_t *p_dir, ...@@ -2833,7 +2833,7 @@ s32 fat_generate_dos_name(struct super_block *sb, struct chain_t *p_dir,
fat_attach_count_to_dos_name(p_dosname->name, count); fat_attach_count_to_dos_name(p_dosname->name, count);
/* Now dos_name has DOS~????.EXT */ /* Now dos_name has DOS~????.EXT */
return FFS_SUCCESS; return 0;
} }
void fat_attach_count_to_dos_name(u8 *dosname, s32 count) void fat_attach_count_to_dos_name(u8 *dosname, s32 count)
...@@ -2975,7 +2975,7 @@ s32 resolve_path(struct inode *inode, char *path, struct chain_t *p_dir, ...@@ -2975,7 +2975,7 @@ s32 resolve_path(struct inode *inode, char *path, struct chain_t *p_dir,
p_dir->size = (s32)(fid->size >> p_fs->cluster_size_bits); p_dir->size = (s32)(fid->size >> p_fs->cluster_size_bits);
p_dir->flags = fid->flags; p_dir->flags = fid->flags;
return FFS_SUCCESS; return 0;
} }
/* /*
...@@ -3067,7 +3067,7 @@ s32 fat16_mount(struct super_block *sb, struct pbr_sector_t *p_pbr) ...@@ -3067,7 +3067,7 @@ s32 fat16_mount(struct super_block *sb, struct pbr_sector_t *p_pbr)
p_fs->fs_func = &fat_fs_func; p_fs->fs_func = &fat_fs_func;
return FFS_SUCCESS; return 0;
} }
s32 fat32_mount(struct super_block *sb, struct pbr_sector_t *p_pbr) s32 fat32_mount(struct super_block *sb, struct pbr_sector_t *p_pbr)
...@@ -3120,7 +3120,7 @@ s32 fat32_mount(struct super_block *sb, struct pbr_sector_t *p_pbr) ...@@ -3120,7 +3120,7 @@ s32 fat32_mount(struct super_block *sb, struct pbr_sector_t *p_pbr)
p_fs->fs_func = &fat_fs_func; p_fs->fs_func = &fat_fs_func;
return FFS_SUCCESS; return 0;
} }
static struct fs_func exfat_fs_func = { static struct fs_func exfat_fs_func = {
...@@ -3195,7 +3195,7 @@ s32 exfat_mount(struct super_block *sb, struct pbr_sector_t *p_pbr) ...@@ -3195,7 +3195,7 @@ s32 exfat_mount(struct super_block *sb, struct pbr_sector_t *p_pbr)
p_fs->fs_func = &exfat_fs_func; p_fs->fs_func = &exfat_fs_func;
return FFS_SUCCESS; return 0;
} }
s32 create_dir(struct inode *inode, struct chain_t *p_dir, s32 create_dir(struct inode *inode, struct chain_t *p_dir,
...@@ -3231,7 +3231,7 @@ s32 create_dir(struct inode *inode, struct chain_t *p_dir, ...@@ -3231,7 +3231,7 @@ s32 create_dir(struct inode *inode, struct chain_t *p_dir,
return -ENOSPC; return -ENOSPC;
ret = clear_cluster(sb, clu.dir); ret = clear_cluster(sb, clu.dir);
if (ret != FFS_SUCCESS) if (ret != 0)
return ret; return ret;
if (p_fs->vol_type == EXFAT) { if (p_fs->vol_type == EXFAT) {
...@@ -3249,11 +3249,11 @@ s32 create_dir(struct inode *inode, struct chain_t *p_dir, ...@@ -3249,11 +3249,11 @@ s32 create_dir(struct inode *inode, struct chain_t *p_dir,
ret = fs_func->init_dir_entry(sb, &clu, 0, TYPE_DIR, clu.dir, ret = fs_func->init_dir_entry(sb, &clu, 0, TYPE_DIR, clu.dir,
0); 0);
if (ret != FFS_SUCCESS) if (ret != 0)
return ret; return ret;
ret = fs_func->init_ext_entry(sb, &clu, 0, 1, NULL, &dot_name); ret = fs_func->init_ext_entry(sb, &clu, 0, 1, NULL, &dot_name);
if (ret != FFS_SUCCESS) if (ret != 0)
return ret; return ret;
memcpy(dot_name.name, DOS_PAR_DIR_NAME, DOS_NAME_LENGTH); memcpy(dot_name.name, DOS_PAR_DIR_NAME, DOS_NAME_LENGTH);
...@@ -3265,12 +3265,12 @@ s32 create_dir(struct inode *inode, struct chain_t *p_dir, ...@@ -3265,12 +3265,12 @@ s32 create_dir(struct inode *inode, struct chain_t *p_dir,
ret = fs_func->init_dir_entry(sb, &clu, 1, TYPE_DIR, ret = fs_func->init_dir_entry(sb, &clu, 1, TYPE_DIR,
p_dir->dir, 0); p_dir->dir, 0);
if (ret != FFS_SUCCESS) if (ret != 0)
return ret; return ret;
ret = p_fs->fs_func->init_ext_entry(sb, &clu, 1, 1, NULL, ret = p_fs->fs_func->init_ext_entry(sb, &clu, 1, 1, NULL,
&dot_name); &dot_name);
if (ret != FFS_SUCCESS) if (ret != 0)
return ret; return ret;
} }
...@@ -3278,12 +3278,12 @@ s32 create_dir(struct inode *inode, struct chain_t *p_dir, ...@@ -3278,12 +3278,12 @@ s32 create_dir(struct inode *inode, struct chain_t *p_dir,
/* make sub-dir entry in parent directory */ /* make sub-dir entry in parent directory */
ret = fs_func->init_dir_entry(sb, p_dir, dentry, TYPE_DIR, clu.dir, ret = fs_func->init_dir_entry(sb, p_dir, dentry, TYPE_DIR, clu.dir,
size); size);
if (ret != FFS_SUCCESS) if (ret != 0)
return ret; return ret;
ret = fs_func->init_ext_entry(sb, p_dir, dentry, num_entries, p_uniname, ret = fs_func->init_ext_entry(sb, p_dir, dentry, num_entries, p_uniname,
&dos_name); &dos_name);
if (ret != FFS_SUCCESS) if (ret != 0)
return ret; return ret;
fid->dir.dir = p_dir->dir; fid->dir.dir = p_dir->dir;
...@@ -3300,7 +3300,7 @@ s32 create_dir(struct inode *inode, struct chain_t *p_dir, ...@@ -3300,7 +3300,7 @@ s32 create_dir(struct inode *inode, struct chain_t *p_dir,
fid->rwoffset = 0; fid->rwoffset = 0;
fid->hint_last_off = -1; fid->hint_last_off = -1;
return FFS_SUCCESS; return 0;
} }
s32 create_file(struct inode *inode, struct chain_t *p_dir, s32 create_file(struct inode *inode, struct chain_t *p_dir,
...@@ -3328,12 +3328,12 @@ s32 create_file(struct inode *inode, struct chain_t *p_dir, ...@@ -3328,12 +3328,12 @@ s32 create_file(struct inode *inode, struct chain_t *p_dir,
*/ */
ret = fs_func->init_dir_entry(sb, p_dir, dentry, TYPE_FILE | mode, ret = fs_func->init_dir_entry(sb, p_dir, dentry, TYPE_FILE | mode,
CLUSTER_32(0), 0); CLUSTER_32(0), 0);
if (ret != FFS_SUCCESS) if (ret != 0)
return ret; return ret;
ret = fs_func->init_ext_entry(sb, p_dir, dentry, num_entries, p_uniname, ret = fs_func->init_ext_entry(sb, p_dir, dentry, num_entries, p_uniname,
&dos_name); &dos_name);
if (ret != FFS_SUCCESS) if (ret != 0)
return ret; return ret;
fid->dir.dir = p_dir->dir; fid->dir.dir = p_dir->dir;
...@@ -3350,7 +3350,7 @@ s32 create_file(struct inode *inode, struct chain_t *p_dir, ...@@ -3350,7 +3350,7 @@ s32 create_file(struct inode *inode, struct chain_t *p_dir,
fid->rwoffset = 0; fid->rwoffset = 0;
fid->hint_last_off = -1; fid->hint_last_off = -1;
return FFS_SUCCESS; return 0;
} }
void remove_file(struct inode *inode, struct chain_t *p_dir, s32 entry) void remove_file(struct inode *inode, struct chain_t *p_dir, s32 entry)
...@@ -3458,7 +3458,7 @@ s32 rename_file(struct inode *inode, struct chain_t *p_dir, s32 oldentry, ...@@ -3458,7 +3458,7 @@ s32 rename_file(struct inode *inode, struct chain_t *p_dir, s32 oldentry,
ret = fs_func->init_ext_entry(sb, p_dir, newentry, ret = fs_func->init_ext_entry(sb, p_dir, newentry,
num_new_entries, p_uniname, num_new_entries, p_uniname,
&dos_name); &dos_name);
if (ret != FFS_SUCCESS) if (ret != 0)
return ret; return ret;
fs_func->delete_dir_entry(sb, p_dir, oldentry, 0, fs_func->delete_dir_entry(sb, p_dir, oldentry, 0,
...@@ -3477,14 +3477,14 @@ s32 rename_file(struct inode *inode, struct chain_t *p_dir, s32 oldentry, ...@@ -3477,14 +3477,14 @@ s32 rename_file(struct inode *inode, struct chain_t *p_dir, s32 oldentry,
ret = fs_func->init_ext_entry(sb, p_dir, oldentry, ret = fs_func->init_ext_entry(sb, p_dir, oldentry,
num_new_entries, p_uniname, num_new_entries, p_uniname,
&dos_name); &dos_name);
if (ret != FFS_SUCCESS) if (ret != 0)
return ret; return ret;
fs_func->delete_dir_entry(sb, p_dir, oldentry, num_new_entries, fs_func->delete_dir_entry(sb, p_dir, oldentry, num_new_entries,
num_old_entries); num_old_entries);
} }
return FFS_SUCCESS; return 0;
} }
s32 move_file(struct inode *inode, struct chain_t *p_olddir, s32 oldentry, s32 move_file(struct inode *inode, struct chain_t *p_olddir, s32 oldentry,
...@@ -3580,7 +3580,7 @@ s32 move_file(struct inode *inode, struct chain_t *p_olddir, s32 oldentry, ...@@ -3580,7 +3580,7 @@ s32 move_file(struct inode *inode, struct chain_t *p_olddir, s32 oldentry,
ret = fs_func->init_ext_entry(sb, p_newdir, newentry, num_new_entries, ret = fs_func->init_ext_entry(sb, p_newdir, newentry, num_new_entries,
p_uniname, &dos_name); p_uniname, &dos_name);
if (ret != FFS_SUCCESS) if (ret != 0)
return ret; return ret;
fs_func->delete_dir_entry(sb, p_olddir, oldentry, 0, num_old_entries); fs_func->delete_dir_entry(sb, p_olddir, oldentry, 0, num_old_entries);
...@@ -3591,7 +3591,7 @@ s32 move_file(struct inode *inode, struct chain_t *p_olddir, s32 oldentry, ...@@ -3591,7 +3591,7 @@ s32 move_file(struct inode *inode, struct chain_t *p_olddir, s32 oldentry,
fid->entry = newentry; fid->entry = newentry;
return FFS_SUCCESS; return 0;
} }
/* /*
...@@ -3614,7 +3614,7 @@ int sector_read(struct super_block *sb, sector_t sec, struct buffer_head **bh, ...@@ -3614,7 +3614,7 @@ int sector_read(struct super_block *sb, sector_t sec, struct buffer_head **bh,
if (!p_fs->dev_ejected) { if (!p_fs->dev_ejected) {
ret = bdev_read(sb, sec, bh, 1, read); ret = bdev_read(sb, sec, bh, 1, read);
if (ret != FFS_SUCCESS) if (ret != 0)
p_fs->dev_ejected = 1; p_fs->dev_ejected = 1;
} }
...@@ -3643,7 +3643,7 @@ int sector_write(struct super_block *sb, sector_t sec, struct buffer_head *bh, ...@@ -3643,7 +3643,7 @@ int sector_write(struct super_block *sb, sector_t sec, struct buffer_head *bh,
if (!p_fs->dev_ejected) { if (!p_fs->dev_ejected) {
ret = bdev_write(sb, sec, bh, 1, sync); ret = bdev_write(sb, sec, bh, 1, sync);
if (ret != FFS_SUCCESS) if (ret != 0)
p_fs->dev_ejected = 1; p_fs->dev_ejected = 1;
} }
...@@ -3666,7 +3666,7 @@ int multi_sector_read(struct super_block *sb, sector_t sec, ...@@ -3666,7 +3666,7 @@ int multi_sector_read(struct super_block *sb, sector_t sec,
if (!p_fs->dev_ejected) { if (!p_fs->dev_ejected) {
ret = bdev_read(sb, sec, bh, num_secs, read); ret = bdev_read(sb, sec, bh, num_secs, read);
if (ret != FFS_SUCCESS) if (ret != 0)
p_fs->dev_ejected = 1; p_fs->dev_ejected = 1;
} }
...@@ -3694,7 +3694,7 @@ int multi_sector_write(struct super_block *sb, sector_t sec, ...@@ -3694,7 +3694,7 @@ int multi_sector_write(struct super_block *sb, sector_t sec,
if (!p_fs->dev_ejected) { if (!p_fs->dev_ejected) {
ret = bdev_write(sb, sec, bh, num_secs, sync); ret = bdev_write(sb, sec, bh, num_secs, sync);
if (ret != FFS_SUCCESS) if (ret != 0)
p_fs->dev_ejected = 1; p_fs->dev_ejected = 1;
} }
......
...@@ -373,7 +373,7 @@ static int ffsMountVol(struct super_block *sb) ...@@ -373,7 +373,7 @@ static int ffsMountVol(struct super_block *sb)
sb_set_blocksize(sb, p_bd->sector_size); sb_set_blocksize(sb, p_bd->sector_size);
/* read Sector 0 */ /* read Sector 0 */
if (sector_read(sb, 0, &tmp_bh, 1) != FFS_SUCCESS) { if (sector_read(sb, 0, &tmp_bh, 1) != 0) {
ret = -EIO; ret = -EIO;
goto out; goto out;
} }
...@@ -452,7 +452,7 @@ static int ffsMountVol(struct super_block *sb) ...@@ -452,7 +452,7 @@ static int ffsMountVol(struct super_block *sb)
static int ffsUmountVol(struct super_block *sb) static int ffsUmountVol(struct super_block *sb)
{ {
struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info); struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info);
int err = FFS_SUCCESS; int err = 0;
pr_info("[EXFAT] trying to unmount...\n"); pr_info("[EXFAT] trying to unmount...\n");
...@@ -493,7 +493,7 @@ static int ffsUmountVol(struct super_block *sb) ...@@ -493,7 +493,7 @@ static int ffsUmountVol(struct super_block *sb)
static int ffsGetVolInfo(struct super_block *sb, struct vol_info_t *info) static int ffsGetVolInfo(struct super_block *sb, struct vol_info_t *info)
{ {
int err = FFS_SUCCESS; int err = 0;
struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info); struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info);
/* check the validity of pointer parameters */ /* check the validity of pointer parameters */
...@@ -523,7 +523,7 @@ static int ffsGetVolInfo(struct super_block *sb, struct vol_info_t *info) ...@@ -523,7 +523,7 @@ static int ffsGetVolInfo(struct super_block *sb, struct vol_info_t *info)
static int ffsSyncVol(struct super_block *sb, bool do_sync) static int ffsSyncVol(struct super_block *sb, bool do_sync)
{ {
int err = FFS_SUCCESS; int err = 0;
struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info); struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info);
/* acquire the lock for file system critical section */ /* acquire the lock for file system critical section */
...@@ -776,13 +776,13 @@ static int ffsReadFile(struct inode *inode, struct file_id_t *fid, void *buffer, ...@@ -776,13 +776,13 @@ static int ffsReadFile(struct inode *inode, struct file_id_t *fid, void *buffer,
if ((offset == 0) && (oneblkread == p_bd->sector_size)) { if ((offset == 0) && (oneblkread == p_bd->sector_size)) {
if (sector_read(sb, LogSector, &tmp_bh, 1) != if (sector_read(sb, LogSector, &tmp_bh, 1) !=
FFS_SUCCESS) 0)
goto err_out; goto err_out;
memcpy((char *)buffer + read_bytes, memcpy((char *)buffer + read_bytes,
(char *)tmp_bh->b_data, (s32)oneblkread); (char *)tmp_bh->b_data, (s32)oneblkread);
} else { } else {
if (sector_read(sb, LogSector, &tmp_bh, 1) != if (sector_read(sb, LogSector, &tmp_bh, 1) !=
FFS_SUCCESS) 0)
goto err_out; goto err_out;
memcpy((char *)buffer + read_bytes, memcpy((char *)buffer + read_bytes,
(char *)tmp_bh->b_data + offset, (char *)tmp_bh->b_data + offset,
...@@ -852,7 +852,7 @@ static int ffsWriteFile(struct inode *inode, struct file_id_t *fid, ...@@ -852,7 +852,7 @@ static int ffsWriteFile(struct inode *inode, struct file_id_t *fid,
if (count == 0) { if (count == 0) {
if (wcount) if (wcount)
*wcount = 0; *wcount = 0;
ret = FFS_SUCCESS; ret = 0;
goto out; goto out;
} }
...@@ -962,12 +962,12 @@ static int ffsWriteFile(struct inode *inode, struct file_id_t *fid, ...@@ -962,12 +962,12 @@ static int ffsWriteFile(struct inode *inode, struct file_id_t *fid,
if ((offset == 0) && (oneblkwrite == p_bd->sector_size)) { if ((offset == 0) && (oneblkwrite == p_bd->sector_size)) {
if (sector_read(sb, LogSector, &tmp_bh, 0) != if (sector_read(sb, LogSector, &tmp_bh, 0) !=
FFS_SUCCESS) 0)
goto err_out; goto err_out;
memcpy((char *)tmp_bh->b_data, memcpy((char *)tmp_bh->b_data,
(char *)buffer + write_bytes, (s32)oneblkwrite); (char *)buffer + write_bytes, (s32)oneblkwrite);
if (sector_write(sb, LogSector, tmp_bh, 0) != if (sector_write(sb, LogSector, tmp_bh, 0) !=
FFS_SUCCESS) { 0) {
brelse(tmp_bh); brelse(tmp_bh);
goto err_out; goto err_out;
} }
...@@ -975,18 +975,18 @@ static int ffsWriteFile(struct inode *inode, struct file_id_t *fid, ...@@ -975,18 +975,18 @@ static int ffsWriteFile(struct inode *inode, struct file_id_t *fid,
if ((offset > 0) || if ((offset > 0) ||
((fid->rwoffset + oneblkwrite) < fid->size)) { ((fid->rwoffset + oneblkwrite) < fid->size)) {
if (sector_read(sb, LogSector, &tmp_bh, 1) != if (sector_read(sb, LogSector, &tmp_bh, 1) !=
FFS_SUCCESS) 0)
goto err_out; goto err_out;
} else { } else {
if (sector_read(sb, LogSector, &tmp_bh, 0) != if (sector_read(sb, LogSector, &tmp_bh, 0) !=
FFS_SUCCESS) 0)
goto err_out; goto err_out;
} }
memcpy((char *)tmp_bh->b_data + offset, memcpy((char *)tmp_bh->b_data + offset,
(char *)buffer + write_bytes, (s32)oneblkwrite); (char *)buffer + write_bytes, (s32)oneblkwrite);
if (sector_write(sb, LogSector, tmp_bh, 0) != if (sector_write(sb, LogSector, tmp_bh, 0) !=
FFS_SUCCESS) { 0) {
brelse(tmp_bh); brelse(tmp_bh);
goto err_out; goto err_out;
} }
...@@ -1100,7 +1100,7 @@ static int ffsTruncateFile(struct inode *inode, u64 old_size, u64 new_size) ...@@ -1100,7 +1100,7 @@ static int ffsTruncateFile(struct inode *inode, u64 old_size, u64 new_size)
} }
if (old_size <= new_size) { if (old_size <= new_size) {
ret = FFS_SUCCESS; ret = 0;
goto out; goto out;
} }
...@@ -1319,7 +1319,7 @@ static int ffsMoveFile(struct inode *old_parent_inode, struct file_id_t *fid, ...@@ -1319,7 +1319,7 @@ static int ffsMoveFile(struct inode *old_parent_inode, struct file_id_t *fid,
ret = move_file(new_parent_inode, &olddir, dentry, &newdir, ret = move_file(new_parent_inode, &olddir, dentry, &newdir,
&uni_name, fid); &uni_name, fid);
if ((ret == FFS_SUCCESS) && new_inode) { if ((ret == 0) && new_inode) {
/* delete entries of new_dir */ /* delete entries of new_dir */
ep = get_entry_in_dir(sb, p_dir, new_entry, NULL); ep = get_entry_in_dir(sb, p_dir, new_entry, NULL);
if (!ep) if (!ep)
...@@ -1350,7 +1350,7 @@ static int ffsMoveFile(struct inode *old_parent_inode, struct file_id_t *fid, ...@@ -1350,7 +1350,7 @@ static int ffsMoveFile(struct inode *old_parent_inode, struct file_id_t *fid,
static int ffsRemoveFile(struct inode *inode, struct file_id_t *fid) static int ffsRemoveFile(struct inode *inode, struct file_id_t *fid)
{ {
s32 dentry; s32 dentry;
int ret = FFS_SUCCESS; int ret = 0;
struct chain_t dir, clu_to_free; struct chain_t dir, clu_to_free;
struct dentry_t *ep; struct dentry_t *ep;
struct super_block *sb = inode->i_sb; struct super_block *sb = inode->i_sb;
...@@ -1414,7 +1414,7 @@ static int ffsRemoveFile(struct inode *inode, struct file_id_t *fid) ...@@ -1414,7 +1414,7 @@ static int ffsRemoveFile(struct inode *inode, struct file_id_t *fid)
static int ffsSetAttr(struct inode *inode, u32 attr) static int ffsSetAttr(struct inode *inode, u32 attr)
{ {
u32 type; u32 type;
int ret = FFS_SUCCESS; int ret = 0;
sector_t sector = 0; sector_t sector = 0;
struct dentry_t *ep; struct dentry_t *ep;
struct super_block *sb = inode->i_sb; struct super_block *sb = inode->i_sb;
...@@ -1426,7 +1426,7 @@ static int ffsSetAttr(struct inode *inode, u32 attr) ...@@ -1426,7 +1426,7 @@ static int ffsSetAttr(struct inode *inode, u32 attr)
if (fid->attr == attr) { if (fid->attr == attr) {
if (p_fs->dev_ejected) if (p_fs->dev_ejected)
return -EIO; return -EIO;
return FFS_SUCCESS; return 0;
} }
if (is_dir) { if (is_dir) {
...@@ -1434,7 +1434,7 @@ static int ffsSetAttr(struct inode *inode, u32 attr) ...@@ -1434,7 +1434,7 @@ static int ffsSetAttr(struct inode *inode, u32 attr)
(fid->entry == -1)) { (fid->entry == -1)) {
if (p_fs->dev_ejected) if (p_fs->dev_ejected)
return -EIO; return -EIO;
return FFS_SUCCESS; return 0;
} }
} }
...@@ -1503,7 +1503,7 @@ static int ffsReadStat(struct inode *inode, struct dir_entry_t *info) ...@@ -1503,7 +1503,7 @@ static int ffsReadStat(struct inode *inode, struct dir_entry_t *info)
{ {
sector_t sector = 0; sector_t sector = 0;
s32 count; s32 count;
int ret = FFS_SUCCESS; int ret = 0;
struct chain_t dir; struct chain_t dir;
struct uni_name_t uni_name; struct uni_name_t uni_name;
struct timestamp_t tm; struct timestamp_t tm;
...@@ -1655,7 +1655,7 @@ static int ffsReadStat(struct inode *inode, struct dir_entry_t *info) ...@@ -1655,7 +1655,7 @@ static int ffsReadStat(struct inode *inode, struct dir_entry_t *info)
static int ffsWriteStat(struct inode *inode, struct dir_entry_t *info) static int ffsWriteStat(struct inode *inode, struct dir_entry_t *info)
{ {
sector_t sector = 0; sector_t sector = 0;
int ret = FFS_SUCCESS; int ret = 0;
struct timestamp_t tm; struct timestamp_t tm;
struct dentry_t *ep, *ep2; struct dentry_t *ep, *ep2;
struct entry_set_cache_t *es = NULL; struct entry_set_cache_t *es = NULL;
...@@ -1674,7 +1674,7 @@ static int ffsWriteStat(struct inode *inode, struct dir_entry_t *info) ...@@ -1674,7 +1674,7 @@ static int ffsWriteStat(struct inode *inode, struct dir_entry_t *info)
(fid->entry == -1)) { (fid->entry == -1)) {
if (p_fs->dev_ejected) if (p_fs->dev_ejected)
ret = -EIO; ret = -EIO;
ret = FFS_SUCCESS; ret = 0;
goto out; goto out;
} }
} }
...@@ -1745,7 +1745,7 @@ static int ffsMapCluster(struct inode *inode, s32 clu_offset, u32 *clu) ...@@ -1745,7 +1745,7 @@ static int ffsMapCluster(struct inode *inode, s32 clu_offset, u32 *clu)
s32 num_clusters, num_alloced; s32 num_clusters, num_alloced;
bool modified = false; bool modified = false;
u32 last_clu; u32 last_clu;
int ret = FFS_SUCCESS; int ret = 0;
sector_t sector = 0; sector_t sector = 0;
struct chain_t new_clu; struct chain_t new_clu;
struct dentry_t *ep; struct dentry_t *ep;
...@@ -1898,7 +1898,7 @@ static int ffsMapCluster(struct inode *inode, s32 clu_offset, u32 *clu) ...@@ -1898,7 +1898,7 @@ static int ffsMapCluster(struct inode *inode, s32 clu_offset, u32 *clu)
static int ffsCreateDir(struct inode *inode, char *path, struct file_id_t *fid) static int ffsCreateDir(struct inode *inode, char *path, struct file_id_t *fid)
{ {
int ret = FFS_SUCCESS; int ret = 0;
struct chain_t dir; struct chain_t dir;
struct uni_name_t uni_name; struct uni_name_t uni_name;
struct super_block *sb = inode->i_sb; struct super_block *sb = inode->i_sb;
...@@ -1939,7 +1939,7 @@ static int ffsCreateDir(struct inode *inode, char *path, struct file_id_t *fid) ...@@ -1939,7 +1939,7 @@ static int ffsCreateDir(struct inode *inode, char *path, struct file_id_t *fid)
static int ffsReadDir(struct inode *inode, struct dir_entry_t *dir_entry) static int ffsReadDir(struct inode *inode, struct dir_entry_t *dir_entry)
{ {
int i, dentry, clu_offset; int i, dentry, clu_offset;
int ret = FFS_SUCCESS; int ret = 0;
s32 dentries_per_clu, dentries_per_clu_bits = 0; s32 dentries_per_clu, dentries_per_clu_bits = 0;
u32 type; u32 type;
sector_t sector; sector_t sector;
...@@ -2138,7 +2138,7 @@ static int ffsReadDir(struct inode *inode, struct dir_entry_t *dir_entry) ...@@ -2138,7 +2138,7 @@ static int ffsReadDir(struct inode *inode, struct dir_entry_t *dir_entry)
static int ffsRemoveDir(struct inode *inode, struct file_id_t *fid) static int ffsRemoveDir(struct inode *inode, struct file_id_t *fid)
{ {
s32 dentry; s32 dentry;
int ret = FFS_SUCCESS; int ret = 0;
struct chain_t dir, clu_to_free; struct chain_t dir, clu_to_free;
struct super_block *sb = inode->i_sb; struct super_block *sb = inode->i_sb;
struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info); struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment