diff options
author | Cyrill Gorcunov <gorcunov@gmail.com> | 2007-07-19 04:47:43 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-19 13:04:43 -0400 |
commit | cb00ea3528eb3c09eae9871d6e7d038776e952e2 (patch) | |
tree | b87eae0b060f37bedf01b52ccad6034d1df4f376 /fs/udf/super.c | |
parent | 95a631e2d9853c9138e14fbaa9a51e6451f040b4 (diff) |
UDF: coding style conversion - lindent
This patch converts UDF coding style to kernel coding style using Lindent.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Jan Kara <jack@ucw.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/udf/super.c')
-rw-r--r-- | fs/udf/super.c | 1625 |
1 files changed, 875 insertions, 750 deletions
diff --git a/fs/udf/super.c b/fs/udf/super.c index d6a504f5d758..911387aa1810 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c | |||
@@ -38,7 +38,7 @@ | |||
38 | * 12/20/98 find the free space bitmap (if it exists) | 38 | * 12/20/98 find the free space bitmap (if it exists) |
39 | */ | 39 | */ |
40 | 40 | ||
41 | #include "udfdecl.h" | 41 | #include "udfdecl.h" |
42 | 42 | ||
43 | #include <linux/blkdev.h> | 43 | #include <linux/blkdev.h> |
44 | #include <linux/slab.h> | 44 | #include <linux/slab.h> |
@@ -80,12 +80,15 @@ static int udf_remount_fs(struct super_block *, int *, char *); | |||
80 | static int udf_check_valid(struct super_block *, int, int); | 80 | static int udf_check_valid(struct super_block *, int, int); |
81 | static int udf_vrs(struct super_block *sb, int silent); | 81 | static int udf_vrs(struct super_block *sb, int silent); |
82 | static int udf_load_partition(struct super_block *, kernel_lb_addr *); | 82 | static int udf_load_partition(struct super_block *, kernel_lb_addr *); |
83 | static int udf_load_logicalvol(struct super_block *, struct buffer_head *, kernel_lb_addr *); | 83 | static int udf_load_logicalvol(struct super_block *, struct buffer_head *, |
84 | kernel_lb_addr *); | ||
84 | static void udf_load_logicalvolint(struct super_block *, kernel_extent_ad); | 85 | static void udf_load_logicalvolint(struct super_block *, kernel_extent_ad); |
85 | static void udf_find_anchor(struct super_block *); | 86 | static void udf_find_anchor(struct super_block *); |
86 | static int udf_find_fileset(struct super_block *, kernel_lb_addr *, kernel_lb_addr *); | 87 | static int udf_find_fileset(struct super_block *, kernel_lb_addr *, |
88 | kernel_lb_addr *); | ||
87 | static void udf_load_pvoldesc(struct super_block *, struct buffer_head *); | 89 | static void udf_load_pvoldesc(struct super_block *, struct buffer_head *); |
88 | static void udf_load_fileset(struct super_block *, struct buffer_head *, kernel_lb_addr *); | 90 | static void udf_load_fileset(struct super_block *, struct buffer_head *, |
91 | kernel_lb_addr *); | ||
89 | static void udf_load_partdesc(struct super_block *, struct buffer_head *); | 92 | static void udf_load_partdesc(struct super_block *, struct buffer_head *); |
90 | static void udf_open_lvid(struct super_block *); | 93 | static void udf_open_lvid(struct super_block *); |
91 | static void udf_close_lvid(struct super_block *); | 94 | static void udf_close_lvid(struct super_block *); |
@@ -94,25 +97,27 @@ static int udf_statfs(struct dentry *, struct kstatfs *); | |||
94 | 97 | ||
95 | /* UDF filesystem type */ | 98 | /* UDF filesystem type */ |
96 | static int udf_get_sb(struct file_system_type *fs_type, | 99 | static int udf_get_sb(struct file_system_type *fs_type, |
97 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) | 100 | int flags, const char *dev_name, void *data, |
101 | struct vfsmount *mnt) | ||
98 | { | 102 | { |
99 | return get_sb_bdev(fs_type, flags, dev_name, data, udf_fill_super, mnt); | 103 | return get_sb_bdev(fs_type, flags, dev_name, data, udf_fill_super, mnt); |
100 | } | 104 | } |
101 | 105 | ||
102 | static struct file_system_type udf_fstype = { | 106 | static struct file_system_type udf_fstype = { |
103 | .owner = THIS_MODULE, | 107 | .owner = THIS_MODULE, |
104 | .name = "udf", | 108 | .name = "udf", |
105 | .get_sb = udf_get_sb, | 109 | .get_sb = udf_get_sb, |
106 | .kill_sb = kill_block_super, | 110 | .kill_sb = kill_block_super, |
107 | .fs_flags = FS_REQUIRES_DEV, | 111 | .fs_flags = FS_REQUIRES_DEV, |
108 | }; | 112 | }; |
109 | 113 | ||
110 | static struct kmem_cache * udf_inode_cachep; | 114 | static struct kmem_cache *udf_inode_cachep; |
111 | 115 | ||
112 | static struct inode *udf_alloc_inode(struct super_block *sb) | 116 | static struct inode *udf_alloc_inode(struct super_block *sb) |
113 | { | 117 | { |
114 | struct udf_inode_info *ei; | 118 | struct udf_inode_info *ei; |
115 | ei = (struct udf_inode_info *)kmem_cache_alloc(udf_inode_cachep, GFP_KERNEL); | 119 | ei = (struct udf_inode_info *)kmem_cache_alloc(udf_inode_cachep, |
120 | GFP_KERNEL); | ||
116 | if (!ei) | 121 | if (!ei) |
117 | return NULL; | 122 | return NULL; |
118 | 123 | ||
@@ -130,9 +135,9 @@ static void udf_destroy_inode(struct inode *inode) | |||
130 | kmem_cache_free(udf_inode_cachep, UDF_I(inode)); | 135 | kmem_cache_free(udf_inode_cachep, UDF_I(inode)); |
131 | } | 136 | } |
132 | 137 | ||
133 | static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags) | 138 | static void init_once(void *foo, struct kmem_cache *cachep, unsigned long flags) |
134 | { | 139 | { |
135 | struct udf_inode_info *ei = (struct udf_inode_info *) foo; | 140 | struct udf_inode_info *ei = (struct udf_inode_info *)foo; |
136 | 141 | ||
137 | ei->i_ext.i_data = NULL; | 142 | ei->i_ext.i_data = NULL; |
138 | inode_init_once(&ei->vfs_inode); | 143 | inode_init_once(&ei->vfs_inode); |
@@ -142,8 +147,8 @@ static int init_inodecache(void) | |||
142 | { | 147 | { |
143 | udf_inode_cachep = kmem_cache_create("udf_inode_cache", | 148 | udf_inode_cachep = kmem_cache_create("udf_inode_cache", |
144 | sizeof(struct udf_inode_info), | 149 | sizeof(struct udf_inode_info), |
145 | 0, (SLAB_RECLAIM_ACCOUNT| | 150 | 0, (SLAB_RECLAIM_ACCOUNT | |
146 | SLAB_MEM_SPREAD), | 151 | SLAB_MEM_SPREAD), |
147 | init_once, NULL); | 152 | init_once, NULL); |
148 | if (udf_inode_cachep == NULL) | 153 | if (udf_inode_cachep == NULL) |
149 | return -ENOMEM; | 154 | return -ENOMEM; |
@@ -157,19 +162,18 @@ static void destroy_inodecache(void) | |||
157 | 162 | ||
158 | /* Superblock operations */ | 163 | /* Superblock operations */ |
159 | static const struct super_operations udf_sb_ops = { | 164 | static const struct super_operations udf_sb_ops = { |
160 | .alloc_inode = udf_alloc_inode, | 165 | .alloc_inode = udf_alloc_inode, |
161 | .destroy_inode = udf_destroy_inode, | 166 | .destroy_inode = udf_destroy_inode, |
162 | .write_inode = udf_write_inode, | 167 | .write_inode = udf_write_inode, |
163 | .delete_inode = udf_delete_inode, | 168 | .delete_inode = udf_delete_inode, |
164 | .clear_inode = udf_clear_inode, | 169 | .clear_inode = udf_clear_inode, |
165 | .put_super = udf_put_super, | 170 | .put_super = udf_put_super, |
166 | .write_super = udf_write_super, | 171 | .write_super = udf_write_super, |
167 | .statfs = udf_statfs, | 172 | .statfs = udf_statfs, |
168 | .remount_fs = udf_remount_fs, | 173 | .remount_fs = udf_remount_fs, |
169 | }; | 174 | }; |
170 | 175 | ||
171 | struct udf_options | 176 | struct udf_options { |
172 | { | ||
173 | unsigned char novrs; | 177 | unsigned char novrs; |
174 | unsigned int blocksize; | 178 | unsigned int blocksize; |
175 | unsigned int session; | 179 | unsigned int session; |
@@ -196,9 +200,9 @@ static int __init init_udf_fs(void) | |||
196 | if (err) | 200 | if (err) |
197 | goto out; | 201 | goto out; |
198 | return 0; | 202 | return 0; |
199 | out: | 203 | out: |
200 | destroy_inodecache(); | 204 | destroy_inodecache(); |
201 | out1: | 205 | out1: |
202 | return err; | 206 | return err; |
203 | } | 207 | } |
204 | 208 | ||
@@ -209,7 +213,7 @@ static void __exit exit_udf_fs(void) | |||
209 | } | 213 | } |
210 | 214 | ||
211 | module_init(init_udf_fs) | 215 | module_init(init_udf_fs) |
212 | module_exit(exit_udf_fs) | 216 | module_exit(exit_udf_fs) |
213 | 217 | ||
214 | /* | 218 | /* |
215 | * udf_parse_options | 219 | * udf_parse_options |
@@ -264,7 +268,6 @@ module_exit(exit_udf_fs) | |||
264 | * July 1, 1997 - Andrew E. Mileski | 268 | * July 1, 1997 - Andrew E. Mileski |
265 | * Written, tested, and released. | 269 | * Written, tested, and released. |
266 | */ | 270 | */ |
267 | |||
268 | enum { | 271 | enum { |
269 | Opt_novrs, Opt_nostrict, Opt_bs, Opt_unhide, Opt_undelete, | 272 | Opt_novrs, Opt_nostrict, Opt_bs, Opt_unhide, Opt_undelete, |
270 | Opt_noadinicb, Opt_adinicb, Opt_shortad, Opt_longad, | 273 | Opt_noadinicb, Opt_adinicb, Opt_shortad, Opt_longad, |
@@ -303,8 +306,7 @@ static match_table_t tokens = { | |||
303 | {Opt_err, NULL} | 306 | {Opt_err, NULL} |
304 | }; | 307 | }; |
305 | 308 | ||
306 | static int | 309 | static int udf_parse_options(char *options, struct udf_options *uopt) |
307 | udf_parse_options(char *options, struct udf_options *uopt) | ||
308 | { | 310 | { |
309 | char *p; | 311 | char *p; |
310 | int option; | 312 | int option; |
@@ -323,126 +325,123 @@ udf_parse_options(char *options, struct udf_options *uopt) | |||
323 | if (!options) | 325 | if (!options) |
324 | return 1; | 326 | return 1; |
325 | 327 | ||
326 | while ((p = strsep(&options, ",")) != NULL) | 328 | while ((p = strsep(&options, ",")) != NULL) { |
327 | { | ||
328 | substring_t args[MAX_OPT_ARGS]; | 329 | substring_t args[MAX_OPT_ARGS]; |
329 | int token; | 330 | int token; |
330 | if (!*p) | 331 | if (!*p) |
331 | continue; | 332 | continue; |
332 | 333 | ||
333 | token = match_token(p, tokens, args); | 334 | token = match_token(p, tokens, args); |
334 | switch (token) | 335 | switch (token) { |
335 | { | 336 | case Opt_novrs: |
336 | case Opt_novrs: | 337 | uopt->novrs = 1; |
337 | uopt->novrs = 1; | 338 | case Opt_bs: |
338 | case Opt_bs: | 339 | if (match_int(&args[0], &option)) |
339 | if (match_int(&args[0], &option)) | 340 | return 0; |
340 | return 0; | 341 | uopt->blocksize = option; |
341 | uopt->blocksize = option; | 342 | break; |
342 | break; | 343 | case Opt_unhide: |
343 | case Opt_unhide: | 344 | uopt->flags |= (1 << UDF_FLAG_UNHIDE); |
344 | uopt->flags |= (1 << UDF_FLAG_UNHIDE); | 345 | break; |
345 | break; | 346 | case Opt_undelete: |
346 | case Opt_undelete: | 347 | uopt->flags |= (1 << UDF_FLAG_UNDELETE); |
347 | uopt->flags |= (1 << UDF_FLAG_UNDELETE); | 348 | break; |
348 | break; | 349 | case Opt_noadinicb: |
349 | case Opt_noadinicb: | 350 | uopt->flags &= ~(1 << UDF_FLAG_USE_AD_IN_ICB); |
350 | uopt->flags &= ~(1 << UDF_FLAG_USE_AD_IN_ICB); | 351 | break; |
351 | break; | 352 | case Opt_adinicb: |
352 | case Opt_adinicb: | 353 | uopt->flags |= (1 << UDF_FLAG_USE_AD_IN_ICB); |
353 | uopt->flags |= (1 << UDF_FLAG_USE_AD_IN_ICB); | 354 | break; |
354 | break; | 355 | case Opt_shortad: |
355 | case Opt_shortad: | 356 | uopt->flags |= (1 << UDF_FLAG_USE_SHORT_AD); |
356 | uopt->flags |= (1 << UDF_FLAG_USE_SHORT_AD); | 357 | break; |
357 | break; | 358 | case Opt_longad: |
358 | case Opt_longad: | 359 | uopt->flags &= ~(1 << UDF_FLAG_USE_SHORT_AD); |
359 | uopt->flags &= ~(1 << UDF_FLAG_USE_SHORT_AD); | 360 | break; |
360 | break; | 361 | case Opt_gid: |
361 | case Opt_gid: | 362 | if (match_int(args, &option)) |
362 | if (match_int(args, &option)) | 363 | return 0; |
363 | return 0; | 364 | uopt->gid = option; |
364 | uopt->gid = option; | 365 | break; |
365 | break; | 366 | case Opt_uid: |
366 | case Opt_uid: | 367 | if (match_int(args, &option)) |
367 | if (match_int(args, &option)) | 368 | return 0; |
368 | return 0; | 369 | uopt->uid = option; |
369 | uopt->uid = option; | 370 | break; |
370 | break; | 371 | case Opt_umask: |
371 | case Opt_umask: | 372 | if (match_octal(args, &option)) |
372 | if (match_octal(args, &option)) | 373 | return 0; |
373 | return 0; | 374 | uopt->umask = option; |
374 | uopt->umask = option; | 375 | break; |
375 | break; | 376 | case Opt_nostrict: |
376 | case Opt_nostrict: | 377 | uopt->flags &= ~(1 << UDF_FLAG_STRICT); |
377 | uopt->flags &= ~(1 << UDF_FLAG_STRICT); | 378 | break; |
378 | break; | 379 | case Opt_session: |
379 | case Opt_session: | 380 | if (match_int(args, &option)) |
380 | if (match_int(args, &option)) | 381 | return 0; |
381 | return 0; | 382 | uopt->session = option; |
382 | uopt->session = option; | 383 | break; |
383 | break; | 384 | case Opt_lastblock: |
384 | case Opt_lastblock: | 385 | if (match_int(args, &option)) |
385 | if (match_int(args, &option)) | 386 | return 0; |
386 | return 0; | 387 | uopt->lastblock = option; |
387 | uopt->lastblock = option; | 388 | break; |
388 | break; | 389 | case Opt_anchor: |
389 | case Opt_anchor: | 390 | if (match_int(args, &option)) |
390 | if (match_int(args, &option)) | 391 | return 0; |
391 | return 0; | 392 | uopt->anchor = option; |
392 | uopt->anchor = option; | 393 | break; |
393 | break; | 394 | case Opt_volume: |
394 | case Opt_volume: | 395 | if (match_int(args, &option)) |
395 | if (match_int(args, &option)) | 396 | return 0; |
396 | return 0; | 397 | uopt->volume = option; |
397 | uopt->volume = option; | 398 | break; |
398 | break; | 399 | case Opt_partition: |
399 | case Opt_partition: | 400 | if (match_int(args, &option)) |
400 | if (match_int(args, &option)) | 401 | return 0; |
401 | return 0; | 402 | uopt->partition = option; |
402 | uopt->partition = option; | 403 | break; |
403 | break; | 404 | case Opt_fileset: |
404 | case Opt_fileset: | 405 | if (match_int(args, &option)) |
405 | if (match_int(args, &option)) | 406 | return 0; |
406 | return 0; | 407 | uopt->fileset = option; |
407 | uopt->fileset = option; | 408 | break; |
408 | break; | 409 | case Opt_rootdir: |
409 | case Opt_rootdir: | 410 | if (match_int(args, &option)) |
410 | if (match_int(args, &option)) | 411 | return 0; |
411 | return 0; | 412 | uopt->rootdir = option; |
412 | uopt->rootdir = option; | 413 | break; |
413 | break; | 414 | case Opt_utf8: |
414 | case Opt_utf8: | 415 | uopt->flags |= (1 << UDF_FLAG_UTF8); |
415 | uopt->flags |= (1 << UDF_FLAG_UTF8); | 416 | break; |
416 | break; | ||
417 | #ifdef CONFIG_UDF_NLS | 417 | #ifdef CONFIG_UDF_NLS |
418 | case Opt_iocharset: | 418 | case Opt_iocharset: |
419 | uopt->nls_map = load_nls(args[0].from); | 419 | uopt->nls_map = load_nls(args[0].from); |
420 | uopt->flags |= (1 << UDF_FLAG_NLS_MAP); | 420 | uopt->flags |= (1 << UDF_FLAG_NLS_MAP); |
421 | break; | 421 | break; |
422 | #endif | 422 | #endif |
423 | case Opt_uignore: | 423 | case Opt_uignore: |
424 | uopt->flags |= (1 << UDF_FLAG_UID_IGNORE); | 424 | uopt->flags |= (1 << UDF_FLAG_UID_IGNORE); |
425 | break; | 425 | break; |
426 | case Opt_uforget: | 426 | case Opt_uforget: |
427 | uopt->flags |= (1 << UDF_FLAG_UID_FORGET); | 427 | uopt->flags |= (1 << UDF_FLAG_UID_FORGET); |
428 | break; | 428 | break; |
429 | case Opt_gignore: | 429 | case Opt_gignore: |
430 | uopt->flags |= (1 << UDF_FLAG_GID_IGNORE); | 430 | uopt->flags |= (1 << UDF_FLAG_GID_IGNORE); |
431 | break; | 431 | break; |
432 | case Opt_gforget: | 432 | case Opt_gforget: |
433 | uopt->flags |= (1 << UDF_FLAG_GID_FORGET); | 433 | uopt->flags |= (1 << UDF_FLAG_GID_FORGET); |
434 | break; | 434 | break; |
435 | default: | 435 | default: |
436 | printk(KERN_ERR "udf: bad mount option \"%s\" " | 436 | printk(KERN_ERR "udf: bad mount option \"%s\" " |
437 | "or missing value\n", p); | 437 | "or missing value\n", p); |
438 | return 0; | 438 | return 0; |
439 | } | 439 | } |
440 | } | 440 | } |
441 | return 1; | 441 | return 1; |
442 | } | 442 | } |
443 | 443 | ||
444 | void | 444 | void udf_write_super(struct super_block *sb) |
445 | udf_write_super(struct super_block *sb) | ||
446 | { | 445 | { |
447 | lock_kernel(); | 446 | lock_kernel(); |
448 | if (!(sb->s_flags & MS_RDONLY)) | 447 | if (!(sb->s_flags & MS_RDONLY)) |
@@ -451,22 +450,21 @@ udf_write_super(struct super_block *sb) | |||
451 | unlock_kernel(); | 450 | unlock_kernel(); |
452 | } | 451 | } |
453 | 452 | ||
454 | static int | 453 | static int udf_remount_fs(struct super_block *sb, int *flags, char *options) |
455 | udf_remount_fs(struct super_block *sb, int *flags, char *options) | ||
456 | { | 454 | { |
457 | struct udf_options uopt; | 455 | struct udf_options uopt; |
458 | 456 | ||
459 | uopt.flags = UDF_SB(sb)->s_flags ; | 457 | uopt.flags = UDF_SB(sb)->s_flags; |
460 | uopt.uid = UDF_SB(sb)->s_uid ; | 458 | uopt.uid = UDF_SB(sb)->s_uid; |
461 | uopt.gid = UDF_SB(sb)->s_gid ; | 459 | uopt.gid = UDF_SB(sb)->s_gid; |
462 | uopt.umask = UDF_SB(sb)->s_umask ; | 460 | uopt.umask = UDF_SB(sb)->s_umask; |
463 | 461 | ||
464 | if ( !udf_parse_options(options, &uopt) ) | 462 | if (!udf_parse_options(options, &uopt)) |
465 | return -EINVAL; | 463 | return -EINVAL; |
466 | 464 | ||
467 | UDF_SB(sb)->s_flags = uopt.flags; | 465 | UDF_SB(sb)->s_flags = uopt.flags; |
468 | UDF_SB(sb)->s_uid = uopt.uid; | 466 | UDF_SB(sb)->s_uid = uopt.uid; |
469 | UDF_SB(sb)->s_gid = uopt.gid; | 467 | UDF_SB(sb)->s_gid = uopt.gid; |
470 | UDF_SB(sb)->s_umask = uopt.umask; | 468 | UDF_SB(sb)->s_umask = uopt.umask; |
471 | 469 | ||
472 | if (UDF_SB_LVIDBH(sb)) { | 470 | if (UDF_SB_LVIDBH(sb)) { |
@@ -512,8 +510,7 @@ udf_remount_fs(struct super_block *sb, int *flags, char *options) | |||
512 | * July 1, 1997 - Andrew E. Mileski | 510 | * July 1, 1997 - Andrew E. Mileski |
513 | * Written, tested, and released. | 511 | * Written, tested, and released. |
514 | */ | 512 | */ |
515 | static int | 513 | static int udf_set_blocksize(struct super_block *sb, int bsize) |
516 | udf_set_blocksize(struct super_block *sb, int bsize) | ||
517 | { | 514 | { |
518 | if (!sb_min_blocksize(sb, bsize)) { | 515 | if (!sb_min_blocksize(sb, bsize)) { |
519 | udf_debug("Bad block size (%d)\n", bsize); | 516 | udf_debug("Bad block size (%d)\n", bsize); |
@@ -523,16 +520,15 @@ udf_set_blocksize(struct super_block *sb, int bsize) | |||
523 | return sb->s_blocksize; | 520 | return sb->s_blocksize; |
524 | } | 521 | } |
525 | 522 | ||
526 | static int | 523 | static int udf_vrs(struct super_block *sb, int silent) |
527 | udf_vrs(struct super_block *sb, int silent) | ||
528 | { | 524 | { |
529 | struct volStructDesc *vsd = NULL; | 525 | struct volStructDesc *vsd = NULL; |
530 | int sector = 32768; | 526 | int sector = 32768; |
531 | int sectorsize; | 527 | int sectorsize; |
532 | struct buffer_head *bh = NULL; | 528 | struct buffer_head *bh = NULL; |
533 | int iso9660=0; | 529 | int iso9660 = 0; |
534 | int nsr02=0; | 530 | int nsr02 = 0; |
535 | int nsr03=0; | 531 | int nsr03 = 0; |
536 | 532 | ||
537 | /* Block size must be a multiple of 512 */ | 533 | /* Block size must be a multiple of 512 */ |
538 | if (sb->s_blocksize & 511) | 534 | if (sb->s_blocksize & 511) |
@@ -546,10 +542,9 @@ udf_vrs(struct super_block *sb, int silent) | |||
546 | sector += (UDF_SB_SESSION(sb) << sb->s_blocksize_bits); | 542 | sector += (UDF_SB_SESSION(sb) << sb->s_blocksize_bits); |
547 | 543 | ||
548 | udf_debug("Starting at sector %u (%ld byte sectors)\n", | 544 | udf_debug("Starting at sector %u (%ld byte sectors)\n", |
549 | (sector >> sb->s_blocksize_bits), sb->s_blocksize); | 545 | (sector >> sb->s_blocksize_bits), sb->s_blocksize); |
550 | /* Process the sequence (if applicable) */ | 546 | /* Process the sequence (if applicable) */ |
551 | for (;!nsr02 && !nsr03; sector += sectorsize) | 547 | for (; !nsr02 && !nsr03; sector += sectorsize) { |
552 | { | ||
553 | /* Read a block */ | 548 | /* Read a block */ |
554 | bh = udf_tread(sb, sector >> sb->s_blocksize_bits); | 549 | bh = udf_tread(sb, sector >> sb->s_blocksize_bits); |
555 | if (!bh) | 550 | if (!bh) |
@@ -557,52 +552,56 @@ udf_vrs(struct super_block *sb, int silent) | |||
557 | 552 | ||
558 | /* Look for ISO descriptors */ | 553 | /* Look for ISO descriptors */ |
559 | vsd = (struct volStructDesc *)(bh->b_data + | 554 | vsd = (struct volStructDesc *)(bh->b_data + |
560 | (sector & (sb->s_blocksize - 1))); | 555 | (sector & |
556 | (sb->s_blocksize - 1))); | ||
561 | 557 | ||
562 | if (vsd->stdIdent[0] == 0) | 558 | if (vsd->stdIdent[0] == 0) { |
563 | { | ||
564 | brelse(bh); | 559 | brelse(bh); |
565 | break; | 560 | break; |
566 | } | 561 | } else |
567 | else if (!strncmp(vsd->stdIdent, VSD_STD_ID_CD001, VSD_STD_ID_LEN)) | 562 | if (!strncmp |
568 | { | 563 | (vsd->stdIdent, VSD_STD_ID_CD001, VSD_STD_ID_LEN)) { |
569 | iso9660 = sector; | 564 | iso9660 = sector; |
570 | switch (vsd->structType) | 565 | switch (vsd->structType) { |
571 | { | 566 | case 0: |
572 | case 0: | 567 | udf_debug("ISO9660 Boot Record found\n"); |
573 | udf_debug("ISO9660 Boot Record found\n"); | 568 | break; |
574 | break; | 569 | case 1: |
575 | case 1: | 570 | udf_debug |
576 | udf_debug("ISO9660 Primary Volume Descriptor found\n"); | 571 | ("ISO9660 Primary Volume Descriptor found\n"); |
577 | break; | 572 | break; |
578 | case 2: | 573 | case 2: |
579 | udf_debug("ISO9660 Supplementary Volume Descriptor found\n"); | 574 | udf_debug |
580 | break; | 575 | ("ISO9660 Supplementary Volume Descriptor found\n"); |
581 | case 3: | 576 | break; |
582 | udf_debug("ISO9660 Volume Partition Descriptor found\n"); | 577 | case 3: |
583 | break; | 578 | udf_debug |
584 | case 255: | 579 | ("ISO9660 Volume Partition Descriptor found\n"); |
585 | udf_debug("ISO9660 Volume Descriptor Set Terminator found\n"); | 580 | break; |
586 | break; | 581 | case 255: |
587 | default: | 582 | udf_debug |
588 | udf_debug("ISO9660 VRS (%u) found\n", vsd->structType); | 583 | ("ISO9660 Volume Descriptor Set Terminator found\n"); |
589 | break; | 584 | break; |
585 | default: | ||
586 | udf_debug("ISO9660 VRS (%u) found\n", | ||
587 | vsd->structType); | ||
588 | break; | ||
590 | } | 589 | } |
591 | } | 590 | } else |
592 | else if (!strncmp(vsd->stdIdent, VSD_STD_ID_BEA01, VSD_STD_ID_LEN)) | 591 | if (!strncmp |
593 | { | 592 | (vsd->stdIdent, VSD_STD_ID_BEA01, VSD_STD_ID_LEN)) { |
594 | } | 593 | } else |
595 | else if (!strncmp(vsd->stdIdent, VSD_STD_ID_TEA01, VSD_STD_ID_LEN)) | 594 | if (!strncmp |
596 | { | 595 | (vsd->stdIdent, VSD_STD_ID_TEA01, VSD_STD_ID_LEN)) { |
597 | brelse(bh); | 596 | brelse(bh); |
598 | break; | 597 | break; |
599 | } | 598 | } else |
600 | else if (!strncmp(vsd->stdIdent, VSD_STD_ID_NSR02, VSD_STD_ID_LEN)) | 599 | if (!strncmp |
601 | { | 600 | (vsd->stdIdent, VSD_STD_ID_NSR02, VSD_STD_ID_LEN)) { |
602 | nsr02 = sector; | 601 | nsr02 = sector; |
603 | } | 602 | } else |
604 | else if (!strncmp(vsd->stdIdent, VSD_STD_ID_NSR03, VSD_STD_ID_LEN)) | 603 | if (!strncmp |
605 | { | 604 | (vsd->stdIdent, VSD_STD_ID_NSR03, VSD_STD_ID_LEN)) { |
606 | nsr03 = sector; | 605 | nsr03 = sector; |
607 | } | 606 | } |
608 | brelse(bh); | 607 | brelse(bh); |
@@ -635,8 +634,7 @@ udf_vrs(struct super_block *sb, int silent) | |||
635 | * July 1, 1997 - Andrew E. Mileski | 634 | * July 1, 1997 - Andrew E. Mileski |
636 | * Written, tested, and released. | 635 | * Written, tested, and released. |
637 | */ | 636 | */ |
638 | static void | 637 | static void udf_find_anchor(struct super_block *sb) |
639 | udf_find_anchor(struct super_block *sb) | ||
640 | { | 638 | { |
641 | int lastblock = UDF_SB_LASTBLOCK(sb); | 639 | int lastblock = UDF_SB_LASTBLOCK(sb); |
642 | struct buffer_head *bh = NULL; | 640 | struct buffer_head *bh = NULL; |
@@ -644,13 +642,13 @@ udf_find_anchor(struct super_block *sb) | |||
644 | uint32_t location; | 642 | uint32_t location; |
645 | int i; | 643 | int i; |
646 | 644 | ||
647 | if (lastblock) | 645 | if (lastblock) { |
648 | { | ||
649 | int varlastblock = udf_variable_to_fixed(lastblock); | 646 | int varlastblock = udf_variable_to_fixed(lastblock); |
650 | int last[] = { lastblock, lastblock - 2, | 647 | int last[] = { lastblock, lastblock - 2, |
651 | lastblock - 150, lastblock - 152, | 648 | lastblock - 150, lastblock - 152, |
652 | varlastblock, varlastblock - 2, | 649 | varlastblock, varlastblock - 2, |
653 | varlastblock - 150, varlastblock - 152 }; | 650 | varlastblock - 150, varlastblock - 152 |
651 | }; | ||
654 | 652 | ||
655 | lastblock = 0; | 653 | lastblock = 0; |
656 | 654 | ||
@@ -663,90 +661,103 @@ udf_find_anchor(struct super_block *sb) | |||
663 | * however, if the disc isn't closed, it could be 512 */ | 661 | * however, if the disc isn't closed, it could be 512 */ |
664 | 662 | ||
665 | for (i = 0; !lastblock && i < ARRAY_SIZE(last); i++) { | 663 | for (i = 0; !lastblock && i < ARRAY_SIZE(last); i++) { |
666 | if (last[i] < 0 || !(bh = sb_bread(sb, last[i]))) | 664 | if (last[i] < 0 || !(bh = sb_bread(sb, last[i]))) { |
667 | { | ||
668 | ident = location = 0; | 665 | ident = location = 0; |
669 | } | 666 | } else { |
670 | else | 667 | ident = |
671 | { | 668 | le16_to_cpu(((tag *) bh->b_data)->tagIdent); |
672 | ident = le16_to_cpu(((tag *)bh->b_data)->tagIdent); | 669 | location = |
673 | location = le32_to_cpu(((tag *)bh->b_data)->tagLocation); | 670 | le32_to_cpu(((tag *) bh->b_data)-> |
671 | tagLocation); | ||
674 | brelse(bh); | 672 | brelse(bh); |
675 | } | 673 | } |
676 | 674 | ||
677 | if (ident == TAG_IDENT_AVDP) | 675 | if (ident == TAG_IDENT_AVDP) { |
678 | { | 676 | if (location == last[i] - UDF_SB_SESSION(sb)) { |
679 | if (location == last[i] - UDF_SB_SESSION(sb)) | 677 | lastblock = UDF_SB_ANCHOR(sb)[0] = |
680 | { | 678 | last[i] - UDF_SB_SESSION(sb); |
681 | lastblock = UDF_SB_ANCHOR(sb)[0] = last[i] - UDF_SB_SESSION(sb); | 679 | UDF_SB_ANCHOR(sb)[1] = |
682 | UDF_SB_ANCHOR(sb)[1] = last[i] - 256 - UDF_SB_SESSION(sb); | 680 | last[i] - 256 - UDF_SB_SESSION(sb); |
683 | } | 681 | } else if (location == |
684 | else if (location == udf_variable_to_fixed(last[i]) - UDF_SB_SESSION(sb)) | 682 | udf_variable_to_fixed(last[i]) - |
685 | { | 683 | UDF_SB_SESSION(sb)) { |
686 | UDF_SET_FLAG(sb, UDF_FLAG_VARCONV); | 684 | UDF_SET_FLAG(sb, UDF_FLAG_VARCONV); |
687 | lastblock = UDF_SB_ANCHOR(sb)[0] = udf_variable_to_fixed(last[i]) - UDF_SB_SESSION(sb); | 685 | lastblock = UDF_SB_ANCHOR(sb)[0] = |
688 | UDF_SB_ANCHOR(sb)[1] = lastblock - 256 - UDF_SB_SESSION(sb); | 686 | udf_variable_to_fixed(last[i]) - |
689 | } | 687 | UDF_SB_SESSION(sb); |
690 | else | 688 | UDF_SB_ANCHOR(sb)[1] = |
691 | udf_debug("Anchor found at block %d, location mismatch %d.\n", | 689 | lastblock - 256 - |
692 | last[i], location); | 690 | UDF_SB_SESSION(sb); |
693 | } | 691 | } else |
694 | else if (ident == TAG_IDENT_FE || ident == TAG_IDENT_EFE) | 692 | udf_debug |
695 | { | 693 | ("Anchor found at block %d, location mismatch %d.\n", |
694 | last[i], location); | ||
695 | } else if (ident == TAG_IDENT_FE | ||
696 | || ident == TAG_IDENT_EFE) { | ||
696 | lastblock = last[i]; | 697 | lastblock = last[i]; |
697 | UDF_SB_ANCHOR(sb)[3] = 512; | 698 | UDF_SB_ANCHOR(sb)[3] = 512; |
698 | } | 699 | } else { |
699 | else | 700 | if (last[i] < 256 |
700 | { | 701 | || !(bh = sb_bread(sb, last[i] - 256))) { |
701 | if (last[i] < 256 || !(bh = sb_bread(sb, last[i] - 256))) | ||
702 | { | ||
703 | ident = location = 0; | 702 | ident = location = 0; |
704 | } | 703 | } else { |
705 | else | 704 | ident = |
706 | { | 705 | le16_to_cpu(((tag *) bh->b_data)-> |
707 | ident = le16_to_cpu(((tag *)bh->b_data)->tagIdent); | 706 | tagIdent); |
708 | location = le32_to_cpu(((tag *)bh->b_data)->tagLocation); | 707 | location = |
708 | le32_to_cpu(((tag *) bh->b_data)-> | ||
709 | tagLocation); | ||
709 | brelse(bh); | 710 | brelse(bh); |
710 | } | 711 | } |
711 | 712 | ||
712 | if (ident == TAG_IDENT_AVDP && | 713 | if (ident == TAG_IDENT_AVDP && |
713 | location == last[i] - 256 - UDF_SB_SESSION(sb)) | 714 | location == |
714 | { | 715 | last[i] - 256 - UDF_SB_SESSION(sb)) { |
715 | lastblock = last[i]; | 716 | lastblock = last[i]; |
716 | UDF_SB_ANCHOR(sb)[1] = last[i] - 256; | 717 | UDF_SB_ANCHOR(sb)[1] = last[i] - 256; |
717 | } | 718 | } else { |
718 | else | 719 | if (last[i] < 312 + UDF_SB_SESSION(sb) |
719 | { | 720 | || !(bh = |
720 | if (last[i] < 312 + UDF_SB_SESSION(sb) || !(bh = sb_bread(sb, last[i] - 312 - UDF_SB_SESSION(sb)))) | 721 | sb_bread(sb, |
722 | last[i] - 312 - | ||
723 | UDF_SB_SESSION(sb)))) | ||
721 | { | 724 | { |
722 | ident = location = 0; | 725 | ident = location = 0; |
723 | } | 726 | } else { |
724 | else | 727 | ident = |
725 | { | 728 | le16_to_cpu(((tag *) bh-> |
726 | ident = le16_to_cpu(((tag *)bh->b_data)->tagIdent); | 729 | b_data)-> |
727 | location = le32_to_cpu(((tag *)bh->b_data)->tagLocation); | 730 | tagIdent); |
731 | location = | ||
732 | le32_to_cpu(((tag *) bh-> | ||
733 | b_data)-> | ||
734 | tagLocation); | ||
728 | brelse(bh); | 735 | brelse(bh); |
729 | } | 736 | } |
730 | 737 | ||
731 | if (ident == TAG_IDENT_AVDP && | 738 | if (ident == TAG_IDENT_AVDP && |
732 | location == udf_variable_to_fixed(last[i]) - 256) | 739 | location == |
733 | { | 740 | udf_variable_to_fixed(last[i]) - |
734 | UDF_SET_FLAG(sb, UDF_FLAG_VARCONV); | 741 | 256) { |
735 | lastblock = udf_variable_to_fixed(last[i]); | 742 | UDF_SET_FLAG(sb, |
736 | UDF_SB_ANCHOR(sb)[1] = lastblock - 256; | 743 | UDF_FLAG_VARCONV); |
744 | lastblock = | ||
745 | udf_variable_to_fixed(last | ||
746 | [i]); | ||
747 | UDF_SB_ANCHOR(sb)[1] = | ||
748 | lastblock - 256; | ||
737 | } | 749 | } |
738 | } | 750 | } |
739 | } | 751 | } |
740 | } | 752 | } |
741 | } | 753 | } |
742 | 754 | ||
743 | if (!lastblock) | 755 | if (!lastblock) { |
744 | { | ||
745 | /* We havn't found the lastblock. check 312 */ | 756 | /* We havn't found the lastblock. check 312 */ |
746 | if ((bh = sb_bread(sb, 312 + UDF_SB_SESSION(sb)))) | 757 | if ((bh = sb_bread(sb, 312 + UDF_SB_SESSION(sb)))) { |
747 | { | 758 | ident = le16_to_cpu(((tag *) bh->b_data)->tagIdent); |
748 | ident = le16_to_cpu(((tag *)bh->b_data)->tagIdent); | 759 | location = |
749 | location = le32_to_cpu(((tag *)bh->b_data)->tagLocation); | 760 | le32_to_cpu(((tag *) bh->b_data)->tagLocation); |
750 | brelse(bh); | 761 | brelse(bh); |
751 | 762 | ||
752 | if (ident == TAG_IDENT_AVDP && location == 256) | 763 | if (ident == TAG_IDENT_AVDP && location == 256) |
@@ -755,18 +766,19 @@ udf_find_anchor(struct super_block *sb) | |||
755 | } | 766 | } |
756 | 767 | ||
757 | for (i = 0; i < ARRAY_SIZE(UDF_SB_ANCHOR(sb)); i++) { | 768 | for (i = 0; i < ARRAY_SIZE(UDF_SB_ANCHOR(sb)); i++) { |
758 | if (UDF_SB_ANCHOR(sb)[i]) | 769 | if (UDF_SB_ANCHOR(sb)[i]) { |
759 | { | ||
760 | if (!(bh = udf_read_tagged(sb, | 770 | if (!(bh = udf_read_tagged(sb, |
761 | UDF_SB_ANCHOR(sb)[i], UDF_SB_ANCHOR(sb)[i], &ident))) | 771 | UDF_SB_ANCHOR(sb)[i], |
762 | { | 772 | UDF_SB_ANCHOR(sb)[i], |
773 | &ident))) { | ||
763 | UDF_SB_ANCHOR(sb)[i] = 0; | 774 | UDF_SB_ANCHOR(sb)[i] = 0; |
764 | } | 775 | } else { |
765 | else | ||
766 | { | ||
767 | brelse(bh); | 776 | brelse(bh); |
768 | if ((ident != TAG_IDENT_AVDP) && (i || | 777 | if ((ident != TAG_IDENT_AVDP) && (i || |
769 | (ident != TAG_IDENT_FE && ident != TAG_IDENT_EFE))) | 778 | (ident != |
779 | TAG_IDENT_FE | ||
780 | && ident != | ||
781 | TAG_IDENT_EFE))) | ||
770 | { | 782 | { |
771 | UDF_SB_ANCHOR(sb)[i] = 0; | 783 | UDF_SB_ANCHOR(sb)[i] = 0; |
772 | } | 784 | } |
@@ -777,72 +789,75 @@ udf_find_anchor(struct super_block *sb) | |||
777 | UDF_SB_LASTBLOCK(sb) = lastblock; | 789 | UDF_SB_LASTBLOCK(sb) = lastblock; |
778 | } | 790 | } |
779 | 791 | ||
780 | static int | 792 | static int |
781 | udf_find_fileset(struct super_block *sb, kernel_lb_addr *fileset, kernel_lb_addr *root) | 793 | udf_find_fileset(struct super_block *sb, kernel_lb_addr * fileset, |
794 | kernel_lb_addr * root) | ||
782 | { | 795 | { |
783 | struct buffer_head *bh = NULL; | 796 | struct buffer_head *bh = NULL; |
784 | long lastblock; | 797 | long lastblock; |
785 | uint16_t ident; | 798 | uint16_t ident; |
786 | 799 | ||
787 | if (fileset->logicalBlockNum != 0xFFFFFFFF || | 800 | if (fileset->logicalBlockNum != 0xFFFFFFFF || |
788 | fileset->partitionReferenceNum != 0xFFFF) | 801 | fileset->partitionReferenceNum != 0xFFFF) { |
789 | { | ||
790 | bh = udf_read_ptagged(sb, *fileset, 0, &ident); | 802 | bh = udf_read_ptagged(sb, *fileset, 0, &ident); |
791 | 803 | ||
792 | if (!bh) | 804 | if (!bh) |
793 | return 1; | 805 | return 1; |
794 | else if (ident != TAG_IDENT_FSD) | 806 | else if (ident != TAG_IDENT_FSD) { |
795 | { | ||
796 | brelse(bh); | 807 | brelse(bh); |
797 | return 1; | 808 | return 1; |
798 | } | 809 | } |
799 | 810 | ||
800 | } | 811 | } |
801 | 812 | ||
802 | if (!bh) /* Search backwards through the partitions */ | 813 | if (!bh) { /* Search backwards through the partitions */ |
803 | { | ||
804 | kernel_lb_addr newfileset; | 814 | kernel_lb_addr newfileset; |
805 | 815 | ||
806 | return 1; | 816 | return 1; |
807 | 817 | ||
808 | for (newfileset.partitionReferenceNum=UDF_SB_NUMPARTS(sb)-1; | 818 | for (newfileset.partitionReferenceNum = UDF_SB_NUMPARTS(sb) - 1; |
809 | (newfileset.partitionReferenceNum != 0xFFFF && | 819 | (newfileset.partitionReferenceNum != 0xFFFF && |
810 | fileset->logicalBlockNum == 0xFFFFFFFF && | 820 | fileset->logicalBlockNum == 0xFFFFFFFF && |
811 | fileset->partitionReferenceNum == 0xFFFF); | 821 | fileset->partitionReferenceNum == 0xFFFF); |
812 | newfileset.partitionReferenceNum--) | 822 | newfileset.partitionReferenceNum--) { |
813 | { | 823 | lastblock = |
814 | lastblock = UDF_SB_PARTLEN(sb, newfileset.partitionReferenceNum); | 824 | UDF_SB_PARTLEN(sb, |
825 | newfileset.partitionReferenceNum); | ||
815 | newfileset.logicalBlockNum = 0; | 826 | newfileset.logicalBlockNum = 0; |
816 | 827 | ||
817 | do | 828 | do { |
818 | { | 829 | bh = udf_read_ptagged(sb, newfileset, 0, |
819 | bh = udf_read_ptagged(sb, newfileset, 0, &ident); | 830 | &ident); |
820 | if (!bh) | 831 | if (!bh) { |
821 | { | 832 | newfileset.logicalBlockNum++; |
822 | newfileset.logicalBlockNum ++; | ||
823 | continue; | 833 | continue; |
824 | } | 834 | } |
825 | 835 | ||
826 | switch (ident) | 836 | switch (ident) { |
827 | { | 837 | case TAG_IDENT_SBD: |
828 | case TAG_IDENT_SBD: | ||
829 | { | 838 | { |
830 | struct spaceBitmapDesc *sp; | 839 | struct spaceBitmapDesc *sp; |
831 | sp = (struct spaceBitmapDesc *)bh->b_data; | 840 | sp = (struct spaceBitmapDesc *) |
832 | newfileset.logicalBlockNum += 1 + | 841 | bh->b_data; |
833 | ((le32_to_cpu(sp->numOfBytes) + sizeof(struct spaceBitmapDesc) - 1) | 842 | newfileset.logicalBlockNum += |
834 | >> sb->s_blocksize_bits); | 843 | 1 + |
844 | ((le32_to_cpu | ||
845 | (sp->numOfBytes) + | ||
846 | sizeof(struct | ||
847 | spaceBitmapDesc) - | ||
848 | 1) | ||
849 | >> sb->s_blocksize_bits); | ||
835 | brelse(bh); | 850 | brelse(bh); |
836 | break; | 851 | break; |
837 | } | 852 | } |
838 | case TAG_IDENT_FSD: | 853 | case TAG_IDENT_FSD: |
839 | { | 854 | { |
840 | *fileset = newfileset; | 855 | *fileset = newfileset; |
841 | break; | 856 | break; |
842 | } | 857 | } |
843 | default: | 858 | default: |
844 | { | 859 | { |
845 | newfileset.logicalBlockNum ++; | 860 | newfileset.logicalBlockNum++; |
846 | brelse(bh); | 861 | brelse(bh); |
847 | bh = NULL; | 862 | bh = NULL; |
848 | break; | 863 | break; |
@@ -850,16 +865,16 @@ udf_find_fileset(struct super_block *sb, kernel_lb_addr *fileset, kernel_lb_addr | |||
850 | } | 865 | } |
851 | } | 866 | } |
852 | while (newfileset.logicalBlockNum < lastblock && | 867 | while (newfileset.logicalBlockNum < lastblock && |
853 | fileset->logicalBlockNum == 0xFFFFFFFF && | 868 | fileset->logicalBlockNum == 0xFFFFFFFF && |
854 | fileset->partitionReferenceNum == 0xFFFF); | 869 | fileset->partitionReferenceNum == 0xFFFF); |
855 | } | 870 | } |
856 | } | 871 | } |
857 | 872 | ||
858 | if ((fileset->logicalBlockNum != 0xFFFFFFFF || | 873 | if ((fileset->logicalBlockNum != 0xFFFFFFFF || |
859 | fileset->partitionReferenceNum != 0xFFFF) && bh) | 874 | fileset->partitionReferenceNum != 0xFFFF) && bh) { |
860 | { | ||
861 | udf_debug("Fileset at block=%d, partition=%d\n", | 875 | udf_debug("Fileset at block=%d, partition=%d\n", |
862 | fileset->logicalBlockNum, fileset->partitionReferenceNum); | 876 | fileset->logicalBlockNum, |
877 | fileset->partitionReferenceNum); | ||
863 | 878 | ||
864 | UDF_SB_PARTITION(sb) = fileset->partitionReferenceNum; | 879 | UDF_SB_PARTITION(sb) = fileset->partitionReferenceNum; |
865 | udf_load_fileset(sb, bh, root); | 880 | udf_load_fileset(sb, bh, root); |
@@ -869,8 +884,7 @@ udf_find_fileset(struct super_block *sb, kernel_lb_addr *fileset, kernel_lb_addr | |||
869 | return 1; | 884 | return 1; |
870 | } | 885 | } |
871 | 886 | ||
872 | static void | 887 | static void udf_load_pvoldesc(struct super_block *sb, struct buffer_head *bh) |
873 | udf_load_pvoldesc(struct super_block *sb, struct buffer_head *bh) | ||
874 | { | 888 | { |
875 | struct primaryVolDesc *pvoldesc; | 889 | struct primaryVolDesc *pvoldesc; |
876 | time_t recording; | 890 | time_t recording; |
@@ -880,37 +894,35 @@ udf_load_pvoldesc(struct super_block *sb, struct buffer_head *bh) | |||
880 | 894 | ||
881 | pvoldesc = (struct primaryVolDesc *)bh->b_data; | 895 | pvoldesc = (struct primaryVolDesc *)bh->b_data; |
882 | 896 | ||
883 | if ( udf_stamp_to_time(&recording, &recording_usec, | 897 | if (udf_stamp_to_time(&recording, &recording_usec, |
884 | lets_to_cpu(pvoldesc->recordingDateAndTime)) ) | 898 | lets_to_cpu(pvoldesc->recordingDateAndTime))) { |
885 | { | ||
886 | kernel_timestamp ts; | 899 | kernel_timestamp ts; |
887 | ts = lets_to_cpu(pvoldesc->recordingDateAndTime); | 900 | ts = lets_to_cpu(pvoldesc->recordingDateAndTime); |
888 | udf_debug("recording time %ld/%ld, %04u/%02u/%02u %02u:%02u (%x)\n", | 901 | udf_debug |
889 | recording, recording_usec, | 902 | ("recording time %ld/%ld, %04u/%02u/%02u %02u:%02u (%x)\n", |
890 | ts.year, ts.month, ts.day, ts.hour, ts.minute, ts.typeAndTimezone); | 903 | recording, recording_usec, ts.year, ts.month, ts.day, |
904 | ts.hour, ts.minute, ts.typeAndTimezone); | ||
891 | UDF_SB_RECORDTIME(sb).tv_sec = recording; | 905 | UDF_SB_RECORDTIME(sb).tv_sec = recording; |
892 | UDF_SB_RECORDTIME(sb).tv_nsec = recording_usec * 1000; | 906 | UDF_SB_RECORDTIME(sb).tv_nsec = recording_usec * 1000; |
893 | } | 907 | } |
894 | 908 | ||
895 | if ( !udf_build_ustr(&instr, pvoldesc->volIdent, 32) ) | 909 | if (!udf_build_ustr(&instr, pvoldesc->volIdent, 32)) { |
896 | { | 910 | if (udf_CS0toUTF8(&outstr, &instr)) { |
897 | if (udf_CS0toUTF8(&outstr, &instr)) | 911 | strncpy(UDF_SB_VOLIDENT(sb), outstr.u_name, |
898 | { | ||
899 | strncpy( UDF_SB_VOLIDENT(sb), outstr.u_name, | ||
900 | outstr.u_len > 31 ? 31 : outstr.u_len); | 912 | outstr.u_len > 31 ? 31 : outstr.u_len); |
901 | udf_debug("volIdent[] = '%s'\n", UDF_SB_VOLIDENT(sb)); | 913 | udf_debug("volIdent[] = '%s'\n", UDF_SB_VOLIDENT(sb)); |
902 | } | 914 | } |
903 | } | 915 | } |
904 | 916 | ||
905 | if ( !udf_build_ustr(&instr, pvoldesc->volSetIdent, 128) ) | 917 | if (!udf_build_ustr(&instr, pvoldesc->volSetIdent, 128)) { |
906 | { | ||
907 | if (udf_CS0toUTF8(&outstr, &instr)) | 918 | if (udf_CS0toUTF8(&outstr, &instr)) |
908 | udf_debug("volSetIdent[] = '%s'\n", outstr.u_name); | 919 | udf_debug("volSetIdent[] = '%s'\n", outstr.u_name); |
909 | } | 920 | } |
910 | } | 921 | } |
911 | 922 | ||
912 | static void | 923 | static void |
913 | udf_load_fileset(struct super_block *sb, struct buffer_head *bh, kernel_lb_addr *root) | 924 | udf_load_fileset(struct super_block *sb, struct buffer_head *bh, |
925 | kernel_lb_addr * root) | ||
914 | { | 926 | { |
915 | struct fileSetDesc *fset; | 927 | struct fileSetDesc *fset; |
916 | 928 | ||
@@ -920,109 +932,154 @@ udf_load_fileset(struct super_block *sb, struct buffer_head *bh, kernel_lb_addr | |||
920 | 932 | ||
921 | UDF_SB_SERIALNUM(sb) = le16_to_cpu(fset->descTag.tagSerialNum); | 933 | UDF_SB_SERIALNUM(sb) = le16_to_cpu(fset->descTag.tagSerialNum); |
922 | 934 | ||
923 | udf_debug("Rootdir at block=%d, partition=%d\n", | 935 | udf_debug("Rootdir at block=%d, partition=%d\n", |
924 | root->logicalBlockNum, root->partitionReferenceNum); | 936 | root->logicalBlockNum, root->partitionReferenceNum); |
925 | } | 937 | } |
926 | 938 | ||
927 | static void | 939 | static void udf_load_partdesc(struct super_block *sb, struct buffer_head *bh) |
928 | udf_load_partdesc(struct super_block *sb, struct buffer_head *bh) | ||
929 | { | 940 | { |
930 | struct partitionDesc *p; | 941 | struct partitionDesc *p; |
931 | int i; | 942 | int i; |
932 | 943 | ||
933 | p = (struct partitionDesc *)bh->b_data; | 944 | p = (struct partitionDesc *)bh->b_data; |
934 | 945 | ||
935 | for (i=0; i<UDF_SB_NUMPARTS(sb); i++) | 946 | for (i = 0; i < UDF_SB_NUMPARTS(sb); i++) { |
936 | { | 947 | udf_debug("Searching map: (%d == %d)\n", |
937 | udf_debug("Searching map: (%d == %d)\n", | 948 | UDF_SB_PARTMAPS(sb)[i].s_partition_num, |
938 | UDF_SB_PARTMAPS(sb)[i].s_partition_num, le16_to_cpu(p->partitionNumber)); | 949 | le16_to_cpu(p->partitionNumber)); |
939 | if (UDF_SB_PARTMAPS(sb)[i].s_partition_num == le16_to_cpu(p->partitionNumber)) | 950 | if (UDF_SB_PARTMAPS(sb)[i].s_partition_num == |
940 | { | 951 | le16_to_cpu(p->partitionNumber)) { |
941 | UDF_SB_PARTLEN(sb,i) = le32_to_cpu(p->partitionLength); /* blocks */ | 952 | UDF_SB_PARTLEN(sb, i) = le32_to_cpu(p->partitionLength); /* blocks */ |
942 | UDF_SB_PARTROOT(sb,i) = le32_to_cpu(p->partitionStartingLocation); | 953 | UDF_SB_PARTROOT(sb, i) = |
943 | if (le32_to_cpu(p->accessType) == PD_ACCESS_TYPE_READ_ONLY) | 954 | le32_to_cpu(p->partitionStartingLocation); |
944 | UDF_SB_PARTFLAGS(sb,i) |= UDF_PART_FLAG_READ_ONLY; | 955 | if (le32_to_cpu(p->accessType) == |
945 | if (le32_to_cpu(p->accessType) == PD_ACCESS_TYPE_WRITE_ONCE) | 956 | PD_ACCESS_TYPE_READ_ONLY) |
946 | UDF_SB_PARTFLAGS(sb,i) |= UDF_PART_FLAG_WRITE_ONCE; | 957 | UDF_SB_PARTFLAGS(sb, i) |= |
947 | if (le32_to_cpu(p->accessType) == PD_ACCESS_TYPE_REWRITABLE) | 958 | UDF_PART_FLAG_READ_ONLY; |
948 | UDF_SB_PARTFLAGS(sb,i) |= UDF_PART_FLAG_REWRITABLE; | 959 | if (le32_to_cpu(p->accessType) == |
949 | if (le32_to_cpu(p->accessType) == PD_ACCESS_TYPE_OVERWRITABLE) | 960 | PD_ACCESS_TYPE_WRITE_ONCE) |
950 | UDF_SB_PARTFLAGS(sb,i) |= UDF_PART_FLAG_OVERWRITABLE; | 961 | UDF_SB_PARTFLAGS(sb, i) |= |
951 | 962 | UDF_PART_FLAG_WRITE_ONCE; | |
952 | if (!strcmp(p->partitionContents.ident, PD_PARTITION_CONTENTS_NSR02) || | 963 | if (le32_to_cpu(p->accessType) == |
953 | !strcmp(p->partitionContents.ident, PD_PARTITION_CONTENTS_NSR03)) | 964 | PD_ACCESS_TYPE_REWRITABLE) |
954 | { | 965 | UDF_SB_PARTFLAGS(sb, i) |= |
966 | UDF_PART_FLAG_REWRITABLE; | ||
967 | if (le32_to_cpu(p->accessType) == | ||
968 | PD_ACCESS_TYPE_OVERWRITABLE) | ||
969 | UDF_SB_PARTFLAGS(sb, i) |= | ||
970 | UDF_PART_FLAG_OVERWRITABLE; | ||
971 | |||
972 | if (!strcmp | ||
973 | (p->partitionContents.ident, | ||
974 | PD_PARTITION_CONTENTS_NSR02) | ||
975 | || !strcmp(p->partitionContents.ident, | ||
976 | PD_PARTITION_CONTENTS_NSR03)) { | ||
955 | struct partitionHeaderDesc *phd; | 977 | struct partitionHeaderDesc *phd; |
956 | 978 | ||
957 | phd = (struct partitionHeaderDesc *)(p->partitionContentsUse); | 979 | phd = |
958 | if (phd->unallocSpaceTable.extLength) | 980 | (struct partitionHeaderDesc *)(p-> |
959 | { | 981 | partitionContentsUse); |
960 | kernel_lb_addr loc = { le32_to_cpu(phd->unallocSpaceTable.extPosition), i }; | 982 | if (phd->unallocSpaceTable.extLength) { |
961 | 983 | kernel_lb_addr loc = | |
962 | UDF_SB_PARTMAPS(sb)[i].s_uspace.s_table = | 984 | { le32_to_cpu(phd-> |
963 | udf_iget(sb, loc); | 985 | unallocSpaceTable. |
964 | UDF_SB_PARTFLAGS(sb,i) |= UDF_PART_FLAG_UNALLOC_TABLE; | 986 | extPosition), i }; |
965 | udf_debug("unallocSpaceTable (part %d) @ %ld\n", | 987 | |
966 | i, UDF_SB_PARTMAPS(sb)[i].s_uspace.s_table->i_ino); | 988 | UDF_SB_PARTMAPS(sb)[i].s_uspace. |
989 | s_table = udf_iget(sb, loc); | ||
990 | UDF_SB_PARTFLAGS(sb, i) |= | ||
991 | UDF_PART_FLAG_UNALLOC_TABLE; | ||
992 | udf_debug | ||
993 | ("unallocSpaceTable (part %d) @ %ld\n", | ||
994 | i, | ||
995 | UDF_SB_PARTMAPS(sb)[i].s_uspace. | ||
996 | s_table->i_ino); | ||
967 | } | 997 | } |
968 | if (phd->unallocSpaceBitmap.extLength) | 998 | if (phd->unallocSpaceBitmap.extLength) { |
969 | { | ||
970 | UDF_SB_ALLOC_BITMAP(sb, i, s_uspace); | 999 | UDF_SB_ALLOC_BITMAP(sb, i, s_uspace); |
971 | if (UDF_SB_PARTMAPS(sb)[i].s_uspace.s_bitmap != NULL) | 1000 | if (UDF_SB_PARTMAPS(sb)[i].s_uspace. |
972 | { | 1001 | s_bitmap != NULL) { |
973 | UDF_SB_PARTMAPS(sb)[i].s_uspace.s_bitmap->s_extLength = | 1002 | UDF_SB_PARTMAPS(sb)[i].s_uspace. |
974 | le32_to_cpu(phd->unallocSpaceBitmap.extLength); | 1003 | s_bitmap->s_extLength = |
975 | UDF_SB_PARTMAPS(sb)[i].s_uspace.s_bitmap->s_extPosition = | 1004 | le32_to_cpu(phd-> |
976 | le32_to_cpu(phd->unallocSpaceBitmap.extPosition); | 1005 | unallocSpaceBitmap. |
977 | UDF_SB_PARTFLAGS(sb,i) |= UDF_PART_FLAG_UNALLOC_BITMAP; | 1006 | extLength); |
978 | udf_debug("unallocSpaceBitmap (part %d) @ %d\n", | 1007 | UDF_SB_PARTMAPS(sb)[i].s_uspace. |
979 | i, UDF_SB_PARTMAPS(sb)[i].s_uspace.s_bitmap->s_extPosition); | 1008 | s_bitmap->s_extPosition = |
1009 | le32_to_cpu(phd-> | ||
1010 | unallocSpaceBitmap. | ||
1011 | extPosition); | ||
1012 | UDF_SB_PARTFLAGS(sb, i) |= | ||
1013 | UDF_PART_FLAG_UNALLOC_BITMAP; | ||
1014 | udf_debug | ||
1015 | ("unallocSpaceBitmap (part %d) @ %d\n", | ||
1016 | i, | ||
1017 | UDF_SB_PARTMAPS(sb)[i]. | ||
1018 | s_uspace.s_bitmap-> | ||
1019 | s_extPosition); | ||
980 | } | 1020 | } |
981 | } | 1021 | } |
982 | if (phd->partitionIntegrityTable.extLength) | 1022 | if (phd->partitionIntegrityTable.extLength) |
983 | udf_debug("partitionIntegrityTable (part %d)\n", i); | 1023 | udf_debug |
984 | if (phd->freedSpaceTable.extLength) | 1024 | ("partitionIntegrityTable (part %d)\n", |
985 | { | 1025 | i); |
986 | kernel_lb_addr loc = { le32_to_cpu(phd->freedSpaceTable.extPosition), i }; | 1026 | if (phd->freedSpaceTable.extLength) { |
987 | 1027 | kernel_lb_addr loc = | |
988 | UDF_SB_PARTMAPS(sb)[i].s_fspace.s_table = | 1028 | { le32_to_cpu(phd->freedSpaceTable. |
989 | udf_iget(sb, loc); | 1029 | extPosition), i }; |
990 | UDF_SB_PARTFLAGS(sb,i) |= UDF_PART_FLAG_FREED_TABLE; | 1030 | |
991 | udf_debug("freedSpaceTable (part %d) @ %ld\n", | 1031 | UDF_SB_PARTMAPS(sb)[i].s_fspace. |
992 | i, UDF_SB_PARTMAPS(sb)[i].s_fspace.s_table->i_ino); | 1032 | s_table = udf_iget(sb, loc); |
1033 | UDF_SB_PARTFLAGS(sb, i) |= | ||
1034 | UDF_PART_FLAG_FREED_TABLE; | ||
1035 | udf_debug | ||
1036 | ("freedSpaceTable (part %d) @ %ld\n", | ||
1037 | i, | ||
1038 | UDF_SB_PARTMAPS(sb)[i].s_fspace. | ||
1039 | s_table->i_ino); | ||
993 | } | 1040 | } |
994 | if (phd->freedSpaceBitmap.extLength) | 1041 | if (phd->freedSpaceBitmap.extLength) { |
995 | { | ||
996 | UDF_SB_ALLOC_BITMAP(sb, i, s_fspace); | 1042 | UDF_SB_ALLOC_BITMAP(sb, i, s_fspace); |
997 | if (UDF_SB_PARTMAPS(sb)[i].s_fspace.s_bitmap != NULL) | 1043 | if (UDF_SB_PARTMAPS(sb)[i].s_fspace. |
998 | { | 1044 | s_bitmap != NULL) { |
999 | UDF_SB_PARTMAPS(sb)[i].s_fspace.s_bitmap->s_extLength = | 1045 | UDF_SB_PARTMAPS(sb)[i].s_fspace. |
1000 | le32_to_cpu(phd->freedSpaceBitmap.extLength); | 1046 | s_bitmap->s_extLength = |
1001 | UDF_SB_PARTMAPS(sb)[i].s_fspace.s_bitmap->s_extPosition = | 1047 | le32_to_cpu(phd-> |
1002 | le32_to_cpu(phd->freedSpaceBitmap.extPosition); | 1048 | freedSpaceBitmap. |
1003 | UDF_SB_PARTFLAGS(sb,i) |= UDF_PART_FLAG_FREED_BITMAP; | 1049 | extLength); |
1004 | udf_debug("freedSpaceBitmap (part %d) @ %d\n", | 1050 | UDF_SB_PARTMAPS(sb)[i].s_fspace. |
1005 | i, UDF_SB_PARTMAPS(sb)[i].s_fspace.s_bitmap->s_extPosition); | 1051 | s_bitmap->s_extPosition = |
1052 | le32_to_cpu(phd-> | ||
1053 | freedSpaceBitmap. | ||
1054 | extPosition); | ||
1055 | UDF_SB_PARTFLAGS(sb, i) |= | ||
1056 | UDF_PART_FLAG_FREED_BITMAP; | ||
1057 | udf_debug | ||
1058 | ("freedSpaceBitmap (part %d) @ %d\n", | ||
1059 | i, | ||
1060 | UDF_SB_PARTMAPS(sb)[i]. | ||
1061 | s_fspace.s_bitmap-> | ||
1062 | s_extPosition); | ||
1006 | } | 1063 | } |
1007 | } | 1064 | } |
1008 | } | 1065 | } |
1009 | break; | 1066 | break; |
1010 | } | 1067 | } |
1011 | } | 1068 | } |
1012 | if (i == UDF_SB_NUMPARTS(sb)) | 1069 | if (i == UDF_SB_NUMPARTS(sb)) { |
1013 | { | 1070 | udf_debug("Partition (%d) not found in partition map\n", |
1014 | udf_debug("Partition (%d) not found in partition map\n", le16_to_cpu(p->partitionNumber)); | 1071 | le16_to_cpu(p->partitionNumber)); |
1015 | } | 1072 | } else { |
1016 | else | 1073 | udf_debug |
1017 | { | 1074 | ("Partition (%d:%d type %x) starts at physical %d, block length %d\n", |
1018 | udf_debug("Partition (%d:%d type %x) starts at physical %d, block length %d\n", | 1075 | le16_to_cpu(p->partitionNumber), i, UDF_SB_PARTTYPE(sb, i), |
1019 | le16_to_cpu(p->partitionNumber), i, UDF_SB_PARTTYPE(sb,i), | 1076 | UDF_SB_PARTROOT(sb, i), UDF_SB_PARTLEN(sb, i)); |
1020 | UDF_SB_PARTROOT(sb,i), UDF_SB_PARTLEN(sb,i)); | ||
1021 | } | 1077 | } |
1022 | } | 1078 | } |
1023 | 1079 | ||
1024 | static int | 1080 | static int |
1025 | udf_load_logicalvol(struct super_block *sb, struct buffer_head * bh, kernel_lb_addr *fileset) | 1081 | udf_load_logicalvol(struct super_block *sb, struct buffer_head *bh, |
1082 | kernel_lb_addr * fileset) | ||
1026 | { | 1083 | { |
1027 | struct logicalVolDesc *lvd; | 1084 | struct logicalVolDesc *lvd; |
1028 | int i, j, offset; | 1085 | int i, j, offset; |
@@ -1032,82 +1089,114 @@ udf_load_logicalvol(struct super_block *sb, struct buffer_head * bh, kernel_lb_a | |||
1032 | 1089 | ||
1033 | UDF_SB_ALLOC_PARTMAPS(sb, le32_to_cpu(lvd->numPartitionMaps)); | 1090 | UDF_SB_ALLOC_PARTMAPS(sb, le32_to_cpu(lvd->numPartitionMaps)); |
1034 | 1091 | ||
1035 | for (i=0,offset=0; | 1092 | for (i = 0, offset = 0; |
1036 | i<UDF_SB_NUMPARTS(sb) && offset<le32_to_cpu(lvd->mapTableLength); | 1093 | i < UDF_SB_NUMPARTS(sb) |
1037 | i++,offset+=((struct genericPartitionMap *)&(lvd->partitionMaps[offset]))->partitionMapLength) | 1094 | && offset < le32_to_cpu(lvd->mapTableLength); |
1038 | { | 1095 | i++, offset += |
1039 | type = ((struct genericPartitionMap *)&(lvd->partitionMaps[offset]))->partitionMapType; | 1096 | ((struct genericPartitionMap *)&(lvd->partitionMaps[offset]))-> |
1040 | if (type == 1) | 1097 | partitionMapLength) { |
1041 | { | 1098 | type = |
1042 | struct genericPartitionMap1 *gpm1 = (struct genericPartitionMap1 *)&(lvd->partitionMaps[offset]); | 1099 | ((struct genericPartitionMap *) |
1043 | UDF_SB_PARTTYPE(sb,i) = UDF_TYPE1_MAP15; | 1100 | &(lvd->partitionMaps[offset]))->partitionMapType; |
1044 | UDF_SB_PARTVSN(sb,i) = le16_to_cpu(gpm1->volSeqNum); | 1101 | if (type == 1) { |
1045 | UDF_SB_PARTNUM(sb,i) = le16_to_cpu(gpm1->partitionNum); | 1102 | struct genericPartitionMap1 *gpm1 = |
1046 | UDF_SB_PARTFUNC(sb,i) = NULL; | 1103 | (struct genericPartitionMap1 *)&(lvd-> |
1047 | } | 1104 | partitionMaps |
1048 | else if (type == 2) | 1105 | [offset]); |
1049 | { | 1106 | UDF_SB_PARTTYPE(sb, i) = UDF_TYPE1_MAP15; |
1050 | struct udfPartitionMap2 *upm2 = (struct udfPartitionMap2 *)&(lvd->partitionMaps[offset]); | 1107 | UDF_SB_PARTVSN(sb, i) = le16_to_cpu(gpm1->volSeqNum); |
1051 | if (!strncmp(upm2->partIdent.ident, UDF_ID_VIRTUAL, strlen(UDF_ID_VIRTUAL))) | 1108 | UDF_SB_PARTNUM(sb, i) = le16_to_cpu(gpm1->partitionNum); |
1052 | { | 1109 | UDF_SB_PARTFUNC(sb, i) = NULL; |
1053 | if (le16_to_cpu(((__le16 *)upm2->partIdent.identSuffix)[0]) == 0x0150) | 1110 | } else if (type == 2) { |
1054 | { | 1111 | struct udfPartitionMap2 *upm2 = |
1055 | UDF_SB_PARTTYPE(sb,i) = UDF_VIRTUAL_MAP15; | 1112 | (struct udfPartitionMap2 *)&(lvd-> |
1056 | UDF_SB_PARTFUNC(sb,i) = udf_get_pblock_virt15; | 1113 | partitionMaps[offset]); |
1057 | } | 1114 | if (!strncmp |
1058 | else if (le16_to_cpu(((__le16 *)upm2->partIdent.identSuffix)[0]) == 0x0200) | 1115 | (upm2->partIdent.ident, UDF_ID_VIRTUAL, |
1059 | { | 1116 | strlen(UDF_ID_VIRTUAL))) { |
1060 | UDF_SB_PARTTYPE(sb,i) = UDF_VIRTUAL_MAP20; | 1117 | if (le16_to_cpu |
1061 | UDF_SB_PARTFUNC(sb,i) = udf_get_pblock_virt20; | 1118 | (((__le16 *) upm2->partIdent. |
1119 | identSuffix)[0]) == 0x0150) { | ||
1120 | UDF_SB_PARTTYPE(sb, i) = | ||
1121 | UDF_VIRTUAL_MAP15; | ||
1122 | UDF_SB_PARTFUNC(sb, i) = | ||
1123 | udf_get_pblock_virt15; | ||
1124 | } else | ||
1125 | if (le16_to_cpu | ||
1126 | (((__le16 *) upm2->partIdent. | ||
1127 | identSuffix)[0]) == 0x0200) { | ||
1128 | UDF_SB_PARTTYPE(sb, i) = | ||
1129 | UDF_VIRTUAL_MAP20; | ||
1130 | UDF_SB_PARTFUNC(sb, i) = | ||
1131 | udf_get_pblock_virt20; | ||
1062 | } | 1132 | } |
1063 | } | 1133 | } else |
1064 | else if (!strncmp(upm2->partIdent.ident, UDF_ID_SPARABLE, strlen(UDF_ID_SPARABLE))) | 1134 | if (!strncmp |
1065 | { | 1135 | (upm2->partIdent.ident, UDF_ID_SPARABLE, |
1136 | strlen(UDF_ID_SPARABLE))) { | ||
1066 | uint32_t loc; | 1137 | uint32_t loc; |
1067 | uint16_t ident; | 1138 | uint16_t ident; |
1068 | struct sparingTable *st; | 1139 | struct sparingTable *st; |
1069 | struct sparablePartitionMap *spm = (struct sparablePartitionMap *)&(lvd->partitionMaps[offset]); | 1140 | struct sparablePartitionMap *spm = |
1070 | 1141 | (struct sparablePartitionMap *)&(lvd-> | |
1071 | UDF_SB_PARTTYPE(sb,i) = UDF_SPARABLE_MAP15; | 1142 | partitionMaps |
1072 | UDF_SB_TYPESPAR(sb,i).s_packet_len = le16_to_cpu(spm->packetLength); | 1143 | [offset]); |
1073 | for (j=0; j<spm->numSparingTables; j++) | 1144 | |
1074 | { | 1145 | UDF_SB_PARTTYPE(sb, i) = UDF_SPARABLE_MAP15; |
1075 | loc = le32_to_cpu(spm->locSparingTable[j]); | 1146 | UDF_SB_TYPESPAR(sb, i).s_packet_len = |
1076 | UDF_SB_TYPESPAR(sb,i).s_spar_map[j] = | 1147 | le16_to_cpu(spm->packetLength); |
1077 | udf_read_tagged(sb, loc, loc, &ident); | 1148 | for (j = 0; j < spm->numSparingTables; j++) { |
1078 | if (UDF_SB_TYPESPAR(sb,i).s_spar_map[j] != NULL) | 1149 | loc = |
1079 | { | 1150 | le32_to_cpu(spm-> |
1080 | st = (struct sparingTable *)UDF_SB_TYPESPAR(sb,i).s_spar_map[j]->b_data; | 1151 | locSparingTable[j]); |
1081 | if (ident != 0 || | 1152 | UDF_SB_TYPESPAR(sb, i).s_spar_map[j] = |
1082 | strncmp(st->sparingIdent.ident, UDF_ID_SPARING, strlen(UDF_ID_SPARING))) | 1153 | udf_read_tagged(sb, loc, loc, |
1154 | &ident); | ||
1155 | if (UDF_SB_TYPESPAR(sb, i). | ||
1156 | s_spar_map[j] != NULL) { | ||
1157 | st = (struct sparingTable *) | ||
1158 | UDF_SB_TYPESPAR(sb, | ||
1159 | i). | ||
1160 | s_spar_map[j]->b_data; | ||
1161 | if (ident != 0 | ||
1162 | || strncmp(st->sparingIdent. | ||
1163 | ident, | ||
1164 | UDF_ID_SPARING, | ||
1165 | strlen | ||
1166 | (UDF_ID_SPARING))) | ||
1083 | { | 1167 | { |
1084 | brelse(UDF_SB_TYPESPAR(sb,i).s_spar_map[j]); | 1168 | brelse(UDF_SB_TYPESPAR |
1085 | UDF_SB_TYPESPAR(sb,i).s_spar_map[j] = NULL; | 1169 | (sb, |
1170 | i). | ||
1171 | s_spar_map[j]); | ||
1172 | UDF_SB_TYPESPAR(sb, | ||
1173 | i). | ||
1174 | s_spar_map[j] = | ||
1175 | NULL; | ||
1086 | } | 1176 | } |
1087 | } | 1177 | } |
1088 | } | 1178 | } |
1089 | UDF_SB_PARTFUNC(sb,i) = udf_get_pblock_spar15; | 1179 | UDF_SB_PARTFUNC(sb, i) = udf_get_pblock_spar15; |
1090 | } | 1180 | } else { |
1091 | else | 1181 | udf_debug("Unknown ident: %s\n", |
1092 | { | 1182 | upm2->partIdent.ident); |
1093 | udf_debug("Unknown ident: %s\n", upm2->partIdent.ident); | ||
1094 | continue; | 1183 | continue; |
1095 | } | 1184 | } |
1096 | UDF_SB_PARTVSN(sb,i) = le16_to_cpu(upm2->volSeqNum); | 1185 | UDF_SB_PARTVSN(sb, i) = le16_to_cpu(upm2->volSeqNum); |
1097 | UDF_SB_PARTNUM(sb,i) = le16_to_cpu(upm2->partitionNum); | 1186 | UDF_SB_PARTNUM(sb, i) = le16_to_cpu(upm2->partitionNum); |
1098 | } | 1187 | } |
1099 | udf_debug("Partition (%d:%d) type %d on volume %d\n", | 1188 | udf_debug("Partition (%d:%d) type %d on volume %d\n", |
1100 | i, UDF_SB_PARTNUM(sb,i), type, UDF_SB_PARTVSN(sb,i)); | 1189 | i, UDF_SB_PARTNUM(sb, i), type, UDF_SB_PARTVSN(sb, |
1190 | i)); | ||
1101 | } | 1191 | } |
1102 | 1192 | ||
1103 | if (fileset) | 1193 | if (fileset) { |
1104 | { | 1194 | long_ad *la = (long_ad *) & (lvd->logicalVolContentsUse[0]); |
1105 | long_ad *la = (long_ad *)&(lvd->logicalVolContentsUse[0]); | ||
1106 | 1195 | ||
1107 | *fileset = lelb_to_cpu(la->extLocation); | 1196 | *fileset = lelb_to_cpu(la->extLocation); |
1108 | udf_debug("FileSet found in LogicalVolDesc at block=%d, partition=%d\n", | 1197 | udf_debug |
1109 | fileset->logicalBlockNum, | 1198 | ("FileSet found in LogicalVolDesc at block=%d, partition=%d\n", |
1110 | fileset->partitionReferenceNum); | 1199 | fileset->logicalBlockNum, fileset->partitionReferenceNum); |
1111 | } | 1200 | } |
1112 | if (lvd->integritySeqExt.extLength) | 1201 | if (lvd->integritySeqExt.extLength) |
1113 | udf_load_logicalvolint(sb, leea_to_cpu(lvd->integritySeqExt)); | 1202 | udf_load_logicalvolint(sb, leea_to_cpu(lvd->integritySeqExt)); |
@@ -1118,26 +1207,26 @@ udf_load_logicalvol(struct super_block *sb, struct buffer_head * bh, kernel_lb_a | |||
1118 | * udf_load_logicalvolint | 1207 | * udf_load_logicalvolint |
1119 | * | 1208 | * |
1120 | */ | 1209 | */ |
1121 | static void | 1210 | static void udf_load_logicalvolint(struct super_block *sb, kernel_extent_ad loc) |
1122 | udf_load_logicalvolint(struct super_block *sb, kernel_extent_ad loc) | ||
1123 | { | 1211 | { |
1124 | struct buffer_head *bh = NULL; | 1212 | struct buffer_head *bh = NULL; |
1125 | uint16_t ident; | 1213 | uint16_t ident; |
1126 | 1214 | ||
1127 | while (loc.extLength > 0 && | 1215 | while (loc.extLength > 0 && |
1128 | (bh = udf_read_tagged(sb, loc.extLocation, | 1216 | (bh = udf_read_tagged(sb, loc.extLocation, |
1129 | loc.extLocation, &ident)) && | 1217 | loc.extLocation, &ident)) && |
1130 | ident == TAG_IDENT_LVID) | 1218 | ident == TAG_IDENT_LVID) { |
1131 | { | ||
1132 | UDF_SB_LVIDBH(sb) = bh; | 1219 | UDF_SB_LVIDBH(sb) = bh; |
1133 | 1220 | ||
1134 | if (UDF_SB_LVID(sb)->nextIntegrityExt.extLength) | 1221 | if (UDF_SB_LVID(sb)->nextIntegrityExt.extLength) |
1135 | udf_load_logicalvolint(sb, leea_to_cpu(UDF_SB_LVID(sb)->nextIntegrityExt)); | 1222 | udf_load_logicalvolint(sb, |
1136 | 1223 | leea_to_cpu(UDF_SB_LVID(sb)-> | |
1224 | nextIntegrityExt)); | ||
1225 | |||
1137 | if (UDF_SB_LVIDBH(sb) != bh) | 1226 | if (UDF_SB_LVIDBH(sb) != bh) |
1138 | brelse(bh); | 1227 | brelse(bh); |
1139 | loc.extLength -= sb->s_blocksize; | 1228 | loc.extLength -= sb->s_blocksize; |
1140 | loc.extLocation ++; | 1229 | loc.extLocation++; |
1141 | } | 1230 | } |
1142 | if (UDF_SB_LVIDBH(sb) != bh) | 1231 | if (UDF_SB_LVIDBH(sb) != bh) |
1143 | brelse(bh); | 1232 | brelse(bh); |
@@ -1158,15 +1247,16 @@ udf_load_logicalvolint(struct super_block *sb, kernel_extent_ad loc) | |||
1158 | * July 1, 1997 - Andrew E. Mileski | 1247 | * July 1, 1997 - Andrew E. Mileski |
1159 | * Written, tested, and released. | 1248 | * Written, tested, and released. |
1160 | */ | 1249 | */ |
1161 | static int | 1250 | static int |
1162 | udf_process_sequence(struct super_block *sb, long block, long lastblock, kernel_lb_addr *fileset) | 1251 | udf_process_sequence(struct super_block *sb, long block, long lastblock, |
1252 | kernel_lb_addr * fileset) | ||
1163 | { | 1253 | { |
1164 | struct buffer_head *bh = NULL; | 1254 | struct buffer_head *bh = NULL; |
1165 | struct udf_vds_record vds[VDS_POS_LENGTH]; | 1255 | struct udf_vds_record vds[VDS_POS_LENGTH]; |
1166 | struct generic_desc *gd; | 1256 | struct generic_desc *gd; |
1167 | struct volDescPtr *vdp; | 1257 | struct volDescPtr *vdp; |
1168 | int done=0; | 1258 | int done = 0; |
1169 | int i,j; | 1259 | int i, j; |
1170 | uint32_t vdsn; | 1260 | uint32_t vdsn; |
1171 | uint16_t ident; | 1261 | uint16_t ident; |
1172 | long next_s = 0, next_e = 0; | 1262 | long next_s = 0, next_e = 0; |
@@ -1174,93 +1264,92 @@ udf_process_sequence(struct super_block *sb, long block, long lastblock, kernel_ | |||
1174 | memset(vds, 0, sizeof(struct udf_vds_record) * VDS_POS_LENGTH); | 1264 | memset(vds, 0, sizeof(struct udf_vds_record) * VDS_POS_LENGTH); |
1175 | 1265 | ||
1176 | /* Read the main descriptor sequence */ | 1266 | /* Read the main descriptor sequence */ |
1177 | for (;(!done && block <= lastblock); block++) | 1267 | for (; (!done && block <= lastblock); block++) { |
1178 | { | ||
1179 | 1268 | ||
1180 | bh = udf_read_tagged(sb, block, block, &ident); | 1269 | bh = udf_read_tagged(sb, block, block, &ident); |
1181 | if (!bh) | 1270 | if (!bh) |
1182 | break; | 1271 | break; |
1183 | 1272 | ||
1184 | /* Process each descriptor (ISO 13346 3/8.3-8.4) */ | 1273 | /* Process each descriptor (ISO 13346 3/8.3-8.4) */ |
1185 | gd = (struct generic_desc *)bh->b_data; | 1274 | gd = (struct generic_desc *)bh->b_data; |
1186 | vdsn = le32_to_cpu(gd->volDescSeqNum); | 1275 | vdsn = le32_to_cpu(gd->volDescSeqNum); |
1187 | switch (ident) | 1276 | switch (ident) { |
1188 | { | 1277 | case TAG_IDENT_PVD: /* ISO 13346 3/10.1 */ |
1189 | case TAG_IDENT_PVD: /* ISO 13346 3/10.1 */ | 1278 | if (vdsn >= vds[VDS_POS_PRIMARY_VOL_DESC].volDescSeqNum) { |
1190 | if (vdsn >= vds[VDS_POS_PRIMARY_VOL_DESC].volDescSeqNum) | 1279 | vds[VDS_POS_PRIMARY_VOL_DESC].volDescSeqNum = |
1191 | { | 1280 | vdsn; |
1192 | vds[VDS_POS_PRIMARY_VOL_DESC].volDescSeqNum = vdsn; | 1281 | vds[VDS_POS_PRIMARY_VOL_DESC].block = block; |
1193 | vds[VDS_POS_PRIMARY_VOL_DESC].block = block; | 1282 | } |
1194 | } | 1283 | break; |
1195 | break; | 1284 | case TAG_IDENT_VDP: /* ISO 13346 3/10.3 */ |
1196 | case TAG_IDENT_VDP: /* ISO 13346 3/10.3 */ | 1285 | if (vdsn >= vds[VDS_POS_VOL_DESC_PTR].volDescSeqNum) { |
1197 | if (vdsn >= vds[VDS_POS_VOL_DESC_PTR].volDescSeqNum) | 1286 | vds[VDS_POS_VOL_DESC_PTR].volDescSeqNum = vdsn; |
1198 | { | 1287 | vds[VDS_POS_VOL_DESC_PTR].block = block; |
1199 | vds[VDS_POS_VOL_DESC_PTR].volDescSeqNum = vdsn; | 1288 | |
1200 | vds[VDS_POS_VOL_DESC_PTR].block = block; | 1289 | vdp = (struct volDescPtr *)bh->b_data; |
1201 | 1290 | next_s = | |
1202 | vdp = (struct volDescPtr *)bh->b_data; | 1291 | le32_to_cpu(vdp->nextVolDescSeqExt. |
1203 | next_s = le32_to_cpu(vdp->nextVolDescSeqExt.extLocation); | 1292 | extLocation); |
1204 | next_e = le32_to_cpu(vdp->nextVolDescSeqExt.extLength); | 1293 | next_e = |
1205 | next_e = next_e >> sb->s_blocksize_bits; | 1294 | le32_to_cpu(vdp->nextVolDescSeqExt. |
1206 | next_e += next_s; | 1295 | extLength); |
1207 | } | 1296 | next_e = next_e >> sb->s_blocksize_bits; |
1208 | break; | 1297 | next_e += next_s; |
1209 | case TAG_IDENT_IUVD: /* ISO 13346 3/10.4 */ | 1298 | } |
1210 | if (vdsn >= vds[VDS_POS_IMP_USE_VOL_DESC].volDescSeqNum) | 1299 | break; |
1211 | { | 1300 | case TAG_IDENT_IUVD: /* ISO 13346 3/10.4 */ |
1212 | vds[VDS_POS_IMP_USE_VOL_DESC].volDescSeqNum = vdsn; | 1301 | if (vdsn >= vds[VDS_POS_IMP_USE_VOL_DESC].volDescSeqNum) { |
1213 | vds[VDS_POS_IMP_USE_VOL_DESC].block = block; | 1302 | vds[VDS_POS_IMP_USE_VOL_DESC].volDescSeqNum = |
1214 | } | 1303 | vdsn; |
1215 | break; | 1304 | vds[VDS_POS_IMP_USE_VOL_DESC].block = block; |
1216 | case TAG_IDENT_PD: /* ISO 13346 3/10.5 */ | 1305 | } |
1217 | if (!vds[VDS_POS_PARTITION_DESC].block) | 1306 | break; |
1218 | vds[VDS_POS_PARTITION_DESC].block = block; | 1307 | case TAG_IDENT_PD: /* ISO 13346 3/10.5 */ |
1219 | break; | 1308 | if (!vds[VDS_POS_PARTITION_DESC].block) |
1220 | case TAG_IDENT_LVD: /* ISO 13346 3/10.6 */ | 1309 | vds[VDS_POS_PARTITION_DESC].block = block; |
1221 | if (vdsn >= vds[VDS_POS_LOGICAL_VOL_DESC].volDescSeqNum) | 1310 | break; |
1222 | { | 1311 | case TAG_IDENT_LVD: /* ISO 13346 3/10.6 */ |
1223 | vds[VDS_POS_LOGICAL_VOL_DESC].volDescSeqNum = vdsn; | 1312 | if (vdsn >= vds[VDS_POS_LOGICAL_VOL_DESC].volDescSeqNum) { |
1224 | vds[VDS_POS_LOGICAL_VOL_DESC].block = block; | 1313 | vds[VDS_POS_LOGICAL_VOL_DESC].volDescSeqNum = |
1225 | } | 1314 | vdsn; |
1226 | break; | 1315 | vds[VDS_POS_LOGICAL_VOL_DESC].block = block; |
1227 | case TAG_IDENT_USD: /* ISO 13346 3/10.8 */ | 1316 | } |
1228 | if (vdsn >= vds[VDS_POS_UNALLOC_SPACE_DESC].volDescSeqNum) | 1317 | break; |
1229 | { | 1318 | case TAG_IDENT_USD: /* ISO 13346 3/10.8 */ |
1230 | vds[VDS_POS_UNALLOC_SPACE_DESC].volDescSeqNum = vdsn; | 1319 | if (vdsn >= |
1231 | vds[VDS_POS_UNALLOC_SPACE_DESC].block = block; | 1320 | vds[VDS_POS_UNALLOC_SPACE_DESC].volDescSeqNum) { |
1232 | } | 1321 | vds[VDS_POS_UNALLOC_SPACE_DESC].volDescSeqNum = |
1233 | break; | 1322 | vdsn; |
1234 | case TAG_IDENT_TD: /* ISO 13346 3/10.9 */ | 1323 | vds[VDS_POS_UNALLOC_SPACE_DESC].block = block; |
1235 | vds[VDS_POS_TERMINATING_DESC].block = block; | 1324 | } |
1236 | if (next_e) | 1325 | break; |
1237 | { | 1326 | case TAG_IDENT_TD: /* ISO 13346 3/10.9 */ |
1238 | block = next_s; | 1327 | vds[VDS_POS_TERMINATING_DESC].block = block; |
1239 | lastblock = next_e; | 1328 | if (next_e) { |
1240 | next_s = next_e = 0; | 1329 | block = next_s; |
1241 | } | 1330 | lastblock = next_e; |
1242 | else | 1331 | next_s = next_e = 0; |
1243 | done = 1; | 1332 | } else |
1244 | break; | 1333 | done = 1; |
1334 | break; | ||
1245 | } | 1335 | } |
1246 | brelse(bh); | 1336 | brelse(bh); |
1247 | } | 1337 | } |
1248 | for (i=0; i<VDS_POS_LENGTH; i++) | 1338 | for (i = 0; i < VDS_POS_LENGTH; i++) { |
1249 | { | 1339 | if (vds[i].block) { |
1250 | if (vds[i].block) | 1340 | bh = udf_read_tagged(sb, vds[i].block, vds[i].block, |
1251 | { | 1341 | &ident); |
1252 | bh = udf_read_tagged(sb, vds[i].block, vds[i].block, &ident); | ||
1253 | 1342 | ||
1254 | if (i == VDS_POS_PRIMARY_VOL_DESC) | 1343 | if (i == VDS_POS_PRIMARY_VOL_DESC) |
1255 | udf_load_pvoldesc(sb, bh); | 1344 | udf_load_pvoldesc(sb, bh); |
1256 | else if (i == VDS_POS_LOGICAL_VOL_DESC) | 1345 | else if (i == VDS_POS_LOGICAL_VOL_DESC) |
1257 | udf_load_logicalvol(sb, bh, fileset); | 1346 | udf_load_logicalvol(sb, bh, fileset); |
1258 | else if (i == VDS_POS_PARTITION_DESC) | 1347 | else if (i == VDS_POS_PARTITION_DESC) { |
1259 | { | ||
1260 | struct buffer_head *bh2 = NULL; | 1348 | struct buffer_head *bh2 = NULL; |
1261 | udf_load_partdesc(sb, bh); | 1349 | udf_load_partdesc(sb, bh); |
1262 | for (j=vds[i].block+1; j<vds[VDS_POS_TERMINATING_DESC].block; j++) | 1350 | for (j = vds[i].block + 1; |
1263 | { | 1351 | j < vds[VDS_POS_TERMINATING_DESC].block; |
1352 | j++) { | ||
1264 | bh2 = udf_read_tagged(sb, j, j, &ident); | 1353 | bh2 = udf_read_tagged(sb, j, j, &ident); |
1265 | gd = (struct generic_desc *)bh2->b_data; | 1354 | gd = (struct generic_desc *)bh2->b_data; |
1266 | if (ident == TAG_IDENT_PD) | 1355 | if (ident == TAG_IDENT_PD) |
@@ -1278,31 +1367,27 @@ udf_process_sequence(struct super_block *sb, long block, long lastblock, kernel_ | |||
1278 | /* | 1367 | /* |
1279 | * udf_check_valid() | 1368 | * udf_check_valid() |
1280 | */ | 1369 | */ |
1281 | static int | 1370 | static int udf_check_valid(struct super_block *sb, int novrs, int silent) |
1282 | udf_check_valid(struct super_block *sb, int novrs, int silent) | ||
1283 | { | 1371 | { |
1284 | long block; | 1372 | long block; |
1285 | 1373 | ||
1286 | if (novrs) | 1374 | if (novrs) { |
1287 | { | ||
1288 | udf_debug("Validity check skipped because of novrs option\n"); | 1375 | udf_debug("Validity check skipped because of novrs option\n"); |
1289 | return 0; | 1376 | return 0; |
1290 | } | 1377 | } |
1291 | /* Check that it is NSR02 compliant */ | 1378 | /* Check that it is NSR02 compliant */ |
1292 | /* Process any "CD-ROM Volume Descriptor Set" (ECMA 167 2/8.3.1) */ | 1379 | /* Process any "CD-ROM Volume Descriptor Set" (ECMA 167 2/8.3.1) */ |
1293 | else if ((block = udf_vrs(sb, silent)) == -1) | 1380 | else if ((block = udf_vrs(sb, silent)) == -1) { |
1294 | { | 1381 | udf_debug |
1295 | udf_debug("Failed to read byte 32768. Assuming open disc. Skipping validity check\n"); | 1382 | ("Failed to read byte 32768. Assuming open disc. Skipping validity check\n"); |
1296 | if (!UDF_SB_LASTBLOCK(sb)) | 1383 | if (!UDF_SB_LASTBLOCK(sb)) |
1297 | UDF_SB_LASTBLOCK(sb) = udf_get_last_block(sb); | 1384 | UDF_SB_LASTBLOCK(sb) = udf_get_last_block(sb); |
1298 | return 0; | 1385 | return 0; |
1299 | } | 1386 | } else |
1300 | else | ||
1301 | return !block; | 1387 | return !block; |
1302 | } | 1388 | } |
1303 | 1389 | ||
1304 | static int | 1390 | static int udf_load_partition(struct super_block *sb, kernel_lb_addr * fileset) |
1305 | udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset) | ||
1306 | { | 1391 | { |
1307 | struct anchorVolDescPtr *anchor; | 1392 | struct anchorVolDescPtr *anchor; |
1308 | uint16_t ident; | 1393 | uint16_t ident; |
@@ -1315,19 +1400,27 @@ udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset) | |||
1315 | 1400 | ||
1316 | for (i = 0; i < ARRAY_SIZE(UDF_SB_ANCHOR(sb)); i++) { | 1401 | for (i = 0; i < ARRAY_SIZE(UDF_SB_ANCHOR(sb)); i++) { |
1317 | if (UDF_SB_ANCHOR(sb)[i] && (bh = udf_read_tagged(sb, | 1402 | if (UDF_SB_ANCHOR(sb)[i] && (bh = udf_read_tagged(sb, |
1318 | UDF_SB_ANCHOR(sb)[i], UDF_SB_ANCHOR(sb)[i], &ident))) | 1403 | UDF_SB_ANCHOR |
1319 | { | 1404 | (sb)[i], |
1405 | UDF_SB_ANCHOR | ||
1406 | (sb)[i], | ||
1407 | &ident))) { | ||
1320 | anchor = (struct anchorVolDescPtr *)bh->b_data; | 1408 | anchor = (struct anchorVolDescPtr *)bh->b_data; |
1321 | 1409 | ||
1322 | /* Locate the main sequence */ | 1410 | /* Locate the main sequence */ |
1323 | main_s = le32_to_cpu( anchor->mainVolDescSeqExt.extLocation ); | 1411 | main_s = |
1324 | main_e = le32_to_cpu( anchor->mainVolDescSeqExt.extLength ); | 1412 | le32_to_cpu(anchor->mainVolDescSeqExt.extLocation); |
1413 | main_e = | ||
1414 | le32_to_cpu(anchor->mainVolDescSeqExt.extLength); | ||
1325 | main_e = main_e >> sb->s_blocksize_bits; | 1415 | main_e = main_e >> sb->s_blocksize_bits; |
1326 | main_e += main_s; | 1416 | main_e += main_s; |
1327 | 1417 | ||
1328 | /* Locate the reserve sequence */ | 1418 | /* Locate the reserve sequence */ |
1329 | reserve_s = le32_to_cpu(anchor->reserveVolDescSeqExt.extLocation); | 1419 | reserve_s = |
1330 | reserve_e = le32_to_cpu(anchor->reserveVolDescSeqExt.extLength); | 1420 | le32_to_cpu(anchor->reserveVolDescSeqExt. |
1421 | extLocation); | ||
1422 | reserve_e = | ||
1423 | le32_to_cpu(anchor->reserveVolDescSeqExt.extLength); | ||
1331 | reserve_e = reserve_e >> sb->s_blocksize_bits; | 1424 | reserve_e = reserve_e >> sb->s_blocksize_bits; |
1332 | reserve_e += reserve_s; | 1425 | reserve_e += reserve_s; |
1333 | 1426 | ||
@@ -1335,9 +1428,10 @@ udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset) | |||
1335 | 1428 | ||
1336 | /* Process the main & reserve sequences */ | 1429 | /* Process the main & reserve sequences */ |
1337 | /* responsible for finding the PartitionDesc(s) */ | 1430 | /* responsible for finding the PartitionDesc(s) */ |
1338 | if (!(udf_process_sequence(sb, main_s, main_e, fileset) && | 1431 | if (! |
1339 | udf_process_sequence(sb, reserve_s, reserve_e, fileset))) | 1432 | (udf_process_sequence(sb, main_s, main_e, fileset) |
1340 | { | 1433 | && udf_process_sequence(sb, reserve_s, reserve_e, |
1434 | fileset))) { | ||
1341 | break; | 1435 | break; |
1342 | } | 1436 | } |
1343 | } | 1437 | } |
@@ -1349,36 +1443,37 @@ udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset) | |||
1349 | } else | 1443 | } else |
1350 | udf_debug("Using anchor in block %d\n", UDF_SB_ANCHOR(sb)[i]); | 1444 | udf_debug("Using anchor in block %d\n", UDF_SB_ANCHOR(sb)[i]); |
1351 | 1445 | ||
1352 | for (i=0; i<UDF_SB_NUMPARTS(sb); i++) | 1446 | for (i = 0; i < UDF_SB_NUMPARTS(sb); i++) { |
1353 | { | 1447 | switch (UDF_SB_PARTTYPE(sb, i)) { |
1354 | switch (UDF_SB_PARTTYPE(sb, i)) | 1448 | case UDF_VIRTUAL_MAP15: |
1355 | { | 1449 | case UDF_VIRTUAL_MAP20: |
1356 | case UDF_VIRTUAL_MAP15: | ||
1357 | case UDF_VIRTUAL_MAP20: | ||
1358 | { | 1450 | { |
1359 | kernel_lb_addr uninitialized_var(ino); | 1451 | kernel_lb_addr uninitialized_var(ino); |
1360 | 1452 | ||
1361 | if (!UDF_SB_LASTBLOCK(sb)) | 1453 | if (!UDF_SB_LASTBLOCK(sb)) { |
1362 | { | 1454 | UDF_SB_LASTBLOCK(sb) = |
1363 | UDF_SB_LASTBLOCK(sb) = udf_get_last_block(sb); | 1455 | udf_get_last_block(sb); |
1364 | udf_find_anchor(sb); | 1456 | udf_find_anchor(sb); |
1365 | } | 1457 | } |
1366 | 1458 | ||
1367 | if (!UDF_SB_LASTBLOCK(sb)) | 1459 | if (!UDF_SB_LASTBLOCK(sb)) { |
1368 | { | 1460 | udf_debug |
1369 | udf_debug("Unable to determine Lastblock (For Virtual Partition)\n"); | 1461 | ("Unable to determine Lastblock (For Virtual Partition)\n"); |
1370 | return 1; | 1462 | return 1; |
1371 | } | 1463 | } |
1372 | 1464 | ||
1373 | for (j=0; j<UDF_SB_NUMPARTS(sb); j++) | 1465 | for (j = 0; j < UDF_SB_NUMPARTS(sb); j++) { |
1374 | { | ||
1375 | if (j != i && | 1466 | if (j != i && |
1376 | UDF_SB_PARTVSN(sb,i) == UDF_SB_PARTVSN(sb,j) && | 1467 | UDF_SB_PARTVSN(sb, |
1377 | UDF_SB_PARTNUM(sb,i) == UDF_SB_PARTNUM(sb,j)) | 1468 | i) == |
1378 | { | 1469 | UDF_SB_PARTVSN(sb, j) |
1470 | && UDF_SB_PARTNUM(sb, | ||
1471 | i) == | ||
1472 | UDF_SB_PARTNUM(sb, j)) { | ||
1379 | ino.partitionReferenceNum = j; | 1473 | ino.partitionReferenceNum = j; |
1380 | ino.logicalBlockNum = UDF_SB_LASTBLOCK(sb) - | 1474 | ino.logicalBlockNum = |
1381 | UDF_SB_PARTROOT(sb,j); | 1475 | UDF_SB_LASTBLOCK(sb) - |
1476 | UDF_SB_PARTROOT(sb, j); | ||
1382 | break; | 1477 | break; |
1383 | } | 1478 | } |
1384 | } | 1479 | } |
@@ -1389,13 +1484,13 @@ udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset) | |||
1389 | if (!(UDF_SB_VAT(sb) = udf_iget(sb, ino))) | 1484 | if (!(UDF_SB_VAT(sb) = udf_iget(sb, ino))) |
1390 | return 1; | 1485 | return 1; |
1391 | 1486 | ||
1392 | if (UDF_SB_PARTTYPE(sb,i) == UDF_VIRTUAL_MAP15) | 1487 | if (UDF_SB_PARTTYPE(sb, i) == UDF_VIRTUAL_MAP15) { |
1393 | { | 1488 | UDF_SB_TYPEVIRT(sb, i).s_start_offset = |
1394 | UDF_SB_TYPEVIRT(sb,i).s_start_offset = udf_ext0_offset(UDF_SB_VAT(sb)); | 1489 | udf_ext0_offset(UDF_SB_VAT(sb)); |
1395 | UDF_SB_TYPEVIRT(sb,i).s_num_entries = (UDF_SB_VAT(sb)->i_size - 36) >> 2; | 1490 | UDF_SB_TYPEVIRT(sb, i).s_num_entries = |
1396 | } | 1491 | (UDF_SB_VAT(sb)->i_size - 36) >> 2; |
1397 | else if (UDF_SB_PARTTYPE(sb,i) == UDF_VIRTUAL_MAP20) | 1492 | } else if (UDF_SB_PARTTYPE(sb, i) == |
1398 | { | 1493 | UDF_VIRTUAL_MAP20) { |
1399 | struct buffer_head *bh = NULL; | 1494 | struct buffer_head *bh = NULL; |
1400 | uint32_t pos; | 1495 | uint32_t pos; |
1401 | 1496 | ||
@@ -1403,15 +1498,26 @@ udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset) | |||
1403 | bh = sb_bread(sb, pos); | 1498 | bh = sb_bread(sb, pos); |
1404 | if (!bh) | 1499 | if (!bh) |
1405 | return 1; | 1500 | return 1; |
1406 | UDF_SB_TYPEVIRT(sb,i).s_start_offset = | 1501 | UDF_SB_TYPEVIRT(sb, i).s_start_offset = |
1407 | le16_to_cpu(((struct virtualAllocationTable20 *)bh->b_data + udf_ext0_offset(UDF_SB_VAT(sb)))->lengthHeader) + | 1502 | le16_to_cpu(((struct |
1408 | udf_ext0_offset(UDF_SB_VAT(sb)); | 1503 | virtualAllocationTable20 |
1409 | UDF_SB_TYPEVIRT(sb,i).s_num_entries = (UDF_SB_VAT(sb)->i_size - | 1504 | *)bh->b_data + |
1410 | UDF_SB_TYPEVIRT(sb,i).s_start_offset) >> 2; | 1505 | udf_ext0_offset |
1506 | (UDF_SB_VAT(sb)))-> | ||
1507 | lengthHeader) + | ||
1508 | udf_ext0_offset(UDF_SB_VAT(sb)); | ||
1509 | UDF_SB_TYPEVIRT(sb, i).s_num_entries = | ||
1510 | (UDF_SB_VAT(sb)->i_size - | ||
1511 | UDF_SB_TYPEVIRT(sb, | ||
1512 | i). | ||
1513 | s_start_offset) >> 2; | ||
1411 | brelse(bh); | 1514 | brelse(bh); |
1412 | } | 1515 | } |
1413 | UDF_SB_PARTROOT(sb,i) = udf_get_pblock(sb, 0, i, 0); | 1516 | UDF_SB_PARTROOT(sb, i) = |
1414 | UDF_SB_PARTLEN(sb,i) = UDF_SB_PARTLEN(sb,ino.partitionReferenceNum); | 1517 | udf_get_pblock(sb, 0, i, 0); |
1518 | UDF_SB_PARTLEN(sb, i) = | ||
1519 | UDF_SB_PARTLEN(sb, | ||
1520 | ino.partitionReferenceNum); | ||
1415 | } | 1521 | } |
1416 | } | 1522 | } |
1417 | } | 1523 | } |
@@ -1420,26 +1526,28 @@ udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset) | |||
1420 | 1526 | ||
1421 | static void udf_open_lvid(struct super_block *sb) | 1527 | static void udf_open_lvid(struct super_block *sb) |
1422 | { | 1528 | { |
1423 | if (UDF_SB_LVIDBH(sb)) | 1529 | if (UDF_SB_LVIDBH(sb)) { |
1424 | { | ||
1425 | int i; | 1530 | int i; |
1426 | kernel_timestamp cpu_time; | 1531 | kernel_timestamp cpu_time; |
1427 | 1532 | ||
1428 | UDF_SB_LVIDIU(sb)->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX; | 1533 | UDF_SB_LVIDIU(sb)->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX; |
1429 | UDF_SB_LVIDIU(sb)->impIdent.identSuffix[1] = UDF_OS_ID_LINUX; | 1534 | UDF_SB_LVIDIU(sb)->impIdent.identSuffix[1] = UDF_OS_ID_LINUX; |
1430 | if (udf_time_to_stamp(&cpu_time, CURRENT_TIME)) | 1535 | if (udf_time_to_stamp(&cpu_time, CURRENT_TIME)) |
1431 | UDF_SB_LVID(sb)->recordingDateAndTime = cpu_to_lets(cpu_time); | 1536 | UDF_SB_LVID(sb)->recordingDateAndTime = |
1537 | cpu_to_lets(cpu_time); | ||
1432 | UDF_SB_LVID(sb)->integrityType = LVID_INTEGRITY_TYPE_OPEN; | 1538 | UDF_SB_LVID(sb)->integrityType = LVID_INTEGRITY_TYPE_OPEN; |
1433 | 1539 | ||
1434 | UDF_SB_LVID(sb)->descTag.descCRC = | 1540 | UDF_SB_LVID(sb)->descTag.descCRC = |
1435 | cpu_to_le16(udf_crc((char *)UDF_SB_LVID(sb) + sizeof(tag), | 1541 | cpu_to_le16(udf_crc((char *)UDF_SB_LVID(sb) + sizeof(tag), |
1436 | le16_to_cpu(UDF_SB_LVID(sb)->descTag.descCRCLength), 0)); | 1542 | le16_to_cpu(UDF_SB_LVID(sb)->descTag. |
1543 | descCRCLength), 0)); | ||
1437 | 1544 | ||
1438 | UDF_SB_LVID(sb)->descTag.tagChecksum = 0; | 1545 | UDF_SB_LVID(sb)->descTag.tagChecksum = 0; |
1439 | for (i=0; i<16; i++) | 1546 | for (i = 0; i < 16; i++) |
1440 | if (i != 4) | 1547 | if (i != 4) |
1441 | UDF_SB_LVID(sb)->descTag.tagChecksum += | 1548 | UDF_SB_LVID(sb)->descTag.tagChecksum += |
1442 | ((uint8_t *)&(UDF_SB_LVID(sb)->descTag))[i]; | 1549 | ((uint8_t *) & |
1550 | (UDF_SB_LVID(sb)->descTag))[i]; | ||
1443 | 1551 | ||
1444 | mark_buffer_dirty(UDF_SB_LVIDBH(sb)); | 1552 | mark_buffer_dirty(UDF_SB_LVIDBH(sb)); |
1445 | } | 1553 | } |
@@ -1448,32 +1556,41 @@ static void udf_open_lvid(struct super_block *sb) | |||
1448 | static void udf_close_lvid(struct super_block *sb) | 1556 | static void udf_close_lvid(struct super_block *sb) |
1449 | { | 1557 | { |
1450 | if (UDF_SB_LVIDBH(sb) && | 1558 | if (UDF_SB_LVIDBH(sb) && |
1451 | UDF_SB_LVID(sb)->integrityType == LVID_INTEGRITY_TYPE_OPEN) | 1559 | UDF_SB_LVID(sb)->integrityType == LVID_INTEGRITY_TYPE_OPEN) { |
1452 | { | ||
1453 | int i; | 1560 | int i; |
1454 | kernel_timestamp cpu_time; | 1561 | kernel_timestamp cpu_time; |
1455 | 1562 | ||
1456 | UDF_SB_LVIDIU(sb)->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX; | 1563 | UDF_SB_LVIDIU(sb)->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX; |
1457 | UDF_SB_LVIDIU(sb)->impIdent.identSuffix[1] = UDF_OS_ID_LINUX; | 1564 | UDF_SB_LVIDIU(sb)->impIdent.identSuffix[1] = UDF_OS_ID_LINUX; |
1458 | if (udf_time_to_stamp(&cpu_time, CURRENT_TIME)) | 1565 | if (udf_time_to_stamp(&cpu_time, CURRENT_TIME)) |
1459 | UDF_SB_LVID(sb)->recordingDateAndTime = cpu_to_lets(cpu_time); | 1566 | UDF_SB_LVID(sb)->recordingDateAndTime = |
1460 | if (UDF_MAX_WRITE_VERSION > le16_to_cpu(UDF_SB_LVIDIU(sb)->maxUDFWriteRev)) | 1567 | cpu_to_lets(cpu_time); |
1461 | UDF_SB_LVIDIU(sb)->maxUDFWriteRev = cpu_to_le16(UDF_MAX_WRITE_VERSION); | 1568 | if (UDF_MAX_WRITE_VERSION > |
1462 | if (UDF_SB_UDFREV(sb) > le16_to_cpu(UDF_SB_LVIDIU(sb)->minUDFReadRev)) | 1569 | le16_to_cpu(UDF_SB_LVIDIU(sb)->maxUDFWriteRev)) |
1463 | UDF_SB_LVIDIU(sb)->minUDFReadRev = cpu_to_le16(UDF_SB_UDFREV(sb)); | 1570 | UDF_SB_LVIDIU(sb)->maxUDFWriteRev = |
1464 | if (UDF_SB_UDFREV(sb) > le16_to_cpu(UDF_SB_LVIDIU(sb)->minUDFWriteRev)) | 1571 | cpu_to_le16(UDF_MAX_WRITE_VERSION); |
1465 | UDF_SB_LVIDIU(sb)->minUDFWriteRev = cpu_to_le16(UDF_SB_UDFREV(sb)); | 1572 | if (UDF_SB_UDFREV(sb) > |
1466 | UDF_SB_LVID(sb)->integrityType = cpu_to_le32(LVID_INTEGRITY_TYPE_CLOSE); | 1573 | le16_to_cpu(UDF_SB_LVIDIU(sb)->minUDFReadRev)) |
1574 | UDF_SB_LVIDIU(sb)->minUDFReadRev = | ||
1575 | cpu_to_le16(UDF_SB_UDFREV(sb)); | ||
1576 | if (UDF_SB_UDFREV(sb) > | ||
1577 | le16_to_cpu(UDF_SB_LVIDIU(sb)->minUDFWriteRev)) | ||
1578 | UDF_SB_LVIDIU(sb)->minUDFWriteRev = | ||
1579 | cpu_to_le16(UDF_SB_UDFREV(sb)); | ||
1580 | UDF_SB_LVID(sb)->integrityType = | ||
1581 | cpu_to_le32(LVID_INTEGRITY_TYPE_CLOSE); | ||
1467 | 1582 | ||
1468 | UDF_SB_LVID(sb)->descTag.descCRC = | 1583 | UDF_SB_LVID(sb)->descTag.descCRC = |
1469 | cpu_to_le16(udf_crc((char *)UDF_SB_LVID(sb) + sizeof(tag), | 1584 | cpu_to_le16(udf_crc((char *)UDF_SB_LVID(sb) + sizeof(tag), |
1470 | le16_to_cpu(UDF_SB_LVID(sb)->descTag.descCRCLength), 0)); | 1585 | le16_to_cpu(UDF_SB_LVID(sb)->descTag. |
1586 | descCRCLength), 0)); | ||
1471 | 1587 | ||
1472 | UDF_SB_LVID(sb)->descTag.tagChecksum = 0; | 1588 | UDF_SB_LVID(sb)->descTag.tagChecksum = 0; |
1473 | for (i=0; i<16; i++) | 1589 | for (i = 0; i < 16; i++) |
1474 | if (i != 4) | 1590 | if (i != 4) |
1475 | UDF_SB_LVID(sb)->descTag.tagChecksum += | 1591 | UDF_SB_LVID(sb)->descTag.tagChecksum += |
1476 | ((uint8_t *)&(UDF_SB_LVID(sb)->descTag))[i]; | 1592 | ((uint8_t *) & |
1593 | (UDF_SB_LVID(sb)->descTag))[i]; | ||
1477 | 1594 | ||
1478 | mark_buffer_dirty(UDF_SB_LVIDBH(sb)); | 1595 | mark_buffer_dirty(UDF_SB_LVIDBH(sb)); |
1479 | } | 1596 | } |
@@ -1498,7 +1615,7 @@ static void udf_close_lvid(struct super_block *sb) | |||
1498 | static int udf_fill_super(struct super_block *sb, void *options, int silent) | 1615 | static int udf_fill_super(struct super_block *sb, void *options, int silent) |
1499 | { | 1616 | { |
1500 | int i; | 1617 | int i; |
1501 | struct inode *inode=NULL; | 1618 | struct inode *inode = NULL; |
1502 | struct udf_options uopt; | 1619 | struct udf_options uopt; |
1503 | kernel_lb_addr rootdir, fileset; | 1620 | kernel_lb_addr rootdir, fileset; |
1504 | struct udf_sb_info *sbi; | 1621 | struct udf_sb_info *sbi; |
@@ -1520,15 +1637,13 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) | |||
1520 | goto error_out; | 1637 | goto error_out; |
1521 | 1638 | ||
1522 | if (uopt.flags & (1 << UDF_FLAG_UTF8) && | 1639 | if (uopt.flags & (1 << UDF_FLAG_UTF8) && |
1523 | uopt.flags & (1 << UDF_FLAG_NLS_MAP)) | 1640 | uopt.flags & (1 << UDF_FLAG_NLS_MAP)) { |
1524 | { | ||
1525 | udf_error(sb, "udf_read_super", | 1641 | udf_error(sb, "udf_read_super", |
1526 | "utf8 cannot be combined with iocharset\n"); | 1642 | "utf8 cannot be combined with iocharset\n"); |
1527 | goto error_out; | 1643 | goto error_out; |
1528 | } | 1644 | } |
1529 | #ifdef CONFIG_UDF_NLS | 1645 | #ifdef CONFIG_UDF_NLS |
1530 | if ((uopt.flags & (1 << UDF_FLAG_NLS_MAP)) && !uopt.nls_map) | 1646 | if ((uopt.flags & (1 << UDF_FLAG_NLS_MAP)) && !uopt.nls_map) { |
1531 | { | ||
1532 | uopt.nls_map = load_nls_default(); | 1647 | uopt.nls_map = load_nls_default(); |
1533 | if (!uopt.nls_map) | 1648 | if (!uopt.nls_map) |
1534 | uopt.flags &= ~(1 << UDF_FLAG_NLS_MAP); | 1649 | uopt.flags &= ~(1 << UDF_FLAG_NLS_MAP); |
@@ -1552,7 +1667,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) | |||
1552 | if (!udf_set_blocksize(sb, uopt.blocksize)) | 1667 | if (!udf_set_blocksize(sb, uopt.blocksize)) |
1553 | goto error_out; | 1668 | goto error_out; |
1554 | 1669 | ||
1555 | if ( uopt.session == 0xFFFFFFFF ) | 1670 | if (uopt.session == 0xFFFFFFFF) |
1556 | UDF_SB_SESSION(sb) = udf_get_last_session(sb); | 1671 | UDF_SB_SESSION(sb) = udf_get_last_session(sb); |
1557 | else | 1672 | else |
1558 | UDF_SB_SESSION(sb) = uopt.session; | 1673 | UDF_SB_SESSION(sb) = uopt.session; |
@@ -1564,10 +1679,9 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) | |||
1564 | UDF_SB_ANCHOR(sb)[2] = uopt.anchor; | 1679 | UDF_SB_ANCHOR(sb)[2] = uopt.anchor; |
1565 | UDF_SB_ANCHOR(sb)[3] = 256; | 1680 | UDF_SB_ANCHOR(sb)[3] = 256; |
1566 | 1681 | ||
1567 | if (udf_check_valid(sb, uopt.novrs, silent)) /* read volume recognition sequences */ | 1682 | if (udf_check_valid(sb, uopt.novrs, silent)) { /* read volume recognition sequences */ |
1568 | { | ||
1569 | printk("UDF-fs: No VRS found\n"); | 1683 | printk("UDF-fs: No VRS found\n"); |
1570 | goto error_out; | 1684 | goto error_out; |
1571 | } | 1685 | } |
1572 | 1686 | ||
1573 | udf_find_anchor(sb); | 1687 | udf_find_anchor(sb); |
@@ -1579,29 +1693,26 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) | |||
1579 | sb->s_magic = UDF_SUPER_MAGIC; | 1693 | sb->s_magic = UDF_SUPER_MAGIC; |
1580 | sb->s_time_gran = 1000; | 1694 | sb->s_time_gran = 1000; |
1581 | 1695 | ||
1582 | if (udf_load_partition(sb, &fileset)) | 1696 | if (udf_load_partition(sb, &fileset)) { |
1583 | { | ||
1584 | printk("UDF-fs: No partition found (1)\n"); | 1697 | printk("UDF-fs: No partition found (1)\n"); |
1585 | goto error_out; | 1698 | goto error_out; |
1586 | } | 1699 | } |
1587 | 1700 | ||
1588 | udf_debug("Lastblock=%d\n", UDF_SB_LASTBLOCK(sb)); | 1701 | udf_debug("Lastblock=%d\n", UDF_SB_LASTBLOCK(sb)); |
1589 | 1702 | ||
1590 | if ( UDF_SB_LVIDBH(sb) ) | 1703 | if (UDF_SB_LVIDBH(sb)) { |
1591 | { | 1704 | uint16_t minUDFReadRev = |
1592 | uint16_t minUDFReadRev = le16_to_cpu(UDF_SB_LVIDIU(sb)->minUDFReadRev); | 1705 | le16_to_cpu(UDF_SB_LVIDIU(sb)->minUDFReadRev); |
1593 | uint16_t minUDFWriteRev = le16_to_cpu(UDF_SB_LVIDIU(sb)->minUDFWriteRev); | 1706 | uint16_t minUDFWriteRev = |
1707 | le16_to_cpu(UDF_SB_LVIDIU(sb)->minUDFWriteRev); | ||
1594 | /* uint16_t maxUDFWriteRev = le16_to_cpu(UDF_SB_LVIDIU(sb)->maxUDFWriteRev); */ | 1708 | /* uint16_t maxUDFWriteRev = le16_to_cpu(UDF_SB_LVIDIU(sb)->maxUDFWriteRev); */ |
1595 | 1709 | ||
1596 | if (minUDFReadRev > UDF_MAX_READ_VERSION) | 1710 | if (minUDFReadRev > UDF_MAX_READ_VERSION) { |
1597 | { | ||
1598 | printk("UDF-fs: minUDFReadRev=%x (max is %x)\n", | 1711 | printk("UDF-fs: minUDFReadRev=%x (max is %x)\n", |
1599 | le16_to_cpu(UDF_SB_LVIDIU(sb)->minUDFReadRev), | 1712 | le16_to_cpu(UDF_SB_LVIDIU(sb)->minUDFReadRev), |
1600 | UDF_MAX_READ_VERSION); | 1713 | UDF_MAX_READ_VERSION); |
1601 | goto error_out; | 1714 | goto error_out; |
1602 | } | 1715 | } else if (minUDFWriteRev > UDF_MAX_WRITE_VERSION) { |
1603 | else if (minUDFWriteRev > UDF_MAX_WRITE_VERSION) | ||
1604 | { | ||
1605 | sb->s_flags |= MS_RDONLY; | 1716 | sb->s_flags |= MS_RDONLY; |
1606 | } | 1717 | } |
1607 | 1718 | ||
@@ -1613,31 +1724,30 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) | |||
1613 | UDF_SET_FLAG(sb, UDF_FLAG_USE_STREAMS); | 1724 | UDF_SET_FLAG(sb, UDF_FLAG_USE_STREAMS); |
1614 | } | 1725 | } |
1615 | 1726 | ||
1616 | if ( !UDF_SB_NUMPARTS(sb) ) | 1727 | if (!UDF_SB_NUMPARTS(sb)) { |
1617 | { | ||
1618 | printk("UDF-fs: No partition found (2)\n"); | 1728 | printk("UDF-fs: No partition found (2)\n"); |
1619 | goto error_out; | 1729 | goto error_out; |
1620 | } | 1730 | } |
1621 | 1731 | ||
1622 | if (UDF_SB_PARTFLAGS(sb, UDF_SB_PARTITION(sb)) & UDF_PART_FLAG_READ_ONLY) { | 1732 | if (UDF_SB_PARTFLAGS(sb, UDF_SB_PARTITION(sb)) & |
1623 | printk("UDF-fs: Partition marked readonly; forcing readonly mount\n"); | 1733 | UDF_PART_FLAG_READ_ONLY) { |
1734 | printk | ||
1735 | ("UDF-fs: Partition marked readonly; forcing readonly mount\n"); | ||
1624 | sb->s_flags |= MS_RDONLY; | 1736 | sb->s_flags |= MS_RDONLY; |
1625 | } | 1737 | } |
1626 | 1738 | ||
1627 | if ( udf_find_fileset(sb, &fileset, &rootdir) ) | 1739 | if (udf_find_fileset(sb, &fileset, &rootdir)) { |
1628 | { | ||
1629 | printk("UDF-fs: No fileset found\n"); | 1740 | printk("UDF-fs: No fileset found\n"); |
1630 | goto error_out; | 1741 | goto error_out; |
1631 | } | 1742 | } |
1632 | 1743 | ||
1633 | if (!silent) | 1744 | if (!silent) { |
1634 | { | ||
1635 | kernel_timestamp ts; | 1745 | kernel_timestamp ts; |
1636 | udf_time_to_stamp(&ts, UDF_SB_RECORDTIME(sb)); | 1746 | udf_time_to_stamp(&ts, UDF_SB_RECORDTIME(sb)); |
1637 | udf_info("UDF %s (%s) Mounting volume '%s', timestamp %04u/%02u/%02u %02u:%02u (%x)\n", | 1747 | udf_info |
1638 | UDFFS_VERSION, UDFFS_DATE, | 1748 | ("UDF %s (%s) Mounting volume '%s', timestamp %04u/%02u/%02u %02u:%02u (%x)\n", |
1639 | UDF_SB_VOLIDENT(sb), ts.year, ts.month, ts.day, ts.hour, ts.minute, | 1749 | UDFFS_VERSION, UDFFS_DATE, UDF_SB_VOLIDENT(sb), ts.year, |
1640 | ts.typeAndTimezone); | 1750 | ts.month, ts.day, ts.hour, ts.minute, ts.typeAndTimezone); |
1641 | } | 1751 | } |
1642 | if (!(sb->s_flags & MS_RDONLY)) | 1752 | if (!(sb->s_flags & MS_RDONLY)) |
1643 | udf_open_lvid(sb); | 1753 | udf_open_lvid(sb); |
@@ -1645,18 +1755,16 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) | |||
1645 | /* Assign the root inode */ | 1755 | /* Assign the root inode */ |
1646 | /* assign inodes by physical block number */ | 1756 | /* assign inodes by physical block number */ |
1647 | /* perhaps it's not extensible enough, but for now ... */ | 1757 | /* perhaps it's not extensible enough, but for now ... */ |
1648 | inode = udf_iget(sb, rootdir); | 1758 | inode = udf_iget(sb, rootdir); |
1649 | if (!inode) | 1759 | if (!inode) { |
1650 | { | ||
1651 | printk("UDF-fs: Error in udf_iget, block=%d, partition=%d\n", | 1760 | printk("UDF-fs: Error in udf_iget, block=%d, partition=%d\n", |
1652 | rootdir.logicalBlockNum, rootdir.partitionReferenceNum); | 1761 | rootdir.logicalBlockNum, rootdir.partitionReferenceNum); |
1653 | goto error_out; | 1762 | goto error_out; |
1654 | } | 1763 | } |
1655 | 1764 | ||
1656 | /* Allocate a dentry for the root inode */ | 1765 | /* Allocate a dentry for the root inode */ |
1657 | sb->s_root = d_alloc_root(inode); | 1766 | sb->s_root = d_alloc_root(inode); |
1658 | if (!sb->s_root) | 1767 | if (!sb->s_root) { |
1659 | { | ||
1660 | printk("UDF-fs: Couldn't allocate root dentry\n"); | 1768 | printk("UDF-fs: Couldn't allocate root dentry\n"); |
1661 | iput(inode); | 1769 | iput(inode); |
1662 | goto error_out; | 1770 | goto error_out; |
@@ -1664,23 +1772,30 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) | |||
1664 | sb->s_maxbytes = MAX_LFS_FILESIZE; | 1772 | sb->s_maxbytes = MAX_LFS_FILESIZE; |
1665 | return 0; | 1773 | return 0; |
1666 | 1774 | ||
1667 | error_out: | 1775 | error_out: |
1668 | if (UDF_SB_VAT(sb)) | 1776 | if (UDF_SB_VAT(sb)) |
1669 | iput(UDF_SB_VAT(sb)); | 1777 | iput(UDF_SB_VAT(sb)); |
1670 | if (UDF_SB_NUMPARTS(sb)) | 1778 | if (UDF_SB_NUMPARTS(sb)) { |
1671 | { | 1779 | if (UDF_SB_PARTFLAGS(sb, UDF_SB_PARTITION(sb)) & |
1672 | if (UDF_SB_PARTFLAGS(sb, UDF_SB_PARTITION(sb)) & UDF_PART_FLAG_UNALLOC_TABLE) | 1780 | UDF_PART_FLAG_UNALLOC_TABLE) |
1673 | iput(UDF_SB_PARTMAPS(sb)[UDF_SB_PARTITION(sb)].s_uspace.s_table); | 1781 | iput(UDF_SB_PARTMAPS(sb)[UDF_SB_PARTITION(sb)].s_uspace. |
1674 | if (UDF_SB_PARTFLAGS(sb, UDF_SB_PARTITION(sb)) & UDF_PART_FLAG_FREED_TABLE) | 1782 | s_table); |
1675 | iput(UDF_SB_PARTMAPS(sb)[UDF_SB_PARTITION(sb)].s_fspace.s_table); | 1783 | if (UDF_SB_PARTFLAGS(sb, UDF_SB_PARTITION(sb)) & |
1676 | if (UDF_SB_PARTFLAGS(sb, UDF_SB_PARTITION(sb)) & UDF_PART_FLAG_UNALLOC_BITMAP) | 1784 | UDF_PART_FLAG_FREED_TABLE) |
1677 | UDF_SB_FREE_BITMAP(sb,UDF_SB_PARTITION(sb),s_uspace); | 1785 | iput(UDF_SB_PARTMAPS(sb)[UDF_SB_PARTITION(sb)].s_fspace. |
1678 | if (UDF_SB_PARTFLAGS(sb, UDF_SB_PARTITION(sb)) & UDF_PART_FLAG_FREED_BITMAP) | 1786 | s_table); |
1679 | UDF_SB_FREE_BITMAP(sb,UDF_SB_PARTITION(sb),s_fspace); | 1787 | if (UDF_SB_PARTFLAGS(sb, UDF_SB_PARTITION(sb)) & |
1680 | if (UDF_SB_PARTTYPE(sb, UDF_SB_PARTITION(sb)) == UDF_SPARABLE_MAP15) | 1788 | UDF_PART_FLAG_UNALLOC_BITMAP) |
1681 | { | 1789 | UDF_SB_FREE_BITMAP(sb, UDF_SB_PARTITION(sb), s_uspace); |
1682 | for (i=0; i<4; i++) | 1790 | if (UDF_SB_PARTFLAGS(sb, UDF_SB_PARTITION(sb)) & |
1683 | brelse(UDF_SB_TYPESPAR(sb, UDF_SB_PARTITION(sb)).s_spar_map[i]); | 1791 | UDF_PART_FLAG_FREED_BITMAP) |
1792 | UDF_SB_FREE_BITMAP(sb, UDF_SB_PARTITION(sb), s_fspace); | ||
1793 | if (UDF_SB_PARTTYPE(sb, UDF_SB_PARTITION(sb)) == | ||
1794 | UDF_SPARABLE_MAP15) { | ||
1795 | for (i = 0; i < 4; i++) | ||
1796 | brelse(UDF_SB_TYPESPAR | ||
1797 | (sb, | ||
1798 | UDF_SB_PARTITION(sb)).s_spar_map[i]); | ||
1684 | } | 1799 | } |
1685 | } | 1800 | } |
1686 | #ifdef CONFIG_UDF_NLS | 1801 | #ifdef CONFIG_UDF_NLS |
@@ -1697,32 +1812,31 @@ error_out: | |||
1697 | } | 1812 | } |
1698 | 1813 | ||
1699 | void udf_error(struct super_block *sb, const char *function, | 1814 | void udf_error(struct super_block *sb, const char *function, |
1700 | const char *fmt, ...) | 1815 | const char *fmt, ...) |
1701 | { | 1816 | { |
1702 | va_list args; | 1817 | va_list args; |
1703 | 1818 | ||
1704 | if (!(sb->s_flags & MS_RDONLY)) | 1819 | if (!(sb->s_flags & MS_RDONLY)) { |
1705 | { | ||
1706 | /* mark sb error */ | 1820 | /* mark sb error */ |
1707 | sb->s_dirt = 1; | 1821 | sb->s_dirt = 1; |
1708 | } | 1822 | } |
1709 | va_start(args, fmt); | 1823 | va_start(args, fmt); |
1710 | vsnprintf(error_buf, sizeof(error_buf), fmt, args); | 1824 | vsnprintf(error_buf, sizeof(error_buf), fmt, args); |
1711 | va_end(args); | 1825 | va_end(args); |
1712 | printk (KERN_CRIT "UDF-fs error (device %s): %s: %s\n", | 1826 | printk(KERN_CRIT "UDF-fs error (device %s): %s: %s\n", |
1713 | sb->s_id, function, error_buf); | 1827 | sb->s_id, function, error_buf); |
1714 | } | 1828 | } |
1715 | 1829 | ||
1716 | void udf_warning(struct super_block *sb, const char *function, | 1830 | void udf_warning(struct super_block *sb, const char *function, |
1717 | const char *fmt, ...) | 1831 | const char *fmt, ...) |
1718 | { | 1832 | { |
1719 | va_list args; | 1833 | va_list args; |
1720 | 1834 | ||
1721 | va_start (args, fmt); | 1835 | va_start(args, fmt); |
1722 | vsnprintf(error_buf, sizeof(error_buf), fmt, args); | 1836 | vsnprintf(error_buf, sizeof(error_buf), fmt, args); |
1723 | va_end(args); | 1837 | va_end(args); |
1724 | printk(KERN_WARNING "UDF-fs warning (device %s): %s: %s\n", | 1838 | printk(KERN_WARNING "UDF-fs warning (device %s): %s: %s\n", |
1725 | sb->s_id, function, error_buf); | 1839 | sb->s_id, function, error_buf); |
1726 | } | 1840 | } |
1727 | 1841 | ||
1728 | /* | 1842 | /* |
@@ -1738,27 +1852,33 @@ void udf_warning(struct super_block *sb, const char *function, | |||
1738 | * July 1, 1997 - Andrew E. Mileski | 1852 | * July 1, 1997 - Andrew E. Mileski |
1739 | * Written, tested, and released. | 1853 | * Written, tested, and released. |
1740 | */ | 1854 | */ |
1741 | static void | 1855 | static void udf_put_super(struct super_block *sb) |
1742 | udf_put_super(struct super_block *sb) | ||
1743 | { | 1856 | { |
1744 | int i; | 1857 | int i; |
1745 | 1858 | ||
1746 | if (UDF_SB_VAT(sb)) | 1859 | if (UDF_SB_VAT(sb)) |
1747 | iput(UDF_SB_VAT(sb)); | 1860 | iput(UDF_SB_VAT(sb)); |
1748 | if (UDF_SB_NUMPARTS(sb)) | 1861 | if (UDF_SB_NUMPARTS(sb)) { |
1749 | { | 1862 | if (UDF_SB_PARTFLAGS(sb, UDF_SB_PARTITION(sb)) & |
1750 | if (UDF_SB_PARTFLAGS(sb, UDF_SB_PARTITION(sb)) & UDF_PART_FLAG_UNALLOC_TABLE) | 1863 | UDF_PART_FLAG_UNALLOC_TABLE) |
1751 | iput(UDF_SB_PARTMAPS(sb)[UDF_SB_PARTITION(sb)].s_uspace.s_table); | 1864 | iput(UDF_SB_PARTMAPS(sb)[UDF_SB_PARTITION(sb)].s_uspace. |
1752 | if (UDF_SB_PARTFLAGS(sb, UDF_SB_PARTITION(sb)) & UDF_PART_FLAG_FREED_TABLE) | 1865 | s_table); |
1753 | iput(UDF_SB_PARTMAPS(sb)[UDF_SB_PARTITION(sb)].s_fspace.s_table); | 1866 | if (UDF_SB_PARTFLAGS(sb, UDF_SB_PARTITION(sb)) & |
1754 | if (UDF_SB_PARTFLAGS(sb, UDF_SB_PARTITION(sb)) & UDF_PART_FLAG_UNALLOC_BITMAP) | 1867 | UDF_PART_FLAG_FREED_TABLE) |
1755 | UDF_SB_FREE_BITMAP(sb,UDF_SB_PARTITION(sb),s_uspace); | 1868 | iput(UDF_SB_PARTMAPS(sb)[UDF_SB_PARTITION(sb)].s_fspace. |
1756 | if (UDF_SB_PARTFLAGS(sb, UDF_SB_PARTITION(sb)) & UDF_PART_FLAG_FREED_BITMAP) | 1869 | s_table); |
1757 | UDF_SB_FREE_BITMAP(sb,UDF_SB_PARTITION(sb),s_fspace); | 1870 | if (UDF_SB_PARTFLAGS(sb, UDF_SB_PARTITION(sb)) & |
1758 | if (UDF_SB_PARTTYPE(sb, UDF_SB_PARTITION(sb)) == UDF_SPARABLE_MAP15) | 1871 | UDF_PART_FLAG_UNALLOC_BITMAP) |
1759 | { | 1872 | UDF_SB_FREE_BITMAP(sb, UDF_SB_PARTITION(sb), s_uspace); |
1760 | for (i=0; i<4; i++) | 1873 | if (UDF_SB_PARTFLAGS(sb, UDF_SB_PARTITION(sb)) & |
1761 | brelse(UDF_SB_TYPESPAR(sb, UDF_SB_PARTITION(sb)).s_spar_map[i]); | 1874 | UDF_PART_FLAG_FREED_BITMAP) |
1875 | UDF_SB_FREE_BITMAP(sb, UDF_SB_PARTITION(sb), s_fspace); | ||
1876 | if (UDF_SB_PARTTYPE(sb, UDF_SB_PARTITION(sb)) == | ||
1877 | UDF_SPARABLE_MAP15) { | ||
1878 | for (i = 0; i < 4; i++) | ||
1879 | brelse(UDF_SB_TYPESPAR | ||
1880 | (sb, | ||
1881 | UDF_SB_PARTITION(sb)).s_spar_map[i]); | ||
1762 | } | 1882 | } |
1763 | } | 1883 | } |
1764 | #ifdef CONFIG_UDF_NLS | 1884 | #ifdef CONFIG_UDF_NLS |
@@ -1786,8 +1906,7 @@ udf_put_super(struct super_block *sb) | |||
1786 | * July 1, 1997 - Andrew E. Mileski | 1906 | * July 1, 1997 - Andrew E. Mileski |
1787 | * Written, tested, and released. | 1907 | * Written, tested, and released. |
1788 | */ | 1908 | */ |
1789 | static int | 1909 | static int udf_statfs(struct dentry *dentry, struct kstatfs *buf) |
1790 | udf_statfs(struct dentry *dentry, struct kstatfs *buf) | ||
1791 | { | 1910 | { |
1792 | struct super_block *sb = dentry->d_sb; | 1911 | struct super_block *sb = dentry->d_sb; |
1793 | 1912 | ||
@@ -1797,11 +1916,12 @@ udf_statfs(struct dentry *dentry, struct kstatfs *buf) | |||
1797 | buf->f_bfree = udf_count_free(sb); | 1916 | buf->f_bfree = udf_count_free(sb); |
1798 | buf->f_bavail = buf->f_bfree; | 1917 | buf->f_bavail = buf->f_bfree; |
1799 | buf->f_files = (UDF_SB_LVIDBH(sb) ? | 1918 | buf->f_files = (UDF_SB_LVIDBH(sb) ? |
1800 | (le32_to_cpu(UDF_SB_LVIDIU(sb)->numFiles) + | 1919 | (le32_to_cpu(UDF_SB_LVIDIU(sb)->numFiles) + |
1801 | le32_to_cpu(UDF_SB_LVIDIU(sb)->numDirs)) : 0) + buf->f_bfree; | 1920 | le32_to_cpu(UDF_SB_LVIDIU(sb)->numDirs)) : 0) + |
1921 | buf->f_bfree; | ||
1802 | buf->f_ffree = buf->f_bfree; | 1922 | buf->f_ffree = buf->f_bfree; |
1803 | /* __kernel_fsid_t f_fsid */ | 1923 | /* __kernel_fsid_t f_fsid */ |
1804 | buf->f_namelen = UDF_NAME_LEN-2; | 1924 | buf->f_namelen = UDF_NAME_LEN - 2; |
1805 | 1925 | ||
1806 | return 0; | 1926 | return 0; |
1807 | } | 1927 | } |
@@ -1830,13 +1950,10 @@ udf_count_free_bitmap(struct super_block *sb, struct udf_bitmap *bitmap) | |||
1830 | loc.partitionReferenceNum = UDF_SB_PARTITION(sb); | 1950 | loc.partitionReferenceNum = UDF_SB_PARTITION(sb); |
1831 | bh = udf_read_ptagged(sb, loc, 0, &ident); | 1951 | bh = udf_read_ptagged(sb, loc, 0, &ident); |
1832 | 1952 | ||
1833 | if (!bh) | 1953 | if (!bh) { |
1834 | { | ||
1835 | printk(KERN_ERR "udf: udf_count_free failed\n"); | 1954 | printk(KERN_ERR "udf: udf_count_free failed\n"); |
1836 | goto out; | 1955 | goto out; |
1837 | } | 1956 | } else if (ident != TAG_IDENT_SBD) { |
1838 | else if (ident != TAG_IDENT_SBD) | ||
1839 | { | ||
1840 | brelse(bh); | 1957 | brelse(bh); |
1841 | printk(KERN_ERR "udf: udf_count_free failed\n"); | 1958 | printk(KERN_ERR "udf: udf_count_free failed\n"); |
1842 | goto out; | 1959 | goto out; |
@@ -1844,43 +1961,39 @@ udf_count_free_bitmap(struct super_block *sb, struct udf_bitmap *bitmap) | |||
1844 | 1961 | ||
1845 | bm = (struct spaceBitmapDesc *)bh->b_data; | 1962 | bm = (struct spaceBitmapDesc *)bh->b_data; |
1846 | bytes = le32_to_cpu(bm->numOfBytes); | 1963 | bytes = le32_to_cpu(bm->numOfBytes); |
1847 | index = sizeof(struct spaceBitmapDesc); /* offset in first block only */ | 1964 | index = sizeof(struct spaceBitmapDesc); /* offset in first block only */ |
1848 | ptr = (uint8_t *)bh->b_data; | 1965 | ptr = (uint8_t *) bh->b_data; |
1849 | 1966 | ||
1850 | while ( bytes > 0 ) | 1967 | while (bytes > 0) { |
1851 | { | 1968 | while ((bytes > 0) && (index < sb->s_blocksize)) { |
1852 | while ((bytes > 0) && (index < sb->s_blocksize)) | ||
1853 | { | ||
1854 | value = ptr[index]; | 1969 | value = ptr[index]; |
1855 | accum += udf_bitmap_lookup[ value & 0x0f ]; | 1970 | accum += udf_bitmap_lookup[value & 0x0f]; |
1856 | accum += udf_bitmap_lookup[ value >> 4 ]; | 1971 | accum += udf_bitmap_lookup[value >> 4]; |
1857 | index++; | 1972 | index++; |
1858 | bytes--; | 1973 | bytes--; |
1859 | } | 1974 | } |
1860 | if ( bytes ) | 1975 | if (bytes) { |
1861 | { | ||
1862 | brelse(bh); | 1976 | brelse(bh); |
1863 | newblock = udf_get_lb_pblock(sb, loc, ++block); | 1977 | newblock = udf_get_lb_pblock(sb, loc, ++block); |
1864 | bh = udf_tread(sb, newblock); | 1978 | bh = udf_tread(sb, newblock); |
1865 | if (!bh) | 1979 | if (!bh) { |
1866 | { | ||
1867 | udf_debug("read failed\n"); | 1980 | udf_debug("read failed\n"); |
1868 | goto out; | 1981 | goto out; |
1869 | } | 1982 | } |
1870 | index = 0; | 1983 | index = 0; |
1871 | ptr = (uint8_t *)bh->b_data; | 1984 | ptr = (uint8_t *) bh->b_data; |
1872 | } | 1985 | } |
1873 | } | 1986 | } |
1874 | brelse(bh); | 1987 | brelse(bh); |
1875 | 1988 | ||
1876 | out: | 1989 | out: |
1877 | unlock_kernel(); | 1990 | unlock_kernel(); |
1878 | 1991 | ||
1879 | return accum; | 1992 | return accum; |
1880 | } | 1993 | } |
1881 | 1994 | ||
1882 | static unsigned int | 1995 | static unsigned int |
1883 | udf_count_free_table(struct super_block *sb, struct inode * table) | 1996 | udf_count_free_table(struct super_block *sb, struct inode *table) |
1884 | { | 1997 | { |
1885 | unsigned int accum = 0; | 1998 | unsigned int accum = 0; |
1886 | uint32_t elen; | 1999 | uint32_t elen; |
@@ -1902,17 +2015,17 @@ udf_count_free_table(struct super_block *sb, struct inode * table) | |||
1902 | 2015 | ||
1903 | return accum; | 2016 | return accum; |
1904 | } | 2017 | } |
1905 | 2018 | ||
1906 | static unsigned int | 2019 | static unsigned int udf_count_free(struct super_block *sb) |
1907 | udf_count_free(struct super_block *sb) | ||
1908 | { | 2020 | { |
1909 | unsigned int accum = 0; | 2021 | unsigned int accum = 0; |
1910 | 2022 | ||
1911 | if (UDF_SB_LVIDBH(sb)) | 2023 | if (UDF_SB_LVIDBH(sb)) { |
1912 | { | 2024 | if (le32_to_cpu(UDF_SB_LVID(sb)->numOfPartitions) > |
1913 | if (le32_to_cpu(UDF_SB_LVID(sb)->numOfPartitions) > UDF_SB_PARTITION(sb)) | 2025 | UDF_SB_PARTITION(sb)) { |
1914 | { | 2026 | accum = |
1915 | accum = le32_to_cpu(UDF_SB_LVID(sb)->freeSpaceTable[UDF_SB_PARTITION(sb)]); | 2027 | le32_to_cpu(UDF_SB_LVID(sb)-> |
2028 | freeSpaceTable[UDF_SB_PARTITION(sb)]); | ||
1916 | 2029 | ||
1917 | if (accum == 0xFFFFFFFF) | 2030 | if (accum == 0xFFFFFFFF) |
1918 | accum = 0; | 2031 | accum = 0; |
@@ -1922,28 +2035,40 @@ udf_count_free(struct super_block *sb) | |||
1922 | if (accum) | 2035 | if (accum) |
1923 | return accum; | 2036 | return accum; |
1924 | 2037 | ||
1925 | if (UDF_SB_PARTFLAGS(sb,UDF_SB_PARTITION(sb)) & UDF_PART_FLAG_UNALLOC_BITMAP) | 2038 | if (UDF_SB_PARTFLAGS(sb, UDF_SB_PARTITION(sb)) & |
1926 | { | 2039 | UDF_PART_FLAG_UNALLOC_BITMAP) { |
1927 | accum += udf_count_free_bitmap(sb, | 2040 | accum += |
1928 | UDF_SB_PARTMAPS(sb)[UDF_SB_PARTITION(sb)].s_uspace.s_bitmap); | 2041 | udf_count_free_bitmap(sb, |
2042 | UDF_SB_PARTMAPS(sb)[UDF_SB_PARTITION | ||
2043 | (sb)].s_uspace. | ||
2044 | s_bitmap); | ||
1929 | } | 2045 | } |
1930 | if (UDF_SB_PARTFLAGS(sb,UDF_SB_PARTITION(sb)) & UDF_PART_FLAG_FREED_BITMAP) | 2046 | if (UDF_SB_PARTFLAGS(sb, UDF_SB_PARTITION(sb)) & |
1931 | { | 2047 | UDF_PART_FLAG_FREED_BITMAP) { |
1932 | accum += udf_count_free_bitmap(sb, | 2048 | accum += |
1933 | UDF_SB_PARTMAPS(sb)[UDF_SB_PARTITION(sb)].s_fspace.s_bitmap); | 2049 | udf_count_free_bitmap(sb, |
2050 | UDF_SB_PARTMAPS(sb)[UDF_SB_PARTITION | ||
2051 | (sb)].s_fspace. | ||
2052 | s_bitmap); | ||
1934 | } | 2053 | } |
1935 | if (accum) | 2054 | if (accum) |
1936 | return accum; | 2055 | return accum; |
1937 | 2056 | ||
1938 | if (UDF_SB_PARTFLAGS(sb,UDF_SB_PARTITION(sb)) & UDF_PART_FLAG_UNALLOC_TABLE) | 2057 | if (UDF_SB_PARTFLAGS(sb, UDF_SB_PARTITION(sb)) & |
1939 | { | 2058 | UDF_PART_FLAG_UNALLOC_TABLE) { |
1940 | accum += udf_count_free_table(sb, | 2059 | accum += |
1941 | UDF_SB_PARTMAPS(sb)[UDF_SB_PARTITION(sb)].s_uspace.s_table); | 2060 | udf_count_free_table(sb, |
2061 | UDF_SB_PARTMAPS(sb)[UDF_SB_PARTITION | ||
2062 | (sb)].s_uspace. | ||
2063 | s_table); | ||
1942 | } | 2064 | } |
1943 | if (UDF_SB_PARTFLAGS(sb,UDF_SB_PARTITION(sb)) & UDF_PART_FLAG_FREED_TABLE) | 2065 | if (UDF_SB_PARTFLAGS(sb, UDF_SB_PARTITION(sb)) & |
1944 | { | 2066 | UDF_PART_FLAG_FREED_TABLE) { |
1945 | accum += udf_count_free_table(sb, | 2067 | accum += |
1946 | UDF_SB_PARTMAPS(sb)[UDF_SB_PARTITION(sb)].s_fspace.s_table); | 2068 | udf_count_free_table(sb, |
2069 | UDF_SB_PARTMAPS(sb)[UDF_SB_PARTITION | ||
2070 | (sb)].s_fspace. | ||
2071 | s_table); | ||
1947 | } | 2072 | } |
1948 | 2073 | ||
1949 | return accum; | 2074 | return accum; |