X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=fs%2Fudf%2Fdirectory.c;h=2820f8fcf4cc2e932b72f70cf25a7c69586546d9;hb=6ce37a58e334ef773f88283939afc9f4965c7697;hp=ba79794abcede4c8a9743e407cf88a16749ad140;hpb=4b11111aba6c80cc2969fd1806d2a869bfc9f357;p=linux-2.6 diff --git a/fs/udf/directory.c b/fs/udf/directory.c index ba79794abc..2820f8fcf4 100644 --- a/fs/udf/directory.c +++ b/fs/udf/directory.c @@ -81,12 +81,13 @@ struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t *nf_pos, struct fileIdentDesc *fi; int i, num, block; struct buffer_head *tmp, *bha[16]; + struct udf_inode_info *iinfo = UDF_I(dir); fibh->soffset = fibh->eoffset; - if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_IN_ICB) { - fi = udf_get_fileident(UDF_I_DATA(dir) - - (UDF_I_EFE(dir) ? + if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) { + fi = udf_get_fileident(iinfo->i_ext.i_data - + (iinfo->i_efe ? sizeof(struct extendedFileEntry) : sizeof(struct fileEntry)), dir->i_sb->s_blocksize, @@ -94,7 +95,7 @@ struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t *nf_pos, if (!fi) return NULL; - *nf_pos += ((fibh->eoffset - fibh->soffset) >> 2); + *nf_pos += fibh->eoffset - fibh->soffset; memcpy((uint8_t *)cfi, (uint8_t *)fi, sizeof(struct fileIdentDesc)); @@ -156,7 +157,7 @@ struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t *nf_pos, if (!fi) return NULL; - *nf_pos += ((fibh->eoffset - fibh->soffset) >> 2); + *nf_pos += fibh->eoffset - fibh->soffset; if (fibh->eoffset <= dir->i_sb->s_blocksize) { memcpy((uint8_t *)cfi, (uint8_t *)fi, @@ -196,8 +197,7 @@ struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t *nf_pos, cfi->lengthFileIdent + le16_to_cpu(cfi->lengthOfImpUse) + 3) & ~3; - *nf_pos += (fi_len - (fibh->eoffset - fibh->soffset)) - >> 2; + *nf_pos += fi_len - (fibh->eoffset - fibh->soffset); fibh->eoffset = fibh->soffset + fi_len; } else { memcpy((uint8_t *)cfi, (uint8_t *)fi, @@ -225,7 +225,7 @@ struct fileIdentDesc *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) != TAG_IDENT_FID) { + if (fi->descTag.tagIdent != cpu_to_le16(TAG_IDENT_FID)) { udf_debug("0x%x != TAG_IDENT_FID\n", le16_to_cpu(fi->descTag.tagIdent)); udf_debug("offset: %u sizeof: %lu bufsize: %u\n", @@ -262,7 +262,7 @@ static extent_ad *udf_get_fileextent(void *buffer, int bufsize, int *offset) fe = (struct fileEntry *)buffer; - if (le16_to_cpu(fe->descTag.tagIdent) != TAG_IDENT_FE) { + if (fe->descTag.tagIdent != cpu_to_le16(TAG_IDENT_FE)) { udf_debug("0x%x != TAG_IDENT_FE\n", le16_to_cpu(fe->descTag.tagIdent)); return NULL; @@ -281,7 +281,7 @@ static extent_ad *udf_get_fileextent(void *buffer, int bufsize, int *offset) } #endif -short_ad *udf_get_fileshortad(uint8_t *ptr, int maxoffset, int *offset, +short_ad *udf_get_fileshortad(uint8_t *ptr, int maxoffset, uint32_t *offset, int inc) { short_ad *sa; @@ -291,7 +291,7 @@ short_ad *udf_get_fileshortad(uint8_t *ptr, int maxoffset, int *offset, return NULL; } - if ((*offset < 0) || ((*offset + sizeof(short_ad)) > maxoffset)) + if ((*offset + sizeof(short_ad)) > maxoffset) return NULL; else { sa = (short_ad *)ptr; @@ -304,7 +304,7 @@ short_ad *udf_get_fileshortad(uint8_t *ptr, int maxoffset, int *offset, return sa; } -long_ad *udf_get_filelongad(uint8_t *ptr, int maxoffset, int *offset, int inc) +long_ad *udf_get_filelongad(uint8_t *ptr, int maxoffset, uint32_t *offset, int inc) { long_ad *la; @@ -313,7 +313,7 @@ long_ad *udf_get_filelongad(uint8_t *ptr, int maxoffset, int *offset, int inc) return NULL; } - if ((*offset < 0) || ((*offset + sizeof(long_ad)) > maxoffset)) + if ((*offset + sizeof(long_ad)) > maxoffset) return NULL; else { la = (long_ad *)ptr;