diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-03-27 23:54:12 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-03-27 23:54:12 +0000 |
commit | d3e71cb08747743fce908122bab08b479eb403a5 (patch) | |
tree | cbec6948fdbdee9af81cf3ecfb504070d2745d7b /fs/udf | |
parent | fe7ff1706e323d0e5ed83972960a1ecc1ee538b3 (diff) |
Merge with Linux 2.3.99-pre3.
Diffstat (limited to 'fs/udf')
-rw-r--r-- | fs/udf/balloc.c | 102 | ||||
-rw-r--r-- | fs/udf/file.c | 6 | ||||
-rw-r--r-- | fs/udf/inode.c | 23 | ||||
-rw-r--r-- | fs/udf/lowlevel.c | 22 | ||||
-rw-r--r-- | fs/udf/misc.c | 8 | ||||
-rw-r--r-- | fs/udf/namei.c | 4 | ||||
-rw-r--r-- | fs/udf/super.c | 84 | ||||
-rw-r--r-- | fs/udf/udf_sb.h | 6 | ||||
-rw-r--r-- | fs/udf/udfdecl.h | 4 | ||||
-rw-r--r-- | fs/udf/unicode.c | 3 |
10 files changed, 163 insertions, 99 deletions
diff --git a/fs/udf/balloc.c b/fs/udf/balloc.c index 1aa3aa1c4..2be4e8562 100644 --- a/fs/udf/balloc.c +++ b/fs/udf/balloc.c @@ -85,14 +85,14 @@ found_middle: #define find_first_one_bit(addr, size)\ find_next_one_bit((addr), (size), 0) -static int read_block_bitmap(struct super_block * sb, unsigned int block, - unsigned long bitmap_nr) +static int read_block_bitmap(struct super_block * sb, Uint32 bitmap, + unsigned int block, unsigned long bitmap_nr) { struct buffer_head *bh = NULL; int retval = 0; lb_addr loc; - loc.logicalBlockNum = UDF_SB_PARTMAPS(sb)[UDF_SB_PARTITION(sb)].s_uspace_bitmap; + loc.logicalBlockNum = bitmap; loc.partitionReferenceNum = UDF_SB_PARTITION(sb); bh = udf_tread(sb, udf_get_lb_pblock(sb, loc, block), sb->s_blocksize); @@ -105,7 +105,8 @@ static int read_block_bitmap(struct super_block * sb, unsigned int block, return retval; } -static int __load_block_bitmap(struct super_block * sb, unsigned int block_group) +static int __load_block_bitmap(struct super_block * sb, Uint32 bitmap, + unsigned int block_group) { int i, j, retval = 0; unsigned long block_bitmap_number; @@ -125,7 +126,7 @@ static int __load_block_bitmap(struct super_block * sb, unsigned int block_group if (UDF_SB_BLOCK_BITMAP_NUMBER(sb, block_group) == block_group) return block_group; } - retval = read_block_bitmap(sb, block_group, block_group); + retval = read_block_bitmap(sb, bitmap, block_group, block_group); if (retval < 0) return retval; return block_group; @@ -150,7 +151,7 @@ static int __load_block_bitmap(struct super_block * sb, unsigned int block_group UDF_SB_BLOCK_BITMAP(sb, 0) = block_bitmap; if (!block_bitmap) - retval = read_block_bitmap(sb, block_group, 0); + retval = read_block_bitmap(sb, bitmap, block_group, 0); } else { @@ -163,12 +164,12 @@ static int __load_block_bitmap(struct super_block * sb, unsigned int block_group UDF_SB_BLOCK_BITMAP_NUMBER(sb, j) = UDF_SB_BLOCK_BITMAP_NUMBER(sb, j-1); UDF_SB_BLOCK_BITMAP(sb, j) = UDF_SB_BLOCK_BITMAP(sb, j-1); } - retval = read_block_bitmap(sb, block_group, 0); + retval = read_block_bitmap(sb, bitmap, block_group, 0); } return retval; } -static inline int load_block_bitmap(struct super_block *sb, +static inline int load_block_bitmap(struct super_block *sb, Uint32 bitmap, unsigned int block_group) { int slot; @@ -189,7 +190,7 @@ static inline int load_block_bitmap(struct super_block *sb, } else { - slot = __load_block_bitmap(sb, block_group); + slot = __load_block_bitmap(sb, bitmap, block_group); } if (slot < 0) @@ -201,8 +202,8 @@ static inline int load_block_bitmap(struct super_block *sb, return slot; } -void udf_free_blocks(const struct inode * inode, lb_addr bloc, Uint32 offset, - Uint32 count) +static void udf_bitmap_free_blocks(const struct inode * inode, Uint32 bitmap, + lb_addr bloc, Uint32 offset, Uint32 count) { struct buffer_head * bh = NULL; unsigned long block; @@ -220,9 +221,6 @@ void udf_free_blocks(const struct inode * inode, lb_addr bloc, Uint32 offset, return; } - if (UDF_SB_PARTMAPS(sb)[bloc.partitionReferenceNum].s_uspace_bitmap == 0xFFFFFFFF) - return; - lock_super(sb); if (bloc.logicalBlockNum < 0 || (bloc.logicalBlockNum + count) > UDF_SB_PARTLEN(sb, bloc.partitionReferenceNum)) @@ -248,7 +246,7 @@ do_more: overflow = bit + count - (sb->s_blocksize << 3); count -= overflow; } - bitmap_nr = load_block_bitmap(sb, block_group); + bitmap_nr = load_block_bitmap(sb, bitmap, block_group); if (bitmap_nr < 0) goto error_return; @@ -285,8 +283,8 @@ error_return: return; } -int udf_prealloc_blocks(const struct inode * inode, Uint16 partition, - Uint32 first_block, Uint32 block_count) +static int udf_bitmap_prealloc_blocks(const struct inode * inode, Uint32 bitmap, + Uint16 partition, Uint32 first_block, Uint32 block_count) { int alloc_count = 0; int bit, block, block_group, group_start; @@ -312,7 +310,7 @@ repeat: block_group = block >> (sb->s_blocksize_bits + 3); group_start = block_group ? 0 : sizeof(struct SpaceBitmapDesc); - bitmap_nr = load_block_bitmap(sb, block_group); + bitmap_nr = load_block_bitmap(sb, bitmap, block_group); if (bitmap_nr < 0) goto out; bh = UDF_SB_BLOCK_BITMAP(sb, bitmap_nr); @@ -351,7 +349,8 @@ out: return alloc_count; } -int udf_new_block(const struct inode * inode, Uint16 partition, Uint32 goal, int *err) +static int udf_bitmap_new_block(const struct inode * inode, Uint32 bitmap, + Uint16 partition, Uint32 goal, int *err) { int tmp, newbit, bit=0, block, block_group, group_start; int end_goal, nr_groups, bitmap_nr, i; @@ -379,7 +378,7 @@ repeat: block_group = block >> (sb->s_blocksize_bits + 3); group_start = block_group ? 0 : sizeof(struct SpaceBitmapDesc); - bitmap_nr = load_block_bitmap(sb, block_group); + bitmap_nr = load_block_bitmap(sb, bitmap, block_group); if (bitmap_nr < 0) goto error_return; bh = UDF_SB_BLOCK_BITMAP(sb, bitmap_nr); @@ -419,7 +418,7 @@ repeat: block_group = 0; group_start = block_group ? 0 : sizeof(struct SpaceBitmapDesc); - bitmap_nr = load_block_bitmap(sb, block_group); + bitmap_nr = load_block_bitmap(sb, bitmap, block_group); if (bitmap_nr < 0) goto error_return; bh = UDF_SB_BLOCK_BITMAP(sb, bitmap_nr); @@ -497,3 +496,64 @@ error_return: unlock_super(sb); return 0; } + +inline void udf_free_blocks(const struct inode * inode, lb_addr bloc, + Uint32 offset, Uint32 count) +{ + if (UDF_SB_PARTFLAGS(inode->i_sb, bloc.partitionReferenceNum) & UDF_PART_FLAG_UNALLOC_BITMAP) + { + return udf_bitmap_free_blocks(inode, + UDF_SB_PARTMAPS(inode->i_sb)[bloc.partitionReferenceNum].s_uspace.bitmap, + bloc, offset, count); + } + else if (UDF_SB_PARTFLAGS(inode->i_sb, bloc.partitionReferenceNum) & UDF_PART_FLAG_FREED_BITMAP) + { + return udf_bitmap_free_blocks(inode, + UDF_SB_PARTMAPS(inode->i_sb)[bloc.partitionReferenceNum].s_fspace.bitmap, + bloc, offset, count); + } + else + return; +} + +inline int udf_prealloc_blocks(const struct inode * inode, Uint16 partition, + Uint32 first_block, Uint32 block_count) +{ + if (UDF_SB_PARTFLAGS(inode->i_sb, partition) & UDF_PART_FLAG_UNALLOC_BITMAP) + { + return udf_bitmap_prealloc_blocks(inode, + UDF_SB_PARTMAPS(inode->i_sb)[partition].s_uspace.bitmap, + partition, first_block, block_count); + } + else if (UDF_SB_PARTFLAGS(inode->i_sb, partition) & UDF_PART_FLAG_FREED_BITMAP) + { + return udf_bitmap_prealloc_blocks(inode, + UDF_SB_PARTMAPS(inode->i_sb)[partition].s_fspace.bitmap, + partition, first_block, block_count); + } + else + return 0; +} + +inline int udf_new_block(const struct inode * inode, Uint16 partition, + Uint32 goal, int *err) +{ + if (UDF_SB_PARTFLAGS(inode->i_sb, partition) & UDF_PART_FLAG_UNALLOC_BITMAP) + { + return udf_bitmap_new_block(inode, + UDF_SB_PARTMAPS(inode->i_sb)[partition].s_uspace.bitmap, + partition, goal, err); + } + else if (UDF_SB_PARTFLAGS(inode->i_sb, partition) & UDF_PART_FLAG_FREED_BITMAP) + { + return udf_bitmap_new_block(inode, + UDF_SB_PARTMAPS(inode->i_sb)[partition].s_fspace.bitmap, + partition, goal, err); + } + else + { + *err = -EIO; + return 0; + } +} + diff --git a/fs/udf/file.c b/fs/udf/file.c index 73d47ac10..96297521b 100644 --- a/fs/udf/file.c +++ b/fs/udf/file.c @@ -87,7 +87,7 @@ static int udf_adinicb_writepage(struct dentry *dentry, struct page *page) return 0; } -static int udf_adinicb_prepare_write(struct page *page, unsigned offset, unsigned to) +static int udf_adinicb_prepare_write(struct file *file, struct page *page, unsigned offset, unsigned to) { kmap(page); return 0; @@ -246,7 +246,7 @@ int udf_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, struct FileEntry *fe; fe = (struct FileEntry *)bh->b_data; - eaicb = fe->extendedAttrICB; + eaicb = lela_to_cpu(fe->extendedAttrICB); if (UDF_I_LENEATTR(inode)) ea = fe->extendedAttr; } @@ -255,7 +255,7 @@ int udf_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, struct ExtendedFileEntry *efe; efe = (struct ExtendedFileEntry *)bh->b_data; - eaicb = efe->extendedAttrICB; + eaicb = lela_to_cpu(efe->extendedAttrICB); if (UDF_I_LENEATTR(inode)) ea = efe->extendedAttr; } diff --git a/fs/udf/inode.c b/fs/udf/inode.c index 264086135..ed1507fa7 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c @@ -74,10 +74,13 @@ static int udf_get_block(struct inode *, long, struct buffer_head *, int); */ void udf_put_inode(struct inode * inode) { - lock_kernel(); - udf_discard_prealloc(inode); - write_inode_now(inode); - unlock_kernel(); + if (!(inode->i_sb->s_flags & MS_RDONLY)) + { + lock_kernel(); + udf_discard_prealloc(inode); + write_inode_now(inode); + unlock_kernel(); + } } /* @@ -130,7 +133,7 @@ static int udf_readpage(struct dentry *dentry, struct page *page) return block_read_full_page(page, udf_get_block); } -static int udf_prepare_write(struct page *page, unsigned from, unsigned to) +static int udf_prepare_write(struct file *file, struct page *page, unsigned from, unsigned to) { return block_prepare_write(page, from, to, udf_get_block); } @@ -1554,16 +1557,18 @@ int udf_add_aext(struct inode *inode, lb_addr *bloc, int *extoffset, case ICB_FLAG_AD_SHORT: { sad = (short_ad *)sptr; - sad->extLength = EXTENT_NEXT_EXTENT_ALLOCDECS << 30 | - inode->i_sb->s_blocksize; + sad->extLength = cpu_to_le32( + EXTENT_NEXT_EXTENT_ALLOCDECS << 30 | + inode->i_sb->s_blocksize); sad->extPosition = cpu_to_le32(bloc->logicalBlockNum); break; } case ICB_FLAG_AD_LONG: { lad = (long_ad *)sptr; - lad->extLength = EXTENT_NEXT_EXTENT_ALLOCDECS << 30 | - inode->i_sb->s_blocksize; + lad->extLength = cpu_to_le32( + EXTENT_NEXT_EXTENT_ALLOCDECS << 30 | + inode->i_sb->s_blocksize); lad->extLocation = cpu_to_lelb(*bloc); break; } diff --git a/fs/udf/lowlevel.c b/fs/udf/lowlevel.c index 653997033..1403cec52 100644 --- a/fs/udf/lowlevel.c +++ b/fs/udf/lowlevel.c @@ -70,8 +70,6 @@ udf_get_last_session(struct super_block *sb) unsigned int udf_get_last_block(struct super_block *sb) { - extern int *blksize_size[]; - kdev_t dev = sb->s_dev; struct block_device *bdev = sb->s_bdev; int ret; unsigned long lblock = 0; @@ -80,28 +78,10 @@ udf_get_last_block(struct super_block *sb) if (ret) /* Hard Disk */ { - unsigned int hbsize = get_hardblocksize(dev); - unsigned int blocksize = sb->s_blocksize; - unsigned int mult = 0; - unsigned int div = 0; - - if (!hbsize) - hbsize = blksize_size[MAJOR(dev)][MINOR(dev)]; - - if (hbsize > blocksize) - mult = hbsize / blocksize; - else if (blocksize > hbsize) - div = blocksize / hbsize; - ret = ioctl_by_bdev(bdev, BLKGETSIZE, (unsigned long) &lblock); if (!ret && lblock != 0x7FFFFFFF) - { - if (mult) - lblock *= mult; - else if (div) - lblock /= div; - } + lblock = ((512 * lblock) / sb->s_blocksize); } if (!ret && lblock) diff --git a/fs/udf/misc.c b/fs/udf/misc.c index bed1e3984..ae998258e 100644 --- a/fs/udf/misc.c +++ b/fs/udf/misc.c @@ -90,7 +90,7 @@ udf_add_extendedattr(struct inode * inode, Uint32 size, Uint32 type, struct FileEntry *fe; fe = (struct FileEntry *)(*bh)->b_data; - eaicb = fe->extendedAttrICB; + eaicb = lela_to_cpu(fe->extendedAttrICB); offset = sizeof(struct FileEntry); } else @@ -98,7 +98,7 @@ udf_add_extendedattr(struct inode * inode, Uint32 size, Uint32 type, struct ExtendedFileEntry *efe; efe = (struct ExtendedFileEntry *)(*bh)->b_data; - eaicb = efe->extendedAttrICB; + eaicb = lela_to_cpu(efe->extendedAttrICB); offset = sizeof(struct ExtendedFileEntry); } @@ -206,7 +206,7 @@ udf_get_extendedattr(struct inode * inode, Uint32 type, Uint8 subtype, struct FileEntry *fe; fe = (struct FileEntry *)(*bh)->b_data; - eaicb = fe->extendedAttrICB; + eaicb = lela_to_cpu(fe->extendedAttrICB); if (UDF_I_LENEATTR(inode)) ea = fe->extendedAttr; } @@ -215,7 +215,7 @@ udf_get_extendedattr(struct inode * inode, Uint32 type, Uint8 subtype, struct ExtendedFileEntry *efe; efe = (struct ExtendedFileEntry *)(*bh)->b_data; - eaicb = efe->extendedAttrICB; + eaicb = lela_to_cpu(efe->extendedAttrICB); if (UDF_I_LENEATTR(inode)) ea = efe->extendedAttr; } diff --git a/fs/udf/namei.c b/fs/udf/namei.c index c371b5d52..a44e19043 100644 --- a/fs/udf/namei.c +++ b/fs/udf/namei.c @@ -935,7 +935,7 @@ static int udf_symlink(struct inode * dir, struct dentry * dentry, const char * inode->i_data.a_ops = &udf_symlink_aops; inode->i_op = &page_symlink_inode_operations; - if (UDF_I_ALLOCTYPE(inode) == ICB_FLAG_AD_IN_ICB) + if (UDF_I_ALLOCTYPE(inode) != ICB_FLAG_AD_IN_ICB) { struct buffer_head *bh = NULL; lb_addr bloc, eloc; @@ -964,7 +964,7 @@ static int udf_symlink(struct inode * dir, struct dentry * dentry, const char * bh = udf_tread(inode->i_sb, block, inode->i_sb->s_blocksize); ea = bh->b_data + udf_ext0_offset(inode); - eoffset = inode->i_sb->s_blocksize - (ea - bh->b_data); + eoffset = inode->i_sb->s_blocksize - udf_ext0_offset(inode); pc = (struct PathComponent *)ea; if (*symname == '/') diff --git a/fs/udf/super.c b/fs/udf/super.c index 81f59e9a3..5f76abbb0 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c @@ -100,14 +100,14 @@ static DECLARE_FSTYPE_DEV(udf_fstype, "udf", udf_read_super); /* Superblock operations */ static struct super_operations udf_sb_ops = { - read_inode: udf_read_inode, + read_inode: udf_read_inode, write_inode: udf_write_inode, - put_inode: udf_put_inode, + put_inode: udf_put_inode, delete_inode: udf_delete_inode, - put_super: udf_put_super, + put_super: udf_put_super, write_super: udf_write_super, - statfs: udf_statfs, - remount_fs: udf_remount_fs, + statfs: udf_statfs, + remount_fs: udf_remount_fs, }; struct udf_options @@ -127,7 +127,6 @@ struct udf_options uid_t uid; }; - static int __init init_udf_fs(void) { printk(KERN_NOTICE "udf: registering filesystem\n"); @@ -745,8 +744,9 @@ udf_load_pvoldesc(struct super_block *sb, struct buffer_head *bh) { if (udf_CS0toUTF8(&outstr, &instr)) { - udf_debug("volIdent[] = '%s'\n", outstr.u_name); - strncpy( UDF_SB_VOLIDENT(sb), outstr.u_name, outstr.u_len); + strncpy( UDF_SB_VOLIDENT(sb), outstr.u_name, + outstr.u_len > 31 ? 31 : outstr.u_len); + udf_debug("volIdent[] = '%s'\n", UDF_SB_VOLIDENT(sb)); } } @@ -788,7 +788,6 @@ udf_load_partdesc(struct super_block *sb, struct buffer_head *bh) { UDF_SB_PARTLEN(sb,i) = le32_to_cpu(p->partitionLength); /* blocks */ UDF_SB_PARTROOT(sb,i) = le32_to_cpu(p->partitionStartingLocation) + UDF_SB_SESSION(sb); - UDF_SB_PARTMAPS(sb)[i].s_uspace_bitmap = 0xFFFFFFFF; if (UDF_SB_PARTTYPE(sb,i) == UDF_SPARABLE_MAP15) udf_fill_spartable(sb, &UDF_SB_TYPESPAR(sb,i), UDF_SB_PARTLEN(sb,i)); @@ -803,17 +802,24 @@ udf_load_partdesc(struct super_block *sb, struct buffer_head *bh) udf_debug("unallocatedSpaceTable (part %d)\n", i); if (phd->unallocatedSpaceBitmap.extLength) { - UDF_SB_PARTMAPS(sb)[i].s_uspace_bitmap = + UDF_SB_PARTMAPS(sb)[i].s_uspace.bitmap = le32_to_cpu(phd->unallocatedSpaceBitmap.extPosition); + UDF_SB_PARTFLAGS(sb,i) |= UDF_PART_FLAG_UNALLOC_BITMAP; udf_debug("unallocatedSpaceBitmap (part %d) @ %d\n", - i, UDF_SB_PARTMAPS(sb)[i].s_uspace_bitmap); + i, UDF_SB_PARTMAPS(sb)[i].s_uspace.bitmap); } if (phd->partitionIntegrityTable.extLength) udf_debug("partitionIntegrityTable (part %d)\n", i); if (phd->freedSpaceTable.extLength) udf_debug("freedSpaceTable (part %d)\n", i); if (phd->freedSpaceBitmap.extLength) - udf_debug("freedSpaceBitmap (part %d\n", i); + { + UDF_SB_PARTMAPS(sb)[i].s_fspace.bitmap = + le32_to_cpu(phd->freedSpaceBitmap.extPosition); + UDF_SB_PARTFLAGS(sb,i) |= UDF_PART_FLAG_FREED_BITMAP; + udf_debug("freedSpaceBitmap (part %d) @ %d\n", + i, UDF_SB_PARTMAPS(sb)[i].s_fspace.bitmap); + } } break; } @@ -1184,7 +1190,6 @@ udf_load_partition(struct super_block *sb, lb_addr *fileset) } UDF_SB_PARTROOT(sb,i) = udf_get_pblock(sb, 0, i, 0); UDF_SB_PARTLEN(sb,i) = UDF_SB_PARTLEN(sb,ino.partitionReferenceNum); - UDF_SB_PARTMAPS(sb)[i].s_uspace_bitmap = 0xFFFFFFFF; } } } @@ -1520,34 +1525,27 @@ static unsigned int udf_count_free(struct super_block *sb) { struct buffer_head *bh = NULL; - unsigned int accum=0; - int index; - int block=0, newblock; + unsigned int accum = 0; lb_addr loc; - Uint32 bytes; - Uint8 value; - Uint8 * ptr; - Uint16 ident; - - if (UDF_SB_PARTMAPS(sb)[UDF_SB_PARTITION(sb)].s_uspace_bitmap == 0xFFFFFFFF) - { - if (UDF_SB_LVIDBH(sb)) - { - if (le32_to_cpu(UDF_SB_LVID(sb)->numOfPartitions) > UDF_SB_PARTITION(sb)) - accum = le32_to_cpu(UDF_SB_LVID(sb)->freeSpaceTable[UDF_SB_PARTITION(sb)]); - - if (accum == 0xFFFFFFFF) - accum = 0; + Uint32 bitmap; - return accum; - } - else - return 0; - } + if (UDF_SB_PARTFLAGS(sb,UDF_SB_PARTITION(sb)) & UDF_PART_FLAG_UNALLOC_BITMAP) + bitmap = UDF_SB_PARTMAPS(sb)[UDF_SB_PARTITION(sb)].s_uspace.bitmap; + else if (UDF_SB_PARTFLAGS(sb,UDF_SB_PARTITION(sb)) & UDF_PART_FLAG_FREED_BITMAP) + bitmap = UDF_SB_PARTMAPS(sb)[UDF_SB_PARTITION(sb)].s_fspace.bitmap; else + bitmap = 0xFFFFFFFF; + + if (bitmap != 0xFFFFFFFF) { struct SpaceBitmapDesc *bm; - loc.logicalBlockNum = UDF_SB_PARTMAPS(sb)[UDF_SB_PARTITION(sb)].s_uspace_bitmap; + int block = 0, newblock, index; + Uint16 ident; + Uint32 bytes; + Uint8 value; + Uint8 * ptr; + + loc.logicalBlockNum = bitmap; loc.partitionReferenceNum = UDF_SB_PARTITION(sb); bh = udf_read_ptagged(sb, loc, 0, &ident); @@ -1593,6 +1591,18 @@ udf_count_free(struct super_block *sb) } } udf_release_data(bh); - return accum; } + else + { + if (UDF_SB_LVIDBH(sb)) + { + if (le32_to_cpu(UDF_SB_LVID(sb)->numOfPartitions) > UDF_SB_PARTITION(sb)) + accum = le32_to_cpu(UDF_SB_LVID(sb)->freeSpaceTable[UDF_SB_PARTITION(sb)]); + + if (accum == 0xFFFFFFFF) + accum = 0; + } + } + + return accum; } diff --git a/fs/udf/udf_sb.h b/fs/udf/udf_sb.h index 6084c5613..6988a7238 100644 --- a/fs/udf/udf_sb.h +++ b/fs/udf/udf_sb.h @@ -18,6 +18,11 @@ #define UDF_FLAG_UNDELETE 6 #define UDF_FLAG_UNHIDE 7 #define UDF_FLAG_VARCONV 8 + +#define UDF_PART_FLAG_UNALLOC_BITMAP 0x0001 +#define UDF_PART_FLAG_UNALLOC_TABLE 0x0002 +#define UDF_PART_FLAG_FREED_BITMAP 0x0004 +#define UDF_PART_FLAG_FREED_TABLE 0x0008 #define UDF_SB_FREE(X)\ {\ @@ -52,6 +57,7 @@ #define UDF_SB_TYPESPAR(X,Y) ( UDF_SB_PARTMAPS(X)[(Y)].s_type_specific.s_sparing ) #define UDF_SB_TYPEVIRT(X,Y) ( UDF_SB_PARTMAPS(X)[(Y)].s_type_specific.s_virtual ) #define UDF_SB_PARTFUNC(X,Y) ( UDF_SB_PARTMAPS(X)[(Y)].s_partition_func ) +#define UDF_SB_PARTFLAGS(X,Y) ( UDF_SB_PARTMAPS(X)[(Y)].s_partition_flags ) #define UDF_SB_VOLIDENT(X) ( UDF_SB(X)->s_volident ) #define UDF_SB_NUMPARTS(X) ( UDF_SB(X)->s_partitions ) diff --git a/fs/udf/udfdecl.h b/fs/udf/udfdecl.h index b92eed7db..7dd00bc19 100644 --- a/fs/udf/udfdecl.h +++ b/fs/udf/udfdecl.h @@ -106,7 +106,7 @@ struct ktm struct ustr { Uint8 u_cmpID; - Uint8 u_name[UDF_NAME_LEN-1]; + Uint8 u_name[UDF_NAME_LEN]; Uint8 u_len; Uint8 padding; unsigned long u_hash; @@ -182,6 +182,8 @@ extern void udf_truncate(struct inode *); extern void udf_free_blocks(const struct inode *, lb_addr, Uint32, Uint32); extern int udf_prealloc_blocks(const struct inode *, Uint16, Uint32, Uint32); extern int udf_new_block(const struct inode *, Uint16, Uint32, int *); + +/* fsync.c */ extern int udf_sync_file(struct file *, struct dentry *); /* directory.c */ diff --git a/fs/udf/unicode.c b/fs/udf/unicode.c index 134b3c755..7cb2d3c1f 100644 --- a/fs/udf/unicode.c +++ b/fs/udf/unicode.c @@ -177,7 +177,8 @@ int udf_CS0toUTF8(struct ustr *utf_o, struct ustr *ocu_i) return 0; } - for (i = 0; (i < ocu_len) && (utf_o->u_len < UDF_NAME_LEN) ;) { + for (i = 0; (i < ocu_len) && (utf_o->u_len <= (UDF_NAME_LEN-3)) ;) + { /* Expand OSTA compressed Unicode to Unicode */ c = ocu[i++]; |