patch-2.4.19 linux-2.4.19/fs/udf/inode.c

Next file: linux-2.4.19/fs/udf/lowlevel.c
Previous file: linux-2.4.19/fs/udf/ialloc.c
Back to the patch index
Back to the overall index

diff -urN linux-2.4.18/fs/udf/inode.c linux-2.4.19/fs/udf/inode.c
@@ -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 @@
 
 #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 @@
 	 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 *, long, struct buffer_head *, int);
 
 /*
@@ -83,9 +83,6 @@
 	{
 		lock_kernel();
 		udf_discard_prealloc(inode);
-		/* write the root inode on put, if dirty */
-		if (!inode->i_sb->s_root && inode->i_state & I_DIRTY)
-			udf_update_inode(inode, IS_SYNC(inode));
 		unlock_kernel();
 	}
 }
@@ -128,7 +125,7 @@
 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);
 	}
@@ -176,9 +173,9 @@
 	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;
 	}
@@ -205,9 +202,9 @@
 		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);
 
@@ -223,19 +220,19 @@
 	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;
 	}
@@ -279,7 +276,7 @@
 		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))
 		{
@@ -295,9 +292,9 @@
 
 	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;
@@ -401,19 +398,19 @@
 {
 	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.
@@ -450,7 +447,7 @@
 		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);
@@ -464,11 +461,11 @@
 	/* 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);
@@ -496,7 +493,7 @@
 					~(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 ++;
@@ -537,7 +534,7 @@
 
 	/* 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 */
 	{
@@ -603,8 +600,8 @@
 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) +
@@ -626,10 +623,10 @@
 
 		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;
@@ -643,16 +640,16 @@
 		}
 		
 		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);
@@ -676,7 +673,7 @@
 	}
 	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) +
@@ -693,7 +690,7 @@
 			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
@@ -712,7 +709,6 @@
 
 		if (numalloc)
 		{
-			UDF_I_LENEXTENTS(inode) += numalloc << inode->i_sb->s_blocksize_bits;
 			if (start == (c+1))
 				laarr[start].extLength +=
 					(numalloc << inode->i_sb->s_blocksize_bits);
@@ -724,7 +720,7 @@
 				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;
 			}
@@ -736,7 +732,7 @@
 
 				if (elen > numalloc)
 				{
-					laarr[c+1].extLength -=
+					laarr[c].extLength -=
 						(numalloc << inode->i_sb->s_blocksize_bits);
 					numalloc = 0;
 				}
@@ -750,6 +746,7 @@
 					(*endnum) --;
 				}
 			}
+			UDF_I_LENEXTENTS(inode) += numalloc << inode->i_sb->s_blocksize_bits;
 		}
 	}
 }
@@ -763,7 +760,7 @@
 	{
 		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)))
@@ -800,11 +797,11 @@
 
 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)
 	{
@@ -866,13 +863,13 @@
 	if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
 		return;
 
-	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);
 				return;
@@ -937,8 +934,8 @@
 __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!
@@ -966,8 +963,8 @@
 		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);
@@ -976,28 +973,28 @@
 		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);
@@ -1033,8 +1030,8 @@
 
 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;
@@ -1042,24 +1039,24 @@
 	inode->i_version = ++event;
 	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;
-	if (fe->descTag.tagIdent == TID_EXTENDED_FILE_ENTRY)
+	UDF_I_ALLOCTYPE(inode) = le16_to_cpu(fe->icbTag.flags) & ICBTAG_FLAG_AD_MASK;
+	if (le16_to_cpu(fe->descTag.tagIdent) == TAG_IDENT_EFE)
 		UDF_I_EXTENDED_FE(inode) = 1;
-	else if (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 (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;
 	}
 
@@ -1124,7 +1121,7 @@
 		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
@@ -1181,13 +1178,13 @@
 		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;
@@ -1195,11 +1192,11 @@
 			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;
@@ -1208,22 +1205,22 @@
 			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;
@@ -1241,8 +1238,8 @@
 	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)
@@ -1261,11 +1258,11 @@
 }
 
 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);
@@ -1273,9 +1270,9 @@
 	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;
 }
