]> git.hungrycats.org Git - linux/commitdiff
[PATCH] udf patch for 2.5.7-pre1 (part 4/4)
authorBen Fennema <bfennema@falcon.csc.calpoly.edu>
Wed, 13 Mar 2002 07:39:28 +0000 (23:39 -0800)
committerLinus Torvalds <torvalds@home.transmeta.com>
Wed, 13 Mar 2002 07:39:28 +0000 (23:39 -0800)
This patch moves the udf spec header files into the fs/udf directory and
removes all the non-standard sized typedefs.

28 files changed:
fs/udf/balloc.c
fs/udf/crc.c
fs/udf/dir.c
fs/udf/directory.c
fs/udf/ecma_167.h [new file with mode: 0644]
fs/udf/file.c
fs/udf/fsync.c
fs/udf/ialloc.c
fs/udf/inode.c
fs/udf/lowlevel.c
fs/udf/misc.c
fs/udf/namei.c
fs/udf/osta_udf.h [new file with mode: 0644]
fs/udf/partition.c
fs/udf/super.c
fs/udf/symlink.c
fs/udf/truncate.c
fs/udf/udf_i.h
fs/udf/udf_sb.h
fs/udf/udfdecl.h
fs/udf/udfend.h
fs/udf/udftime.c
fs/udf/unicode.c
include/linux/udf_167.h [deleted file]
include/linux/udf_fs.h
include/linux/udf_fs_i.h
include/linux/udf_fs_sb.h
include/linux/udf_udf.h [deleted file]

index 56b769e9e332e6d46be2ef915c1ea978aa69a2d3..eab06b2999d75b371f839d8c20dae3a00c6534f1 100644 (file)
@@ -15,7 +15,7 @@
  *             ftp://prep.ai.mit.edu/pub/gnu/GPL
  *     Each contributing author retains all rights to their own work.
  *
- *  (C) 1999-2000 Ben Fennema
+ *  (C) 1999-2001 Ben Fennema
  *  (C) 1999 Stelias Computing Inc
  *
  * HISTORY
  */
 
 #include "udfdecl.h"
-#include <linux/fs.h>
+
 #include <linux/locks.h>
 #include <linux/quotaops.h>
-#include <linux/udf_fs.h>
-
 #include <asm/bitops.h>
 
 #include "udf_i.h"
 #define leBPL_to_cpup(x) leNUM_to_cpup(BITS_PER_LONG, x)
 #define leNUM_to_cpup(x,y) xleNUM_to_cpup(x,y)
 #define xleNUM_to_cpup(x,y) (le ## x ## _to_cpup(y))
-#define UintBPL Uint(BITS_PER_LONG)
-#define Uint(x) xUint(x)
-#define xUint(x) Uint ## x
+#define uintBPL_t uint(BITS_PER_LONG)
+#define uint(x) xuint(x)
+#define xuint(x) uint ## x ## _t
 
 extern inline int find_next_one_bit (void * addr, int size, int offset)
 {
-       UintBPL * p = ((UintBPL *) addr) + (offset / BITS_PER_LONG);
-       UintBPL result = offset & ~(BITS_PER_LONG-1);
-       UintBPL tmp;
+       uintBPL_t * p = ((uintBPL_t *) addr) + (offset / BITS_PER_LONG);
+       uintBPL_t result = offset & ~(BITS_PER_LONG-1);
+       uintBPL_t tmp;
 
        if (offset >= size)
                return size;
@@ -147,7 +145,7 @@ static inline int load_block_bitmap(struct super_block * sb,
 
 static void udf_bitmap_free_blocks(struct super_block * sb,
        struct inode * inode,
-       struct udf_bitmap *bitmap, lb_addr bloc, Uint32 offset, Uint32 count)
+       struct udf_bitmap *bitmap, lb_addr bloc, uint32_t offset, uint32_t count)
 {
        struct buffer_head * bh = NULL;
        unsigned long block;
@@ -167,7 +165,7 @@ static void udf_bitmap_free_blocks(struct super_block * sb,
                goto error_return;
        }
 
-       block = bloc.logicalBlockNum + offset + (sizeof(struct SpaceBitmapDesc) << 3);
+       block = bloc.logicalBlockNum + offset + (sizeof(struct spaceBitmapDesc) << 3);
 
 do_more:
        overflow = 0;
@@ -222,8 +220,8 @@ error_return:
 
 static int udf_bitmap_prealloc_blocks(struct super_block * sb,
        struct inode * inode,
-       struct udf_bitmap *bitmap, Uint16 partition, Uint32 first_block,
-       Uint32 block_count)
+       struct udf_bitmap *bitmap, uint16_t partition, uint32_t first_block,
+       uint32_t block_count)
 {
        int alloc_count = 0;
        int bit, block, block_group, group_start;
@@ -240,10 +238,10 @@ static int udf_bitmap_prealloc_blocks(struct super_block * sb,
 
 repeat:
        nr_groups = (UDF_SB_PARTLEN(sb, partition) +
-               (sizeof(struct SpaceBitmapDesc) << 3) + (sb->s_blocksize * 8) - 1) / (sb->s_blocksize * 8);
-       block = first_block + (sizeof(struct SpaceBitmapDesc) << 3);
+               (sizeof(struct spaceBitmapDesc) << 3) + (sb->s_blocksize * 8) - 1) / (sb->s_blocksize * 8);
+       block = first_block + (sizeof(struct spaceBitmapDesc) << 3);
        block_group = block >> (sb->s_blocksize_bits + 3);
-       group_start = block_group ? 0 : sizeof(struct SpaceBitmapDesc);
+       group_start = block_group ? 0 : sizeof(struct spaceBitmapDesc);
 
        bitmap_nr = load_block_bitmap(sb, bitmap, block_group);
        if (bitmap_nr < 0)
@@ -286,7 +284,7 @@ out:
 
 static int udf_bitmap_new_block(struct super_block * sb,
        struct inode * inode,
-       struct udf_bitmap *bitmap, Uint16 partition, Uint32 goal, int *err)
+       struct udf_bitmap *bitmap, uint16_t partition, uint32_t goal, int *err)
 {
        int newbit, bit=0, block, block_group, group_start;
        int end_goal, nr_groups, bitmap_nr, i;
@@ -302,9 +300,9 @@ repeat:
                goal = 0;
 
        nr_groups = bitmap->s_nr_groups;
-       block = goal + (sizeof(struct SpaceBitmapDesc) << 3);
+       block = goal + (sizeof(struct spaceBitmapDesc) << 3);
        block_group = block >> (sb->s_blocksize_bits + 3);
-       group_start = block_group ? 0 : sizeof(struct SpaceBitmapDesc);
+       group_start = block_group ? 0 : sizeof(struct spaceBitmapDesc);
 
        bitmap_nr = load_block_bitmap(sb, bitmap, block_group);
        if (bitmap_nr < 0)
@@ -344,7 +342,7 @@ repeat:
                block_group ++;
                if (block_group >= nr_groups)
                        block_group = 0;
-               group_start = block_group ? 0 : sizeof(struct SpaceBitmapDesc);
+               group_start = block_group ? 0 : sizeof(struct spaceBitmapDesc);
 
                bitmap_nr = load_block_bitmap(sb, bitmap, block_group);
                if (bitmap_nr < 0)
@@ -397,7 +395,7 @@ got_block:
        }
 
        newblock = bit + (block_group << (sb->s_blocksize_bits + 3)) -
-               (sizeof(struct SpaceBitmapDesc) << 3);
+               (sizeof(struct spaceBitmapDesc) << 3);
 
        if (!udf_clear_bit(bit, bh->b_data))
        {
@@ -426,13 +424,13 @@ error_return:
 
 static void udf_table_free_blocks(struct super_block * sb,
        struct inode * inode,
-       struct inode * table, lb_addr bloc, Uint32 offset, Uint32 count)
+       struct inode * table, lb_addr bloc, uint32_t offset, uint32_t count)
 {
-       Uint32 start, end;
-       Uint32 nextoffset, oextoffset, elen;
+       uint32_t start, end;
+       uint32_t nextoffset, oextoffset, elen;
        lb_addr nbloc, obloc, eloc;
        struct buffer_head *obh, *nbh;
-       Sint8 etype;
+       int8_t etype;
        int i;
 
        lock_super(sb);
@@ -459,7 +457,7 @@ static void udf_table_free_blocks(struct super_block * sb,
        start = bloc.logicalBlockNum + offset;
        end = bloc.logicalBlockNum + offset + count - 1;
 
-       oextoffset = nextoffset = sizeof(struct UnallocatedSpaceEntry);
+       oextoffset = nextoffset = sizeof(struct unallocSpaceEntry);
        elen = 0;
        obloc = nbloc = UDF_I_LOCATION(table);
 
@@ -538,15 +536,15 @@ static void udf_table_free_blocks(struct super_block * sb,
                int adsize;
                short_ad *sad = NULL;
                long_ad *lad = NULL;
-               struct AllocExtDesc *aed;
+               struct allocExtDesc *aed;
 
                eloc.logicalBlockNum = start;
-               elen = (EXTENT_RECORDED_ALLOCATED << 30) |
+               elen = EXT_RECORDED_ALLOCATED |
                        (count << sb->s_blocksize_bits);
 
-               if (UDF_I_ALLOCTYPE(table) == ICB_FLAG_AD_SHORT)
+               if (UDF_I_ALLOCTYPE(table) == ICBTAG_FLAG_AD_SHORT)
                        adsize = sizeof(short_ad);
-               else if (UDF_I_ALLOCTYPE(table) == ICB_FLAG_AD_LONG)
+               else if (UDF_I_ALLOCTYPE(table) == ICBTAG_FLAG_AD_LONG)
                        adsize = sizeof(long_ad);
                else
                {
@@ -576,27 +574,27 @@ static void udf_table_free_blocks(struct super_block * sb,
                                udf_release_data(obh);
                                goto error_return;
                        }
-                       aed = (struct AllocExtDesc *)(nbh->b_data);
+                       aed = (struct allocExtDesc *)(nbh->b_data);
                        aed->previousAllocExtLocation = cpu_to_le32(obloc.logicalBlockNum);
                        if (nextoffset + adsize > sb->s_blocksize)
                        {
                                loffset = nextoffset;
                                aed->lengthAllocDescs = cpu_to_le32(adsize);
                                sptr = (obh)->b_data + nextoffset - adsize;
-                               dptr = nbh->b_data + sizeof(struct AllocExtDesc);
+                               dptr = nbh->b_data + sizeof(struct allocExtDesc);
                                memcpy(dptr, sptr, adsize);
-                               nextoffset = sizeof(struct AllocExtDesc) + adsize;
+                               nextoffset = sizeof(struct allocExtDesc) + adsize;
                        }
                        else
                        {
                                loffset = nextoffset + adsize;
                                aed->lengthAllocDescs = cpu_to_le32(0);
                                sptr = (obh)->b_data + nextoffset;
-                               nextoffset = sizeof(struct AllocExtDesc);
+                               nextoffset = sizeof(struct allocExtDesc);
        
                                if (memcmp(&UDF_I_LOCATION(table), &obloc, sizeof(lb_addr)))
                                {
-                                       aed = (struct AllocExtDesc *)(obh)->b_data;
+                                       aed = (struct allocExtDesc *)(obh)->b_data;
                                        aed->lengthAllocDescs =
                                                cpu_to_le32(le32_to_cpu(aed->lengthAllocDescs) + adsize);
                                }
@@ -607,27 +605,27 @@ static void udf_table_free_blocks(struct super_block * sb,
                                }
                        }
                        if (UDF_SB_UDFREV(sb) >= 0x0200)
-                               udf_new_tag(nbh->b_data, TID_ALLOC_EXTENT_DESC, 3, 1,
+                               udf_new_tag(nbh->b_data, TAG_IDENT_AED, 3, 1,
                                        nbloc.logicalBlockNum, sizeof(tag));
                        else
-                               udf_new_tag(nbh->b_data, TID_ALLOC_EXTENT_DESC, 2, 1,
+                               udf_new_tag(nbh->b_data, TAG_IDENT_AED, 2, 1,
                                        nbloc.logicalBlockNum, sizeof(tag));
                        switch (UDF_I_ALLOCTYPE(table))
                        {
-                               case ICB_FLAG_AD_SHORT:
+                               case ICBTAG_FLAG_AD_SHORT:
                                {
                                        sad = (short_ad *)sptr;
                                        sad->extLength = cpu_to_le32(
-                                               EXTENT_NEXT_EXTENT_ALLOCDECS << 30 |
+                                               EXT_NEXT_EXTENT_ALLOCDECS |
                                                sb->s_blocksize);
                                        sad->extPosition = cpu_to_le32(nbloc.logicalBlockNum);
                                        break;
                                }
-                               case ICB_FLAG_AD_LONG:
+                               case ICBTAG_FLAG_AD_LONG:
                                {
                                        lad = (long_ad *)sptr;
                                        lad->extLength = cpu_to_le32(
-                                               EXTENT_NEXT_EXTENT_ALLOCDECS << 30 |
+                                               EXT_NEXT_EXTENT_ALLOCDECS |
                                                sb->s_blocksize);
                                        lad->extLocation = cpu_to_lelb(nbloc);
                                        break;
@@ -648,7 +646,7 @@ static void udf_table_free_blocks(struct super_block * sb,
                        }
                        else
                        {
-                               aed = (struct AllocExtDesc *)nbh->b_data;
+                               aed = (struct allocExtDesc *)nbh->b_data;
                                aed->lengthAllocDescs =
                                        cpu_to_le32(le32_to_cpu(aed->lengthAllocDescs) + adsize);
                                udf_update_tag(nbh->b_data, nextoffset);
@@ -668,28 +666,28 @@ error_return:
 
 static int udf_table_prealloc_blocks(struct super_block * sb,
        struct inode * inode,
-       struct inode *table, Uint16 partition, Uint32 first_block,
-       Uint32 block_count)
+       struct inode *table, uint16_t partition, uint32_t first_block,
+       uint32_t block_count)
 {
        int alloc_count = 0;
-       Uint32 extoffset, elen, adsize;
+       uint32_t extoffset, elen, adsize;
        lb_addr bloc, eloc;
        struct buffer_head *bh;
-       Sint8 etype = -1;
+       int8_t etype = -1;
 
        if (first_block < 0 || first_block >= UDF_SB_PARTLEN(sb, partition))
                return 0;
 
-       if (UDF_I_ALLOCTYPE(table) == ICB_FLAG_AD_SHORT)
+       if (UDF_I_ALLOCTYPE(table) == ICBTAG_FLAG_AD_SHORT)
                adsize = sizeof(short_ad);
-       else if (UDF_I_ALLOCTYPE(table) == ICB_FLAG_AD_LONG)
+       else if (UDF_I_ALLOCTYPE(table) == ICBTAG_FLAG_AD_LONG)
                adsize = sizeof(long_ad);
        else
                return 0;
 
        lock_super(sb);
 
-       extoffset = sizeof(struct UnallocatedSpaceEntry);
+       extoffset = sizeof(struct unallocSpaceEntry);
        bloc = UDF_I_LOCATION(table);
 
        bh = udf_tread(sb, udf_get_lb_pblock(sb, bloc, 0));
@@ -738,20 +736,20 @@ static int udf_table_prealloc_blocks(struct super_block * sb,
 
 static int udf_table_new_block(struct super_block * sb,
        struct inode * inode,
-       struct inode *table, Uint16 partition, Uint32 goal, int *err)
+       struct inode *table, uint16_t partition, uint32_t goal, int *err)
 {
-       Uint32 spread = 0xFFFFFFFF, nspread;
-       Uint32 newblock = 0, adsize;
-       Uint32 extoffset, goal_extoffset, elen, goal_elen = 0;
+       uint32_t spread = 0xFFFFFFFF, nspread = 0xFFFFFFFF;
+       uint32_t newblock = 0, adsize;
+       uint32_t extoffset, goal_extoffset, elen, goal_elen = 0;
        lb_addr bloc, goal_bloc, eloc, goal_eloc;
        struct buffer_head *bh, *goal_bh;
-       Sint8 etype;
+       int8_t etype;
 
        *err = -ENOSPC;
 
-       if (UDF_I_ALLOCTYPE(table) == ICB_FLAG_AD_SHORT)
+       if (UDF_I_ALLOCTYPE(table) == ICBTAG_FLAG_AD_SHORT)
                adsize = sizeof(short_ad);
-       else if (UDF_I_ALLOCTYPE(table) == ICB_FLAG_AD_LONG)
+       else if (UDF_I_ALLOCTYPE(table) == ICBTAG_FLAG_AD_LONG)
                adsize = sizeof(long_ad);
        else
                return newblock;
@@ -761,12 +759,13 @@ static int udf_table_new_block(struct super_block * sb,
        if (goal < 0 || goal >= UDF_SB_PARTLEN(sb, partition))
                goal = 0;
 
-       /* We search for the closest matching block to goal. If we find a exact hit,       we stop. Otherwise we keep going till we run out of extents.
+       /* We search for the closest matching block to goal. If we find a exact hit,
+          we stop. Otherwise we keep going till we run out of extents.
           We store the buffer_head, bloc, and extoffset of the current closest
           match and use that when we are done.
        */
 
-       extoffset = sizeof(struct UnallocatedSpaceEntry);
+       extoffset = sizeof(struct unallocSpaceEntry);
        bloc = UDF_I_LOCATION(table);
 
        goal_bh = bh = udf_tread(sb, udf_get_lb_pblock(sb, bloc, 0));
@@ -849,9 +848,9 @@ static int udf_table_new_block(struct super_block * sb,
 
 inline void udf_free_blocks(struct super_block * sb,
        struct inode * inode,
-       lb_addr bloc, Uint32 offset, Uint32 count)
+       lb_addr bloc, uint32_t offset, uint32_t count)
 {
-       Uint16 partition = bloc.partitionReferenceNum;
+       uint16_t partition = bloc.partitionReferenceNum;
 
        if (UDF_SB_PARTFLAGS(sb, partition) & UDF_PART_FLAG_UNALLOC_BITMAP)
        {
@@ -883,7 +882,7 @@ inline void udf_free_blocks(struct super_block * sb,
 
 inline int udf_prealloc_blocks(struct super_block * sb,
        struct inode * inode,
-       Uint16 partition, Uint32 first_block, Uint32 block_count)
+       uint16_t partition, uint32_t first_block, uint32_t block_count)
 {
        if (UDF_SB_PARTFLAGS(sb, partition) & UDF_PART_FLAG_UNALLOC_BITMAP)
        {
@@ -915,7 +914,7 @@ inline int udf_prealloc_blocks(struct super_block * sb,
 
 inline int udf_new_block(struct super_block * sb,
        struct inode * inode,
-       Uint16 partition, Uint32 goal, int *err)
+       uint16_t partition, uint32_t goal, int *err)
 {
        if (UDF_SB_PARTFLAGS(sb, partition) & UDF_PART_FLAG_UNALLOC_BITMAP)
        {
index d1fbf1fc69502651a8ce734f304af390953f8370..1dc900e7af31ab8eb5d777d7e95482d0be8d3b13 100644 (file)
@@ -28,7 +28,7 @@
 
 #include "udfdecl.h"
 
-static Uint16 crc_table[256] = {
+static uint16_t crc_table[256] = {
        0x0000U, 0x1021U, 0x2042U, 0x3063U, 0x4084U, 0x50a5U, 0x60c6U, 0x70e7U,
        0x8108U, 0x9129U, 0xa14aU, 0xb16bU, 0xc18cU, 0xd1adU, 0xe1ceU, 0xf1efU,
        0x1231U, 0x0210U, 0x3273U, 0x2252U, 0x52b5U, 0x4294U, 0x72f7U, 0x62d6U,
@@ -84,8 +84,8 @@ static Uint16 crc_table[256] = {
  *     July 21, 1997 - Andrew E. Mileski
  *     Adapted from OSTA-UDF(tm) 1.50 standard.
  */
-extern Uint16
-udf_crc(Uint8 *data, Uint32 size, Uint16 crc)
+extern uint16_t
+udf_crc(uint8_t *data, uint32_t size, uint16_t crc)
 {
        while (size--)
                crc = crc_table[(crc >> 8 ^ *(data++)) & 0xffU] ^ (crc << 8);
index 91a6b64f0d1fc245036ee11b6602f6d7818e39a3..41fa6534c88cff4ef9286c8bc825032fb6dcbf15 100644 (file)
  *             ftp://prep.ai.mit.edu/pub/gnu/GPL
  *     Each contributing author retains all rights to their own work.
  *
- *  (C) 1998-2000 Ben Fennema
+ *  (C) 1998-2001 Ben Fennema
  *
  * HISTORY
  *
  *  10/05/98 dgb  Split directory operations into it's own file
  *                Implemented directory reads via do_udf_readdir
  *  10/06/98      Made directory operations work!
- *  11/17/98      Rewrote directory to support ICB_FLAG_AD_LONG
+ *  11/17/98      Rewrote directory to support ICBTAG_FLAG_AD_LONG
  *  11/25/98 blf  Rewrote directory handling (readdir+lookup) to support reading
  *                across blocks.
  *  12/12/98      Split out the lookup code to namei.c. bulk of directory
 
 #include "udfdecl.h"
 
-#if defined(__linux__) && defined(__KERNEL__)
-#include <linux/version.h>
-#include "udf_i.h"
-#include "udf_sb.h"
 #include <linux/string.h>
 #include <linux/errno.h>
 #include <linux/mm.h>
 #include <linux/slab.h>
-#include <linux/udf_fs.h>
-#endif
+
+#include "udf_i.h"
+#include "udf_sb.h"
 
 /* Prototypes for file operations */
 static int udf_readdir(struct file *, void *, filldir_t);
@@ -102,19 +99,19 @@ static int
 do_udf_readdir(struct inode * dir, struct file *filp, filldir_t filldir, void *dirent)
 {
        struct udf_fileident_bh fibh;
-       struct FileIdentDesc *fi=NULL;
-       struct FileIdentDesc cfi;
+       struct fileIdentDesc *fi=NULL;
+       struct fileIdentDesc cfi;
        int block, iblock;
        loff_t nf_pos = filp->f_pos - 1;
        int flen;
        char fname[255];
        char *nameptr;
-       Uint16 liu;
-       Uint8 lfi;
+       uint16_t liu;
+       uint8_t lfi;
        loff_t size = (udf_ext0_offset(dir) + dir->i_size) >> 2;
        struct buffer_head * bh = NULL, * tmp, * bha[16];
        lb_addr bloc, eloc;
-       Uint32 extoffset, elen, offset;
+       uint32_t extoffset, elen, offset;
        int i, num;
        unsigned int dt_type;
 
@@ -126,15 +123,15 @@ do_udf_readdir(struct inode * dir, struct file *filp, filldir_t filldir, void *d
 
        fibh.soffset = fibh.eoffset = (nf_pos & ((dir->i_sb->s_blocksize - 1) >> 2)) << 2;
        if (inode_bmap(dir, nf_pos >> (dir->i_sb->s_blocksize_bits - 2),
-               &bloc, &extoffset, &eloc, &elen, &offset, &bh) == EXTENT_RECORDED_ALLOCATED)
+               &bloc, &extoffset, &eloc, &elen, &offset, &bh) == (EXT_RECORDED_ALLOCATED >> 30))
        {
                offset >>= dir->i_sb->s_blocksize_bits;
                block = udf_get_lb_pblock(dir->i_sb, eloc, offset);
                if ((++offset << dir->i_sb->s_blocksize_bits) < elen)
                {
-                       if (UDF_I_ALLOCTYPE(dir) == ICB_FLAG_AD_SHORT)
+                       if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_SHORT)
                                extoffset -= sizeof(short_ad);
-                       else if (UDF_I_ALLOCTYPE(dir) == ICB_FLAG_AD_LONG)
+                       else if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_LONG)
                                extoffset -= sizeof(long_ad);
                }
                else
@@ -198,7 +195,7 @@ do_udf_readdir(struct inode * dir, struct file *filp, filldir_t filldir, void *d
                {
                        int poffset;    /* Unpaded ending offset */
 
-                       poffset = fibh.soffset + sizeof(struct FileIdentDesc) + liu + lfi;
+                       poffset = fibh.soffset + sizeof(struct fileIdentDesc) + liu + lfi;
 
                        if (poffset >= lfi)
                                nameptr = (char *)(fibh.ebh->b_data + poffset - lfi);
@@ -210,19 +207,19 @@ do_udf_readdir(struct inode * dir, struct file *filp, filldir_t filldir, void *d
                        }
                }
 
-               if ( (cfi.fileCharacteristics & FILE_DELETED) != 0 )
+               if ( (cfi.fileCharacteristics & FID_FILE_CHAR_DELETED) != 0 )
                {
                        if ( !UDF_QUERY_FLAG(dir->i_sb, UDF_FLAG_UNDELETE) )
                                continue;
                }
                
-               if ( (cfi.fileCharacteristics & FILE_HIDDEN) != 0 )
+               if ( (cfi.fileCharacteristics & FID_FILE_CHAR_HIDDEN) != 0 )
                {
                        if ( !UDF_QUERY_FLAG(dir->i_sb, UDF_FLAG_UNHIDE) )
                                continue;
                }
 
-               if ( cfi.fileCharacteristics & FILE_PARENT )
+               if ( cfi.fileCharacteristics & FID_FILE_CHAR_PARENT )
                {
                        iblock = parent_ino(filp->f_dentry);
                        flen = 2;
index 97ebc7e6d9600765dec0c280d48fe81086c85742..b17105c947cfb06fdf5da0cc63dbb50025c082bd 100644 (file)
 
 #include "udfdecl.h"
 
-#if defined(__linux__) && defined(__KERNEL__)
-
 #include <linux/fs.h>
 #include <linux/string.h>
-#include <linux/udf_fs.h>
-
-#else
-
-#include <sys/types.h>
-#include <stdio.h>
-#include <unistd.h>
-
-#endif
-
-#ifdef __KERNEL__
 
-Uint8 * udf_filead_read(struct inode *dir, Uint8 *tmpad, Uint8 ad_size,
+uint8_t * udf_filead_read(struct inode *dir, uint8_t *tmpad, uint8_t ad_size,
        lb_addr fe_loc, int *pos, int *offset, struct buffer_head **bh, int *error)
 {
        int loffset = *offset;
        int block;
-       Uint8 *ad;
+       uint8_t *ad;
        int remainder;
 
        *error = 0;
 
-       ad = (Uint8 *)(*bh)->b_data + *offset;
+       ad = (uint8_t *)(*bh)->b_data + *offset;
        *offset += ad_size;
 
        if (!ad)
@@ -68,7 +55,7 @@ Uint8 * udf_filead_read(struct inode *dir, Uint8 *tmpad, Uint8 ad_size,
                ad = tmpad;
 
                remainder = dir->i_sb->s_blocksize - loffset;
-               memcpy((Uint8 *)ad, (*bh)->b_data + loffset, remainder);
+               memcpy((uint8_t *)ad, (*bh)->b_data + loffset, remainder);
 
                udf_release_data(*bh);
                block = udf_get_lb_pblock(dir->i_sb, fe_loc, ++*pos);
@@ -77,21 +64,21 @@ Uint8 * udf_filead_read(struct inode *dir, Uint8 *tmpad, Uint8 ad_size,
                if (!((*bh) = udf_tread(dir->i_sb, block)))
                        return NULL;
 
-               memcpy((Uint8 *)ad + remainder, (*bh)->b_data, ad_size - remainder);
+               memcpy((uint8_t *)ad + remainder, (*bh)->b_data, ad_size - remainder);
                *offset = ad_size - remainder;
        }
        return ad;
 }
 
-struct FileIdentDesc *
+struct fileIdentDesc *
 udf_fileident_read(struct inode *dir, loff_t *nf_pos,
        struct udf_fileident_bh *fibh,
-       struct FileIdentDesc *cfi,
-       lb_addr *bloc, Uint32 *extoffset, 
-       lb_addr *eloc, Uint32 *elen,
-       Uint32 *offset, struct buffer_head **bh)
+       struct fileIdentDesc *cfi,
+       lb_addr *bloc, uint32_t *extoffset, 
+       lb_addr *eloc, uint32_t *elen,
+       uint32_t *offset, struct buffer_head **bh)
 {
-       struct FileIdentDesc *fi;
+       struct fileIdentDesc *fi;
        int i, num, block;
        struct buffer_head * tmp, * bha[16];
 
@@ -102,7 +89,7 @@ udf_fileident_read(struct inode *dir, loff_t *nf_pos,
                int lextoffset = *extoffset;
 
                if (udf_next_aext(dir, bloc, extoffset, eloc, elen, bh, 1) !=
-                       EXTENT_RECORDED_ALLOCATED)
+                       (EXT_RECORDED_ALLOCATED >> 30))
                {
                        return NULL;
                }
@@ -159,14 +146,14 @@ udf_fileident_read(struct inode *dir, loff_t *nf_pos,
 
        if (fibh->eoffset <= dir->i_sb->s_blocksize)
        {
-               memcpy((Uint8 *)cfi, (Uint8 *)fi, sizeof(struct FileIdentDesc));
+               memcpy((uint8_t *)cfi, (uint8_t *)fi, sizeof(struct fileIdentDesc));
        }
        else if (fibh->eoffset > dir->i_sb->s_blocksize)
        {
                int lextoffset = *extoffset;
 
                if (udf_next_aext(dir, bloc, extoffset, eloc, elen, bh, 1) !=
-                       EXTENT_RECORDED_ALLOCATED)
+                       (EXT_RECORDED_ALLOCATED >> 30))
                {
                        return NULL;
                }
@@ -186,15 +173,15 @@ udf_fileident_read(struct inode *dir, loff_t *nf_pos,
                if (!(fibh->ebh = udf_tread(dir->i_sb, block)))
                        return NULL;
 
-               if (sizeof(struct FileIdentDesc) > - fibh->soffset)
+               if (sizeof(struct fileIdentDesc) > - fibh->soffset)
                {
                        int fi_len;
 
-                       memcpy((Uint8 *)cfi, (Uint8 *)fi, - fibh->soffset);
-                       memcpy((Uint8 *)cfi - fibh->soffset, fibh->ebh->b_data,
-                               sizeof(struct FileIdentDesc) + fibh->soffset);
+                       memcpy((uint8_t *)cfi, (uint8_t *)fi, - fibh->soffset);
+                       memcpy((uint8_t *)cfi - fibh->soffset, fibh->ebh->b_data,
+                               sizeof(struct fileIdentDesc) + fibh->soffset);
 
-                       fi_len = (sizeof(struct FileIdentDesc) + cfi->lengthFileIdent +
+                       fi_len = (sizeof(struct fileIdentDesc) + cfi->lengthFileIdent +
                                le16_to_cpu(cfi->lengthOfImpUse) + 3) & ~3;
 
                        *nf_pos += ((fi_len - (fibh->eoffset - fibh->soffset)) >> 2);
@@ -202,25 +189,22 @@ udf_fileident_read(struct inode *dir, loff_t *nf_pos,
                }
                else
                {
-                       memcpy((Uint8 *)cfi, (Uint8 *)fi, sizeof(struct FileIdentDesc));
+                       memcpy((uint8_t *)cfi, (uint8_t *)fi, sizeof(struct fileIdentDesc));
                }
        }
        return fi;
 }
-#endif
 
-struct FileIdentDesc * 
+struct fileIdentDesc * 
 udf_get_fileident(void * buffer, int bufsize, int * offset)
 {
-       struct FileIdentDesc *fi;
+       struct fileIdentDesc *fi;
        int lengthThisIdent;
-       Uint8 * ptr;
+       uint8_t * ptr;
        int padlen;
 
        if ( (!buffer) || (!offset) ) {
-#ifdef __KERNEL__
                udf_debug("invalidparms\n, buffer=%p, offset=%p\n", buffer, offset);
-#endif
                return NULL;
        }
 
@@ -229,23 +213,21 @@ udf_get_fileident(void * buffer, int bufsize, int * offset)
        if ( (*offset > 0) && (*offset < bufsize) ) {
                ptr += *offset;
        }
-       fi=(struct FileIdentDesc *)ptr;
-       if (le16_to_cpu(fi->descTag.tagIdent) != TID_FILE_IDENT_DESC)
+       fi=(struct fileIdentDesc *)ptr;
+       if (le16_to_cpu(fi->descTag.tagIdent) != TAG_IDENT_FID)
        {
-#ifdef __KERNEL__
-               udf_debug("0x%x != TID_FILE_IDENT_DESC\n",
+               udf_debug("0x%x != TAG_IDENT_FID\n",
                        le16_to_cpu(fi->descTag.tagIdent));
                udf_debug("offset: %u sizeof: %lu bufsize: %u\n",
-                       *offset, (unsigned long)sizeof(struct FileIdentDesc), bufsize);
-#endif
+                       *offset, (unsigned long)sizeof(struct fileIdentDesc), bufsize);
                return NULL;
        }
-       if ( (*offset + sizeof(struct FileIdentDesc)) > bufsize )
+       if ( (*offset + sizeof(struct fileIdentDesc)) > bufsize )
        {
-               lengthThisIdent = sizeof(struct FileIdentDesc);
+               lengthThisIdent = sizeof(struct fileIdentDesc);
        }
        else
-               lengthThisIdent = sizeof(struct FileIdentDesc) +
+               lengthThisIdent = sizeof(struct fileIdentDesc) +
                        fi->lengthFileIdent + le16_to_cpu(fi->lengthOfImpUse);
 
        /* we need to figure padding, too! */
@@ -261,29 +243,25 @@ extent_ad *
 udf_get_fileextent(void * buffer, int bufsize, int * offset)
 {
        extent_ad * ext;
-       struct FileEntry *fe;
-       Uint8 * ptr;
+       struct fileEntry *fe;
+       uint8_t * ptr;
 
        if ( (!buffer) || (!offset) )
        {
-#ifdef __KERNEL__
                printk(KERN_ERR "udf: udf_get_fileextent() invalidparms\n");
-#endif
                return NULL;
        }
 
-       fe = (struct FileEntry *)buffer;
+       fe = (struct fileEntry *)buffer;
 
-       if ( le16_to_cpu(fe->descTag.tagIdent) != TID_FILE_ENTRY )
+       if ( le16_to_cpu(fe->descTag.tagIdent) != TAG_IDENT_FE )
        {
-#ifdef __KERNEL__
-               udf_debug("0x%x != TID_FILE_ENTRY\n",
+               udf_debug("0x%x != TAG_IDENT_FE\n",
                        le16_to_cpu(fe->descTag.tagIdent));
-#endif
                return NULL;
        }
 
-       ptr=(Uint8 *)(fe->extendedAttr) + le32_to_cpu(fe->lengthExtendedAttr);
+       ptr=(uint8_t *)(fe->extendedAttr) + le32_to_cpu(fe->lengthExtendedAttr);
 
        if ( (*offset > 0) && (*offset < le32_to_cpu(fe->lengthAllocDescs)) )
        {
@@ -300,17 +278,15 @@ short_ad *
 udf_get_fileshortad(void * buffer, int maxoffset, int *offset, int inc)
 {
        short_ad * sa;
-       Uint8 * ptr;
+       uint8_t * ptr;
 
        if ( (!buffer) || (!offset) )
        {
-#ifdef __KERNEL__
                printk(KERN_ERR "udf: udf_get_fileshortad() invalidparms\n");
-#endif
                return NULL;
        }
 
-       ptr = (Uint8 *)buffer;
+       ptr = (uint8_t *)buffer;
 
        if ( (*offset > 0) && (*offset < maxoffset) )
                ptr += *offset;
@@ -328,17 +304,15 @@ long_ad *
 udf_get_filelongad(void * buffer, int maxoffset, int * offset, int inc)
 {
        long_ad * la;
-       Uint8 * ptr;
+       uint8_t * ptr;
 
        if ( (!buffer) || !(offset) ) 
        {
-#ifdef __KERNEL__
                printk(KERN_ERR "udf: udf_get_filelongad() invalidparms\n");
-#endif
                return NULL;
        }
 
-       ptr = (Uint8 *)buffer;
+       ptr = (uint8_t *)buffer;
 
        if ( (*offset > 0) && (*offset < maxoffset) )
                ptr += *offset;
diff --git a/fs/udf/ecma_167.h b/fs/udf/ecma_167.h
new file mode 100644 (file)
index 0000000..6e42f6f
--- /dev/null
@@ -0,0 +1,822 @@
+/*
+ * ecma_167.h
+ *
+ * This file is based on ECMA-167 3rd edition (June 1997)
+ * http://www.ecma.ch
+ *
+ * Copyright (c) 2001-2002  Ben Fennema <bfennema@falcon.csc.calpoly.edu>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU Public License ("GPL").
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <linux/types.h>
+
+#ifndef _ECMA_167_H
+#define _ECMA_167_H 1
+
+/* Character set specification (ECMA 167r3 1/7.2.1) */
+typedef struct
+{
+       uint8_t         charSetType;
+       uint8_t         charSetInfo[63];
+} __attribute__ ((packed)) charspec;
+
+/* Character Set Type (ECMA 167r3 1/7.2.1.1) */
+#define CHARSPEC_TYPE_CS0              0x00    /* (1/7.2.2) */
+#define CHARSPEC_TYPE_CS1              0x01    /* (1/7.2.3) */
+#define CHARSPEC_TYPE_CS2              0x02    /* (1/7.2.4) */
+#define CHARSPEC_TYPE_CS3              0x03    /* (1/7.2.5) */
+#define CHARSPEC_TYPE_CS4              0x04    /* (1/7.2.6) */
+#define CHARSPEC_TYPE_CS5              0x05    /* (1/7.2.7) */
+#define CHARSPEC_TYPE_CS6              0x06    /* (1/7.2.8) */
+#define CHARSPEC_TYPE_CS7              0x07    /* (1/7.2.9) */
+#define CHARSPEC_TYPE_CS8              0x08    /* (1/7.2.10) */
+
+typedef uint8_t                dstring;
+
+/* Timestamp (ECMA 167r3 1/7.3) */
+typedef struct
+{
+       uint16_t        typeAndTimezone;
+       int16_t         year;
+       uint8_t         month;
+       uint8_t         day;
+       uint8_t         hour;
+       uint8_t         minute;
+       uint8_t         second;
+       uint8_t         centiseconds;
+       uint8_t         hundredsOfMicroseconds;
+       uint8_t         microseconds;
+} __attribute__ ((packed)) timestamp;
+
+/* Type and Time Zone (ECMA 167r3 1/7.3.1) */
+#define TIMESTAMP_TYPE_MASK            0xF000
+#define TIMESTAMP_TYPE_CUT             0x0000
+#define TIMESTAMP_TYPE_LOCAL           0x1000
+#define TIMESTAMP_TYPE_AGREEMENT       0x2000
+#define TIMESTAMP_TIMEZONE_MASK                0x0FFF
+
+/* Entity identifier (ECMA 167r3 1/7.4) */
+typedef struct
+{
+       uint8_t         flags;
+       uint8_t         ident[23];
+       uint8_t         identSuffix[8];
+} __attribute__ ((packed)) regid;
+
+/* Flags (ECMA 167r3 1/7.4.1) */
+#define ENTITYID_FLAGS_DIRTY           0x00
+#define ENTITYID_FLAGS_PROTECTED       0x01
+
+/* Volume Structure Descriptor (ECMA 167r3 2/9.1) */
+#define VSD_STD_ID_LEN                 5
+struct volStructDesc
+{
+       uint8_t         structType;
+       uint8_t         stdIdent[VSD_STD_ID_LEN];
+       uint8_t         structVersion;
+       uint8_t         structData[2041];
+} __attribute__ ((packed));
+
+/* Standard Identifier (EMCA 167r2 2/9.1.2) */
+#define VSD_STD_ID_NSR02               "NSR02" /* (3/9.1) */
+
+/* Standard Identifier (ECMA 167r3 2/9.1.2) */
+#define VSD_STD_ID_BEA01               "BEA01" /* (2/9.2) */
+#define VSD_STD_ID_BOOT2               "BOOT2" /* (2/9.4) */
+#define VSD_STD_ID_CD001               "CD001" /* (ECMA-119) */
+#define VSD_STD_ID_CDW02               "CDW02" /* (ECMA-168) */
+#define VSD_STD_ID_NSR03               "NSR03" /* (3/9.1) */
+#define VSD_STD_ID_TEA01               "TEA01" /* (2/9.3) */
+
+/* Beginning Extended Area Descriptor (ECMA 167r3 2/9.2) */
+struct beginningExtendedAreaDesc
+{
+       uint8_t         structType;
+       uint8_t         stdIdent[VSD_STD_ID_LEN];
+       uint8_t         structVersion;
+       uint8_t         structData[2041];
+} __attribute__ ((packed));
+
+/* Terminating Extended Area Descriptor (ECMA 167r3 2/9.3) */
+struct terminatingExtendedAreaDesc
+{
+       uint8_t         structType;
+       uint8_t         stdIdent[VSD_STD_ID_LEN];
+       uint8_t         structVersion;
+       uint8_t         structData[2041];
+} __attribute__ ((packed));
+
+/* Boot Descriptor (ECMA 167r3 2/9.4) */
+struct bootDesc
+{
+       uint8_t         structType;
+       uint8_t         stdIdent[VSD_STD_ID_LEN];
+       uint8_t         structVersion;
+       uint8_t         reserved1;
+       regid           archType;
+       regid           bootIdent;
+       uint32_t        bootExtLocation;
+       uint32_t        bootExtLength;
+       uint64_t        loadAddress;
+       uint64_t        startAddress;
+       timestamp       descCreationDateAndTime;
+       uint16_t        flags;
+       uint8_t         reserved2[32];
+       uint8_t         bootUse[1906];
+} __attribute__ ((packed));
+
+/* Flags (ECMA 167r3 2/9.4.12) */
+#define BOOT_FLAGS_ERASE               0x01
+
+/* Extent Descriptor (ECMA 167r3 3/7.1) */
+typedef struct
+{
+       uint32_t        extLength;
+       uint32_t        extLocation;
+} __attribute__ ((packed)) extent_ad;
+
+/* Descriptor Tag (ECMA 167r3 3/7.2) */
+typedef struct
+{
+       uint16_t        tagIdent;
+       uint16_t        descVersion;
+       uint8_t         tagChecksum;
+       uint8_t         reserved;
+       uint16_t        tagSerialNum;
+       uint16_t        descCRC;
+       uint16_t        descCRCLength;
+       uint32_t        tagLocation;
+} __attribute__ ((packed)) tag;
+
+/* Tag Identifier (ECMA 167r3 3/7.2.1) */
+#define TAG_IDENT_PVD                  0x0001
+#define TAG_IDENT_AVDP                 0x0002
+#define TAG_IDENT_VDP                  0x0003
+#define TAG_IDENT_IUVD                 0x0004
+#define TAG_IDENT_PD                   0x0005
+#define TAG_IDENT_LVD                  0x0006
+#define TAG_IDENT_USD                  0x0007
+#define TAG_IDENT_TD                   0x0008
+#define TAG_IDENT_LVID                 0x0009
+
+/* NSR Descriptor (ECMA 167r3 3/9.1) */
+struct NSRDesc
+{
+       uint8_t         structType;
+       uint8_t         stdIdent[VSD_STD_ID_LEN];
+       uint8_t         structVersion;
+       uint8_t         reserved;
+       uint8_t         structData[2040];
+} __attribute__ ((packed));
+       
+/* Primary Volume Descriptor (ECMA 167r3 3/10.1) */
+struct primaryVolDesc
+{
+       tag             descTag;
+       uint32_t        volDescSeqNum;
+       uint32_t        primaryVolDescNum;
+       dstring         volIdent[32];
+       uint16_t        volSeqNum;
+       uint16_t        maxVolSeqNum;
+       uint16_t        interchangeLvl;
+       uint16_t        maxInterchangeLvl;
+       uint32_t        charSetList;
+       uint32_t        maxCharSetList;
+       dstring         volSetIdent[128];
+       charspec        descCharSet;
+       charspec        explanatoryCharSet;
+       extent_ad       volAbstract;
+       extent_ad       volCopyright;
+       regid           appIdent;
+       timestamp       recordingDateAndTime;
+       regid           impIdent;
+       uint8_t         impUse[64];
+       uint32_t        predecessorVolDescSeqLocation;
+       uint16_t        flags;
+       uint8_t         reserved[22];
+} __attribute__ ((packed));
+
+/* Flags (ECMA 167r3 3/10.1.21) */
+#define PVD_FLAGS_VSID_COMMON          0x0001
+
+/* Anchor Volume Descriptor Pointer (ECMA 167r3 3/10.2) */
+struct anchorVolDescPtr
+{
+       tag             descTag;
+       extent_ad       mainVolDescSeqExt;
+       extent_ad       reserveVolDescSeqExt;
+       uint8_t         reserved[480];
+} __attribute__ ((packed));
+
+/* Volume Descriptor Pointer (ECMA 167r3 3/10.3) */
+struct volDescPtr
+{
+       tag             descTag;
+       uint32_t        volDescSeqNum;
+       extent_ad       nextVolDescSeqExt;
+       uint8_t         reserved[484];
+} __attribute__ ((packed));
+
+/* Implementation Use Volume Descriptor (ECMA 167r3 3/10.4) */
+struct impUseVolDesc
+{
+       tag             descTag;
+       uint32_t        volDescSeqNum;
+       regid           impIdent;
+       uint8_t         impUse[460];
+} __attribute__ ((packed));
+
+/* Partition Descriptor (ECMA 167r3 3/10.5) */
+struct partitionDesc
+{
+       tag             descTag;
+       uint32_t        volDescSeqNum;
+       uint16_t        partitionFlags;
+       uint16_t        partitionNumber;
+       regid           partitionContents;
+       uint8_t         partitionContentsUse[128];
+       uint32_t        accessType;
+       uint32_t        partitionStartingLocation;
+       uint32_t        partitionLength;
+       regid           impIdent;
+       uint8_t         impUse[128];
+       uint8_t         reserved[156];
+} __attribute__ ((packed));
+
+/* Partition Flags (ECMA 167r3 3/10.5.3) */
+#define PD_PARTITION_FLAGS_ALLOC       0x0001
+
+/* Partition Contents (ECMA 167r2 3/10.5.3) */
+#define PD_PARTITION_CONTENTS_NSR02    "+NSR02"
+
+/* Partition Contents (ECMA 167r3 3/10.5.5) */
+#define PD_PARTITION_CONTENTS_FDC01    "+FDC01"
+#define PD_PARTITION_CONTENTS_CD001    "+CD001"
+#define PD_PARTITION_CONTENTS_CDW02    "+CDW02"
+#define PD_PARTITION_CONTENTS_NSR03    "+NSR03"
+
+/* Access Type (ECMA 167r3 3/10.5.7) */
+#define PD_ACCESS_TYPE_NONE            0x00000000
+#define PD_ACCESS_TYPE_READ_ONLY       0x00000001
+#define PD_ACCESS_TYPE_WRITE_ONCE      0x00000002
+#define PD_ACCESS_TYPE_REWRITABLE      0x00000003
+#define PD_ACCESS_TYPE_OVERWRITABLE    0x00000004
+
+/* Logical Volume Descriptor (ECMA 167r3 3/10.6) */
+struct logicalVolDesc
+{
+       tag             descTag;
+       uint32_t        volDescSeqNum;
+       charspec        descCharSet;
+       dstring         logicalVolIdent[128];
+       uint32_t        logicalBlockSize;
+       regid           domainIdent;
+       uint8_t         logicalVolContentsUse[16];
+       uint32_t        mapTableLength;
+       uint32_t        numPartitionMaps;
+       regid           impIdent;
+       uint8_t         impUse[128];
+       extent_ad       integritySeqExt;
+       uint8_t         partitionMaps[0];
+} __attribute__ ((packed));
+
+/* Generic Partition Map (ECMA 167r3 3/10.7.1) */
+struct genericPartitionMap
+{
+       uint8_t         partitionMapType;
+       uint8_t         partitionMapLength;
+       uint8_t         partitionMapping[0];
+} __attribute__ ((packed));
+
+/* Partition Map Type (ECMA 167r3 3/10.7.1.1) */
+#define GP_PARTITION_MAP_TYPE_UNDEF    0x00
+#define GP_PARTIITON_MAP_TYPE_1                0x01
+#define GP_PARTITION_MAP_TYPE_2                0x02
+
+/* Type 1 Partition Map (ECMA 167r3 3/10.7.2) */
+struct genericPartitionMap1
+{
+       uint8_t         partitionMapType;
+       uint8_t         partitionMapLength;
+       uint16_t        volSeqNum;
+       uint16_t        partitionNum;
+} __attribute__ ((packed));
+
+/* Type 2 Partition Map (ECMA 167r3 3/10.7.3) */
+struct genericPartitionMap2
+{
+       uint8_t         partitionMapType;
+       uint8_t         partitionMapLength; 
+       uint8_t         partitionIdent[62];
+} __attribute__ ((packed));
+
+/* Unallocated Space Descriptor (ECMA 167r3 3/10.8) */
+struct unallocSpaceDesc
+{
+       tag             descTag;
+       uint32_t        volDescSeqNum;
+       uint32_t        numAllocDescs;
+       extent_ad       allocDescs[0];
+} __attribute__ ((packed));
+
+/* Terminating Descriptor (ECMA 167r3 3/10.9) */
+struct terminatingDesc
+{
+       tag             descTag;
+       uint8_t         reserved[496];
+} __attribute__ ((packed));
+
+/* Logical Volume Integrity Descriptor (ECMA 167r3 3/10.10) */
+struct logicalVolIntegrityDesc
+{
+       tag             descTag;
+       timestamp       recordingDateAndTime;
+       uint32_t        integrityType;
+       extent_ad       nextIntegrityExt;
+       uint8_t         logicalVolContentsUse[32];
+       uint32_t        numOfPartitions;
+       uint32_t        lengthOfImpUse;
+       uint32_t        freeSpaceTable[0];
+       uint32_t        sizeTable[0];
+       uint8_t         impUse[0];
+} __attribute__ ((packed));
+
+/* Integrity Type (ECMA 167r3 3/10.10.3) */
+#define LVID_INTEGRITY_TYPE_OPEN       0x00000000
+#define LVID_INTEGRITY_TYPE_CLOSE      0x00000001
+
+/* Recorded Address (ECMA 167r3 4/7.1) */
+typedef struct 
+{
+       uint32_t        logicalBlockNum;
+       uint16_t        partitionReferenceNum;
+} __attribute__ ((packed)) lb_addr;
+
+/* Short Allocation Descriptor (ECMA 167r3 4/14.14.1) */
+typedef struct
+{
+        uint32_t       extLength;
+        uint32_t       extPosition;
+} __attribute__ ((packed)) short_ad;
+
+/* Long Allocation Descriptor (ECMA 167r3 4/14.14.2) */
+typedef struct
+{
+       uint32_t        extLength;
+       lb_addr         extLocation;
+       uint8_t         impUse[6];
+} __attribute__ ((packed)) long_ad;
+
+/* Extended Allocation Descriptor (ECMA 167r3 4/14.14.3) */
+typedef struct
+{
+       uint32_t        extLength;
+       uint32_t        recordedLength;
+       uint32_t        informationLength;
+       lb_addr         extLocation;
+} __attribute__ ((packed)) ext_ad;
+
+/* Descriptor Tag (ECMA 167r3 4/7.2 - See 3/7.2) */
+
+/* Tag Identifier (ECMA 167r3 4/7.2.1) */
+#define TAG_IDENT_FSD                  0x0100
+#define TAG_IDENT_FID                  0x0101
+#define TAG_IDENT_AED                  0x0102
+#define TAG_IDENT_IE                   0x0103
+#define TAG_IDENT_TE                   0x0104
+#define TAG_IDENT_FE                   0x0105
+#define TAG_IDENT_EAHD                 0x0106
+#define TAG_IDENT_USE                  0x0107
+#define TAG_IDENT_SBD                  0x0108
+#define TAG_IDENT_PIE                  0x0109
+#define TAG_IDENT_EFE                  0x010A
+
+/* File Set Descriptor (ECMA 167r3 4/14.1) */
+struct fileSetDesc
+{
+       tag             descTag;
+       timestamp       recordingDateAndTime;
+       uint16_t        interchangeLvl;
+       uint16_t        maxInterchangeLvl;
+       uint32_t        charSetList;
+       uint32_t        maxCharSetList;
+       uint32_t        fileSetNum;
+       uint32_t        fileSetDescNum;
+       charspec        logicalVolIdentCharSet;
+       dstring         logicalVolIdent[128];
+       charspec        fileSetCharSet;
+       dstring         fileSetIdent[32];
+       dstring         copyrightFileIdent[32];
+       dstring         abstractFileIdent[32];
+       long_ad         rootDirectoryICB;
+       regid           domainIdent;
+       long_ad         nextExt;
+       long_ad         streamDirectoryICB;
+       uint8_t         reserved[32];
+} __attribute__ ((packed));
+
+/* Partition Header Descriptor (ECMA 167r3 4/14.3) */
+struct partitionHeaderDesc
+{
+       short_ad        unallocSpaceTable;
+       short_ad        unallocSpaceBitmap;
+       short_ad        partitionIntegrityTable;
+       short_ad        freedSpaceTable;
+       short_ad        freedSpaceBitmap;
+       uint8_t         reserved[88];
+} __attribute__ ((packed));
+
+/* File Identifier Descriptor (ECMA 167r3 4/14.4) */
+struct fileIdentDesc
+{
+       tag             descTag;
+       uint16_t        fileVersionNum;
+       uint8_t         fileCharacteristics;
+       uint8_t         lengthFileIdent;
+       long_ad         icb;
+       uint16_t        lengthOfImpUse;
+       uint8_t         impUse[0];
+       uint8_t         fileIdent[0];
+       uint8_t         padding[0];
+} __attribute__ ((packed));
+
+/* File Characteristics (ECMA 167r3 4/14.4.3) */
+#define FID_FILE_CHAR_HIDDEN           0x01
+#define FID_FILE_CHAR_DIRECTORY                0x02
+#define FID_FILE_CHAR_DELETED          0x04
+#define FID_FILE_CHAR_PARENT           0x08
+#define FID_FILE_CHAR_METADATA         0x10
+
+/* Allocation Ext Descriptor (ECMA 167r3 4/14.5) */
+struct allocExtDesc
+{
+       tag             descTag;
+       uint32_t        previousAllocExtLocation;
+       uint32_t        lengthAllocDescs;
+} __attribute__ ((packed));
+
+/* ICB Tag (ECMA 167r3 4/14.6) */
+typedef struct
+{
+       uint32_t        priorRecordedNumDirectEntries;
+       uint16_t        strategyType;
+       uint16_t        strategyParameter;
+       uint16_t        numEntries;
+       uint8_t         reserved;
+       uint8_t         fileType;
+       lb_addr         parentICBLocation;
+       uint16_t        flags;
+} __attribute__ ((packed)) icbtag;
+
+/* Strategy Type (ECMA 167r3 4/14.6.2) */
+#define ICBTAG_STRATEGY_TYPE_UNDEF     0x0000
+#define ICBTAG_STRATEGY_TYPE_1         0x0001
+#define ICBTAG_STRATEGY_TYPE_2         0x0002
+#define ICBTAG_STRATEGY_TYPE_3         0x0003
+#define ICBTAG_STRATEGY_TYPE_4         0x0004
+
+/* File Type (ECMA 167r3 4/14.6.6) */
+#define ICBTAG_FILE_TYPE_UNDEF         0x00
+#define ICBTAG_FILE_TYPE_USE           0x01
+#define ICBTAG_FILE_TYPE_PIE           0x02
+#define ICBTAG_FILE_TYPE_IE            0x03
+#define ICBTAG_FILE_TYPE_DIRECTORY     0x04
+#define ICBTAG_FILE_TYPE_REGULAR       0x05
+#define ICBTAG_FILE_TYPE_BLOCK         0x06
+#define ICBTAG_FILE_TYPE_CHAR          0x07
+#define ICBTAG_FILE_TYPE_EA            0x08
+#define ICBTAG_FILE_TYPE_FIFO          0x09
+#define ICBTAG_FILE_TYPE_SOCKET                0x0A
+#define ICBTAG_FILE_TYPE_TE            0x0B
+#define ICBTAG_FILE_TYPE_SYMLINK       0x0C
+#define ICBTAG_FILE_TYPE_STREAMDIR     0x0D
+
+/* Flags (ECMA 167r3 4/14.6.8) */
+#define ICBTAG_FLAG_AD_MASK            0x0007
+#define ICBTAG_FLAG_AD_SHORT           0x0000
+#define ICBTAG_FLAG_AD_LONG            0x0001
+#define ICBTAG_FLAG_AD_EXTENDED                0x0002
+#define ICBTAG_FLAG_AD_IN_ICB          0x0003
+#define ICBTAG_FLAG_SORTED             0x0008
+#define ICBTAG_FLAG_NONRELOCATABLE     0x0010
+#define ICBTAG_FLAG_ARCHIVE            0x0020
+#define ICBTAG_FLAG_SETUID             0x0040
+#define ICBTAG_FLAG_SETGID             0x0080
+#define ICBTAG_FLAG_STICKY             0x0100
+#define ICBTAG_FLAG_CONTIGUOUS         0x0200
+#define ICBTAG_FLAG_SYSTEM             0x0400
+#define ICBTAG_FLAG_TRANSFORMED                0x0800
+#define ICBTAG_FLAG_MULTIVERSIONS      0x1000
+#define ICBTAG_FLAG_STREAM             0x2000
+
+/* Indirect Entry (ECMA 167r3 4/14.7) */
+struct indirectEntry
+{
+       tag             descTag;
+       icbtag          icbTag;
+       long_ad         indirectICB;
+} __attribute__ ((packed));
+
+/* Terminal Entry (ECMA 167r3 4/14.8) */
+struct terminalEntry
+{
+       tag             descTag;
+       icbtag          icbTag;
+} __attribute__ ((packed));
+
+/* File Entry (ECMA 167r3 4/14.9) */
+struct fileEntry
+{
+       tag             descTag;
+       icbtag          icbTag;
+       uint32_t        uid;
+       uint32_t        gid;
+       uint32_t        permissions;
+       uint16_t        fileLinkCount;
+       uint8_t         recordFormat;
+       uint8_t         recordDisplayAttr;
+       uint32_t        recordLength;
+       uint64_t        informationLength;
+       uint64_t        logicalBlocksRecorded;
+       timestamp       accessTime;
+       timestamp       modificationTime;
+       timestamp       attrTime;
+       uint32_t        checkpoint;
+       long_ad         extendedAttrICB;
+       regid           impIdent;
+       uint64_t        uniqueID;
+       uint32_t        lengthExtendedAttr;
+       uint32_t        lengthAllocDescs;
+       uint8_t         extendedAttr[0];
+       uint8_t         allocDescs[0];
+} __attribute__ ((packed));
+
+/* Permissions (ECMA 167r3 4/14.9.5) */
+#define FE_PERM_O_EXEC                 0x00000001U
+#define FE_PERM_O_WRITE                        0x00000002U
+#define FE_PERM_O_READ                 0x00000004U
+#define FE_PERM_O_CHATTR               0x00000008U
+#define FE_PERM_O_DELETE               0x00000010U
+#define FE_PERM_G_EXEC                 0x00000020U
+#define FE_PERM_G_WRITE                        0x00000040U
+#define FE_PERM_G_READ                 0x00000080U
+#define FE_PERM_G_CHATTR               0x00000100U
+#define FE_PERM_G_DELETE               0x00000200U
+#define FE_PERM_U_EXEC                 0x00000400U
+#define FE_PERM_U_WRITE                        0x00000800U
+#define FE_PERM_U_READ                 0x00001000U
+#define FE_PERM_U_CHATTR               0x00002000U
+#define FE_PERM_U_DELETE               0x00004000U
+
+/* Record Format (ECMA 167r3 4/14.9.7) */
+#define FE_RECORD_FMT_UNDEF            0x00
+#define FE_RECORD_FMT_FIXED_PAD                0x01
+#define FE_RECORD_FMT_FIXED            0x02
+#define FE_RECORD_FMT_VARIABLE8                0x03
+#define FE_RECORD_FMT_VARIABLE16       0x04
+#define FE_RECORD_FMT_VARIABLE16_MSB   0x05
+#define FE_RECORD_FMT_VARIABLE32       0x06
+#define FE_RECORD_FMT_PRINT            0x07
+#define FE_RECORD_FMT_LF               0x08
+#define FE_RECORD_FMT_CR               0x09
+#define FE_RECORD_FMT_CRLF             0x0A
+#define FE_RECORD_FMT_LFCR             0x0B
+
+#define Record Display Attributes (ECMA 167r3 4/14.9.8) */
+#define FE_RECORD_DISPLAY_ATTR_UNDEF   0x00
+#define FE_RECORD_DISPLAY_ATTR_1       0x01
+#define FE_RECORD_DISPLAY_ATTR_2       0x02
+#define FE_RECORD_DISPLAY_ATTR_3       0x03
+
+/* Extended Attribute Header Descriptor (ECMA 167r3 4/14.10.1) */
+struct extendedAttrHeaderDesc
+{
+       tag             descTag;
+       uint32_t        impAttrLocation;
+       uint32_t        appAttrLocation;
+} __attribute__ ((packed));
+
+/* Generic Format (ECMA 167r3 4/14.10.2) */
+struct genericFormat
+{
+       uint32_t        attrType;
+       uint8_t         attrSubtype;
+       uint8_t         reserved[3];
+       uint32_t        attrLength;
+       uint8_t         attrData[0];
+} __attribute__ ((packed));
+
+/* Character Set Information (ECMA 167r3 4/14.10.3) */
+struct charSetInfo
+{
+       uint32_t        attrType;
+       uint8_t         attrSubtype;
+       uint8_t         reserved[3];
+       uint32_t        attrLength;
+       uint32_t        escapeSeqLength;
+       uint8_t         charSetType;
+       uint8_t         escapeSeq[0];
+} __attribute__ ((packed));
+
+/* Alternate Permissions (ECMA 167r3 4/14.10.4) */
+struct altPerms
+{
+       uint32_t        attrType;
+       uint8_t         attrSubtype;
+       uint8_t         reserved[3];
+       uint32_t        attrLength;
+       uint16_t        ownerIdent;
+       uint16_t        groupIdent;
+       uint16_t        permission;
+} __attribute__ ((packed));
+
+/* File Times Extended Attribute (ECMA 167r3 4/14.10.5) */
+struct fileTimesExtAttr
+{
+       uint32_t        attrType;
+       uint8_t         attrSubtype;
+       uint8_t         reserved[3];
+       uint32_t        attrLength;
+       uint32_t        dataLength;
+       uint32_t        fileTimeExistence;
+       uint8_t         fileTimes;
+} __attribute__ ((packed));
+
+/* FileTimeExistence (ECMA 167r3 4/14.10.5.6) */
+#define FTE_CREATION                   0x00000001
+#define FTE_DELETION                   0x00000004
+#define FTE_EFFECTIVE                  0x00000008
+#define FTE_BACKUP                     0x00000002
+
+/* Information Times Extended Attribute (ECMA 167r3 4/14.10.6) */
+struct infoTimesExtAttr
+{
+       uint32_t        attrType;
+       uint8_t         attrSubtype;
+       uint8_t         reserved[3];
+       uint32_t        attrLength;
+       uint32_t        dataLength;
+       uint32_t        infoTimeExistence;
+       uint8_t         infoTimes[0];
+} __attribute__ ((packed));
+
+/* Device Specification (ECMA 167r3 4/14.10.7) */
+struct deviceSpec
+{
+       uint32_t        attrType;
+       uint8_t         attrSubtype;
+       uint8_t         reserved[3];
+       uint32_t        attrLength;
+       uint32_t        impUseLength;
+       uint32_t        majorDeviceIdent;
+       uint32_t        minorDeviceIdent;
+       uint8_t         impUse[0];
+} __attribute__ ((packed));
+
+/* Implementation Use Extended Attr (ECMA 167r3 4/14.10.8) */
+struct impUseExtAttr
+{
+       uint32_t        attrType;
+       uint8_t         attrSubtype;
+       uint8_t         reserved[3];
+       uint32_t        attrLength;
+       uint32_t        impUseLength;
+       regid           impIdent;
+       uint8_t         impUse[0];
+} __attribute__ ((packed));
+
+/* Application Use Extended Attribute (ECMA 167r3 4/14.10.9) */
+struct appUseExtAttr
+{
+       uint32_t        attrType;
+       uint8_t         attrSubtype;
+       uint8_t         reserved[3];
+       uint32_t        attrLength;
+       uint32_t        appUseLength;
+       regid           appIdent;
+       uint8_t         appUse[0];
+} __attribute__ ((packed));
+
+#define EXTATTR_CHAR_SET               1
+#define EXTATTR_ALT_PERMS              3
+#define EXTATTR_FILE_TIMES             5
+#define EXTATTR_INFO_TIMES             6
+#define EXTATTR_DEV_SPEC               12
+#define EXTATTR_IMP_USE                        2048
+#define EXTATTR_APP_USE                        65536
+
+
+/* Unallocated Space Entry (ECMA 167r3 4/14.11) */
+struct unallocSpaceEntry
+{
+       tag             descTag;
+       icbtag          icbTag;
+       uint32_t        lengthAllocDescs;
+       uint8_t         allocDescs[0];
+} __attribute__ ((packed));
+
+/* Space Bitmap Descriptor (ECMA 167r3 4/14.12) */
+struct spaceBitmapDesc
+{
+       tag             descTag;
+       uint32_t        numOfBits;
+       uint32_t        numOfBytes;
+       uint8_t         bitmap[0];
+} __attribute__ ((packed));
+
+/* Partition Integrity Entry (ECMA 167r3 4/14.13) */
+struct partitionIntegrityEntry
+{
+       tag             descTag;
+       icbtag          icbTag;
+       timestamp       recordingDateAndTime;
+       uint8_t         integrityType;
+       uint8_t         reserved[175];
+       regid           impIdent;
+       uint8_t         impUse[256];
+} __attribute__ ((packed));
+
+/* Short Allocation Descriptor (ECMA 167r3 4/14.14.1) */
+
+/* Extent Length (ECMA 167r3 4/14.14.1.1) */
+#define EXT_RECORDED_ALLOCATED         0x00000000
+#define EXT_NOT_RECORDED_ALLOCATED     0x40000000
+#define EXT_NOT_RECORDED_NOT_ALLOCATED 0x80000000
+#define EXT_NEXT_EXTENT_ALLOCDECS      0xC0000000
+
+/* Long Allocation Descriptor (ECMA 167r3 4/14.14.2) */
+
+/* Extended Allocation Descriptor (ECMA 167r3 4/14.14.3) */
+
+/* Logical Volume Header Descriptor (ECMA 167r3 4/14.15) */
+struct logicalVolHeaderDesc
+{
+       uint64_t        uniqueID;
+       uint8_t         reserved[24];
+} __attribute__ ((packed));
+
+/* Path Component (ECMA 167r3 4/14.16.1) */
+struct pathComponent
+{
+       uint8_t         componentType;
+       uint8_t         lengthComponentIdent;
+       uint16_t        componentFileVersionNum;
+       dstring         componentIdent[0];
+} __attribute__ ((packed));
+
+/* File Entry (ECMA 167r3 4/14.17) */
+struct extendedFileEntry
+{
+       tag             descTag;
+       icbtag          icbTag;
+       uint32_t        uid;
+       uint32_t        gid;
+       uint32_t        permissions;
+       uint16_t        fileLinkCount;
+       uint8_t         recordFormat;
+       uint8_t         recordDisplayAttr;
+       uint32_t        recordLength;
+       uint64_t        informationLength;
+       uint64_t        objectSize;
+       uint64_t        logicalBlocksRecorded;
+       timestamp       accessTime;
+       timestamp       modificationTime;
+       timestamp       createTime;
+       timestamp       attrTime;
+       uint32_t        checkpoint;
+       uint32_t        reserved;
+       long_ad         extendedAttrICB;
+       long_ad         streamDirectoryICB;
+       regid           impIdent;
+       uint64_t        uniqueID;
+       uint32_t        lengthExtendedAttr;
+       uint32_t        lengthAllocDescs;
+       uint8_t         extendedAttr[0];
+       uint8_t         allocDescs[0];
+} __attribute__ ((packed));
+
+#endif /* _ECMA_167_H */
index e6fdea847c4bd47fc7115ca827ff8a849a4f0dea..bba20e6f6d5090ce26c3386d7bdea56e4fba6cc2 100644 (file)
@@ -16,7 +16,7 @@
  *  Each contributing author retains all rights to their own work.
  *
  *  (C) 1998-1999 Dave Boynton
- *  (C) 1998-2000 Ben Fennema
+ *  (C) 1998-2001 Ben Fennema
  *  (C) 1999-2000 Stelias Computing Inc
  *
  * HISTORY
@@ -25,7 +25,7 @@
  *  10/07/98      Switched to using generic_readpage, etc., like isofs
  *                And it works!
  *  12/06/98 blf  Added udf_file_read. uses generic_file_read for all cases but
- *                ICB_FLAG_AD_IN_ICB.
+ *                ICBTAG_FLAG_AD_IN_ICB.
  *  04/06/99      64 bit file handling on 32 bit systems taken from ext2 file.c
  *  05/12/99      Preliminary file write support
  */
@@ -157,7 +157,7 @@ static ssize_t udf_file_write(struct file * file, const char * buf,
        struct inode *inode = file->f_dentry->d_inode;
        int err, pos;
 
-       if (UDF_I_ALLOCTYPE(inode) == ICB_FLAG_AD_IN_ICB)
+       if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_IN_ICB)
        {
                if (file->f_flags & O_APPEND)
                        pos = inode->i_size;
@@ -168,7 +168,7 @@ static ssize_t udf_file_write(struct file * file, const char * buf,
                        pos + count))
                {
                        udf_expand_file_adinicb(inode, pos + count, &err);
-                       if (UDF_I_ALLOCTYPE(inode) == ICB_FLAG_AD_IN_ICB)
+                       if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_IN_ICB)
                        {
                                udf_debug("udf_expand_adinicb: err=%d\n", err);
                                return err;
@@ -233,7 +233,7 @@ int udf_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
        int result = -EINVAL;
        struct buffer_head *bh = NULL;
        long_ad eaicb;
-       Uint8 *ea = NULL;
+       uint8_t *ea = NULL;
 
        if ( permission(inode, MAY_READ) != 0 )
        {
@@ -280,18 +280,18 @@ int udf_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
 
        if (UDF_I_EXTENDED_FE(inode) == 0)
        {
-               struct FileEntry *fe;
+               struct fileEntry *fe;
 
-               fe = (struct FileEntry *)bh->b_data;
+               fe = (struct fileEntry *)bh->b_data;
                eaicb = lela_to_cpu(fe->extendedAttrICB);
                if (UDF_I_LENEATTR(inode))
                        ea = fe->extendedAttr;
        }
        else
        {
-               struct ExtendedFileEntry *efe;
+               struct extendedFileEntry *efe;
 
-               efe = (struct ExtendedFileEntry *)bh->b_data;
+               efe = (struct extendedFileEntry *)bh->b_data;
                eaicb = lela_to_cpu(efe->extendedAttrICB);
                if (UDF_I_LENEATTR(inode))
                        ea = efe->extendedAttr;
index f302078dfa0f511380e481f0c709dd1c8c5c6a61..00d4c207f4fe8d96871935236dad61ec3051fdd6 100644 (file)
@@ -15,7 +15,7 @@
  *      ftp://prep.ai.mit.edu/pub/gnu/GPL
  *  Each contributing author retains all rights to their own work.
  *
- *  (C) 1999-2000 Ben Fennema
+ *  (C) 1999-2001 Ben Fennema
  *  (C) 1999-2000 Stelias Computing Inc
  *
  * HISTORY
index e560827b02ee67d11f6b3872a3f27c003e8e3b9f..5f58afa05f8ab94b343264b7665dc5b28b83692f 100644 (file)
@@ -15,7 +15,7 @@
  *             ftp://prep.ai.mit.edu/pub/gnu/GPL
  *     Each contributing author retains all rights to their own work.
  *
- *  (C) 1998-2000 Ben Fennema
+ *  (C) 1998-2001 Ben Fennema
  *
  * HISTORY
  *
@@ -74,7 +74,7 @@ struct inode * udf_new_inode (struct inode *dir, int mode, int * err)
        struct super_block *sb;
        struct inode * inode;
        int block;
-       Uint32 start = UDF_I_LOCATION(dir).logicalBlockNum;
+       uint32_t start = UDF_I_LOCATION(dir).logicalBlockNum;
 
        sb = dir->i_sb;
        inode = new_inode(sb);
@@ -102,9 +102,9 @@ struct inode * udf_new_inode (struct inode *dir, int mode, int * err)
        UDF_I_STRAT4096(inode) = 0;
        if (UDF_SB_LVIDBH(sb))
        {
-               struct LogicalVolHeaderDesc *lvhd;
-               Uint64 uniqueID;
-               lvhd = (struct LogicalVolHeaderDesc *)(UDF_SB_LVID(sb)->logicalVolContentsUse);
+               struct logicalVolHeaderDesc *lvhd;
+               uint64_t uniqueID;
+               lvhd = (struct logicalVolHeaderDesc *)(UDF_SB_LVID(sb)->logicalVolContentsUse);
                if (S_ISDIR(mode))
                        UDF_SB_LVIDIU(sb)->numDirs =
                                cpu_to_le32(le32_to_cpu(UDF_SB_LVIDIU(sb)->numDirs) + 1);
@@ -143,11 +143,11 @@ struct inode * udf_new_inode (struct inode *dir, int mode, int * err)
        else
                UDF_I_EXTENDED_FE(inode) = 0;
        if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_AD_IN_ICB))
-               UDF_I_ALLOCTYPE(inode) = ICB_FLAG_AD_IN_ICB;
+               UDF_I_ALLOCTYPE(inode) = ICBTAG_FLAG_AD_IN_ICB;
        else if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD))
-               UDF_I_ALLOCTYPE(inode) = ICB_FLAG_AD_SHORT;
+               UDF_I_ALLOCTYPE(inode) = ICBTAG_FLAG_AD_SHORT;
        else
-               UDF_I_ALLOCTYPE(inode) = ICB_FLAG_AD_LONG;
+               UDF_I_ALLOCTYPE(inode) = ICBTAG_FLAG_AD_LONG;
        inode->i_mtime = inode->i_atime = inode->i_ctime =
                UDF_I_CRTIME(inode) = CURRENT_TIME;
        UDF_I_UMTIME(inode) = UDF_I_UCTIME(inode) =
index 93f842967cf64959d574536b9467cb1d4b2c6f96..11488336361207d11258071166db5448c3e24721 100644 (file)
@@ -16,7 +16,7 @@
  *  Each contributing author retains all rights to their own work.
  *
  *  (C) 1998 Dave Boynton
- *  (C) 1998-2000 Ben Fennema
+ *  (C) 1998-2001 Ben Fennema
  *  (C) 1999-2000 Stelias Computing Inc
  *
  * HISTORY
@@ -48,7 +48,7 @@ MODULE_LICENSE("GPL");
 
 #define EXTENT_MERGE_SIZE 5
 
-static mode_t udf_convert_permissions(struct FileEntry *);
+static mode_t udf_convert_permissions(struct fileEntry *);
 static int udf_update_inode(struct inode *, int);
 static void udf_fill_inode(struct inode *, struct buffer_head *);
 static struct buffer_head *inode_getblk(struct inode *, long, int *, long *, int *);
@@ -60,7 +60,7 @@ static void udf_merge_extents(struct inode *,
         long_ad [EXTENT_MERGE_SIZE], int *);
 static void udf_update_extents(struct inode *,
        long_ad [EXTENT_MERGE_SIZE], int, int,
-       lb_addr, Uint32, struct buffer_head **);
+       lb_addr, uint32_t, struct buffer_head **);
 static int udf_get_block(struct inode *, sector_t, struct buffer_head *, int);
 
 /*
@@ -124,7 +124,7 @@ no_delete:
 void udf_discard_prealloc(struct inode * inode)
 {
        if (inode->i_size && inode->i_size != UDF_I_LENEXTENTS(inode) &&
-               UDF_I_ALLOCTYPE(inode) != ICB_FLAG_AD_IN_ICB)
+               UDF_I_ALLOCTYPE(inode) != ICBTAG_FLAG_AD_IN_ICB)
        {
                udf_truncate_extents(inode);
        }
@@ -172,9 +172,9 @@ void udf_expand_file_adinicb(struct inode * inode, int newsize, int * err)
        if (!UDF_I_LENALLOC(inode))
        {
                if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD))
-                       UDF_I_ALLOCTYPE(inode) = ICB_FLAG_AD_SHORT;
+                       UDF_I_ALLOCTYPE(inode) = ICBTAG_FLAG_AD_SHORT;
                else
-                       UDF_I_ALLOCTYPE(inode) = ICB_FLAG_AD_LONG;
+                       UDF_I_ALLOCTYPE(inode) = ICBTAG_FLAG_AD_LONG;
                mark_inode_dirty(inode);
                return;
        }
@@ -201,9 +201,9 @@ void udf_expand_file_adinicb(struct inode * inode, int newsize, int * err)
                0, UDF_I_LENALLOC(inode));
        UDF_I_LENALLOC(inode) = 0;
        if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD))
-               UDF_I_ALLOCTYPE(inode) = ICB_FLAG_AD_SHORT;
+               UDF_I_ALLOCTYPE(inode) = ICBTAG_FLAG_AD_SHORT;
        else
-               UDF_I_ALLOCTYPE(inode) = ICB_FLAG_AD_LONG;
+               UDF_I_ALLOCTYPE(inode) = ICBTAG_FLAG_AD_LONG;
        mark_buffer_dirty_inode(bh, inode);
        udf_release_data(bh);
 
@@ -218,19 +218,19 @@ struct buffer_head * udf_expand_dir_adinicb(struct inode *inode, int *block, int
        int newblock;
        struct buffer_head *sbh = NULL, *dbh = NULL;
        lb_addr bloc, eloc;
-       Uint32 elen, extoffset;
+       uint32_t elen, extoffset;
 
        struct udf_fileident_bh sfibh, dfibh;
        loff_t f_pos = udf_ext0_offset(inode) >> 2;
        int size = (udf_ext0_offset(inode) + inode->i_size) >> 2;
-       struct FileIdentDesc cfi, *sfi, *dfi;
+       struct fileIdentDesc cfi, *sfi, *dfi;
 
        if (!inode->i_size)
        {
                if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD))
-                       UDF_I_ALLOCTYPE(inode) = ICB_FLAG_AD_SHORT;
+                       UDF_I_ALLOCTYPE(inode) = ICBTAG_FLAG_AD_SHORT;
                else
-                       UDF_I_ALLOCTYPE(inode) = ICB_FLAG_AD_LONG;
+                       UDF_I_ALLOCTYPE(inode) = ICBTAG_FLAG_AD_LONG;
                mark_inode_dirty(inode);
                return NULL;
        }
@@ -274,7 +274,7 @@ struct buffer_head * udf_expand_dir_adinicb(struct inode *inode, int *block, int
                sfi->descTag.tagLocation = *block;
                dfibh.soffset = dfibh.eoffset;
                dfibh.eoffset += (sfibh.eoffset - sfibh.soffset);
-               dfi = (struct FileIdentDesc *)(dbh->b_data + dfibh.soffset);
+               dfi = (struct fileIdentDesc *)(dbh->b_data + dfibh.soffset);
                if (udf_write_fi(inode, sfi, dfi, &dfibh, sfi->impUse,
                        sfi->fileIdent + sfi->lengthOfImpUse))
                {
@@ -290,9 +290,9 @@ struct buffer_head * udf_expand_dir_adinicb(struct inode *inode, int *block, int
 
        UDF_I_LENALLOC(inode) = 0;
        if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD))
-               UDF_I_ALLOCTYPE(inode) = ICB_FLAG_AD_SHORT;
+               UDF_I_ALLOCTYPE(inode) = ICBTAG_FLAG_AD_SHORT;
        else
-               UDF_I_ALLOCTYPE(inode) = ICB_FLAG_AD_LONG;
+               UDF_I_ALLOCTYPE(inode) = ICBTAG_FLAG_AD_LONG;
        bloc = UDF_I_LOCATION(inode);
        eloc.logicalBlockNum = *block;
        eloc.partitionReferenceNum = UDF_I_LOCATION(inode).partitionReferenceNum;
@@ -389,19 +389,19 @@ static struct buffer_head * inode_getblk(struct inode * inode, long block,
 {
        struct buffer_head *pbh = NULL, *cbh = NULL, *nbh = NULL, *result = NULL;
        long_ad laarr[EXTENT_MERGE_SIZE];
-       Uint32 pextoffset = 0, cextoffset = 0, nextoffset = 0;
+       uint32_t pextoffset = 0, cextoffset = 0, nextoffset = 0;
        int count = 0, startnum = 0, endnum = 0;
-       Uint32 elen = 0;
+       uint32_t elen = 0;
        lb_addr eloc, pbloc, cbloc, nbloc;
        int c = 1;
-       Uint64 lbcount = 0, b_off = 0;
-       Uint32 newblocknum, newblock, offset = 0;
-       Sint8 etype;
+       uint64_t lbcount = 0, b_off = 0;
+       uint32_t newblocknum, newblock, offset = 0;
+       int8_t etype;
        int goal = 0, pgoal = UDF_I_LOCATION(inode).logicalBlockNum;
        char lastblock = 0;
 
        pextoffset = cextoffset = nextoffset = udf_file_entry_alloc_offset(inode);
-       b_off = (Uint64)block << inode->i_sb->s_blocksize_bits;
+       b_off = (uint64_t)block << inode->i_sb->s_blocksize_bits;
        pbloc = cbloc = nbloc = UDF_I_LOCATION(inode);
 
        /* find the extent which contains the block we are looking for.
@@ -438,7 +438,7 @@ static struct buffer_head * inode_getblk(struct inode * inode, long block,
                laarr[c].extLength = (etype << 30) | elen;
                laarr[c].extLocation = eloc;
 
-               if (etype != EXTENT_NOT_RECORDED_NOT_ALLOCATED)
+               if (etype != (EXT_NOT_RECORDED_NOT_ALLOCATED >> 30))
                        pgoal = eloc.logicalBlockNum +
                                ((elen + inode->i_sb->s_blocksize - 1) >>
                                inode->i_sb->s_blocksize_bits);
@@ -452,11 +452,11 @@ static struct buffer_head * inode_getblk(struct inode * inode, long block,
        /* if the extent is allocated and recorded, return the block
        if the extent is not a multiple of the blocksize, round up */
 
-       if (etype == EXTENT_RECORDED_ALLOCATED)
+       if (etype == (EXT_RECORDED_ALLOCATED >> 30))
        {
                if (elen & (inode->i_sb->s_blocksize - 1))
                {
-                       elen = (EXTENT_RECORDED_ALLOCATED << 30) |
+                       elen = EXT_RECORDED_ALLOCATED |
                                ((elen + inode->i_sb->s_blocksize - 1) &
                                ~(inode->i_sb->s_blocksize - 1));
                        etype = udf_write_aext(inode, nbloc, &cextoffset, eloc, elen, nbh, 1);
@@ -484,7 +484,7 @@ static struct buffer_head * inode_getblk(struct inode * inode, long block,
                                        ~(inode->i_sb->s_blocksize - 1);
                }
                c = !c;
-               laarr[c].extLength = (EXTENT_NOT_RECORDED_NOT_ALLOCATED << 30) |
+               laarr[c].extLength = EXT_NOT_RECORDED_NOT_ALLOCATED |
                        ((offset + 1) << inode->i_sb->s_blocksize_bits);
                memset(&laarr[c].extLocation, 0x00, sizeof(lb_addr));
                count ++;
@@ -525,7 +525,7 @@ static struct buffer_head * inode_getblk(struct inode * inode, long block,
 
        /* if the current extent is not recorded but allocated, get the
                block in the extent corresponding to the requested block */
-       if ((laarr[c].extLength >> 30) == EXTENT_NOT_RECORDED_ALLOCATED)
+       if ((laarr[c].extLength >> 30) == (EXT_NOT_RECORDED_ALLOCATED >> 30))
                newblocknum = laarr[c].extLocation.logicalBlockNum + offset;
        else /* otherwise, allocate a new block */
        {
@@ -591,8 +591,8 @@ static struct buffer_head * inode_getblk(struct inode * inode, long block,
 static void udf_split_extents(struct inode *inode, int *c, int offset, int newblocknum,
        long_ad laarr[EXTENT_MERGE_SIZE], int *endnum)
 {
-       if ((laarr[*c].extLength >> 30) == EXTENT_NOT_RECORDED_ALLOCATED ||
-               (laarr[*c].extLength >> 30) == EXTENT_NOT_RECORDED_NOT_ALLOCATED)
+       if ((laarr[*c].extLength >> 30) == (EXT_NOT_RECORDED_ALLOCATED >> 30) ||
+               (laarr[*c].extLength >> 30) == (EXT_NOT_RECORDED_NOT_ALLOCATED >> 30))
        {
                int curr = *c;
                int blen = ((laarr[curr].extLength & UDF_EXTENT_LENGTH_MASK) +
@@ -614,10 +614,10 @@ static void udf_split_extents(struct inode *inode, int *c, int offset, int newbl
 
                if (offset)
                {
-                       if ((type >> 30) == EXTENT_NOT_RECORDED_ALLOCATED)
+                       if ((type >> 30) == (EXT_NOT_RECORDED_ALLOCATED >> 30))
                        {
                                udf_free_blocks(inode->i_sb, inode, laarr[curr].extLocation, 0, offset);
-                               laarr[curr].extLength = (EXTENT_NOT_RECORDED_NOT_ALLOCATED << 30) |
+                               laarr[curr].extLength = EXT_NOT_RECORDED_NOT_ALLOCATED |
                                        (offset << inode->i_sb->s_blocksize_bits);
                                laarr[curr].extLocation.logicalBlockNum = 0;
                                laarr[curr].extLocation.partitionReferenceNum = 0;
@@ -631,16 +631,16 @@ static void udf_split_extents(struct inode *inode, int *c, int offset, int newbl
                }
                
                laarr[curr].extLocation.logicalBlockNum = newblocknum;
-               if ((type >> 30) == EXTENT_NOT_RECORDED_NOT_ALLOCATED)
+               if ((type >> 30) == (EXT_NOT_RECORDED_NOT_ALLOCATED >> 30))
                        laarr[curr].extLocation.partitionReferenceNum =
                                UDF_I_LOCATION(inode).partitionReferenceNum;
-               laarr[curr].extLength = (EXTENT_RECORDED_ALLOCATED << 30) |
+               laarr[curr].extLength = EXT_RECORDED_ALLOCATED |
                        inode->i_sb->s_blocksize;
                curr ++;
 
                if (blen != offset + 1)
                {
-                       if ((type >> 30) == EXTENT_NOT_RECORDED_ALLOCATED)
+                       if ((type >> 30) == (EXT_NOT_RECORDED_ALLOCATED >> 30))
                                laarr[curr].extLocation.logicalBlockNum += (offset + 1);
                        laarr[curr].extLength = type |
                                ((blen - (offset + 1)) << inode->i_sb->s_blocksize_bits);
@@ -664,7 +664,7 @@ static void udf_prealloc_extents(struct inode *inode, int c, int lastblock,
        }
        else
        {
-               if ((laarr[c+1].extLength >> 30) == EXTENT_NOT_RECORDED_ALLOCATED)
+               if ((laarr[c+1].extLength >> 30) == (EXT_NOT_RECORDED_ALLOCATED >> 30))
                {
                        start = c+1;
                        length = currlength = (((laarr[c+1].extLength & UDF_EXTENT_LENGTH_MASK) +
@@ -681,7 +681,7 @@ static void udf_prealloc_extents(struct inode *inode, int c, int lastblock,
                        if (lastblock)
                                length += UDF_DEFAULT_PREALLOC_BLOCKS;
                }
-               else if ((laarr[i].extLength >> 30) == EXTENT_NOT_RECORDED_NOT_ALLOCATED)
+               else if ((laarr[i].extLength >> 30) == (EXT_NOT_RECORDED_NOT_ALLOCATED >> 30))
                        length += (((laarr[i].extLength & UDF_EXTENT_LENGTH_MASK) +
                                inode->i_sb->s_blocksize - 1) >> inode->i_sb->s_blocksize_bits);
                else
@@ -711,7 +711,7 @@ static void udf_prealloc_extents(struct inode *inode, int c, int lastblock,
                                laarr[c+1].extLocation.logicalBlockNum = next;
                                laarr[c+1].extLocation.partitionReferenceNum =
                                        laarr[c].extLocation.partitionReferenceNum;
-                               laarr[c+1].extLength = (EXTENT_NOT_RECORDED_ALLOCATED << 30) |
+                               laarr[c+1].extLength = EXT_NOT_RECORDED_ALLOCATED |
                                        (numalloc << inode->i_sb->s_blocksize_bits);
                                start = c+1;
                        }
@@ -751,7 +751,7 @@ static void udf_merge_extents(struct inode *inode,
        {
                if ((laarr[i].extLength >> 30) == (laarr[i+1].extLength >> 30))
                {
-                       if (((laarr[i].extLength >> 30) == EXTENT_NOT_RECORDED_NOT_ALLOCATED) ||
+                       if (((laarr[i].extLength >> 30) == (EXT_NOT_RECORDED_NOT_ALLOCATED >> 30)) ||
                                ((laarr[i+1].extLocation.logicalBlockNum - laarr[i].extLocation.logicalBlockNum) ==
                                (((laarr[i].extLength & UDF_EXTENT_LENGTH_MASK) +
                                inode->i_sb->s_blocksize - 1) >> inode->i_sb->s_blocksize_bits)))
@@ -788,11 +788,11 @@ static void udf_merge_extents(struct inode *inode,
 
 static void udf_update_extents(struct inode *inode,
        long_ad laarr[EXTENT_MERGE_SIZE], int startnum, int endnum,
-       lb_addr pbloc, Uint32 pextoffset, struct buffer_head **pbh)
+       lb_addr pbloc, uint32_t pextoffset, struct buffer_head **pbh)
 {
        int start = 0, i;
        lb_addr tmploc;
-       Uint32 tmplen;
+       uint32_t tmplen;
 
        if (startnum > endnum)
        {
@@ -855,13 +855,13 @@ void udf_truncate(struct inode * inode)
                return;
 
        lock_kernel();
-       if (UDF_I_ALLOCTYPE(inode) == ICB_FLAG_AD_IN_ICB)
+       if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_IN_ICB)
        {
                if (inode->i_sb->s_blocksize < (udf_file_entry_alloc_offset(inode) +
                        inode->i_size))
                {
                        udf_expand_file_adinicb(inode, inode->i_size, &err);
-                       if (UDF_I_ALLOCTYPE(inode) == ICB_FLAG_AD_IN_ICB)
+                       if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_IN_ICB)
                        {
                                inode->i_size = UDF_I_LENALLOC(inode);
                                unlock_kernel();
@@ -928,8 +928,8 @@ void
 __udf_read_inode(struct inode *inode)
 {
        struct buffer_head *bh = NULL;
-       struct FileEntry *fe;
-       Uint16 ident;
+       struct fileEntry *fe;
+       uint16_t ident;
 
        /*
         * Set defaults, but the inode is still incomplete!
@@ -956,8 +956,8 @@ __udf_read_inode(struct inode *inode)
                return;
        }
 
-       if (ident != TID_FILE_ENTRY && ident != TID_EXTENDED_FILE_ENTRY &&
-               ident != TID_UNALLOCATED_SPACE_ENTRY)
+       if (ident != TAG_IDENT_FE && ident != TAG_IDENT_EFE &&
+               ident != TAG_IDENT_USE)
        {
                printk(KERN_ERR "udf: udf_read_inode(ino %ld) failed ident=%d\n",
                        inode->i_ino, ident);
@@ -966,28 +966,28 @@ __udf_read_inode(struct inode *inode)
                return;
        }
 
-       fe = (struct FileEntry *)bh->b_data;
+       fe = (struct fileEntry *)bh->b_data;
 
        if (le16_to_cpu(fe->icbTag.strategyType) == 4096)
        {
                struct buffer_head *ibh = NULL, *nbh = NULL;
-               struct IndirectEntry *ie;
+               struct indirectEntry *ie;
 
                ibh = udf_read_ptagged(inode->i_sb, UDF_I_LOCATION(inode), 1, &ident);
-               if (ident == TID_INDIRECT_ENTRY)
+               if (ident == TAG_IDENT_IE)
                {
                        if (ibh)
                        {
                                lb_addr loc;
-                               ie = (struct IndirectEntry *)ibh->b_data;
+                               ie = (struct indirectEntry *)ibh->b_data;
        
                                loc = lelb_to_cpu(ie->indirectICB.extLocation);
        
                                if (ie->indirectICB.extLength && 
                                        (nbh = udf_read_ptagged(inode->i_sb, loc, 0, &ident)))
                                {
-                                       if (ident == TID_FILE_ENTRY ||
-                                               ident == TID_EXTENDED_FILE_ENTRY)
+                                       if (ident == TAG_IDENT_FE ||
+                                               ident == TAG_IDENT_EFE)
                                        {
                                                memcpy(&UDF_I_LOCATION(inode), &loc, sizeof(lb_addr));
                                                udf_release_data(bh);
@@ -1023,23 +1023,23 @@ __udf_read_inode(struct inode *inode)
 
 static void udf_fill_inode(struct inode *inode, struct buffer_head *bh)
 {
-       struct FileEntry *fe;
-       struct ExtendedFileEntry *efe;
+       struct fileEntry *fe;
+       struct extendedFileEntry *efe;
        time_t convtime;
        long convtime_usec;
        int offset, alen;
 
        UDF_I_NEW_INODE(inode) = 0;
 
-       fe = (struct FileEntry *)bh->b_data;
-       efe = (struct ExtendedFileEntry *)bh->b_data;
+       fe = (struct fileEntry *)bh->b_data;
+       efe = (struct extendedFileEntry *)bh->b_data;
 
        if (le16_to_cpu(fe->icbTag.strategyType) == 4)
                UDF_I_STRAT4096(inode) = 0;
        else /* if (le16_to_cpu(fe->icbTag.strategyType) == 4096) */
                UDF_I_STRAT4096(inode) = 1;
 
-       UDF_I_ALLOCTYPE(inode) = le16_to_cpu(fe->icbTag.flags) & ICB_FLAG_ALLOC_MASK;
+       UDF_I_ALLOCTYPE(inode) = le16_to_cpu(fe->icbTag.flags) & ICBTAG_FLAG_AD_MASK;
        UDF_I_UMTIME(inode) = 0;
        UDF_I_UCTIME(inode) = 0;
        UDF_I_CRTIME(inode) = 0;
@@ -1050,15 +1050,15 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh)
        UDF_I_LENALLOC(inode) = 0;
        UDF_I_NEXT_ALLOC_BLOCK(inode) = 0;
        UDF_I_NEXT_ALLOC_GOAL(inode) = 0;
-       if (le16_to_cpu(fe->descTag.tagIdent) == TID_EXTENDED_FILE_ENTRY)
+       if (le16_to_cpu(fe->descTag.tagIdent) == TAG_IDENT_EFE)
                UDF_I_EXTENDED_FE(inode) = 1;
-       else if (le16_to_cpu(fe->descTag.tagIdent) == TID_FILE_ENTRY)
+       else if (le16_to_cpu(fe->descTag.tagIdent) == TAG_IDENT_FE)
                UDF_I_EXTENDED_FE(inode) = 0;
-       else if (le16_to_cpu(fe->descTag.tagIdent) == TID_UNALLOCATED_SPACE_ENTRY)
+       else if (le16_to_cpu(fe->descTag.tagIdent) == TAG_IDENT_USE)
        {
                UDF_I_LENALLOC(inode) =
                        le32_to_cpu(
-                               ((struct UnallocatedSpaceEntry *)bh->b_data)->lengthAllocDescs);
+                               ((struct unallocSpaceEntry *)bh->b_data)->lengthAllocDescs);
                return;
        }
 
@@ -1120,7 +1120,7 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh)
                UDF_I_UNIQUE(inode) = le64_to_cpu(fe->uniqueID);
                UDF_I_LENEATTR(inode) = le32_to_cpu(fe->lengthExtendedAttr);
                UDF_I_LENALLOC(inode) = le32_to_cpu(fe->lengthAllocDescs);
-               offset = sizeof(struct FileEntry) + UDF_I_LENEATTR(inode);
+               offset = sizeof(struct fileEntry) + UDF_I_LENEATTR(inode);
                alen = offset + UDF_I_LENALLOC(inode);
        }
        else
@@ -1177,13 +1177,13 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh)
                UDF_I_UNIQUE(inode) = le64_to_cpu(efe->uniqueID);
                UDF_I_LENEATTR(inode) = le32_to_cpu(efe->lengthExtendedAttr);
                UDF_I_LENALLOC(inode) = le32_to_cpu(efe->lengthAllocDescs);
-               offset = sizeof(struct ExtendedFileEntry) + UDF_I_LENEATTR(inode);
+               offset = sizeof(struct extendedFileEntry) + UDF_I_LENEATTR(inode);
                alen = offset + UDF_I_LENALLOC(inode);
        }
 
        switch (fe->icbTag.fileType)
        {
-               case FILE_TYPE_DIRECTORY:
+               case ICBTAG_FILE_TYPE_DIRECTORY:
                {
                        inode->i_op = &udf_dir_inode_operations;
                        inode->i_fop = &udf_dir_operations;
@@ -1191,11 +1191,11 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh)
                        inode->i_nlink ++;
                        break;
                }
-               case FILE_TYPE_REALTIME:
-               case FILE_TYPE_REGULAR:
-               case FILE_TYPE_NONE:
+               case ICBTAG_FILE_TYPE_REALTIME:
+               case ICBTAG_FILE_TYPE_REGULAR:
+               case ICBTAG_FILE_TYPE_UNDEF:
                {
-                       if (UDF_I_ALLOCTYPE(inode) == ICB_FLAG_AD_IN_ICB)
+                       if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_IN_ICB)
                                inode->i_data.a_ops = &udf_adinicb_aops;
                        else
                                inode->i_data.a_ops = &udf_aops;
@@ -1204,22 +1204,22 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh)
                        inode->i_mode |= S_IFREG;
                        break;
                }
-               case FILE_TYPE_BLOCK:
+               case ICBTAG_FILE_TYPE_BLOCK:
                {
                        inode->i_mode |= S_IFBLK;
                        break;
                }
-               case FILE_TYPE_CHAR:
+               case ICBTAG_FILE_TYPE_CHAR:
                {
                        inode->i_mode |= S_IFCHR;
                        break;
                }
-               case FILE_TYPE_FIFO:
+               case ICBTAG_FILE_TYPE_FIFO:
                {
                        init_special_inode(inode, inode->i_mode | S_IFIFO, 0);
                        break;
                }
-               case FILE_TYPE_SYMLINK:
+               case ICBTAG_FILE_TYPE_SYMLINK:
                {
                        inode->i_data.a_ops = &udf_symlink_aops;
                        inode->i_op = &page_symlink_inode_operations;
@@ -1237,8 +1237,8 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh)
        if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode))
        {
                struct buffer_head *tbh = NULL;
-               struct DeviceSpecificationExtendedAttr *dsea =
-                       (struct DeviceSpecificationExtendedAttr *)
+               struct deviceSpec *dsea =
+                       (struct deviceSpec *)
                                udf_get_extendedattr(inode, 12, 1, &tbh);
 
                if (dsea)
@@ -1257,11 +1257,11 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh)
 }
 
 static mode_t
-udf_convert_permissions(struct FileEntry *fe)
+udf_convert_permissions(struct fileEntry *fe)
 {
        mode_t mode;
-       Uint32 permissions;
-       Uint32 flags;
+       uint32_t permissions;
+       uint32_t flags;
 
        permissions = le32_to_cpu(fe->permissions);
        flags = le16_to_cpu(fe->icbTag.flags);
@@ -1269,9 +1269,9 @@ udf_convert_permissions(struct FileEntry *fe)
        mode =  (( permissions      ) & S_IRWXO) |
                (( permissions >> 2 ) & S_IRWXG) |
                (( permissions >> 4 ) & S_IRWXU) |
-               (( flags & ICB_FLAG_SETUID) ? S_ISUID : 0) |
-               (( flags & ICB_FLAG_SETGID) ? S_ISGID : 0) |
-               (( flags & ICB_FLAG_STICKY) ? S_ISVTX : 0);
+               (( flags & ICBTAG_FLAG_SETUID) ? S_ISUID : 0) |
+               (( flags & ICBTAG_FLAG_SETGID) ? S_ISGID : 0) |
+               (( flags & ICBTAG_FLAG_STICKY) ? S_ISVTX : 0);
 
        return mode;
 }
@@ -1307,11 +1307,11 @@ static int
 udf_update_inode(struct inode *inode, int do_sync)
 {
        struct buffer_head *bh = NULL;
-       struct FileEntry *fe;
-       struct ExtendedFileEntry *efe;
-       Uint32 udfperms;
-       Uint16 icbflags;
-       Uint16 crclen;
+       struct fileEntry *fe;
+       struct extendedFileEntry *efe;
+       uint32_t udfperms;
+       uint16_t icbflags;
+       uint16_t crclen;
        int i;
        timestamp cpu_time;
        int err = 0;
@@ -1324,27 +1324,27 @@ udf_update_inode(struct inode *inode, int do_sync)
                udf_debug("bread failure\n");
                return -EIO;
        }
-       fe = (struct FileEntry *)bh->b_data;
-       efe = (struct ExtendedFileEntry *)bh->b_data;
+       fe = (struct fileEntry *)bh->b_data;
+       efe = (struct extendedFileEntry *)bh->b_data;
        if (UDF_I_NEW_INODE(inode) == 1)
        {
                if (UDF_I_EXTENDED_FE(inode) == 0)
-                       memset(bh->b_data, 0x00, sizeof(struct FileEntry));
+                       memset(bh->b_data, 0x00, sizeof(struct fileEntry));
                else
-                       memset(bh->b_data, 0x00, sizeof(struct ExtendedFileEntry));
+                       memset(bh->b_data, 0x00, sizeof(struct extendedFileEntry));
                memset(bh->b_data + udf_file_entry_alloc_offset(inode) +
                        UDF_I_LENALLOC(inode), 0x0, inode->i_sb->s_blocksize -
                        udf_file_entry_alloc_offset(inode) - UDF_I_LENALLOC(inode));
                UDF_I_NEW_INODE(inode) = 0;
        }
 
-       if (le16_to_cpu(fe->descTag.tagIdent) == TID_UNALLOCATED_SPACE_ENTRY)
+       if (le16_to_cpu(fe->descTag.tagIdent) == TAG_IDENT_USE)
        {
-               struct UnallocatedSpaceEntry *use =
-                       (struct UnallocatedSpaceEntry *)bh->b_data;
+               struct unallocSpaceEntry *use =
+                       (struct unallocSpaceEntry *)bh->b_data;
 
                use->lengthAllocDescs = cpu_to_le32(UDF_I_LENALLOC(inode));
-               crclen = sizeof(struct UnallocatedSpaceEntry) + UDF_I_LENALLOC(inode) -
+               crclen = sizeof(struct unallocSpaceEntry) + UDF_I_LENALLOC(inode) -
                        sizeof(tag);
                use->descTag.tagLocation = cpu_to_le32(UDF_I_LOCATION(inode).logicalBlockNum);
                use->descTag.descCRCLength = cpu_to_le16(crclen);
@@ -1353,7 +1353,7 @@ udf_update_inode(struct inode *inode, int do_sync)
                use->descTag.tagChecksum = 0;
                for (i=0; i<16; i++)
                        if (i != 4)
-                               use->descTag.tagChecksum += ((Uint8 *)&(use->descTag))[i];
+                               use->descTag.tagChecksum += ((uint8_t *)&(use->descTag))[i];
 
                mark_buffer_dirty(bh);
                udf_release_data(bh);
@@ -1371,9 +1371,9 @@ udf_update_inode(struct inode *inode, int do_sync)
                        ((inode->i_mode & S_IRWXU) << 4);
 
        udfperms |=     (le32_to_cpu(fe->permissions) &
-                       (PERM_O_DELETE | PERM_O_CHATTR |
-                        PERM_G_DELETE | PERM_G_CHATTR |
-                        PERM_U_DELETE | PERM_U_CHATTR));
+                       (FE_PERM_O_DELETE | FE_PERM_O_CHATTR |
+                        FE_PERM_G_DELETE | FE_PERM_G_CHATTR |
+                        FE_PERM_U_DELETE | FE_PERM_U_CHATTR));
        fe->permissions = cpu_to_le32(udfperms);
 
        if (S_ISDIR(inode->i_mode))
@@ -1385,26 +1385,26 @@ udf_update_inode(struct inode *inode, int do_sync)
 
        if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode))
        {
-               EntityID *eid;
+               regid *eid;
                struct buffer_head *tbh = NULL;
-               struct DeviceSpecificationExtendedAttr *dsea =
-                       (struct DeviceSpecificationExtendedAttr *)
+               struct deviceSpec *dsea =
+                       (struct deviceSpec *)
                                udf_get_extendedattr(inode, 12, 1, &tbh);       
 
                if (!dsea)
                {
-                       dsea = (struct DeviceSpecificationExtendedAttr *)
+                       dsea = (struct deviceSpec *)
                                udf_add_extendedattr(inode,
-                                       sizeof(struct DeviceSpecificationExtendedAttr) +
-                                       sizeof(EntityID), 12, 0x3, &tbh);
+                                       sizeof(struct deviceSpec) +
+                                       sizeof(regid), 12, 0x3, &tbh);
                        dsea->attrType = 12;
                        dsea->attrSubtype = 1;
-                       dsea->attrLength = sizeof(struct DeviceSpecificationExtendedAttr) +
-                               sizeof(EntityID);
-                       dsea->impUseLength = sizeof(EntityID);
+                       dsea->attrLength = sizeof(struct deviceSpec) +
+                               sizeof(regid);
+                       dsea->impUseLength = sizeof(regid);
                }
-               eid = (EntityID *)dsea->impUse;
-               memset(eid, 0, sizeof(EntityID));
+               eid = (regid *)dsea->impUse;
+               memset(eid, 0, sizeof(regid));
                strcpy(eid->ident, UDF_ID_DEVELOPER);
                eid->identSuffix[0] = UDF_OS_CLASS_UNIX;
                eid->identSuffix[1] = UDF_OS_ID_LINUX;
@@ -1426,15 +1426,15 @@ udf_update_inode(struct inode *inode, int do_sync)
                        fe->modificationTime = cpu_to_lets(cpu_time);
                if (udf_time_to_stamp(&cpu_time, inode->i_ctime, UDF_I_UCTIME(inode)))
                        fe->attrTime = cpu_to_lets(cpu_time);
-               memset(&(fe->impIdent), 0, sizeof(EntityID));
+               memset(&(fe->impIdent), 0, sizeof(regid));
                strcpy(fe->impIdent.ident, UDF_ID_DEVELOPER);
                fe->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX;
                fe->impIdent.identSuffix[1] = UDF_OS_ID_LINUX;
                fe->uniqueID = cpu_to_le64(UDF_I_UNIQUE(inode));
                fe->lengthExtendedAttr = cpu_to_le32(UDF_I_LENEATTR(inode));
                fe->lengthAllocDescs = cpu_to_le32(UDF_I_LENALLOC(inode));
-               fe->descTag.tagIdent = le16_to_cpu(TID_FILE_ENTRY);
-               crclen = sizeof(struct FileEntry);
+               fe->descTag.tagIdent = le16_to_cpu(TAG_IDENT_FE);
+               crclen = sizeof(struct fileEntry);
        }
        else
        {
@@ -1472,15 +1472,15 @@ udf_update_inode(struct inode *inode, int do_sync)
                if (udf_time_to_stamp(&cpu_time, inode->i_ctime, UDF_I_UCTIME(inode)))
                        efe->attrTime = cpu_to_lets(cpu_time);
 
-               memset(&(efe->impIdent), 0, sizeof(EntityID));
+               memset(&(efe->impIdent), 0, sizeof(regid));
                strcpy(efe->impIdent.ident, UDF_ID_DEVELOPER);
                efe->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX;
                efe->impIdent.identSuffix[1] = UDF_OS_ID_LINUX;
                efe->uniqueID = cpu_to_le64(UDF_I_UNIQUE(inode));
                efe->lengthExtendedAttr = cpu_to_le32(UDF_I_LENEATTR(inode));
                efe->lengthAllocDescs = cpu_to_le32(UDF_I_LENALLOC(inode));
-               efe->descTag.tagIdent = le16_to_cpu(TID_EXTENDED_FILE_ENTRY);
-               crclen = sizeof(struct ExtendedFileEntry);
+               efe->descTag.tagIdent = le16_to_cpu(TAG_IDENT_EFE);
+               crclen = sizeof(struct extendedFileEntry);
        }
        if (UDF_I_STRAT4096(inode))
        {
@@ -1495,25 +1495,25 @@ udf_update_inode(struct inode *inode, int do_sync)
        }
 
        if (S_ISDIR(inode->i_mode))
-               fe->icbTag.fileType = FILE_TYPE_DIRECTORY;
+               fe->icbTag.fileType = ICBTAG_FILE_TYPE_DIRECTORY;
        else if (S_ISREG(inode->i_mode))
-               fe->icbTag.fileType = FILE_TYPE_REGULAR;
+               fe->icbTag.fileType = ICBTAG_FILE_TYPE_REGULAR;
        else if (S_ISLNK(inode->i_mode))
-               fe->icbTag.fileType = FILE_TYPE_SYMLINK;
+               fe->icbTag.fileType = ICBTAG_FILE_TYPE_SYMLINK;
        else if (S_ISBLK(inode->i_mode))
-               fe->icbTag.fileType = FILE_TYPE_BLOCK;
+               fe->icbTag.fileType = ICBTAG_FILE_TYPE_BLOCK;
        else if (S_ISCHR(inode->i_mode))
-               fe->icbTag.fileType = FILE_TYPE_CHAR;
+               fe->icbTag.fileType = ICBTAG_FILE_TYPE_CHAR;
        else if (S_ISFIFO(inode->i_mode))
-               fe->icbTag.fileType = FILE_TYPE_FIFO;
+               fe->icbTag.fileType = ICBTAG_FILE_TYPE_FIFO;
 
        icbflags =      UDF_I_ALLOCTYPE(inode) |
-                       ((inode->i_mode & S_ISUID) ? ICB_FLAG_SETUID : 0) |
-                       ((inode->i_mode & S_ISGID) ? ICB_FLAG_SETGID : 0) |
-                       ((inode->i_mode & S_ISVTX) ? ICB_FLAG_STICKY : 0) |
+                       ((inode->i_mode & S_ISUID) ? ICBTAG_FLAG_SETUID : 0) |
+                       ((inode->i_mode & S_ISGID) ? ICBTAG_FLAG_SETGID : 0) |
+                       ((inode->i_mode & S_ISVTX) ? ICBTAG_FLAG_STICKY : 0) |
                        (le16_to_cpu(fe->icbTag.flags) &
-                               ~(ICB_FLAG_ALLOC_MASK | ICB_FLAG_SETUID |
-                               ICB_FLAG_SETGID | ICB_FLAG_STICKY));
+                               ~(ICBTAG_FLAG_AD_MASK | ICBTAG_FLAG_SETUID |
+                               ICBTAG_FLAG_SETGID | ICBTAG_FLAG_STICKY));
 
        fe->icbTag.flags = cpu_to_le16(icbflags);
        if (UDF_SB_UDFREV(inode->i_sb) >= 0x0200)
@@ -1529,7 +1529,7 @@ udf_update_inode(struct inode *inode, int do_sync)
        fe->descTag.tagChecksum = 0;
        for (i=0; i<16; i++)
                if (i != 4)
-                       fe->descTag.tagChecksum += ((Uint8 *)&(fe->descTag))[i];
+                       fe->descTag.tagChecksum += ((uint8_t *)&(fe->descTag))[i];
 
        /* write the data blocks */
        mark_buffer_dirty(bh);
@@ -1610,14 +1610,14 @@ udf_iget(struct super_block *sb, lb_addr ino)
        return inode;
 }
 
-Sint8 udf_add_aext(struct inode *inode, lb_addr *bloc, int *extoffset,
-       lb_addr eloc, Uint32 elen, struct buffer_head **bh, int inc)
+int8_t udf_add_aext(struct inode *inode, lb_addr *bloc, int *extoffset,
+       lb_addr eloc, uint32_t elen, struct buffer_head **bh, int inc)
 {
        int adsize;
        short_ad *sad = NULL;
        long_ad *lad = NULL;
-       struct AllocExtDesc *aed;
-       int ret;
+       struct allocExtDesc *aed;
+       int8_t etype;
 
        if (!(*bh))
        {
@@ -1630,9 +1630,9 @@ Sint8 udf_add_aext(struct inode *inode, lb_addr *bloc, int *extoffset,
                }
        }
 
-       if (UDF_I_ALLOCTYPE(inode) == ICB_FLAG_AD_SHORT)
+       if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_SHORT)
                adsize = sizeof(short_ad);
-       else if (UDF_I_ALLOCTYPE(inode) == ICB_FLAG_AD_LONG)
+       else if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_LONG)
                adsize = sizeof(long_ad);
        else
                return -1;
@@ -1660,7 +1660,7 @@ Sint8 udf_add_aext(struct inode *inode, lb_addr *bloc, int *extoffset,
                unlock_buffer(nbh);
                mark_buffer_dirty_inode(nbh, inode);
 
-               aed = (struct AllocExtDesc *)(nbh->b_data);
+               aed = (struct allocExtDesc *)(nbh->b_data);
                if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT))
                        aed->previousAllocExtLocation = cpu_to_le32(obloc.logicalBlockNum);
                if (*extoffset + adsize > inode->i_sb->s_blocksize)
@@ -1668,20 +1668,20 @@ Sint8 udf_add_aext(struct inode *inode, lb_addr *bloc, int *extoffset,
                        loffset = *extoffset;
                        aed->lengthAllocDescs = cpu_to_le32(adsize);
                        sptr = (*bh)->b_data + *extoffset - adsize;
-                       dptr = nbh->b_data + sizeof(struct AllocExtDesc);
+                       dptr = nbh->b_data + sizeof(struct allocExtDesc);
                        memcpy(dptr, sptr, adsize);
-                       *extoffset = sizeof(struct AllocExtDesc) + adsize;
+                       *extoffset = sizeof(struct allocExtDesc) + adsize;
                }
                else
                {
                        loffset = *extoffset + adsize;
                        aed->lengthAllocDescs = cpu_to_le32(0);
                        sptr = (*bh)->b_data + *extoffset;
-                       *extoffset = sizeof(struct AllocExtDesc);
+                       *extoffset = sizeof(struct allocExtDesc);
 
                        if (memcmp(&UDF_I_LOCATION(inode), &obloc, sizeof(lb_addr)))
                        {
-                               aed = (struct AllocExtDesc *)(*bh)->b_data;
+                               aed = (struct allocExtDesc *)(*bh)->b_data;
                                aed->lengthAllocDescs =
                                        cpu_to_le32(le32_to_cpu(aed->lengthAllocDescs) + adsize);
                        }
@@ -1692,27 +1692,27 @@ Sint8 udf_add_aext(struct inode *inode, lb_addr *bloc, int *extoffset,
                        }
                }
                if (UDF_SB_UDFREV(inode->i_sb) >= 0x0200)
-                       udf_new_tag(nbh->b_data, TID_ALLOC_EXTENT_DESC, 3, 1,
+                       udf_new_tag(nbh->b_data, TAG_IDENT_AED, 3, 1,
                                bloc->logicalBlockNum, sizeof(tag));
                else
-                       udf_new_tag(nbh->b_data, TID_ALLOC_EXTENT_DESC, 2, 1,
+                       udf_new_tag(nbh->b_data, TAG_IDENT_AED, 2, 1,
                                bloc->logicalBlockNum, sizeof(tag));
                switch (UDF_I_ALLOCTYPE(inode))
                {
-                       case ICB_FLAG_AD_SHORT:
+                       case ICBTAG_FLAG_AD_SHORT:
                        {
                                sad = (short_ad *)sptr;
                                sad->extLength = cpu_to_le32(
-                                       EXTENT_NEXT_EXTENT_ALLOCDECS << 30 |
+                                       EXT_NEXT_EXTENT_ALLOCDECS |
                                        inode->i_sb->s_blocksize);
                                sad->extPosition = cpu_to_le32(bloc->logicalBlockNum);
                                break;
                        }
-                       case ICB_FLAG_AD_LONG:
+                       case ICBTAG_FLAG_AD_LONG:
                        {
                                lad = (long_ad *)sptr;
                                lad->extLength = cpu_to_le32(
-                                       EXTENT_NEXT_EXTENT_ALLOCDECS << 30 |
+                                       EXT_NEXT_EXTENT_ALLOCDECS |
                                        inode->i_sb->s_blocksize);
                                lad->extLocation = cpu_to_lelb(*bloc);
                                memset(lad->impUse, 0x00, sizeof(lad->impUse));
@@ -1722,13 +1722,13 @@ Sint8 udf_add_aext(struct inode *inode, lb_addr *bloc, int *extoffset,
                if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) || UDF_SB_UDFREV(inode->i_sb) >= 0x0201)
                        udf_update_tag((*bh)->b_data, loffset);
                else
-                       udf_update_tag((*bh)->b_data, sizeof(struct AllocExtDesc));
+                       udf_update_tag((*bh)->b_data, sizeof(struct allocExtDesc));
                mark_buffer_dirty_inode(*bh, inode);
                udf_release_data(*bh);
                *bh = nbh;
        }
 
-       ret = udf_write_aext(inode, *bloc, extoffset, eloc, elen, *bh, inc);
+       etype = udf_write_aext(inode, *bloc, extoffset, eloc, elen, *bh, inc);
 
        if (!memcmp(&UDF_I_LOCATION(inode), bloc, sizeof(lb_addr)))
        {
@@ -1737,21 +1737,21 @@ Sint8 udf_add_aext(struct inode *inode, lb_addr *bloc, int *extoffset,
        }
        else
        {
-               aed = (struct AllocExtDesc *)(*bh)->b_data;
+               aed = (struct allocExtDesc *)(*bh)->b_data;
                aed->lengthAllocDescs =
                        cpu_to_le32(le32_to_cpu(aed->lengthAllocDescs) + adsize);
                if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) || UDF_SB_UDFREV(inode->i_sb) >= 0x0201)
                        udf_update_tag((*bh)->b_data, *extoffset + (inc ? 0 : adsize));
                else
-                       udf_update_tag((*bh)->b_data, sizeof(struct AllocExtDesc));
+                       udf_update_tag((*bh)->b_data, sizeof(struct allocExtDesc));
                mark_buffer_dirty_inode(*bh, inode);
        }
 
-       return ret;
+       return etype;
 }
 
-Sint8 udf_write_aext(struct inode *inode, lb_addr bloc, int *extoffset,
-    lb_addr eloc, Uint32 elen, struct buffer_head *bh, int inc)
+int8_t udf_write_aext(struct inode *inode, lb_addr bloc, int *extoffset,
+    lb_addr eloc, uint32_t elen, struct buffer_head *bh, int inc)
 {
        int adsize;
        short_ad *sad = NULL;
@@ -1770,23 +1770,23 @@ Sint8 udf_write_aext(struct inode *inode, lb_addr bloc, int *extoffset,
        else
                atomic_inc(&bh->b_count);
 
-       if (UDF_I_ALLOCTYPE(inode) == ICB_FLAG_AD_SHORT)
+       if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_SHORT)
                adsize = sizeof(short_ad);
-       else if (UDF_I_ALLOCTYPE(inode) == ICB_FLAG_AD_LONG)
+       else if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_LONG)
                adsize = sizeof(long_ad);
        else
                return -1;
 
        switch (UDF_I_ALLOCTYPE(inode))
        {
-               case ICB_FLAG_AD_SHORT:
+               case ICBTAG_FLAG_AD_SHORT:
                {
                        sad = (short_ad *)((bh)->b_data + *extoffset);
                        sad->extLength = cpu_to_le32(elen);
                        sad->extPosition = cpu_to_le32(eloc.logicalBlockNum);
                        break;
                }
-               case ICB_FLAG_AD_LONG:
+               case ICBTAG_FLAG_AD_LONG:
                {
                        lad = (long_ad *)((bh)->b_data + *extoffset);
                        lad->extLength = cpu_to_le32(elen);
@@ -1800,9 +1800,9 @@ Sint8 udf_write_aext(struct inode *inode, lb_addr bloc, int *extoffset,
        {
                if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) || UDF_SB_UDFREV(inode->i_sb) >= 0x0201)
                {
-                       struct AllocExtDesc *aed = (struct AllocExtDesc *)(bh)->b_data;
+                       struct allocExtDesc *aed = (struct allocExtDesc *)(bh)->b_data;
                        udf_update_tag((bh)->b_data,
-                               le32_to_cpu(aed->lengthAllocDescs) + sizeof(struct AllocExtDesc));
+                               le32_to_cpu(aed->lengthAllocDescs) + sizeof(struct allocExtDesc));
                }
                mark_buffer_dirty_inode(bh, inode);
        }
@@ -1818,12 +1818,12 @@ Sint8 udf_write_aext(struct inode *inode, lb_addr bloc, int *extoffset,
        return (elen >> 30);
 }
 
-Sint8 udf_next_aext(struct inode *inode, lb_addr *bloc, int *extoffset,
-       lb_addr *eloc, Uint32 *elen, struct buffer_head **bh, int inc)
+int8_t udf_next_aext(struct inode *inode, lb_addr *bloc, int *extoffset,
+       lb_addr *eloc, uint32_t *elen, struct buffer_head **bh, int inc)
 {
-       Uint16 tagIdent;
+       uint16_t tagIdent;
        int pos, alen;
-       Sint8 etype;
+       int8_t etype;
 
        if (!(*bh))
        {
@@ -1840,25 +1840,25 @@ Sint8 udf_next_aext(struct inode *inode, lb_addr *bloc, int *extoffset,
 
        if (!memcmp(&UDF_I_LOCATION(inode), bloc, sizeof(lb_addr)))
        {
-               if (tagIdent == TID_FILE_ENTRY || tagIdent == TID_EXTENDED_FILE_ENTRY ||
+               if (tagIdent == TAG_IDENT_FE || tagIdent == TAG_IDENT_EFE ||
                        UDF_I_NEW_INODE(inode))
                {
                        pos = udf_file_entry_alloc_offset(inode);
                        alen = UDF_I_LENALLOC(inode) + pos;
                }
-               else if (tagIdent == TID_UNALLOCATED_SPACE_ENTRY)
+               else if (tagIdent == TAG_IDENT_USE)
                {
-                       pos = sizeof(struct UnallocatedSpaceEntry);
+                       pos = sizeof(struct unallocSpaceEntry);
                        alen = UDF_I_LENALLOC(inode) + pos;
                }
                else
                        return -1;
        }
-       else if (tagIdent == TID_ALLOC_EXTENT_DESC)
+       else if (tagIdent == TAG_IDENT_AED)
        {
-               struct AllocExtDesc *aed = (struct AllocExtDesc *)(*bh)->b_data;
+               struct allocExtDesc *aed = (struct allocExtDesc *)(*bh)->b_data;
 
-               pos = sizeof(struct AllocExtDesc);
+               pos = sizeof(struct allocExtDesc);
                alen = le32_to_cpu(aed->lengthAllocDescs) + pos;
        }
        else
@@ -1869,14 +1869,14 @@ Sint8 udf_next_aext(struct inode *inode, lb_addr *bloc, int *extoffset,
 
        switch (UDF_I_ALLOCTYPE(inode))
        {
-               case ICB_FLAG_AD_SHORT:
+               case ICBTAG_FLAG_AD_SHORT:
                {
                        short_ad *sad;
 
                        if (!(sad = udf_get_fileshortad((*bh)->b_data, alen, extoffset, inc)))
                                return -1;
 
-                       if ((etype = le32_to_cpu(sad->extLength) >> 30) == EXTENT_NEXT_EXTENT_ALLOCDECS)
+                       if ((etype = le32_to_cpu(sad->extLength) >> 30) == (EXT_NEXT_EXTENT_ALLOCDECS >> 30))
                        {
                                bloc->logicalBlockNum = le32_to_cpu(sad->extPosition);
                                *extoffset = 0;
@@ -1892,14 +1892,14 @@ Sint8 udf_next_aext(struct inode *inode, lb_addr *bloc, int *extoffset,
                        }
                        break;
                }
-               case ICB_FLAG_AD_LONG:
+               case ICBTAG_FLAG_AD_LONG:
                {
                        long_ad *lad;
 
                        if (!(lad = udf_get_filelongad((*bh)->b_data, alen, extoffset, inc)))
                                return -1;
 
-                       if ((etype = le32_to_cpu(lad->extLength) >> 30) == EXTENT_NEXT_EXTENT_ALLOCDECS)
+                       if ((etype = le32_to_cpu(lad->extLength) >> 30) == (EXT_NEXT_EXTENT_ALLOCDECS >> 30))
                        {
                                *bloc = lelb_to_cpu(lad->extLocation);
                                *extoffset = 0;
@@ -1914,11 +1914,11 @@ Sint8 udf_next_aext(struct inode *inode, lb_addr *bloc, int *extoffset,
                        }
                        break;
                }
-               case ICB_FLAG_AD_IN_ICB:
+               case ICBTAG_FLAG_AD_IN_ICB:
                {
                        if (UDF_I_LENALLOC(inode) == 0)
                                return -1;
-                       etype = EXTENT_RECORDED_ALLOCATED;
+                       etype = (EXT_RECORDED_ALLOCATED >> 30);
                        *eloc = UDF_I_LOCATION(inode);
                        *elen = UDF_I_LENALLOC(inode);
                        break;
@@ -1934,18 +1934,18 @@ Sint8 udf_next_aext(struct inode *inode, lb_addr *bloc, int *extoffset,
 
        udf_debug("Empty Extent, inode=%ld, alloctype=%d, eloc=%d, elen=%d, etype=%d, extoffset=%d\n",
                inode->i_ino, UDF_I_ALLOCTYPE(inode), eloc->logicalBlockNum, *elen, etype, *extoffset);
-       if (UDF_I_ALLOCTYPE(inode) == ICB_FLAG_AD_SHORT)
+       if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_SHORT)
                *extoffset -= sizeof(short_ad);
-       else if (UDF_I_ALLOCTYPE(inode) == ICB_FLAG_AD_LONG)
+       else if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_LONG)
                *extoffset -= sizeof(long_ad);
        return -1;
 }
 
-Sint8 udf_current_aext(struct inode *inode, lb_addr *bloc, int *extoffset,
-       lb_addr *eloc, Uint32 *elen, struct buffer_head **bh, int inc)
+int8_t udf_current_aext(struct inode *inode, lb_addr *bloc, int *extoffset,
+       lb_addr *eloc, uint32_t *elen, struct buffer_head **bh, int inc)
 {
        int pos, alen;
-       Sint8 etype;
+       int8_t etype;
 
        if (!(*bh))
        {
@@ -1961,16 +1961,16 @@ Sint8 udf_current_aext(struct inode *inode, lb_addr *bloc, int *extoffset,
        if (!memcmp(&UDF_I_LOCATION(inode), bloc, sizeof(lb_addr)))
        {
                if (!(UDF_I_EXTENDED_FE(inode)))
-                       pos = sizeof(struct FileEntry) + UDF_I_LENEATTR(inode);
+                       pos = sizeof(struct fileEntry) + UDF_I_LENEATTR(inode);
                else
-                       pos = sizeof(struct ExtendedFileEntry) + UDF_I_LENEATTR(inode);
+                       pos = sizeof(struct extendedFileEntry) + UDF_I_LENEATTR(inode);
                alen = UDF_I_LENALLOC(inode) + pos;
        }
        else
        {
-               struct AllocExtDesc *aed = (struct AllocExtDesc *)(*bh)->b_data;
+               struct allocExtDesc *aed = (struct allocExtDesc *)(*bh)->b_data;
 
-               pos = sizeof(struct AllocExtDesc);
+               pos = sizeof(struct allocExtDesc);
                alen = le32_to_cpu(aed->lengthAllocDescs) + pos;
        }
 
@@ -1979,7 +1979,7 @@ Sint8 udf_current_aext(struct inode *inode, lb_addr *bloc, int *extoffset,
 
        switch (UDF_I_ALLOCTYPE(inode))
        {
-               case ICB_FLAG_AD_SHORT:
+               case ICBTAG_FLAG_AD_SHORT:
                {
                        short_ad *sad;
 
@@ -1992,7 +1992,7 @@ Sint8 udf_current_aext(struct inode *inode, lb_addr *bloc, int *extoffset,
                        *elen = le32_to_cpu(sad->extLength) & UDF_EXTENT_LENGTH_MASK;
                        break;
                }
-               case ICB_FLAG_AD_LONG:
+               case ICBTAG_FLAG_AD_LONG:
                {
                        long_ad *lad;
 
@@ -2014,19 +2014,19 @@ Sint8 udf_current_aext(struct inode *inode, lb_addr *bloc, int *extoffset,
                return etype;
 
        udf_debug("Empty Extent!\n");
-       if (UDF_I_ALLOCTYPE(inode) == ICB_FLAG_AD_SHORT)
+       if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_SHORT)
                *extoffset -= sizeof(short_ad);
-       else if (UDF_I_ALLOCTYPE(inode) == ICB_FLAG_AD_LONG)
+       else if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_LONG)
                *extoffset -= sizeof(long_ad);
        return -1;
 }
 
-Sint8 udf_insert_aext(struct inode *inode, lb_addr bloc, int extoffset,
-       lb_addr neloc, Uint32 nelen, struct buffer_head *bh)
+int8_t udf_insert_aext(struct inode *inode, lb_addr bloc, int extoffset,
+       lb_addr neloc, uint32_t nelen, struct buffer_head *bh)
 {
        lb_addr oeloc;
-       Uint32 oelen;
-       Sint8 etype;
+       uint32_t oelen;
+       int8_t etype;
 
        if (!bh)
        {
@@ -2053,14 +2053,14 @@ Sint8 udf_insert_aext(struct inode *inode, lb_addr bloc, int extoffset,
        return (nelen >> 30);
 }
 
-Sint8 udf_delete_aext(struct inode *inode, lb_addr nbloc, int nextoffset,
-       lb_addr eloc, Uint32 elen, struct buffer_head *nbh)
+int8_t udf_delete_aext(struct inode *inode, lb_addr nbloc, int nextoffset,
+       lb_addr eloc, uint32_t elen, struct buffer_head *nbh)
 {
        struct buffer_head *obh;
        lb_addr obloc;
        int oextoffset, adsize;
-       Sint8 etype;
-       struct AllocExtDesc *aed;
+       int8_t etype;
+       struct allocExtDesc *aed;
 
        if (!(nbh))
        {
@@ -2076,9 +2076,9 @@ Sint8 udf_delete_aext(struct inode *inode, lb_addr nbloc, int nextoffset,
                atomic_inc(&nbh->b_count);
        atomic_inc(&nbh->b_count);
 
-       if (UDF_I_ALLOCTYPE(inode) == ICB_FLAG_AD_SHORT)
+       if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_SHORT)
                adsize = sizeof(short_ad);
-       else if (UDF_I_ALLOCTYPE(inode) == ICB_FLAG_AD_LONG)
+       else if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_LONG)
                adsize = sizeof(long_ad);
        else
                adsize = 0;
@@ -2117,13 +2117,13 @@ Sint8 udf_delete_aext(struct inode *inode, lb_addr nbloc, int nextoffset,
                }
                else
                {
-                       aed = (struct AllocExtDesc *)(obh)->b_data;
+                       aed = (struct allocExtDesc *)(obh)->b_data;
                        aed->lengthAllocDescs =
                                cpu_to_le32(le32_to_cpu(aed->lengthAllocDescs) - (2*adsize));
                        if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) || UDF_SB_UDFREV(inode->i_sb) >= 0x0201)
                                udf_update_tag((obh)->b_data, oextoffset - (2*adsize));
                        else
-                               udf_update_tag((obh)->b_data, sizeof(struct AllocExtDesc));
+                               udf_update_tag((obh)->b_data, sizeof(struct allocExtDesc));
                        mark_buffer_dirty_inode(obh, inode);
                }
        }
@@ -2137,13 +2137,13 @@ Sint8 udf_delete_aext(struct inode *inode, lb_addr nbloc, int nextoffset,
                }
                else
                {
-                       aed = (struct AllocExtDesc *)(obh)->b_data;
+                       aed = (struct allocExtDesc *)(obh)->b_data;
                        aed->lengthAllocDescs =
                                cpu_to_le32(le32_to_cpu(aed->lengthAllocDescs) - adsize);
                        if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) || UDF_SB_UDFREV(inode->i_sb) >= 0x0201)
                                udf_update_tag((obh)->b_data, oextoffset - adsize);
                        else
-                               udf_update_tag((obh)->b_data, sizeof(struct AllocExtDesc));
+                               udf_update_tag((obh)->b_data, sizeof(struct allocExtDesc));
                        mark_buffer_dirty_inode(obh, inode);
                }
        }
@@ -2153,11 +2153,11 @@ Sint8 udf_delete_aext(struct inode *inode, lb_addr nbloc, int nextoffset,
        return (elen >> 30);
 }
 
-Sint8 inode_bmap(struct inode *inode, int block, lb_addr *bloc, Uint32 *extoffset,
-       lb_addr *eloc, Uint32 *elen, Uint32 *offset, struct buffer_head **bh)
+int8_t inode_bmap(struct inode *inode, int block, lb_addr *bloc, uint32_t *extoffset,
+       lb_addr *eloc, uint32_t *elen, uint32_t *offset, struct buffer_head **bh)
 {
-       Uint64 lbcount = 0, bcount = (Uint64)block << inode->i_sb->s_blocksize_bits;
-       Sint8 etype;
+       uint64_t lbcount = 0, bcount = (uint64_t)block << inode->i_sb->s_blocksize_bits;
+       int8_t etype;
 
        if (block < 0)
        {
@@ -2193,13 +2193,13 @@ Sint8 inode_bmap(struct inode *inode, int block, lb_addr *bloc, Uint32 *extoffse
 long udf_block_map(struct inode *inode, long block)
 {
        lb_addr eloc, bloc;
-       Uint32 offset, extoffset, elen;
+       uint32_t offset, extoffset, elen;
        struct buffer_head *bh = NULL;
        int ret;
 
        lock_kernel();
 
-       if (inode_bmap(inode, block, &bloc, &extoffset, &eloc, &elen, &offset, &bh) == EXTENT_RECORDED_ALLOCATED)
+       if (inode_bmap(inode, block, &bloc, &extoffset, &eloc, &elen, &offset, &bh) == (EXT_RECORDED_ALLOCATED >> 30))
                ret = udf_get_lb_pblock(inode->i_sb, eloc, offset >> inode->i_sb->s_blocksize_bits);
        else
                ret = 0;
index cb1155319f65facf770171cf276198b0b2a712b0..b89a322820ef3e7f2370ff0c0d742334c822ea2e 100644 (file)
@@ -15,7 +15,7 @@
  *             ftp://prep.ai.mit.edu/pub/gnu/GPL
  *     Each contributing author retains all rights to their own work.
  *
- *  (C) 1999-2000 Ben Fennema
+ *  (C) 1999-2001 Ben Fennema
  *
  * HISTORY
  *
index 3cbebf75fac7eea605153f9fd19376ff9f68c3ee..6a7751b0e5e2b221a04293c02652060ac4f91f1d 100644 (file)
@@ -16,7 +16,7 @@
  *     Each contributing author retains all rights to their own work.
  *
  *  (C) 1998 Dave Boynton
- *  (C) 1998-2000 Ben Fennema
+ *  (C) 1998-2001 Ben Fennema
  *  (C) 1999-2000 Stelias Computing Inc
  *
  * HISTORY
 
 #include "udfdecl.h"
 
-#if defined(__linux__) && defined(__KERNEL__)
-
-#include "udf_sb.h"
-#include "udf_i.h"
-
 #include <linux/fs.h>
 #include <linux/string.h>
 #include <linux/udf_fs.h>
 
-#else
-
-#include <sys/types.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-
-int udf_blocksize=0;
-int udf_errno=0;
-
-void 
-udf_setblocksize(int size)
-{
-       udf_blocksize=size;
-}
-#endif
+#include "udf_i.h"
+#include "udf_sb.h"
 
-Uint32
-udf64_low32(Uint64 indat)
+uint32_t
+udf64_low32(uint64_t indat)
 {
        return indat & 0x00000000FFFFFFFFULL;
 }
 
-Uint32
-udf64_high32(Uint64 indat)
+uint32_t
+udf64_high32(uint64_t indat)
 {
        return indat >> 32;
 }
 
-#if defined(__linux__) && defined(__KERNEL__)
-
 extern struct buffer_head *
 udf_tgetblk(struct super_block *sb, int block)
 {
@@ -84,11 +63,11 @@ udf_tread(struct super_block *sb, int block)
                return sb_bread(sb, block);
 }
 
-extern struct GenericAttrFormat *
-udf_add_extendedattr(struct inode * inode, Uint32 size, Uint32 type,
-       Uint8 loc, struct buffer_head **bh)
+extern struct genericFormat *
+udf_add_extendedattr(struct inode * inode, uint32_t size, uint32_t type,
+       uint8_t loc, struct buffer_head **bh)
 {
-       Uint8 *ea = NULL, *ad = NULL;
+       uint8_t *ea = NULL, *ad = NULL;
        long_ad eaicb;
        int offset;
 
@@ -96,26 +75,26 @@ udf_add_extendedattr(struct inode * inode, Uint32 size, Uint32 type,
 
        if (UDF_I_EXTENDED_FE(inode) == 0)
        {
-               struct FileEntry *fe;
+               struct fileEntry *fe;
 
-               fe = (struct FileEntry *)(*bh)->b_data;
+               fe = (struct fileEntry *)(*bh)->b_data;
                eaicb = lela_to_cpu(fe->extendedAttrICB);
-               offset = sizeof(struct FileEntry);
+               offset = sizeof(struct fileEntry);
        }
        else
        {
-               struct ExtendedFileEntry *efe;
+               struct extendedFileEntry *efe;
 
-               efe = (struct ExtendedFileEntry *)(*bh)->b_data;
+               efe = (struct extendedFileEntry *)(*bh)->b_data;
                eaicb = lela_to_cpu(efe->extendedAttrICB);
-               offset = sizeof(struct ExtendedFileEntry);
+               offset = sizeof(struct extendedFileEntry);
        }
 
        ea = &(*bh)->b_data[offset];
        if (UDF_I_LENEATTR(inode))
                offset += UDF_I_LENEATTR(inode);
        else
-               size += sizeof(struct ExtendedAttrHeaderDesc);
+               size += sizeof(struct extendedAttrHeaderDesc);
 
        ad = &(*bh)->b_data[offset];
        if (UDF_I_LENALLOC(inode))
@@ -127,8 +106,8 @@ udf_add_extendedattr(struct inode * inode, Uint32 size, Uint32 type,
 
        if (loc & 0x01 && offset >= size)
        {
-               struct ExtendedAttrHeaderDesc *eahd;
-               eahd = (struct ExtendedAttrHeaderDesc *)ea;
+               struct extendedAttrHeaderDesc *eahd;
+               eahd = (struct extendedAttrHeaderDesc *)ea;
 
                if (UDF_I_LENALLOC(inode))
                {
@@ -138,7 +117,7 @@ udf_add_extendedattr(struct inode * inode, Uint32 size, Uint32 type,
                if (UDF_I_LENEATTR(inode))
                {
                        /* check checksum/crc */
-                       if (le16_to_cpu(eahd->descTag.tagIdent) != TID_EXTENDED_ATTRE_HEADER_DESC ||
+                       if (le16_to_cpu(eahd->descTag.tagIdent) != TAG_IDENT_EAHD ||
                                le32_to_cpu(eahd->descTag.tagLocation) != UDF_I_LOCATION(inode).logicalBlockNum)
                        {
                                udf_release_data(*bh);
@@ -147,9 +126,9 @@ udf_add_extendedattr(struct inode * inode, Uint32 size, Uint32 type,
                }
                else
                {
-                       size -= sizeof(struct ExtendedAttrHeaderDesc);
-                       UDF_I_LENEATTR(inode) += sizeof(struct ExtendedAttrHeaderDesc);
-                       eahd->descTag.tagIdent = cpu_to_le16(TID_EXTENDED_ATTRE_HEADER_DESC);
+                       size -= sizeof(struct extendedAttrHeaderDesc);
+                       UDF_I_LENEATTR(inode) += sizeof(struct extendedAttrHeaderDesc);
+                       eahd->descTag.tagIdent = cpu_to_le16(TAG_IDENT_EAHD);
                        eahd->descTag.descVersion = cpu_to_le16(2);
                        eahd->descTag.tagSerialNum = cpu_to_le16(1);
                        eahd->descTag.tagLocation = cpu_to_le32(UDF_I_LOCATION(inode).logicalBlockNum);
@@ -162,7 +141,7 @@ udf_add_extendedattr(struct inode * inode, Uint32 size, Uint32 type,
                {
                        if (le32_to_cpu(eahd->appAttrLocation) < UDF_I_LENEATTR(inode))
                        {
-                               Uint32 aal = le32_to_cpu(eahd->appAttrLocation);
+                               uint32_t aal = le32_to_cpu(eahd->appAttrLocation);
                                memmove(&ea[offset - aal + size],
                                        &ea[aal], offset - aal);
                                offset -= aal;
@@ -170,7 +149,7 @@ udf_add_extendedattr(struct inode * inode, Uint32 size, Uint32 type,
                        }
                        if (le32_to_cpu(eahd->impAttrLocation) < UDF_I_LENEATTR(inode))
                        {
-                               Uint32 ial = le32_to_cpu(eahd->impAttrLocation);
+                               uint32_t ial = le32_to_cpu(eahd->impAttrLocation);
                                memmove(&ea[offset - ial + size],
                                        &ea[ial], offset - ial);
                                offset -= ial;
@@ -181,7 +160,7 @@ udf_add_extendedattr(struct inode * inode, Uint32 size, Uint32 type,
                {
                        if (le32_to_cpu(eahd->appAttrLocation) < UDF_I_LENEATTR(inode))
                        {
-                               Uint32 aal = le32_to_cpu(eahd->appAttrLocation);
+                               uint32_t aal = le32_to_cpu(eahd->appAttrLocation);
                                memmove(&ea[offset - aal + size],
                                        &ea[aal], offset - aal);
                                offset -= aal;
@@ -190,7 +169,7 @@ udf_add_extendedattr(struct inode * inode, Uint32 size, Uint32 type,
                }
                /* rewrite CRC + checksum of eahd */
                UDF_I_LENEATTR(inode) += size;
-               return (struct GenericAttrFormat *)&ea[offset];
+               return (struct genericFormat *)&ea[offset];
        }
        if (loc & 0x02)
        {
@@ -199,31 +178,31 @@ udf_add_extendedattr(struct inode * inode, Uint32 size, Uint32 type,
        return NULL;
 }
 
-extern struct GenericAttrFormat *
-udf_get_extendedattr(struct inode * inode, Uint32 type, Uint8 subtype,
+extern struct genericFormat *
+udf_get_extendedattr(struct inode * inode, uint32_t type, uint8_t subtype,
        struct buffer_head **bh)
 {
-       struct GenericAttrFormat *gaf;
-       Uint8 *ea = NULL;
+       struct genericFormat *gaf;
+       uint8_t *ea = NULL;
        long_ad eaicb;
-       Uint32 offset;
+       uint32_t offset;
 
        *bh = udf_tread(inode->i_sb, inode->i_ino);
 
        if (UDF_I_EXTENDED_FE(inode) == 0)
        {
-               struct FileEntry *fe;
+               struct fileEntry *fe;
 
-               fe = (struct FileEntry *)(*bh)->b_data;
+               fe = (struct fileEntry *)(*bh)->b_data;
                eaicb = lela_to_cpu(fe->extendedAttrICB);
                if (UDF_I_LENEATTR(inode))
                        ea = fe->extendedAttr;
        }
        else
        {
-               struct ExtendedFileEntry *efe;
+               struct extendedFileEntry *efe;
 
-               efe = (struct ExtendedFileEntry *)(*bh)->b_data;
+               efe = (struct extendedFileEntry *)(*bh)->b_data;
                eaicb = lela_to_cpu(efe->extendedAttrICB);
                if (UDF_I_LENEATTR(inode))
                        ea = efe->extendedAttr;
@@ -231,11 +210,11 @@ udf_get_extendedattr(struct inode * inode, Uint32 type, Uint8 subtype,
 
        if (UDF_I_LENEATTR(inode))
        {
-               struct ExtendedAttrHeaderDesc *eahd;
-               eahd = (struct ExtendedAttrHeaderDesc *)ea;
+               struct extendedAttrHeaderDesc *eahd;
+               eahd = (struct extendedAttrHeaderDesc *)ea;
 
                /* check checksum/crc */
-               if (le16_to_cpu(eahd->descTag.tagIdent) != TID_EXTENDED_ATTRE_HEADER_DESC ||
+               if (le16_to_cpu(eahd->descTag.tagIdent) != TAG_IDENT_EAHD ||
                        le32_to_cpu(eahd->descTag.tagLocation) != UDF_I_LOCATION(inode).logicalBlockNum)
                {
                        udf_release_data(*bh);
@@ -243,7 +222,7 @@ udf_get_extendedattr(struct inode * inode, Uint32 type, Uint8 subtype,
                }
        
                if (type < 2048)
-                       offset = sizeof(struct ExtendedAttrHeaderDesc);
+                       offset = sizeof(struct extendedAttrHeaderDesc);
                else if (type < 65536)
                        offset = le32_to_cpu(eahd->impAttrLocation);
                else
@@ -251,7 +230,7 @@ udf_get_extendedattr(struct inode * inode, Uint32 type, Uint8 subtype,
 
                while (offset < UDF_I_LENEATTR(inode))
                {
-                       gaf = (struct GenericAttrFormat *)&ea[offset];
+                       gaf = (struct genericFormat *)&ea[offset];
                        if (le32_to_cpu(gaf->attrType) == type && gaf->attrSubtype == subtype)
                                return gaf;
                        else
@@ -267,22 +246,6 @@ udf_get_extendedattr(struct inode * inode, Uint32 type, Uint8 subtype,
        return NULL;
 }
 
-extern struct buffer_head *
-udf_read_untagged(struct super_block *sb, Uint32 block, Uint32 offset)
-{
-       struct buffer_head *bh = NULL;
-
-       /* Read the block */
-       bh = udf_tread(sb, block+offset);
-       if (!bh)
-       {
-               printk(KERN_ERR "udf: udf_read_untagged(%p,%d,%d) failed\n",
-                       sb, block, offset);
-               return NULL;
-       }
-       return bh;
-}
-
 /*
  * udf_read_tagged
  *
@@ -294,11 +257,11 @@ udf_read_untagged(struct super_block *sb, Uint32 block, Uint32 offset)
  *     Written, tested, and released.
  */
 extern struct buffer_head *
-udf_read_tagged(struct super_block *sb, Uint32 block, Uint32 location, Uint16 *ident)
+udf_read_tagged(struct super_block *sb, uint32_t block, uint32_t location, uint16_t *ident)
 {
        tag *tag_p;
        struct buffer_head *bh = NULL;
-       register Uint8 checksum;
+       register uint8_t checksum;
        register int i;
 
        /* Read the block */
@@ -326,9 +289,9 @@ udf_read_tagged(struct super_block *sb, Uint32 block, Uint32 location, Uint16 *i
        /* Verify the tag checksum */
        checksum = 0U;
        for (i = 0; i < 4; i++)
-               checksum += (Uint8)(bh->b_data[i]);
+               checksum += (uint8_t)(bh->b_data[i]);
        for (i = 5; i < 16; i++)
-               checksum += (Uint8)(bh->b_data[i]);
+               checksum += (uint8_t)(bh->b_data[i]);
        if (checksum != tag_p->tagChecksum) {
                printk(KERN_ERR "udf: tag checksum failed block %d\n", block);
                goto error_out;
@@ -359,7 +322,7 @@ error_out:
 }
 
 extern struct buffer_head *
-udf_read_ptagged(struct super_block *sb, lb_addr loc, Uint32 offset, Uint16 *ident)
+udf_read_ptagged(struct super_block *sb, lb_addr loc, uint32_t offset, uint16_t *ident)
 {
        return udf_read_tagged(sb, udf_get_lb_pblock(sb, loc, offset),
                loc.logicalBlockNum + offset, ident);
@@ -371,8 +334,6 @@ void udf_release_data(struct buffer_head *bh)
                brelse(bh);
 }
 
-#endif
-
 void udf_update_tag(char *data, int length)
 {
        tag *tptr = (tag *)data;
@@ -386,11 +347,11 @@ void udf_update_tag(char *data, int length)
 
        for (i=0; i<16; i++)
                if (i != 4)
-                       tptr->tagChecksum += (Uint8)(data[i]);
+                       tptr->tagChecksum += (uint8_t)(data[i]);
 }
 
-void udf_new_tag(char *data, Uint16 ident, Uint16 version, Uint16 snum,
-       Uint32 loc, int length)
+void udf_new_tag(char *data, uint16_t ident, uint16_t version, uint16_t snum,
+       uint32_t loc, int length)
 {
        tag *tptr = (tag *)data;
        tptr->tagIdent = le16_to_cpu(ident);
@@ -399,114 +360,3 @@ void udf_new_tag(char *data, Uint16 ident, Uint16 version, Uint16 snum,
        tptr->tagLocation = le32_to_cpu(loc);
        udf_update_tag(data, length);
 }
-
-#ifndef __KERNEL__
-/*
- * udf_read_tagged_data
- *
- * PURPOSE
- *     Read the first block of a tagged descriptor.
- *     Usable from user-land.
- *
- * HISTORY
- *       10/4/98 dgb: written
- */
-int
-udf_read_tagged_data(char *buffer, int size, int fd, int block, int offset)
-{
-       tag *tag_p;
-       register Uint8 checksum;
-       register int i;
-       unsigned long offs;
-
-       if (!buffer)
-       {
-               udf_errno = 1;
-               return -1;
-       }
-
-       if ( !udf_blocksize )
-       {
-               udf_errno = 2;
-               return -1;
-       }
-
-       if ( size < udf_blocksize )
-       {
-               udf_errno = 3;
-               return -1;
-       }
-       udf_errno = 0;
-       
-       offs = (long)block * udf_blocksize;
-       if ( lseek(fd, offs, SEEK_SET) != offs )
-       {
-               udf_errno = 4;
-               return -1;
-       }
-
-       i = read(fd, buffer, udf_blocksize);
-       if ( i < udf_blocksize )
-       {
-               udf_errno = 5;
-               return -1;
-       }
-
-       tag_p = (tag *)(buffer);
-
-       /* Verify the tag location */
-       if ((block-offset) != tag_p->tagLocation)
-       {
-#ifdef __KERNEL__
-               printk(KERN_ERR "udf: location mismatch block %d, tag %d\n",
-                       block, tag_p->tagLocation);
-#else
-               udf_errno = 6;
-#endif
-               goto error_out;
-       }
-       
-       /* Verify the tag checksum */
-       checksum = 0U;
-       for (i = 0; i < 4; i++)
-               checksum += (Uint8)(buffer[i]);
-       for (i = 5; i < 16; i++)
-               checksum += (Uint8)(buffer[i]);
-       if (checksum != tag_p->tagChecksum)
-       {
-#ifdef __KERNEL__
-               printk(KERN_ERR "udf: tag checksum failed\n");
-#else
-               udf_errno = 7;
-#endif
-               goto error_out;
-       }
-
-       /* Verify the tag version */
-       if (tag_p->descVersion != 0x0002U)
-       {
-#ifdef __KERNEL__
-               printk(KERN_ERR "udf: tag version 0x%04x != 0x0002U\n",
-                       tag_p->descVersion);
-#else
-               udf_errno = 8;
-#endif
-               goto error_out;
-       }
-
-       /* Verify the descriptor CRC */
-       if (tag_p->descCRC == udf_crc(buffer + 16, tag_p->descCRCLength, 0))
-       {
-               udf_errno = 0;
-               return 0;
-       }
-#ifdef __KERNEL__
-       printk(KERN_ERR "udf: crc failure in udf_read_tagged\n");
-#else
-       udf_errno = 9;
-#endif
-
-error_out:
-       return -1;
-}
-#endif
index dd74d84d4c911c58adae59b8064d352a94d2b812..1b613e35dfb0b7a2dafedd73c06c8255497b8611 100644 (file)
@@ -15,7 +15,7 @@
  *              ftp://prep.ai.mit.edu/pub/gnu/GPL
  *      Each contributing author retains all rights to their own work.
  *
- *  (C) 1998-2000 Ben Fennema
+ *  (C) 1998-2001 Ben Fennema
  *  (C) 1999-2000 Stelias Computing Inc
  *
  * HISTORY
@@ -35,7 +35,6 @@
 #include <linux/quotaops.h>
 #include <linux/locks.h>
 #include <linux/smp_lock.h>
-#include <linux/udf_fs.h>
 
 static inline int udf_match(int len, const char * const name, struct qstr *qs)
 {
@@ -44,31 +43,31 @@ static inline int udf_match(int len, const char * const name, struct qstr *qs)
        return !memcmp(name, qs->name, len);
 }
 
-int udf_write_fi(struct inode *inode, struct FileIdentDesc *cfi,
-       struct FileIdentDesc *sfi, struct udf_fileident_bh *fibh,
-       Uint8 *impuse, Uint8 *fileident)
+int udf_write_fi(struct inode *inode, struct fileIdentDesc *cfi,
+       struct fileIdentDesc *sfi, struct udf_fileident_bh *fibh,
+       uint8_t *impuse, uint8_t *fileident)
 {
-       Uint16 crclen = fibh->eoffset - fibh->soffset - sizeof(tag);
-       Uint16 crc;
-       Uint8 checksum = 0;
+       uint16_t crclen = fibh->eoffset - fibh->soffset - sizeof(tag);
+       uint16_t crc;
+       uint8_t checksum = 0;
        int i;
        int offset;
-       Uint16 liu = le16_to_cpu(cfi->lengthOfImpUse);
-       Uint8 lfi = cfi->lengthFileIdent;
+       uint16_t liu = le16_to_cpu(cfi->lengthOfImpUse);
+       uint8_t lfi = cfi->lengthFileIdent;
        int padlen = fibh->eoffset - fibh->soffset - liu - lfi -
-               sizeof(struct FileIdentDesc);
+               sizeof(struct fileIdentDesc);
 
-       offset = fibh->soffset + sizeof(struct FileIdentDesc);
+       offset = fibh->soffset + sizeof(struct fileIdentDesc);
 
        if (impuse)
        {
                if (offset + liu < 0)
-                       memcpy((Uint8 *)sfi->impUse, impuse, liu);
+                       memcpy((uint8_t *)sfi->impUse, impuse, liu);
                else if (offset >= 0)
                        memcpy(fibh->ebh->b_data + offset, impuse, liu);
                else
                {
-                       memcpy((Uint8 *)sfi->impUse, impuse, -offset);
+                       memcpy((uint8_t *)sfi->impUse, impuse, -offset);
                        memcpy(fibh->ebh->b_data, impuse - offset, liu + offset);
                }
        }
@@ -78,12 +77,12 @@ int udf_write_fi(struct inode *inode, struct FileIdentDesc *cfi,
        if (fileident)
        {
                if (offset + lfi < 0)
-                       memcpy((Uint8 *)sfi->fileIdent + liu, fileident, lfi);
+                       memcpy((uint8_t *)sfi->fileIdent + liu, fileident, lfi);
                else if (offset >= 0)
                        memcpy(fibh->ebh->b_data + offset, fileident, lfi);
                else
                {
-                       memcpy((Uint8 *)sfi->fileIdent + liu, fileident, -offset);
+                       memcpy((uint8_t *)sfi->fileIdent + liu, fileident, -offset);
                        memcpy(fibh->ebh->b_data, fileident - offset, lfi + offset);
                }
        }
@@ -91,28 +90,28 @@ int udf_write_fi(struct inode *inode, struct FileIdentDesc *cfi,
        offset += lfi;
 
        if (offset + padlen < 0)
-               memset((Uint8 *)sfi->padding + liu + lfi, 0x00, padlen);
+               memset((uint8_t *)sfi->padding + liu + lfi, 0x00, padlen);
        else if (offset >= 0)
                memset(fibh->ebh->b_data + offset, 0x00, padlen);
        else
        {
-               memset((Uint8 *)sfi->padding + liu + lfi, 0x00, -offset);
+               memset((uint8_t *)sfi->padding + liu + lfi, 0x00, -offset);
                memset(fibh->ebh->b_data, 0x00, padlen + offset);
        }
 
-       crc = udf_crc((Uint8 *)cfi + sizeof(tag), sizeof(struct FileIdentDesc) -
+       crc = udf_crc((uint8_t *)cfi + sizeof(tag), sizeof(struct fileIdentDesc) -
                sizeof(tag), 0);
 
        if (fibh->sbh == fibh->ebh)
-               crc = udf_crc((Uint8 *)sfi->impUse,
-                       crclen + sizeof(tag) - sizeof(struct FileIdentDesc), crc);
-       else if (sizeof(struct FileIdentDesc) >= -fibh->soffset)
-               crc = udf_crc(fibh->ebh->b_data + sizeof(struct FileIdentDesc) + fibh->soffset,
-                       crclen + sizeof(tag) - sizeof(struct FileIdentDesc), crc);
+               crc = udf_crc((uint8_t *)sfi->impUse,
+                       crclen + sizeof(tag) - sizeof(struct fileIdentDesc), crc);
+       else if (sizeof(struct fileIdentDesc) >= -fibh->soffset)
+               crc = udf_crc(fibh->ebh->b_data + sizeof(struct fileIdentDesc) + fibh->soffset,
+                       crclen + sizeof(tag) - sizeof(struct fileIdentDesc), crc);
        else
        {
-               crc = udf_crc((Uint8 *)sfi->impUse,
-                       -fibh->soffset - sizeof(struct FileIdentDesc), crc);
+               crc = udf_crc((uint8_t *)sfi->impUse,
+                       -fibh->soffset - sizeof(struct fileIdentDesc), crc);
                crc = udf_crc(fibh->ebh->b_data, fibh->eoffset, crc);
        }
 
@@ -121,16 +120,16 @@ int udf_write_fi(struct inode *inode, struct FileIdentDesc *cfi,
 
        for (i=0; i<16; i++)
                if (i != 4)
-                       checksum += ((Uint8 *)&cfi->descTag)[i];
+                       checksum += ((uint8_t *)&cfi->descTag)[i];
 
        cfi->descTag.tagChecksum = checksum;
-       if (sizeof(struct FileIdentDesc) <= -fibh->soffset)
-               memcpy((Uint8 *)sfi, (Uint8 *)cfi, sizeof(struct FileIdentDesc));
+       if (sizeof(struct fileIdentDesc) <= -fibh->soffset)
+               memcpy((uint8_t *)sfi, (uint8_t *)cfi, sizeof(struct fileIdentDesc));
        else
        {
-               memcpy((Uint8 *)sfi, (Uint8 *)cfi, -fibh->soffset);
-               memcpy(fibh->ebh->b_data, (Uint8 *)cfi - fibh->soffset,
-                       sizeof(struct FileIdentDesc) + fibh->soffset);
+               memcpy((uint8_t *)sfi, (uint8_t *)cfi, -fibh->soffset);
+               memcpy(fibh->ebh->b_data, (uint8_t *)cfi - fibh->soffset,
+                       sizeof(struct fileIdentDesc) + fibh->soffset);
        }
 
        if (fibh->sbh != fibh->ebh)
@@ -139,21 +138,21 @@ int udf_write_fi(struct inode *inode, struct FileIdentDesc *cfi,
        return 0;
 }
 
-static struct FileIdentDesc *
+static struct fileIdentDesc *
 udf_find_entry(struct inode *dir, struct dentry *dentry,
        struct udf_fileident_bh *fibh,
-       struct FileIdentDesc *cfi)
+       struct fileIdentDesc *cfi)
 {
-       struct FileIdentDesc *fi=NULL;
+       struct fileIdentDesc *fi=NULL;
        loff_t f_pos;
        int block, flen;
        char fname[255];
        char *nameptr;
-       Uint8 lfi;
-       Uint16 liu;
+       uint8_t lfi;
+       uint16_t liu;
        loff_t size = (udf_ext0_offset(dir) + dir->i_size) >> 2;
        lb_addr bloc, eloc;
-       Uint32 extoffset, elen, offset;
+       uint32_t extoffset, elen, offset;
        struct buffer_head *bh = NULL;
 
        if (!dir)
@@ -163,15 +162,15 @@ udf_find_entry(struct inode *dir, struct dentry *dentry,
 
        fibh->soffset = fibh->eoffset = (f_pos & ((dir->i_sb->s_blocksize - 1) >> 2)) << 2;
        if (inode_bmap(dir, f_pos >> (dir->i_sb->s_blocksize_bits - 2),
-               &bloc, &extoffset, &eloc, &elen, &offset, &bh) == EXTENT_RECORDED_ALLOCATED)
+               &bloc, &extoffset, &eloc, &elen, &offset, &bh) == (EXT_RECORDED_ALLOCATED >> 30))
        {
                offset >>= dir->i_sb->s_blocksize_bits;
                block = udf_get_lb_pblock(dir->i_sb, eloc, offset);
                if ((++offset << dir->i_sb->s_blocksize_bits) < elen)
                {
-                       if (UDF_I_ALLOCTYPE(dir) == ICB_FLAG_AD_SHORT)
+                       if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_SHORT)
                                extoffset -= sizeof(short_ad);
-                       else if (UDF_I_ALLOCTYPE(dir) == ICB_FLAG_AD_LONG)
+                       else if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_LONG)
                                extoffset -= sizeof(long_ad);
                }
                else
@@ -213,10 +212,10 @@ udf_find_entry(struct inode *dir, struct dentry *dentry,
                {
                        int poffset;    /* Unpaded ending offset */
 
-                       poffset = fibh->soffset + sizeof(struct FileIdentDesc) + liu + lfi;
+                       poffset = fibh->soffset + sizeof(struct fileIdentDesc) + liu + lfi;
 
                        if (poffset >= lfi)
-                               nameptr = (Uint8 *)(fibh->ebh->b_data + poffset - lfi);
+                               nameptr = (uint8_t *)(fibh->ebh->b_data + poffset - lfi);
                        else
                        {
                                nameptr = fname;
@@ -225,13 +224,13 @@ udf_find_entry(struct inode *dir, struct dentry *dentry,
                        }
                }
 
-               if ( (cfi->fileCharacteristics & FILE_DELETED) != 0 )
+               if ( (cfi->fileCharacteristics & FID_FILE_CHAR_DELETED) != 0 )
                {
                        if ( !UDF_QUERY_FLAG(dir->i_sb, UDF_FLAG_UNDELETE) )
                                continue;
                }
            
-               if ( (cfi->fileCharacteristics & FILE_HIDDEN) != 0 )
+               if ( (cfi->fileCharacteristics & FID_FILE_CHAR_HIDDEN) != 0 )
                {
                        if ( !UDF_QUERY_FLAG(dir->i_sb, UDF_FLAG_UNHIDE) )
                                continue;
@@ -292,7 +291,7 @@ static struct dentry *
 udf_lookup(struct inode *dir, struct dentry *dentry)
 {
        struct inode *inode = NULL;
-       struct FileIdentDesc cfi, *fi;
+       struct fileIdentDesc cfi, *fi;
        struct udf_fileident_bh fibh;
 
        if (dentry->d_name.len > UDF_NAME_LEN)
@@ -330,13 +329,13 @@ udf_lookup(struct inode *dir, struct dentry *dentry)
        return NULL;
 }
 
-static struct FileIdentDesc *
+static struct fileIdentDesc *
 udf_add_entry(struct inode *dir, struct dentry *dentry,
        struct udf_fileident_bh *fibh,
-       struct FileIdentDesc *cfi, int *err)
+       struct fileIdentDesc *cfi, int *err)
 {
        struct super_block *sb;
-       struct FileIdentDesc *fi=NULL;
+       struct fileIdentDesc *fi=NULL;
        struct ustr unifilename;
        char name[UDF_NAME_LEN], fname[UDF_NAME_LEN];
        int namelen;
@@ -345,11 +344,11 @@ udf_add_entry(struct inode *dir, struct dentry *dentry,
        char *nameptr;
        loff_t size = (udf_ext0_offset(dir) + dir->i_size) >> 2;
        int nfidlen;
-       Uint8 lfi;
-       Uint16 liu;
+       uint8_t lfi;
+       uint16_t liu;
        int block;
        lb_addr bloc, eloc;
-       Uint32 extoffset, elen, offset;
+       uint32_t extoffset, elen, offset;
        struct buffer_head *bh = NULL;
 
        sb = dir->i_sb;
@@ -390,21 +389,21 @@ udf_add_entry(struct inode *dir, struct dentry *dentry,
        else
                namelen = 0;
 
-       nfidlen = (sizeof(struct FileIdentDesc) + namelen + 3) & ~3;
+       nfidlen = (sizeof(struct fileIdentDesc) + namelen + 3) & ~3;
 
        f_pos = (udf_ext0_offset(dir) >> 2);
 
        fibh->soffset = fibh->eoffset = (f_pos & ((dir->i_sb->s_blocksize - 1) >> 2)) << 2;
        if (inode_bmap(dir, f_pos >> (dir->i_sb->s_blocksize_bits - 2),
-               &bloc, &extoffset, &eloc, &elen, &offset, &bh) == EXTENT_RECORDED_ALLOCATED)
+               &bloc, &extoffset, &eloc, &elen, &offset, &bh) == (EXT_RECORDED_ALLOCATED >> 30))
        {
                offset >>= dir->i_sb->s_blocksize_bits;
                block = udf_get_lb_pblock(dir->i_sb, eloc, offset);
                if ((++offset << dir->i_sb->s_blocksize_bits) < elen)
                {
-                       if (UDF_I_ALLOCTYPE(dir) == ICB_FLAG_AD_SHORT)
+                       if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_SHORT)
                                extoffset -= sizeof(short_ad);
-                       else if (UDF_I_ALLOCTYPE(dir) == ICB_FLAG_AD_LONG)
+                       else if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_LONG)
                                extoffset -= sizeof(long_ad);
                }
                else
@@ -442,7 +441,7 @@ udf_add_entry(struct inode *dir, struct dentry *dentry,
                        {
                                int poffset;    /* Unpaded ending offset */
        
-                               poffset = fibh->soffset + sizeof(struct FileIdentDesc) + liu + lfi;
+                               poffset = fibh->soffset + sizeof(struct fileIdentDesc) + liu + lfi;
        
                                if (poffset >= lfi)
                                        nameptr = (char *)(fibh->ebh->b_data + poffset - lfi);
@@ -454,9 +453,9 @@ udf_add_entry(struct inode *dir, struct dentry *dentry,
                                }
                        }
        
-                       if ( (cfi->fileCharacteristics & FILE_DELETED) != 0 )
+                       if ( (cfi->fileCharacteristics & FID_FILE_CHAR_DELETED) != 0 )
                        {
-                               if (((sizeof(struct FileIdentDesc) + liu + lfi + 3) & ~3) == nfidlen)
+                               if (((sizeof(struct fileIdentDesc) + liu + lfi + 3) & ~3) == nfidlen)
                                {
                                        udf_release_data(bh);
                                        cfi->descTag.tagSerialNum = cpu_to_le16(1);
@@ -492,7 +491,7 @@ udf_add_entry(struct inode *dir, struct dentry *dentry,
        else
        {
                block = udf_get_lb_pblock(dir->i_sb, UDF_I_LOCATION(dir), 0);
-               if (UDF_I_ALLOCTYPE(dir) == ICB_FLAG_AD_IN_ICB)
+               if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_IN_ICB)
                {
                        fibh->sbh = fibh->ebh = udf_tread(dir->i_sb, block);
                        fibh->soffset = fibh->eoffset = udf_file_entry_alloc_offset(dir);
@@ -506,7 +505,7 @@ udf_add_entry(struct inode *dir, struct dentry *dentry,
 
        f_pos += nfidlen;
 
-       if (UDF_I_ALLOCTYPE(dir) == ICB_FLAG_AD_IN_ICB &&
+       if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_IN_ICB &&
                sb->s_blocksize - fibh->eoffset < nfidlen)
        {
                udf_release_data(bh);
@@ -524,9 +523,9 @@ udf_add_entry(struct inode *dir, struct dentry *dentry,
                eloc.partitionReferenceNum = UDF_I_LOCATION(dir).partitionReferenceNum;
                elen = dir->i_sb->s_blocksize;
                extoffset = udf_file_entry_alloc_offset(dir);
-               if (UDF_I_ALLOCTYPE(dir) == ICB_FLAG_AD_SHORT)
+               if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_SHORT)
                        extoffset += sizeof(short_ad);
-               else if (UDF_I_ALLOCTYPE(dir) == ICB_FLAG_AD_LONG)
+               else if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_LONG)
                        extoffset += sizeof(long_ad);
        }
 
@@ -540,13 +539,13 @@ udf_add_entry(struct inode *dir, struct dentry *dentry,
                        fibh->sbh = fibh->ebh;
                }
 
-               if (UDF_I_ALLOCTYPE(dir) != ICB_FLAG_AD_IN_ICB)
+               if (UDF_I_ALLOCTYPE(dir) != ICBTAG_FLAG_AD_IN_ICB)
                        block = eloc.logicalBlockNum + ((elen - 1) >>
                                dir->i_sb->s_blocksize_bits);
                else
                        block = UDF_I_LOCATION(dir).logicalBlockNum;
                                
-               fi = (struct FileIdentDesc *)(fibh->sbh->b_data + fibh->soffset);
+               fi = (struct fileIdentDesc *)(fibh->sbh->b_data + fibh->soffset);
        }
        else
        {
@@ -571,7 +570,7 @@ udf_add_entry(struct inode *dir, struct dentry *dentry,
                if (!(fibh->soffset))
                {
                        if (udf_next_aext(dir, &bloc, &extoffset, &eloc, &elen, &bh, 1) ==
-                               EXTENT_RECORDED_ALLOCATED)
+                               (EXT_RECORDED_ALLOCATED >> 30))
                        {
                                block = eloc.logicalBlockNum + ((elen - 1) >>
                                        dir->i_sb->s_blocksize_bits);
@@ -581,20 +580,20 @@ udf_add_entry(struct inode *dir, struct dentry *dentry,
 
                        udf_release_data(fibh->sbh);
                        fibh->sbh = fibh->ebh;
-                       fi = (struct FileIdentDesc *)(fibh->sbh->b_data);
+                       fi = (struct fileIdentDesc *)(fibh->sbh->b_data);
                }
                else
                {
-                       fi = (struct FileIdentDesc *)
+                       fi = (struct fileIdentDesc *)
                                (fibh->sbh->b_data + sb->s_blocksize + fibh->soffset);
                }
        }
 
-       memset(cfi, 0, sizeof(struct FileIdentDesc));
+       memset(cfi, 0, sizeof(struct fileIdentDesc));
        if (UDF_SB_UDFREV(sb) >= 0x0200)
-               udf_new_tag((char *)cfi, TID_FILE_IDENT_DESC, 3, 1, block, sizeof(tag));
+               udf_new_tag((char *)cfi, TAG_IDENT_FID, 3, 1, block, sizeof(tag));
        else
-               udf_new_tag((char *)cfi, TID_FILE_IDENT_DESC, 2, 1, block, sizeof(tag));
+               udf_new_tag((char *)cfi, TAG_IDENT_FID, 2, 1, block, sizeof(tag));
        cfi->fileVersionNum = cpu_to_le16(1);
        cfi->lengthFileIdent = namelen;
        cfi->lengthOfImpUse = cpu_to_le16(0);
@@ -602,7 +601,7 @@ udf_add_entry(struct inode *dir, struct dentry *dentry,
        {
                udf_release_data(bh);
                dir->i_size += nfidlen;
-               if (UDF_I_ALLOCTYPE(dir) == ICB_FLAG_AD_IN_ICB)
+               if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_IN_ICB)
                        UDF_I_LENALLOC(dir) += nfidlen;
                mark_inode_dirty(dir);
                return fi;
@@ -618,10 +617,10 @@ udf_add_entry(struct inode *dir, struct dentry *dentry,
        }
 }
 
-static int udf_delete_entry(struct inode *inode, struct FileIdentDesc *fi,
-       struct udf_fileident_bh *fibh, struct FileIdentDesc *cfi)
+static int udf_delete_entry(struct inode *inode, struct fileIdentDesc *fi,
+       struct udf_fileident_bh *fibh, struct fileIdentDesc *cfi)
 {
-       cfi->fileCharacteristics |= FILE_DELETED;
+       cfi->fileCharacteristics |= FID_FILE_CHAR_DELETED;
        if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT))
                memset(&(cfi->icb), 0x00, sizeof(long_ad));
        return udf_write_fi(inode, cfi, fi, fibh, NULL, NULL);
@@ -631,7 +630,7 @@ static int udf_create(struct inode *dir, struct dentry *dentry, int mode)
 {
        struct udf_fileident_bh fibh;
        struct inode *inode;
-       struct FileIdentDesc cfi, *fi;
+       struct fileIdentDesc cfi, *fi;
        int err;
 
        lock_kernel();
@@ -641,7 +640,7 @@ static int udf_create(struct inode *dir, struct dentry *dentry, int mode)
                return err;
        }
 
-       if (UDF_I_ALLOCTYPE(inode) == ICB_FLAG_AD_IN_ICB)
+       if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_IN_ICB)
                inode->i_data.a_ops = &udf_adinicb_aops;
        else
                inode->i_data.a_ops = &udf_aops;
@@ -660,10 +659,10 @@ static int udf_create(struct inode *dir, struct dentry *dentry, int mode)
        }
        cfi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize);
        cfi.icb.extLocation = cpu_to_lelb(UDF_I_LOCATION(inode));
-       *(Uint32 *)((struct ADImpUse *)cfi.icb.impUse)->impUse =
+       *(uint32_t *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse =
                cpu_to_le32(UDF_I_UNIQUE(inode) & 0x00000000FFFFFFFFUL);
        udf_write_fi(dir, &cfi, fi, &fibh, NULL, NULL);
-       if (UDF_I_ALLOCTYPE(dir) == ICB_FLAG_AD_IN_ICB)
+       if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_IN_ICB)
        {
                mark_inode_dirty(dir);
        }
@@ -680,7 +679,7 @@ static int udf_mknod(struct inode * dir, struct dentry * dentry, int mode, int r
        struct inode * inode;
        struct udf_fileident_bh fibh;
        int err;
-       struct FileIdentDesc cfi, *fi;
+       struct fileIdentDesc cfi, *fi;
 
        lock_kernel();
        err = -EIO;
@@ -700,10 +699,10 @@ static int udf_mknod(struct inode * dir, struct dentry * dentry, int mode, int r
        }
        cfi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize);
        cfi.icb.extLocation = cpu_to_lelb(UDF_I_LOCATION(inode));
-       *(Uint32 *)((struct ADImpUse *)cfi.icb.impUse)->impUse =
+       *(uint32_t *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse =
                cpu_to_le32(UDF_I_UNIQUE(inode) & 0x00000000FFFFFFFFUL);
        udf_write_fi(dir, &cfi, fi, &fibh, NULL, NULL);
-       if (UDF_I_ALLOCTYPE(dir) == ICB_FLAG_AD_IN_ICB)
+       if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_IN_ICB)
        {
                mark_inode_dirty(dir);
        }
@@ -724,7 +723,7 @@ static int udf_mkdir(struct inode * dir, struct dentry * dentry, int mode)
        struct inode * inode;
        struct udf_fileident_bh fibh;
        int err;
-       struct FileIdentDesc cfi, *fi;
+       struct fileIdentDesc cfi, *fi;
 
        lock_kernel();
        err = -EMLINK;
@@ -748,9 +747,9 @@ static int udf_mkdir(struct inode * dir, struct dentry * dentry, int mode)
        inode->i_nlink = 2;
        cfi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize);
        cfi.icb.extLocation = cpu_to_lelb(UDF_I_LOCATION(dir));
-       *(Uint32 *)((struct ADImpUse *)cfi.icb.impUse)->impUse =
+       *(uint32_t *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse =
                cpu_to_le32(UDF_I_UNIQUE(dir) & 0x00000000FFFFFFFFUL);
-       cfi.fileCharacteristics = FILE_DIRECTORY | FILE_PARENT;
+       cfi.fileCharacteristics = FID_FILE_CHAR_DIRECTORY | FID_FILE_CHAR_PARENT;
        udf_write_fi(inode, &cfi, fi, &fibh, NULL, NULL);
        udf_release_data(fibh.sbh);
        inode->i_mode = S_IFDIR | mode;
@@ -767,9 +766,9 @@ static int udf_mkdir(struct inode * dir, struct dentry * dentry, int mode)
        }
        cfi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize);
        cfi.icb.extLocation = cpu_to_lelb(UDF_I_LOCATION(inode));
-       *(Uint32 *)((struct ADImpUse *)cfi.icb.impUse)->impUse =
+       *(uint32_t *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse =
                cpu_to_le32(UDF_I_UNIQUE(inode) & 0x00000000FFFFFFFFUL);
-       cfi.fileCharacteristics |= FILE_DIRECTORY;
+       cfi.fileCharacteristics |= FID_FILE_CHAR_DIRECTORY;
        udf_write_fi(dir, &cfi, fi, &fibh, NULL, NULL);
        dir->i_nlink++;
        mark_inode_dirty(dir);
@@ -785,28 +784,28 @@ out:
 
 static int empty_dir(struct inode *dir)
 {
-       struct FileIdentDesc *fi, cfi;
+       struct fileIdentDesc *fi, cfi;
        struct udf_fileident_bh fibh;
        loff_t f_pos;
        loff_t size = (udf_ext0_offset(dir) + dir->i_size) >> 2;
        int block;
        lb_addr bloc, eloc;
-       Uint32 extoffset, elen, offset;
+       uint32_t extoffset, elen, offset;
        struct buffer_head *bh = NULL;
 
        f_pos = (udf_ext0_offset(dir) >> 2);
 
        fibh.soffset = fibh.eoffset = (f_pos & ((dir->i_sb->s_blocksize - 1) >> 2)) << 2;
        if (inode_bmap(dir, f_pos >> (dir->i_sb->s_blocksize_bits - 2),
-               &bloc, &extoffset, &eloc, &elen, &offset, &bh) == EXTENT_RECORDED_ALLOCATED)
+               &bloc, &extoffset, &eloc, &elen, &offset, &bh) == (EXT_RECORDED_ALLOCATED >> 30))
        {
                offset >>= dir->i_sb->s_blocksize_bits;
                block = udf_get_lb_pblock(dir->i_sb, eloc, offset);
                if ((++offset << dir->i_sb->s_blocksize_bits) < elen)
                {
-                       if (UDF_I_ALLOCTYPE(dir) == ICB_FLAG_AD_SHORT)
+                       if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_SHORT)
                                extoffset -= sizeof(short_ad);
-                       else if (UDF_I_ALLOCTYPE(dir) == ICB_FLAG_AD_LONG)
+                       else if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_LONG)
                                extoffset -= sizeof(long_ad);
                }
                else
@@ -834,7 +833,7 @@ static int empty_dir(struct inode *dir)
                        return 0;
                }
 
-               if (cfi.lengthFileIdent && (cfi.fileCharacteristics & FILE_DELETED) == 0)
+               if (cfi.lengthFileIdent && (cfi.fileCharacteristics & FID_FILE_CHAR_DELETED) == 0)
                {
                        udf_release_data(bh);
                        return 0;
@@ -852,7 +851,7 @@ static int udf_rmdir(struct inode * dir, struct dentry * dentry)
        int retval;
        struct inode * inode = dentry->d_inode;
        struct udf_fileident_bh fibh;
-       struct FileIdentDesc *fi, cfi;
+       struct fileIdentDesc *fi, cfi;
 
        retval = -ENOENT;
        lock_kernel();
@@ -895,8 +894,8 @@ static int udf_unlink(struct inode * dir, struct dentry * dentry)
        int retval;
        struct inode * inode = dentry->d_inode;
        struct udf_fileident_bh fibh;
-       struct FileIdentDesc *fi;
-       struct FileIdentDesc cfi;
+       struct fileIdentDesc *fi;
+       struct fileIdentDesc cfi;
 
        retval = -ENOENT;
        lock_kernel();
@@ -941,13 +940,13 @@ out:
 static int udf_symlink(struct inode * dir, struct dentry * dentry, const char * symname)
 {
        struct inode * inode;
-       struct PathComponent *pc;
+       struct pathComponent *pc;
        char *compstart;
        struct udf_fileident_bh fibh;
        struct buffer_head *bh = NULL;
        int eoffset, elen = 0;
-       struct FileIdentDesc *fi;
-       struct FileIdentDesc cfi;
+       struct fileIdentDesc *fi;
+       struct fileIdentDesc cfi;
        char *ea;
        int err;
        int block;
@@ -960,11 +959,11 @@ 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) != ICBTAG_FLAG_AD_IN_ICB)
        {
                struct buffer_head *bh = NULL;
                lb_addr bloc, eloc;
-               Uint32 elen, extoffset;
+               uint32_t elen, extoffset;
 
                block = udf_new_block(inode->i_sb, inode,
                        UDF_I_LOCATION(inode).partitionReferenceNum,
@@ -997,7 +996,7 @@ static int udf_symlink(struct inode * dir, struct dentry * dentry, const char *
        ea = bh->b_data + udf_ext0_offset(inode);
 
        eoffset = inode->i_sb->s_blocksize - udf_ext0_offset(inode);
-       pc = (struct PathComponent *)ea;
+       pc = (struct pathComponent *)ea;
 
        if (*symname == '/')
        {
@@ -1009,18 +1008,18 @@ static int udf_symlink(struct inode * dir, struct dentry * dentry, const char *
                pc->componentType = 1;
                pc->lengthComponentIdent = 0;
                pc->componentFileVersionNum = 0;
-               pc += sizeof(struct PathComponent);
-               elen += sizeof(struct PathComponent);
+               pc += sizeof(struct pathComponent);
+               elen += sizeof(struct pathComponent);
        }
 
        err = -ENAMETOOLONG;
 
        while (*symname)
        {
-               if (elen + sizeof(struct PathComponent) > eoffset)
+               if (elen + sizeof(struct pathComponent) > eoffset)
                        goto out_no_entry;
 
-               pc = (struct PathComponent *)(ea + elen);
+               pc = (struct pathComponent *)(ea + elen);
 
                compstart = (char *)symname;
 
@@ -1042,7 +1041,7 @@ static int udf_symlink(struct inode * dir, struct dentry * dentry, const char *
 
                if (pc->componentType == 5)
                {
-                       if (elen + sizeof(struct PathComponent) + symname - compstart > eoffset)
+                       if (elen + sizeof(struct pathComponent) + symname - compstart > eoffset)
                                goto out_no_entry;
                        else
                                pc->lengthComponentIdent = symname - compstart;
@@ -1050,7 +1049,7 @@ static int udf_symlink(struct inode * dir, struct dentry * dentry, const char *
                        memcpy(pc->componentIdent, compstart, pc->lengthComponentIdent);
                }
 
-               elen += sizeof(struct PathComponent) + pc->lengthComponentIdent;
+               elen += sizeof(struct pathComponent) + pc->lengthComponentIdent;
 
                if (*symname)
                {
@@ -1063,7 +1062,7 @@ static int udf_symlink(struct inode * dir, struct dentry * dentry, const char *
 
        udf_release_data(bh);
        inode->i_size = elen;
-       if (UDF_I_ALLOCTYPE(inode) == ICB_FLAG_AD_IN_ICB)
+       if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_IN_ICB)
                UDF_I_LENALLOC(inode) = inode->i_size;
        mark_inode_dirty(inode);
 
@@ -1073,11 +1072,11 @@ static int udf_symlink(struct inode * dir, struct dentry * dentry, const char *
        cfi.icb.extLocation = cpu_to_lelb(UDF_I_LOCATION(inode));
        if (UDF_SB_LVIDBH(inode->i_sb))
        {
-               struct LogicalVolHeaderDesc *lvhd;
-               Uint64 uniqueID;
-               lvhd = (struct LogicalVolHeaderDesc *)(UDF_SB_LVID(inode->i_sb)->logicalVolContentsUse);
+               struct logicalVolHeaderDesc *lvhd;
+               uint64_t uniqueID;
+               lvhd = (struct logicalVolHeaderDesc *)(UDF_SB_LVID(inode->i_sb)->logicalVolContentsUse);
                uniqueID = le64_to_cpu(lvhd->uniqueID);
-               *(Uint32 *)((struct ADImpUse *)cfi.icb.impUse)->impUse =
+               *(uint32_t *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse =
                        cpu_to_le32(uniqueID & 0x00000000FFFFFFFFUL);
                if (!(++uniqueID & 0x00000000FFFFFFFFUL))
                        uniqueID += 16;
@@ -1085,7 +1084,7 @@ static int udf_symlink(struct inode * dir, struct dentry * dentry, const char *
                mark_buffer_dirty(UDF_SB_LVIDBH(inode->i_sb));
        }
        udf_write_fi(dir, &cfi, fi, &fibh, NULL, NULL);
-       if (UDF_I_ALLOCTYPE(dir) == ICB_FLAG_AD_IN_ICB)
+       if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_IN_ICB)
        {
                mark_inode_dirty(dir);
        }
@@ -1112,7 +1111,7 @@ static int udf_link(struct dentry * old_dentry, struct inode * dir,
        struct inode *inode = old_dentry->d_inode;
        struct udf_fileident_bh fibh;
        int err;
-       struct FileIdentDesc cfi, *fi;
+       struct fileIdentDesc cfi, *fi;
 
        lock_kernel();
        if (inode->i_nlink >= (256<<sizeof(inode->i_nlink))-1) {
@@ -1128,11 +1127,11 @@ static int udf_link(struct dentry * old_dentry, struct inode * dir,
        cfi.icb.extLocation = cpu_to_lelb(UDF_I_LOCATION(inode));
        if (UDF_SB_LVIDBH(inode->i_sb))
        {
-               struct LogicalVolHeaderDesc *lvhd;
-               Uint64 uniqueID;
-               lvhd = (struct LogicalVolHeaderDesc *)(UDF_SB_LVID(inode->i_sb)->logicalVolContentsUse);
+               struct logicalVolHeaderDesc *lvhd;
+               uint64_t uniqueID;
+               lvhd = (struct logicalVolHeaderDesc *)(UDF_SB_LVID(inode->i_sb)->logicalVolContentsUse);
                uniqueID = le64_to_cpu(lvhd->uniqueID);
-               *(Uint32 *)((struct ADImpUse *)cfi.icb.impUse)->impUse =
+               *(uint32_t *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse =
                        cpu_to_le32(uniqueID & 0x00000000FFFFFFFFUL);
                if (!(++uniqueID & 0x00000000FFFFFFFFUL))
                        uniqueID += 16;
@@ -1140,7 +1139,7 @@ static int udf_link(struct dentry * old_dentry, struct inode * dir,
                mark_buffer_dirty(UDF_SB_LVIDBH(inode->i_sb));
        }
        udf_write_fi(dir, &cfi, fi, &fibh, NULL, NULL);
-       if (UDF_I_ALLOCTYPE(dir) == ICB_FLAG_AD_IN_ICB)
+       if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_IN_ICB)
        {
                mark_inode_dirty(dir);
        }
@@ -1166,7 +1165,7 @@ static int udf_rename (struct inode * old_dir, struct dentry * old_dentry,
        struct inode * old_inode = old_dentry->d_inode;
        struct inode * new_inode = new_dentry->d_inode;
        struct udf_fileident_bh ofibh, nfibh;
-       struct FileIdentDesc *ofi = NULL, *nfi = NULL, *dir_fi = NULL, ocfi, ncfi;
+       struct fileIdentDesc *ofi = NULL, *nfi = NULL, *dir_fi = NULL, ocfi, ncfi;
        struct buffer_head *dir_bh = NULL;
        int retval = -ENOENT;
 
@@ -1196,7 +1195,7 @@ static int udf_rename (struct inode * old_dir, struct dentry * old_dentry,
        }
        if (S_ISDIR(old_inode->i_mode))
        {
-               Uint32 offset = udf_ext0_offset(old_inode);
+               uint32_t offset = udf_ext0_offset(old_inode);
 
                if (new_inode)
                {
@@ -1261,9 +1260,9 @@ static int udf_rename (struct inode * old_dir, struct dentry * old_dentry,
        if (dir_bh)
        {
                dir_fi->icb.extLocation = lelb_to_cpu(UDF_I_LOCATION(new_dir));
-               udf_update_tag((char *)dir_fi, (sizeof(struct FileIdentDesc) +
+               udf_update_tag((char *)dir_fi, (sizeof(struct fileIdentDesc) +
                        cpu_to_le16(dir_fi->lengthOfImpUse) + 3) & ~3);
-               if (UDF_I_ALLOCTYPE(old_inode) == ICB_FLAG_AD_IN_ICB)
+               if (UDF_I_ALLOCTYPE(old_inode) == ICBTAG_FLAG_AD_IN_ICB)
                {
                        mark_inode_dirty(old_inode);
                }
diff --git a/fs/udf/osta_udf.h b/fs/udf/osta_udf.h
new file mode 100644 (file)
index 0000000..ab3b6b6
--- /dev/null
@@ -0,0 +1,271 @@
+/*
+ * osta_udf.h
+ *
+ * This file is based on OSTA UDF(tm) 2.01 (March 15, 2000)
+ * http://www.osta.org
+ *
+ * Copyright (c) 2001-2002  Ben Fennema <bfennema@falcon.csc.calpoly.edu>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU Public License ("GPL").
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "ecma_167.h"
+
+#ifndef _OSTA_UDF_H
+#define _OSTA_UDF_H 1
+
+/* OSTA CS0 Charspec (UDF 2.01 2.1.2) */
+#define UDF_CHAR_SET_TYPE              0
+#define UDF_CHAR_SET_INFO              "OSTA Compressed Unicode"
+
+/* Entity Identifier (UDF 2.01 2.1.5) */
+/* Identifiers (UDF 2.01 2.1.5.2) */
+#define UDF_ID_DEVELOPER               "*Linux UDFFS"
+#define        UDF_ID_COMPLIANT                "*OSTA UDF Compliant"
+#define UDF_ID_LV_INFO                 "*UDF LV Info"
+#define UDF_ID_FREE_EA                 "*UDF FreeEASpace"
+#define UDF_ID_FREE_APP_EA             "*UDF FreeAppEASpace"
+#define UDF_ID_DVD_CGMS                        "*UDF DVD CGMS Info"
+#define UDF_ID_OS2_EA                  "*UDF OS/2 EA"
+#define UDF_ID_OS2_EA_LENGTH           "*UDF OS/2 EALength"
+#define UDF_ID_MAC_VOLUME              "*UDF Mac VolumeInfo"
+#define UDF_ID_MAC_FINDER              "*UDF Mac FinderInfo"
+#define UDF_ID_MAC_UNIQUE              "*UDF Mac UniqueIDTable"
+#define UDF_ID_MAC_RESOURCE            "*UDF Mac ResourceFork"
+#define UDF_ID_VIRTUAL                 "*UDF Virtual Partition"
+#define UDF_ID_SPARABLE                        "*UDF Sparable Partition"
+#define UDF_ID_ALLOC                   "*UDF Virtual Alloc Tbl"
+#define UDF_ID_SPARING                 "*UDF Sparing Table"
+
+/* Identifier Suffix (UDF 2.01 2.1.5.3) */
+#define IS_DF_HARD_WRITE_PROTECT       0x01
+#define IS_DF_SOFT_WRITE_PROTECT       0x02
+
+struct UDFIdentSuffix
+{
+       uint16_t        UDFRevision;
+       uint8_t         OSClass;
+       uint8_t         OSIdentifier;
+       uint8_t         reserved[4];
+} __attribute__ ((packed));
+
+struct impIdentSuffix
+{
+       uint8_t         OSClass;
+       uint8_t         OSIdentifier;
+       uint8_t         reserved[6];
+} __attribute__ ((packed));
+
+struct appIdentSuffix
+{
+       uint8_t         impUse[8];
+} __attribute__ ((packed));
+/* Logical Volume Integrity Descriptor (UDF 2.01 2.2.6) */
+/* Implementation Use (UDF 2.01 2.2.6.4) */
+struct logicalVolIntegrityDescImpUse
+{
+       regid           impIdent;
+       uint32_t        numFiles;
+       uint32_t        numDirs;
+       uint16_t        minUDFReadRev;
+       uint16_t        minUDFWriteRev;
+       uint16_t        maxUDFWriteRev;
+       uint8_t         impUse[0];
+} __attribute__ ((packed));
+
+/* Implementation Use Volume Descriptor (UDF 2.01 2.2.7) */
+/* Implementation Use (UDF 2.01 2.2.7.2) */
+struct impUseVolDescImpUse
+{
+       charspec        LVICharset;
+       dstring         logicalVolIdent[128];
+       dstring         LVInfo1[36];
+       dstring         LVInfo2[36];
+       dstring         LVInfo3[36];
+       regid           impIdent;
+       uint8_t         impUse[128];
+} __attribute__ ((packed));
+
+struct udfPartitionMap2
+{
+       uint8_t         partitionMapType;
+       uint8_t         partitionMapLength;
+       uint8_t         reserved1[2];
+       regid           partIdent;
+       uint16_t        volSeqNum;
+       uint16_t        partitionNum;
+} __attribute__ ((packed));
+
+/* Virtual Partition Map (UDF 2.01 2.2.8) */
+struct virtualPartitionMap
+{
+       uint8_t         partitionMapType;
+       uint8_t         partitionMapLength;
+       uint8_t         reserved1[2];
+       regid           partIdent;
+       uint16_t        volSeqNum;
+       uint16_t        partitionNum;
+       uint8_t         reserved2[24];
+} __attribute__ ((packed));
+
+/* Sparable Partition Map (UDF 2.01 2.2.9) */
+struct sparablePartitionMap
+{
+       uint8_t         partitionMapType;
+       uint8_t         partitionMapLength;
+       uint8_t         reserved1[2];
+       regid           partIdent;
+       uint16_t        volSeqNum;
+       uint16_t        partitionNum;
+       uint16_t        packetLength;
+       uint8_t         numSparingTables;
+       uint8_t         reserved2[1];
+       uint32_t        sizeSparingTable;
+       uint32_t        locSparingTable[4];
+} __attribute__ ((packed));
+
+/* Virtual Allocation Table (UDF 1.5 2.2.10) */
+struct virtualAllocationTable15
+{
+       uint32_t        VirtualSector[0];
+       regid           ident;
+       uint32_t        previousVATICB;
+} __attribute__ ((packed));  
+
+#define ICBTAG_FILE_TYPE_VAT15         0x00U
+
+/* Virtual Allocation Table (UDF 2.01 2.2.10) */
+struct virtualAllocationTable20
+{
+       uint16_t        lengthHeader;
+       uint16_t        lengthImpUse;
+       dstring         logicalVolIdent[128];
+       uint32_t        previousVatICBLoc;
+       uint32_t        numFIDSFiles;
+       uint32_t        numFIDSDirectories;
+       uint16_t        minReadRevision;
+       uint16_t        minWriteRevision;
+       uint16_t        maxWriteRevision;
+       uint16_t        reserved;
+       uint8_t         impUse[0];
+       uint32_t        vatEntry[0];
+} __attribute__ ((packed));
+
+#define ICBTAG_FILE_TYPE_VAT20         0xF8U
+
+/* Sparing Table (UDF 2.01 2.2.11) */
+struct sparingEntry
+{
+       uint32_t        origLocation;
+       uint32_t        mappedLocation;
+} __attribute__ ((packed));
+
+struct sparingTable
+{
+       tag             descTag;
+       regid           sparingIdent;
+       uint16_t        reallocationTableLen;
+       uint16_t        reserved;
+       uint32_t        sequenceNum;
+       struct sparingEntry
+                       mapEntry[0];
+} __attribute__ ((packed));
+
+/* struct long_ad ICB - ADImpUse (UDF 2.01 2.2.4.3) */
+struct allocDescImpUse
+{
+       uint16_t        flags;
+       uint8_t         impUse[4];
+} __attribute__ ((packed));
+
+#define AD_IU_EXT_ERASED               0x0001
+
+/* Real-Time Files (UDF 2.01 6.11) */
+#define ICBTAG_FILE_TYPE_REALTIME      0xF9U
+
+/* Implementation Use Extended Attribute (UDF 2.01 3.3.4.5) */
+/* FreeEASpace (UDF 2.01 3.3.4.5.1.1) */
+struct freeEaSpace
+{
+       uint16_t        headerChecksum;
+       uint8_t         freeEASpace[0];
+} __attribute__ ((packed));
+
+/* DVD Copyright Management Information (UDF 2.01 3.3.4.5.1.2) */
+struct DVDCopyrightImpUse 
+{
+       uint16_t        headerChecksum;
+       uint8_t         CGMSInfo;
+       uint8_t         dataType;
+       uint8_t         protectionSystemInfo[4];
+} __attribute__ ((packed));
+
+/* Application Use Extended Attribute (UDF 2.01 3.3.4.6) */
+/* FreeAppEASpace (UDF 2.01 3.3.4.6.1) */
+struct freeAppEASpace
+{
+       uint16_t        headerChecksum;
+       uint8_t         freeEASpace[0];
+} __attribute__ ((packed));
+
+/* UDF Defined System Stream (UDF 2.01 3.3.7) */
+#define UDF_ID_UNIQUE_ID               "*UDF Unique ID Mapping Data"
+#define UDF_ID_NON_ALLOC               "*UDF Non-Allocatable Space"
+#define UDF_ID_POWER_CAL               "*UDF Power Cal Table"
+#define UDF_ID_BACKUP                  "*UDF Backup"
+
+/* Operating System Identifiers (UDF 2.01 6.3) */
+#define UDF_OS_CLASS_UNDEF             0x00U
+#define UDF_OS_CLASS_DOS               0x01U
+#define UDF_OS_CLASS_OS2               0x02U
+#define UDF_OS_CLASS_MAC               0x03U
+#define UDF_OS_CLASS_UNIX              0x04U
+#define UDF_OS_CLASS_WIN9X             0x05U
+#define UDF_OS_CLASS_WINNT             0x06U
+#define UDF_OS_CLASS_OS400             0x07U
+#define UDF_OS_CLASS_BEOS              0x08U
+#define UDF_OS_CLASS_WINCE             0x09U
+
+#define UDF_OS_ID_UNDEF                        0x00U
+#define UDF_OS_ID_DOS                  0x00U
+#define UDF_OS_ID_OS2                  0x00U
+#define UDF_OS_ID_MAC                  0x00U
+#define UDF_OS_ID_UNIX                 0x00U
+#define UDF_OS_ID_AIX                  0x01U
+#define UDF_OS_ID_SOLARIS              0x02U
+#define UDF_OS_ID_HPUX                 0x03U
+#define UDF_OS_ID_IRIX                 0x04U
+#define UDF_OS_ID_LINUX                        0x05U
+#define UDF_OS_ID_MKLINUX              0x06U
+#define UDF_OS_ID_FREEBSD              0x07U
+#define UDF_OS_ID_WIN9X                        0x00U
+#define UDF_OS_ID_WINNT                        0x00U
+#define UDF_OS_ID_OS400                        0x00U
+#define UDF_OS_ID_BEOS                 0x00U
+#define UDF_OS_ID_WINCE                        0x00U
+
+#endif /* _OSTA_UDF_H */
index 39382845c64fa748993088b10258d26125605067..ba50f93a3c7c6c9d81916bb7f9571806cdadcf2f 100644 (file)
@@ -15,7 +15,7 @@
  *              ftp://prep.ai.mit.edu/pub/gnu/GPL
  *      Each contributing author retains all rights to their own work.
  *
- *  (C) 1998-2000 Ben Fennema
+ *  (C) 1998-2001 Ben Fennema
  *
  * HISTORY
  *
@@ -32,7 +32,7 @@
 #include <linux/udf_fs.h>
 #include <linux/slab.h>
 
-inline Uint32 udf_get_pblock(struct super_block *sb, Uint32 block, Uint16 partition, Uint32 offset)
+inline uint32_t udf_get_pblock(struct super_block *sb, uint32_t block, uint16_t partition, uint32_t offset)
 {
        if (partition >= UDF_SB_NUMPARTS(sb))
        {
@@ -46,14 +46,14 @@ inline Uint32 udf_get_pblock(struct super_block *sb, Uint32 block, Uint16 partit
                return UDF_SB_PARTROOT(sb, partition) + block + offset;
 }
 
-Uint32 udf_get_pblock_virt15(struct super_block *sb, Uint32 block, Uint16 partition, Uint32 offset)
+uint32_t udf_get_pblock_virt15(struct super_block *sb, uint32_t block, uint16_t partition, uint32_t offset)
 {
        struct buffer_head *bh = NULL;
-       Uint32 newblock;
-       Uint32 index;
-       Uint32 loc;
+       uint32_t newblock;
+       uint32_t index;
+       uint32_t loc;
 
-       index = (sb->s_blocksize - UDF_SB_TYPEVIRT(sb,partition).s_start_offset) / sizeof(Uint32);
+       index = (sb->s_blocksize - UDF_SB_TYPEVIRT(sb,partition).s_start_offset) / sizeof(uint32_t);
 
        if (block > UDF_SB_TYPEVIRT(sb,partition).s_num_entries)
        {
@@ -65,13 +65,13 @@ Uint32 udf_get_pblock_virt15(struct super_block *sb, Uint32 block, Uint16 partit
        if (block >= index)
        {
                block -= index;
-               newblock = 1 + (block / (sb->s_blocksize / sizeof(Uint32)));
-               index = block % (sb->s_blocksize / sizeof(Uint32));
+               newblock = 1 + (block / (sb->s_blocksize / sizeof(uint32_t)));
+               index = block % (sb->s_blocksize / sizeof(uint32_t));
        }
        else
        {
                newblock = 0;
-               index = UDF_SB_TYPEVIRT(sb,partition).s_start_offset / sizeof(Uint32) + block;
+               index = UDF_SB_TYPEVIRT(sb,partition).s_start_offset / sizeof(uint32_t) + block;
        }
 
        loc = udf_block_map(UDF_SB_VAT(sb), newblock);
@@ -83,7 +83,7 @@ Uint32 udf_get_pblock_virt15(struct super_block *sb, Uint32 block, Uint16 partit
                return 0xFFFFFFFF;
        }
 
-       loc = le32_to_cpu(((Uint32 *)bh->b_data)[index]);
+       loc = le32_to_cpu(((uint32_t *)bh->b_data)[index]);
 
        udf_release_data(bh);
 
@@ -96,22 +96,22 @@ Uint32 udf_get_pblock_virt15(struct super_block *sb, Uint32 block, Uint16 partit
        return udf_get_pblock(sb, loc, UDF_I_LOCATION(UDF_SB_VAT(sb)).partitionReferenceNum, offset);
 }
 
-inline Uint32 udf_get_pblock_virt20(struct super_block *sb, Uint32 block, Uint16 partition, Uint32 offset)
+inline uint32_t udf_get_pblock_virt20(struct super_block *sb, uint32_t block, uint16_t partition, uint32_t offset)
 {
        return udf_get_pblock_virt15(sb, block, partition, offset);
 }
 
-Uint32 udf_get_pblock_spar15(struct super_block *sb, Uint32 block, Uint16 partition, Uint32 offset)
+uint32_t udf_get_pblock_spar15(struct super_block *sb, uint32_t block, uint16_t partition, uint32_t offset)
 {
        int i;
-       struct SparingTable *st = NULL;
-       Uint32 packet = (block + offset) & ~(UDF_SB_TYPESPAR(sb,partition).s_packet_len - 1);
+       struct sparingTable *st = NULL;
+       uint32_t packet = (block + offset) & ~(UDF_SB_TYPESPAR(sb,partition).s_packet_len - 1);
 
        for (i=0; i<4; i++)
        {
                if (UDF_SB_TYPESPAR(sb,partition).s_spar_map[i] != NULL)
                {
-                       st = (struct SparingTable *)UDF_SB_TYPESPAR(sb,partition).s_spar_map[i]->b_data;
+                       st = (struct sparingTable *)UDF_SB_TYPESPAR(sb,partition).s_spar_map[i]->b_data;
                        break;
                }
        }
@@ -137,9 +137,9 @@ Uint32 udf_get_pblock_spar15(struct super_block *sb, Uint32 block, Uint16 partit
 int udf_relocate_blocks(struct super_block *sb, long old_block, long *new_block)
 {
        struct udf_sparing_data *sdata;
-       struct SparingTable *st = NULL;
-       SparingEntry mapEntry;
-       Uint32 packet;
+       struct sparingTable *st = NULL;
+       struct sparingEntry mapEntry;
+       uint32_t packet;
        int i, j, k, l;
 
        for (i=0; i<UDF_SB_NUMPARTS(sb); i++)
@@ -154,7 +154,7 @@ int udf_relocate_blocks(struct super_block *sb, long old_block, long *new_block)
                        {
                                if (UDF_SB_TYPESPAR(sb,i).s_spar_map[j] != NULL)
                                {
-                                       st = (struct SparingTable *)sdata->s_spar_map[j]->b_data;
+                                       st = (struct sparingTable *)sdata->s_spar_map[j]->b_data;
                                        break;
                                }
                        }
@@ -170,9 +170,9 @@ int udf_relocate_blocks(struct super_block *sb, long old_block, long *new_block)
                                        {
                                                if (sdata->s_spar_map[j])
                                                {
-                                                       st = (struct SparingTable *)sdata->s_spar_map[j]->b_data;
+                                                       st = (struct sparingTable *)sdata->s_spar_map[j]->b_data;
                                                        st->mapEntry[k].origLocation = cpu_to_le32(packet);
-                                                       udf_update_tag((char *)st, sizeof(struct SparingTable) + st->reallocationTableLen * sizeof(SparingEntry));
+                                                       udf_update_tag((char *)st, sizeof(struct sparingTable) + st->reallocationTableLen * sizeof(struct sparingEntry));
                                                        mark_buffer_dirty(sdata->s_spar_map[j]);
                                                }
                                        }
@@ -197,12 +197,12 @@ int udf_relocate_blocks(struct super_block *sb, long old_block, long *new_block)
                                        {
                                                if (sdata->s_spar_map[j])
                                                {
-                                                       st = (struct SparingTable *)sdata->s_spar_map[j]->b_data;
+                                                       st = (struct sparingTable *)sdata->s_spar_map[j]->b_data;
                                                        mapEntry = st->mapEntry[l];
                                                        mapEntry.origLocation = cpu_to_le32(packet);
-                                                       memmove(&st->mapEntry[k+1], &st->mapEntry[k], (l-k)*sizeof(SparingEntry));
+                                                       memmove(&st->mapEntry[k+1], &st->mapEntry[k], (l-k)*sizeof(struct sparingEntry));
                                                        st->mapEntry[k] = mapEntry;
-                                                       udf_update_tag((char *)st, sizeof(struct SparingTable) + st->reallocationTableLen * sizeof(SparingEntry));
+                                                       udf_update_tag((char *)st, sizeof(struct sparingTable) + st->reallocationTableLen * sizeof(struct sparingEntry));
                                                        mark_buffer_dirty(sdata->s_spar_map[j]);
                                                }
                                        }
index d72d5b7eb314d597c49adddf6c7330f166859922..0e668a01a592e75a84e73605a966d9c61426546c 100644 (file)
@@ -26,7 +26,7 @@
  *  Each contributing author retains all rights to their own work.
  *
  *  (C) 1998 Dave Boynton
- *  (C) 1998-2000 Ben Fennema
+ *  (C) 1998-2001 Ben Fennema
  *  (C) 2000 Stelias Computing Inc
  *
  * HISTORY
@@ -436,7 +436,7 @@ udf_set_blocksize(struct super_block *sb, int bsize)
 static int
 udf_vrs(struct super_block *sb, int silent)
 {
-       struct VolStructDesc *vsd = NULL;
+       struct volStructDesc *vsd = NULL;
        int sector = 32768;
        int sectorsize;
        struct buffer_head *bh = NULL;
@@ -448,8 +448,8 @@ udf_vrs(struct super_block *sb, int silent)
        if (sb->s_blocksize & 511)
                return 0;
 
-       if (sb->s_blocksize < sizeof(struct VolStructDesc))
-               sectorsize = sizeof(struct VolStructDesc);
+       if (sb->s_blocksize < sizeof(struct volStructDesc))
+               sectorsize = sizeof(struct volStructDesc);
        else
                sectorsize = sb->s_blocksize;
 
@@ -466,7 +466,7 @@ udf_vrs(struct super_block *sb, int silent)
                        break;
 
                /* Look for ISO  descriptors */
-               vsd = (struct VolStructDesc *)(bh->b_data +
+               vsd = (struct volStructDesc *)(bh->b_data +
                        (sector & (sb->s_blocksize - 1)));
 
                if (vsd->stdIdent[0] == 0)
@@ -474,7 +474,7 @@ udf_vrs(struct super_block *sb, int silent)
                        udf_release_data(bh);
                        break;
                }
-               else if (!strncmp(vsd->stdIdent, STD_ID_CD001, STD_ID_LEN))
+               else if (!strncmp(vsd->stdIdent, VSD_STD_ID_CD001, VSD_STD_ID_LEN))
                {
                        iso9660 = sector;
                        switch (vsd->structType)
@@ -499,19 +499,19 @@ udf_vrs(struct super_block *sb, int silent)
                                        break;
                        }
                }
-               else if (!strncmp(vsd->stdIdent, STD_ID_BEA01, STD_ID_LEN))
+               else if (!strncmp(vsd->stdIdent, VSD_STD_ID_BEA01, VSD_STD_ID_LEN))
                {
                }
-               else if (!strncmp(vsd->stdIdent, STD_ID_TEA01, STD_ID_LEN))
+               else if (!strncmp(vsd->stdIdent, VSD_STD_ID_TEA01, VSD_STD_ID_LEN))
                {
                        udf_release_data(bh);
                        break;
                }
-               else if (!strncmp(vsd->stdIdent, STD_ID_NSR02, STD_ID_LEN))
+               else if (!strncmp(vsd->stdIdent, VSD_STD_ID_NSR02, VSD_STD_ID_LEN))
                {
                        nsr02 = sector;
                }
-               else if (!strncmp(vsd->stdIdent, STD_ID_NSR03, STD_ID_LEN))
+               else if (!strncmp(vsd->stdIdent, VSD_STD_ID_NSR03, VSD_STD_ID_LEN))
                {
                        nsr03 = sector;
                }
@@ -550,8 +550,8 @@ udf_find_anchor(struct super_block *sb)
 {
        int lastblock = UDF_SB_LASTBLOCK(sb);
        struct buffer_head *bh = NULL;
-       Uint16 ident;
-       Uint32 location;
+       uint16_t ident;
+       uint32_t location;
        int i;
 
        if (lastblock)
@@ -585,7 +585,7 @@ udf_find_anchor(struct super_block *sb)
                                udf_release_data(bh);
                        }
        
-                       if (ident == TID_ANCHOR_VOL_DESC_PTR)
+                       if (ident == TAG_IDENT_AVDP)
                        {
                                if (location == last[i] - UDF_SB_SESSION(sb))
                                {
@@ -602,7 +602,7 @@ udf_find_anchor(struct super_block *sb)
                                        udf_debug("Anchor found at block %d, location mismatch %d.\n",
                                                last[i], location);
                        }
-                       else if (ident == TID_FILE_ENTRY || ident == TID_EXTENDED_FILE_ENTRY)
+                       else if (ident == TAG_IDENT_FE || ident == TAG_IDENT_EFE)
                        {
                                lastblock = last[i];
                                UDF_SB_ANCHOR(sb)[3] = 512 + UDF_SB_SESSION(sb);
@@ -620,7 +620,7 @@ udf_find_anchor(struct super_block *sb)
                                        udf_release_data(bh);
                                }
        
-                               if (ident == TID_ANCHOR_VOL_DESC_PTR &&
+                               if (ident == TAG_IDENT_AVDP &&
                                        location == last[i] - 256 - UDF_SB_SESSION(sb))
                                {
                                        lastblock = last[i];
@@ -639,7 +639,7 @@ udf_find_anchor(struct super_block *sb)
                                                udf_release_data(bh);
                                        }
        
-                                       if (ident == TID_ANCHOR_VOL_DESC_PTR &&
+                                       if (ident == TAG_IDENT_AVDP &&
                                                location == udf_variable_to_fixed(last[i]) - 256)
                                        {
                                                UDF_SET_FLAG(sb, UDF_FLAG_VARCONV);
@@ -660,7 +660,7 @@ udf_find_anchor(struct super_block *sb)
                        location = le32_to_cpu(((tag *)bh->b_data)->tagLocation);
                        udf_release_data(bh);
 
-                       if (ident == TID_ANCHOR_VOL_DESC_PTR && location == 256)
+                       if (ident == TAG_IDENT_AVDP && location == 256)
                                UDF_SET_FLAG(sb, UDF_FLAG_VARCONV);
                }
        }
@@ -677,8 +677,8 @@ udf_find_anchor(struct super_block *sb)
                        else
                        {
                                udf_release_data(bh);
-                               if ((ident != TID_ANCHOR_VOL_DESC_PTR) && (i ||
-                                       (ident != TID_FILE_ENTRY && ident != TID_EXTENDED_FILE_ENTRY)))
+                               if ((ident != TAG_IDENT_AVDP) && (i ||
+                                       (ident != TAG_IDENT_FE && ident != TAG_IDENT_EFE)))
                                {
                                        UDF_SB_ANCHOR(sb)[i] = 0;
                                }
@@ -694,7 +694,7 @@ udf_find_fileset(struct super_block *sb, lb_addr *fileset, lb_addr *root)
 {
        struct buffer_head *bh = NULL;
        long lastblock;
-       Uint16 ident;
+       uint16_t ident;
 
        if (fileset->logicalBlockNum != 0xFFFFFFFF ||
                fileset->partitionReferenceNum != 0xFFFF)
@@ -703,7 +703,7 @@ udf_find_fileset(struct super_block *sb, lb_addr *fileset, lb_addr *root)
 
                if (!bh)
                        return 1;
-               else if (ident != TID_FILE_SET_DESC)
+               else if (ident != TAG_IDENT_FSD)
                {
                        udf_release_data(bh);
                        return 1;
@@ -737,17 +737,17 @@ udf_find_fileset(struct super_block *sb, lb_addr *fileset, lb_addr *root)
 
                                switch (ident)
                                {
-                                       case TID_SPACE_BITMAP_DESC:
+                                       case TAG_IDENT_SBD:
                                        {
-                                               struct SpaceBitmapDesc *sp;
-                                               sp = (struct SpaceBitmapDesc *)bh->b_data;
+                                               struct spaceBitmapDesc *sp;
+                                               sp = (struct spaceBitmapDesc *)bh->b_data;
                                                newfileset.logicalBlockNum += 1 +
-                                                       ((le32_to_cpu(sp->numOfBytes) + sizeof(struct SpaceBitmapDesc) - 1)
+                                                       ((le32_to_cpu(sp->numOfBytes) + sizeof(struct spaceBitmapDesc) - 1)
                                                                >> sb->s_blocksize_bits);
                                                udf_release_data(bh);
                                                break;
                                        }
-                                       case TID_FILE_SET_DESC:
+                                       case TAG_IDENT_FSD:
                                        {
                                                *fileset = newfileset;
                                                break;
@@ -784,13 +784,13 @@ udf_find_fileset(struct super_block *sb, lb_addr *fileset, lb_addr *root)
 static void 
 udf_load_pvoldesc(struct super_block *sb, struct buffer_head *bh)
 {
-       struct PrimaryVolDesc *pvoldesc;
+       struct primaryVolDesc *pvoldesc;
        time_t recording;
        long recording_usec;
        struct ustr instr;
        struct ustr outstr;
 
-       pvoldesc = (struct PrimaryVolDesc *)bh->b_data;
+       pvoldesc = (struct primaryVolDesc *)bh->b_data;
 
        if ( udf_stamp_to_time(&recording, &recording_usec,
                lets_to_cpu(pvoldesc->recordingDateAndTime)) )
@@ -823,9 +823,9 @@ udf_load_pvoldesc(struct super_block *sb, struct buffer_head *bh)
 static void 
 udf_load_fileset(struct super_block *sb, struct buffer_head *bh, lb_addr *root)
 {
-       struct FileSetDesc *fset;
+       struct fileSetDesc *fset;
 
-       fset = (struct FileSetDesc *)bh->b_data;
+       fset = (struct fileSetDesc *)bh->b_data;
 
        *root = lelb_to_cpu(fset->rootDirectoryICB.extLocation);
 
@@ -838,10 +838,10 @@ udf_load_fileset(struct super_block *sb, struct buffer_head *bh, lb_addr *root)
 static void 
 udf_load_partdesc(struct super_block *sb, struct buffer_head *bh)
 {
-       struct PartitionDesc *p;
+       struct partitionDesc *p;
        int i;
 
-       p = (struct PartitionDesc *)bh->b_data;
+       p = (struct partitionDesc *)bh->b_data;
 
        for (i=0; i<UDF_SB_NUMPARTS(sb); i++)
        {
@@ -851,42 +851,42 @@ 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)
+                       if (le32_to_cpu(p->accessType) == PD_ACCESS_TYPE_READ_ONLY)
                                UDF_SB_PARTFLAGS(sb,i) |= UDF_PART_FLAG_READ_ONLY;
-                       if (le32_to_cpu(p->accessType) == PARTITION_ACCESS_WO)
+                       if (le32_to_cpu(p->accessType) == PD_ACCESS_TYPE_WRITE_ONCE)
                                UDF_SB_PARTFLAGS(sb,i) |= UDF_PART_FLAG_WRITE_ONCE;
-                       if (le32_to_cpu(p->accessType) == PARTITION_ACCESS_RW)
+                       if (le32_to_cpu(p->accessType) == PD_ACCESS_TYPE_REWRITABLE)
                                UDF_SB_PARTFLAGS(sb,i) |= UDF_PART_FLAG_REWRITABLE;
-                       if (le32_to_cpu(p->accessType) == PARTITION_ACCESS_OW)
+                       if (le32_to_cpu(p->accessType) == PD_ACCESS_TYPE_OVERWRITABLE)
                                UDF_SB_PARTFLAGS(sb,i) |= UDF_PART_FLAG_OVERWRITABLE;
 
-                       if (!strcmp(p->partitionContents.ident, PARTITION_CONTENTS_NSR02) ||
-                               !strcmp(p->partitionContents.ident, PARTITION_CONTENTS_NSR03))
+                       if (!strcmp(p->partitionContents.ident, PD_PARTITION_CONTENTS_NSR02) ||
+                               !strcmp(p->partitionContents.ident, PD_PARTITION_CONTENTS_NSR03))
                        {
-                               struct PartitionHeaderDesc *phd;
+                               struct partitionHeaderDesc *phd;
 
-                               phd = (struct PartitionHeaderDesc *)(p->partitionContentsUse);
-                               if (phd->unallocatedSpaceTable.extLength)
+                               phd = (struct partitionHeaderDesc *)(p->partitionContentsUse);
+                               if (phd->unallocSpaceTable.extLength)
                                {
-                                       lb_addr loc = { le32_to_cpu(phd->unallocatedSpaceTable.extPosition), i };
+                                       lb_addr loc = { le32_to_cpu(phd->unallocSpaceTable.extPosition), i };
 
                                        UDF_SB_PARTMAPS(sb)[i].s_uspace.s_table =
                                                udf_iget(sb, loc);
                                        UDF_SB_PARTFLAGS(sb,i) |= UDF_PART_FLAG_UNALLOC_TABLE;
-                                       udf_debug("unallocatedSpaceTable (part %d) @ %ld\n",
+                                       udf_debug("unallocSpaceTable (part %d) @ %ld\n",
                                                i, UDF_SB_PARTMAPS(sb)[i].s_uspace.s_table->i_ino);
                                }
-                               if (phd->unallocatedSpaceBitmap.extLength)
+                               if (phd->unallocSpaceBitmap.extLength)
                                {
                                        UDF_SB_ALLOC_BITMAP(sb, i, s_uspace);
                                        if (UDF_SB_PARTMAPS(sb)[i].s_uspace.s_bitmap != NULL)
                                        {
                                                UDF_SB_PARTMAPS(sb)[i].s_uspace.s_bitmap->s_extLength =
-                                                       le32_to_cpu(phd->unallocatedSpaceBitmap.extLength);
+                                                       le32_to_cpu(phd->unallocSpaceBitmap.extLength);
                                                UDF_SB_PARTMAPS(sb)[i].s_uspace.s_bitmap->s_extPosition =
-                                                       le32_to_cpu(phd->unallocatedSpaceBitmap.extPosition);
+                                                       le32_to_cpu(phd->unallocSpaceBitmap.extPosition);
                                                UDF_SB_PARTFLAGS(sb,i) |= UDF_PART_FLAG_UNALLOC_BITMAP;
-                                               udf_debug("unallocatedSpaceBitmap (part %d) @ %d\n",
+                                               udf_debug("unallocSpaceBitmap (part %d) @ %d\n",
                                                        i, UDF_SB_PARTMAPS(sb)[i].s_uspace.s_bitmap->s_extPosition);
                                        }
                                }
@@ -935,22 +935,22 @@ udf_load_partdesc(struct super_block *sb, struct buffer_head *bh)
 static int 
 udf_load_logicalvol(struct super_block *sb, struct buffer_head * bh, lb_addr *fileset)
 {
-       struct LogicalVolDesc *lvd;
+       struct logicalVolDesc *lvd;
        int i, j, offset;
-       Uint8 type;
+       uint8_t type;
 
-       lvd = (struct LogicalVolDesc *)bh->b_data;
+       lvd = (struct logicalVolDesc *)bh->b_data;
 
        UDF_SB_ALLOC_PARTMAPS(sb, le32_to_cpu(lvd->numPartitionMaps));
 
        for (i=0,offset=0;
                 i<UDF_SB_NUMPARTS(sb) && offset<le32_to_cpu(lvd->mapTableLength);
-                i++,offset+=((struct GenericPartitionMap *)&(lvd->partitionMaps[offset]))->partitionMapLength)
+                i++,offset+=((struct genericPartitionMap *)&(lvd->partitionMaps[offset]))->partitionMapLength)
        {
-               type = ((struct GenericPartitionMap *)&(lvd->partitionMaps[offset]))->partitionMapType;
+               type = ((struct genericPartitionMap *)&(lvd->partitionMaps[offset]))->partitionMapType;
                if (type == 1)
                {
-                       struct GenericPartitionMap1 *gpm1 = (struct GenericPartitionMap1 *)&(lvd->partitionMaps[offset]);
+                       struct genericPartitionMap1 *gpm1 = (struct genericPartitionMap1 *)&(lvd->partitionMaps[offset]);
                        UDF_SB_PARTTYPE(sb,i) = UDF_TYPE1_MAP15;
                        UDF_SB_PARTVSN(sb,i) = le16_to_cpu(gpm1->volSeqNum);
                        UDF_SB_PARTNUM(sb,i) = le16_to_cpu(gpm1->partitionNum);
@@ -958,15 +958,15 @@ udf_load_logicalvol(struct super_block *sb, struct buffer_head * bh, lb_addr *fi
                }
                else if (type == 2)
                {
-                       struct UdfPartitionMap2 *upm2 = (struct UdfPartitionMap2 *)&(lvd->partitionMaps[offset]);
+                       struct udfPartitionMap2 *upm2 = (struct udfPartitionMap2 *)&(lvd->partitionMaps[offset]);
                        if (!strncmp(upm2->partIdent.ident, UDF_ID_VIRTUAL, strlen(UDF_ID_VIRTUAL)))
                        {
-                               if (le16_to_cpu(((Uint16 *)upm2->partIdent.identSuffix)[0]) == 0x0150)
+                               if (le16_to_cpu(((uint16_t *)upm2->partIdent.identSuffix)[0]) == 0x0150)
                                {
                                        UDF_SB_PARTTYPE(sb,i) = UDF_VIRTUAL_MAP15;
                                        UDF_SB_PARTFUNC(sb,i) = udf_get_pblock_virt15;
                                }
-                               else if (le16_to_cpu(((Uint16 *)upm2->partIdent.identSuffix)[0]) == 0x0200)
+                               else if (le16_to_cpu(((uint16_t *)upm2->partIdent.identSuffix)[0]) == 0x0200)
                                {
                                        UDF_SB_PARTTYPE(sb,i) = UDF_VIRTUAL_MAP20;
                                        UDF_SB_PARTFUNC(sb,i) = udf_get_pblock_virt20;
@@ -974,10 +974,10 @@ udf_load_logicalvol(struct super_block *sb, struct buffer_head * bh, lb_addr *fi
                        }
                        else if (!strncmp(upm2->partIdent.ident, UDF_ID_SPARABLE, strlen(UDF_ID_SPARABLE)))
                        {
-                               Uint32 loc;
-                               Uint16 ident;
-                               struct SparingTable *st;
-                               struct SparablePartitionMap *spm = (struct SparablePartitionMap *)&(lvd->partitionMaps[offset]);
+                               uint32_t loc;
+                               uint16_t ident;
+                               struct sparingTable *st;
+                               struct sparablePartitionMap *spm = (struct sparablePartitionMap *)&(lvd->partitionMaps[offset]);
 
                                UDF_SB_PARTTYPE(sb,i) = UDF_SPARABLE_MAP15;
                                UDF_SB_TYPESPAR(sb,i).s_packet_len = le16_to_cpu(spm->packetLength);
@@ -988,7 +988,7 @@ udf_load_logicalvol(struct super_block *sb, struct buffer_head * bh, lb_addr *fi
                                                udf_read_tagged(sb, loc, loc, &ident);
                                        if (UDF_SB_TYPESPAR(sb,i).s_spar_map[j] != NULL)
                                        {
-                                               st = (struct SparingTable *)UDF_SB_TYPESPAR(sb,i).s_spar_map[j]->b_data;
+                                               st = (struct sparingTable *)UDF_SB_TYPESPAR(sb,i).s_spar_map[j]->b_data;
                                                if (ident != 0 ||
                                                        strncmp(st->sparingIdent.ident, UDF_ID_SPARING, strlen(UDF_ID_SPARING)))
                                                {
@@ -1033,12 +1033,12 @@ static void
 udf_load_logicalvolint(struct super_block *sb, extent_ad loc)
 {
        struct buffer_head *bh = NULL;
-       Uint16 ident;
+       uint16_t ident;
 
        while (loc.extLength > 0 &&
                (bh = udf_read_tagged(sb, loc.extLocation,
                        loc.extLocation, &ident)) &&
-               ident == TID_LOGICAL_VOL_INTEGRITY_DESC)
+               ident == TAG_IDENT_LVID)
        {
                UDF_SB_LVIDBH(sb) = bh;
                
@@ -1074,12 +1074,12 @@ udf_process_sequence(struct super_block *sb, long block, long lastblock, lb_addr
 {
        struct buffer_head *bh = NULL;
        struct udf_vds_record vds[VDS_POS_LENGTH];
-       struct GenericDesc *gd;
-       struct VolDescPtr *vdp;
+       struct generic_desc *gd;
+       struct volDescPtr *vdp;
        int done=0;
        int i,j;
-       Uint32 vdsn;
-       Uint16 ident;
+       uint32_t vdsn;
+       uint16_t ident;
        long next_s = 0, next_e = 0;
 
        memset(vds, 0, sizeof(struct udf_vds_record) * VDS_POS_LENGTH);
@@ -1093,56 +1093,56 @@ udf_process_sequence(struct super_block *sb, long block, long lastblock, lb_addr
                        break;
 
                /* Process each descriptor (ISO 13346 3/8.3-8.4) */
-               gd = (struct GenericDesc *)bh->b_data;
+               gd = (struct generic_desc *)bh->b_data;
                vdsn = le32_to_cpu(gd->volDescSeqNum);
                switch (ident)
                {
-                       case TID_PRIMARY_VOL_DESC: /* ISO 13346 3/10.1 */
+                       case TAG_IDENT_PVD: /* ISO 13346 3/10.1 */
                                if (vdsn >= vds[VDS_POS_PRIMARY_VOL_DESC].volDescSeqNum)
                                {
                                        vds[VDS_POS_PRIMARY_VOL_DESC].volDescSeqNum = vdsn;
                                        vds[VDS_POS_PRIMARY_VOL_DESC].block = block;
                                }
                                break;
-                       case TID_VOL_DESC_PTR: /* ISO 13346 3/10.3 */
+                       case TAG_IDENT_VDP: /* ISO 13346 3/10.3 */
                                if (vdsn >= vds[VDS_POS_VOL_DESC_PTR].volDescSeqNum)
                                {
                                        vds[VDS_POS_VOL_DESC_PTR].volDescSeqNum = vdsn;
                                        vds[VDS_POS_VOL_DESC_PTR].block = block;
 
-                                       vdp = (struct VolDescPtr *)bh->b_data;
+                                       vdp = (struct volDescPtr *)bh->b_data;
                                        next_s = le32_to_cpu(vdp->nextVolDescSeqExt.extLocation);
                                        next_e = le32_to_cpu(vdp->nextVolDescSeqExt.extLength);
                                        next_e = next_e >> sb->s_blocksize_bits;
                                        next_e += next_s;
                                }
                                break;
-                       case TID_IMP_USE_VOL_DESC: /* ISO 13346 3/10.4 */
+                       case TAG_IDENT_IUVD: /* ISO 13346 3/10.4 */
                                if (vdsn >= vds[VDS_POS_IMP_USE_VOL_DESC].volDescSeqNum)
                                {
                                        vds[VDS_POS_IMP_USE_VOL_DESC].volDescSeqNum = vdsn;
                                        vds[VDS_POS_IMP_USE_VOL_DESC].block = block;
                                }
                                break;
-                       case TID_PARTITION_DESC: /* ISO 13346 3/10.5 */
+                       case TAG_IDENT_PD: /* ISO 13346 3/10.5 */
                                if (!vds[VDS_POS_PARTITION_DESC].block)
                                        vds[VDS_POS_PARTITION_DESC].block = block;
                                break;
-                       case TID_LOGICAL_VOL_DESC: /* ISO 13346 3/10.6 */
+                       case TAG_IDENT_LVD: /* ISO 13346 3/10.6 */
                                if (vdsn >= vds[VDS_POS_LOGICAL_VOL_DESC].volDescSeqNum)
                                {
                                        vds[VDS_POS_LOGICAL_VOL_DESC].volDescSeqNum = vdsn;
                                        vds[VDS_POS_LOGICAL_VOL_DESC].block = block;
                                }
                                break;
-                       case TID_UNALLOC_SPACE_DESC: /* ISO 13346 3/10.8 */
+                       case TAG_IDENT_USD: /* ISO 13346 3/10.8 */
                                if (vdsn >= vds[VDS_POS_UNALLOC_SPACE_DESC].volDescSeqNum)
                                {
                                        vds[VDS_POS_UNALLOC_SPACE_DESC].volDescSeqNum = vdsn;
                                        vds[VDS_POS_UNALLOC_SPACE_DESC].block = block;
                                }
                                break;
-                       case TID_TERMINATING_DESC: /* ISO 13346 3/10.9 */
+                       case TAG_IDENT_TD: /* ISO 13346 3/10.9 */
                                vds[VDS_POS_TERMINATING_DESC].block = block;
                                if (next_e)
                                {
@@ -1173,8 +1173,8 @@ udf_process_sequence(struct super_block *sb, long block, long lastblock, lb_addr
                                for (j=vds[i].block+1; j<vds[VDS_POS_TERMINATING_DESC].block; j++)
                                {
                                        bh2 = udf_read_tagged(sb, j, j, &ident);
-                                       gd = (struct GenericDesc *)bh2->b_data;
-                                       if (ident == TID_PARTITION_DESC)
+                                       gd = (struct generic_desc *)bh2->b_data;
+                                       if (ident == TAG_IDENT_PD)
                                                udf_load_partdesc(sb, bh2);
                                        udf_release_data(bh2);
                                }
@@ -1215,8 +1215,8 @@ udf_check_valid(struct super_block *sb, int novrs, int silent)
 static int
 udf_load_partition(struct super_block *sb, lb_addr *fileset)
 {
-       struct AnchorVolDescPtr *anchor;
-       Uint16 ident;
+       struct anchorVolDescPtr *anchor;
+       uint16_t ident;
        struct buffer_head *bh;
        long main_s, main_e, reserve_s, reserve_e;
        int i, j;
@@ -1229,7 +1229,7 @@ udf_load_partition(struct super_block *sb, lb_addr *fileset)
                if (UDF_SB_ANCHOR(sb)[i] && (bh = udf_read_tagged(sb,
                        UDF_SB_ANCHOR(sb)[i], UDF_SB_ANCHOR(sb)[i], &ident)))
                {
-                       anchor = (struct AnchorVolDescPtr *)bh->b_data;
+                       anchor = (struct anchorVolDescPtr *)bh->b_data;
 
                        /* Locate the main sequence */
                        main_s = le32_to_cpu( anchor->mainVolDescSeqExt.extLocation );
@@ -1311,12 +1311,12 @@ udf_load_partition(struct super_block *sb, lb_addr *fileset)
                                else if (UDF_SB_PARTTYPE(sb,i) == UDF_VIRTUAL_MAP20)
                                {
                                        struct buffer_head *bh = NULL;
-                                       Uint32 pos;
+                                       uint32_t pos;
 
                                        pos = udf_block_map(UDF_SB_VAT(sb), 0);
                                        bh = sb_bread(sb, pos);
                                        UDF_SB_TYPEVIRT(sb,i).s_start_offset =
-                                               le16_to_cpu(((struct VirtualAllocationTable20 *)bh->b_data + udf_ext0_offset(UDF_SB_VAT(sb)))->lengthHeader) +
+                                               le16_to_cpu(((struct virtualAllocationTable20 *)bh->b_data + udf_ext0_offset(UDF_SB_VAT(sb)))->lengthHeader) +
                                                        udf_ext0_offset(UDF_SB_VAT(sb));
                                        UDF_SB_TYPEVIRT(sb,i).s_num_entries = (UDF_SB_VAT(sb)->i_size -
                                                UDF_SB_TYPEVIRT(sb,i).s_start_offset) >> 2;
@@ -1341,7 +1341,7 @@ static void udf_open_lvid(struct super_block *sb)
                UDF_SB_LVIDIU(sb)->impIdent.identSuffix[1] = UDF_OS_ID_LINUX;
                if (udf_time_to_stamp(&cpu_time, CURRENT_TIME, CURRENT_UTIME))
                        UDF_SB_LVID(sb)->recordingDateAndTime = cpu_to_lets(cpu_time);
-               UDF_SB_LVID(sb)->integrityType = INTEGRITY_TYPE_OPEN;
+               UDF_SB_LVID(sb)->integrityType = LVID_INTEGRITY_TYPE_OPEN;
 
                UDF_SB_LVID(sb)->descTag.descCRC =
                        cpu_to_le16(udf_crc((char *)UDF_SB_LVID(sb) + sizeof(tag),
@@ -1351,7 +1351,7 @@ static void udf_open_lvid(struct super_block *sb)
                for (i=0; i<16; i++)
                        if (i != 4)
                                UDF_SB_LVID(sb)->descTag.tagChecksum +=
-                                       ((Uint8 *)&(UDF_SB_LVID(sb)->descTag))[i];
+                                       ((uint8_t *)&(UDF_SB_LVID(sb)->descTag))[i];
 
                mark_buffer_dirty(UDF_SB_LVIDBH(sb));
        }
@@ -1360,7 +1360,7 @@ static void udf_open_lvid(struct super_block *sb)
 static void udf_close_lvid(struct super_block *sb)
 {
        if (UDF_SB_LVIDBH(sb) &&
-               UDF_SB_LVID(sb)->integrityType == INTEGRITY_TYPE_OPEN)
+               UDF_SB_LVID(sb)->integrityType == LVID_INTEGRITY_TYPE_OPEN)
        {
                int i;
                timestamp cpu_time;
@@ -1375,7 +1375,7 @@ static void udf_close_lvid(struct super_block *sb)
                        UDF_SB_LVIDIU(sb)->minUDFReadRev = cpu_to_le16(UDF_SB_UDFREV(sb));
                if (UDF_SB_UDFREV(sb) > le16_to_cpu(UDF_SB_LVIDIU(sb)->minUDFWriteRev))
                        UDF_SB_LVIDIU(sb)->minUDFWriteRev = cpu_to_le16(UDF_SB_UDFREV(sb));
-               UDF_SB_LVID(sb)->integrityType = INTEGRITY_TYPE_CLOSE;
+               UDF_SB_LVID(sb)->integrityType = LVID_INTEGRITY_TYPE_CLOSE;
 
                UDF_SB_LVID(sb)->descTag.descCRC =
                        cpu_to_le16(udf_crc((char *)UDF_SB_LVID(sb) + sizeof(tag),
@@ -1385,7 +1385,7 @@ static void udf_close_lvid(struct super_block *sb)
                for (i=0; i<16; i++)
                        if (i != 4)
                                UDF_SB_LVID(sb)->descTag.tagChecksum +=
-                                       ((Uint8 *)&(UDF_SB_LVID(sb)->descTag))[i];
+                                       ((uint8_t *)&(UDF_SB_LVID(sb)->descTag))[i];
 
                mark_buffer_dirty(UDF_SB_LVIDBH(sb));
        }
@@ -1497,9 +1497,9 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
 
        if ( UDF_SB_LVIDBH(sb) )
        {
-               Uint16 minUDFReadRev = le16_to_cpu(UDF_SB_LVIDIU(sb)->minUDFReadRev);
-               Uint16 minUDFWriteRev = le16_to_cpu(UDF_SB_LVIDIU(sb)->minUDFWriteRev);
-               /* Uint16 maxUDFWriteRev = le16_to_cpu(UDF_SB_LVIDIU(sb)->maxUDFWriteRev); */
+               uint16_t minUDFReadRev = le16_to_cpu(UDF_SB_LVIDIU(sb)->minUDFReadRev);
+               uint16_t minUDFWriteRev = le16_to_cpu(UDF_SB_LVIDIU(sb)->minUDFWriteRev);
+               /* uint16_t maxUDFWriteRev = le16_to_cpu(UDF_SB_LVIDIU(sb)->maxUDFWriteRev); */
 
                if (minUDFReadRev > UDF_MAX_READ_VERSION)
                {
@@ -1742,11 +1742,11 @@ udf_count_free_bitmap(struct super_block *sb, struct udf_bitmap *bitmap)
        int index;
        int block = 0, newblock;
        lb_addr loc;
-       Uint32 bytes;
-       Uint8 value;
-       Uint8 *ptr;
-       Uint16 ident;
-       struct SpaceBitmapDesc *bm;
+       uint32_t bytes;
+       uint8_t value;
+       uint8_t *ptr;
+       uint16_t ident;
+       struct spaceBitmapDesc *bm;
 
        loc.logicalBlockNum = bitmap->s_extPosition;
        loc.partitionReferenceNum = UDF_SB_PARTITION(sb);
@@ -1757,17 +1757,17 @@ udf_count_free_bitmap(struct super_block *sb, struct udf_bitmap *bitmap)
                printk(KERN_ERR "udf: udf_count_free failed\n");
                return 0;
        }
-       else if (ident != TID_SPACE_BITMAP_DESC)
+       else if (ident != TAG_IDENT_SBD)
        {
                udf_release_data(bh);
                printk(KERN_ERR "udf: udf_count_free failed\n");
                return 0;
        }
 
-       bm = (struct SpaceBitmapDesc *)bh->b_data;
+       bm = (struct spaceBitmapDesc *)bh->b_data;
        bytes = bm->numOfBytes;
-       index = sizeof(struct SpaceBitmapDesc); /* offset in first block only */
-       ptr = (Uint8 *)bh->b_data;
+       index = sizeof(struct spaceBitmapDesc); /* offset in first block only */
+       ptr = (uint8_t *)bh->b_data;
 
        while ( bytes > 0 )
        {
@@ -1790,7 +1790,7 @@ udf_count_free_bitmap(struct super_block *sb, struct udf_bitmap *bitmap)
                                return accum;
                        }
                        index = 0;
-                       ptr = (Uint8 *)bh->b_data;
+                       ptr = (uint8_t *)bh->b_data;
                }
        }
        udf_release_data(bh);
@@ -1801,13 +1801,13 @@ static unsigned int
 udf_count_free_table(struct super_block *sb, struct inode * table)
 {
        unsigned int accum = 0;
-       Uint32 extoffset, elen;
+       uint32_t extoffset, elen;
        lb_addr bloc, eloc;
-       Sint8 etype;
+       int8_t etype;
        struct buffer_head *bh = NULL;
 
        bloc = UDF_I_LOCATION(table);
-       extoffset = sizeof(struct UnallocatedSpaceEntry);
+       extoffset = sizeof(struct unallocSpaceEntry);
 
        while ((etype = udf_next_aext(table, &bloc, &extoffset, &eloc, &elen, &bh, 1)) != -1)
        {
index 7a0eebeda03e71a754b710dd960210d43823de0f..c9c5154af5880aa39ae9b7720bd6956df24b632c 100644 (file)
@@ -15,7 +15,7 @@
  *             ftp://prep.ai.mit.edu/pub/gnu/GPL
  *     Each contributing author retains all rights to their own work.
  *
- *  (C) 1998-2000 Ben Fennema
+ *  (C) 1998-2001 Ben Fennema
  *  (C) 1999 Stelias Computing Inc 
  *
  * HISTORY
 
 static void udf_pc_to_char(char *from, int fromlen, char *to)
 {
-       struct PathComponent *pc;
+       struct pathComponent *pc;
        int elen = 0;
        char *p = to;
 
        while (elen < fromlen)
        {
-               pc = (struct PathComponent *)(from + elen);
+               pc = (struct pathComponent *)(from + elen);
                switch (pc->componentType)
                {
                        case 1:
@@ -69,7 +69,7 @@ static void udf_pc_to_char(char *from, int fromlen, char *to)
                                p += pc->lengthComponentIdent;
                                *p++ = '/';
                }
-               elen += sizeof(struct PathComponent) + pc->lengthComponentIdent;
+               elen += sizeof(struct pathComponent) + pc->lengthComponentIdent;
        }
        if (p > to+1)
                p[-1] = '\0';
@@ -86,7 +86,7 @@ static int udf_symlink_filler(struct file *file, struct page *page)
        char *p = kmap(page);
        
        lock_kernel();
-       if (UDF_I_ALLOCTYPE(inode) == ICB_FLAG_AD_IN_ICB)
+       if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_IN_ICB)
        {
                bh = udf_tread(inode->i_sb, inode->i_ino);
 
index 5ffebd9a486506f9d589daf1609567113e5ffe15..0ae7e965b1c9970fa6dac86d0ddea32e6ac8c293 100644 (file)
@@ -15,7 +15,7 @@
  *             ftp://prep.ai.mit.edu/pub/gnu/GPL
  *     Each contributing author retains all rights to their own work.
  *
- *  (C) 1999-2000 Ben Fennema
+ *  (C) 1999-2001 Ben Fennema
  *  (C) 1999 Stelias Computing Inc
  *
  * HISTORY
@@ -33,7 +33,7 @@
 #include "udf_sb.h"
 
 static void extent_trunc(struct inode * inode, lb_addr bloc, int extoffset,
-       lb_addr eloc, Sint8 etype, Uint32 elen, struct buffer_head *bh, Uint32 nelen)
+       lb_addr eloc, int8_t etype, uint32_t elen, struct buffer_head *bh, uint32_t nelen)
 {
        lb_addr neloc = { 0, 0 };
        int last_block = (elen + inode->i_sb->s_blocksize - 1) >> inode->i_sb->s_blocksize_bits;
@@ -41,10 +41,10 @@ static void extent_trunc(struct inode * inode, lb_addr bloc, int extoffset,
 
        if (nelen)
        {
-               if (etype == EXTENT_NOT_RECORDED_ALLOCATED)
+               if (etype == (EXT_NOT_RECORDED_ALLOCATED >> 30))
                {
                        udf_free_blocks(inode->i_sb, inode, eloc, 0, last_block);
-                       etype = EXTENT_NOT_RECORDED_NOT_ALLOCATED;
+                       etype = (EXT_NOT_RECORDED_NOT_ALLOCATED >> 30);
                }
                else
                        neloc = eloc;
@@ -56,10 +56,10 @@ static void extent_trunc(struct inode * inode, lb_addr bloc, int extoffset,
                udf_write_aext(inode, bloc, &extoffset, neloc, nelen, bh, 0);
                if (last_block - first_block > 0)
                {
-                       if (etype == EXTENT_RECORDED_ALLOCATED)
+                       if (etype == (EXT_RECORDED_ALLOCATED >> 30))
                                mark_inode_dirty(inode);
 
-                       if (etype != EXTENT_NOT_RECORDED_NOT_ALLOCATED)
+                       if (etype != (EXT_NOT_RECORDED_NOT_ALLOCATED >> 30))
                                udf_free_blocks(inode->i_sb, inode, eloc, first_block, last_block - first_block);
                }
        }
@@ -68,15 +68,15 @@ static void extent_trunc(struct inode * inode, lb_addr bloc, int extoffset,
 void udf_truncate_extents(struct inode * inode)
 {
        lb_addr bloc, eloc, neloc = { 0, 0 };
-       Uint32 extoffset, elen, offset, nelen = 0, lelen = 0, lenalloc;
-       Sint8 etype;
+       uint32_t extoffset, elen, offset, nelen = 0, lelen = 0, lenalloc;
+       int8_t etype;
        int first_block = inode->i_size >> inode->i_sb->s_blocksize_bits;
        struct buffer_head *bh = NULL;
        int adsize;
 
-       if (UDF_I_ALLOCTYPE(inode) == ICB_FLAG_AD_SHORT)
+       if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_SHORT)
                adsize = sizeof(short_ad);
-       else if (UDF_I_ALLOCTYPE(inode) == ICB_FLAG_AD_LONG)
+       else if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_LONG)
                adsize = sizeof(long_ad);
        else
                adsize = 0;
@@ -97,11 +97,11 @@ void udf_truncate_extents(struct inode * inode)
                if (!memcmp(&UDF_I_LOCATION(inode), &bloc, sizeof(lb_addr)))
                        lenalloc -= udf_file_entry_alloc_offset(inode);
                else
-                       lenalloc -= sizeof(struct AllocExtDesc);
+                       lenalloc -= sizeof(struct allocExtDesc);
 
                while ((etype = udf_current_aext(inode, &bloc, &extoffset, &eloc, &elen, &bh, 0)) != -1)
                {
-                       if (etype == EXTENT_NEXT_EXTENT_ALLOCDECS)
+                       if (etype == (EXT_NEXT_EXTENT_ALLOCDECS >> 30))
                        {
                                udf_write_aext(inode, bloc, &extoffset, neloc, nelen, bh, 0);
                                extoffset = 0;
@@ -110,7 +110,7 @@ void udf_truncate_extents(struct inode * inode)
                                        if (!memcmp(&UDF_I_LOCATION(inode), &bloc, sizeof(lb_addr)))
                                                memset(bh->b_data, 0x00, udf_file_entry_alloc_offset(inode));
                                        else
-                                               memset(bh->b_data, 0x00, sizeof(struct AllocExtDesc));
+                                               memset(bh->b_data, 0x00, sizeof(struct allocExtDesc));
                                        udf_free_blocks(inode->i_sb, inode, bloc, 0, lelen);
                                }
                                else
@@ -122,13 +122,13 @@ void udf_truncate_extents(struct inode * inode)
                                        }
                                        else
                                        {
-                                               struct AllocExtDesc *aed = (struct AllocExtDesc *)(bh->b_data);
+                                               struct allocExtDesc *aed = (struct allocExtDesc *)(bh->b_data);
                                                aed->lengthAllocDescs = cpu_to_le32(lenalloc);
                                                if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) || UDF_SB_UDFREV(inode->i_sb) >= 0x0201)
                                                        udf_update_tag(bh->b_data, lenalloc +
-                                                               sizeof(struct AllocExtDesc));
+                                                               sizeof(struct allocExtDesc));
                                                else
-                                                       udf_update_tag(bh->b_data, sizeof(struct AllocExtDesc));
+                                                       udf_update_tag(bh->b_data, sizeof(struct allocExtDesc));
                                                mark_buffer_dirty_inode(bh, inode);
                                        }
                                }
@@ -155,7 +155,7 @@ void udf_truncate_extents(struct inode * inode)
                        if (!memcmp(&UDF_I_LOCATION(inode), &bloc, sizeof(lb_addr)))
                                memset(bh->b_data, 0x00, udf_file_entry_alloc_offset(inode));
                        else
-                               memset(bh->b_data, 0x00, sizeof(struct AllocExtDesc));
+                               memset(bh->b_data, 0x00, sizeof(struct allocExtDesc));
                        udf_free_blocks(inode->i_sb, inode, bloc, 0, lelen);
                }
                else
@@ -167,13 +167,13 @@ void udf_truncate_extents(struct inode * inode)
                        }
                        else
                        {
-                               struct AllocExtDesc *aed = (struct AllocExtDesc *)(bh->b_data);
+                               struct allocExtDesc *aed = (struct allocExtDesc *)(bh->b_data);
                                aed->lengthAllocDescs = cpu_to_le32(lenalloc);
                                if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) || UDF_SB_UDFREV(inode->i_sb) >= 0x0201)
                                        udf_update_tag(bh->b_data, lenalloc +
-                                               sizeof(struct AllocExtDesc));
+                                               sizeof(struct allocExtDesc));
                                else
-                                       udf_update_tag(bh->b_data, sizeof(struct AllocExtDesc));
+                                       udf_update_tag(bh->b_data, sizeof(struct allocExtDesc));
                                mark_buffer_dirty_inode(bh, inode);
                        }
                }
@@ -184,17 +184,17 @@ void udf_truncate_extents(struct inode * inode)
                {
                        extoffset -= adsize;
                        etype = udf_next_aext(inode, &bloc, &extoffset, &eloc, &elen, &bh, 1);
-                       if (etype == EXTENT_NOT_RECORDED_NOT_ALLOCATED)
+                       if (etype == (EXT_NOT_RECORDED_NOT_ALLOCATED >> 30))
                        {
                                extoffset -= adsize;
-                               elen = (EXTENT_NOT_RECORDED_NOT_ALLOCATED << 30) | (elen + offset);
+                               elen = EXT_NOT_RECORDED_NOT_ALLOCATED | (elen + offset);
                                udf_write_aext(inode, bloc, &extoffset, eloc, elen, bh, 0);
                        }
-                       else if (etype == EXTENT_NOT_RECORDED_ALLOCATED)
+                       else if (etype == (EXT_NOT_RECORDED_ALLOCATED >> 30))
                        {
                                lb_addr neloc = { 0, 0 };
                                extoffset -= adsize;
-                               nelen = (EXTENT_NOT_RECORDED_NOT_ALLOCATED << 30) |
+                               nelen = EXT_NOT_RECORDED_NOT_ALLOCATED |
                                        ((elen + offset + inode->i_sb->s_blocksize - 1) &
                                        ~(inode->i_sb->s_blocksize - 1));
                                udf_write_aext(inode, bloc, &extoffset, neloc, nelen, bh, 1);
@@ -205,13 +205,13 @@ void udf_truncate_extents(struct inode * inode)
                                if (elen & (inode->i_sb->s_blocksize - 1))
                                {
                                        extoffset -= adsize;
-                                       elen = (EXTENT_RECORDED_ALLOCATED << 30) |
+                                       elen = EXT_RECORDED_ALLOCATED |
                                                ((elen + inode->i_sb->s_blocksize - 1) &
                                                ~(inode->i_sb->s_blocksize - 1));
                                        udf_write_aext(inode, bloc, &extoffset, eloc, elen, bh, 1);
                                }
                                memset(&eloc, 0x00, sizeof(lb_addr));
-                               elen = (EXTENT_NOT_RECORDED_NOT_ALLOCATED << 30) | offset;
+                               elen = EXT_NOT_RECORDED_NOT_ALLOCATED | offset;
                                udf_add_aext(inode, &bloc, &extoffset, eloc, elen, &bh, 1);
                        }
                }
index 7f627543683d7980c284f53daf4d3e491cd0aa61..a967f2c4a9d34feac65d80f46d44e56390324130 100644 (file)
@@ -13,7 +13,7 @@ static inline struct udf_inode_info *UDF_I(struct inode *inode)
 #define UDF_I_LENEXTENTS(X)    ( UDF_I(X)->i_lenExtents )
 #define UDF_I_UNIQUE(X)                ( UDF_I(X)->i_unique )
 #define UDF_I_ALLOCTYPE(X)     ( UDF_I(X)->i_alloc_type )
-#define UDF_I_EXTENDED_FE(X)( UDF_I(X)->i_extended_fe )
+#define UDF_I_EXTENDED_FE(X)   ( UDF_I(X)->i_extended_fe )
 #define UDF_I_STRAT4096(X)     ( UDF_I(X)->i_strat_4096 )
 #define UDF_I_NEW_INODE(X)     ( UDF_I(X)->i_new_inode )
 #define UDF_I_NEXT_ALLOC_BLOCK(X)      ( UDF_I(X)->i_next_alloc_block )
index 85e01bf94b1dda9196a91572406d8f1701e0c4dd..0dde99415c976cc51bcbb8e7ab0b6e62c96710f2 100644 (file)
@@ -58,7 +58,7 @@
 
 #define UDF_SB_ALLOC_BITMAP(X,Y,Z)\
 {\
-       int nr_groups = ((UDF_SB_PARTLEN((X),(Y)) + (sizeof(struct SpaceBitmapDesc) << 3) +\
+       int nr_groups = ((UDF_SB_PARTLEN((X),(Y)) + (sizeof(struct spaceBitmapDesc) << 3) +\
                ((X)->s_blocksize * 8) - 1) / ((X)->s_blocksize * 8));\
        UDF_SB_PARTMAPS(X)[(Y)].Z.s_bitmap = kmalloc(sizeof(struct udf_bitmap) +\
                sizeof(struct buffer_head *) * nr_groups,\
 }
 
 
-#define UDF_QUERY_FLAG(X,Y)                            ( UDF_SB(X)->s_flags & ( 1 << (Y) ) )
-#define UDF_SET_FLAG(X,Y)                              ( UDF_SB(X)->s_flags |= ( 1 << (Y) ) )
-#define UDF_CLEAR_FLAG(X,Y)                            ( UDF_SB(X)->s_flags &= ~( 1 << (Y) ) )
+#define UDF_QUERY_FLAG(X,Y)                    ( UDF_SB(X)->s_flags & ( 1 << (Y) ) )
+#define UDF_SET_FLAG(X,Y)                      ( UDF_SB(X)->s_flags |= ( 1 << (Y) ) )
+#define UDF_CLEAR_FLAG(X,Y)                    ( UDF_SB(X)->s_flags &= ~( 1 << (Y) ) )
 
 #define UDF_UPDATE_UDFREV(X,Y)                 ( ((Y) > UDF_SB_UDFREV(X)) ? UDF_SB_UDFREV(X) = (Y) : UDF_SB_UDFREV(X) )
 
-#define UDF_SB_PARTMAPS(X)                             ( UDF_SB(X)->s_partmaps )
+#define UDF_SB_PARTMAPS(X)                     ( UDF_SB(X)->s_partmaps )
 #define UDF_SB_PARTTYPE(X,Y)                   ( UDF_SB_PARTMAPS(X)[(Y)].s_partition_type )
 #define UDF_SB_PARTROOT(X,Y)                   ( UDF_SB_PARTMAPS(X)[(Y)].s_partition_root )
-#define UDF_SB_PARTLEN(X,Y)                            ( UDF_SB_PARTMAPS(X)[(Y)].s_partition_len )
-#define UDF_SB_PARTVSN(X,Y)                            ( UDF_SB_PARTMAPS(X)[(Y)].s_volumeseqnum )
-#define UDF_SB_PARTNUM(X,Y)                            ( UDF_SB_PARTMAPS(X)[(Y)].s_partition_num )
+#define UDF_SB_PARTLEN(X,Y)                    ( UDF_SB_PARTMAPS(X)[(Y)].s_partition_len )
+#define UDF_SB_PARTVSN(X,Y)                    ( UDF_SB_PARTMAPS(X)[(Y)].s_volumeseqnum )
+#define UDF_SB_PARTNUM(X,Y)                    ( UDF_SB_PARTMAPS(X)[(Y)].s_partition_num )
 #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_BITMAP(X,Y,Z,I)                 ( UDF_SB_PARTMAPS(X)[(Y)].Z.s_bitmap->s_block_bitmap[I] )
 #define UDF_SB_BITMAP_NR_GROUPS(X,Y,Z) ( UDF_SB_PARTMAPS(X)[(Y)].Z.s_bitmap->s_nr_groups )
 
-#define UDF_SB_VOLIDENT(X)                             ( UDF_SB(X)->s_volident )
-#define UDF_SB_NUMPARTS(X)                             ( UDF_SB(X)->s_partitions )
-#define UDF_SB_PARTITION(X)                            ( UDF_SB(X)->s_partition )
-#define UDF_SB_SESSION(X)                              ( UDF_SB(X)->s_session )
-#define UDF_SB_ANCHOR(X)                               ( UDF_SB(X)->s_anchor )
-#define UDF_SB_LASTBLOCK(X)                            ( UDF_SB(X)->s_lastblock )
-#define UDF_SB_LVIDBH(X)                               ( UDF_SB(X)->s_lvidbh )
-#define UDF_SB_LVID(X)                                 ( (struct LogicalVolIntegrityDesc *)UDF_SB_LVIDBH(X)->b_data )
-#define UDF_SB_LVIDIU(X)                               ( (struct LogicalVolIntegrityDescImpUse *)&(UDF_SB_LVID(X)->impUse[le32_to_cpu(UDF_SB_LVID(X)->numOfPartitions) * 2 * sizeof(Uint32)/sizeof(Uint8)]) )
+#define UDF_SB_VOLIDENT(X)                     ( UDF_SB(X)->s_volident )
+#define UDF_SB_NUMPARTS(X)                     ( UDF_SB(X)->s_partitions )
+#define UDF_SB_PARTITION(X)                    ( UDF_SB(X)->s_partition )
+#define UDF_SB_SESSION(X)                      ( UDF_SB(X)->s_session )
+#define UDF_SB_ANCHOR(X)                       ( UDF_SB(X)->s_anchor )
+#define UDF_SB_LASTBLOCK(X)                    ( UDF_SB(X)->s_lastblock )
+#define UDF_SB_LVIDBH(X)                       ( UDF_SB(X)->s_lvidbh )
+#define UDF_SB_LVID(X)                         ( (struct logicalVolIntegrityDesc *)UDF_SB_LVIDBH(X)->b_data )
+#define UDF_SB_LVIDIU(X)                       ( (struct logicalVolIntegrityDescImpUse *)&(UDF_SB_LVID(X)->impUse[le32_to_cpu(UDF_SB_LVID(X)->numOfPartitions) * 2 * sizeof(uint32_t)/sizeof(uint8_t)]) )
 
-#define UDF_SB_UMASK(X)                                        ( UDF_SB(X)->s_umask )
-#define UDF_SB_GID(X)                                  ( UDF_SB(X)->s_gid )
-#define UDF_SB_UID(X)                                  ( UDF_SB(X)->s_uid )
+#define UDF_SB_UMASK(X)                                ( UDF_SB(X)->s_umask )
+#define UDF_SB_GID(X)                          ( UDF_SB(X)->s_gid )
+#define UDF_SB_UID(X)                          ( UDF_SB(X)->s_uid )
 #define UDF_SB_RECORDTIME(X)                   ( UDF_SB(X)->s_recordtime )
-#define UDF_SB_SERIALNUM(X)                            ( UDF_SB(X)->s_serialnum )
-#define UDF_SB_UDFREV(X)                               ( UDF_SB(X)->s_udfrev )
-#define UDF_SB_FLAGS(X)                                        ( UDF_SB(X)->s_flags )
-#define UDF_SB_VAT(X)                                  ( UDF_SB(X)->s_vat )
+#define UDF_SB_SERIALNUM(X)                    ( UDF_SB(X)->s_serialnum )
+#define UDF_SB_UDFREV(X)                       ( UDF_SB(X)->s_udfrev )
+#define UDF_SB_FLAGS(X)                                ( UDF_SB(X)->s_flags )
+#define UDF_SB_VAT(X)                          ( UDF_SB(X)->s_vat )
 
 #endif /* __LINUX_UDF_SB_H */
index 56d80d31ce079ed32d10276f8cb60c8b9e2dc937..836aef50cdeddf1c16673ff545199ef2c3050a26 100644 (file)
@@ -1,50 +1,49 @@
 #ifndef __UDF_DECL_H
 #define __UDF_DECL_H
 
-#include <linux/udf_167.h>
-#include <linux/udf_udf.h>
-#include "udfend.h"
-
 #include <linux/udf_fs.h>
+#include "ecma_167.h"
+#include "osta_udf.h"
 
-#ifdef __KERNEL__
-
+#include <linux/fs.h>
 #include <linux/config.h>
 #include <linux/types.h>
-#include <linux/fs.h>
+
+#ifndef LINUX_VERSION_CODE
+#include <linux/version.h>
+#endif
 
 #if !defined(CONFIG_UDF_FS) && !defined(CONFIG_UDF_FS_MODULE)
 #define CONFIG_UDF_FS_MODULE
-#include <linux/udf_fs_sb.h>
 #include <linux/udf_fs_i.h>
+#include <linux/udf_fs_sb.h>
 #endif
 
+#include "udfend.h"
+
 #define udf_fixed_to_variable(x) ( ( ( (x) >> 5 ) * 39 ) + ( (x) & 0x0000001F ) )
 #define udf_variable_to_fixed(x) ( ( ( (x) / 39 ) << 5 ) + ( (x) % 39 ) )
 
+#define UDF_EXTENT_LENGTH_MASK 0x3FFFFFFF
+#define UDF_EXTENT_FLAG_MASK   0xC0000000
+
+#define UDF_NAME_PAD           4
+#define UDF_NAME_LEN           255
+#define UDF_PATH_LEN           1023
+
 #define CURRENT_UTIME  (xtime.tv_usec)
 
 #define udf_file_entry_alloc_offset(inode)\
        ((UDF_I_EXTENDED_FE(inode) ?\
-               sizeof(struct ExtendedFileEntry) :\
-               sizeof(struct FileEntry)) + UDF_I_LENEATTR(inode))
+               sizeof(struct extendedFileEntry) :\
+               sizeof(struct fileEntry)) + UDF_I_LENEATTR(inode))
 
 #define udf_ext0_offset(inode)\
-       (UDF_I_ALLOCTYPE(inode) == ICB_FLAG_AD_IN_ICB ?\
+       (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_IN_ICB ?\
                udf_file_entry_alloc_offset(inode) : 0)
 
 #define udf_get_lb_pblock(sb,loc,offset) udf_get_pblock((sb), (loc).logicalBlockNum, (loc).partitionReferenceNum, (offset))
 
-#else
-
-#include <sys/types.h>
-
-#endif /* __KERNEL__ */
-
-
-
-#ifdef __KERNEL__
-
 struct dentry;
 struct inode;
 struct task_struct;
@@ -67,50 +66,38 @@ struct udf_fileident_bh
        int eoffset;
 };
 
-#endif /* __KERNEL__ */
-
 struct udf_directory_record
 {
-       Uint32  d_parent;
-       Uint32  d_inode;
-       Uint32  d_name[255];
+       uint32_t        d_parent;
+       uint32_t        d_inode;
+       uint32_t        d_name[255];
 };
 
-
 struct udf_vds_record
 {
-       Uint32 block;
-       Uint32 volDescSeqNum;
+       uint32_t block;
+       uint32_t volDescSeqNum;
 };
 
-struct ktm
+struct generic_desc
 {
-       int tm_sec;
-       int tm_min;
-       int tm_hour;
-       int tm_mday;
-       int tm_mon;
-       int tm_year;
-       int tm_isdst;
+       tag             descTag;
+       uint32_t        volDescSeqNum;
 };
 
 struct ustr
 {
-       Uint8 u_cmpID;
-       Uint8 u_name[UDF_NAME_LEN];
-       Uint8 u_len;
-       Uint8 padding;
-       unsigned long u_hash;
+       uint8_t u_cmpID;
+       uint8_t u_name[UDF_NAME_LEN];
+       uint8_t u_len;
 };
 
-#ifdef __KERNEL__
-
 /* super.c */
 extern void udf_error(struct super_block *, const char *, const char *, ...);
 extern void udf_warning(struct super_block *, const char *, const char *, ...);
 
 /* namei.c */
-extern int udf_write_fi(struct inode *inode, struct FileIdentDesc *, struct FileIdentDesc *, struct udf_fileident_bh *, Uint8 *, Uint8 *);
+extern int udf_write_fi(struct inode *inode, struct fileIdentDesc *, struct fileIdentDesc *, struct udf_fileident_bh *, uint8_t *, uint8_t *);
 
 /* file.c */
 extern int udf_ioctl(struct inode *, struct file *, unsigned int, unsigned long);
@@ -128,24 +115,23 @@ extern void udf_put_inode(struct inode *);
 extern void udf_delete_inode(struct inode *);
 extern void udf_write_inode(struct inode *, int);
 extern long udf_block_map(struct inode *, long);
-extern Sint8 inode_bmap(struct inode *, int, lb_addr *, Uint32 *, lb_addr *, Uint32 *, Uint32 *, struct buffer_head **);
-extern Sint8 udf_add_aext(struct inode *, lb_addr *, int *, lb_addr, Uint32, struct buffer_head **, int);
-extern Sint8 udf_write_aext(struct inode *, lb_addr, int *, lb_addr, Uint32, struct buffer_head *, int);
-extern Sint8 udf_insert_aext(struct inode *, lb_addr, int, lb_addr, Uint32, struct buffer_head *);
-extern Sint8 udf_delete_aext(struct inode *, lb_addr, int, lb_addr, Uint32, struct buffer_head *);
-extern Sint8 udf_next_aext(struct inode *, lb_addr *, int *, lb_addr *, Uint32 *, struct buffer_head **, int);
-extern Sint8 udf_current_aext(struct inode *, lb_addr *, int *, lb_addr *, Uint32 *, struct buffer_head **, int);
+extern int8_t inode_bmap(struct inode *, int, lb_addr *, uint32_t *, lb_addr *, uint32_t *, uint32_t *, struct buffer_head **);
+extern int8_t udf_add_aext(struct inode *, lb_addr *, int *, lb_addr, uint32_t, struct buffer_head **, int);
+extern int8_t udf_write_aext(struct inode *, lb_addr, int *, lb_addr, uint32_t, struct buffer_head *, int);
+extern int8_t udf_insert_aext(struct inode *, lb_addr, int, lb_addr, uint32_t, struct buffer_head *);
+extern int8_t udf_delete_aext(struct inode *, lb_addr, int, lb_addr, uint32_t, struct buffer_head *);
+extern int8_t udf_next_aext(struct inode *, lb_addr *, int *, lb_addr *, uint32_t *, struct buffer_head **, int);
+extern int8_t udf_current_aext(struct inode *, lb_addr *, int *, lb_addr *, uint32_t *, struct buffer_head **, int);
 extern void udf_discard_prealloc(struct inode *);
 
 /* misc.c */
 extern int udf_read_tagged_data(char *, int size, int fd, int block, int partref);
 extern struct buffer_head *udf_tgetblk(struct super_block *, int);
 extern struct buffer_head *udf_tread(struct super_block *, int);
-extern struct GenericAttrFormat *udf_add_extendedattr(struct inode *, Uint32, Uint32, Uint8, struct buffer_head **);
-extern struct GenericAttrFormat *udf_get_extendedattr(struct inode *, Uint32, Uint8, struct buffer_head **);
-extern struct buffer_head *udf_read_tagged(struct super_block *, Uint32, Uint32, Uint16 *);
-extern struct buffer_head *udf_read_ptagged(struct super_block *, lb_addr, Uint32, Uint16 *);
-extern struct buffer_head *udf_read_untagged(struct super_block *, Uint32, Uint32);
+extern struct genericFormat *udf_add_extendedattr(struct inode *, uint32_t, uint32_t, uint8_t, struct buffer_head **);
+extern struct genericFormat *udf_get_extendedattr(struct inode *, uint32_t, uint8_t, struct buffer_head **);
+extern struct buffer_head *udf_read_tagged(struct super_block *, uint32_t, uint32_t, uint16_t *);
+extern struct buffer_head *udf_read_ptagged(struct super_block *, lb_addr, uint32_t, uint16_t *);
 extern void udf_release_data(struct buffer_head *);
 
 /* lowlevel.c */
@@ -153,14 +139,14 @@ extern unsigned int udf_get_last_session(struct super_block *);
 extern unsigned long udf_get_last_block(struct super_block *);
 
 /* partition.c */
-extern Uint32 udf_get_pblock(struct super_block *, Uint32, Uint16, Uint32);
-extern Uint32 udf_get_pblock_virt15(struct super_block *, Uint32, Uint16, Uint32);
-extern Uint32 udf_get_pblock_virt20(struct super_block *, Uint32, Uint16, Uint32);
-extern Uint32 udf_get_pblock_spar15(struct super_block *, Uint32, Uint16, Uint32);
+extern uint32_t udf_get_pblock(struct super_block *, uint32_t, uint16_t, uint32_t);
+extern uint32_t udf_get_pblock_virt15(struct super_block *, uint32_t, uint16_t, uint32_t);
+extern uint32_t udf_get_pblock_virt20(struct super_block *, uint32_t, uint16_t, uint32_t);
+extern uint32_t udf_get_pblock_spar15(struct super_block *, uint32_t, uint16_t, uint32_t);
 extern int udf_relocate_blocks(struct super_block *, long, long *);
 
 /* unicode.c */
-extern int udf_get_filename(struct super_block *, Uint8 *, Uint8 *, int);
+extern int udf_get_filename(struct super_block *, uint8_t *, uint8_t *, int);
 
 /* ialloc.c */
 extern void udf_free_inode(struct inode *);
@@ -170,58 +156,51 @@ extern struct inode * udf_new_inode (struct inode *, int, int *);
 extern void udf_truncate_extents(struct inode *);
 
 /* balloc.c */
-extern void udf_free_blocks(struct super_block *, struct inode *, lb_addr, Uint32, Uint32);
-extern int udf_prealloc_blocks(struct super_block *, struct inode *, Uint16, Uint32, Uint32);
-extern int udf_new_block(struct super_block *, struct inode *, Uint16, Uint32, int *);
+extern void udf_free_blocks(struct super_block *, struct inode *, lb_addr, uint32_t, uint32_t);
+extern int udf_prealloc_blocks(struct super_block *, struct inode *, uint16_t, uint32_t, uint32_t);
+extern int udf_new_block(struct super_block *, struct inode *, uint16_t, uint32_t, int *);
 
 /* fsync.c */
 extern int udf_fsync_file(struct file *, struct dentry *, int);
 extern int udf_fsync_inode(struct inode *, int);
 
 /* directory.c */
-extern Uint8 * udf_filead_read(struct inode *, Uint8 *, Uint8, lb_addr, int *, int *, struct buffer_head **, int *);
-extern struct FileIdentDesc * udf_fileident_read(struct inode *, loff_t *, struct udf_fileident_bh *, struct FileIdentDesc *, lb_addr *, Uint32 *, lb_addr *, Uint32 *, Uint32 *, struct buffer_head **);
-
-#endif /* __KERNEL__ */
-
-/* Miscellaneous UDF Prototypes */
+extern uint8_t * udf_filead_read(struct inode *, uint8_t *, uint8_t, lb_addr, int *, int *, struct buffer_head **, int *);
+extern struct fileIdentDesc * udf_fileident_read(struct inode *, loff_t *, struct udf_fileident_bh *, struct fileIdentDesc *, lb_addr *, uint32_t *, lb_addr *, uint32_t *, uint32_t *, struct buffer_head **);
 
 /* unicode.c */
-extern int udf_ustr_to_dchars(Uint8 *, const struct ustr *, int);
-extern int udf_ustr_to_char(Uint8 *, const struct ustr *, int);
+extern int udf_ustr_to_dchars(uint8_t *, const struct ustr *, int);
+extern int udf_ustr_to_char(uint8_t *, const struct ustr *, int);
 extern int udf_ustr_to_dstring(dstring *, const struct ustr *, int);
-extern int udf_dchars_to_ustr(struct ustr *, const Uint8 *, int);
-extern int udf_char_to_ustr(struct ustr *, const Uint8 *, int);
+extern int udf_dchars_to_ustr(struct ustr *, const uint8_t *, int);
+extern int udf_char_to_ustr(struct ustr *, const uint8_t *, int);
 extern int udf_dstring_to_ustr(struct ustr *, const dstring *, int);
-extern int udf_translate_to_linux(Uint8 *, Uint8 *, int, Uint8 *, int);
+extern int udf_translate_to_linux(uint8_t *, uint8_t *, int, uint8_t *, int);
 extern int udf_build_ustr(struct ustr *, dstring *, int);
 extern int udf_build_ustr_exact(struct ustr *, dstring *, int);
 extern int udf_CS0toUTF8(struct ustr *, struct ustr *);
 extern int udf_UTF8toCS0(dstring *, struct ustr *, int);
-#ifdef __KERNEL__
 extern int udf_CS0toNLS(struct nls_table *, struct ustr *, struct ustr *);
 extern int udf_NLStoCS0(struct nls_table *, dstring *, struct ustr *, int);
-#endif
 
 /* crc.c */
-extern Uint16 udf_crc(Uint8 *, Uint32, Uint16);
+extern uint16_t udf_crc(uint8_t *, uint32_t, uint16_t);
 
 /* misc.c */
-extern Uint32 udf64_low32(Uint64);
-extern Uint32 udf64_high32(Uint64);
+extern uint32_t udf64_low32(uint64_t);
+extern uint32_t udf64_high32(uint64_t);
 extern void udf_update_tag(char *, int);
-extern void udf_new_tag(char *, Uint16, Uint16, Uint16, Uint32, int);
+extern void udf_new_tag(char *, uint16_t, uint16_t, uint16_t, uint32_t, int);
 
 /* udftime.c */
 extern time_t *udf_stamp_to_time(time_t *, long *, timestamp);
 extern timestamp *udf_time_to_stamp(timestamp *, time_t, long);
-extern time_t udf_converttime (struct ktm *);
 
 /* directory.c */
-extern struct FileIdentDesc * udf_get_fileident(void * buffer, int bufsize, int * offset);
+extern struct fileIdentDesc * udf_get_fileident(void * buffer, int bufsize, int * offset);
 extern extent_ad * udf_get_fileextent(void * buffer, int bufsize, int * offset);
 extern long_ad * udf_get_filelongad(void * buffer, int bufsize, int * offset, int);
 extern short_ad * udf_get_fileshortad(void * buffer, int bufsize, int * offset, int);
-extern Uint8 * udf_get_filead(struct FileEntry *, Uint8 *, int, int, int, int *);
+extern uint8_t * udf_get_filead(struct fileEntry *, uint8_t *, int, int, int, int *);
 
 #endif /* __UDF_DECL_H */
index 1b1139ec13064bbd641782ac2a8dfdba282430a9..6313daab090e71f65266aafaa20503d2dcd0aea0 100644 (file)
@@ -1,60 +1,9 @@
 #ifndef __UDF_ENDIAN_H
 #define __UDF_ENDIAN_H
 
-#ifndef __KERNEL__ 
-
-#include <sys/types.h>
-
-#if __BYTE_ORDER == 0
-
-#error "__BYTE_ORDER must be defined"
-
-#elif __BYTE_ORDER == __BIG_ENDIAN
-
-#define le16_to_cpu(x) \
-       ((Uint16)((((Uint16)(x) & 0x00FFU) << 8) | \
-                 (((Uint16)(x) & 0xFF00U) >> 8)))
-#define le32_to_cpu(x) \
-       ((Uint32)((((Uint32)(x) & 0x000000FFU) << 24) | \
-                 (((Uint32)(x) & 0x0000FF00U) <<  8) | \
-                 (((Uint32)(x) & 0x00FF0000U) >>  8) | \
-                 (((Uint32)(x) & 0xFF000000U) >> 24)))
-
-#define le64_to_cpu(x) \
-       ((Uint64)((((Uint64)(x) & 0x00000000000000FFULL) << 56) | \
-                 (((Uint64)(x) & 0x000000000000FF00ULL) << 40) | \
-                 (((Uint64)(x) & 0x0000000000FF0000ULL) << 24) | \
-                 (((Uint64)(x) & 0x00000000FF000000ULL) <<  8) | \
-                 (((Uint64)(x) & 0x000000FF00000000ULL) >>  8) | \
-                 (((Uint64)(x) & 0x0000FF0000000000ULL) >> 24) | \
-                 (((Uint64)(x) & 0x00FF000000000000ULL) >> 40) | \
-                 (((Uint64)(x) & 0xFF00000000000000ULL) >> 56)))               
-
-#define cpu_to_le16(x) (le16_to_cpu(x))
-#define cpu_to_le32(x) (le32_to_cpu(x))
-#define cpu_to_le64(x) (le64_to_cpu(x))
-
-#else /* __BYTE_ORDER == __LITTLE_ENDIAN */
-
-#define le16_to_cpu(x) (x)
-#define le32_to_cpu(x) (x)
-#define le64_to_cpu(x) (x)
-#define cpu_to_le16(x) (x)
-#define cpu_to_le32(x) (x)
-#define cpu_to_le64(x) (x)
-
-#endif /* __BYTE_ORDER == 0 */
-
-#include <string.h>
-
-#else /* __KERNEL__ */
-
 #include <asm/byteorder.h>
 #include <linux/string.h>
 
-#endif /* ! __KERNEL__ */
-
 static inline lb_addr lelb_to_cpu(lb_addr in)
 {
        lb_addr out;
index 2d00c120b76ecd5c207c24f7be17773420bee4bb..decaede92657f617c8ff81cd8b2dd4714e94dd95 100644 (file)
  *  http://www.boulder.nist.gov/timefreq/pubs/bulletin/leapsecond.htm
  */
 
-#if defined(__linux__) && defined(__KERNEL__)
 #include <linux/types.h>
 #include <linux/kernel.h>
-#else
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#endif
-
 #include "udfdecl.h"
 
 #define EPOCH_YEAR 1970
@@ -86,9 +79,7 @@ time_t year_seconds[MAX_YEAR_SECONDS]= {
 /*2038*/ SPY(68,17,0)
 };
 
-#ifdef __KERNEL__
 extern struct timezone sys_tz;
-#endif
 
 #define SECS_PER_HOUR  (60 * 60)
 #define SECS_PER_DAY   (SECS_PER_HOUR * 24)
@@ -97,8 +88,8 @@ time_t *
 udf_stamp_to_time(time_t *dest, long *dest_usec, timestamp src)
 {
        int yday;
-       Uint8 type = src.typeAndTimezone >> 12;
-       Sint16 offset;
+       uint8_t type = src.typeAndTimezone >> 12;
+       int16_t offset;
 
        if (type == 1)
        {
@@ -134,13 +125,8 @@ udf_time_to_stamp(timestamp *dest, time_t tv_sec, long tv_usec)
 {
        long int days, rem, y;
        const unsigned short int *ip;
-       Sint16 offset;
-#ifndef __KERNEL__
-       struct timeval tv;
-       struct timezone sys_tz;
+       int16_t offset;
 
-       gettimeofday(&tv, &sys_tz);
-#endif
        offset = -sys_tz.tz_minuteswest;
 
        if (!dest)
index 3eaaf854b3c5b7698c23bbf5f3d42c56533ad0d7..eb88a0173f170262301a56f22fd7e8b60beb7f81 100644 (file)
  *     Each contributing author retains all rights to their own work.
  */
 
+#include "udfdecl.h"
 
-#ifdef __KERNEL__
 #include <linux/kernel.h>
 #include <linux/string.h>      /* for memset */
 #include <linux/nls.h>
 #include <linux/udf_fs.h>
-#include "udf_sb.h"
-#else
-#include <string.h>
-#endif
 
-#include "udfdecl.h"
+#include "udf_sb.h"
 
-int udf_ustr_to_dchars(Uint8 *dest, const struct ustr *src, int strlen)
+int udf_ustr_to_dchars(uint8_t *dest, const struct ustr *src, int strlen)
 {
        if ( (!dest) || (!src) || (!strlen) || (src->u_len > strlen) )
                return 0;
@@ -45,7 +41,7 @@ int udf_ustr_to_dchars(Uint8 *dest, const struct ustr *src, int strlen)
        return src->u_len + 1;
 }
 
-int udf_ustr_to_char(Uint8 *dest, const struct ustr *src, int strlen)
+int udf_ustr_to_char(uint8_t *dest, const struct ustr *src, int strlen)
 {
        if ( (!dest) || (!src) || (!strlen) || (src->u_len >= strlen) )
                return 0;
@@ -64,7 +60,7 @@ int udf_ustr_to_dstring(dstring *dest, const struct ustr *src, int dlength)
                return 0;
 }
 
-int udf_dchars_to_ustr(struct ustr *dest, const Uint8 *src, int strlen)
+int udf_dchars_to_ustr(struct ustr *dest, const uint8_t *src, int strlen)
 {
        if ( (!dest) || (!src) || (!strlen) || (strlen > UDF_NAME_LEN) )
                return 0;
@@ -75,7 +71,7 @@ int udf_dchars_to_ustr(struct ustr *dest, const Uint8 *src, int strlen)
        return strlen-1;
 }
 
-int udf_char_to_ustr(struct ustr *dest, const Uint8 *src, int strlen)
+int udf_char_to_ustr(struct ustr *dest, const uint8_t *src, int strlen)
 {
        if ( (!dest) || (!src) || (!strlen) || (strlen >= UDF_NAME_LEN) )
                return 0;
@@ -152,9 +148,9 @@ int udf_build_ustr_exact(struct ustr *dest, dstring *ptr, int exactsize)
  */
 int udf_CS0toUTF8(struct ustr *utf_o, struct ustr *ocu_i)
 {
-       Uint8 *ocu;
-       Uint32 c;
-       Uint8 cmp_id, ocu_len;
+       uint8_t *ocu;
+       uint32_t c;
+       uint8_t cmp_id, ocu_len;
        int i;
 
        ocu = ocu_i->u_name;
@@ -173,9 +169,7 @@ int udf_CS0toUTF8(struct ustr *utf_o, struct ustr *ocu_i)
 
        if ((cmp_id != 8) && (cmp_id != 16))
        {
-#ifdef __KERNEL__
                printk(KERN_ERR "udf: unknown compression code (%d) stri=%s\n", cmp_id, ocu_i->u_name);
-#endif
                return 0;
        }
 
@@ -189,22 +183,20 @@ int udf_CS0toUTF8(struct ustr *utf_o, struct ustr *ocu_i)
 
                /* Compress Unicode to UTF-8 */
                if (c < 0x80U)
-                       utf_o->u_name[utf_o->u_len++] = (Uint8)c;
+                       utf_o->u_name[utf_o->u_len++] = (uint8_t)c;
                else if (c < 0x800U)
                {
-                       utf_o->u_name[utf_o->u_len++] = (Uint8)(0xc0 | (c >> 6));
-                       utf_o->u_name[utf_o->u_len++] = (Uint8)(0x80 | (c & 0x3f));
+                       utf_o->u_name[utf_o->u_len++] = (uint8_t)(0xc0 | (c >> 6));
+                       utf_o->u_name[utf_o->u_len++] = (uint8_t)(0x80 | (c & 0x3f));
                }
                else
                {
-                       utf_o->u_name[utf_o->u_len++] = (Uint8)(0xe0 | (c >> 12));
-                       utf_o->u_name[utf_o->u_len++] = (Uint8)(0x80 | ((c >> 6) & 0x3f));
-                       utf_o->u_name[utf_o->u_len++] = (Uint8)(0x80 | (c & 0x3f));
+                       utf_o->u_name[utf_o->u_len++] = (uint8_t)(0xe0 | (c >> 12));
+                       utf_o->u_name[utf_o->u_len++] = (uint8_t)(0x80 | ((c >> 6) & 0x3f));
+                       utf_o->u_name[utf_o->u_len++] = (uint8_t)(0x80 | (c & 0x3f));
                }
        }
        utf_o->u_cmpID=8;
-       utf_o->u_hash=0L;
-       utf_o->padding=0;
 
        return utf_o->u_len;
 }
@@ -247,7 +239,7 @@ try_again:
        utf_cnt = 0U;
        for (i = 0U; i < utf->u_len; i++)
        {
-               c = (Uint8)utf->u_name[i];
+               c = (uint8_t)utf->u_name[i];
 
                /* Complete a multi-byte UTF-8 character */
                if (utf_cnt)
@@ -301,7 +293,7 @@ try_again:
                        if ( 0xffU == max_val )
                        {
                                max_val = 0xffffU;
-                               ocu[0] = (Uint8)0x10U;
+                               ocu[0] = (uint8_t)0x10U;
                                goto try_again;
                        }
                        goto error_out;
@@ -309,31 +301,28 @@ try_again:
 
                if (max_val == 0xffffU)
                {
-                       ocu[++u_len] = (Uint8)(utf_char >> 8);
+                       ocu[++u_len] = (uint8_t)(utf_char >> 8);
                }
-               ocu[++u_len] = (Uint8)(utf_char & 0xffU);
+               ocu[++u_len] = (uint8_t)(utf_char & 0xffU);
        }
 
 
        if (utf_cnt)
        {
 error_out:
-#ifdef __KERNEL__
                printk(KERN_ERR "udf: bad UTF-8 character\n");
-#endif
                return 0;
        }
 
-       ocu[length - 1] = (Uint8)u_len + 1;
+       ocu[length - 1] = (uint8_t)u_len + 1;
        return u_len + 1;
 }
 
-#ifdef __KERNEL__
 int udf_CS0toNLS(struct nls_table *nls, struct ustr *utf_o, struct ustr *ocu_i)
 {
-       Uint8 *ocu;
-       Uint32 c;
-       Uint8 cmp_id, ocu_len;
+       uint8_t *ocu;
+       uint32_t c;
+       uint8_t cmp_id, ocu_len;
        int i;
 
        ocu = ocu_i->u_name;
@@ -367,8 +356,6 @@ int udf_CS0toNLS(struct nls_table *nls, struct ustr *utf_o, struct ustr *ocu_i)
                        UDF_NAME_LEN - utf_o->u_len);
        }
        utf_o->u_cmpID=8;
-       utf_o->u_hash=0L;
-       utf_o->padding=0;
 
        return utf_o->u_len;
 }
@@ -376,7 +363,7 @@ int udf_CS0toNLS(struct nls_table *nls, struct ustr *utf_o, struct ustr *ocu_i)
 int udf_NLStoCS0(struct nls_table *nls, dstring *ocu, struct ustr *uni, int length)
 {
        unsigned len, i, max_val;
-       Uint16 uni_char;
+       uint16_t uni_char;
        int uni_cnt;
        int u_len = 0;
 
@@ -394,23 +381,23 @@ try_again:
                if (len == 2 && max_val == 0xff)
                {
                        max_val = 0xffffU;
-                       ocu[0] = (Uint8)0x10U;
+                       ocu[0] = (uint8_t)0x10U;
                        goto try_again;
                }
                
                if (max_val == 0xffffU)
                {
-                       ocu[++u_len] = (Uint8)(uni_char >> 8);
+                       ocu[++u_len] = (uint8_t)(uni_char >> 8);
                        i++;
                }
-               ocu[++u_len] = (Uint8)(uni_char & 0xffU);
+               ocu[++u_len] = (uint8_t)(uni_char & 0xffU);
        }
 
-       ocu[length - 1] = (Uint8)u_len + 1;
+       ocu[length - 1] = (uint8_t)u_len + 1;
        return u_len + 1;
 }
 
-int udf_get_filename(struct super_block *sb, Uint8 *sname, Uint8 *dname, int flen)
+int udf_get_filename(struct super_block *sb, uint8_t *sname, uint8_t *dname, int flen)
 {
        struct ustr filename, unifilename;
        int len;
@@ -446,20 +433,19 @@ int udf_get_filename(struct super_block *sb, Uint8 *sname, Uint8 *dname, int fle
        }
        return 0;
 }
-#endif
 
 #define ILLEGAL_CHAR_MARK      '_'
 #define EXT_MARK                       '.'
 #define CRC_MARK                       '#'
 #define EXT_SIZE                       5
 
-int udf_translate_to_linux(Uint8 *newName, Uint8 *udfName, int udfLen, Uint8 *fidName, int fidNameLen)
+int udf_translate_to_linux(uint8_t *newName, uint8_t *udfName, int udfLen, uint8_t *fidName, int fidNameLen)
 {
        int index, newIndex = 0, needsCRC = 0;  
        int extIndex = 0, newExtIndex = 0, hasExt = 0;
        unsigned short valueCRC;
-       Uint8 curr;
-       const Uint8 hexChar[] = "0123456789ABCDEF";
+       uint8_t curr;
+       const uint8_t hexChar[] = "0123456789ABCDEF";
 
        if (udfName[0] == '.' && (udfLen == 1 ||
                (udfLen == 2 && udfName[1] == '.')))
@@ -500,7 +486,7 @@ int udf_translate_to_linux(Uint8 *newName, Uint8 *udfName, int udfLen, Uint8 *fi
        }
        if (needsCRC)
        {
-               Uint8 ext[EXT_SIZE];
+               uint8_t ext[EXT_SIZE];
                int localExtIndex = 0;
 
                if (hasExt)
diff --git a/include/linux/udf_167.h b/include/linux/udf_167.h
deleted file mode 100644 (file)
index b7d0b3c..0000000
+++ /dev/null
@@ -1,786 +0,0 @@
-#if !defined(_LINUX_UDF_167_H)
-#define _LINUX_UDF_167_H
-/*
- * udf_167.h
- *
- * DESCRIPTION
- *     Definitions from the ECMA 167 standard.
- *     http://www.ecma.ch/
- *
- *     These abbreviations are used to keep the symbols short:
- *             Alloc   Allocation
- *             App     Application
- *             Attr    Attribute
- *             Char    Characters
- *             Desc    Descriptor
- *             Descs   Descriptors
- *             Ext     Extent
- *             Ident   Identifier
- *             Imp     Implementation
- *             Lvl     Level
- *             Max     Maximum
- *             Num     Number
- *             Ptr     Pointer
- *             Seq     Sequence
- *             Std     Standard
- *             Struct  Structure
- *             Vol     Volume
- *     The symbols are otherwise identical to the standard, and the
- *     sections of the standard to refer to are indicated.
- *
- * CONTACTS
- *     E-mail regarding any portion of the Linux UDF file system should be
- *     directed to the development team mailing list (run by majordomo):
- *             linux_udf@hpesjro.fc.hp.com
- *
- * COPYRIGHT
- *     This file is distributed under the terms of the GNU General Public
- *     License (GPL). Copies of the GPL can be obtained from:
- *             ftp://prep.ai.mit.edu/pub/gnu/GPL
- *     Each contributing author retains all rights to their own work.
- *
- * HISTORY
- *     July 12, 1997 - Andrew E. Mileski
- *     Adapted from the ECMA-167 standard.
- *
- * 10/2/98 dgb Adaptation
- * 10/4/98     Changes by HJA Sandkuyl
- * 10/7/98     Changed FILE_EXISTENCE to FILE_HIDDEN, per UDF 2.0 spec
- * 11/26/98    Modifed some entries for UDF 1.5/2.0
- * 11/26/98 bf  Fixed typos, non-linux types, more structures
- * 12/5/98 dgb  Adjusted structure and content of include files.
- */
-
-#ifdef __KERNEL__
-#include <linux/types.h>
-#define Uint8  __u8
-#define Sint8  __s8
-#define Uint16 __u16
-#define Sint16 __s16
-#define Uint32 __u32
-#define Sint32 __s32
-#define Uint64 __u64
-#define Sint64 __s64
-typedef Uint8  dstring;
-#else
-#define Uint8  unsigned char
-#define Sint8  char
-#define Uint16 unsigned short
-#define Sint16 short
-#define Uint32 unsigned int
-#define Sint32 int
-#define Uint64 unsigned long long
-#define Sint64 long long
-typedef Uint8  dstring;
-#endif
-
-/* make sure all structures are packed! */
-#pragma pack(1)
-
-/* CS0 Charspec (ECMA 167 1/7.2.1) */
-typedef struct {
-       Uint8 charSetType;
-       Uint8 charSetInfo[63];
-} charspec;
-
-/* Timestamp (ECMA 167 1/7.3) */
-typedef struct {
-       Uint16 typeAndTimezone;
-       Uint16 year;
-       Uint8 month;
-       Uint8 day;
-       Uint8 hour;
-       Uint8 minute;
-       Uint8 second;
-       Uint8 centiseconds;
-       Uint8 hundredsOfMicroseconds;
-       Uint8 microseconds;
-} timestamp;
-
-/* Timestamp types (ECMA 167 1/7.3.1) */
-#define TIMESTAMP_TYPE_CUT             0x0000U
-#define TIMESTAMP_TYPE_LOCAL           0x0001U
-#define TIMESTAMP_TYPE_AGREEMENT       0x0002U
-
-/* Entity Identifier (ECMA 167 1/7.4) */
-typedef struct {
-       Uint8 flags;
-       Uint8 ident[23];
-       Uint8 identSuffix[8];
-} EntityID;
-#define regid EntityID
-
-/* Entity identifier flags (ECMA 167 1/7.4.1) */
-#define ENTITYID_FLAGS_DIRTY           0x01U
-#define ENTITYID_FLAGS_PROTECTED       0x02U
-
-/* Volume Structure Descriptor (ECMA 167 2/9.1) */
-#define STD_ID_LEN     5
-struct VolStructDesc {
-       Uint8 structType;
-       Uint8 stdIdent[STD_ID_LEN];
-       Uint8 structVersion;
-       Uint8 structData[2041];
-};
-
-/* Std structure identifiers (ECMA 167 2/9.1.2) */
-#define STD_ID_BEA01   "BEA01"
-#define STD_ID_BOOT2   "BOOT2"
-#define STD_ID_CD001   "CD001"
-#define STD_ID_CDW02   "CDW02"
-#define STD_ID_NSR02   "NSR02"
-#define STD_ID_NSR03   "NSR03"
-#define STD_ID_TEA01   "TEA01"
-
-/* Beginning Extended Area Descriptor (ECMA 167 2/9.2) */
-struct BeginningExtendedAreaDesc {
-       Uint8 structType;
-       Uint8 stdIdent[STD_ID_LEN];
-       Uint8 structVersion;
-       Uint8 structData[2041];
-};
-
-/* Terminating Extended Area Descriptor (ECMA 167 2/9.3) */
-struct TerminatingExtendedAreaDesc {
-       Uint8 structType;
-       Uint8 stdIdent[STD_ID_LEN];
-       Uint8 structVersion;
-       Uint8 structData[2041];
-};
-
-/* Boot Descriptor (ECMA 167 2/9.4) */
-struct BootDesc {
-       Uint8 structType;
-       Uint8 stdIdent[STD_ID_LEN];
-       Uint8 structVersion;
-       Uint8 reserved1;
-       EntityID architectureType;
-       EntityID bootIdent;
-       Uint32 bootExtLocation;
-       Uint32 bootExtLength;
-       Uint64 loadAddress;
-       Uint64 startAddress;
-       timestamp descCreationDateAndTime;
-       Uint16 flags;
-       Uint8 reserved2[32];
-       Uint8 bootUse[1906];
-};
-
-/* Boot flags (ECMA 167 2/9.4.12) */
-#define BOOT_FLAGS_ERASE       1
-
-/* Extent Descriptor (ECMA 167 3/7.1) */
-typedef struct {
-       Uint32 extLength;
-       Uint32 extLocation;
-} extent_ad;
-
-/* Descriptor Tag (ECMA 167 3/7.2) */
-typedef struct {
-       Uint16 tagIdent;
-       Uint16 descVersion;
-       Uint8 tagChecksum;
-       Uint8 reserved;
-       Uint16 tagSerialNum;
-       Uint16 descCRC;
-       Uint16 descCRCLength;
-       Uint32 tagLocation;
-} tag;
-
-/* Tag Identifiers (ECMA 167 3/7.2.1) */
-#define TID_UNUSED_DESC                        0x0000U
-#define TID_PRIMARY_VOL_DESC           0x0001U
-#define TID_ANCHOR_VOL_DESC_PTR                0x0002U
-#define TID_VOL_DESC_PTR               0x0003U
-#define TID_IMP_USE_VOL_DESC           0x0004U
-#define TID_PARTITION_DESC             0x0005U
-#define TID_LOGICAL_VOL_DESC           0x0006U
-#define TID_UNALLOC_SPACE_DESC         0x0007U
-#define TID_TERMINATING_DESC           0x0008U
-#define TID_LOGICAL_VOL_INTEGRITY_DESC 0x0009U
-
-/* Tag Identifiers (ECMA 167 4/7.2.1) */
-#define TID_FILE_SET_DESC              0x0100U
-#define TID_FILE_IDENT_DESC            0x0101U
-#define TID_ALLOC_EXTENT_DESC          0x0102U
-#define TID_INDIRECT_ENTRY             0x0103U
-#define TID_TERMINAL_ENTRY             0x0104U
-#define TID_FILE_ENTRY                 0x0105U
-#define TID_EXTENDED_ATTRE_HEADER_DESC 0x0106U
-#define TID_UNALLOCATED_SPACE_ENTRY    0x0107U
-#define TID_SPACE_BITMAP_DESC          0x0108U
-#define TID_PARTITION_INTEGRITY_ENTRY  0x0109U
-#define TID_EXTENDED_FILE_ENTRY                0x010AU
-
-/* NSR Descriptor (ECMA 167 3/9.1) */
-struct NSRDesc {
-       Uint8 structType;
-       Uint8 stdIdent[STD_ID_LEN];
-       Uint8 structVersion;
-       Uint8 reserved;
-       Uint8 structData[2040];
-};
-       
-/* Primary Volume Descriptor (ECMA 167 3/10.1) */
-struct PrimaryVolDesc {
-       tag descTag;
-       Uint32 volDescSeqNum;
-       Uint32 primaryVolDescNum;
-       dstring volIdent[32];
-       Uint16 volSeqNum;
-       Uint16 maxVolSeqNum;
-       Uint16 interchangeLvl;
-       Uint16 maxInterchangeLvl;
-       Uint32 charSetList;
-       Uint32 maxCharSetList;
-       dstring volSetIdent[128];
-       charspec descCharSet;
-       charspec explanatoryCharSet;
-       extent_ad volAbstract;
-       extent_ad volCopyright;
-       EntityID appIdent;
-       timestamp recordingDateAndTime;
-       EntityID impIdent;
-       Uint8 impUse[64];
-       Uint32 predecessorVolDescSeqLocation;
-       Uint16 flags;
-       Uint8 reserved[22];
-};
-
-/* Primary volume descriptor flags (ECMA 167 3/10.1.21) */
-#define VOL_SET_IDENT  1
-
-/* Anchor Volume Descriptor Pointer (ECMA 167 3/10.2) */
-struct AnchorVolDescPtr {
-       tag descTag;
-       extent_ad mainVolDescSeqExt;
-       extent_ad reserveVolDescSeqExt;
-       Uint8 reserved[480];
-};
-
-/* Volume Descriptor Pointer (ECMA 167 3/10.3) */
-struct VolDescPtr {
-       tag descTag;
-       Uint32 volDescSeqNum;
-       extent_ad nextVolDescSeqExt;
-       Uint8 reserved[484];
-};
-
-/* Implementation Use Volume Descriptor (ECMA 167 3/10.4) */
-struct ImpUseVolDesc {
-       tag descTag;
-       Uint32 volDescSeqNum;
-       EntityID impIdent;
-       Uint8 impUse[460];
-};
-
-/* Partition Descriptor (ECMA 167 3/10.5) */
-struct PartitionDesc {
-       tag descTag;
-       Uint32 volDescSeqNum;
-       Uint16 partitionFlags;
-       Uint16 partitionNumber;
-       EntityID partitionContents;
-       Uint8 partitionContentsUse[128];
-       Uint32 accessType;
-       Uint32 partitionStartingLocation;
-       Uint32 partitionLength;
-       EntityID impIdent;
-       Uint8 impUse[128];
-       Uint8 reserved[156];
-};
-
-/* Partition Flags (ECMA 167 3/10.5.3) */
-#define PARTITION_FLAGS_ALLOC  1
-
-/* Partition Contents (ECMA 167 3/10.5.5) */
-#define PARTITION_CONTENTS_FDC01       "+FDC01"
-#define PARTITION_CONTENTS_CD001       "+CD001"
-#define PARTITION_CONTENTS_CDW02       "+CDW02"
-#define PARTITION_CONTENTS_NSR02       "+NSR02"
-#define PARTITION_CONTENTS_NSR03       "+NSR03"
-
-/* Partition Access Types (ECMA 167 3/10.5.7) */
-#define PARTITION_ACCESS_NONE  0
-#define PARTITION_ACCESS_R     1
-#define PARTITION_ACCESS_WO    2
-#define PARTITION_ACCESS_RW    3
-#define PARTITION_ACCESS_OW    4
-
-/* Logical Volume Descriptor (ECMA 167 3/10.6) */
-struct LogicalVolDesc {
-       tag descTag;
-       Uint32 volDescSeqNum;
-       charspec descCharSet;
-       dstring logicalVolIdent[128];
-       Uint32 logicalBlockSize;
-       EntityID domainIdent;
-       Uint8 logicalVolContentsUse[16]; /* used to find fileset */
-       Uint32 mapTableLength;
-       Uint32 numPartitionMaps;
-       EntityID impIdent;
-       Uint8 impUse[128];
-       extent_ad integritySeqExt;
-       Uint8 partitionMaps[0];
-};
-
-/* Generic Partition Map (ECMA 167 3/10.7.1) */
-struct GenericPartitionMap {
-       Uint8 partitionMapType;
-       Uint8 partitionMapLength;
-       Uint8 partitionMapping[0];
-};
-
-/* Partition Map Type (ECMA 167 3/10.7.1.1) */
-#define PARTITION_MAP_TYPE_NONE                0
-#define PARTITION_MAP_TYPE_1           1
-#define PARTITION_MAP_TYPE_2           2
-
-/* Type 1 Partition Map (ECMA 167 3/10.7.2) */
-struct GenericPartitionMap1 {
-       Uint8 partitionMapType;
-       Uint8 partitionMapLength;
-       Uint16 volSeqNum;
-       Uint16 partitionNum;
-};
-
-/* Type 2 Partition Map (ECMA 167 3/10.7.3) */
-struct GenericPartitionMap2 {
-       Uint8 partitionMapType; /* 2 */
-       Uint8 partitionMapLength; 
-       Uint8 partitionIdent[62];
-};
-
-/* Unallocated Space Descriptor (ECMA 167 3/10.8) */
-struct UnallocatedSpaceDesc {
-       tag descTag;
-       Uint32 volDescSeqNum;
-       Uint32 numAllocDescs;
-       extent_ad allocDescs[0];
-};
-
-/* Terminating Descriptor (ECMA 3/10.9) */
-struct TerminatingDesc {
-       tag descTag;
-       Uint8 reserved[496];
-};
-
-struct GenericDesc
-{
-        tag descTag;
-        Uint32 volDescSeqNum;
-};
-
-/* Logical Volume Integrity Descriptor (ECMA 167 3/10.10) */
-struct LogicalVolIntegrityDesc {
-       tag descTag;
-       timestamp recordingDateAndTime;
-       Uint32 integrityType;
-       extent_ad nextIntegrityExt;
-       Uint8 logicalVolContentsUse[32];
-       Uint32 numOfPartitions;
-       Uint32 lengthOfImpUse;
-       Uint32 freeSpaceTable[0];
-       Uint32 sizeTable[0];
-       Uint8 impUse[0];
-};
-
-/* Integrity Types (ECMA 167 3/10.10.3) */
-#define INTEGRITY_TYPE_OPEN    0
-#define INTEGRITY_TYPE_CLOSE   1
-
-/* Recorded Address (ECMA 167 4/7.1) */
-typedef struct {
-       Uint32 logicalBlockNum;
-       Uint16 partitionReferenceNum;
-} lb_addr;
-
-/* Extent interpretation (ECMA 167 4/14.14.1.1) */
-#define EXTENT_RECORDED_ALLOCATED               0x00
-#define EXTENT_NOT_RECORDED_ALLOCATED           0x01
-#define EXTENT_NOT_RECORDED_NOT_ALLOCATED       0x02
-#define EXTENT_NEXT_EXTENT_ALLOCDECS            0x03
-
-/* Long Allocation Descriptor (ECMA 167 4/14.14.2) */
-typedef struct {
-       Uint32 extLength;
-       lb_addr extLocation;
-       Uint8 impUse[6];
-} long_ad;
-       /* upper 2 bits of extLength indicate type */
-
-/* File Set Descriptor (ECMA 167 4/14.1) */
-struct FileSetDesc {
-       tag descTag;
-       timestamp recordingDateAndTime;
-       Uint16 interchangeLvl;
-       Uint16 maxInterchangeLvl;
-       Uint32 charSetList;
-       Uint32 maxCharSetList;
-       Uint32 fileSetNum;
-       Uint32 fileSetDescNum;
-       charspec logicalVolIdentCharSet;
-       dstring logicalVolIdent[128];
-       charspec fileSetCharSet;
-       dstring fileSetIdent[32];
-       dstring copyrightFileIdent[32];
-       dstring abstractFileIdent[32];
-       long_ad rootDirectoryICB;
-       EntityID domainIdent;
-       long_ad nextExt;
-       long_ad streamDirectoryICB;
-       Uint8 reserved[32];
-};
-
-/* Short Allocation Descriptor (ECMA 167 4/14.14.1) */
-typedef struct {
-       Uint32 extLength;
-       Uint32 extPosition;
-} short_ad;
-
-/* Partition Header Descriptor (ECMA 167 4/14.3) */
-struct PartitionHeaderDesc {
-       short_ad unallocatedSpaceTable;
-       short_ad unallocatedSpaceBitmap;
-       short_ad partitionIntegrityTable;
-       short_ad freedSpaceTable;
-       short_ad freedSpaceBitmap;
-       Uint8 reserved[88];
-};
-
-/* File Identifier Descriptor (ECMA 167 4/14.4) */
-struct FileIdentDesc
-{
-       tag descTag;
-       Uint16 fileVersionNum; /* 1 */
-       Uint8 fileCharacteristics;
-       Uint8 lengthFileIdent;
-       long_ad icb;
-       Uint16 lengthOfImpUse;
-       Uint8 impUse[0];
-       Uint8 fileIdent[0];
-       Uint8 padding[0];
-};
-
-/* File Characteristics (ECMA 167 4/14.4.3) */
-#define FILE_HIDDEN    1
-#define FILE_DIRECTORY 2
-#define FILE_DELETED   4
-#define FILE_PARENT    8
-#define FILE_METADATA  0x10 /* UDF 2.0 */
-
-/* Allocation Ext Descriptor (ECMA 167 4/14.5) */
-struct AllocExtDesc
-{
-       tag descTag;
-       Uint32 previousAllocExtLocation;
-       Uint32 lengthAllocDescs;
-};
-
-/* ICB Tag (ECMA 167 4/14.6) */
-typedef struct {
-       Uint32 priorRecordedNumDirectEntries;
-       Uint16 strategyType;
-       Uint16 strategyParameter;
-       Uint16 numEntries;
-       Uint8 reserved;
-       Uint8 fileType;
-       lb_addr parentICBLocation;
-       Uint16 flags;
-} icbtag;
-
-/* ICB File Type (ECMA 167 4/14.6.6) */
-#define FILE_TYPE_NONE         0x00U
-#define FILE_TYPE_UNALLOC      0x01U
-#define FILE_TYPE_INTEGRITY    0x02U
-#define FILE_TYPE_INDIRECT     0x03U
-#define FILE_TYPE_DIRECTORY    0x04U
-#define FILE_TYPE_REGULAR      0x05U
-#define FILE_TYPE_BLOCK                0x06U
-#define FILE_TYPE_CHAR         0x07U
-#define FILE_TYPE_EXTENDED     0x08U
-#define FILE_TYPE_FIFO         0x09U
-#define FILE_TYPE_SOCKET       0x0aU
-#define FILE_TYPE_TERMINAL     0x0bU
-#define FILE_TYPE_SYMLINK      0x0cU
-#define FILE_TYPE_STREAMDIR    0x0dU /* ECMA 167 4/13 */
-
-/* ICB Flags (ECMA 167 4/14.6.8) */
-#define ICB_FLAG_ALLOC_MASK    0x0007U
-#define ICB_FLAG_SORTED                0x0008U
-#define ICB_FLAG_NONRELOCATABLE        0x0010U
-#define ICB_FLAG_ARCHIVE       0x0020U
-#define ICB_FLAG_SETUID                0x0040U
-#define ICB_FLAG_SETGID                0x0080U
-#define ICB_FLAG_STICKY                0x0100U
-#define ICB_FLAG_CONTIGUOUS    0x0200U
-#define ICB_FLAG_SYSTEM                0x0400U
-#define ICB_FLAG_TRANSFORMED   0x0800U
-#define ICB_FLAG_MULTIVERSIONS 0x1000U
-
-/* ICB Flags Allocation type(ECMA 167 4/14.6.8) */
-#define ICB_FLAG_AD_SHORT      0
-#define ICB_FLAG_AD_LONG       1
-#define ICB_FLAG_AD_EXTENDED   2
-#define ICB_FLAG_AD_IN_ICB     3
-
-/* Indirect Entry (ECMA 167 4/14.7) */
-struct IndirectEntry {
-       tag descTag;
-       icbtag icbTag;
-       long_ad indirectICB;
-};
-
-/* Terminal Entry (ECMA 167 4/14.8) */
-struct TerminalEntry {
-       tag descTag;
-       icbtag icbTag;
-};
-
-/* File Entry (ECMA 167 4/14.9) */
-struct FileEntry {
-       tag                     descTag;
-       icbtag          icbTag;
-       Uint32          uid;
-       Uint32          gid;
-       Uint32          permissions;
-       Uint16          fileLinkCount;
-       Uint8           recordFormat;
-       Uint8           recordDisplayAttr;
-       Uint32          recordLength;
-       Uint64          informationLength;
-       Uint64          logicalBlocksRecorded;
-       timestamp       accessTime;
-       timestamp       modificationTime;
-       timestamp       attrTime;
-       Uint32          checkpoint;
-       long_ad         extendedAttrICB;
-       EntityID        impIdent;
-       Uint64          uniqueID; /* 0= root, 16- (2^32-1) */
-       Uint32          lengthExtendedAttr;
-       Uint32          lengthAllocDescs;
-       Uint8           extendedAttr[0];
-       Uint8           allocDescs[0];
-};
-
-/* File Permissions (ECMA 167 4/14.9.5) */
-#define PERM_O_EXEC    0x00000001U
-#define PERM_O_WRITE   0x00000002U
-#define PERM_O_READ    0x00000004U
-#define PERM_O_CHATTR  0x00000008U
-#define PERM_O_DELETE  0x00000010U
-#define PERM_G_EXEC    0x00000020U
-#define PERM_G_WRITE   0x00000040U
-#define PERM_G_READ    0x00000080U
-#define PERM_G_CHATTR  0x00000100U
-#define PERM_G_DELETE  0x00000200U
-#define PERM_U_EXEC    0x00000400U
-#define PERM_U_WRITE   0x00000800U
-#define PERM_U_READ    0x00001000U
-#define PERM_U_CHATTR  0x00002000U
-#define PERM_U_DELETE  0x00004000U
-
-/* File Record Format (ECMA 167 4/14.9.7) */
-#define RECORD_FMT_NONE                        0
-#define RECORD_FMT_FIXED_PAD           1
-#define RECORD_FMT_FIXED               2
-#define RECORD_FMT_VARIABLE8           3
-#define RECORD_FMT_VARIABLE16          4
-#define RECORD_FMT_VARIABLE16_MSB      5
-#define RECORD_FMT_VARIABLE32          6
-#define RECORD_FMT_PRINT               7
-#define RECORD_FMT_LF                  8
-#define RECORD_FMT_CR                  9
-#define RECORD_FMT_CRLF                        10
-#define RECORD_FMT_LFCR                        10
-
-/* Extended Attribute Header Descriptor (ECMA 167 4/14.10.1) */
-struct ExtendedAttrHeaderDesc {
-       tag descTag;
-       Uint32 impAttrLocation;
-       Uint32 appAttrLocation;
-};
-
-/* Generic Attribute Format (ECMA 4/14.10.2) */
-struct GenericAttrFormat {
-       Uint32 attrType;
-       Uint8 attrSubtype;
-       Uint8 reserved[3];
-       Uint32 attrLength;
-       Uint8 attrData[0];
-};
-
-/* Character Set Attribute Format (ECMA 4/14.10.3) */
-struct CharSetAttrFormat {
-       Uint32 attrType;                /* 1 */
-       Uint8 attrSubtype;              /* 1 */
-       Uint8 reserved[3];
-       Uint32 attrLength;
-       Uint32 escapeSeqLength;
-       Uint8 charSetType;
-       Uint8 escapeSeq[0];
-};
-
-/* Alternate Permissions (ECMA 167 4/14.10.4) */
-struct AlternatePermissionsExtendedAttr {
-       Uint32 attrType;                /* 3 */
-       Uint8 attrSubtype;              /* 1 */
-       Uint8 reserved[3];
-       Uint32 attrLength;
-       Uint16 ownerIdent;
-       Uint16 groupIdent;
-       Uint16 permission;
-};
-
-/* File Times Extended Attribute (ECMA 167 4/14.10.5) */
-struct FileTimesExtendedAttr {
-       Uint32 attrType;                /* 5 */
-       Uint8 attrSubtype;              /* 1 */
-       Uint8 reserved[3];
-       Uint32 attrLength;
-       Uint32 dataLength;
-       Uint32 fileTimeExistence;
-       Uint8 fileTimes;
-};
-
-/* FileTimeExistence (ECMA 167 4/14.10.5.6) */
-#define FTE_CREATION   0
-#define FTE_DELETION   2
-#define FTE_EFFECTIVE  3
-#define FTE_BACKUP     5
-
-/* Information Times Extended Attribute (ECMA 167 4/14.10.6) */
-struct InfoTimesExtendedAttr {
-       Uint32 attrType;                /* 6 */
-       Uint8 attrSubtype;              /* 1 */
-       Uint8 reserved[3];
-       Uint32 attrLength;
-       Uint32 dataLength;
-       Uint32 infoTimeExistence;
-       Uint8 infoTimes[0];
-};
-
-/* Device Specification Extended Attribute (ECMA 167 4/14.10.7) */
-struct DeviceSpecificationExtendedAttr {
-       Uint32 attrType;                /* 12 */
-       Uint8 attrSubtype;              /* 1 */
-       Uint8 reserved[3];
-       Uint32 attrLength;
-       Uint32 impUseLength;
-       Uint32 majorDeviceIdent;
-       Uint32 minorDeviceIdent;
-       Uint8 impUse[0];
-};
-
-/* Implementation Use Extended Attr (ECMA 167 4/14.10.8) */
-struct ImpUseExtendedAttr {
-       Uint32 attrType;                /* 2048 */
-       Uint8 attrSubtype;              /* 1 */
-       Uint8 reserved[3];
-       Uint32 attrLength;
-       Uint32 impUseLength;
-       EntityID impIdent;
-       Uint8 impUse[0];
-};
-
-/* Application Use Extended Attribute (ECMA 167 4/14.10.9) */
-struct AppUseExtendedAttr {
-       Uint32 attrType;                /* 65536 */
-       Uint8 attrSubtype;              /* 1 */
-       Uint8 reserved[3];
-       Uint32 attrLength;
-       Uint32 appUseLength;
-       EntityID appIdent;
-       Uint8 appUse[0];
-};
-
-#define EXTATTR_CHAR_SET       1
-#define EXTATTR_ALT_PERMS      3
-#define EXTATTR_FILE_TIMES     5
-#define EXTATTR_INFO_TIMES     6
-#define EXTATTR_DEV_SPEC       12
-#define EXTATTR_IMP_USE                2048
-#define EXTATTR_APP_USE                65536
-
-
-/* Unallocated Space Entry (ECMA 167 4/14.11) */
-struct UnallocatedSpaceEntry {
-       tag descTag;
-       icbtag icbTag;
-       Uint32 lengthAllocDescs;
-       Uint8 allocDescs[0];
-};
-
-/* Space Bitmap Descriptor (ECMA 167 4/14.12) */
-struct SpaceBitmapDesc {
-       tag descTag;
-       Uint32 numOfBits;
-       Uint32 numOfBytes;
-       Uint8 bitmap[0];
-};
-
-/* Partition Integrity Entry (ECMA 167 4/14.13) */
-struct PartitionIntegrityEntry {
-       tag descTag;
-       icbtag icbTag;
-       timestamp recordingDateAndTime;
-       Uint8 integrityType;
-       Uint8 reserved[175];
-       EntityID impIdent;
-       Uint8 impUse[256];
-};
-
-/* Extended Allocation Descriptor (ECMA 167 4/14.14.3) */
-typedef struct { /* ECMA 167 4/14.14.3 */
-       Uint32 extLength;
-       Uint32 recordedLength;
-       Uint32 informationLength;
-       lb_addr extLocation;
-} ext_ad;
-
-/* Logical Volume Header Descriptor (ECMA 167 4/14.5) */
-struct LogicalVolHeaderDesc {
-       Uint64 uniqueID;
-       Uint8 reserved[24];
-};
-
-/* Path Component (ECMA 167 4/14.16.1) */
-struct PathComponent {
-       Uint8 componentType;
-       Uint8 lengthComponentIdent;
-       Uint16 componentFileVersionNum;
-       dstring componentIdent[0];
-};
-
-/* File Entry (ECMA 167 4/14.17) */
-struct ExtendedFileEntry {
-       tag                     descTag;
-       icbtag          icbTag;
-       Uint32          uid;
-       Uint32          gid;
-       Uint32          permissions;
-       Uint16          fileLinkCount;
-       Uint8           recordFormat;
-       Uint8           recordDisplayAttr;
-       Uint32          recordLength;
-       Uint64          informationLength;
-       Uint64          objectSize;
-       Uint64          logicalBlocksRecorded;
-       timestamp       accessTime;
-       timestamp       modificationTime;
-       timestamp       createTime;
-       timestamp       attrTime;
-       Uint32          checkpoint;
-       Uint32          reserved;
-       long_ad         extendedAttrICB;
-       long_ad         streamDirectoryICB;
-       EntityID        impIdent;
-       Uint64          uniqueID;
-       Uint32          lengthExtendedAttr;
-       Uint32          lengthAllocDescs;
-       Uint8           extendedAttr[0];
-       Uint8           allocDescs[0];
-};
-#pragma pack()
-
-#endif /* !defined(_LINUX_UDF_167_H) */
index c2a0b4b2394887fc5a120dd0f6f2b38a838bcbe6..77a54446df3d9c439f08446739e54898914e99fe 100644 (file)
  *
  */
 
-#if !defined(_LINUX_UDF_FS_H)
-#define _LINUX_UDF_FS_H
+#ifndef _UDF_FS_H
+#define _UDF_FS_H 1
 
 #define UDF_PREALLOCATE
 #define UDF_DEFAULT_PREALLOC_BLOCKS    8
 
-#define UDFFS_DATE                     "2001/10/10"
-#define UDFFS_VERSION                  "0.9.5"
+#define UDFFS_DATE                     "2002/03/11"
+#define UDFFS_VERSION                  "0.9.6"
 
 #if !defined(UDFFS_RW)
 
@@ -66,4 +66,4 @@
 #define udf_info(f, a...) \
                printk (KERN_INFO "UDF-fs INFO " f, ##a);
 
-#endif /* !defined(_LINUX_UDF_FS_H) */
+#endif /* _UDF_FS_H */
index 8e26831b69420093edcd1b923b44906342f33423..110468cb82df5d704c5aa4bcdf7ffc899ee6f2dc 100644 (file)
  *     Each contributing author retains all rights to their own work.
  */
 
-#if !defined(_LINUX_UDF_FS_I_H)
-#define _LINUX_UDF_FS_I_H
+#ifndef _UDF_FS_I_H
+#define _UDF_FS_I_H 1
 
 #ifdef __KERNEL__
 
-#ifndef _LINUX_UDF_167_H
+#ifndef _ECMA_167_H
 typedef struct
 {
        __u32 logicalBlockNum;
        __u16 partitionReferenceNum;
-} lb_addr;
+} __attribute__ ((packed)) lb_addr;
 #endif
 
 struct udf_inode_info
@@ -59,4 +59,4 @@ struct udf_inode_info
 #define UDF_GETVOLIDENT _IOR('l', 0x42, void *)
 #define UDF_RELOCATE_BLOCKS _IOWR('l', 0x43, long)
 
-#endif /* !defined(_LINUX_UDF_FS_I_H) */
+#endif /* _UDF_FS_I_H */
index fdb078d9dbc61a5fe361b030f5f96f08c33f7492..e898136bf94726e2261bc63e3d42036237941efa 100644 (file)
@@ -15,8 +15,8 @@
  *     Each contributing author retains all rights to their own work.
  */
 
-#if !defined(_LINUX_UDF_FS_SB_H)
-#define _LINUX_UDF_FS_SB_H
+#ifndef _UDF_FS_SB_H
+#define _UDF_FS_SB_H 1
 
 #pragma pack(1)
 
@@ -115,4 +115,4 @@ struct udf_sb_info
        struct inode            *s_vat;
 };
 
-#endif /* !defined(_LINUX_UDF_FS_SB_H) */
+#endif /* _UDF_FS_SB_H */
diff --git a/include/linux/udf_udf.h b/include/linux/udf_udf.h
deleted file mode 100644 (file)
index 6b9df04..0000000
+++ /dev/null
@@ -1,231 +0,0 @@
-#if !defined(_LINUX_UDF_UDF_H)
-#define _LINUX_UDF_UDF_H
-/*
- * udf_udf.h
- *
- * PURPOSE
- *     OSTA-UDF(tm) format specification [based on ECMA 167 standard].
- *     http://www.osta.org/
- *
- * CONTACTS
- *     E-mail regarding any portion of the Linux UDF file system should be
- *     directed to the development team mailing list (run by majordomo):
- *             linux_udf@hpesjro.fc.hp.com
- *
- * COPYRIGHT
- *     This file is distributed under the terms of the GNU General Public
- *     License (GPL). Copies of the GPL can be obtained from:
- *             ftp://prep.ai.mit.edu/pub/gnu/GPL
- *     Each contributing author retains all rights to their own work.
- *
- * HISTORY
- *     July 1, 1997 - Andrew E. Mileski
- *     Written, tested, and released.
- *
- * 10/2/98 dgb changed UDF_ID_DEVELOPER
- * 11/26/98 bf  changed UDF_ID_DEVELOPER, 
- * 12/5/98 dgb  updated include file hierarchy, more UDF definitions
- */
-
-/* based on ECMA 167 structure definitions */
-#include <linux/udf_167.h>
-
-#pragma pack(1)
-
-/* -------- Basic types and constants ----------- */
-/* UDF character set (UDF 1.50 2.1.2) */
-#define UDF_CHAR_SET_TYPE      0
-#define UDF_CHAR_SET_INFO      "OSTA Compressed Unicode"
-
-#define UDF_ID_DEVELOPER       "*Linux UDFFS"
-/* UDF 1.02 2.2.6.4 */
-struct LogicalVolIntegrityDescImpUse
-{
-       EntityID        impIdent;
-       Uint32          numFiles;
-       Uint32          numDirs;
-       Uint16          minUDFReadRev;
-       Uint16          minUDFWriteRev;
-       Uint16          maxUDFWriteRev;
-};
-
-/* UDF 1.02 2.2.7.2 */
-/* LVInformation may be present in ImpUseVolDesc.impUse */
-struct ImpUseVolDescImpUse
-{
-       charspec        LVICharset;
-       dstring         logicalVolIdent[128];
-       dstring         LVInfo1[36];
-       dstring         LVInfo2[36];
-       dstring         LVInfo3[36];
-       EntityID        impIdent;
-       Uint8           impUse[128];
-};
-
-struct UdfPartitionMap2
-{
-        Uint8           partitionMapType;
-        Uint8           partitionMapLength;
-        Uint8           reserved1[2];
-        EntityID        partIdent;
-        Uint16          volSeqNum;
-        Uint16          partitionNum;
-        Uint8           reserved2[24];
-};
-
-/* UDF 1.5 2.2.8 */
-struct VirtualPartitionMap
-{
-       Uint8           partitionMapType;       /* 2 */
-       Uint8           partitionMapLength;     /* 64 */
-       Uint8           reserved1[2];           /* #00 */
-       EntityID        partIdent;
-       Uint16          volSeqNum;
-       Uint16          partitionNum;
-       Uint8           reserved2[24];          /* #00 */
-};
-
-/* UDF 1.5 2.2.9 */
-struct SparablePartitionMap
-{
-       Uint8           partitionMapType;       /* 2 */
-       Uint8           partitionMapLength;     /* 64 */
-       Uint8           reserved1[2];           /* #00 */
-       EntityID        partIdent;              /* Flags = 0 */
-                                               /* Id = UDF_ID_SPARABLE */
-                                               /* IdSuf = 2.1.5.3 */
-       Uint16          volSeqNum;
-       Uint16          partitionNum;
-       Uint16          packetLength;           /* 32 */
-       Uint8           numSparingTables;
-       Uint8           reserved2[1];           /* #00 */
-       Uint32          sizeSparingTable;
-       Uint32          locSparingTable[4];
-};
-/* DVD Copyright Management Info, see UDF 1.02 3.3.4.5.1.2 */
-/* when ImpUseExtendedAttr.impIdent= "*UDF DVD CGMS Info" */
-struct DVDCopyrightImpUse {
-       Uint16 headerChecksum;
-       Uint8  CGMSInfo;
-       Uint8  dataType;
-       Uint8  protectionSystemInfo[4];
-};
-
-/* the impUse of long_ad used in AllocDescs  - UDF 1.02 2.3.10.1 */
-struct ADImpUse
-{
-       Uint16 flags;
-       Uint8  impUse[4];
-};
-
-/* UDF 1.02 2.3.10.1 */
-#define UDF_EXTENT_LENGTH_MASK         0x3FFFFFFF
-#define UDF_EXTENT_FLAG_MASK           0xc0000000
-#define UDF_EXTENT_FLAG_ERASED         0x40000000
-
-/* 
- * Important!  VirtualAllocationTables are 
- * very different between 1.5 and 2.0!
- */
-
-/* ----------- 1.5 ------------- */
-/* UDF 1.5 2.2.10 */
-#define FILE_TYPE_VAT15                0x0U
-
-/* UDF 1.5 2.2.10 - VAT layout: */
-struct VirutalAllocationTable15 {
-       Uint32 VirtualSector[0];
-       EntityID        ident;
-       Uint32  previousVATICB;
-   };  
-/* where number of VirtualSector's is (VATSize-36)/4 */
-
-/* ----------- 2.0 ------------- */
-/* UDF 2.0 2.2.10 */
-#define FILE_TYPE_VAT20                0xf8U
-
-/* UDF 2.0 2.2.10 (different from 1.5!) */
-struct VirtualAllocationTable20 {
-       Uint16 lengthHeader;
-       Uint16 lengthImpUse;
-       dstring logicalVolIdent[128];
-       Uint32  previousVatICBLoc;
-       Uint32  numFIDSFiles;
-       Uint32  numFIDSDirectories; /* non-parent */
-       Uint16  minReadRevision;
-       Uint16  minWriteRevision;
-       Uint16  maxWriteRevision;
-       Uint16  reserved;
-       Uint8   impUse[0];
-       Uint32  vatEntry[0];
-};
-
-/* ----------- 2.01 ------------- */
-/* UDF 2.01 6.11 */
-#define FILE_TYPE_REALTIME     0xf9U
-
-/* Sparing maps, see UDF 1.5 2.2.11 */
-typedef struct {
-       Uint32  origLocation;
-       Uint32  mappedLocation;
-} SparingEntry;
-
-/* sparing maps, see UDF 2.0 2.2.11 */
-struct SparingTable {
-       tag     descTag;
-       EntityID sparingIdent; /* *UDF Sparing Table */
-       Uint16   reallocationTableLen;
-       Uint16   reserved;      /* #00 */
-       Uint32   sequenceNum;
-       SparingEntry mapEntry[0];
-};
-
-/* Entity Identifiers (UDF 1.50 6.1) */
-#define        UDF_ID_COMPLIANT        "*OSTA UDF Compliant"
-#define UDF_ID_LV_INFO         "*UDF LV Info"
-#define UDF_ID_FREE_EA         "*UDF FreeEASpace"
-#define UDF_ID_FREE_APP_EA     "*UDF FreeAppEASpace"
-#define UDF_ID_DVD_CGMS                "*UDF DVD CGMS Info"
-#define UDF_ID_OS2_EA          "*UDF OS/2 EA"
-#define UDF_ID_OS2_EA_LENGTH   "*UDF OS/2 EALength"
-#define UDF_ID_MAC_VOLUME      "*UDF Mac VolumeInfo"
-#define UDF_ID_MAC_FINDER      "*UDF Mac FinderInfo"
-#define UDF_ID_MAC_UNIQUE      "*UDF Mac UniqueIDTable"
-#define UDF_ID_MAC_RESOURCE    "*UDF Mac ResourceFork"
-#define UDF_ID_VIRTUAL         "*UDF Virtual Partition"
-#define UDF_ID_SPARABLE                "*UDF Sparable Partition"
-#define UDF_ID_ALLOC           "*UDF Virtual Alloc Tbl"
-#define UDF_ID_SPARING         "*UDF Sparing Table"
-
-/* Operating System Identifiers (UDF 1.50 6.3) */
-#define UDF_OS_CLASS_UNDEF     0x00U
-#define UDF_OS_CLASS_DOS       0x01U
-#define UDF_OS_CLASS_OS2       0x02U
-#define UDF_OS_CLASS_MAC       0x03U
-#define UDF_OS_CLASS_UNIX      0x04U
-#define UDF_OS_CLASS_WIN95     0x05U
-#define UDF_OS_CLASS_WINNT     0x06U
-#define UDF_OS_ID_UNDEF                0x00U
-#define UDF_OS_ID_DOS          0x00U
-#define UDF_OS_ID_OS2          0x00U
-#define UDF_OS_ID_MAC          0x00U
-#define UDF_OS_ID_UNIX         0x00U
-#define UDF_OS_ID_WIN95                0x00U
-#define UDF_OS_ID_WINNT                0x00U
-#define UDF_OS_ID_AIX          0x01U
-#define UDF_OS_ID_SOLARIS      0x02U
-#define UDF_OS_ID_HPUX         0x03U
-#define UDF_OS_ID_IRIX         0x04U
-#define UDF_OS_ID_LINUX                0x05U
-#define UDF_OS_ID_MKLINUX      0x06U
-#define UDF_OS_ID_FREEBSD      0x07U
-
-#define UDF_NAME_PAD   4
-#define UDF_NAME_LEN   255
-#define UDF_PATH_LEN   1023
-
-#pragma pack()
-
-#endif /* !defined(_LINUX_UDF_FMT_H) */