diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2001-01-10 17:17:53 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2001-01-10 17:17:53 +0000 |
commit | b2ad5f821b1381492d792ca10b1eb7a107b48f14 (patch) | |
tree | 954a648692e7da983db1d2470953705f6a729264 /fs/fat | |
parent | c9c06167e7933d93a6e396174c68abf242294abb (diff) |
Merge with Linux 2.4.0-prerelease. Big Makefile rewrite, test your
Makefiles.
Diffstat (limited to 'fs/fat')
-rw-r--r-- | fs/fat/Makefile | 8 | ||||
-rw-r--r-- | fs/fat/cache.c | 12 | ||||
-rw-r--r-- | fs/fat/inode.c | 8 |
3 files changed, 18 insertions, 10 deletions
diff --git a/fs/fat/Makefile b/fs/fat/Makefile index 339250c7c..76368ae52 100644 --- a/fs/fat/Makefile +++ b/fs/fat/Makefile @@ -8,8 +8,10 @@ # Note 2! The CFLAGS definitions are now in the main makefile. O_TARGET := fat.o -O_OBJS := buffer.o cache.o dir.o file.o inode.o misc.o tables.o cvf.o -OX_OBJS := fatfs_syms.o -M_OBJS := $(O_TARGET) + +export-objs := fatfs_syms.o + +obj-y := buffer.o cache.o dir.o file.o inode.o misc.o tables.o cvf.o fatfs_syms.o +obj-m := $(O_TARGET) include $(TOPDIR)/Rules.make diff --git a/fs/fat/cache.c b/fs/fat/cache.c index fd3746920..0cc0ee242 100644 --- a/fs/fat/cache.c +++ b/fs/fat/cache.c @@ -70,7 +70,7 @@ int default_fat_access(struct super_block *sb,int nr,int new_value) } if (MSDOS_SB(sb)->fat_bits == 32) { p_first = p_last = NULL; /* GCC needs that stuff */ - next = CF_LE_L(((unsigned long *) bh->b_data)[(first & + next = CF_LE_L(((__u32 *) bh->b_data)[(first & (SECTOR_SIZE-1)) >> 2]); /* Fscking Microsoft marketing department. Their "32" is 28. */ next &= 0xfffffff; @@ -79,12 +79,12 @@ int default_fat_access(struct super_block *sb,int nr,int new_value) } else if (MSDOS_SB(sb)->fat_bits == 16) { p_first = p_last = NULL; /* GCC needs that stuff */ - next = CF_LE_W(((unsigned short *) bh->b_data)[(first & + next = CF_LE_W(((__u16 *) bh->b_data)[(first & (SECTOR_SIZE-1)) >> 1]); if (next >= 0xfff7) next = -1; } else { - p_first = &((unsigned char *) bh->b_data)[first & (SECTOR_SIZE-1)]; - p_last = &((unsigned char *) bh2->b_data)[(first+1) & + p_first = &((__u8 *) bh->b_data)[first & (SECTOR_SIZE-1)]; + p_last = &((__u8 *) bh2->b_data)[(first+1) & (SECTOR_SIZE-1)]; if (nr & 1) next = ((*p_first >> 4) | (*p_last << 4)) & 0xfff; else next = (*p_first+(*p_last << 8)) & 0xfff; @@ -92,10 +92,10 @@ int default_fat_access(struct super_block *sb,int nr,int new_value) } if (new_value != -1) { if (MSDOS_SB(sb)->fat_bits == 32) { - ((unsigned long *) bh->b_data)[(first & (SECTOR_SIZE-1)) >> + ((__u32 *) bh->b_data)[(first & (SECTOR_SIZE-1)) >> 2] = CT_LE_L(new_value); } else if (MSDOS_SB(sb)->fat_bits == 16) { - ((unsigned short *) bh->b_data)[(first & (SECTOR_SIZE-1)) >> + ((__u16 *) bh->b_data)[(first & (SECTOR_SIZE-1)) >> 1] = CT_LE_W(new_value); } else { if (nr & 1) { diff --git a/fs/fat/inode.c b/fs/fat/inode.c index 82f58826d..f13260966 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c @@ -746,7 +746,7 @@ static int fat_readpage(struct file *file, struct page *page) static int fat_prepare_write(struct file *file, struct page *page, unsigned from, unsigned to) { return cont_prepare_write(page,from,to,fat_get_block, - &MSDOS_I((struct inode*)page->mapping->host)->mmu_private); + &MSDOS_I(page->mapping->host)->mmu_private); } static int _fat_bmap(struct address_space *mapping, long block) { @@ -904,6 +904,12 @@ int fat_notify_change(struct dentry * dentry, struct iattr * attr) struct inode *inode = dentry->d_inode; int error; + /* FAT cannot truncate to a longer file */ + if (attr->ia_valid & ATTR_SIZE) { + if (attr->ia_size > inode->i_size) + return -EPERM; + } + error = inode_change_ok(inode, attr); if (error) return MSDOS_SB(sb)->options.quiet ? 0 : error; |