Skip to content
This repository has been archived by the owner on Mar 3, 2024. It is now read-only.

Commit

Permalink
exfat: remove unused functions
Browse files Browse the repository at this point in the history
Extracted via ctags -x --c-kinds=fp

Signed-off-by: Park Ju Hyung <qkrwngud825@gmail.com>
  • Loading branch information
arter97 committed Sep 18, 2019
1 parent 60e69d7 commit 5afb404
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 208 deletions.
41 changes: 0 additions & 41 deletions blkdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,47 +245,6 @@ s32 write_sect(struct super_block *sb, u64 sec, struct buffer_head *bh, s32 sync
return 0;
}

s32 read_msect(struct super_block *sb, u64 sec, struct buffer_head **bh, u64 num_secs, s32 read)
{
FS_INFO_T *fsi = &(EXFAT_SB(sb)->fsi);

BUG_ON(!bh);
if (((sec+num_secs) > fsi->num_sectors) && (fsi->num_sectors > 0)) {
exfat_fs_error_ratelimit(sb, "%s: out of range(sect:%llu len:%llu)",
__func__, sec, num_secs);
return -EIO;
}

if (bdev_mread(sb, sec, bh, num_secs, read)) {
exfat_fs_error_ratelimit(sb, "%s: I/O error (sect:%llu len:%llu)",
__func__, sec, num_secs);
return -EIO;
}

return 0;
}

s32 write_msect(struct super_block *sb, u64 sec, struct buffer_head *bh, u64 num_secs, s32 sync)
{
FS_INFO_T *fsi = &(EXFAT_SB(sb)->fsi);

BUG_ON(!bh);
if (((sec+num_secs) > fsi->num_sectors) && (fsi->num_sectors > 0)) {
exfat_fs_error_ratelimit(sb, "%s: out of range(sect:%llu len:%llu)",
__func__, sec, num_secs);
return -EIO;
}


if (bdev_mwrite(sb, sec, bh, num_secs, sync)) {
exfat_fs_error_ratelimit(sb, "%s: I/O error (sect:%llu len:%llu)",
__func__, sec, num_secs);
return -EIO;
}

return 0;
}

static inline void __blkdev_write_bhs(struct buffer_head **bhs, s32 nr_bhs)
{
s32 i;
Expand Down
22 changes: 0 additions & 22 deletions core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2891,28 +2891,6 @@ s32 fscore_map_clus(struct inode *inode, u32 clu_offset, u32 *clu, int dest)
return 0;
}

/* allocate reserved cluster */
s32 fscore_reserve_clus(struct inode *inode)
{
struct super_block *sb = inode->i_sb;
FS_INFO_T *fsi = &(EXFAT_SB(sb)->fsi);

if ((fsi->used_clusters + fsi->reserved_clusters) >= (fsi->num_clusters - 2))
return -ENOSPC;

if (bdev_check_bdi_valid(sb))
return -EIO;

fsi->reserved_clusters++;

/* inode->i_blocks update */
inode->i_blocks += 1 << (fsi->cluster_size_bits - sb->s_blocksize_bits);

exfat_debug_check_clusters(inode);

return 0;
}

