diff options
Diffstat (limited to 'fs/ntfs')
-rw-r--r-- | fs/ntfs/fs.c | 16 | ||||
-rw-r--r-- | fs/ntfs/super.c | 8 | ||||
-rw-r--r-- | fs/ntfs/super.h | 2 |
3 files changed, 11 insertions, 15 deletions
diff --git a/fs/ntfs/fs.c b/fs/ntfs/fs.c index 4fe6df055..b087bd7f6 100644 --- a/fs/ntfs/fs.c +++ b/fs/ntfs/fs.c @@ -442,10 +442,8 @@ static struct inode_operations ntfs_inode_operations_nobmap = { NULL, /* get_block */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* flushpage */ NULL, /* truncate */ NULL, /* permission */ - NULL, /* smap */ NULL, /* revalidate */ }; @@ -625,10 +623,8 @@ static struct inode_operations ntfs_inode_operations = { ntfs_bmap, /* get_block */ block_read_full_page, /* readpage */ NULL, /* writepage */ - NULL, /* flushpage */ NULL, /* truncate */ NULL, /* permission */ - NULL, /* smap */ NULL, /* revalidate */ }; @@ -674,10 +670,8 @@ static struct inode_operations ntfs_dir_inode_operations = { NULL, /* get_block */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* flushpage */ NULL, /* truncate */ NULL, /* permission */ - NULL, /* smap */ NULL, /* revalidate */ }; @@ -818,6 +812,7 @@ static int ntfs_statfs(struct super_block *sb, struct statfs *sf, int bufsize) struct statfs fs; struct inode *mft; ntfs_volume *vol; + ntfs_u64 size; int error; ntfs_debug(DEBUG_OTHER, "ntfs_statfs\n"); @@ -826,16 +821,21 @@ static int ntfs_statfs(struct super_block *sb, struct statfs *sf, int bufsize) fs.f_type=NTFS_SUPER_MAGIC; fs.f_bsize=vol->clustersize; - error = ntfs_get_volumesize( NTFS_SB2VOL( sb ), &fs.f_blocks ); + error = ntfs_get_volumesize( NTFS_SB2VOL( sb ), &size ); if( error ) return -error; + fs.f_blocks = size; /* volumesize is in clusters */ fs.f_bfree=ntfs_get_free_cluster_count(vol->bitmap); fs.f_bavail=fs.f_bfree; /* Number of files is limited by free space only, so we lie here */ fs.f_ffree=0; mft=iget(sb,FILE_MFT); - fs.f_files=mft->i_size/vol->mft_recordsize; + if (!mft) + return -EIO; + /* So ... we lie... thus this following cast of loff_t value + is ok here.. */ + fs.f_files = (unsigned long)mft->i_size / vol->mft_recordsize; iput(mft); /* should be read from volume */ diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c index 51f14e72b..d7dcb127f 100644 --- a/fs/ntfs/super.c +++ b/fs/ntfs/super.c @@ -253,10 +253,9 @@ int ntfs_release_volume(ntfs_volume *vol) * Writes the volume size into vol_size. Returns 0 if successful * or error. */ -int ntfs_get_volumesize(ntfs_volume *vol, long *vol_size ) +int ntfs_get_volumesize(ntfs_volume *vol, ntfs_u64 *vol_size ) { ntfs_io io; - ntfs_u64 size; char *cluster0; if( !vol_size ) @@ -272,11 +271,8 @@ int ntfs_get_volumesize(ntfs_volume *vol, long *vol_size ) io.do_read=1; io.size=vol->clustersize; ntfs_getput_clusters(vol,0,0,&io); - size=NTFS_GETU64(cluster0+0x28); + *vol_size = NTFS_GETU64(cluster0+0x28); ntfs_free(cluster0); - /* FIXME: more than 2**32 cluster */ - /* FIXME: gcc will emit udivdi3 if we don't truncate it */ - *vol_size = ((unsigned long)size)/vol->clusterfactor; return 0; } diff --git a/fs/ntfs/super.h b/fs/ntfs/super.h index b74772143..3afbf7e47 100644 --- a/fs/ntfs/super.h +++ b/fs/ntfs/super.h @@ -10,7 +10,7 @@ #define ALLOC_REQUIRE_SIZE 2 int ntfs_get_free_cluster_count(ntfs_inode *bitmap); -int ntfs_get_volumesize(ntfs_volume *vol, long *vol_size ); +int ntfs_get_volumesize(ntfs_volume *vol, ntfs_u64 *vol_size ); int ntfs_init_volume(ntfs_volume *vol,char *boot); int ntfs_load_special_files(ntfs_volume *vol); int ntfs_release_volume(ntfs_volume *vol); |