patch-2.3.13 linux/fs/fat/inode.c
Next file: linux/fs/fat/misc.c
Previous file: linux/fs/fat/file.c
Back to the patch index
Back to the overall index
- Lines: 140
- Date:
Mon Aug 9 11:43:49 1999
- Orig file:
v2.3.12/linux/fs/fat/inode.c
- Orig date:
Tue Jun 8 10:47:58 1999
diff -u --recursive --new-file v2.3.12/linux/fs/fat/inode.c linux/fs/fat/inode.c
@@ -33,6 +33,8 @@
#include <asm/uaccess.h>
#include <asm/unaligned.h>
+extern struct cvf_format default_cvf, bigblock_cvf;
+
/* #define FAT_PARANOIA 1 */
#define DEBUG_LEVEL 0
#ifdef FAT_DEBUG
@@ -166,7 +168,7 @@
void fat_put_super(struct super_block *sb)
{
- if (MSDOS_SB(sb)->cvf_format) {
+ if (MSDOS_SB(sb)->cvf_format->cvf_version) {
dec_cvf_format_use_count_by_version(MSDOS_SB(sb)->cvf_format->cvf_version);
MSDOS_SB(sb)->cvf_format->unmount_cvf(sb);
}
@@ -364,7 +366,6 @@
struct super_block *sb = inode->i_sb;
int nr;
- MSDOS_I(inode)->i_binary = 1;
INIT_LIST_HEAD(&MSDOS_I(inode)->i_fat_hash);
MSDOS_I(inode)->i_location = 0;
MSDOS_I(inode)->i_fat_inode = inode;
@@ -394,6 +395,7 @@
inode->i_blocks = (inode->i_size+inode->i_blksize-1)/
inode->i_blksize*MSDOS_SB(sb)->cluster_size;
MSDOS_I(inode)->i_logstart = 0;
+ MSDOS_I(inode)->i_realsize = inode->i_size;
MSDOS_I(inode)->i_attrs = 0;
inode->i_mtime = inode->i_atime = inode->i_ctime = 0;
@@ -477,10 +479,10 @@
sb->s_blocksize = 1024;
set_blocksize(sb->s_dev, 1024);
}
- bh = fat_bread(sb, 0);
+ bh = bread(sb->s_dev, 0, sb->s_blocksize);
unlock_super(sb);
- if (bh == NULL || !fat_is_uptodate(sb,bh)) {
- fat_brelse (sb, bh);
+ if (bh == NULL || !buffer_uptodate(bh)) {
+ brelse (bh);
goto out_no_bread;
}
@@ -572,7 +574,7 @@
MSDOS_MAX_EXTRA || (logical_sector_size & (SECTOR_SIZE-1))
|| !b->secs_track || !b->heads;
}
- fat_brelse(sb, bh);
+ brelse(bh);
set_blocksize(sb->s_dev, blksize);
/*
This must be done after the brelse because the bh is a dummy
@@ -589,6 +591,10 @@
i = detect_cvf(sb,cvf_format);
if (i >= 0)
error = cvf_formats[i]->mount_cvf(sb,cvf_options);
+ else if (sb->s_blocksize == 512)
+ MSDOS_SB(sb)->cvf_format = &default_cvf;
+ else
+ MSDOS_SB(sb)->cvf_format = &bigblock_cvf;
if (error || debug) {
/* The MSDOS_CAN_BMAP is obsolete, but left just to remember */
printk("[MS-DOS FS Rel. 12,FAT %d,check=%c,conv=%c,"
@@ -717,25 +723,6 @@
return copy_to_user(buf, &tmp, bufsiz) ? -EFAULT : 0;
}
-
-int fat_bmap(struct inode *inode,int block)
-{
- struct msdos_sb_info *sb;
- int cluster,offset;
-
- sb = MSDOS_SB(inode->i_sb);
- if (sb->cvf_format &&
- sb->cvf_format->cvf_bmap)
- return sb->cvf_format->cvf_bmap(inode,block);
- if ((inode->i_ino == MSDOS_ROOT_INO) && (sb->fat_bits != 32)) {
- return sb->dir_start + block;
- }
- cluster = block/sb->cluster_size;
- offset = block % sb->cluster_size;
- if (!(cluster = fat_get_cluster(inode,cluster))) return 0;
- return (cluster-2)*sb->cluster_size+sb->data_start+offset;
-}
-
static int is_exec(char *extension)
{
char *exe_extensions = "EXECOMBAT", *walk;
@@ -752,7 +739,6 @@
struct super_block *sb = inode->i_sb;
int nr;
- MSDOS_I(inode)->i_binary = 1;
INIT_LIST_HEAD(&MSDOS_I(inode)->i_fat_hash);
MSDOS_I(inode)->i_location = 0;
MSDOS_I(inode)->i_fat_inode = inode;
@@ -789,6 +775,7 @@
break;
}
}
+ MSDOS_I(inode)->i_realsize = inode->i_size;
} else { /* not a directory */
inode->i_mode = MSDOS_MKMODE(de->attr,
((IS_NOEXEC(inode) ||
@@ -796,14 +783,7 @@
!is_exec(de->ext)))
? S_IRUGO|S_IWUGO : S_IRWXUGO)
& ~MSDOS_SB(sb)->options.fs_umask) | S_IFREG;
- if (MSDOS_SB(sb)->cvf_format)
- inode->i_op = (MSDOS_SB(sb)->cvf_format->flags & CVF_USE_READPAGE)
- ? &fat_file_inode_operations_readpage
- : &fat_file_inode_operations_1024;
- else
- inode->i_op = (sb->s_blocksize == 1024 || sb->s_blocksize == 2048)
- ? &fat_file_inode_operations_1024
- : &fat_file_inode_operations;
+ inode->i_op = &fat_file_inode_operations;
MSDOS_I(inode)->i_start = CF_LE_W(de->start);
if (MSDOS_SB(sb)->fat_bits == 32) {
MSDOS_I(inode)->i_start |=
@@ -812,12 +792,11 @@
MSDOS_I(inode)->i_logstart = MSDOS_I(inode)->i_start;
inode->i_nlink = 1;
inode->i_size = CF_LE_L(de->size);
+ MSDOS_I(inode)->i_realsize = ((inode->i_size-1)|(SECTOR_SIZE-1))+1;
}
if(de->attr & ATTR_SYS)
if (MSDOS_SB(sb)->options.sys_immutable)
inode->i_flags |= S_IMMUTABLE;
- MSDOS_I(inode)->i_binary =
- fat_is_binary(MSDOS_SB(sb)->options.conversion, de->ext);
MSDOS_I(inode)->i_attrs = de->attr & ATTR_UNUSED;
/* this is as close to the truth as we can get ... */
inode->i_blksize = MSDOS_SB(sb)->cluster_size*SECTOR_SIZE;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)