/* remove an entry, BUT don't truncate */
s32 fscore_unlink(struct inode *inode, FILE_ID_T *fid)
{
Expand Down
5 changes: 0 additions & 5 deletions core.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ s32 fscore_remove(struct inode *inode, FILE_ID_T *fid);
s32 fscore_read_inode(struct inode *inode, DIR_ENTRY_T *info);
s32 fscore_write_inode(struct inode *inode, DIR_ENTRY_T *info, int sync);
s32 fscore_map_clus(struct inode *inode, u32 clu_offset, u32 *clu, int dest);
s32 fscore_reserve_clus(struct inode *inode);
s32 fscore_unlink(struct inode *inode, FILE_ID_T *fid);

/* directory management functions */
Expand Down Expand Up @@ -119,7 +118,6 @@ ENTRY_SET_CACHE_T *get_dentry_set_in_dir(struct super_block *sb,
void release_dentry_set(ENTRY_SET_CACHE_T *es);
s32 update_dir_chksum(struct super_block *sb, CHAIN_T *p_dir, s32 entry);
s32 update_dir_chksum_with_entry_set(struct super_block *sb, ENTRY_SET_CACHE_T *es);
bool is_dir_empty(struct super_block *sb, CHAIN_T *p_dir);
s32 mount_exfat(struct super_block *sb, pbr_t *p_pbr);

/* blkdev.c */
Expand All @@ -134,12 +132,9 @@ s32 bdev_sync_all(struct super_block *sb);
/* blkdev.c : sector read/write functions */
s32 read_sect(struct super_block *sb, u64 sec, struct buffer_head **bh, s32 read);
s32 write_sect(struct super_block *sb, u64 sec, struct buffer_head *bh, s32 sync);
s32 read_msect(struct super_block *sb, u64 sec, struct buffer_head **bh, s64 num_secs, s32 read);
s32 write_msect(struct super_block *sb, u64 sec, struct buffer_head *bh, s64 num_secs, s32 sync);
s32 write_msect_zero(struct super_block *sb, u64 sec, u64 num_secs);

/* misc.c */
u8 calc_chksum_1byte(void *data, s32 len, u8 chksum);
u16 calc_chksum_2byte(void *data, s32 len, u16 chksum, s32 type);

/* extent.c */
Expand Down
12 changes: 0 additions & 12 deletions core_exfat.c
Original file line number Diff line number Diff line change
Expand Up @@ -1170,18 +1170,6 @@ static u32 test_alloc_bitmap(struct super_block *sb, u32 clu)
return CLUS_EOF;
}

void sync_alloc_bmp(struct super_block *sb)
{
s32 i;
FS_INFO_T *fsi = &(EXFAT_SB(sb)->fsi);

if (fsi->vol_amap == NULL)
return;

for (i = 0; i < fsi->map_sectors; i++)
sync_dirty_buffer(fsi->vol_amap[i]);
}

static s32 exfat_chain_cont_cluster(struct super_block *sb, u32 chain, u32 len)
{
if (!len)
Expand Down
2 changes: 0 additions & 2 deletions exfat.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,7 @@ static inline void exfat_save_attr(struct inode *inode, u32 attr)

/* exfat/nls.c */
/* NLS management function */
s32 nls_cmp_sfn(struct super_block *sb, u8 *a, u8 *b);
s32 nls_cmp_uniname(struct super_block *sb, u16 *a, u16 *b);
s32 nls_uni16s_to_sfn(struct super_block *sb, UNI_NAME_T *p_uniname, DOS_NAME_T *p_dosname, s32 *p_lossy);
s32 nls_sfn_to_uni16s(struct super_block *sb, DOS_NAME_T *p_dosname, UNI_NAME_T *p_uniname);
s32 nls_uni16s_to_vfsname(struct super_block *sb, UNI_NAME_T *uniname, u8 *p_cstring, s32 len);
s32 nls_vfsname_to_uni16s(struct super_block *sb, const u8 *p_cstring,
Expand Down
11 changes: 0 additions & 11 deletions misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,17 +266,6 @@ TIMESTAMP_T *tm_now(struct exfat_sb_info *sbi, TIMESTAMP_T *tp)
return tp;
}

u8 calc_chksum_1byte(void *data, s32 len, u8 chksum)
{
s32 i;
u8 *c = (u8 *) data;

for (i = 0; i < len; i++, c++)
chksum = (((chksum & 1) << 7) | ((chksum & 0xFE) >> 1)) + *c;

return chksum;
}

u16 calc_chksum_2byte(void *data, s32 len, u16 chksum, s32 type)
{
s32 i;
Expand Down
115 changes: 0 additions & 115 deletions nls.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,6 @@
#include "exfat.h"
#include "core.h"

static u16 bad_dos_chars[] = {
/* + , ; = [ ] */
0x002B, 0x002C, 0x003B, 0x003D, 0x005B, 0x005D,
0xFF0B, 0xFF0C, 0xFF1B, 0xFF1D, 0xFF3B, 0xFF3D,
0
};

/*
* Allow full-width illegal characters :
* "MS windows 7" supports full-width-invalid-name-characters.
Expand Down Expand Up @@ -63,11 +56,6 @@ u16 *nls_wstrchr(u16 *str, u16 wchar)
return 0;
}

s32 nls_cmp_sfn(struct super_block *sb, u8 *a, u8 *b)
{
return strncmp((void *)a, (void *)b, DOS_NAME_LENGTH);
}

s32 nls_cmp_uniname(struct super_block *sb, u16 *a, u16 *b)
{
s32 i;
Expand All @@ -84,109 +72,6 @@ s32 nls_cmp_uniname(struct super_block *sb, u16 *a, u16 *b)
#define CASE_LOWER_BASE (0x08) /* base is lower case */
#define CASE_LOWER_EXT (0x10) /* extension is lower case */

s32 nls_uni16s_to_sfn(struct super_block *sb, UNI_NAME_T *p_uniname, DOS_NAME_T *p_dosname, s32 *p_lossy)
{
s32 i, j, len, lossy = NLS_NAME_NO_LOSSY;
u8 buf[MAX_CHARSET_SIZE];
u8 lower = 0, upper = 0;
u8 *dosname = p_dosname->name;
u16 *uniname = p_uniname->name;
u16 *p, *last_period;
struct nls_table *nls = EXFAT_SB(sb)->nls_disk;

/* DOSNAME is filled with space */
for (i = 0; i < DOS_NAME_LENGTH; i++)
*(dosname+i) = ' ';

/* DOT and DOTDOT are handled by VFS layer */

/* search for the last embedded period */
last_period = NULL;
for (p = uniname; *p; p++) {
if (*p == (u16) '.')
last_period = p;
}

i = 0;
while (i < DOS_NAME_LENGTH) {
if (i == 8) {
if (last_period == NULL)
break;

if (uniname <= last_period) {
if (uniname < last_period)
lossy |= NLS_NAME_OVERLEN;
uniname = last_period + 1;
}
}

if (*uniname == (u16) '\0') {
break;
} else if (*uniname == (u16) ' ') {
lossy |= NLS_NAME_LOSSY;
} else if (*uniname == (u16) '.') {
if (uniname < last_period)
lossy |= NLS_NAME_LOSSY;
else
i = 8;
} else if (nls_wstrchr(bad_dos_chars, *uniname)) {
lossy |= NLS_NAME_LOSSY;
*(dosname+i) = '_';
i++;
} else {
len = convert_uni_to_ch(nls, *uniname, buf, &lossy);

if (len > 1) {
if ((i >= 8) && ((i+len) > DOS_NAME_LENGTH))
break;

if ((i < 8) && ((i+len) > 8)) {
i = 8;
continue;
}

lower = 0xFF;

for (j = 0; j < len; j++, i++)
*(dosname+i) = *(buf+j);
} else { /* len == 1 */
if ((*buf >= 'a') && (*buf <= 'z')) {
*(dosname+i) = *buf - ('a' - 'A');

lower |= (i < 8) ?
CASE_LOWER_BASE :
CASE_LOWER_EXT;
} else if ((*buf >= 'A') && (*buf <= 'Z')) {
*(dosname+i) = *buf;

upper |= (i < 8) ?
CASE_LOWER_BASE :
CASE_LOWER_EXT;
} else {
*(dosname+i) = *buf;
}
i++;
}
}

uniname++;
}

if (*dosname == 0xE5)
*dosname = 0x05;
if (*uniname != 0x0)
lossy |= NLS_NAME_OVERLEN;

if (upper & lower)
p_dosname->name_case = 0xFF;
else
p_dosname->name_case = lower;

if (p_lossy)
*p_lossy = lossy;
return i;
}

s32 nls_sfn_to_uni16s(struct super_block *sb, DOS_NAME_T *p_dosname, UNI_NAME_T *p_uniname)
{
s32 i = 0, j, n = 0;
Expand Down

0 comments on commit 5afb404

Please sign in to comment.