Commit e8759df1 authored by Hirofumi Ogawa's avatar Hirofumi Ogawa Committed by Linus Torvalds

[PATCH] fat: fs/fat/* cleanup

This patch is just cleanup (whitespace, and place of functions is changed).
No changes of logic.
Signed-off-by: default avatarOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent ac0b36bf
...@@ -296,7 +296,7 @@ static int __fat_access(struct super_block *sb, int nr, int new_value) ...@@ -296,7 +296,7 @@ static int __fat_access(struct super_block *sb, int nr, int new_value)
return next; return next;
} }
/* /*
* Returns the this'th FAT entry, -1 if it is an end-of-file entry. If * Returns the this'th FAT entry, -1 if it is an end-of-file entry. If
* new_value is != -1, that FAT entry is replaced by it. * new_value is != -1, that FAT entry is replaced by it.
*/ */
...@@ -343,7 +343,7 @@ int fat_get_cluster(struct inode *inode, int cluster, int *fclus, int *dclus) ...@@ -343,7 +343,7 @@ int fat_get_cluster(struct inode *inode, int cluster, int *fclus, int *dclus)
int nr; int nr;
BUG_ON(MSDOS_I(inode)->i_start == 0); BUG_ON(MSDOS_I(inode)->i_start == 0);
*fclus = 0; *fclus = 0;
*dclus = MSDOS_I(inode)->i_start; *dclus = MSDOS_I(inode)->i_start;
if (cluster == 0) if (cluster == 0)
...@@ -368,7 +368,7 @@ int fat_get_cluster(struct inode *inode, int cluster, int *fclus, int *dclus) ...@@ -368,7 +368,7 @@ int fat_get_cluster(struct inode *inode, int cluster, int *fclus, int *dclus)
nr = fat_access(sb, *dclus, -1); nr = fat_access(sb, *dclus, -1);
if (nr < 0) if (nr < 0)
return nr; return nr;
else if (nr == FAT_ENT_FREE) { else if (nr == FAT_ENT_FREE) {
fat_fs_panic(sb, "%s: invalid cluster chain" fat_fs_panic(sb, "%s: invalid cluster chain"
" (i_pos %lld)", __FUNCTION__, " (i_pos %lld)", __FUNCTION__,
...@@ -437,65 +437,3 @@ int fat_bmap(struct inode *inode, sector_t sector, sector_t *phys) ...@@ -437,65 +437,3 @@ int fat_bmap(struct inode *inode, sector_t sector, sector_t *phys)
} }
return 0; return 0;
} }
/* Free all clusters after the skip'th cluster. */
int fat_free(struct inode *inode, int skip)
{
struct super_block *sb = inode->i_sb;
int nr, ret, fclus, dclus;
if (MSDOS_I(inode)->i_start == 0)
return 0;
if (skip) {
ret = fat_get_cluster(inode, skip - 1, &fclus, &dclus);
if (ret < 0)
return ret;
else if (ret == FAT_ENT_EOF)
return 0;
nr = fat_access(sb, dclus, -1);
if (nr == FAT_ENT_EOF)
return 0;
else if (nr > 0) {
/*
* write a new EOF, and get the remaining cluster
* chain for freeing.
*/
nr = fat_access(sb, dclus, FAT_ENT_EOF);
}
if (nr < 0)
return nr;
fat_cache_inval_inode(inode);
} else {
fat_cache_inval_inode(inode);
nr = MSDOS_I(inode)->i_start;
MSDOS_I(inode)->i_start = 0;
MSDOS_I(inode)->i_logstart = 0;
mark_inode_dirty(inode);
}
lock_fat(sb);
do {
nr = fat_access(sb, nr, FAT_ENT_FREE);
if (nr < 0)
goto error;
else if (nr == FAT_ENT_FREE) {
fat_fs_panic(sb, "%s: deleting beyond EOF (i_pos %lld)",
__FUNCTION__, MSDOS_I(inode)->i_pos);
nr = -EIO;
goto error;
}
if (MSDOS_SB(sb)->free_clusters != -1)
MSDOS_SB(sb)->free_clusters++;
inode->i_blocks -= MSDOS_SB(sb)->cluster_size >> 9;
} while (nr != FAT_ENT_EOF);
fat_clusters_flush(sb);
nr = 0;
error:
unlock_fat(sb);
return nr;
}
...@@ -20,20 +20,8 @@ ...@@ -20,20 +20,8 @@
#include <linux/dirent.h> #include <linux/dirent.h>
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/buffer_head.h> #include <linux/buffer_head.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
static int fat_dir_ioctl(struct inode * inode, struct file * filp,
unsigned int cmd, unsigned long arg);
static int fat_readdir(struct file *filp, void *dirent, filldir_t filldir);
struct file_operations fat_dir_operations = {
.read = generic_read_dir,
.readdir = fat_readdir,
.ioctl = fat_dir_ioctl,
.fsync = file_fsync,
};
/* /*
* Convert Unicode 16 to UTF8, translated Unicode, or ASCII. * Convert Unicode 16 to UTF8, translated Unicode, or ASCII.
* If uni_xlate is enabled and we can't get a 1:1 conversion, use a * If uni_xlate is enabled and we can't get a 1:1 conversion, use a
...@@ -44,9 +32,8 @@ struct file_operations fat_dir_operations = { ...@@ -44,9 +32,8 @@ struct file_operations fat_dir_operations = {
* but ignore that right now. * but ignore that right now.
* Ahem... Stack smashing in ring 0 isn't fun. Fixed. * Ahem... Stack smashing in ring 0 isn't fun. Fixed.
*/ */
static int static int uni16_to_x8(unsigned char *ascii, wchar_t *uni, int uni_xlate,
uni16_to_x8(unsigned char *ascii, wchar_t *uni, int uni_xlate, struct nls_table *nls)
struct nls_table *nls)
{ {
wchar_t *ip, ec; wchar_t *ip, ec;
unsigned char *op, nc; unsigned char *op, nc;
...@@ -84,20 +71,6 @@ uni16_to_x8(unsigned char *ascii, wchar_t *uni, int uni_xlate, ...@@ -84,20 +71,6 @@ uni16_to_x8(unsigned char *ascii, wchar_t *uni, int uni_xlate,
return (op - ascii); return (op - ascii);
} }
#if 0
static void dump_de(struct msdos_dir_entry *de)
{
int i;
unsigned char *p = (unsigned char *) de;
printk("[");
for (i = 0; i < 32; i++, p++) {
printk("%02x ", *p);
}
printk("]\n");
}
#endif
static inline int static inline int
fat_short2uni(struct nls_table *t, unsigned char *c, int clen, wchar_t *uni) fat_short2uni(struct nls_table *t, unsigned char *c, int clen, wchar_t *uni)
{ {
...@@ -123,17 +96,17 @@ fat_short2lower_uni(struct nls_table *t, unsigned char *c, int clen, wchar_t *un ...@@ -123,17 +96,17 @@ fat_short2lower_uni(struct nls_table *t, unsigned char *c, int clen, wchar_t *un
charlen = 1; charlen = 1;
} else if (charlen <= 1) { } else if (charlen <= 1) {
unsigned char nc = t->charset2lower[*c]; unsigned char nc = t->charset2lower[*c];
if (!nc) if (!nc)
nc = *c; nc = *c;
if ( (charlen = t->char2uni(&nc, 1, uni)) < 0) { if ( (charlen = t->char2uni(&nc, 1, uni)) < 0) {
*uni = 0x003f; /* a question mark */ *uni = 0x003f; /* a question mark */
charlen = 1; charlen = 1;
} }
} else } else
*uni = wc; *uni = wc;
return charlen; return charlen;
} }
...@@ -150,7 +123,7 @@ fat_shortname2uni(struct nls_table *nls, unsigned char *buf, int buf_size, ...@@ -150,7 +123,7 @@ fat_shortname2uni(struct nls_table *nls, unsigned char *buf, int buf_size,
else if (opt & VFAT_SFN_DISPLAY_WINNT) { else if (opt & VFAT_SFN_DISPLAY_WINNT) {
if (lower) if (lower)
len = fat_short2lower_uni(nls, buf, buf_size, uni_buf); len = fat_short2lower_uni(nls, buf, buf_size, uni_buf);
else else
len = fat_short2uni(nls, buf, buf_size, uni_buf); len = fat_short2uni(nls, buf, buf_size, uni_buf);
} else } else
len = fat_short2uni(nls, buf, buf_size, uni_buf); len = fat_short2uni(nls, buf, buf_size, uni_buf);
...@@ -326,6 +299,8 @@ int fat_search_long(struct inode *inode, const unsigned char *name, ...@@ -326,6 +299,8 @@ int fat_search_long(struct inode *inode, const unsigned char *name,
return res; return res;
} }
EXPORT_SYMBOL(fat_search_long);
struct fat_ioctl_filldir_callback { struct fat_ioctl_filldir_callback {
struct dirent __user *dirent; struct dirent __user *dirent;
int result; int result;
...@@ -336,8 +311,6 @@ struct fat_ioctl_filldir_callback { ...@@ -336,8 +311,6 @@ struct fat_ioctl_filldir_callback {
int short_len; int short_len;
}; };
EXPORT_SYMBOL(fat_search_long);
static int fat_readdirx(struct inode *inode, struct file *filp, void *dirent, static int fat_readdirx(struct inode *inode, struct file *filp, void *dirent,
filldir_t filldir, int short_only, int both) filldir_t filldir, int short_only, int both)
{ {
...@@ -362,7 +335,7 @@ static int fat_readdirx(struct inode *inode, struct file *filp, void *dirent, ...@@ -362,7 +335,7 @@ static int fat_readdirx(struct inode *inode, struct file *filp, void *dirent,
int chi, chl, i, i2, j, last, last_u, dotoffset = 0; int chi, chl, i, i2, j, last, last_u, dotoffset = 0;
loff_t i_pos, cpos; loff_t i_pos, cpos;
int ret = 0; int ret = 0;
lock_kernel(); lock_kernel();
cpos = filp->f_pos; cpos = filp->f_pos;
...@@ -385,7 +358,7 @@ static int fat_readdirx(struct inode *inode, struct file *filp, void *dirent, ...@@ -385,7 +358,7 @@ static int fat_readdirx(struct inode *inode, struct file *filp, void *dirent,
goto out; goto out;
} }
bh = NULL; bh = NULL;
GetNew: GetNew:
long_slots = 0; long_slots = 0;
if (fat_get_entry(inode,&cpos,&bh,&de,&i_pos) == -1) if (fat_get_entry(inode,&cpos,&bh,&de,&i_pos) == -1)
...@@ -694,6 +667,132 @@ static int fat_dir_ioctl(struct inode * inode, struct file * filp, ...@@ -694,6 +667,132 @@ static int fat_dir_ioctl(struct inode * inode, struct file * filp,
return ret; return ret;
} }
struct file_operations fat_dir_operations = {
.read = generic_read_dir,
.readdir = fat_readdir,
.ioctl = fat_dir_ioctl,
.fsync = file_fsync,
};
static int fat_get_short_entry(struct inode *dir, loff_t *pos,
struct buffer_head **bh,
struct msdos_dir_entry **de, loff_t *i_pos)
{
while (fat_get_entry(dir, pos, bh, de, i_pos) >= 0) {
/* free entry or long name entry or volume label */
if (!IS_FREE((*de)->name) && !((*de)->attr & ATTR_VOLUME))
return 0;
}
return -ENOENT;
}
/* See if directory is empty */
int fat_dir_empty(struct inode *dir)
{
struct buffer_head *bh;
struct msdos_dir_entry *de;
loff_t cpos, i_pos;
int result = 0;
bh = NULL;
cpos = 0;
while (fat_get_short_entry(dir, &cpos, &bh, &de, &i_pos) >= 0) {
if (strncmp(de->name, MSDOS_DOT , MSDOS_NAME) &&
strncmp(de->name, MSDOS_DOTDOT, MSDOS_NAME)) {
result = -ENOTEMPTY;
break;
}
}
brelse(bh);
return result;
}
EXPORT_SYMBOL(fat_dir_empty);
/*
* fat_subdirs counts the number of sub-directories of dir. It can be run
* on directories being created.
*/
int fat_subdirs(struct inode *dir)
{
struct buffer_head *bh;
struct msdos_dir_entry *de;
loff_t cpos, i_pos;
int count = 0;
bh = NULL;
cpos = 0;
while (fat_get_short_entry(dir, &cpos, &bh, &de, &i_pos) >= 0) {
if (de->attr & ATTR_DIR)
count++;
}
brelse(bh);
return count;
}
/*
* 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 unsigned char *name,
struct buffer_head **bh, struct msdos_dir_entry **de,
loff_t *i_pos)
{
loff_t cpos;
*bh = NULL;
cpos = 0;
while (fat_get_short_entry(dir, &cpos, bh, de, i_pos) >= 0) {
if (!strncmp((*de)->name, name, MSDOS_NAME))
return 0;
}
return -ENOENT;
}
EXPORT_SYMBOL(fat_scan);
static struct buffer_head *fat_extend_dir(struct inode *inode)
{
struct super_block *sb = inode->i_sb;
struct buffer_head *bh, *res = NULL;
int nr, sec_per_clus = MSDOS_SB(sb)->sec_per_clus;
sector_t sector, last_sector;
if (MSDOS_SB(sb)->fat_bits != 32) {
if (inode->i_ino == MSDOS_ROOT_INO)
return ERR_PTR(-ENOSPC);
}
nr = fat_add_cluster(inode);
if (nr < 0)
return ERR_PTR(nr);
sector = ((sector_t)nr - 2) * sec_per_clus + MSDOS_SB(sb)->data_start;
last_sector = sector + sec_per_clus;
for ( ; sector < last_sector; sector++) {
if ((bh = sb_getblk(sb, sector))) {
memset(bh->b_data, 0, sb->s_blocksize);
set_buffer_uptodate(bh);
mark_buffer_dirty(bh);
if (!res)
res = bh;
else
brelse(bh);
}
}
if (res == NULL)
res = ERR_PTR(-EIO);
if (inode->i_size & (sb->s_blocksize - 1)) {
fat_fs_panic(sb, "Odd directory size");
inode->i_size = (inode->i_size + sb->s_blocksize)
& ~((loff_t)sb->s_blocksize - 1);
}
inode->i_size += MSDOS_SB(sb)->cluster_size;
MSDOS_I(inode)->mmu_private += MSDOS_SB(sb)->cluster_size;
return res;
}
/* This assumes that size of cluster is above the 32*slots */ /* This assumes that size of cluster is above the 32*slots */
int fat_add_entries(struct inode *dir,int slots, struct buffer_head **bh, int fat_add_entries(struct inode *dir,int slots, struct buffer_head **bh,
...@@ -722,7 +821,7 @@ int fat_add_entries(struct inode *dir,int slots, struct buffer_head **bh, ...@@ -722,7 +821,7 @@ int fat_add_entries(struct inode *dir,int slots, struct buffer_head **bh,
offset = curr; offset = curr;
} }
} }
if ((dir->i_ino == MSDOS_ROOT_INO) && (MSDOS_SB(sb)->fat_bits != 32)) if ((dir->i_ino == MSDOS_ROOT_INO) && (MSDOS_SB(sb)->fat_bits != 32))
return -ENOSPC; return -ENOSPC;
new_bh = fat_extend_dir(dir); new_bh = fat_extend_dir(dir);
if (IS_ERR(new_bh)) if (IS_ERR(new_bh))
...@@ -773,80 +872,3 @@ int fat_new_dir(struct inode *dir, struct inode *parent, int is_vfat) ...@@ -773,80 +872,3 @@ int fat_new_dir(struct inode *dir, struct inode *parent, int is_vfat)
} }
EXPORT_SYMBOL(fat_new_dir); EXPORT_SYMBOL(fat_new_dir);
static int fat_get_short_entry(struct inode *dir, loff_t *pos,
struct buffer_head **bh,
struct msdos_dir_entry **de, loff_t *i_pos)
{
while (fat_get_entry(dir, pos, bh, de, i_pos) >= 0) {
/* free entry or long name entry or volume label */
if (!IS_FREE((*de)->name) && !((*de)->attr & ATTR_VOLUME))
return 0;
}
return -ENOENT;
}
/* See if directory is empty */
int fat_dir_empty(struct inode *dir)
{
struct buffer_head *bh;
struct msdos_dir_entry *de;
loff_t cpos, i_pos;
int result = 0;
bh = NULL;
cpos = 0;
while (fat_get_short_entry(dir, &cpos, &bh, &de, &i_pos) >= 0) {
if (strncmp(de->name, MSDOS_DOT , MSDOS_NAME) &&
strncmp(de->name, MSDOS_DOTDOT, MSDOS_NAME)) {
result = -ENOTEMPTY;
break;
}
}
brelse(bh);
return result;
}
EXPORT_SYMBOL(fat_dir_empty);
/*
* fat_subdirs counts the number of sub-directories of dir. It can be run
* on directories being created.
*/
int fat_subdirs(struct inode *dir)
{
struct buffer_head *bh;
struct msdos_dir_entry *de;
loff_t cpos, i_pos;
int count = 0;
bh = NULL;
cpos = 0;
while (fat_get_short_entry(dir, &cpos, &bh, &de, &i_pos) >= 0) {
if (de->attr & ATTR_DIR)
count++;
}
brelse(bh);
return count;
}
/*
* 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 unsigned char *name,
struct buffer_head **bh, struct msdos_dir_entry **de,
loff_t *i_pos)
{
loff_t cpos;
*bh = NULL;
cpos = 0;
while (fat_get_short_entry(dir, &cpos, bh, de, i_pos) >= 0) {
if (!strncmp((*de)->name, name, MSDOS_NAME))
return 0;
}
return -ENOENT;
}
EXPORT_SYMBOL(fat_scan);
...@@ -6,13 +6,26 @@ ...@@ -6,13 +6,26 @@
* regular file handling primitives for fat-based filesystems * regular file handling primitives for fat-based filesystems
*/ */
#include <linux/module.h>
#include <linux/time.h> #include <linux/time.h>
#include <linux/msdos_fs.h> #include <linux/msdos_fs.h>
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/buffer_head.h> #include <linux/buffer_head.h>
static ssize_t fat_file_write(struct file *filp, const char __user *buf, static ssize_t fat_file_write(struct file *filp, const char __user *buf,
size_t count, loff_t *ppos); size_t count, loff_t *ppos)
{
struct inode *inode = filp->f_dentry->d_inode;
int retval;
retval = generic_file_write(filp, buf, count, ppos);
if (retval > 0) {
inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
MSDOS_I(inode)->i_attrs |= ATTR_ARCH;
mark_inode_dirty(inode);
}
return retval;
}
struct file_operations fat_file_operations = { struct file_operations fat_file_operations = {
.llseek = generic_file_llseek, .llseek = generic_file_llseek,
...@@ -25,63 +38,117 @@ struct file_operations fat_file_operations = { ...@@ -25,63 +38,117 @@ struct file_operations fat_file_operations = {
.sendfile = generic_file_sendfile, .sendfile = generic_file_sendfile,
}; };
struct inode_operations fat_file_inode_operations = { int fat_notify_change(struct dentry *dentry, struct iattr *attr)
.truncate = fat_truncate,
.setattr = fat_notify_change,
};
int fat_get_block(struct inode *inode, sector_t iblock,
struct buffer_head *bh_result, int create)
{ {
struct super_block *sb = inode->i_sb; struct msdos_sb_info *sbi = MSDOS_SB(dentry->d_sb);
sector_t phys; struct inode *inode = dentry->d_inode;
int err; int mask, error = 0;
err = fat_bmap(inode, iblock, &phys); lock_kernel();
if (err)
return err; /* FAT cannot truncate to a longer file */
if (phys) { if (attr->ia_valid & ATTR_SIZE) {
map_bh(bh_result, sb, phys); if (attr->ia_size > inode->i_size) {
return 0; error = -EPERM;
goto out;
}
} }
if (!create)
return 0; error = inode_change_ok(inode, attr);
if (iblock != MSDOS_I(inode)->mmu_private >> sb->s_blocksize_bits) { if (error) {
fat_fs_panic(sb, "corrupted file size (i_pos %lld, %lld)", if (sbi->options.quiet)
MSDOS_I(inode)->i_pos, MSDOS_I(inode)->mmu_private); error = 0;
return -EIO; goto out;
} }
if (!((unsigned long)iblock & (MSDOS_SB(sb)->sec_per_clus - 1))) { if (((attr->ia_valid & ATTR_UID) &&
int error; (attr->ia_uid != sbi->options.fs_uid)) ||
((attr->ia_valid & ATTR_GID) &&
(attr->ia_gid != sbi->options.fs_gid)) ||
((attr->ia_valid & ATTR_MODE) &&
(attr->ia_mode & ~MSDOS_VALID_MODE)))
error = -EPERM;
error = fat_add_cluster(inode); if (error) {
if (error < 0) if (sbi->options.quiet)
return error; error = 0;
goto out;
} }
MSDOS_I(inode)->mmu_private += sb->s_blocksize; error = inode_setattr(inode, attr);
err = fat_bmap(inode, iblock, &phys); if (error)
if (err) goto out;
return err;
if (!phys) if (S_ISDIR(inode->i_mode))
BUG(); mask = sbi->options.fs_dmask;
set_buffer_new(bh_result); else
map_bh(bh_result, sb, phys); mask = sbi->options.fs_fmask;
return 0; inode->i_mode &= S_IFMT | (S_IRWXUGO & ~mask);
out:
unlock_kernel();
return error;
} }
static ssize_t fat_file_write(struct file *filp, const char __user *buf, EXPORT_SYMBOL(fat_notify_change);
size_t count, loff_t *ppos)
/* Free all clusters after the skip'th cluster. */
static int fat_free(struct inode *inode, int skip)
{ {
struct inode *inode = filp->f_dentry->d_inode; struct super_block *sb = inode->i_sb;
int retval; int nr, ret, fclus, dclus;
retval = generic_file_write(filp, buf, count, ppos); if (MSDOS_I(inode)->i_start == 0)
if (retval > 0) { return 0;
inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
MSDOS_I(inode)->i_attrs |= ATTR_ARCH; if (skip) {
ret = fat_get_cluster(inode, skip - 1, &fclus, &dclus);
if (ret < 0)
return ret;
else if (ret == FAT_ENT_EOF)
return 0;
nr = fat_access(sb, dclus, -1);
if (nr == FAT_ENT_EOF)
return 0;
else if (nr > 0) {
/*
* write a new EOF, and get the remaining cluster
* chain for freeing.
*/
nr = fat_access(sb, dclus, FAT_ENT_EOF);
}
if (nr < 0)
return nr;
fat_cache_inval_inode(inode);
} else {
fat_cache_inval_inode(inode);
nr = MSDOS_I(inode)->i_start;
MSDOS_I(inode)->i_start = 0;
MSDOS_I(inode)->i_logstart = 0;
mark_inode_dirty(inode); mark_inode_dirty(inode);
} }
return retval;
lock_fat(sb);
do {
nr = fat_access(sb, nr, FAT_ENT_FREE);
if (nr < 0)
goto error;
else if (nr == FAT_ENT_FREE) {
fat_fs_panic(sb, "%s: deleting beyond EOF (i_pos %lld)",
__FUNCTION__, MSDOS_I(inode)->i_pos);
nr = -EIO;
goto error;
}
if (MSDOS_SB(sb)->free_clusters != -1)
MSDOS_SB(sb)->free_clusters++;
inode->i_blocks -= MSDOS_SB(sb)->cluster_size >> 9;
} while (nr != FAT_ENT_EOF);
fat_clusters_flush(sb);
nr = 0;
error:
unlock_fat(sb);
return nr;
} }
void fat_truncate(struct inode *inode) void fat_truncate(struct inode *inode)
...@@ -90,7 +157,7 @@ void fat_truncate(struct inode *inode) ...@@ -90,7 +157,7 @@ void fat_truncate(struct inode *inode)
const unsigned int cluster_size = sbi->cluster_size; const unsigned int cluster_size = sbi->cluster_size;
int nr_clusters; int nr_clusters;
/* /*
* This protects against truncating a file bigger than it was then * This protects against truncating a file bigger than it was then
* trying to write into the hole. * trying to write into the hole.
*/ */
...@@ -106,3 +173,8 @@ void fat_truncate(struct inode *inode) ...@@ -106,3 +173,8 @@ void fat_truncate(struct inode *inode)
inode->i_ctime = inode->i_mtime = CURRENT_TIME_SEC; inode->i_ctime = inode->i_mtime = CURRENT_TIME_SEC;
mark_inode_dirty(inode); mark_inode_dirty(inode);
} }
struct inode_operations fat_file_inode_operations = {
.truncate = fat_truncate,
.setattr = fat_notify_change,
};
This diff is collapsed.
...@@ -88,8 +88,8 @@ int fat_add_cluster(struct inode *inode) ...@@ -88,8 +88,8 @@ int fat_add_cluster(struct inode *inode)
struct super_block *sb = inode->i_sb; struct super_block *sb = inode->i_sb;
int ret, count, limit, new_dclus, new_fclus, last; int ret, count, limit, new_dclus, new_fclus, last;
int cluster_bits = MSDOS_SB(sb)->cluster_bits; int cluster_bits = MSDOS_SB(sb)->cluster_bits;
/* /*
* We must locate the last cluster of the file to add this new * We must locate the last cluster of the file to add this new
* one (new_dclus) to the end of the link list (the FAT). * one (new_dclus) to the end of the link list (the FAT).
* *
...@@ -109,7 +109,7 @@ int fat_add_cluster(struct inode *inode) ...@@ -109,7 +109,7 @@ int fat_add_cluster(struct inode *inode)
/* find free FAT entry */ /* find free FAT entry */
lock_fat(sb); lock_fat(sb);
if (MSDOS_SB(sb)->free_clusters == 0) { if (MSDOS_SB(sb)->free_clusters == 0) {
unlock_fat(sb); unlock_fat(sb);
return -ENOSPC; return -ENOSPC;
...@@ -145,7 +145,7 @@ int fat_add_cluster(struct inode *inode) ...@@ -145,7 +145,7 @@ int fat_add_cluster(struct inode *inode)
if (MSDOS_SB(sb)->free_clusters != -1) if (MSDOS_SB(sb)->free_clusters != -1)
MSDOS_SB(sb)->free_clusters--; MSDOS_SB(sb)->free_clusters--;
fat_clusters_flush(sb); fat_clusters_flush(sb);
unlock_fat(sb); unlock_fat(sb);
/* add new one to the last of the cluster chain */ /* add new one to the last of the cluster chain */
...@@ -169,65 +169,23 @@ int fat_add_cluster(struct inode *inode) ...@@ -169,65 +169,23 @@ int fat_add_cluster(struct inode *inode)
return new_dclus; return new_dclus;
} }
struct buffer_head *fat_extend_dir(struct inode *inode)
{
struct super_block *sb = inode->i_sb;
struct buffer_head *bh, *res = NULL;
int nr, sec_per_clus = MSDOS_SB(sb)->sec_per_clus;
sector_t sector, last_sector;
if (MSDOS_SB(sb)->fat_bits != 32) {
if (inode->i_ino == MSDOS_ROOT_INO)
return ERR_PTR(-ENOSPC);
}
nr = fat_add_cluster(inode);
if (nr < 0)
return ERR_PTR(nr);
sector = ((sector_t)nr - 2) * sec_per_clus + MSDOS_SB(sb)->data_start;
last_sector = sector + sec_per_clus;
for ( ; sector < last_sector; sector++) {
if ((bh = sb_getblk(sb, sector))) {
memset(bh->b_data, 0, sb->s_blocksize);
set_buffer_uptodate(bh);
mark_buffer_dirty(bh);
if (!res)
res = bh;
else
brelse(bh);
}
}
if (res == NULL)
res = ERR_PTR(-EIO);
if (inode->i_size & (sb->s_blocksize - 1)) {
fat_fs_panic(sb, "Odd directory size");
inode->i_size = (inode->i_size + sb->s_blocksize)
& ~((loff_t)sb->s_blocksize - 1);
}
inode->i_size += MSDOS_SB(sb)->cluster_size;
MSDOS_I(inode)->mmu_private += MSDOS_SB(sb)->cluster_size;
return res;
}
/* Linear day numbers of the respective 1sts in non-leap years. */
static int day_n[] = { 0,31,59,90,120,151,181,212,243,273,304,334,0,0,0,0 };
/* JanFebMarApr May Jun Jul Aug Sep Oct Nov Dec */
extern struct timezone sys_tz; extern struct timezone sys_tz;
/* Linear day numbers of the respective 1sts in non-leap years. */
static int day_n[] = {
/* Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec */
0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 0, 0, 0, 0
};
/* Convert a MS-DOS time/date pair to a UNIX date (seconds since 1 1 70). */ /* Convert a MS-DOS time/date pair to a UNIX date (seconds since 1 1 70). */
int date_dos2unix(unsigned short time, unsigned short date)
int date_dos2unix(unsigned short time,unsigned short date)
{ {
int month,year,secs; int month, year, secs;
/* first subtract and mask after that... Otherwise, if /*
date == 0, bad things happen */ * first subtract and mask after that... Otherwise, if
* date == 0, bad things happen
*/
month = ((date >> 5) - 1) & 15; month = ((date >> 5) - 1) & 15;
year = date >> 9; year = date >> 9;
secs = (time & 31)*2+60*((time >> 5) & 63)+(time >> 11)*3600+86400* secs = (time & 31)*2+60*((time >> 5) & 63)+(time >> 11)*3600+86400*
...@@ -238,12 +196,10 @@ int date_dos2unix(unsigned short time,unsigned short date) ...@@ -238,12 +196,10 @@ int date_dos2unix(unsigned short time,unsigned short date)
return secs; return secs;
} }
/* Convert linear UNIX date to a MS-DOS time/date pair. */ /* Convert linear UNIX date to a MS-DOS time/date pair. */
void fat_date_unix2dos(int unix_date, __le16 *time, __le16 *date)
void fat_date_unix2dos(int unix_date,__le16 *time, __le16 *date)
{ {
int day,year,nl_day,month; int day, year, nl_day, month;
unix_date -= sys_tz.tz_minuteswest*60; unix_date -= sys_tz.tz_minuteswest*60;
...@@ -255,16 +211,18 @@ void fat_date_unix2dos(int unix_date,__le16 *time, __le16 *date) ...@@ -255,16 +211,18 @@ void fat_date_unix2dos(int unix_date,__le16 *time, __le16 *date)
(((unix_date/3600) % 24) << 11)); (((unix_date/3600) % 24) << 11));
day = unix_date/86400-3652; day = unix_date/86400-3652;
year = day/365; year = day/365;
if ((year+3)/4+365*year > day) year--; if ((year+3)/4+365*year > day)
year--;
day -= (year+3)/4+365*year; day -= (year+3)/4+365*year;
if (day == 59 && !(year & 3)) { if (day == 59 && !(year & 3)) {
nl_day = day; nl_day = day;
month = 2; month = 2;
} } else {
else {
nl_day = (year & 3) || day <= 59 ? day : day-1; nl_day = (year & 3) || day <= 59 ? day : day-1;
for (month = 0; month < 12; month++) for (month = 0; month < 12; month++) {
if (day_n[month] > nl_day) break; if (day_n[month] > nl_day)
break;
}
} }
*date = cpu_to_le16(nl_day-day_n[month-1]+1+(month << 5)+(year << 9)); *date = cpu_to_le16(nl_day-day_n[month-1]+1+(month << 5)+(year << 9));
} }
...@@ -279,10 +237,10 @@ EXPORT_SYMBOL(fat_date_unix2dos); ...@@ -279,10 +237,10 @@ EXPORT_SYMBOL(fat_date_unix2dos);
AV. want the next entry (took one explicit de=NULL in vfat/namei.c). AV. want the next entry (took one explicit de=NULL in vfat/namei.c).
AV. It's done in fat_get_entry() (inlined), here the slow case lives. AV. It's done in fat_get_entry() (inlined), here the slow case lives.
AV. Additionally, when we return -1 (i.e. reached the end of directory) AV. Additionally, when we return -1 (i.e. reached the end of directory)
AV. we make bh NULL. AV. we make bh NULL.
*/ */
int fat__get_entry(struct inode *dir, loff_t *pos,struct buffer_head **bh, int fat__get_entry(struct inode *dir, loff_t *pos, struct buffer_head **bh,
struct msdos_dir_entry **de, loff_t *i_pos) struct msdos_dir_entry **de, loff_t *i_pos)
{ {
struct super_block *sb = dir->i_sb; struct super_block *sb = dir->i_sb;
......
...@@ -12,6 +12,10 @@ ...@@ -12,6 +12,10 @@
#define MSDOS_DPB_BITS 4 /* log2(MSDOS_DPB) */ #define MSDOS_DPB_BITS 4 /* log2(MSDOS_DPB) */
#define MSDOS_DPS (SECTOR_SIZE / sizeof(struct msdos_dir_entry)) #define MSDOS_DPS (SECTOR_SIZE / sizeof(struct msdos_dir_entry))
#define MSDOS_DPS_BITS 4 /* log2(MSDOS_DPS) */ #define MSDOS_DPS_BITS 4 /* log2(MSDOS_DPS) */
#define CF_LE_W(v) le16_to_cpu(v)
#define CF_LE_L(v) le32_to_cpu(v)
#define CT_LE_W(v) cpu_to_le16(v)
#define CT_LE_L(v) cpu_to_le32(v)
#define MSDOS_SUPER_MAGIC 0x4d44 /* MD */ #define MSDOS_SUPER_MAGIC 0x4d44 /* MD */
...@@ -23,37 +27,37 @@ ...@@ -23,37 +27,37 @@
#define FAT_MAX_DIR_ENTRIES (65536) #define FAT_MAX_DIR_ENTRIES (65536)
#define FAT_MAX_DIR_SIZE (FAT_MAX_DIR_ENTRIES << MSDOS_DIR_BITS) #define FAT_MAX_DIR_SIZE (FAT_MAX_DIR_ENTRIES << MSDOS_DIR_BITS)
#define ATTR_NONE 0 /* no attribute bits */ #define ATTR_NONE 0 /* no attribute bits */
#define ATTR_RO 1 /* read-only */ #define ATTR_RO 1 /* read-only */
#define ATTR_HIDDEN 2 /* hidden */ #define ATTR_HIDDEN 2 /* hidden */
#define ATTR_SYS 4 /* system */ #define ATTR_SYS 4 /* system */
#define ATTR_VOLUME 8 /* volume label */ #define ATTR_VOLUME 8 /* volume label */
#define ATTR_DIR 16 /* directory */ #define ATTR_DIR 16 /* directory */
#define ATTR_ARCH 32 /* archived */ #define ATTR_ARCH 32 /* archived */
/* attribute bits that are copied "as is" */ /* attribute bits that are copied "as is" */
#define ATTR_UNUSED (ATTR_VOLUME | ATTR_ARCH | ATTR_SYS | ATTR_HIDDEN) #define ATTR_UNUSED (ATTR_VOLUME | ATTR_ARCH | ATTR_SYS | ATTR_HIDDEN)
/* bits that are used by the Windows 95/Windows NT extended FAT */ /* bits that are used by the Windows 95/Windows NT extended FAT */
#define ATTR_EXT (ATTR_RO | ATTR_HIDDEN | ATTR_SYS | ATTR_VOLUME) #define ATTR_EXT (ATTR_RO | ATTR_HIDDEN | ATTR_SYS | ATTR_VOLUME)
#define CASE_LOWER_BASE 8 /* base is lower case */ #define CASE_LOWER_BASE 8 /* base is lower case */
#define CASE_LOWER_EXT 16 /* extension is lower case */ #define CASE_LOWER_EXT 16 /* extension is lower case */
#define DELETED_FLAG 0xe5 /* marks file as deleted when in name[0] */ #define DELETED_FLAG 0xe5 /* marks file as deleted when in name[0] */
#define IS_FREE(n) (!*(n) || *(n) == DELETED_FLAG) #define IS_FREE(n) (!*(n) || *(n) == DELETED_FLAG)
/* valid file mode bits */ /* valid file mode bits */
#define MSDOS_VALID_MODE (S_IFREG | S_IFDIR | S_IRWXU | S_IRWXG | S_IRWXO) #define MSDOS_VALID_MODE (S_IFREG | S_IFDIR | S_IRWXU | S_IRWXG | S_IRWXO)
/* Convert attribute bits and a mask to the UNIX mode. */ /* Convert attribute bits and a mask to the UNIX mode. */
#define MSDOS_MKMODE(a, m) (m & (a & ATTR_RO ? S_IRUGO|S_IXUGO : S_IRWXUGO)) #define MSDOS_MKMODE(a, m) (m & (a & ATTR_RO ? S_IRUGO|S_IXUGO : S_IRWXUGO))
/* Convert the UNIX mode to MS-DOS attribute bits. */ /* Convert the UNIX mode to MS-DOS attribute bits. */
#define MSDOS_MKATTR(m) ((m & S_IWUGO) ? ATTR_NONE : ATTR_RO) #define MSDOS_MKATTR(m) ((m & S_IWUGO) ? ATTR_NONE : ATTR_RO)
#define MSDOS_NAME 11 /* maximum name length */ #define MSDOS_NAME 11 /* maximum name length */
#define MSDOS_LONGNAME 256 /* maximum name length */ #define MSDOS_LONGNAME 256 /* maximum name length */
#define MSDOS_SLOTS 21 /* max # of slots needed for short and long names */ #define MSDOS_SLOTS 21 /* max # of slots for short and long names */
#define MSDOS_DOT ". " /* ".", padded to MSDOS_NAME chars */ #define MSDOS_DOT ". " /* ".", padded to MSDOS_NAME chars */
#define MSDOS_DOTDOT ".. " /* "..", padded to MSDOS_NAME chars */ #define MSDOS_DOTDOT ".. " /* "..", padded to MSDOS_NAME chars */
/* media of boot sector */ /* media of boot sector */
#define FAT_VALID_MEDIA(x) ((0xF8 <= (x) && (x) <= 0xFF) || (x) == 0xF0) #define FAT_VALID_MEDIA(x) ((0xF8 <= (x) && (x) <= 0xFF) || (x) == 0xF0)
...@@ -61,24 +65,24 @@ ...@@ -61,24 +65,24 @@
MSDOS_SB(s)->fat_bits == 16 ? 0xFF00 : 0xF00) | (x)) MSDOS_SB(s)->fat_bits == 16 ? 0xFF00 : 0xF00) | (x))
/* maximum number of clusters */ /* maximum number of clusters */
#define MAX_FAT12 0xFF4 #define MAX_FAT12 0xFF4
#define MAX_FAT16 0xFFF4 #define MAX_FAT16 0xFFF4
#define MAX_FAT32 0x0FFFFFF6 #define MAX_FAT32 0x0FFFFFF6
#define MAX_FAT(s) (MSDOS_SB(s)->fat_bits == 32 ? MAX_FAT32 : \ #define MAX_FAT(s) (MSDOS_SB(s)->fat_bits == 32 ? MAX_FAT32 : \
MSDOS_SB(s)->fat_bits == 16 ? MAX_FAT16 : MAX_FAT12) MSDOS_SB(s)->fat_bits == 16 ? MAX_FAT16 : MAX_FAT12)
/* bad cluster mark */ /* bad cluster mark */
#define BAD_FAT12 0xFF7 #define BAD_FAT12 0xFF7
#define BAD_FAT16 0xFFF7 #define BAD_FAT16 0xFFF7
#define BAD_FAT32 0x0FFFFFF7 #define BAD_FAT32 0x0FFFFFF7
#define BAD_FAT(s) (MSDOS_SB(s)->fat_bits == 32 ? BAD_FAT32 : \ #define BAD_FAT(s) (MSDOS_SB(s)->fat_bits == 32 ? BAD_FAT32 : \
MSDOS_SB(s)->fat_bits == 16 ? BAD_FAT16 : BAD_FAT12) MSDOS_SB(s)->fat_bits == 16 ? BAD_FAT16 : BAD_FAT12)
/* standard EOF */ /* standard EOF */
#define EOF_FAT12 0xFFF #define EOF_FAT12 0xFFF
#define EOF_FAT16 0xFFFF #define EOF_FAT16 0xFFFF
#define EOF_FAT32 0x0FFFFFFF #define EOF_FAT32 0x0FFFFFFF
#define EOF_FAT(s) (MSDOS_SB(s)->fat_bits == 32 ? EOF_FAT32 : \ #define EOF_FAT(s) (MSDOS_SB(s)->fat_bits == 32 ? EOF_FAT32 : \
MSDOS_SB(s)->fat_bits == 16 ? EOF_FAT16 : EOF_FAT12) MSDOS_SB(s)->fat_bits == 16 ? EOF_FAT16 : EOF_FAT12)
#define FAT_ENT_FREE (0) #define FAT_ENT_FREE (0)
...@@ -96,7 +100,7 @@ ...@@ -96,7 +100,7 @@
#define VFAT_IOCTL_READDIR_BOTH _IOR('r', 1, struct dirent [2]) #define VFAT_IOCTL_READDIR_BOTH _IOR('r', 1, struct dirent [2])
#define VFAT_IOCTL_READDIR_SHORT _IOR('r', 2, struct dirent [2]) #define VFAT_IOCTL_READDIR_SHORT _IOR('r', 2, struct dirent [2])
/* /*
* vfat shortname flags * vfat shortname flags
*/ */
#define VFAT_SFN_DISPLAY_LOWER 0x0001 /* convert to lowercase for display */ #define VFAT_SFN_DISPLAY_LOWER 0x0001 /* convert to lowercase for display */
...@@ -105,18 +109,6 @@ ...@@ -105,18 +109,6 @@
#define VFAT_SFN_CREATE_WIN95 0x0100 /* emulate win95 rule for create */ #define VFAT_SFN_CREATE_WIN95 0x0100 /* emulate win95 rule for create */
#define VFAT_SFN_CREATE_WINNT 0x0200 /* emulate winnt rule for create */ #define VFAT_SFN_CREATE_WINNT 0x0200 /* emulate winnt rule for create */
/*
* Conversion from and to little-endian byte order. (no-op on i386/i486)
*
* Naming: Ca_b_c, where a: F = from, T = to, b: LE = little-endian,
* BE = big-endian, c: W = word (16 bits), L = longword (32 bits)
*/
#define CF_LE_W(v) le16_to_cpu(v)
#define CF_LE_L(v) le32_to_cpu(v)
#define CT_LE_W(v) cpu_to_le16(v)
#define CT_LE_L(v) cpu_to_le32(v)
struct fat_boot_sector { struct fat_boot_sector {
__u8 ignored[3]; /* Boot strap short or near jump */ __u8 ignored[3]; /* Boot strap short or near jump */
__u8 system_id[8]; /* Name - can be used to special case __u8 system_id[8]; /* Name - can be used to special case
...@@ -161,7 +153,7 @@ struct msdos_dir_entry { ...@@ -161,7 +153,7 @@ struct msdos_dir_entry {
__le16 ctime; /* Creation time */ __le16 ctime; /* Creation time */
__le16 cdate; /* Creation date */ __le16 cdate; /* Creation date */
__le16 adate; /* Last access date */ __le16 adate; /* Last access date */
__le16 starthi; /* High 16 bits of cluster in FAT32 */ __le16 starthi; /* High 16 bits of cluster in FAT32 */
__le16 time,date,start;/* time, date and first cluster */ __le16 time,date,start;/* time, date and first cluster */
__le32 size; /* file size (in bytes) */ __le32 size; /* file size (in bytes) */
}; };
...@@ -179,9 +171,9 @@ struct msdos_dir_slot { ...@@ -179,9 +171,9 @@ struct msdos_dir_slot {
}; };
struct vfat_slot_info { struct vfat_slot_info {
int long_slots; /* number of long slots in filename */ int long_slots; /* number of long slots in filename */
loff_t longname_offset; /* dir offset for longname start */ loff_t longname_offset; /* dir offset for longname start */
loff_t i_pos; /* on-disk position of directory entry */ loff_t i_pos; /* on-disk position of directory entry */
}; };
#ifdef __KERNEL__ #ifdef __KERNEL__
...@@ -259,11 +251,11 @@ struct msdos_inode_info { ...@@ -259,11 +251,11 @@ struct msdos_inode_info {
unsigned int cache_valid_id; unsigned int cache_valid_id;
loff_t mmu_private; loff_t mmu_private;
int i_start; /* first cluster or 0 */ int i_start; /* first cluster or 0 */
int i_logstart; /* logical first cluster */ int i_logstart; /* logical first cluster */
int i_attrs; /* unused attribute bits */ int i_attrs; /* unused attribute bits */
int i_ctime_ms; /* unused change time in milliseconds */ int i_ctime_ms; /* unused change time in milliseconds */
loff_t i_pos; /* on-disk position of directory entry or 0 */ loff_t i_pos; /* on-disk position of directory entry or 0 */
struct hlist_node i_fat_hash; /* hash by i_location */ struct hlist_node i_fat_hash; /* hash by i_location */
struct inode vfs_inode; struct inode vfs_inode;
}; };
...@@ -305,20 +297,20 @@ static inline void fatwchar_to16(__u8 *dst, const wchar_t *src, size_t len) ...@@ -305,20 +297,20 @@ static inline void fatwchar_to16(__u8 *dst, const wchar_t *src, size_t len)
} }
/* fat/cache.c */ /* fat/cache.c */
extern int fat_access(struct super_block *sb, int nr, int new_value);
extern int fat_bmap(struct inode *inode, sector_t sector, sector_t *phys);
extern void fat_cache_inval_inode(struct inode *inode); extern void fat_cache_inval_inode(struct inode *inode);
extern int fat_access(struct super_block *sb, int nr, int new_value);
extern int fat_get_cluster(struct inode *inode, int cluster, extern int fat_get_cluster(struct inode *inode, int cluster,
int *fclus, int *dclus); int *fclus, int *dclus);
extern int fat_free(struct inode *inode, int skip); extern int fat_bmap(struct inode *inode, sector_t sector, sector_t *phys);
/* fat/dir.c */ /* fat/dir.c */
extern struct file_operations fat_dir_operations; extern struct file_operations fat_dir_operations;
extern int fat_search_long(struct inode *inode, const unsigned char *name, extern int fat_search_long(struct inode *inode, const unsigned char *name,
int name_len, int anycase, int name_len, int anycase,
loff_t *spos, loff_t *lpos); loff_t *spos, loff_t *lpos);
extern int fat_add_entries(struct inode *dir, int slots, struct buffer_head **bh, extern int fat_add_entries(struct inode *dir, int slots,
struct msdos_dir_entry **de, loff_t *i_pos); struct buffer_head **bh,
struct msdos_dir_entry **de, loff_t *i_pos);
extern int fat_new_dir(struct inode *dir, struct inode *parent, int is_vfat); extern int fat_new_dir(struct inode *dir, struct inode *parent, int is_vfat);
extern int fat_dir_empty(struct inode *dir); extern int fat_dir_empty(struct inode *dir);
extern int fat_subdirs(struct inode *dir); extern int fat_subdirs(struct inode *dir);
...@@ -329,8 +321,7 @@ extern int fat_scan(struct inode *dir, const unsigned char *name, ...@@ -329,8 +321,7 @@ extern int fat_scan(struct inode *dir, const unsigned char *name,
/* fat/file.c */ /* fat/file.c */
extern struct file_operations fat_file_operations; extern struct file_operations fat_file_operations;
extern struct inode_operations fat_file_inode_operations; extern struct inode_operations fat_file_inode_operations;
extern int fat_get_block(struct inode *inode, sector_t iblock, extern int fat_notify_change(struct dentry * dentry, struct iattr * attr);
struct buffer_head *bh_result, int create);
extern void fat_truncate(struct inode *inode); extern void fat_truncate(struct inode *inode);
/* fat/inode.c */ /* fat/inode.c */
...@@ -341,7 +332,6 @@ extern struct inode *fat_build_inode(struct super_block *sb, ...@@ -341,7 +332,6 @@ extern struct inode *fat_build_inode(struct super_block *sb,
struct msdos_dir_entry *de, loff_t i_pos, int *res); struct msdos_dir_entry *de, loff_t i_pos, int *res);
int fat_fill_super(struct super_block *sb, void *data, int silent, int fat_fill_super(struct super_block *sb, void *data, int silent,
struct inode_operations *fs_dir_inode_ops, int isvfat); struct inode_operations *fs_dir_inode_ops, int isvfat);
extern int fat_notify_change(struct dentry * dentry, struct iattr * attr);
/* fat/misc.c */ /* fat/misc.c */
extern void fat_fs_panic(struct super_block *s, const char *fmt, ...); extern void fat_fs_panic(struct super_block *s, const char *fmt, ...);
...@@ -349,7 +339,6 @@ extern void lock_fat(struct super_block *sb); ...@@ -349,7 +339,6 @@ extern void lock_fat(struct super_block *sb);
extern void unlock_fat(struct super_block *sb); extern void unlock_fat(struct super_block *sb);
extern void fat_clusters_flush(struct super_block *sb); extern void fat_clusters_flush(struct super_block *sb);
extern int fat_add_cluster(struct inode *inode); extern int fat_add_cluster(struct inode *inode);
extern struct buffer_head *fat_extend_dir(struct inode *inode);
extern int date_dos2unix(unsigned short time, unsigned short date); extern int date_dos2unix(unsigned short time, unsigned short date);
extern void fat_date_unix2dos(int unix_date, __le16 *time, __le16 *date); extern void fat_date_unix2dos(int unix_date, __le16 *time, __le16 *date);
extern int fat__get_entry(struct inode *dir, loff_t *pos, extern int fat__get_entry(struct inode *dir, loff_t *pos,
......
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