diff options
author | Marcin Slusarz <marcin.slusarz@gmail.com> | 2008-02-08 07:20:42 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-08 12:22:35 -0500 |
commit | c0b344385fa05f6bea462e707fcba89f9e2776c2 (patch) | |
tree | 391376739ffb0b5c9dfcf294c9f746d7ff2daf66 /fs/udf/inode.c | |
parent | 5e0f001736651f6f859aeca95f895c829d223cdb (diff) |
udf: remove UDF_I_* macros and open code them
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Acked-by: Jan Kara <jack@suse.cz>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/udf/inode.c')
-rw-r--r-- | fs/udf/inode.c | 296 |
1 files changed, 151 insertions, 145 deletions
diff --git a/fs/udf/inode.c b/fs/udf/inode.c index 487bdb7dc835..f746b9f1c03c 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c | |||
@@ -120,8 +120,8 @@ void udf_clear_inode(struct inode *inode) | |||
120 | unlock_kernel(); | 120 | unlock_kernel(); |
121 | write_inode_now(inode, 1); | 121 | write_inode_now(inode, 1); |
122 | } | 122 | } |
123 | kfree(UDF_I_DATA(inode)); | 123 | kfree(UDF_I(inode)->i_ext.i_data); |
124 | UDF_I_DATA(inode) = NULL; | 124 | UDF_I(inode)->i_ext.i_data = NULL; |
125 | } | 125 | } |
126 | 126 | ||
127 | static int udf_writepage(struct page *page, struct writeback_control *wbc) | 127 | static int udf_writepage(struct page *page, struct writeback_control *wbc) |
@@ -169,11 +169,11 @@ void udf_expand_file_adinicb(struct inode *inode, int newsize, int *err) | |||
169 | /* from now on we have normal address_space methods */ | 169 | /* from now on we have normal address_space methods */ |
170 | inode->i_data.a_ops = &udf_aops; | 170 | inode->i_data.a_ops = &udf_aops; |
171 | 171 | ||
172 | if (!UDF_I_LENALLOC(inode)) { | 172 | if (!UDF_I(inode)->i_lenAlloc) { |
173 | if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD)) | 173 | if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD)) |
174 | UDF_I_ALLOCTYPE(inode) = ICBTAG_FLAG_AD_SHORT; | 174 | UDF_I(inode)->i_alloc_type = ICBTAG_FLAG_AD_SHORT; |
175 | else | 175 | else |
176 | UDF_I_ALLOCTYPE(inode) = ICBTAG_FLAG_AD_LONG; | 176 | UDF_I(inode)->i_alloc_type = ICBTAG_FLAG_AD_LONG; |
177 | mark_inode_dirty(inode); | 177 | mark_inode_dirty(inode); |
178 | return; | 178 | return; |
179 | } | 179 | } |
@@ -183,21 +183,21 @@ void udf_expand_file_adinicb(struct inode *inode, int newsize, int *err) | |||
183 | 183 | ||
184 | if (!PageUptodate(page)) { | 184 | if (!PageUptodate(page)) { |
185 | kaddr = kmap(page); | 185 | kaddr = kmap(page); |
186 | memset(kaddr + UDF_I_LENALLOC(inode), 0x00, | 186 | memset(kaddr + UDF_I(inode)->i_lenAlloc, 0x00, |
187 | PAGE_CACHE_SIZE - UDF_I_LENALLOC(inode)); | 187 | PAGE_CACHE_SIZE - UDF_I(inode)->i_lenAlloc); |
188 | memcpy(kaddr, UDF_I_DATA(inode) + UDF_I_LENEATTR(inode), | 188 | memcpy(kaddr, UDF_I(inode)->i_ext.i_data + |
189 | UDF_I_LENALLOC(inode)); | 189 | UDF_I(inode)->i_lenEAttr, UDF_I(inode)->i_lenAlloc); |
190 | flush_dcache_page(page); | 190 | flush_dcache_page(page); |
191 | SetPageUptodate(page); | 191 | SetPageUptodate(page); |
192 | kunmap(page); | 192 | kunmap(page); |
193 | } | 193 | } |
194 | memset(UDF_I_DATA(inode) + UDF_I_LENEATTR(inode), 0x00, | 194 | memset(UDF_I(inode)->i_ext.i_data + UDF_I(inode)->i_lenEAttr, 0x00, |
195 | UDF_I_LENALLOC(inode)); | 195 | UDF_I(inode)->i_lenAlloc); |
196 | UDF_I_LENALLOC(inode) = 0; | 196 | UDF_I(inode)->i_lenAlloc = 0; |
197 | if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD)) | 197 | if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD)) |
198 | UDF_I_ALLOCTYPE(inode) = ICBTAG_FLAG_AD_SHORT; | 198 | UDF_I(inode)->i_alloc_type = ICBTAG_FLAG_AD_SHORT; |
199 | else | 199 | else |
200 | UDF_I_ALLOCTYPE(inode) = ICBTAG_FLAG_AD_LONG; | 200 | UDF_I(inode)->i_alloc_type = ICBTAG_FLAG_AD_LONG; |
201 | 201 | ||
202 | inode->i_data.a_ops->writepage(page, &udf_wbc); | 202 | inode->i_data.a_ops->writepage(page, &udf_wbc); |
203 | page_cache_release(page); | 203 | page_cache_release(page); |
@@ -226,20 +226,20 @@ struct buffer_head *udf_expand_dir_adinicb(struct inode *inode, int *block, | |||
226 | alloctype = ICBTAG_FLAG_AD_LONG; | 226 | alloctype = ICBTAG_FLAG_AD_LONG; |
227 | 227 | ||
228 | if (!inode->i_size) { | 228 | if (!inode->i_size) { |
229 | UDF_I_ALLOCTYPE(inode) = alloctype; | 229 | UDF_I(inode)->i_alloc_type = alloctype; |
230 | mark_inode_dirty(inode); | 230 | mark_inode_dirty(inode); |
231 | return NULL; | 231 | return NULL; |
232 | } | 232 | } |
233 | 233 | ||
234 | /* alloc block, and copy data to it */ | 234 | /* alloc block, and copy data to it */ |
235 | *block = udf_new_block(inode->i_sb, inode, | 235 | *block = udf_new_block(inode->i_sb, inode, |
236 | UDF_I_LOCATION(inode).partitionReferenceNum, | 236 | UDF_I(inode)->i_location.partitionReferenceNum, |
237 | UDF_I_LOCATION(inode).logicalBlockNum, err); | 237 | UDF_I(inode)->i_location.logicalBlockNum, err); |
238 | if (!(*block)) | 238 | if (!(*block)) |
239 | return NULL; | 239 | return NULL; |
240 | newblock = udf_get_pblock(inode->i_sb, *block, | 240 | newblock = udf_get_pblock(inode->i_sb, *block, |
241 | UDF_I_LOCATION(inode).partitionReferenceNum, | 241 | UDF_I(inode)->i_location.partitionReferenceNum, |
242 | 0); | 242 | 0); |
243 | if (!newblock) | 243 | if (!newblock) |
244 | return NULL; | 244 | return NULL; |
245 | dbh = udf_tgetblk(inode->i_sb, newblock); | 245 | dbh = udf_tgetblk(inode->i_sb, newblock); |
@@ -257,14 +257,14 @@ struct buffer_head *udf_expand_dir_adinicb(struct inode *inode, int *block, | |||
257 | dfibh.soffset = dfibh.eoffset = 0; | 257 | dfibh.soffset = dfibh.eoffset = 0; |
258 | dfibh.sbh = dfibh.ebh = dbh; | 258 | dfibh.sbh = dfibh.ebh = dbh; |
259 | while ((f_pos < size)) { | 259 | while ((f_pos < size)) { |
260 | UDF_I_ALLOCTYPE(inode) = ICBTAG_FLAG_AD_IN_ICB; | 260 | UDF_I(inode)->i_alloc_type = ICBTAG_FLAG_AD_IN_ICB; |
261 | sfi = udf_fileident_read(inode, &f_pos, &sfibh, &cfi, NULL, | 261 | sfi = udf_fileident_read(inode, &f_pos, &sfibh, &cfi, NULL, |
262 | NULL, NULL, NULL); | 262 | NULL, NULL, NULL); |
263 | if (!sfi) { | 263 | if (!sfi) { |
264 | brelse(dbh); | 264 | brelse(dbh); |
265 | return NULL; | 265 | return NULL; |
266 | } | 266 | } |
267 | UDF_I_ALLOCTYPE(inode) = alloctype; | 267 | UDF_I(inode)->i_alloc_type = alloctype; |
268 | sfi->descTag.tagLocation = cpu_to_le32(*block); | 268 | sfi->descTag.tagLocation = cpu_to_le32(*block); |
269 | dfibh.soffset = dfibh.eoffset; | 269 | dfibh.soffset = dfibh.eoffset; |
270 | dfibh.eoffset += (sfibh.eoffset - sfibh.soffset); | 270 | dfibh.eoffset += (sfibh.eoffset - sfibh.soffset); |
@@ -272,23 +272,23 @@ struct buffer_head *udf_expand_dir_adinicb(struct inode *inode, int *block, | |||
272 | if (udf_write_fi(inode, sfi, dfi, &dfibh, sfi->impUse, | 272 | if (udf_write_fi(inode, sfi, dfi, &dfibh, sfi->impUse, |
273 | sfi->fileIdent + | 273 | sfi->fileIdent + |
274 | le16_to_cpu(sfi->lengthOfImpUse))) { | 274 | le16_to_cpu(sfi->lengthOfImpUse))) { |
275 | UDF_I_ALLOCTYPE(inode) = ICBTAG_FLAG_AD_IN_ICB; | 275 | UDF_I(inode)->i_alloc_type = ICBTAG_FLAG_AD_IN_ICB; |
276 | brelse(dbh); | 276 | brelse(dbh); |
277 | return NULL; | 277 | return NULL; |
278 | } | 278 | } |
279 | } | 279 | } |
280 | mark_buffer_dirty_inode(dbh, inode); | 280 | mark_buffer_dirty_inode(dbh, inode); |
281 | 281 | ||
282 | memset(UDF_I_DATA(inode) + UDF_I_LENEATTR(inode), 0, | 282 | memset(UDF_I(inode)->i_ext.i_data + UDF_I(inode)->i_lenEAttr, 0, |
283 | UDF_I_LENALLOC(inode)); | 283 | UDF_I(inode)->i_lenAlloc); |
284 | UDF_I_LENALLOC(inode) = 0; | 284 | UDF_I(inode)->i_lenAlloc = 0; |
285 | eloc.logicalBlockNum = *block; | 285 | eloc.logicalBlockNum = *block; |
286 | eloc.partitionReferenceNum = | 286 | eloc.partitionReferenceNum = |
287 | UDF_I_LOCATION(inode).partitionReferenceNum; | 287 | UDF_I(inode)->i_location.partitionReferenceNum; |
288 | elen = inode->i_size; | 288 | elen = inode->i_size; |
289 | UDF_I_LENEXTENTS(inode) = elen; | 289 | UDF_I(inode)->i_lenExtents = elen; |
290 | epos.bh = NULL; | 290 | epos.bh = NULL; |
291 | epos.block = UDF_I_LOCATION(inode); | 291 | epos.block = UDF_I(inode)->i_location; |
292 | epos.offset = udf_file_entry_alloc_offset(inode); | 292 | epos.offset = udf_file_entry_alloc_offset(inode); |
293 | udf_add_aext(inode, &epos, eloc, elen, 0); | 293 | udf_add_aext(inode, &epos, eloc, elen, 0); |
294 | /* UniqueID stuff */ | 294 | /* UniqueID stuff */ |
@@ -321,9 +321,9 @@ static int udf_get_block(struct inode *inode, sector_t block, | |||
321 | if (block < 0) | 321 | if (block < 0) |
322 | goto abort_negative; | 322 | goto abort_negative; |
323 | 323 | ||
324 | if (block == UDF_I_NEXT_ALLOC_BLOCK(inode) + 1) { | 324 | if (block == UDF_I(inode)->i_next_alloc_block + 1) { |
325 | UDF_I_NEXT_ALLOC_BLOCK(inode)++; | 325 | UDF_I(inode)->i_next_alloc_block++; |
326 | UDF_I_NEXT_ALLOC_GOAL(inode)++; | 326 | UDF_I(inode)->i_next_alloc_goal++; |
327 | } | 327 | } |
328 | 328 | ||
329 | err = 0; | 329 | err = 0; |
@@ -392,8 +392,8 @@ int udf_extend_file(struct inode *inode, struct extent_position *last_pos, | |||
392 | (last_ext->extLength & UDF_EXTENT_FLAG_MASK) | | 392 | (last_ext->extLength & UDF_EXTENT_FLAG_MASK) | |
393 | (((last_ext->extLength & UDF_EXTENT_LENGTH_MASK) + | 393 | (((last_ext->extLength & UDF_EXTENT_LENGTH_MASK) + |
394 | sb->s_blocksize - 1) & ~(sb->s_blocksize - 1)); | 394 | sb->s_blocksize - 1) & ~(sb->s_blocksize - 1)); |
395 | UDF_I_LENEXTENTS(inode) = | 395 | UDF_I(inode)->i_lenExtents = |
396 | (UDF_I_LENEXTENTS(inode) + sb->s_blocksize - 1) & | 396 | (UDF_I(inode)->i_lenExtents + sb->s_blocksize - 1) & |
397 | ~(sb->s_blocksize - 1); | 397 | ~(sb->s_blocksize - 1); |
398 | } | 398 | } |
399 | 399 | ||
@@ -470,9 +470,9 @@ out: | |||
470 | } | 470 | } |
471 | 471 | ||
472 | /* last_pos should point to the last written extent... */ | 472 | /* last_pos should point to the last written extent... */ |
473 | if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_SHORT) | 473 | if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_SHORT) |
474 | last_pos->offset -= sizeof(short_ad); | 474 | last_pos->offset -= sizeof(short_ad); |
475 | else if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_LONG) | 475 | else if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_LONG) |
476 | last_pos->offset -= sizeof(long_ad); | 476 | last_pos->offset -= sizeof(long_ad); |
477 | else | 477 | else |
478 | return -1; | 478 | return -1; |
@@ -495,11 +495,11 @@ static struct buffer_head *inode_getblk(struct inode *inode, sector_t block, | |||
495 | uint32_t newblocknum, newblock; | 495 | uint32_t newblocknum, newblock; |
496 | sector_t offset = 0; | 496 | sector_t offset = 0; |
497 | int8_t etype; | 497 | int8_t etype; |
498 | int goal = 0, pgoal = UDF_I_LOCATION(inode).logicalBlockNum; | 498 | int goal = 0, pgoal = UDF_I(inode)->i_location.logicalBlockNum; |
499 | int lastblock = 0; | 499 | int lastblock = 0; |
500 | 500 | ||
501 | prev_epos.offset = udf_file_entry_alloc_offset(inode); | 501 | prev_epos.offset = udf_file_entry_alloc_offset(inode); |
502 | prev_epos.block = UDF_I_LOCATION(inode); | 502 | prev_epos.block = UDF_I(inode)->i_location; |
503 | prev_epos.bh = NULL; | 503 | prev_epos.bh = NULL; |
504 | cur_epos = next_epos = prev_epos; | 504 | cur_epos = next_epos = prev_epos; |
505 | b_off = (loff_t)block << inode->i_sb->s_blocksize_bits; | 505 | b_off = (loff_t)block << inode->i_sb->s_blocksize_bits; |
@@ -649,23 +649,24 @@ static struct buffer_head *inode_getblk(struct inode *inode, sector_t block, | |||
649 | if ((laarr[c].extLength >> 30) == (EXT_NOT_RECORDED_ALLOCATED >> 30)) | 649 | if ((laarr[c].extLength >> 30) == (EXT_NOT_RECORDED_ALLOCATED >> 30)) |
650 | newblocknum = laarr[c].extLocation.logicalBlockNum + offset; | 650 | newblocknum = laarr[c].extLocation.logicalBlockNum + offset; |
651 | else { /* otherwise, allocate a new block */ | 651 | else { /* otherwise, allocate a new block */ |
652 | if (UDF_I_NEXT_ALLOC_BLOCK(inode) == block) | 652 | if (UDF_I(inode)->i_next_alloc_block == block) |
653 | goal = UDF_I_NEXT_ALLOC_GOAL(inode); | 653 | goal = UDF_I(inode)->i_next_alloc_goal; |
654 | 654 | ||
655 | if (!goal) { | 655 | if (!goal) { |
656 | if (!(goal = pgoal)) /* XXX: what was intended here? */ | 656 | if (!(goal = pgoal)) /* XXX: what was intended here? */ |
657 | goal = UDF_I_LOCATION(inode).logicalBlockNum+1; | 657 | goal = UDF_I(inode)-> |
658 | i_location.logicalBlockNum + 1; | ||
658 | } | 659 | } |
659 | 660 | ||
660 | newblocknum = udf_new_block(inode->i_sb, inode, | 661 | newblocknum = udf_new_block(inode->i_sb, inode, |
661 | UDF_I_LOCATION(inode).partitionReferenceNum, | 662 | UDF_I(inode)->i_location.partitionReferenceNum, |
662 | goal, err); | 663 | goal, err); |
663 | if (!newblocknum) { | 664 | if (!newblocknum) { |
664 | brelse(prev_epos.bh); | 665 | brelse(prev_epos.bh); |
665 | *err = -ENOSPC; | 666 | *err = -ENOSPC; |
666 | return NULL; | 667 | return NULL; |
667 | } | 668 | } |
668 | UDF_I_LENEXTENTS(inode) += inode->i_sb->s_blocksize; | 669 | UDF_I(inode)->i_lenExtents += inode->i_sb->s_blocksize; |
669 | } | 670 | } |
670 | 671 | ||
671 | /* if the extent the requsted block is located in contains multiple | 672 | /* if the extent the requsted block is located in contains multiple |
@@ -690,14 +691,14 @@ static struct buffer_head *inode_getblk(struct inode *inode, sector_t block, | |||
690 | brelse(prev_epos.bh); | 691 | brelse(prev_epos.bh); |
691 | 692 | ||
692 | newblock = udf_get_pblock(inode->i_sb, newblocknum, | 693 | newblock = udf_get_pblock(inode->i_sb, newblocknum, |
693 | UDF_I_LOCATION(inode).partitionReferenceNum, 0); | 694 | UDF_I(inode)->i_location.partitionReferenceNum, 0); |
694 | if (!newblock) | 695 | if (!newblock) |
695 | return NULL; | 696 | return NULL; |
696 | *phys = newblock; | 697 | *phys = newblock; |
697 | *err = 0; | 698 | *err = 0; |
698 | *new = 1; | 699 | *new = 1; |
699 | UDF_I_NEXT_ALLOC_BLOCK(inode) = block; | 700 | UDF_I(inode)->i_next_alloc_block = block; |
700 | UDF_I_NEXT_ALLOC_GOAL(inode) = newblocknum; | 701 | UDF_I(inode)->i_next_alloc_goal = newblocknum; |
701 | inode->i_ctime = current_fs_time(inode->i_sb); | 702 | inode->i_ctime = current_fs_time(inode->i_sb); |
702 | 703 | ||
703 | if (IS_SYNC(inode)) | 704 | if (IS_SYNC(inode)) |
@@ -756,7 +757,7 @@ static void udf_split_extents(struct inode *inode, int *c, int offset, | |||
756 | laarr[curr].extLocation.logicalBlockNum = newblocknum; | 757 | laarr[curr].extLocation.logicalBlockNum = newblocknum; |
757 | if (etype == (EXT_NOT_RECORDED_NOT_ALLOCATED >> 30)) | 758 | if (etype == (EXT_NOT_RECORDED_NOT_ALLOCATED >> 30)) |
758 | laarr[curr].extLocation.partitionReferenceNum = | 759 | laarr[curr].extLocation.partitionReferenceNum = |
759 | UDF_I_LOCATION(inode).partitionReferenceNum; | 760 | UDF_I(inode)->i_location.partitionReferenceNum; |
760 | laarr[curr].extLength = EXT_RECORDED_ALLOCATED | | 761 | laarr[curr].extLength = EXT_RECORDED_ALLOCATED | |
761 | blocksize; | 762 | blocksize; |
762 | curr++; | 763 | curr++; |
@@ -863,7 +864,7 @@ static void udf_prealloc_extents(struct inode *inode, int c, int lastblock, | |||
863 | (*endnum)--; | 864 | (*endnum)--; |
864 | } | 865 | } |
865 | } | 866 | } |
866 | UDF_I_LENEXTENTS(inode) += | 867 | UDF_I(inode)->i_lenExtents += |
867 | numalloc << inode->i_sb->s_blocksize_bits; | 868 | numalloc << inode->i_sb->s_blocksize_bits; |
868 | } | 869 | } |
869 | } | 870 | } |
@@ -1034,23 +1035,25 @@ void udf_truncate(struct inode *inode) | |||
1034 | return; | 1035 | return; |
1035 | 1036 | ||
1036 | lock_kernel(); | 1037 | lock_kernel(); |
1037 | if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_IN_ICB) { | 1038 | if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) { |
1038 | if (inode->i_sb->s_blocksize < | 1039 | if (inode->i_sb->s_blocksize < |
1039 | (udf_file_entry_alloc_offset(inode) + | 1040 | (udf_file_entry_alloc_offset(inode) + |
1040 | inode->i_size)) { | 1041 | inode->i_size)) { |
1041 | udf_expand_file_adinicb(inode, inode->i_size, &err); | 1042 | udf_expand_file_adinicb(inode, inode->i_size, &err); |
1042 | if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_IN_ICB) { | 1043 | if (UDF_I(inode)->i_alloc_type == |
1043 | inode->i_size = UDF_I_LENALLOC(inode); | 1044 | ICBTAG_FLAG_AD_IN_ICB) { |
1045 | inode->i_size = UDF_I(inode)->i_lenAlloc; | ||
1044 | unlock_kernel(); | 1046 | unlock_kernel(); |
1045 | return; | 1047 | return; |
1046 | } else | 1048 | } else |
1047 | udf_truncate_extents(inode); | 1049 | udf_truncate_extents(inode); |
1048 | } else { | 1050 | } else { |
1049 | offset = inode->i_size & (inode->i_sb->s_blocksize - 1); | 1051 | offset = inode->i_size & (inode->i_sb->s_blocksize - 1); |
1050 | memset(UDF_I_DATA(inode) + UDF_I_LENEATTR(inode) + | 1052 | memset(UDF_I(inode)->i_ext.i_data + |
1051 | offset, 0x00, inode->i_sb->s_blocksize - | 1053 | UDF_I(inode)->i_lenEAttr + offset, |
1054 | 0x00, inode->i_sb->s_blocksize - | ||
1052 | offset - udf_file_entry_alloc_offset(inode)); | 1055 | offset - udf_file_entry_alloc_offset(inode)); |
1053 | UDF_I_LENALLOC(inode) = inode->i_size; | 1056 | UDF_I(inode)->i_lenAlloc = inode->i_size; |
1054 | } | 1057 | } |
1055 | } else { | 1058 | } else { |
1056 | block_truncate_page(inode->i_mapping, inode->i_size, | 1059 | block_truncate_page(inode->i_mapping, inode->i_size, |
@@ -1084,7 +1087,7 @@ static void __udf_read_inode(struct inode *inode) | |||
1084 | * i_nlink = 1 | 1087 | * i_nlink = 1 |
1085 | * i_op = NULL; | 1088 | * i_op = NULL; |
1086 | */ | 1089 | */ |
1087 | bh = udf_read_ptagged(inode->i_sb, UDF_I_LOCATION(inode), 0, &ident); | 1090 | bh = udf_read_ptagged(inode->i_sb, UDF_I(inode)->i_location, 0, &ident); |
1088 | if (!bh) { | 1091 | if (!bh) { |
1089 | printk(KERN_ERR "udf: udf_read_inode(ino %ld) failed !bh\n", | 1092 | printk(KERN_ERR "udf: udf_read_inode(ino %ld) failed !bh\n", |
1090 | inode->i_ino); | 1093 | inode->i_ino); |
@@ -1107,7 +1110,7 @@ static void __udf_read_inode(struct inode *inode) | |||
1107 | struct buffer_head *ibh = NULL, *nbh = NULL; | 1110 | struct buffer_head *ibh = NULL, *nbh = NULL; |
1108 | struct indirectEntry *ie; | 1111 | struct indirectEntry *ie; |
1109 | 1112 | ||
1110 | ibh = udf_read_ptagged(inode->i_sb, UDF_I_LOCATION(inode), 1, | 1113 | ibh = udf_read_ptagged(inode->i_sb, UDF_I(inode)->i_location, 1, |
1111 | &ident); | 1114 | &ident); |
1112 | if (ident == TAG_IDENT_IE) { | 1115 | if (ident == TAG_IDENT_IE) { |
1113 | if (ibh) { | 1116 | if (ibh) { |
@@ -1121,7 +1124,7 @@ static void __udf_read_inode(struct inode *inode) | |||
1121 | &ident))) { | 1124 | &ident))) { |
1122 | if (ident == TAG_IDENT_FE || | 1125 | if (ident == TAG_IDENT_FE || |
1123 | ident == TAG_IDENT_EFE) { | 1126 | ident == TAG_IDENT_EFE) { |
1124 | memcpy(&UDF_I_LOCATION(inode), | 1127 | memcpy(&UDF_I(inode)->i_location, |
1125 | &loc, | 1128 | &loc, |
1126 | sizeof(kernel_lb_addr)); | 1129 | sizeof(kernel_lb_addr)); |
1127 | brelse(bh); | 1130 | brelse(bh); |
@@ -1165,44 +1168,45 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) | |||
1165 | efe = (struct extendedFileEntry *)bh->b_data; | 1168 | efe = (struct extendedFileEntry *)bh->b_data; |
1166 | 1169 | ||
1167 | if (fe->icbTag.strategyType == cpu_to_le16(4)) | 1170 | if (fe->icbTag.strategyType == cpu_to_le16(4)) |
1168 | UDF_I_STRAT4096(inode) = 0; | 1171 | UDF_I(inode)->i_strat4096 = 0; |
1169 | else /* if (fe->icbTag.strategyType == cpu_to_le16(4096)) */ | 1172 | else /* if (fe->icbTag.strategyType == cpu_to_le16(4096)) */ |
1170 | UDF_I_STRAT4096(inode) = 1; | 1173 | UDF_I(inode)->i_strat4096 = 1; |
1171 | 1174 | ||
1172 | UDF_I_ALLOCTYPE(inode) = le16_to_cpu(fe->icbTag.flags) & | 1175 | UDF_I(inode)->i_alloc_type = le16_to_cpu(fe->icbTag.flags) & |
1173 | ICBTAG_FLAG_AD_MASK; | 1176 | ICBTAG_FLAG_AD_MASK; |
1174 | UDF_I_UNIQUE(inode) = 0; | 1177 | UDF_I(inode)->i_unique = 0; |
1175 | UDF_I_LENEATTR(inode) = 0; | 1178 | UDF_I(inode)->i_lenEAttr = 0; |
1176 | UDF_I_LENEXTENTS(inode) = 0; | 1179 | UDF_I(inode)->i_lenExtents = 0; |
1177 | UDF_I_LENALLOC(inode) = 0; | 1180 | UDF_I(inode)->i_lenAlloc = 0; |
1178 | UDF_I_NEXT_ALLOC_BLOCK(inode) = 0; | 1181 | UDF_I(inode)->i_next_alloc_block = 0; |
1179 | UDF_I_NEXT_ALLOC_GOAL(inode) = 0; | 1182 | UDF_I(inode)->i_next_alloc_goal = 0; |
1180 | if (fe->descTag.tagIdent == cpu_to_le16(TAG_IDENT_EFE)) { | 1183 | if (fe->descTag.tagIdent == cpu_to_le16(TAG_IDENT_EFE)) { |
1181 | UDF_I_EFE(inode) = 1; | 1184 | UDF_I(inode)->i_efe = 1; |
1182 | UDF_I_USE(inode) = 0; | 1185 | UDF_I(inode)->i_use = 0; |
1183 | if (udf_alloc_i_data(inode, inode->i_sb->s_blocksize - | 1186 | if (udf_alloc_i_data(inode, inode->i_sb->s_blocksize - |
1184 | sizeof(struct extendedFileEntry))) { | 1187 | sizeof(struct extendedFileEntry))) { |
1185 | make_bad_inode(inode); | 1188 | make_bad_inode(inode); |
1186 | return; | 1189 | return; |
1187 | } | 1190 | } |
1188 | memcpy(UDF_I_DATA(inode), | 1191 | memcpy(UDF_I(inode)->i_ext.i_data, |
1189 | bh->b_data + sizeof(struct extendedFileEntry), | 1192 | bh->b_data + sizeof(struct extendedFileEntry), |
1190 | inode->i_sb->s_blocksize - | 1193 | inode->i_sb->s_blocksize - |
1191 | sizeof(struct extendedFileEntry)); | 1194 | sizeof(struct extendedFileEntry)); |
1192 | } else if (fe->descTag.tagIdent == cpu_to_le16(TAG_IDENT_FE)) { | 1195 | } else if (fe->descTag.tagIdent == cpu_to_le16(TAG_IDENT_FE)) { |
1193 | UDF_I_EFE(inode) = 0; | 1196 | UDF_I(inode)->i_efe = 0; |
1194 | UDF_I_USE(inode) = 0; | 1197 | UDF_I(inode)->i_use = 0; |
1195 | if (udf_alloc_i_data(inode, inode->i_sb->s_blocksize - | 1198 | if (udf_alloc_i_data(inode, inode->i_sb->s_blocksize - |
1196 | sizeof(struct fileEntry))) { | 1199 | sizeof(struct fileEntry))) { |
1197 | make_bad_inode(inode); | 1200 | make_bad_inode(inode); |
1198 | return; | 1201 | return; |
1199 | } | 1202 | } |
1200 | memcpy(UDF_I_DATA(inode), bh->b_data + sizeof(struct fileEntry), | 1203 | memcpy(UDF_I(inode)->i_ext.i_data, |
1204 | bh->b_data + sizeof(struct fileEntry), | ||
1201 | inode->i_sb->s_blocksize - sizeof(struct fileEntry)); | 1205 | inode->i_sb->s_blocksize - sizeof(struct fileEntry)); |
1202 | } else if (fe->descTag.tagIdent == cpu_to_le16(TAG_IDENT_USE)) { | 1206 | } else if (fe->descTag.tagIdent == cpu_to_le16(TAG_IDENT_USE)) { |
1203 | UDF_I_EFE(inode) = 0; | 1207 | UDF_I(inode)->i_efe = 0; |
1204 | UDF_I_USE(inode) = 1; | 1208 | UDF_I(inode)->i_use = 1; |
1205 | UDF_I_LENALLOC(inode) = le32_to_cpu( | 1209 | UDF_I(inode)->i_lenAlloc = le32_to_cpu( |
1206 | ((struct unallocSpaceEntry *)bh->b_data)-> | 1210 | ((struct unallocSpaceEntry *)bh->b_data)-> |
1207 | lengthAllocDescs); | 1211 | lengthAllocDescs); |
1208 | if (udf_alloc_i_data(inode, inode->i_sb->s_blocksize - | 1212 | if (udf_alloc_i_data(inode, inode->i_sb->s_blocksize - |
@@ -1210,7 +1214,7 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) | |||
1210 | make_bad_inode(inode); | 1214 | make_bad_inode(inode); |
1211 | return; | 1215 | return; |
1212 | } | 1216 | } |
1213 | memcpy(UDF_I_DATA(inode), | 1217 | memcpy(UDF_I(inode)->i_ext.i_data, |
1214 | bh->b_data + sizeof(struct unallocSpaceEntry), | 1218 | bh->b_data + sizeof(struct unallocSpaceEntry), |
1215 | inode->i_sb->s_blocksize - | 1219 | inode->i_sb->s_blocksize - |
1216 | sizeof(struct unallocSpaceEntry)); | 1220 | sizeof(struct unallocSpaceEntry)); |
@@ -1234,12 +1238,12 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) | |||
1234 | inode->i_nlink = 1; | 1238 | inode->i_nlink = 1; |
1235 | 1239 | ||
1236 | inode->i_size = le64_to_cpu(fe->informationLength); | 1240 | inode->i_size = le64_to_cpu(fe->informationLength); |
1237 | UDF_I_LENEXTENTS(inode) = inode->i_size; | 1241 | UDF_I(inode)->i_lenExtents = inode->i_size; |
1238 | 1242 | ||
1239 | inode->i_mode = udf_convert_permissions(fe); | 1243 | inode->i_mode = udf_convert_permissions(fe); |
1240 | inode->i_mode &= ~UDF_SB(inode->i_sb)->s_umask; | 1244 | inode->i_mode &= ~UDF_SB(inode->i_sb)->s_umask; |
1241 | 1245 | ||
1242 | if (UDF_I_EFE(inode) == 0) { | 1246 | if (UDF_I(inode)->i_efe == 0) { |
1243 | inode->i_blocks = le64_to_cpu(fe->logicalBlocksRecorded) << | 1247 | inode->i_blocks = le64_to_cpu(fe->logicalBlocksRecorded) << |
1244 | (inode->i_sb->s_blocksize_bits - 9); | 1248 | (inode->i_sb->s_blocksize_bits - 9); |
1245 | 1249 | ||
@@ -1267,10 +1271,10 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) | |||
1267 | inode->i_ctime = sbi->s_record_time; | 1271 | inode->i_ctime = sbi->s_record_time; |
1268 | } | 1272 | } |
1269 | 1273 | ||
1270 | UDF_I_UNIQUE(inode) = le64_to_cpu(fe->uniqueID); | 1274 | UDF_I(inode)->i_unique = le64_to_cpu(fe->uniqueID); |
1271 | UDF_I_LENEATTR(inode) = le32_to_cpu(fe->lengthExtendedAttr); | 1275 | UDF_I(inode)->i_lenEAttr = le32_to_cpu(fe->lengthExtendedAttr); |
1272 | UDF_I_LENALLOC(inode) = le32_to_cpu(fe->lengthAllocDescs); | 1276 | UDF_I(inode)->i_lenAlloc = le32_to_cpu(fe->lengthAllocDescs); |
1273 | offset = sizeof(struct fileEntry) + UDF_I_LENEATTR(inode); | 1277 | offset = sizeof(struct fileEntry) + UDF_I(inode)->i_lenEAttr; |
1274 | } else { | 1278 | } else { |
1275 | inode->i_blocks = le64_to_cpu(efe->logicalBlocksRecorded) << | 1279 | inode->i_blocks = le64_to_cpu(efe->logicalBlocksRecorded) << |
1276 | (inode->i_sb->s_blocksize_bits - 9); | 1280 | (inode->i_sb->s_blocksize_bits - 9); |
@@ -1293,10 +1297,10 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) | |||
1293 | 1297 | ||
1294 | if (udf_stamp_to_time(&convtime, &convtime_usec, | 1298 | if (udf_stamp_to_time(&convtime, &convtime_usec, |
1295 | lets_to_cpu(efe->createTime))) { | 1299 | lets_to_cpu(efe->createTime))) { |
1296 | UDF_I_CRTIME(inode).tv_sec = convtime; | 1300 | UDF_I(inode)->i_crtime.tv_sec = convtime; |
1297 | UDF_I_CRTIME(inode).tv_nsec = convtime_usec * 1000; | 1301 | UDF_I(inode)->i_crtime.tv_nsec = convtime_usec * 1000; |
1298 | } else { | 1302 | } else { |
1299 | UDF_I_CRTIME(inode) = sbi->s_record_time; | 1303 | UDF_I(inode)->i_crtime = sbi->s_record_time; |
1300 | } | 1304 | } |
1301 | 1305 | ||
1302 | if (udf_stamp_to_time(&convtime, &convtime_usec, | 1306 | if (udf_stamp_to_time(&convtime, &convtime_usec, |
@@ -1307,11 +1311,11 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) | |||
1307 | inode->i_ctime = sbi->s_record_time; | 1311 | inode->i_ctime = sbi->s_record_time; |
1308 | } | 1312 | } |
1309 | 1313 | ||
1310 | UDF_I_UNIQUE(inode) = le64_to_cpu(efe->uniqueID); | 1314 | UDF_I(inode)->i_unique = le64_to_cpu(efe->uniqueID); |
1311 | UDF_I_LENEATTR(inode) = le32_to_cpu(efe->lengthExtendedAttr); | 1315 | UDF_I(inode)->i_lenEAttr = le32_to_cpu(efe->lengthExtendedAttr); |
1312 | UDF_I_LENALLOC(inode) = le32_to_cpu(efe->lengthAllocDescs); | 1316 | UDF_I(inode)->i_lenAlloc = le32_to_cpu(efe->lengthAllocDescs); |
1313 | offset = sizeof(struct extendedFileEntry) + | 1317 | offset = sizeof(struct extendedFileEntry) + |
1314 | UDF_I_LENEATTR(inode); | 1318 | UDF_I(inode)->i_lenEAttr; |
1315 | } | 1319 | } |
1316 | 1320 | ||
1317 | switch (fe->icbTag.fileType) { | 1321 | switch (fe->icbTag.fileType) { |
@@ -1324,7 +1328,7 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) | |||
1324 | case ICBTAG_FILE_TYPE_REALTIME: | 1328 | case ICBTAG_FILE_TYPE_REALTIME: |
1325 | case ICBTAG_FILE_TYPE_REGULAR: | 1329 | case ICBTAG_FILE_TYPE_REGULAR: |
1326 | case ICBTAG_FILE_TYPE_UNDEF: | 1330 | case ICBTAG_FILE_TYPE_UNDEF: |
1327 | if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_IN_ICB) | 1331 | if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) |
1328 | inode->i_data.a_ops = &udf_adinicb_aops; | 1332 | inode->i_data.a_ops = &udf_adinicb_aops; |
1329 | else | 1333 | else |
1330 | inode->i_data.a_ops = &udf_aops; | 1334 | inode->i_data.a_ops = &udf_aops; |
@@ -1371,9 +1375,9 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) | |||
1371 | 1375 | ||
1372 | static int udf_alloc_i_data(struct inode *inode, size_t size) | 1376 | static int udf_alloc_i_data(struct inode *inode, size_t size) |
1373 | { | 1377 | { |
1374 | UDF_I_DATA(inode) = kmalloc(size, GFP_KERNEL); | 1378 | UDF_I(inode)->i_ext.i_data = kmalloc(size, GFP_KERNEL); |
1375 | 1379 | ||
1376 | if (!UDF_I_DATA(inode)) { | 1380 | if (!UDF_I(inode)->i_ext.i_data) { |
1377 | printk(KERN_ERR "udf:udf_alloc_i_data (ino %ld) " | 1381 | printk(KERN_ERR "udf:udf_alloc_i_data (ino %ld) " |
1378 | "no free memory\n", inode->i_ino); | 1382 | "no free memory\n", inode->i_ino); |
1379 | return -ENOMEM; | 1383 | return -ENOMEM; |
@@ -1447,7 +1451,7 @@ static int udf_update_inode(struct inode *inode, int do_sync) | |||
1447 | 1451 | ||
1448 | bh = udf_tread(inode->i_sb, | 1452 | bh = udf_tread(inode->i_sb, |
1449 | udf_get_lb_pblock(inode->i_sb, | 1453 | udf_get_lb_pblock(inode->i_sb, |
1450 | UDF_I_LOCATION(inode), 0)); | 1454 | UDF_I(inode)->i_location, 0)); |
1451 | if (!bh) { | 1455 | if (!bh) { |
1452 | udf_debug("bread failure\n"); | 1456 | udf_debug("bread failure\n"); |
1453 | return -EIO; | 1457 | return -EIO; |
@@ -1462,14 +1466,14 @@ static int udf_update_inode(struct inode *inode, int do_sync) | |||
1462 | struct unallocSpaceEntry *use = | 1466 | struct unallocSpaceEntry *use = |
1463 | (struct unallocSpaceEntry *)bh->b_data; | 1467 | (struct unallocSpaceEntry *)bh->b_data; |
1464 | 1468 | ||
1465 | use->lengthAllocDescs = cpu_to_le32(UDF_I_LENALLOC(inode)); | 1469 | use->lengthAllocDescs = cpu_to_le32(UDF_I(inode)->i_lenAlloc); |
1466 | memcpy(bh->b_data + sizeof(struct unallocSpaceEntry), | 1470 | memcpy(bh->b_data + sizeof(struct unallocSpaceEntry), |
1467 | UDF_I_DATA(inode), inode->i_sb->s_blocksize - | 1471 | UDF_I(inode)->i_ext.i_data, inode->i_sb->s_blocksize - |
1468 | sizeof(struct unallocSpaceEntry)); | 1472 | sizeof(struct unallocSpaceEntry)); |
1469 | crclen = sizeof(struct unallocSpaceEntry) + | 1473 | crclen = sizeof(struct unallocSpaceEntry) + |
1470 | UDF_I_LENALLOC(inode) - sizeof(tag); | 1474 | UDF_I(inode)->i_lenAlloc - sizeof(tag); |
1471 | use->descTag.tagLocation = cpu_to_le32( | 1475 | use->descTag.tagLocation = cpu_to_le32( |
1472 | UDF_I_LOCATION(inode). | 1476 | UDF_I(inode)->i_location. |
1473 | logicalBlockNum); | 1477 | logicalBlockNum); |
1474 | use->descTag.descCRCLength = cpu_to_le16(crclen); | 1478 | use->descTag.descCRCLength = cpu_to_le16(crclen); |
1475 | use->descTag.descCRC = cpu_to_le16(udf_crc((char *)use + | 1479 | use->descTag.descCRC = cpu_to_le16(udf_crc((char *)use + |
@@ -1534,8 +1538,9 @@ static int udf_update_inode(struct inode *inode, int do_sync) | |||
1534 | dsea->minorDeviceIdent = cpu_to_le32(iminor(inode)); | 1538 | dsea->minorDeviceIdent = cpu_to_le32(iminor(inode)); |
1535 | } | 1539 | } |
1536 | 1540 | ||
1537 | if (UDF_I_EFE(inode) == 0) { | 1541 | if (UDF_I(inode)->i_efe == 0) { |
1538 | memcpy(bh->b_data + sizeof(struct fileEntry), UDF_I_DATA(inode), | 1542 | memcpy(bh->b_data + sizeof(struct fileEntry), |
1543 | UDF_I(inode)->i_ext.i_data, | ||
1539 | inode->i_sb->s_blocksize - sizeof(struct fileEntry)); | 1544 | inode->i_sb->s_blocksize - sizeof(struct fileEntry)); |
1540 | fe->logicalBlocksRecorded = cpu_to_le64( | 1545 | fe->logicalBlocksRecorded = cpu_to_le64( |
1541 | (inode->i_blocks + (1 << (blocksize_bits - 9)) - 1) >> | 1546 | (inode->i_blocks + (1 << (blocksize_bits - 9)) - 1) >> |
@@ -1551,14 +1556,14 @@ static int udf_update_inode(struct inode *inode, int do_sync) | |||
1551 | strcpy(fe->impIdent.ident, UDF_ID_DEVELOPER); | 1556 | strcpy(fe->impIdent.ident, UDF_ID_DEVELOPER); |
1552 | fe->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX; | 1557 | fe->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX; |
1553 | fe->impIdent.identSuffix[1] = UDF_OS_ID_LINUX; | 1558 | fe->impIdent.identSuffix[1] = UDF_OS_ID_LINUX; |
1554 | fe->uniqueID = cpu_to_le64(UDF_I_UNIQUE(inode)); | 1559 | fe->uniqueID = cpu_to_le64(UDF_I(inode)->i_unique); |
1555 | fe->lengthExtendedAttr = cpu_to_le32(UDF_I_LENEATTR(inode)); | 1560 | fe->lengthExtendedAttr = cpu_to_le32(UDF_I(inode)->i_lenEAttr); |
1556 | fe->lengthAllocDescs = cpu_to_le32(UDF_I_LENALLOC(inode)); | 1561 | fe->lengthAllocDescs = cpu_to_le32(UDF_I(inode)->i_lenAlloc); |
1557 | fe->descTag.tagIdent = cpu_to_le16(TAG_IDENT_FE); | 1562 | fe->descTag.tagIdent = cpu_to_le16(TAG_IDENT_FE); |
1558 | crclen = sizeof(struct fileEntry); | 1563 | crclen = sizeof(struct fileEntry); |
1559 | } else { | 1564 | } else { |
1560 | memcpy(bh->b_data + sizeof(struct extendedFileEntry), | 1565 | memcpy(bh->b_data + sizeof(struct extendedFileEntry), |
1561 | UDF_I_DATA(inode), | 1566 | UDF_I(inode)->i_ext.i_data, |
1562 | inode->i_sb->s_blocksize - | 1567 | inode->i_sb->s_blocksize - |
1563 | sizeof(struct extendedFileEntry)); | 1568 | sizeof(struct extendedFileEntry)); |
1564 | efe->objectSize = cpu_to_le64(inode->i_size); | 1569 | efe->objectSize = cpu_to_le64(inode->i_size); |
@@ -1566,26 +1571,26 @@ static int udf_update_inode(struct inode *inode, int do_sync) | |||
1566 | (inode->i_blocks + (1 << (blocksize_bits - 9)) - 1) >> | 1571 | (inode->i_blocks + (1 << (blocksize_bits - 9)) - 1) >> |
1567 | (blocksize_bits - 9)); | 1572 | (blocksize_bits - 9)); |
1568 | 1573 | ||
1569 | if (UDF_I_CRTIME(inode).tv_sec > inode->i_atime.tv_sec || | 1574 | if (UDF_I(inode)->i_crtime.tv_sec > inode->i_atime.tv_sec || |
1570 | (UDF_I_CRTIME(inode).tv_sec == inode->i_atime.tv_sec && | 1575 | (UDF_I(inode)->i_crtime.tv_sec == inode->i_atime.tv_sec && |
1571 | UDF_I_CRTIME(inode).tv_nsec > inode->i_atime.tv_nsec)) | 1576 | UDF_I(inode)->i_crtime.tv_nsec > inode->i_atime.tv_nsec)) |
1572 | UDF_I_CRTIME(inode) = inode->i_atime; | 1577 | UDF_I(inode)->i_crtime = inode->i_atime; |
1573 | 1578 | ||
1574 | if (UDF_I_CRTIME(inode).tv_sec > inode->i_mtime.tv_sec || | 1579 | if (UDF_I(inode)->i_crtime.tv_sec > inode->i_mtime.tv_sec || |
1575 | (UDF_I_CRTIME(inode).tv_sec == inode->i_mtime.tv_sec && | 1580 | (UDF_I(inode)->i_crtime.tv_sec == inode->i_mtime.tv_sec && |
1576 | UDF_I_CRTIME(inode).tv_nsec > inode->i_mtime.tv_nsec)) | 1581 | UDF_I(inode)->i_crtime.tv_nsec > inode->i_mtime.tv_nsec)) |
1577 | UDF_I_CRTIME(inode) = inode->i_mtime; | 1582 | UDF_I(inode)->i_crtime = inode->i_mtime; |
1578 | 1583 | ||
1579 | if (UDF_I_CRTIME(inode).tv_sec > inode->i_ctime.tv_sec || | 1584 | if (UDF_I(inode)->i_crtime.tv_sec > inode->i_ctime.tv_sec || |
1580 | (UDF_I_CRTIME(inode).tv_sec == inode->i_ctime.tv_sec && | 1585 | (UDF_I(inode)->i_crtime.tv_sec == inode->i_ctime.tv_sec && |
1581 | UDF_I_CRTIME(inode).tv_nsec > inode->i_ctime.tv_nsec)) | 1586 | UDF_I(inode)->i_crtime.tv_nsec > inode->i_ctime.tv_nsec)) |
1582 | UDF_I_CRTIME(inode) = inode->i_ctime; | 1587 | UDF_I(inode)->i_crtime = inode->i_ctime; |
1583 | 1588 | ||
1584 | if (udf_time_to_stamp(&cpu_time, inode->i_atime)) | 1589 | if (udf_time_to_stamp(&cpu_time, inode->i_atime)) |
1585 | efe->accessTime = cpu_to_lets(cpu_time); | 1590 | efe->accessTime = cpu_to_lets(cpu_time); |
1586 | if (udf_time_to_stamp(&cpu_time, inode->i_mtime)) | 1591 | if (udf_time_to_stamp(&cpu_time, inode->i_mtime)) |
1587 | efe->modificationTime = cpu_to_lets(cpu_time); | 1592 | efe->modificationTime = cpu_to_lets(cpu_time); |
1588 | if (udf_time_to_stamp(&cpu_time, UDF_I_CRTIME(inode))) | 1593 | if (udf_time_to_stamp(&cpu_time, UDF_I(inode)->i_crtime)) |
1589 | efe->createTime = cpu_to_lets(cpu_time); | 1594 | efe->createTime = cpu_to_lets(cpu_time); |
1590 | if (udf_time_to_stamp(&cpu_time, inode->i_ctime)) | 1595 | if (udf_time_to_stamp(&cpu_time, inode->i_ctime)) |
1591 | efe->attrTime = cpu_to_lets(cpu_time); | 1596 | efe->attrTime = cpu_to_lets(cpu_time); |
@@ -1594,13 +1599,13 @@ static int udf_update_inode(struct inode *inode, int do_sync) | |||
1594 | strcpy(efe->impIdent.ident, UDF_ID_DEVELOPER); | 1599 | strcpy(efe->impIdent.ident, UDF_ID_DEVELOPER); |
1595 | efe->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX; | 1600 | efe->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX; |
1596 | efe->impIdent.identSuffix[1] = UDF_OS_ID_LINUX; | 1601 | efe->impIdent.identSuffix[1] = UDF_OS_ID_LINUX; |
1597 | efe->uniqueID = cpu_to_le64(UDF_I_UNIQUE(inode)); | 1602 | efe->uniqueID = cpu_to_le64(UDF_I(inode)->i_unique); |
1598 | efe->lengthExtendedAttr = cpu_to_le32(UDF_I_LENEATTR(inode)); | 1603 | efe->lengthExtendedAttr = cpu_to_le32(UDF_I(inode)->i_lenEAttr); |
1599 | efe->lengthAllocDescs = cpu_to_le32(UDF_I_LENALLOC(inode)); | 1604 | efe->lengthAllocDescs = cpu_to_le32(UDF_I(inode)->i_lenAlloc); |
1600 | efe->descTag.tagIdent = cpu_to_le16(TAG_IDENT_EFE); | 1605 | efe->descTag.tagIdent = cpu_to_le16(TAG_IDENT_EFE); |
1601 | crclen = sizeof(struct extendedFileEntry); | 1606 | crclen = sizeof(struct extendedFileEntry); |
1602 | } | 1607 | } |
1603 | if (UDF_I_STRAT4096(inode)) { | 1608 | if (UDF_I(inode)->i_strat4096) { |
1604 | fe->icbTag.strategyType = cpu_to_le16(4096); | 1609 | fe->icbTag.strategyType = cpu_to_le16(4096); |
1605 | fe->icbTag.strategyParameter = cpu_to_le16(1); | 1610 | fe->icbTag.strategyParameter = cpu_to_le16(1); |
1606 | fe->icbTag.numEntries = cpu_to_le16(2); | 1611 | fe->icbTag.numEntries = cpu_to_le16(2); |
@@ -1624,7 +1629,7 @@ static int udf_update_inode(struct inode *inode, int do_sync) | |||
1624 | else if (S_ISSOCK(inode->i_mode)) | 1629 | else if (S_ISSOCK(inode->i_mode)) |
1625 | fe->icbTag.fileType = ICBTAG_FILE_TYPE_SOCKET; | 1630 | fe->icbTag.fileType = ICBTAG_FILE_TYPE_SOCKET; |
1626 | 1631 | ||
1627 | icbflags = UDF_I_ALLOCTYPE(inode) | | 1632 | icbflags = UDF_I(inode)->i_alloc_type | |
1628 | ((inode->i_mode & S_ISUID) ? ICBTAG_FLAG_SETUID : 0) | | 1633 | ((inode->i_mode & S_ISUID) ? ICBTAG_FLAG_SETUID : 0) | |
1629 | ((inode->i_mode & S_ISGID) ? ICBTAG_FLAG_SETGID : 0) | | 1634 | ((inode->i_mode & S_ISGID) ? ICBTAG_FLAG_SETGID : 0) | |
1630 | ((inode->i_mode & S_ISVTX) ? ICBTAG_FLAG_STICKY : 0) | | 1635 | ((inode->i_mode & S_ISVTX) ? ICBTAG_FLAG_STICKY : 0) | |
@@ -1639,8 +1644,9 @@ static int udf_update_inode(struct inode *inode, int do_sync) | |||
1639 | fe->descTag.descVersion = cpu_to_le16(2); | 1644 | fe->descTag.descVersion = cpu_to_le16(2); |
1640 | fe->descTag.tagSerialNum = cpu_to_le16(sbi->s_serial_number); | 1645 | fe->descTag.tagSerialNum = cpu_to_le16(sbi->s_serial_number); |
1641 | fe->descTag.tagLocation = cpu_to_le32( | 1646 | fe->descTag.tagLocation = cpu_to_le32( |
1642 | UDF_I_LOCATION(inode).logicalBlockNum); | 1647 | UDF_I(inode)->i_location.logicalBlockNum); |
1643 | crclen += UDF_I_LENEATTR(inode) + UDF_I_LENALLOC(inode) - sizeof(tag); | 1648 | crclen += UDF_I(inode)->i_lenEAttr + UDF_I(inode)->i_lenAlloc - |
1649 | sizeof(tag); | ||
1644 | fe->descTag.descCRCLength = cpu_to_le16(crclen); | 1650 | fe->descTag.descCRCLength = cpu_to_le16(crclen); |
1645 | fe->descTag.descCRC = cpu_to_le16(udf_crc((char *)fe + sizeof(tag), | 1651 | fe->descTag.descCRC = cpu_to_le16(udf_crc((char *)fe + sizeof(tag), |
1646 | crclen, 0)); | 1652 | crclen, 0)); |
@@ -1671,7 +1677,7 @@ struct inode *udf_iget(struct super_block *sb, kernel_lb_addr ino) | |||
1671 | return NULL; | 1677 | return NULL; |
1672 | 1678 | ||
1673 | if (inode->i_state & I_NEW) { | 1679 | if (inode->i_state & I_NEW) { |
1674 | memcpy(&UDF_I_LOCATION(inode), &ino, sizeof(kernel_lb_addr)); | 1680 | memcpy(&UDF_I(inode)->i_location, &ino, sizeof(kernel_lb_addr)); |
1675 | __udf_read_inode(inode); | 1681 | __udf_read_inode(inode); |
1676 | unlock_new_inode(inode); | 1682 | unlock_new_inode(inode); |
1677 | } | 1683 | } |
@@ -1705,15 +1711,15 @@ int8_t udf_add_aext(struct inode *inode, struct extent_position *epos, | |||
1705 | uint8_t *ptr; | 1711 | uint8_t *ptr; |
1706 | 1712 | ||
1707 | if (!epos->bh) | 1713 | if (!epos->bh) |
1708 | ptr = UDF_I_DATA(inode) + epos->offset - | 1714 | ptr = UDF_I(inode)->i_ext.i_data + epos->offset - |
1709 | udf_file_entry_alloc_offset(inode) + | 1715 | udf_file_entry_alloc_offset(inode) + |
1710 | UDF_I_LENEATTR(inode); | 1716 | UDF_I(inode)->i_lenEAttr; |
1711 | else | 1717 | else |
1712 | ptr = epos->bh->b_data + epos->offset; | 1718 | ptr = epos->bh->b_data + epos->offset; |
1713 | 1719 | ||
1714 | if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_SHORT) | 1720 | if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_SHORT) |
1715 | adsize = sizeof(short_ad); | 1721 | adsize = sizeof(short_ad); |
1716 | else if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_LONG) | 1722 | else if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_LONG) |
1717 | adsize = sizeof(long_ad); | 1723 | adsize = sizeof(long_ad); |
1718 | else | 1724 | else |
1719 | return -1; | 1725 | return -1; |
@@ -1763,7 +1769,7 @@ int8_t udf_add_aext(struct inode *inode, struct extent_position *epos, | |||
1763 | cpu_to_le32(le32_to_cpu( | 1769 | cpu_to_le32(le32_to_cpu( |
1764 | aed->lengthAllocDescs) + adsize); | 1770 | aed->lengthAllocDescs) + adsize); |
1765 | } else { | 1771 | } else { |
1766 | UDF_I_LENALLOC(inode) += adsize; | 1772 | UDF_I(inode)->i_lenAlloc += adsize; |
1767 | mark_inode_dirty(inode); | 1773 | mark_inode_dirty(inode); |
1768 | } | 1774 | } |
1769 | } | 1775 | } |
@@ -1773,7 +1779,7 @@ int8_t udf_add_aext(struct inode *inode, struct extent_position *epos, | |||
1773 | else | 1779 | else |
1774 | udf_new_tag(nbh->b_data, TAG_IDENT_AED, 2, 1, | 1780 | udf_new_tag(nbh->b_data, TAG_IDENT_AED, 2, 1, |
1775 | epos->block.logicalBlockNum, sizeof(tag)); | 1781 | epos->block.logicalBlockNum, sizeof(tag)); |
1776 | switch (UDF_I_ALLOCTYPE(inode)) { | 1782 | switch (UDF_I(inode)->i_alloc_type) { |
1777 | case ICBTAG_FLAG_AD_SHORT: | 1783 | case ICBTAG_FLAG_AD_SHORT: |
1778 | sad = (short_ad *)sptr; | 1784 | sad = (short_ad *)sptr; |
1779 | sad->extLength = cpu_to_le32(EXT_NEXT_EXTENT_ALLOCDECS | | 1785 | sad->extLength = cpu_to_le32(EXT_NEXT_EXTENT_ALLOCDECS | |
@@ -1807,7 +1813,7 @@ int8_t udf_add_aext(struct inode *inode, struct extent_position *epos, | |||
1807 | etype = udf_write_aext(inode, epos, eloc, elen, inc); | 1813 | etype = udf_write_aext(inode, epos, eloc, elen, inc); |
1808 | 1814 | ||
1809 | if (!epos->bh) { | 1815 | if (!epos->bh) { |
1810 | UDF_I_LENALLOC(inode) += adsize; | 1816 | UDF_I(inode)->i_lenAlloc += adsize; |
1811 | mark_inode_dirty(inode); | 1817 | mark_inode_dirty(inode); |
1812 | } else { | 1818 | } else { |
1813 | aed = (struct allocExtDesc *)epos->bh->b_data; | 1819 | aed = (struct allocExtDesc *)epos->bh->b_data; |
@@ -1836,13 +1842,13 @@ int8_t udf_write_aext(struct inode *inode, struct extent_position *epos, | |||
1836 | long_ad *lad; | 1842 | long_ad *lad; |
1837 | 1843 | ||
1838 | if (!epos->bh) | 1844 | if (!epos->bh) |
1839 | ptr = UDF_I_DATA(inode) + epos->offset - | 1845 | ptr = UDF_I(inode)->i_ext.i_data + epos->offset - |
1840 | udf_file_entry_alloc_offset(inode) + | 1846 | udf_file_entry_alloc_offset(inode) + |
1841 | UDF_I_LENEATTR(inode); | 1847 | UDF_I(inode)->i_lenEAttr; |
1842 | else | 1848 | else |
1843 | ptr = epos->bh->b_data + epos->offset; | 1849 | ptr = epos->bh->b_data + epos->offset; |
1844 | 1850 | ||
1845 | switch (UDF_I_ALLOCTYPE(inode)) { | 1851 | switch (UDF_I(inode)->i_alloc_type) { |
1846 | case ICBTAG_FLAG_AD_SHORT: | 1852 | case ICBTAG_FLAG_AD_SHORT: |
1847 | sad = (short_ad *)ptr; | 1853 | sad = (short_ad *)ptr; |
1848 | sad->extLength = cpu_to_le32(elen); | 1854 | sad->extLength = cpu_to_le32(elen); |
@@ -1914,11 +1920,11 @@ int8_t udf_current_aext(struct inode *inode, struct extent_position *epos, | |||
1914 | if (!epos->bh) { | 1920 | if (!epos->bh) { |
1915 | if (!epos->offset) | 1921 | if (!epos->offset) |
1916 | epos->offset = udf_file_entry_alloc_offset(inode); | 1922 | epos->offset = udf_file_entry_alloc_offset(inode); |
1917 | ptr = UDF_I_DATA(inode) + epos->offset - | 1923 | ptr = UDF_I(inode)->i_ext.i_data + epos->offset - |
1918 | udf_file_entry_alloc_offset(inode) + | 1924 | udf_file_entry_alloc_offset(inode) + |
1919 | UDF_I_LENEATTR(inode); | 1925 | UDF_I(inode)->i_lenEAttr; |
1920 | alen = udf_file_entry_alloc_offset(inode) + | 1926 | alen = udf_file_entry_alloc_offset(inode) + |
1921 | UDF_I_LENALLOC(inode); | 1927 | UDF_I(inode)->i_lenAlloc; |
1922 | } else { | 1928 | } else { |
1923 | if (!epos->offset) | 1929 | if (!epos->offset) |
1924 | epos->offset = sizeof(struct allocExtDesc); | 1930 | epos->offset = sizeof(struct allocExtDesc); |
@@ -1928,7 +1934,7 @@ int8_t udf_current_aext(struct inode *inode, struct extent_position *epos, | |||
1928 | lengthAllocDescs); | 1934 | lengthAllocDescs); |
1929 | } | 1935 | } |
1930 | 1936 | ||
1931 | switch (UDF_I_ALLOCTYPE(inode)) { | 1937 | switch (UDF_I(inode)->i_alloc_type) { |
1932 | case ICBTAG_FLAG_AD_SHORT: | 1938 | case ICBTAG_FLAG_AD_SHORT: |
1933 | sad = udf_get_fileshortad(ptr, alen, &epos->offset, inc); | 1939 | sad = udf_get_fileshortad(ptr, alen, &epos->offset, inc); |
1934 | if (!sad) | 1940 | if (!sad) |
@@ -1936,7 +1942,7 @@ int8_t udf_current_aext(struct inode *inode, struct extent_position *epos, | |||
1936 | etype = le32_to_cpu(sad->extLength) >> 30; | 1942 | etype = le32_to_cpu(sad->extLength) >> 30; |
1937 | eloc->logicalBlockNum = le32_to_cpu(sad->extPosition); | 1943 | eloc->logicalBlockNum = le32_to_cpu(sad->extPosition); |
1938 | eloc->partitionReferenceNum = | 1944 | eloc->partitionReferenceNum = |
1939 | UDF_I_LOCATION(inode).partitionReferenceNum; | 1945 | UDF_I(inode)->i_location.partitionReferenceNum; |
1940 | *elen = le32_to_cpu(sad->extLength) & UDF_EXTENT_LENGTH_MASK; | 1946 | *elen = le32_to_cpu(sad->extLength) & UDF_EXTENT_LENGTH_MASK; |
1941 | break; | 1947 | break; |
1942 | case ICBTAG_FLAG_AD_LONG: | 1948 | case ICBTAG_FLAG_AD_LONG: |
@@ -1949,7 +1955,7 @@ int8_t udf_current_aext(struct inode *inode, struct extent_position *epos, | |||
1949 | break; | 1955 | break; |
1950 | default: | 1956 | default: |
1951 | udf_debug("alloc_type = %d unsupported\n", | 1957 | udf_debug("alloc_type = %d unsupported\n", |
1952 | UDF_I_ALLOCTYPE(inode)); | 1958 | UDF_I(inode)->i_alloc_type); |
1953 | return -1; | 1959 | return -1; |
1954 | } | 1960 | } |
1955 | 1961 | ||
@@ -1990,9 +1996,9 @@ int8_t udf_delete_aext(struct inode *inode, struct extent_position epos, | |||
1990 | get_bh(epos.bh); | 1996 | get_bh(epos.bh); |
1991 | } | 1997 | } |
1992 | 1998 | ||
1993 | if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_SHORT) | 1999 | if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_SHORT) |
1994 | adsize = sizeof(short_ad); | 2000 | adsize = sizeof(short_ad); |
1995 | else if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_LONG) | 2001 | else if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_LONG) |
1996 | adsize = sizeof(long_ad); | 2002 | adsize = sizeof(long_ad); |
1997 | else | 2003 | else |
1998 | adsize = 0; | 2004 | adsize = 0; |
@@ -2019,7 +2025,7 @@ int8_t udf_delete_aext(struct inode *inode, struct extent_position epos, | |||
2019 | udf_write_aext(inode, &oepos, eloc, elen, 1); | 2025 | udf_write_aext(inode, &oepos, eloc, elen, 1); |
2020 | udf_write_aext(inode, &oepos, eloc, elen, 1); | 2026 | udf_write_aext(inode, &oepos, eloc, elen, 1); |
2021 | if (!oepos.bh) { | 2027 | if (!oepos.bh) { |
2022 | UDF_I_LENALLOC(inode) -= (adsize * 2); | 2028 | UDF_I(inode)->i_lenAlloc -= (adsize * 2); |
2023 | mark_inode_dirty(inode); | 2029 | mark_inode_dirty(inode); |
2024 | } else { | 2030 | } else { |
2025 | aed = (struct allocExtDesc *)oepos.bh->b_data; | 2031 | aed = (struct allocExtDesc *)oepos.bh->b_data; |
@@ -2038,7 +2044,7 @@ int8_t udf_delete_aext(struct inode *inode, struct extent_position epos, | |||
2038 | } else { | 2044 | } else { |
2039 | udf_write_aext(inode, &oepos, eloc, elen, 1); | 2045 | udf_write_aext(inode, &oepos, eloc, elen, 1); |
2040 | if (!oepos.bh) { | 2046 | if (!oepos.bh) { |
2041 | UDF_I_LENALLOC(inode) -= adsize; | 2047 | UDF_I(inode)->i_lenAlloc -= adsize; |
2042 | mark_inode_dirty(inode); | 2048 | mark_inode_dirty(inode); |
2043 | } else { | 2049 | } else { |
2044 | aed = (struct allocExtDesc *)oepos.bh->b_data; | 2050 | aed = (struct allocExtDesc *)oepos.bh->b_data; |
@@ -2077,7 +2083,7 @@ int8_t inode_bmap(struct inode *inode, sector_t block, | |||
2077 | } | 2083 | } |
2078 | 2084 | ||
2079 | pos->offset = 0; | 2085 | pos->offset = 0; |
2080 | pos->block = UDF_I_LOCATION(inode); | 2086 | pos->block = UDF_I(inode)->i_location; |
2081 | pos->bh = NULL; | 2087 | pos->bh = NULL; |
2082 | *elen = 0; | 2088 | *elen = 0; |
2083 | 2089 | ||
@@ -2085,7 +2091,7 @@ int8_t inode_bmap(struct inode *inode, sector_t block, | |||
2085 | etype = udf_next_aext(inode, pos, eloc, elen, 1); | 2091 | etype = udf_next_aext(inode, pos, eloc, elen, 1); |
2086 | if (etype == -1) { | 2092 | if (etype == -1) { |
2087 | *offset = (bcount - lbcount) >> blocksize_bits; | 2093 | *offset = (bcount - lbcount) >> blocksize_bits; |
2088 | UDF_I_LENEXTENTS(inode) = lbcount; | 2094 | UDF_I(inode)->i_lenExtents = lbcount; |
2089 | return -1; | 2095 | return -1; |
2090 | } | 2096 | } |
2091 | lbcount += *elen; | 2097 | lbcount += *elen; |