]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] udf patch for 2.5.7-pre1 (part 2/4)
authorBen Fennema <bfennema@falcon.csc.calpoly.edu>
Wed, 13 Mar 2002 07:37:25 +0000 (23:37 -0800)
committerLinus Torvalds <torvalds@home.transmeta.com>
Wed, 13 Mar 2002 07:37:25 +0000 (23:37 -0800)
This patch fixes writing the descriptor version for udf revisions >= 2.0

fs/udf/balloc.c
fs/udf/inode.c
fs/udf/namei.c
fs/udf/super.c
fs/udf/udf_sb.h

index 8dc09bf9600800858f694032366ce5f32382bcf1..56b769e9e332e6d46be2ef915c1ea978aa69a2d3 100644 (file)
@@ -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:
index 4a6af3b5e3e9e5489588a0a7dddab9a73187cb44..9d7cc260dfb7638d119c58f9845f42abb03801f9 100644 (file)
@@ -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:
index 5131033222d5705826b9f6b4d27be4b4717b5c46..dd74d84d4c911c58adae59b8064d352a94d2b812 100644 (file)
@@ -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);
index 94f483d365c4b36886ce9d8cbb1f15fe5359a1ab..d72d5b7eb314d597c49adddf6c7330f166859922 100644 (file)
@@ -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))
index 9473703db6a9e5c95bcded11224e741c83c4a672..85e01bf94b1dda9196a91572406d8f1701e0c4dd 100644 (file)
 #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)\
 {\