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

Next file: linux-2.4.19/fs/udf/ecma_167.h
Previous file: linux-2.4.19/fs/udf/dir.c
Back to the patch index
Back to the overall index

diff -urN linux-2.4.18/fs/udf/directory.c linux-2.4.19/fs/udf/directory.c
@@ -18,33 +18,20 @@
 
 #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 @@
 		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 @@
 		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 @@
 		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 @@
 
 	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 @@
 		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 @@
 		}
 		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 @@
 	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 @@
 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 @@
 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 @@
 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;

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