@@ -1311,11 +1308,11 @@
 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;
@@ -1328,35 +1325,36 @@
 		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 (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);
 		use->descTag.descCRC = cpu_to_le16(udf_crc((char *)use + sizeof(tag), crclen, 0));
 
 		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);
@@ -1374,9 +1372,9 @@
 			((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))
@@ -1388,26 +1386,26 @@
 
 	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;
@@ -1429,15 +1427,15 @@
 			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
 	{
@@ -1475,15 +1473,15 @@
 		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))
 	{
@@ -1498,28 +1496,31 @@
 	}
 
 	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);
-	fe->descTag.descVersion = cpu_to_le16(2);
+	if (UDF_SB_UDFREV(inode->i_sb) >= 0x0200)
+		fe->descTag.descVersion = cpu_to_le16(3);
+	else
+		fe->descTag.descVersion = cpu_to_le16(2);
 	fe->descTag.tagSerialNum = cpu_to_le16(UDF_SB_SERIALNUM(inode->i_sb));
 	fe->descTag.tagLocation = cpu_to_le32(UDF_I_LOCATION(inode).logicalBlockNum);
 	crclen += UDF_I_LENEATTR(inode) + UDF_I_LENALLOC(inode) - sizeof(tag);
@@ -1529,7 +1530,7 @@
 	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 +1611,14 @@
 	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 +1631,9 @@
 		}
 	}
 
-	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 +1661,7 @@
 		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 +1669,20 @@
 			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);
 			}
@@ -1691,24 +1692,28 @@
 				mark_inode_dirty(inode);
 			}
 		}
-		udf_new_tag(nbh->b_data, TID_ALLOC_EXTENT_DESC, 2, 1,
-			bloc->logicalBlockNum, sizeof(tag));
+		if (UDF_SB_UDFREV(inode->i_sb) >= 0x0200)
+			udf_new_tag(nbh->b_data, TAG_IDENT_AED, 3, 1,
+				bloc->logicalBlockNum, sizeof(tag));
+		else
+			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));
@@ -1718,13 +1723,13 @@
 		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)))
 	{
@@ -1733,21 +1738,21 @@
 	}
 	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;
@@ -1766,23 +1771,23 @@
 	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);
@@ -1796,9 +1801,9 @@
 	{
 		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);
 	}
@@ -1814,12 +1819,12 @@
 	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))
 	{
@@ -1832,29 +1837,29 @@
 		}
 	}
 
-	tagIdent = ((tag *)(*bh)->b_data)->tagIdent;
+	tagIdent = le16_to_cpu(((tag *)(*bh)->b_data)->tagIdent);
 
 	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
@@ -1865,14 +1870,14 @@
 
 	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;
@@ -1888,14 +1893,14 @@
 			}
 			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;
@@ -1910,11 +1915,11 @@
 			}
 			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;
@@ -1930,18 +1935,18 @@
 
 	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))
 	{
@@ -1957,16 +1962,16 @@
 	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;
 	}
 
@@ -1975,7 +1980,7 @@
 
 	switch (UDF_I_ALLOCTYPE(inode))
 	{
-		case ICB_FLAG_AD_SHORT:
+		case ICBTAG_FLAG_AD_SHORT:
 		{
 			short_ad *sad;
 
@@ -1988,7 +1993,7 @@
 			*elen = le32_to_cpu(sad->extLength) & UDF_EXTENT_LENGTH_MASK;
 			break;
 		}
-		case ICB_FLAG_AD_LONG:
+		case ICBTAG_FLAG_AD_LONG:
 		{
 			long_ad *lad;
 
@@ -2010,19 +2015,19 @@
 		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)
 	{
@@ -2049,14 +2054,14 @@
 	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))
 	{
@@ -2072,9 +2077,9 @@
 		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;
@@ -2113,13 +2118,13 @@
 		}
 		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);
 		}
 	}
@@ -2133,13 +2138,13 @@
 		}
 		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);
 		}
 	}
@@ -2149,11 +2154,11 @@
 	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)
 	{
@@ -2189,13 +2194,13 @@
 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;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)