namei.c (7f3fbd08976f1d2562d6174d5fe4c85d12bb7d54) | namei.c (af793295bf9ee92660f5e77d337b0493cea3f9b9) |
---|---|
1/* 2 * namei.c 3 * 4 * PURPOSE 5 * Inode name handling routines for the OSTA-UDF(tm) filesystem. 6 * 7 * COPYRIGHT 8 * This file is distributed under the terms of the GNU General Public --- 146 unchanged lines hidden (view full) --- 155 uint16_t liu; 156 loff_t size; 157 kernel_lb_addr eloc; 158 uint32_t elen; 159 sector_t offset; 160 struct extent_position epos = {}; 161 struct udf_inode_info *dinfo = UDF_I(dir); 162 | 1/* 2 * namei.c 3 * 4 * PURPOSE 5 * Inode name handling routines for the OSTA-UDF(tm) filesystem. 6 * 7 * COPYRIGHT 8 * This file is distributed under the terms of the GNU General Public --- 146 unchanged lines hidden (view full) --- 155 uint16_t liu; 156 loff_t size; 157 kernel_lb_addr eloc; 158 uint32_t elen; 159 sector_t offset; 160 struct extent_position epos = {}; 161 struct udf_inode_info *dinfo = UDF_I(dir); 162 |
163 size = (udf_ext0_offset(dir) + dir->i_size) >> 2; 164 f_pos = (udf_ext0_offset(dir) >> 2); | 163 size = udf_ext0_offset(dir) + dir->i_size; 164 f_pos = udf_ext0_offset(dir); |
165 | 165 |
166 fibh->soffset = fibh->eoffset = 167 (f_pos & ((dir->i_sb->s_blocksize - 1) >> 2)) << 2; | 166 fibh->soffset = fibh->eoffset = f_pos & (dir->i_sb->s_blocksize - 1); |
168 if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) 169 fibh->sbh = fibh->ebh = NULL; | 167 if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) 168 fibh->sbh = fibh->ebh = NULL; |
170 else if (inode_bmap(dir, f_pos >> (dir->i_sb->s_blocksize_bits - 2), | 169 else if (inode_bmap(dir, f_pos >> dir->i_sb->s_blocksize_bits, |
171 &epos, &eloc, &elen, &offset) == 172 (EXT_RECORDED_ALLOCATED >> 30)) { 173 block = udf_get_lb_pblock(dir->i_sb, eloc, offset); 174 if ((++offset << dir->i_sb->s_blocksize_bits) < elen) { 175 if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT) 176 epos.offset -= sizeof(short_ad); 177 else if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_LONG) 178 epos.offset -= sizeof(long_ad); --- 5 unchanged lines hidden (view full) --- 184 brelse(epos.bh); 185 return NULL; 186 } 187 } else { 188 brelse(epos.bh); 189 return NULL; 190 } 191 | 170 &epos, &eloc, &elen, &offset) == 171 (EXT_RECORDED_ALLOCATED >> 30)) { 172 block = udf_get_lb_pblock(dir->i_sb, eloc, offset); 173 if ((++offset << dir->i_sb->s_blocksize_bits) < elen) { 174 if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT) 175 epos.offset -= sizeof(short_ad); 176 else if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_LONG) 177 epos.offset -= sizeof(long_ad); --- 5 unchanged lines hidden (view full) --- 183 brelse(epos.bh); 184 return NULL; 185 } 186 } else { 187 brelse(epos.bh); 188 return NULL; 189 } 190 |
192 while ((f_pos < size)) { | 191 while (f_pos < size) { |
193 fi = udf_fileident_read(dir, &f_pos, fibh, cfi, &epos, &eloc, 194 &elen, &offset); 195 if (!fi) { 196 if (fibh->sbh != fibh->ebh) 197 brelse(fibh->ebh); 198 brelse(fibh->sbh); 199 brelse(epos.bh); 200 return NULL; --- 136 unchanged lines hidden (view full) --- 337{ 338 struct super_block *sb = dir->i_sb; 339 struct fileIdentDesc *fi = NULL; 340 char name[UDF_NAME_LEN], fname[UDF_NAME_LEN]; 341 int namelen; 342 loff_t f_pos; 343 int flen; 344 char *nameptr; | 192 fi = udf_fileident_read(dir, &f_pos, fibh, cfi, &epos, &eloc, 193 &elen, &offset); 194 if (!fi) { 195 if (fibh->sbh != fibh->ebh) 196 brelse(fibh->ebh); 197 brelse(fibh->sbh); 198 brelse(epos.bh); 199 return NULL; --- 136 unchanged lines hidden (view full) --- 336{ 337 struct super_block *sb = dir->i_sb; 338 struct fileIdentDesc *fi = NULL; 339 char name[UDF_NAME_LEN], fname[UDF_NAME_LEN]; 340 int namelen; 341 loff_t f_pos; 342 int flen; 343 char *nameptr; |
345 loff_t size = (udf_ext0_offset(dir) + dir->i_size) >> 2; | 344 loff_t size = udf_ext0_offset(dir) + dir->i_size; |
346 int nfidlen; 347 uint8_t lfi; 348 uint16_t liu; 349 int block; 350 kernel_lb_addr eloc; 351 uint32_t elen; 352 sector_t offset; 353 struct extent_position epos = {}; --- 11 unchanged lines hidden (view full) --- 365 return NULL; 366 } 367 } else { 368 namelen = 0; 369 } 370 371 nfidlen = (sizeof(struct fileIdentDesc) + namelen + 3) & ~3; 372 | 345 int nfidlen; 346 uint8_t lfi; 347 uint16_t liu; 348 int block; 349 kernel_lb_addr eloc; 350 uint32_t elen; 351 sector_t offset; 352 struct extent_position epos = {}; --- 11 unchanged lines hidden (view full) --- 364 return NULL; 365 } 366 } else { 367 namelen = 0; 368 } 369 370 nfidlen = (sizeof(struct fileIdentDesc) + namelen + 3) & ~3; 371 |
373 f_pos = (udf_ext0_offset(dir) >> 2); | 372 f_pos = udf_ext0_offset(dir); |
374 | 373 |
375 fibh->soffset = fibh->eoffset = 376 (f_pos & ((dir->i_sb->s_blocksize - 1) >> 2)) << 2; | 374 fibh->soffset = fibh->eoffset = f_pos & (dir->i_sb->s_blocksize - 1); |
377 dinfo = UDF_I(dir); 378 if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) 379 fibh->sbh = fibh->ebh = NULL; | 375 dinfo = UDF_I(dir); 376 if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) 377 fibh->sbh = fibh->ebh = NULL; |
380 else if (inode_bmap(dir, f_pos >> (dir->i_sb->s_blocksize_bits - 2), | 378 else if (inode_bmap(dir, f_pos >> dir->i_sb->s_blocksize_bits, |
381 &epos, &eloc, &elen, &offset) == 382 (EXT_RECORDED_ALLOCATED >> 30)) { 383 block = udf_get_lb_pblock(dir->i_sb, eloc, offset); 384 if ((++offset << dir->i_sb->s_blocksize_bits) < elen) { 385 if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT) 386 epos.offset -= sizeof(short_ad); 387 else if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_LONG) 388 epos.offset -= sizeof(long_ad); --- 11 unchanged lines hidden (view full) --- 400 401 } else { 402 block = udf_get_lb_pblock(dir->i_sb, dinfo->i_location, 0); 403 fibh->sbh = fibh->ebh = NULL; 404 fibh->soffset = fibh->eoffset = sb->s_blocksize; 405 goto add; 406 } 407 | 379 &epos, &eloc, &elen, &offset) == 380 (EXT_RECORDED_ALLOCATED >> 30)) { 381 block = udf_get_lb_pblock(dir->i_sb, eloc, offset); 382 if ((++offset << dir->i_sb->s_blocksize_bits) < elen) { 383 if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT) 384 epos.offset -= sizeof(short_ad); 385 else if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_LONG) 386 epos.offset -= sizeof(long_ad); --- 11 unchanged lines hidden (view full) --- 398 399 } else { 400 block = udf_get_lb_pblock(dir->i_sb, dinfo->i_location, 0); 401 fibh->sbh = fibh->ebh = NULL; 402 fibh->soffset = fibh->eoffset = sb->s_blocksize; 403 goto add; 404 } 405 |
408 while ((f_pos < size)) { | 406 while (f_pos < size) { |
409 fi = udf_fileident_read(dir, &f_pos, fibh, cfi, &epos, &eloc, 410 &elen, &offset); 411 412 if (!fi) { 413 if (fibh->sbh != fibh->ebh) 414 brelse(fibh->ebh); 415 brelse(fibh->sbh); 416 brelse(epos.bh); --- 62 unchanged lines hidden (view full) --- 479 f_pos += nfidlen; 480 481 if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB && 482 sb->s_blocksize - fibh->eoffset < nfidlen) { 483 brelse(epos.bh); 484 epos.bh = NULL; 485 fibh->soffset -= udf_ext0_offset(dir); 486 fibh->eoffset -= udf_ext0_offset(dir); | 407 fi = udf_fileident_read(dir, &f_pos, fibh, cfi, &epos, &eloc, 408 &elen, &offset); 409 410 if (!fi) { 411 if (fibh->sbh != fibh->ebh) 412 brelse(fibh->ebh); 413 brelse(fibh->sbh); 414 brelse(epos.bh); --- 62 unchanged lines hidden (view full) --- 477 f_pos += nfidlen; 478 479 if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB && 480 sb->s_blocksize - fibh->eoffset < nfidlen) { 481 brelse(epos.bh); 482 epos.bh = NULL; 483 fibh->soffset -= udf_ext0_offset(dir); 484 fibh->eoffset -= udf_ext0_offset(dir); |
487 f_pos -= (udf_ext0_offset(dir) >> 2); | 485 f_pos -= udf_ext0_offset(dir); |
488 if (fibh->sbh != fibh->ebh) 489 brelse(fibh->ebh); 490 brelse(fibh->sbh); 491 fibh->sbh = fibh->ebh = 492 udf_expand_dir_adinicb(dir, &block, err); 493 if (!fibh->sbh) 494 return NULL; 495 epos.block = dinfo->i_location; --- 36 unchanged lines hidden (view full) --- 532 if (fibh->sbh != fibh->ebh) { 533 brelse(fibh->sbh); 534 fibh->sbh = fibh->ebh; 535 } 536 537 block = eloc.logicalBlockNum + ((elen - 1) >> 538 dir->i_sb->s_blocksize_bits); 539 fibh->ebh = udf_bread(dir, | 486 if (fibh->sbh != fibh->ebh) 487 brelse(fibh->ebh); 488 brelse(fibh->sbh); 489 fibh->sbh = fibh->ebh = 490 udf_expand_dir_adinicb(dir, &block, err); 491 if (!fibh->sbh) 492 return NULL; 493 epos.block = dinfo->i_location; --- 36 unchanged lines hidden (view full) --- 530 if (fibh->sbh != fibh->ebh) { 531 brelse(fibh->sbh); 532 fibh->sbh = fibh->ebh; 533 } 534 535 block = eloc.logicalBlockNum + ((elen - 1) >> 536 dir->i_sb->s_blocksize_bits); 537 fibh->ebh = udf_bread(dir, |
540 f_pos >> (dir->i_sb->s_blocksize_bits - 2), 541 1, err); | 538 f_pos >> dir->i_sb->s_blocksize_bits, 1, err); |
542 if (!fibh->ebh) { 543 brelse(epos.bh); 544 brelse(fibh->sbh); 545 return NULL; 546 } 547 548 if (!fibh->soffset) { 549 if (udf_next_aext(dir, &epos, &eloc, &elen, 1) == --- 220 unchanged lines hidden (view full) --- 770 return err; 771} 772 773static int empty_dir(struct inode *dir) 774{ 775 struct fileIdentDesc *fi, cfi; 776 struct udf_fileident_bh fibh; 777 loff_t f_pos; | 539 if (!fibh->ebh) { 540 brelse(epos.bh); 541 brelse(fibh->sbh); 542 return NULL; 543 } 544 545 if (!fibh->soffset) { 546 if (udf_next_aext(dir, &epos, &eloc, &elen, 1) == --- 220 unchanged lines hidden (view full) --- 767 return err; 768} 769 770static int empty_dir(struct inode *dir) 771{ 772 struct fileIdentDesc *fi, cfi; 773 struct udf_fileident_bh fibh; 774 loff_t f_pos; |
778 loff_t size = (udf_ext0_offset(dir) + dir->i_size) >> 2; | 775 loff_t size = udf_ext0_offset(dir) + dir->i_size; |
779 int block; 780 kernel_lb_addr eloc; 781 uint32_t elen; 782 sector_t offset; 783 struct extent_position epos = {}; 784 struct udf_inode_info *dinfo = UDF_I(dir); 785 | 776 int block; 777 kernel_lb_addr eloc; 778 uint32_t elen; 779 sector_t offset; 780 struct extent_position epos = {}; 781 struct udf_inode_info *dinfo = UDF_I(dir); 782 |
786 f_pos = (udf_ext0_offset(dir) >> 2); | 783 f_pos = udf_ext0_offset(dir); 784 fibh.soffset = fibh.eoffset = f_pos & (dir->i_sb->s_blocksize - 1); |
787 | 785 |
788 fibh.soffset = fibh.eoffset = 789 (f_pos & ((dir->i_sb->s_blocksize - 1) >> 2)) << 2; 790 | |
791 if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) 792 fibh.sbh = fibh.ebh = NULL; | 786 if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) 787 fibh.sbh = fibh.ebh = NULL; |
793 else if (inode_bmap(dir, f_pos >> (dir->i_sb->s_blocksize_bits - 2), | 788 else if (inode_bmap(dir, f_pos >> dir->i_sb->s_blocksize_bits, |
794 &epos, &eloc, &elen, &offset) == 795 (EXT_RECORDED_ALLOCATED >> 30)) { 796 block = udf_get_lb_pblock(dir->i_sb, eloc, offset); 797 if ((++offset << dir->i_sb->s_blocksize_bits) < elen) { 798 if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT) 799 epos.offset -= sizeof(short_ad); 800 else if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_LONG) 801 epos.offset -= sizeof(long_ad); --- 5 unchanged lines hidden (view full) --- 807 brelse(epos.bh); 808 return 0; 809 } 810 } else { 811 brelse(epos.bh); 812 return 0; 813 } 814 | 789 &epos, &eloc, &elen, &offset) == 790 (EXT_RECORDED_ALLOCATED >> 30)) { 791 block = udf_get_lb_pblock(dir->i_sb, eloc, offset); 792 if ((++offset << dir->i_sb->s_blocksize_bits) < elen) { 793 if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT) 794 epos.offset -= sizeof(short_ad); 795 else if (dinfo->i_alloc_type == ICBTAG_FLAG_AD_LONG) 796 epos.offset -= sizeof(long_ad); --- 5 unchanged lines hidden (view full) --- 802 brelse(epos.bh); 803 return 0; 804 } 805 } else { 806 brelse(epos.bh); 807 return 0; 808 } 809 |
815 while ((f_pos < size)) { | 810 while (f_pos < size) { |
816 fi = udf_fileident_read(dir, &f_pos, &fibh, &cfi, &epos, &eloc, 817 &elen, &offset); 818 if (!fi) { 819 if (fibh.sbh != fibh.ebh) 820 brelse(fibh.ebh); 821 brelse(fibh.sbh); 822 brelse(epos.bh); 823 return 0; --- 492 unchanged lines hidden --- | 811 fi = udf_fileident_read(dir, &f_pos, &fibh, &cfi, &epos, &eloc, 812 &elen, &offset); 813 if (!fi) { 814 if (fibh.sbh != fibh.ebh) 815 brelse(fibh.ebh); 816 brelse(fibh.sbh); 817 brelse(epos.bh); 818 return 0; --- 492 unchanged lines hidden --- |