hint_clu = p_chain->dir;
if (hint_clu == CLUSTER_32(~0)) {
- hint_clu = test_alloc_bitmap(sb, p_fs->clu_srch_ptr-2);
+ hint_clu = test_alloc_bitmap(sb, p_fs->clu_srch_ptr - 2);
if (hint_clu == CLUSTER_32(~0))
return 0;
} else if (hint_clu >= p_fs->num_clusters) {
p_chain->dir = CLUSTER_32(~0);
- while ((new_clu = test_alloc_bitmap(sb, hint_clu-2)) != CLUSTER_32(~0)) {
+ while ((new_clu = test_alloc_bitmap(sb, hint_clu - 2)) != CLUSTER_32(~0)) {
if (new_clu != hint_clu) {
if (p_chain->flags == 0x03) {
exfat_chain_cont_cluster(sb, p_chain->dir,
}
}
- if (set_alloc_bitmap(sb, new_clu-2) != FFS_SUCCESS)
+ if (set_alloc_bitmap(sb, new_clu - 2) != FFS_SUCCESS)
return -1;
num_clusters++;
if (do_relse) {
sector = START_SECTOR(clu);
for (i = 0; i < p_fs->sectors_per_clu; i++)
- buf_release(sb, sector+i);
+ buf_release(sb, sector + i);
}
prev = clu;
if (do_relse) {
sector = START_SECTOR(clu);
for (i = 0; i < p_fs->sectors_per_clu; i++)
- 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) != FFS_SUCCESS)
break;
clu++;
if (do_relse) {
sector = START_SECTOR(clu);
for (i = 0; i < p_fs->sectors_per_clu; i++)
- 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) != FFS_SUCCESS)
break;
if (FAT_read(sb, clu, &clu) == -1)
return;
while (len > 1) {
- if (FAT_write(sb, chain, chain+1) < 0)
+ if (FAT_write(sb, chain, chain + 1) < 0)
break;
chain++;
len--;
p_fs->map_clu = GET32_A(ep->start_clu);
map_size = (u32) GET64_A(ep->size);
- p_fs->map_sectors = ((map_size-1) >> p_bd->sector_size_bits) + 1;
+ p_fs->map_sectors = ((map_size - 1) >> p_bd->sector_size_bits) + 1;
p_fs->vol_amap = kmalloc_array(p_fs->map_sectors,
sizeof(struct buffer_head *),
for (j = 0; j < p_fs->map_sectors; j++) {
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) {
/* release all buffers and free vol_amap */
i = 0;
sector++;
for (i = 0; i < p_bd->sector_size && index <= 0xFFFF; i += 2) {
- uni = GET16(((u8 *) tmp_bh->b_data)+i);
+ uni = GET16(((u8 *) tmp_bh->b_data) + i);
checksum = ((checksum & 1) ? 0x80000000 : 0) +
(checksum >> 1) + *(((u8 *)tmp_bh->b_data) +
return FFS_MEMORYERR;
memset(upcase_table, 0, UTBL_COL_COUNT * sizeof(u16 *));
- for (i = 0; index <= 0xFFFF && i < NUM_UPCASE*2; i += 2) {
+ for (i = 0; index <= 0xFFFF && i < NUM_UPCASE * 2; i += 2) {
uni = GET16(uni_upcase + i);
if (skip) {
pr_debug("skip from 0x%X ", index);
tbl_size = (u32) GET64_A(ep->size);
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,
GET32_A(ep->checksum)) != FFS_SUCCESS)
break;
else if (ep->attr == ATTR_EXTEND)
return TYPE_EXTEND;
- else if ((ep->attr & (ATTR_SUBDIR|ATTR_VOLUME)) == ATTR_VOLUME)
+ else if ((ep->attr & (ATTR_SUBDIR | ATTR_VOLUME)) == ATTR_VOLUME)
return TYPE_VOLUME;
- else if ((ep->attr & (ATTR_SUBDIR|ATTR_VOLUME)) == ATTR_SUBDIR)
+ else if ((ep->attr & (ATTR_SUBDIR | ATTR_VOLUME)) == ATTR_SUBDIR)
return TYPE_DIR;
return TYPE_FILE;
if (!file_ep)
return FFS_MEDIAERR;
- strm_ep = (struct strm_dentry_t *)get_entry_in_dir(sb, p_dir, entry+1,
+ strm_ep = (struct strm_dentry_t *)get_entry_in_dir(sb, p_dir, entry + 1,
§or);
if (!strm_ep)
return FFS_MEDIAERR;
if (!ext_ep)
return FFS_MEDIAERR;
- init_ext_entry(ext_ep, i+0x40, chksum, uniname);
+ init_ext_entry(ext_ep, i + 0x40, chksum, uniname);
buf_modify(sb, sector);
}
file_ep->num_ext = (u8)(num_entries - 1);
buf_modify(sb, sector);
- strm_ep = (struct strm_dentry_t *)get_entry_in_dir(sb, p_dir, entry+1,
+ strm_ep = (struct strm_dentry_t *)get_entry_in_dir(sb, p_dir, entry + 1,
§or);
if (!strm_ep)
return FFS_MEDIAERR;
for (i = 0; i < 10; i += 2) {
if (!end) {
- SET16(ep->unicode_0_4+i, *uniname);
+ SET16(ep->unicode_0_4 + i, *uniname);
if (*uniname == 0x0)
end = true;
else
uniname++;
} else {
- SET16(ep->unicode_0_4+i, 0xFFFF);
+ SET16(ep->unicode_0_4 + i, 0xFFFF);
}
}
ep->flags = 0x0;
for (i = 0; i < 30; i++, i++) {
- SET16_A(ep->unicode_0_14+i, *uniname);
+ SET16_A(ep->unicode_0_14 + i, *uniname);
if (*uniname == 0x0)
break;
uniname++;
struct dentry_t *ep;
struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info);
- for (i = num_entries-1; i >= order; i--) {
- ep = get_entry_in_dir(sb, p_dir, entry-i, §or);
+ for (i = num_entries - 1; i >= order; i--) {
+ ep = get_entry_in_dir(sb, p_dir, entry - i, §or);
if (!ep)
return;
struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info);
for (i = order; i < num_entries; i++) {
- ep = get_entry_in_dir(sb, p_dir, entry+i, §or);
+ ep = get_entry_in_dir(sb, p_dir, entry + i, §or);
if (!ep)
return;
CS_DIR_ENTRY);
for (i = 1; i < num_entries; i++) {
- ep = get_entry_in_dir(sb, p_dir, entry+i, NULL);
+ ep = get_entry_in_dir(sb, p_dir, entry + i, NULL);
if (!ep) {
buf_unlock(sb, sector);
return;
goto err_out;
if (type == ES_ALL_ENTRIES)
- num_entries = ((struct file_dentry_t *)ep)->num_ext+1;
+ num_entries = ((struct file_dentry_t *)ep)->num_ext + 1;
else
num_entries = type;
if (p_dir->dir == CLUSTER_32(0)) /* FAT16 root_dir */
i = dentry % dentries_per_clu;
else
- i = dentry & (dentries_per_clu-1);
+ i = dentry & (dentries_per_clu - 1);
for (; i < dentries_per_clu; i++, dentry++) {
ep = get_entry_in_dir(sb, &clu, i, NULL);
p_fs->hint_uentry.entry = -1;
if (p_fs->vol_type == EXFAT)
- return dentry - (num_entries-1);
+ return dentry - (num_entries - 1);
else
return dentry;
}
}
}
- i_size_write(inode, i_size_read(inode)+p_fs->cluster_size);
+ i_size_write(inode, i_size_read(inode) + p_fs->cluster_size);
EXFAT_I(inode)->mmu_private += p_fs->cluster_size;
EXFAT_I(inode)->fid.size += p_fs->cluster_size;
EXFAT_I(inode)->fid.flags = p_dir->flags;
ext_ep = (struct ext_dentry_t *) ep;
if (ext_ep->order > 0x40) {
order = (s32)(ext_ep->order - 0x40);
- uniname = p_uniname->name + 13 * (order-1);
+ uniname = p_uniname->name + 13 * (order - 1);
} else {
order = (s32) ext_ep->order;
uniname -= 13;
len = extract_uni_name_from_ext_entry(ext_ep, entry_uniname, order);
- unichar = *(uniname+len);
- *(uniname+len) = 0x0;
+ unichar = *(uniname + len);
+ *(uniname + len) = 0x0;
if (nls_uniname_cmp(sb, uniname, entry_uniname))
is_feasible_entry = false;
- *(uniname+len) = unichar;
+ *(uniname + len) = unichar;
}
has_ext_entry = true;
} else if (entry_type == TYPE_UNUSED) {
p_fs->hint_uentry.clu.flags = clu.flags;
}
if ((num_empty >= num_entries) || (entry_type == TYPE_UNUSED))
- p_fs->hint_uentry.entry = dentry - (num_empty-1);
+ p_fs->hint_uentry.entry = dentry - (num_empty - 1);
}
if (entry_type == TYPE_UNUSED)
len = extract_uni_name_from_name_entry(name_ep,
entry_uniname, order);
- unichar = *(uniname+len);
- *(uniname+len) = 0x0;
+ unichar = *(uniname + len);
+ *(uniname + len) = 0x0;
if (nls_uniname_cmp(sb, uniname, entry_uniname)) {
is_feasible_entry = false;
return dentry - (num_ext_entries);
}
- *(uniname+len) = unichar;
+ *(uniname + len) = unichar;
}
} else {
is_feasible_entry = false;
ret = FFS_MEDIAERR;
goto out;
}
- ep2 = ep+1;
+ ep2 = ep + 1;
} else {
ep = get_entry_in_dir(sb, &dir, dentry, NULL);
if (!ep) {
fid->hint_last_clu = clu;
/* byte offset in cluster */
- offset = (s32)(fid->rwoffset & (p_fs->cluster_size-1));
+ offset = (s32)(fid->rwoffset & (p_fs->cluster_size - 1));
/* sector offset in cluster */
sec_offset = offset >> p_bd->sector_size_bits;
if (fid->size == 0)
num_clusters = 0;
else
- num_clusters = (s32)((fid->size-1) >>
+ num_clusters = (s32)((fid->size - 1) >>
p_fs->cluster_size_bits) + 1;
write_bytes = 0;
num_alloc = (s32)((count - 1) >>
p_fs->cluster_size_bits) + 1;
new_clu.dir = (last_clu == CLUSTER_32(~0)) ?
- CLUSTER_32(~0) : last_clu+1;
+ CLUSTER_32(~0) : last_clu + 1;
new_clu.size = 0;
new_clu.flags = fid->flags;
}
} else {
if ((offset > 0) ||
- ((fid->rwoffset+oneblkwrite) < fid->size)) {
+ ((fid->rwoffset + oneblkwrite) < fid->size)) {
if (sector_read(sb, LogSector, &tmp_bh, 1) !=
FFS_SUCCESS)
goto err_out;
ES_ALL_ENTRIES, &ep);
if (!es)
goto err_out;
- ep2 = ep+1;
+ ep2 = ep + 1;
} else {
ep = get_entry_in_dir(sb, &(fid->dir), fid->entry, §or);
if (!ep)
fs_set_vol_flags(sb, VOL_DIRTY);
clu.dir = fid->start_clu;
- clu.size = (s32)((old_size-1) >> p_fs->cluster_size_bits) + 1;
+ clu.size = (s32)((old_size - 1) >> p_fs->cluster_size_bits) + 1;
clu.flags = fid->flags;
if (new_size > 0) {
- num_clusters = (s32)((new_size-1) >>
+ num_clusters = (s32)((new_size - 1) >>
p_fs->cluster_size_bits) + 1;
if (clu.flags == 0x03) {
ret = FFS_MEDIAERR;
goto out;
}
- ep2 = ep+1;
+ ep2 = ep + 1;
} else {
ep = get_entry_in_dir(sb, &(fid->dir), fid->entry, §or);
if (!ep) {
(parent_fid->start_clu != fid->dir.dir))) {
fid->dir.dir = parent_fid->start_clu;
fid->dir.flags = parent_fid->flags;
- fid->dir.size = ((parent_fid->size + (p_fs->cluster_size-1))
+ fid->dir.size = ((parent_fid->size + (p_fs->cluster_size - 1))
>> p_fs->cluster_size_bits);
}
}
if (num_entries < 0)
goto out;
p_fs->fs_func->delete_dir_entry(sb, p_dir, new_entry, 0,
- num_entries+1);
+ num_entries + 1);
}
out:
#ifdef CONFIG_EXFAT_DELAYED_SYNC
remove_file(inode, &dir, dentry);
clu_to_free.dir = fid->start_clu;
- clu_to_free.size = (s32)((fid->size-1) >> p_fs->cluster_size_bits) + 1;
+ clu_to_free.size = (s32)((fid->size - 1) >> p_fs->cluster_size_bits) + 1;
clu_to_free.flags = fid->flags;
/* (2) free the clusters */
ret = FFS_MEDIAERR;
goto out;
}
- ep2 = ep+1;
+ ep2 = ep + 1;
} else {
ep = get_entry_in_dir(sb, &(fid->dir), fid->entry, §or);
if (!ep) {
ret = FFS_MEDIAERR;
goto out;
}
- ep2 = ep+1;
+ ep2 = ep + 1;
} else {
/* for other than exfat */
ep = get_entry_in_dir(sb, &(fid->dir), fid->entry, §or);
if (dir.dir == CLUSTER_32(0)) /* FAT16 root_dir */
i = dentry % dentries_per_clu;
else
- i = dentry & (dentries_per_clu-1);
+ i = dentry & (dentries_per_clu - 1);
for ( ; i < dentries_per_clu; i++, dentry++) {
ep = get_entry_in_dir(sb, &clu, i, §or);
buf_unlock(sb, sector);
if (p_fs->vol_type == EXFAT) {
- ep = get_entry_in_dir(sb, &clu, i+1, NULL);
+ ep = get_entry_in_dir(sb, &clu, i + 1, NULL);
if (!ep) {
ret = FFS_MEDIAERR;
goto out;
down(&p_fs->v_sem);
clu_to_free.dir = fid->start_clu;
- clu_to_free.size = (s32)((fid->size-1) >> p_fs->cluster_size_bits) + 1;
+ clu_to_free.size = (s32)((fid->size - 1) >> p_fs->cluster_size_bits) + 1;
clu_to_free.flags = fid->flags;
if (!is_dir_empty(sb, &clu_to_free)) {
*/
if (err == FFS_MEDIAERR) {
cpos += 1 << p_bd->sector_size_bits;
- cpos &= ~((1 << p_bd->sector_size_bits)-1);
+ cpos &= ~((1 << p_bd->sector_size_bits) - 1);
}
err = -EIO;
inum = parent_ino(filp->f_path.dentry);
} else {
loff_t i_pos = ((loff_t) EXFAT_I(inode)->fid.start_clu << 32) |
- ((EXFAT_I(inode)->fid.rwoffset-1) & 0xffffffff);
+ ((EXFAT_I(inode)->fid.rwoffset - 1) & 0xffffffff);
struct inode *tmp = exfat_iget(sb, i_pos);
if (tmp) {
if (inode->i_ino == EXFAT_ROOT_INO) {
if (sector <
(p_fs->dentries_in_root >>
- (p_bd->sector_size_bits-DENTRY_SIZE_BITS))) {
+ (p_bd->sector_size_bits - DENTRY_SIZE_BITS))) {
*phys = sector + p_fs->root_start_sector;
*mapped_blocks = 1;
}
&EXFAT_I(mapping->host)->mmu_private);
if (ret < 0)
- exfat_write_failed(mapping, pos+len);
+ exfat_write_failed(mapping, pos + len);
return ret;
}
err = generic_write_end(file, mapping, pos, len, copied, pagep, fsdata);
if (err < len)
- exfat_write_failed(mapping, pos+len);
+ exfat_write_failed(mapping, pos + len);
if (!(err < 0) && !(fid->attr & ATTR_ARCHIVE)) {
inode->i_mtime = inode->i_ctime = current_time(inode);