Commit 0fe988de authored by Ben Fennema's avatar Ben Fennema Committed by Linus Torvalds

[PATCH] udf patch for 2.5.7-pre1 (part 2/4)

This patch fixes writing the descriptor version for udf revisions >= 2.0
parent a7fb1571
......@@ -606,8 +606,12 @@ static void udf_table_free_blocks(struct super_block * sb,
mark_inode_dirty(table);
}
}
udf_new_tag(nbh->b_data, TID_ALLOC_EXTENT_DESC, 2, 1,
nbloc.logicalBlockNum, sizeof(tag));
if (UDF_SB_UDFREV(sb) >= 0x0200)
udf_new_tag(nbh->b_data, TID_ALLOC_EXTENT_DESC, 3, 1,
nbloc.logicalBlockNum, sizeof(tag));
else
udf_new_tag(nbh->b_data, TID_ALLOC_EXTENT_DESC, 2, 1,
nbloc.logicalBlockNum, sizeof(tag));
switch (UDF_I_ALLOCTYPE(table))
{
case ICB_FLAG_AD_SHORT:
......
......@@ -1518,7 +1518,10 @@ udf_update_inode(struct inode *inode, int do_sync)
ICB_FLAG_SETGID | ICB_FLAG_STICKY));
fe->icbTag.flags = cpu_to_le16(icbflags);
fe->descTag.descVersion = cpu_to_le16(2);
if (UDF_SB_UDFREV(inode->i_sb) >= 0x0200)
fe->descTag.descVersion = cpu_to_le16(3);
else
fe->descTag.descVersion = cpu_to_le16(2);
fe->descTag.tagSerialNum = cpu_to_le16(UDF_SB_SERIALNUM(inode->i_sb));
fe->descTag.tagLocation = cpu_to_le32(UDF_I_LOCATION(inode).logicalBlockNum);
crclen += UDF_I_LENEATTR(inode) + UDF_I_LENALLOC(inode) - sizeof(tag);
......@@ -1690,8 +1693,12 @@ Sint8 udf_add_aext(struct inode *inode, lb_addr *bloc, int *extoffset,
mark_inode_dirty(inode);
}
}
udf_new_tag(nbh->b_data, TID_ALLOC_EXTENT_DESC, 2, 1,
bloc->logicalBlockNum, sizeof(tag));
if (UDF_SB_UDFREV(inode->i_sb) >= 0x0200)
udf_new_tag(nbh->b_data, TID_ALLOC_EXTENT_DESC, 3, 1,
bloc->logicalBlockNum, sizeof(tag));
else
udf_new_tag(nbh->b_data, TID_ALLOC_EXTENT_DESC, 2, 1,
bloc->logicalBlockNum, sizeof(tag));
switch (UDF_I_ALLOCTYPE(inode))
{
case ICB_FLAG_AD_SHORT:
......
......@@ -591,7 +591,10 @@ udf_add_entry(struct inode *dir, struct dentry *dentry,
}
memset(cfi, 0, sizeof(struct FileIdentDesc));
udf_new_tag((char *)cfi, TID_FILE_IDENT_DESC, 2, 1, block, sizeof(tag));
if (UDF_SB_UDFREV(sb) >= 0x0200)
udf_new_tag((char *)cfi, TID_FILE_IDENT_DESC, 3, 1, block, sizeof(tag));
else
udf_new_tag((char *)cfi, TID_FILE_IDENT_DESC, 2, 1, block, sizeof(tag));
cfi->fileVersionNum = cpu_to_le16(1);
cfi->lengthFileIdent = namelen;
cfi->lengthOfImpUse = cpu_to_le16(0);
......
......@@ -851,6 +851,14 @@ 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);
if (le32_to_cpu(p->accessType) == PARTITION_ACCESS_R)
UDF_SB_PARTFLAGS(sb,i) |= UDF_PART_FLAG_READ_ONLY;
if (le32_to_cpu(p->accessType) == PARTITION_ACCESS_WO)
UDF_SB_PARTFLAGS(sb,i) |= UDF_PART_FLAG_WRITE_ONCE;
if (le32_to_cpu(p->accessType) == PARTITION_ACCESS_RW)
UDF_SB_PARTFLAGS(sb,i) |= UDF_PART_FLAG_REWRITABLE;
if (le32_to_cpu(p->accessType) == PARTITION_ACCESS_OW)
UDF_SB_PARTFLAGS(sb,i) |= UDF_PART_FLAG_OVERWRITABLE;
if (!strcmp(p->partitionContents.ident, PARTITION_CONTENTS_NSR02) ||
!strcmp(p->partitionContents.ident, PARTITION_CONTENTS_NSR03))
......
......@@ -25,6 +25,10 @@
#define UDF_PART_FLAG_UNALLOC_TABLE 0x0002
#define UDF_PART_FLAG_FREED_BITMAP 0x0004
#define UDF_PART_FLAG_FREED_TABLE 0x0008
#define UDF_PART_FLAG_READ_ONLY 0x0010
#define UDF_PART_FLAG_WRITE_ONCE 0x0020
#define UDF_PART_FLAG_REWRITABLE 0x0040
#define UDF_PART_FLAG_OVERWRITABLE 0x0080
#define UDF_SB_FREE(X)\
{\
......
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