Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- a/exfat.c 2013-08-16 12:38:00.000000000 +0700
- +++ b/exfat.c 2013-12-22 19:35:32.000000000 +0700
- @@ -595,6 +595,8 @@
- num_alloced = p_fs->fs_func->alloc_cluster(sb, num_alloc, &new_clu);
- if (num_alloced == 0)
- break;
- + else if (num_alloced < 0)
- + return FFS_MEDIAERR;
- if (last_clu == CLUSTER_32(~0)) {
- if (new_clu.flags == 0x01)
- @@ -1302,7 +1304,9 @@
- new_clu.flags = fid->flags;
- num_alloced = p_fs->fs_func->alloc_cluster(sb, 1, &new_clu);
- - if (num_alloced < 1)
- + if (num_alloced < 0)
- + return FFS_MEDIAERR;
- + else if (num_alloced == 0)
- return FFS_FULL;
- if (last_clu == CLUSTER_32(~0)) {
- @@ -1744,16 +1748,19 @@
- for (i = 2; i < p_fs->num_clusters; i++) {
- if (FAT_read(sb, new_clu, &read_clu) != 0)
- - return 0;
- + return -1;
- if (read_clu == CLUSTER_32(0)) {
- - FAT_write(sb, new_clu, CLUSTER_32(~0));
- + if(FAT_write(sb, new_clu, CLUSTER_32(~0)) < 0)
- + return -1;
- num_clusters++;
- if (p_chain->dir == CLUSTER_32(~0))
- p_chain->dir = new_clu;
- - else
- - FAT_write(sb, last_clu, new_clu);
- + else {
- + if(FAT_write(sb, last_clu, new_clu) < 0)
- + return -1;
- + }
- last_clu = new_clu;
- @@ -1805,18 +1812,22 @@
- }
- if (set_alloc_bitmap(sb, new_clu-2) != FFS_SUCCESS)
- - return 0;
- + return -1;
- num_clusters++;
- - if (p_chain->flags == 0x01)
- - FAT_write(sb, new_clu, CLUSTER_32(~0));
- + if (p_chain->flags == 0x01) {
- + if(FAT_write(sb, new_clu, CLUSTER_32(~0)) < 0)
- + return -1;
- + }
- if (p_chain->dir == CLUSTER_32(~0)) {
- p_chain->dir = new_clu;
- } else {
- - if (p_chain->flags == 0x01)
- - FAT_write(sb, last_clu, new_clu);
- + if (p_chain->flags == 0x01) {
- + if(FAT_write(sb, last_clu, new_clu) < 0)
- + return -1;
- + }
- }
- last_clu = new_clu;
- @@ -1879,7 +1890,8 @@
- if (FAT_read(sb, clu, &clu) == -1)
- break;
- - FAT_write(sb, prev, CLUSTER_32(0));
- + if (FAT_write(sb, prev, CLUSTER_32(0)) < 0)
- + break;
- num_clusters++;
- } while (clu != CLUSTER_32(~0));
- @@ -2039,7 +2051,8 @@
- return;
- while (len > 1) {
- - FAT_write(sb, chain, chain+1);
- + if (FAT_write(sb, chain, chain+1) < 0)
- + break;
- chain++;
- len--;
- }
- @@ -3507,7 +3520,8 @@
- p_fs->hint_uentry.clu.flags = 0x01;
- }
- if (clu.flags == 0x01)
- - FAT_write(sb, last_clu, clu.dir);
- + if(FAT_write(sb, last_clu, clu.dir) < 0)
- + return -1;
- if (p_fs->hint_uentry.entry == -1) {
- p_fs->hint_uentry.dir = p_dir->dir;
- @@ -4546,9 +4560,11 @@
- clu.flags = (p_fs->vol_type == EXFAT) ? 0x03 : 0x01;
- ret = p_fs->fs_func->alloc_cluster(sb, 1, &clu);
- - if (ret < 1)
- + if (ret < 0)
- + return FFS_MEDIAERR;
- + else if(ret == 0)
- return FFS_FULL;
- -
- +
- ret = clear_cluster(sb, clu.dir);
- if (ret != FFS_SUCCESS)
- return ret;
- --- b/exfat_super.c 2013-12-22 19:35:32.000000000 +0700
- +++ a/exfat_super.c 2013-08-16 12:53:42.000000000 +0700
- @@ -60,6 +60,9 @@
- #include <linux/exportfs.h>
- #include <linux/mount.h>
- #include <linux/vfs.h>
- +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
- +#include <linux/aio.h>
- +#endif
- #include <linux/parser.h>
- #include <linux/uio.h>
- #include <linux/writeback.h>
- @@ -1405,12 +1402,17 @@
- static struct inode *exfat_iget(struct super_block *sb, loff_t i_pos) {
- struct exfat_sb_info *sbi = EXFAT_SB(sb);
- struct exfat_inode_info *info;
- - struct hlist_node *node;
- struct hlist_head *head = sbi->inode_hashtable + exfat_hash(i_pos);
- struct inode *inode = NULL;
- +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0)
- + struct hlist_node *node;
- spin_lock(&sbi->inode_hash_lock);
- hlist_for_each_entry(info, node, head, i_hash_fat) {
- +#else
- + spin_lock(&sbi->inode_hash_lock);
- + hlist_for_each_entry(info, head, i_hash_fat) {
- +#endif
- CHECK_ERR(info->vfs_inode.i_sb != sb);
- if (i_pos != info->i_pos)
- @@ -1687,7 +1679,7 @@
- info.FreeClusters = info.NumClusters - info.UsedClusters;
- if (p_fs->dev_ejected)
- - return -EIO;
- + printk("[EXFAT] statfs on device is ejected\n");
- }
- buf->f_type = sb->s_magic;
- --- a/exfat_version.h 2013-08-14 14:03:26.000000000 +0700
- +++ b/exfat_version.h 2013-12-22 19:35:32.000000000 +0700
- @@ -1 +1 @@
- -#define EXFAT_VERSION "1.2.4"
- +#define EXFAT_VERSION "1.2.5"
Add Comment
Please, Sign In to add comment