📄 1011.udf.patch
字号:
@@ -1806,30 +1841,28 @@ le32_to_cpu(aed->lengthAllocDescs) + sizeof(struct allocExtDesc)); } mark_buffer_dirty_inode(bh, inode);+ udf_release_data(bh); } else- { mark_inode_dirty(inode);- mark_buffer_dirty(bh);- } if (inc) *extoffset += adsize;- udf_release_data(bh); return (elen >> 30); } 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_t tagIdent;- int pos, alen; int8_t etype; - if (!(*bh))+ while ((etype = udf_current_aext(inode, bloc, extoffset, eloc, elen, bh, inc)) ==+ (EXT_NEXT_EXTENT_ALLOCDECS >> 30)) {- if (!(*bh = udf_tread(inode->i_sb,- udf_get_lb_pblock(inode->i_sb, *bloc, 0))))+ *bloc = *eloc;+ *extoffset = sizeof(struct allocExtDesc);+ udf_release_data(*bh);+ if (!(*bh = udf_tread(inode->i_sb, udf_get_lb_pblock(inode->i_sb, *bloc, 0)))) { udf_debug("reading block %d failed!\n", udf_get_lb_pblock(inode->i_sb, *bloc, 0));@@ -1837,154 +1870,38 @@ } } - tagIdent = le16_to_cpu(((tag *)(*bh)->b_data)->tagIdent);-- if (!memcmp(&UDF_I_LOCATION(inode), bloc, sizeof(lb_addr)))- {- 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 == TAG_IDENT_USE)- {- pos = sizeof(struct unallocSpaceEntry);- alen = UDF_I_LENALLOC(inode) + pos;- }- else- return -1;- }- else if (tagIdent == TAG_IDENT_AED)- {- struct allocExtDesc *aed = (struct allocExtDesc *)(*bh)->b_data;-- pos = sizeof(struct allocExtDesc);- alen = le32_to_cpu(aed->lengthAllocDescs) + pos;- }- else- return -1;-- if (!(*extoffset))- *extoffset = pos;-- switch (UDF_I_ALLOCTYPE(inode))- {- 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) == (EXT_NEXT_EXTENT_ALLOCDECS >> 30))- {- bloc->logicalBlockNum = le32_to_cpu(sad->extPosition);- *extoffset = 0;- udf_release_data(*bh);- *bh = NULL;- return udf_next_aext(inode, bloc, extoffset, eloc, elen, bh, inc);- }- else- {- eloc->logicalBlockNum = le32_to_cpu(sad->extPosition);- eloc->partitionReferenceNum = UDF_I_LOCATION(inode).partitionReferenceNum;- *elen = le32_to_cpu(sad->extLength) & UDF_EXTENT_LENGTH_MASK;- }- break;- }- 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) == (EXT_NEXT_EXTENT_ALLOCDECS >> 30))- {- *bloc = lelb_to_cpu(lad->extLocation);- *extoffset = 0;- udf_release_data(*bh);- *bh = NULL;- return udf_next_aext(inode, bloc, extoffset, eloc, elen, bh, inc);- }- else- {- *eloc = lelb_to_cpu(lad->extLocation);- *elen = le32_to_cpu(lad->extLength) & UDF_EXTENT_LENGTH_MASK;- }- break;- }- case ICBTAG_FLAG_AD_IN_ICB:- {- if (UDF_I_LENALLOC(inode) == 0)- return -1;- etype = (EXT_RECORDED_ALLOCATED >> 30);- *eloc = UDF_I_LOCATION(inode);- *elen = UDF_I_LENALLOC(inode);- break;- }- default:- {- udf_debug("alloc_type = %d unsupported\n", UDF_I_ALLOCTYPE(inode));- return -1;- }- }- if (*elen)- return etype;-- 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) == ICBTAG_FLAG_AD_SHORT)- *extoffset -= sizeof(short_ad);- else if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_LONG)- *extoffset -= sizeof(long_ad);- return -1;+ return etype; } 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;+ int alen; int8_t etype;+ uint8_t *ptr; - if (!(*bh))- {- if (!(*bh = udf_tread(inode->i_sb,- udf_get_lb_pblock(inode->i_sb, *bloc, 0))))- {- udf_debug("reading block %d failed!\n",- udf_get_lb_pblock(inode->i_sb, *bloc, 0));- return -1;- }- }-- if (!memcmp(&UDF_I_LOCATION(inode), bloc, sizeof(lb_addr)))+ if (!*bh) {- if (!(UDF_I_EXTENDED_FE(inode)))- pos = sizeof(struct fileEntry) + UDF_I_LENEATTR(inode);- else- pos = sizeof(struct extendedFileEntry) + UDF_I_LENEATTR(inode);- alen = UDF_I_LENALLOC(inode) + pos;+ if (!(*extoffset))+ *extoffset = udf_file_entry_alloc_offset(inode);+ ptr = UDF_I_DATA(inode) + *extoffset - udf_file_entry_alloc_offset(inode) + UDF_I_LENEATTR(inode);+ alen = udf_file_entry_alloc_offset(inode) + UDF_I_LENALLOC(inode); } else {- struct allocExtDesc *aed = (struct allocExtDesc *)(*bh)->b_data;-- pos = sizeof(struct allocExtDesc);- alen = le32_to_cpu(aed->lengthAllocDescs) + pos;+ if (!(*extoffset))+ *extoffset = sizeof(struct allocExtDesc);+ ptr = (*bh)->b_data + *extoffset;+ alen = sizeof(struct allocExtDesc) + le32_to_cpu(((struct allocExtDesc *)(*bh)->b_data)->lengthAllocDescs); } - if (!(*extoffset))- *extoffset = pos;- switch (UDF_I_ALLOCTYPE(inode)) { case ICBTAG_FLAG_AD_SHORT: { short_ad *sad; - if (!(sad = udf_get_fileshortad((*bh)->b_data, alen, extoffset, inc)))+ if (!(sad = udf_get_fileshortad(ptr, alen, extoffset, inc))) return -1; etype = le32_to_cpu(sad->extLength) >> 30;@@ -1997,7 +1914,7 @@ { long_ad *lad; - if (!(lad = udf_get_filelongad((*bh)->b_data, alen, extoffset, inc)))+ if (!(lad = udf_get_filelongad(ptr, alen, extoffset, inc))) return -1; etype = le32_to_cpu(lad->extLength) >> 30;@@ -2005,21 +1922,22 @@ *elen = le32_to_cpu(lad->extLength) & UDF_EXTENT_LENGTH_MASK; break; }+ case ICBTAG_FLAG_AD_IN_ICB:+ {+ etype = EXT_RECORDED_ALLOCATED;+ eloc->logicalBlockNum = UDF_I_LOCATION(inode).logicalBlockNum;+ eloc->partitionReferenceNum = UDF_I_LOCATION(inode).partitionReferenceNum;+ *elen = UDF_I_LENALLOC(inode);+ break;+ } default: { udf_debug("alloc_type = %d unsupported\n", UDF_I_ALLOCTYPE(inode)); return -1; } }- if (*elen)- return etype; - udf_debug("Empty Extent!\n");- if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_SHORT)- *extoffset -= sizeof(short_ad);- else if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_LONG)- *extoffset -= sizeof(long_ad);- return -1;+ return etype; } int8_t udf_insert_aext(struct inode *inode, lb_addr bloc, int extoffset,@@ -2029,17 +1947,7 @@ uint32_t oelen; int8_t etype; - if (!bh)- {- if (!(bh = udf_tread(inode->i_sb,- udf_get_lb_pblock(inode->i_sb, bloc, 0))))- {- udf_debug("reading block %d failed!\n",- udf_get_lb_pblock(inode->i_sb, bloc, 0));- return -1;- }- }- else+ if (bh) atomic_inc(&bh->b_count); while ((etype = udf_next_aext(inode, &bloc, &extoffset, &oeloc, &oelen, &bh, 0)) != -1)@@ -2063,19 +1971,11 @@ int8_t etype; struct allocExtDesc *aed; - if (!(nbh))+ if (nbh) {- if (!(nbh = udf_tread(inode->i_sb,- udf_get_lb_pblock(inode->i_sb, nbloc, 0))))- {- udf_debug("reading block %d failed!\n",- udf_get_lb_pblock(inode->i_sb, nbloc, 0));- return -1;- }- }- else atomic_inc(&nbh->b_count);- atomic_inc(&nbh->b_count);+ atomic_inc(&nbh->b_count);+ } if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_SHORT) adsize = sizeof(short_ad);@@ -2094,7 +1994,7 @@ while ((etype = udf_next_aext(inode, &nbloc, &nextoffset, &eloc, &elen, &nbh, 1)) != -1) { udf_write_aext(inode, obloc, &oextoffset, eloc, (etype << 30) | elen, obh, 1);- if (memcmp(&nbloc, &obloc, sizeof(lb_addr)))+ if (obh != nbh) { obloc = nbloc; udf_release_data(obh);@@ -2106,12 +2006,12 @@ memset(&eloc, 0x00, sizeof(lb_addr)); elen = 0; - if (memcmp(&nbloc, &obloc, sizeof(lb_addr)))+ if (nbh != obh) { udf_free_blocks(inode->i_sb, inode, nbloc, 0, 1); udf_write_aext(inode, obloc, &oextoffset, eloc, elen, obh, 1); udf_write_aext(inode, obloc, &oextoffset, eloc, elen, obh, 1);- if (!memcmp(&UDF_I_LOCATION(inode), &obloc, sizeof(lb_addr)))+ if (!obh) { UDF_I_LENALLOC(inode) -= (adsize * 2); mark_inode_dirty(inode);@@ -2131,7 +2031,7 @@ else { udf_write_aext(inode, obloc, &oextoffset, eloc, elen, obh, 1);- if (!memcmp(&UDF_I_LOCATION(inode), &obloc, sizeof(lb_addr)))+ if (!obh) { UDF_I_LENALLOC(inode) -= adsize; mark_inode_dirty(inode);@@ -2206,9 +2106,7 @@ ret = 0; unlock_kernel();-- if (bh)- udf_release_data(bh);+ udf_release_data(bh); if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_VARCONV)) return udf_fixed_to_variable(ret);diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/fs/udf/lowlevel.c linuxmips-2.4.30/fs/udf/lowlevel.c--- linuxmips-2.4.30.ref/fs/udf/lowlevel.c 2002-06-26 15:36:23.000000000 -0700+++ linuxmips-2.4.30/fs/udf/lowlevel.c 2007-05-10 10:49:29.000000000 -0700@@ -71,20 +71,12 @@ udf_get_last_block(struct super_block *sb) { struct block_device *bdev = sb->s_bdev;- int ret; unsigned long lblock = 0; - ret = ioctl_by_bdev(bdev, CDROM_LAST_WRITTEN, (unsigned long) &lblock);+ if (ioctl_by_bdev(bdev, CDROM_LAST_WRITTEN, (unsigned long) &lblock))+ lblock = bdev->bd_inode->i_size >> sb->s_blocksize_bits; - if (ret) /* Hard Disk */- {- ret = ioctl_by_bdev(bdev, BLKGETSIZE, (unsigned long) &lblock);-- if (!ret && lblock != 0x7FFFFFFF)- lblock = ((512 * lblock) / sb->s_blocksize);- }-- if (!ret && lblock)+ if (lblock) return lblock - 1; else return 0;diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/fs/udf/misc.c linuxmips-2.4.30/fs/udf/misc.c--- linuxmips-2.4.30.ref/fs/udf/misc.c 2002-06-26 15:36:23.000000000 -0700+++ linuxmips-2.4.30/fs/udf/misc.c 2007-05-10 10:49:29.000000000 -0700@@ -16,7 +16,7 @@ * Each contributing author retains all rights to their own work. * * (C) 1998 Dave Boynton- * (C) 1998-2001 Ben Fennema+ * (C) 1998-2004 Ben Fennema * (C) 1999-2000 Stelias Computing Inc * * HISTORY@@ -33,19 +33,7 @@ #include "udf_i.h" #include "udf_sb.h" -uint32_t-udf64_low32(uint64_t indat)-{- return indat & 0x00000000FFFFFFFFULL;-}--uint32_t-udf64_high32(uint64_t indat)-{- return indat >> 32;-}--extern struct buffer_head *+struct buffer_head * udf_tgetblk(struct super_block *sb, int block) { if (UDF_QUERY_FLAG(sb, UDF_FLAG_VARCONV))@@ -54,7 +42,7 @@ return sb_getblk(sb, block); } -extern struct buffer_head *+struct buffer_head * udf_tread(struct super_block *sb, int block) { if (UDF_QUERY_FLAG(sb, UDF_FLAG_VARCONV))@@ -63,44 +51,26 @@ return sb_bread(sb, block); } -extern struct genericFormat *+struct genericFormat * udf_add_extendedattr(struct inode * inode, uint32_t size, uint32_t type,- uint8_t loc, struct buffer_head **bh)+ uint8_t loc) { uint8_t *ea = NULL, *ad = NULL;- long_ad eaicb; int offset;+ uint16_t crclen;+ int i; - *bh = udf_tread(inode->i_sb, inode->i_ino);-- if (UDF_I_EXTENDED_FE(inode) == 0)- {- struct fileEntry *fe;-- fe = (struct fileEntry *)(*bh)->b_data;- eaicb = lela_to_cpu(fe->extendedAttrICB);- offset = sizeof(struct fileEntry);- }- else- {- struct extendedFileEntry *efe;-- efe = (struct extendedFileEntry *)(*bh)->b_data;- eaicb = lel
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -