diff options
Diffstat (limited to 'fs/ufs')
-rw-r--r-- | fs/ufs/balloc.c | 1 | ||||
-rw-r--r-- | fs/ufs/cylinder.c | 1 | ||||
-rw-r--r-- | fs/ufs/dir.c | 56 | ||||
-rw-r--r-- | fs/ufs/file.c | 3 | ||||
-rw-r--r-- | fs/ufs/ialloc.c | 1 | ||||
-rw-r--r-- | fs/ufs/inode.c | 24 | ||||
-rw-r--r-- | fs/ufs/namei.c | 3 | ||||
-rw-r--r-- | fs/ufs/super.c | 100 | ||||
-rw-r--r-- | fs/ufs/symlink.c | 2 | ||||
-rw-r--r-- | fs/ufs/truncate.c | 1 | ||||
-rw-r--r-- | fs/ufs/ufs.h | 157 | ||||
-rw-r--r-- | fs/ufs/util.c | 1 | ||||
-rw-r--r-- | fs/ufs/util.h | 53 |
13 files changed, 347 insertions, 56 deletions
diff --git a/fs/ufs/balloc.c b/fs/ufs/balloc.c index 841ac25fd950..f63a09ce8683 100644 --- a/fs/ufs/balloc.c +++ b/fs/ufs/balloc.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/bitops.h> | 19 | #include <linux/bitops.h> |
20 | #include <asm/byteorder.h> | 20 | #include <asm/byteorder.h> |
21 | 21 | ||
22 | #include "ufs.h" | ||
22 | #include "swab.h" | 23 | #include "swab.h" |
23 | #include "util.h" | 24 | #include "util.h" |
24 | 25 | ||
diff --git a/fs/ufs/cylinder.c b/fs/ufs/cylinder.c index 09c39e5e6386..2a815665644f 100644 --- a/fs/ufs/cylinder.c +++ b/fs/ufs/cylinder.c | |||
@@ -17,6 +17,7 @@ | |||
17 | 17 | ||
18 | #include <asm/byteorder.h> | 18 | #include <asm/byteorder.h> |
19 | 19 | ||
20 | #include "ufs.h" | ||
20 | #include "swab.h" | 21 | #include "swab.h" |
21 | #include "util.h" | 22 | #include "util.h" |
22 | 23 | ||
diff --git a/fs/ufs/dir.c b/fs/ufs/dir.c index 154452172f43..30f8c2bb0c3e 100644 --- a/fs/ufs/dir.c +++ b/fs/ufs/dir.c | |||
@@ -19,7 +19,9 @@ | |||
19 | #include <linux/time.h> | 19 | #include <linux/time.h> |
20 | #include <linux/fs.h> | 20 | #include <linux/fs.h> |
21 | #include <linux/ufs_fs.h> | 21 | #include <linux/ufs_fs.h> |
22 | #include <linux/swap.h> | ||
22 | 23 | ||
24 | #include "ufs.h" | ||
23 | #include "swab.h" | 25 | #include "swab.h" |
24 | #include "util.h" | 26 | #include "util.h" |
25 | 27 | ||
@@ -38,12 +40,18 @@ static inline int ufs_match(struct super_block *sb, int len, | |||
38 | return !memcmp(name, de->d_name, len); | 40 | return !memcmp(name, de->d_name, len); |
39 | } | 41 | } |
40 | 42 | ||
41 | static int ufs_commit_chunk(struct page *page, unsigned from, unsigned to) | 43 | static int ufs_commit_chunk(struct page *page, loff_t pos, unsigned len) |
42 | { | 44 | { |
43 | struct inode *dir = page->mapping->host; | 45 | struct address_space *mapping = page->mapping; |
46 | struct inode *dir = mapping->host; | ||
44 | int err = 0; | 47 | int err = 0; |
48 | |||
45 | dir->i_version++; | 49 | dir->i_version++; |
46 | page->mapping->a_ops->commit_write(NULL, page, from, to); | 50 | block_write_end(NULL, mapping, pos, len, len, page, NULL); |
51 | if (pos+len > dir->i_size) { | ||
52 | i_size_write(dir, pos+len); | ||
53 | mark_inode_dirty(dir); | ||
54 | } | ||
47 | if (IS_DIRSYNC(dir)) | 55 | if (IS_DIRSYNC(dir)) |
48 | err = write_one_page(page, 1); | 56 | err = write_one_page(page, 1); |
49 | else | 57 | else |
@@ -81,16 +89,20 @@ ino_t ufs_inode_by_name(struct inode *dir, struct dentry *dentry) | |||
81 | void ufs_set_link(struct inode *dir, struct ufs_dir_entry *de, | 89 | void ufs_set_link(struct inode *dir, struct ufs_dir_entry *de, |
82 | struct page *page, struct inode *inode) | 90 | struct page *page, struct inode *inode) |
83 | { | 91 | { |
84 | unsigned from = (char *) de - (char *) page_address(page); | 92 | loff_t pos = page_offset(page) + |
85 | unsigned to = from + fs16_to_cpu(dir->i_sb, de->d_reclen); | 93 | (char *) de - (char *) page_address(page); |
94 | unsigned len = fs16_to_cpu(dir->i_sb, de->d_reclen); | ||
86 | int err; | 95 | int err; |
87 | 96 | ||
88 | lock_page(page); | 97 | lock_page(page); |
89 | err = page->mapping->a_ops->prepare_write(NULL, page, from, to); | 98 | err = __ufs_write_begin(NULL, page->mapping, pos, len, |
99 | AOP_FLAG_UNINTERRUPTIBLE, &page, NULL); | ||
90 | BUG_ON(err); | 100 | BUG_ON(err); |
101 | |||
91 | de->d_ino = cpu_to_fs32(dir->i_sb, inode->i_ino); | 102 | de->d_ino = cpu_to_fs32(dir->i_sb, inode->i_ino); |
92 | ufs_set_de_type(dir->i_sb, de, inode->i_mode); | 103 | ufs_set_de_type(dir->i_sb, de, inode->i_mode); |
93 | err = ufs_commit_chunk(page, from, to); | 104 | |
105 | err = ufs_commit_chunk(page, pos, len); | ||
94 | ufs_put_page(page); | 106 | ufs_put_page(page); |
95 | dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC; | 107 | dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC; |
96 | mark_inode_dirty(dir); | 108 | mark_inode_dirty(dir); |
@@ -312,7 +324,7 @@ int ufs_add_link(struct dentry *dentry, struct inode *inode) | |||
312 | unsigned long npages = ufs_dir_pages(dir); | 324 | unsigned long npages = ufs_dir_pages(dir); |
313 | unsigned long n; | 325 | unsigned long n; |
314 | char *kaddr; | 326 | char *kaddr; |
315 | unsigned from, to; | 327 | loff_t pos; |
316 | int err; | 328 | int err; |
317 | 329 | ||
318 | UFSD("ENTER, name %s, namelen %u\n", name, namelen); | 330 | UFSD("ENTER, name %s, namelen %u\n", name, namelen); |
@@ -367,9 +379,10 @@ int ufs_add_link(struct dentry *dentry, struct inode *inode) | |||
367 | return -EINVAL; | 379 | return -EINVAL; |
368 | 380 | ||
369 | got_it: | 381 | got_it: |
370 | from = (char*)de - (char*)page_address(page); | 382 | pos = page_offset(page) + |
371 | to = from + rec_len; | 383 | (char*)de - (char*)page_address(page); |
372 | err = page->mapping->a_ops->prepare_write(NULL, page, from, to); | 384 | err = __ufs_write_begin(NULL, page->mapping, pos, rec_len, |
385 | AOP_FLAG_UNINTERRUPTIBLE, &page, NULL); | ||
373 | if (err) | 386 | if (err) |
374 | goto out_unlock; | 387 | goto out_unlock; |
375 | if (de->d_ino) { | 388 | if (de->d_ino) { |
@@ -386,7 +399,7 @@ got_it: | |||
386 | de->d_ino = cpu_to_fs32(sb, inode->i_ino); | 399 | de->d_ino = cpu_to_fs32(sb, inode->i_ino); |
387 | ufs_set_de_type(sb, de, inode->i_mode); | 400 | ufs_set_de_type(sb, de, inode->i_mode); |
388 | 401 | ||
389 | err = ufs_commit_chunk(page, from, to); | 402 | err = ufs_commit_chunk(page, pos, rec_len); |
390 | dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC; | 403 | dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC; |
391 | 404 | ||
392 | mark_inode_dirty(dir); | 405 | mark_inode_dirty(dir); |
@@ -509,6 +522,7 @@ int ufs_delete_entry(struct inode *inode, struct ufs_dir_entry *dir, | |||
509 | char *kaddr = page_address(page); | 522 | char *kaddr = page_address(page); |
510 | unsigned from = ((char*)dir - kaddr) & ~(UFS_SB(sb)->s_uspi->s_dirblksize - 1); | 523 | unsigned from = ((char*)dir - kaddr) & ~(UFS_SB(sb)->s_uspi->s_dirblksize - 1); |
511 | unsigned to = ((char*)dir - kaddr) + fs16_to_cpu(sb, dir->d_reclen); | 524 | unsigned to = ((char*)dir - kaddr) + fs16_to_cpu(sb, dir->d_reclen); |
525 | loff_t pos; | ||
512 | struct ufs_dir_entry *pde = NULL; | 526 | struct ufs_dir_entry *pde = NULL; |
513 | struct ufs_dir_entry *de = (struct ufs_dir_entry *) (kaddr + from); | 527 | struct ufs_dir_entry *de = (struct ufs_dir_entry *) (kaddr + from); |
514 | int err; | 528 | int err; |
@@ -532,13 +546,16 @@ int ufs_delete_entry(struct inode *inode, struct ufs_dir_entry *dir, | |||
532 | } | 546 | } |
533 | if (pde) | 547 | if (pde) |
534 | from = (char*)pde - (char*)page_address(page); | 548 | from = (char*)pde - (char*)page_address(page); |
549 | |||
550 | pos = page_offset(page) + from; | ||
535 | lock_page(page); | 551 | lock_page(page); |
536 | err = mapping->a_ops->prepare_write(NULL, page, from, to); | 552 | err = __ufs_write_begin(NULL, mapping, pos, to - from, |
553 | AOP_FLAG_UNINTERRUPTIBLE, &page, NULL); | ||
537 | BUG_ON(err); | 554 | BUG_ON(err); |
538 | if (pde) | 555 | if (pde) |
539 | pde->d_reclen = cpu_to_fs16(sb, to-from); | 556 | pde->d_reclen = cpu_to_fs16(sb, to - from); |
540 | dir->d_ino = 0; | 557 | dir->d_ino = 0; |
541 | err = ufs_commit_chunk(page, from, to); | 558 | err = ufs_commit_chunk(page, pos, to - from); |
542 | inode->i_ctime = inode->i_mtime = CURRENT_TIME_SEC; | 559 | inode->i_ctime = inode->i_mtime = CURRENT_TIME_SEC; |
543 | mark_inode_dirty(inode); | 560 | mark_inode_dirty(inode); |
544 | out: | 561 | out: |
@@ -559,14 +576,15 @@ int ufs_make_empty(struct inode * inode, struct inode *dir) | |||
559 | 576 | ||
560 | if (!page) | 577 | if (!page) |
561 | return -ENOMEM; | 578 | return -ENOMEM; |
562 | kmap(page); | 579 | |
563 | err = mapping->a_ops->prepare_write(NULL, page, 0, chunk_size); | 580 | err = __ufs_write_begin(NULL, mapping, 0, chunk_size, |
581 | AOP_FLAG_UNINTERRUPTIBLE, &page, NULL); | ||
564 | if (err) { | 582 | if (err) { |
565 | unlock_page(page); | 583 | unlock_page(page); |
566 | goto fail; | 584 | goto fail; |
567 | } | 585 | } |
568 | 586 | ||
569 | 587 | kmap(page); | |
570 | base = (char*)page_address(page); | 588 | base = (char*)page_address(page); |
571 | memset(base, 0, PAGE_CACHE_SIZE); | 589 | memset(base, 0, PAGE_CACHE_SIZE); |
572 | 590 | ||
@@ -584,10 +602,10 @@ int ufs_make_empty(struct inode * inode, struct inode *dir) | |||
584 | de->d_reclen = cpu_to_fs16(sb, chunk_size - UFS_DIR_REC_LEN(1)); | 602 | de->d_reclen = cpu_to_fs16(sb, chunk_size - UFS_DIR_REC_LEN(1)); |
585 | ufs_set_de_namlen(sb, de, 2); | 603 | ufs_set_de_namlen(sb, de, 2); |
586 | strcpy (de->d_name, ".."); | 604 | strcpy (de->d_name, ".."); |
605 | kunmap(page); | ||
587 | 606 | ||
588 | err = ufs_commit_chunk(page, 0, chunk_size); | 607 | err = ufs_commit_chunk(page, 0, chunk_size); |
589 | fail: | 608 | fail: |
590 | kunmap(page); | ||
591 | page_cache_release(page); | 609 | page_cache_release(page); |
592 | return err; | 610 | return err; |
593 | } | 611 | } |
diff --git a/fs/ufs/file.c b/fs/ufs/file.c index 6705d74c6d2d..a46c97bf023f 100644 --- a/fs/ufs/file.c +++ b/fs/ufs/file.c | |||
@@ -27,6 +27,9 @@ | |||
27 | #include <linux/ufs_fs.h> | 27 | #include <linux/ufs_fs.h> |
28 | #include <linux/buffer_head.h> /* for sync_mapping_buffers() */ | 28 | #include <linux/buffer_head.h> /* for sync_mapping_buffers() */ |
29 | 29 | ||
30 | #include "ufs.h" | ||
31 | |||
32 | |||
30 | static int ufs_sync_file(struct file *file, struct dentry *dentry, int datasync) | 33 | static int ufs_sync_file(struct file *file, struct dentry *dentry, int datasync) |
31 | { | 34 | { |
32 | struct inode *inode = dentry->d_inode; | 35 | struct inode *inode = dentry->d_inode; |
diff --git a/fs/ufs/ialloc.c b/fs/ufs/ialloc.c index c28a8b6f2feb..7e260bc0d94f 100644 --- a/fs/ufs/ialloc.c +++ b/fs/ufs/ialloc.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/bitops.h> | 34 | #include <linux/bitops.h> |
35 | #include <asm/byteorder.h> | 35 | #include <asm/byteorder.h> |
36 | 36 | ||
37 | #include "ufs.h" | ||
37 | #include "swab.h" | 38 | #include "swab.h" |
38 | #include "util.h" | 39 | #include "util.h" |
39 | 40 | ||
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c index f18b79122fa3..4320782761ae 100644 --- a/fs/ufs/inode.c +++ b/fs/ufs/inode.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/smp_lock.h> | 38 | #include <linux/smp_lock.h> |
39 | #include <linux/buffer_head.h> | 39 | #include <linux/buffer_head.h> |
40 | 40 | ||
41 | #include "ufs.h" | ||
41 | #include "swab.h" | 42 | #include "swab.h" |
42 | #include "util.h" | 43 | #include "util.h" |
43 | 44 | ||
@@ -558,24 +559,39 @@ static int ufs_writepage(struct page *page, struct writeback_control *wbc) | |||
558 | { | 559 | { |
559 | return block_write_full_page(page,ufs_getfrag_block,wbc); | 560 | return block_write_full_page(page,ufs_getfrag_block,wbc); |
560 | } | 561 | } |
562 | |||
561 | static int ufs_readpage(struct file *file, struct page *page) | 563 | static int ufs_readpage(struct file *file, struct page *page) |
562 | { | 564 | { |
563 | return block_read_full_page(page,ufs_getfrag_block); | 565 | return block_read_full_page(page,ufs_getfrag_block); |
564 | } | 566 | } |
565 | static int ufs_prepare_write(struct file *file, struct page *page, unsigned from, unsigned to) | 567 | |
568 | int __ufs_write_begin(struct file *file, struct address_space *mapping, | ||
569 | loff_t pos, unsigned len, unsigned flags, | ||
570 | struct page **pagep, void **fsdata) | ||
566 | { | 571 | { |
567 | return block_prepare_write(page,from,to,ufs_getfrag_block); | 572 | return block_write_begin(file, mapping, pos, len, flags, pagep, fsdata, |
573 | ufs_getfrag_block); | ||
568 | } | 574 | } |
575 | |||
576 | static int ufs_write_begin(struct file *file, struct address_space *mapping, | ||
577 | loff_t pos, unsigned len, unsigned flags, | ||
578 | struct page **pagep, void **fsdata) | ||
579 | { | ||
580 | *pagep = NULL; | ||
581 | return __ufs_write_begin(file, mapping, pos, len, flags, pagep, fsdata); | ||
582 | } | ||
583 | |||
569 | static sector_t ufs_bmap(struct address_space *mapping, sector_t block) | 584 | static sector_t ufs_bmap(struct address_space *mapping, sector_t block) |
570 | { | 585 | { |
571 | return generic_block_bmap(mapping,block,ufs_getfrag_block); | 586 | return generic_block_bmap(mapping,block,ufs_getfrag_block); |
572 | } | 587 | } |
588 | |||
573 | const struct address_space_operations ufs_aops = { | 589 | const struct address_space_operations ufs_aops = { |
574 | .readpage = ufs_readpage, | 590 | .readpage = ufs_readpage, |
575 | .writepage = ufs_writepage, | 591 | .writepage = ufs_writepage, |
576 | .sync_page = block_sync_page, | 592 | .sync_page = block_sync_page, |
577 | .prepare_write = ufs_prepare_write, | 593 | .write_begin = ufs_write_begin, |
578 | .commit_write = generic_commit_write, | 594 | .write_end = generic_write_end, |
579 | .bmap = ufs_bmap | 595 | .bmap = ufs_bmap |
580 | }; | 596 | }; |
581 | 597 | ||
diff --git a/fs/ufs/namei.c b/fs/ufs/namei.c index a059ccd064ea..d8bfbee2fe2b 100644 --- a/fs/ufs/namei.c +++ b/fs/ufs/namei.c | |||
@@ -31,7 +31,7 @@ | |||
31 | #include <linux/fs.h> | 31 | #include <linux/fs.h> |
32 | #include <linux/ufs_fs.h> | 32 | #include <linux/ufs_fs.h> |
33 | #include <linux/smp_lock.h> | 33 | #include <linux/smp_lock.h> |
34 | #include "swab.h" /* will go away - see comment in mknod() */ | 34 | #include "ufs.h" |
35 | #include "util.h" | 35 | #include "util.h" |
36 | 36 | ||
37 | static inline int ufs_add_nondir(struct dentry *dentry, struct inode *inode) | 37 | static inline int ufs_add_nondir(struct dentry *dentry, struct inode *inode) |
@@ -110,7 +110,6 @@ static int ufs_mknod (struct inode * dir, struct dentry *dentry, int mode, dev_t | |||
110 | err = PTR_ERR(inode); | 110 | err = PTR_ERR(inode); |
111 | if (!IS_ERR(inode)) { | 111 | if (!IS_ERR(inode)) { |
112 | init_special_inode(inode, mode, rdev); | 112 | init_special_inode(inode, mode, rdev); |
113 | /* NOTE: that'll go when we get wide dev_t */ | ||
114 | ufs_set_inode_dev(inode->i_sb, UFS_I(inode), rdev); | 113 | ufs_set_inode_dev(inode->i_sb, UFS_I(inode), rdev); |
115 | mark_inode_dirty(inode); | 114 | mark_inode_dirty(inode); |
116 | lock_kernel(); | 115 | lock_kernel(); |
diff --git a/fs/ufs/super.c b/fs/ufs/super.c index 73402c5eeb8a..584cf12cc40f 100644 --- a/fs/ufs/super.c +++ b/fs/ufs/super.c | |||
@@ -88,7 +88,10 @@ | |||
88 | #include <linux/buffer_head.h> | 88 | #include <linux/buffer_head.h> |
89 | #include <linux/vfs.h> | 89 | #include <linux/vfs.h> |
90 | #include <linux/log2.h> | 90 | #include <linux/log2.h> |
91 | #include <linux/mount.h> | ||
92 | #include <linux/seq_file.h> | ||
91 | 93 | ||
94 | #include "ufs.h" | ||
92 | #include "swab.h" | 95 | #include "swab.h" |
93 | #include "util.h" | 96 | #include "util.h" |
94 | 97 | ||
@@ -286,16 +289,28 @@ void ufs_warning (struct super_block * sb, const char * function, | |||
286 | } | 289 | } |
287 | 290 | ||
288 | enum { | 291 | enum { |
289 | Opt_type_old, Opt_type_sunx86, Opt_type_sun, Opt_type_44bsd, | 292 | Opt_type_old = UFS_MOUNT_UFSTYPE_OLD, |
290 | Opt_type_ufs2, Opt_type_hp, Opt_type_nextstepcd, Opt_type_nextstep, | 293 | Opt_type_sunx86 = UFS_MOUNT_UFSTYPE_SUNx86, |
291 | Opt_type_openstep, Opt_onerror_panic, Opt_onerror_lock, | 294 | Opt_type_sun = UFS_MOUNT_UFSTYPE_SUN, |
292 | Opt_onerror_umount, Opt_onerror_repair, Opt_err | 295 | Opt_type_sunos = UFS_MOUNT_UFSTYPE_SUNOS, |
296 | Opt_type_44bsd = UFS_MOUNT_UFSTYPE_44BSD, | ||
297 | Opt_type_ufs2 = UFS_MOUNT_UFSTYPE_UFS2, | ||
298 | Opt_type_hp = UFS_MOUNT_UFSTYPE_HP, | ||
299 | Opt_type_nextstepcd = UFS_MOUNT_UFSTYPE_NEXTSTEP_CD, | ||
300 | Opt_type_nextstep = UFS_MOUNT_UFSTYPE_NEXTSTEP, | ||
301 | Opt_type_openstep = UFS_MOUNT_UFSTYPE_OPENSTEP, | ||
302 | Opt_onerror_panic = UFS_MOUNT_ONERROR_PANIC, | ||
303 | Opt_onerror_lock = UFS_MOUNT_ONERROR_LOCK, | ||
304 | Opt_onerror_umount = UFS_MOUNT_ONERROR_UMOUNT, | ||
305 | Opt_onerror_repair = UFS_MOUNT_ONERROR_REPAIR, | ||
306 | Opt_err | ||
293 | }; | 307 | }; |
294 | 308 | ||
295 | static match_table_t tokens = { | 309 | static match_table_t tokens = { |
296 | {Opt_type_old, "ufstype=old"}, | 310 | {Opt_type_old, "ufstype=old"}, |
297 | {Opt_type_sunx86, "ufstype=sunx86"}, | 311 | {Opt_type_sunx86, "ufstype=sunx86"}, |
298 | {Opt_type_sun, "ufstype=sun"}, | 312 | {Opt_type_sun, "ufstype=sun"}, |
313 | {Opt_type_sunos, "ufstype=sunos"}, | ||
299 | {Opt_type_44bsd, "ufstype=44bsd"}, | 314 | {Opt_type_44bsd, "ufstype=44bsd"}, |
300 | {Opt_type_ufs2, "ufstype=ufs2"}, | 315 | {Opt_type_ufs2, "ufstype=ufs2"}, |
301 | {Opt_type_ufs2, "ufstype=5xbsd"}, | 316 | {Opt_type_ufs2, "ufstype=5xbsd"}, |
@@ -303,6 +318,7 @@ static match_table_t tokens = { | |||
303 | {Opt_type_nextstepcd, "ufstype=nextstep-cd"}, | 318 | {Opt_type_nextstepcd, "ufstype=nextstep-cd"}, |
304 | {Opt_type_nextstep, "ufstype=nextstep"}, | 319 | {Opt_type_nextstep, "ufstype=nextstep"}, |
305 | {Opt_type_openstep, "ufstype=openstep"}, | 320 | {Opt_type_openstep, "ufstype=openstep"}, |
321 | /*end of possible ufs types */ | ||
306 | {Opt_onerror_panic, "onerror=panic"}, | 322 | {Opt_onerror_panic, "onerror=panic"}, |
307 | {Opt_onerror_lock, "onerror=lock"}, | 323 | {Opt_onerror_lock, "onerror=lock"}, |
308 | {Opt_onerror_umount, "onerror=umount"}, | 324 | {Opt_onerror_umount, "onerror=umount"}, |
@@ -339,6 +355,10 @@ static int ufs_parse_options (char * options, unsigned * mount_options) | |||
339 | ufs_clear_opt (*mount_options, UFSTYPE); | 355 | ufs_clear_opt (*mount_options, UFSTYPE); |
340 | ufs_set_opt (*mount_options, UFSTYPE_SUN); | 356 | ufs_set_opt (*mount_options, UFSTYPE_SUN); |
341 | break; | 357 | break; |
358 | case Opt_type_sunos: | ||
359 | ufs_clear_opt(*mount_options, UFSTYPE); | ||
360 | ufs_set_opt(*mount_options, UFSTYPE_SUNOS); | ||
361 | break; | ||
342 | case Opt_type_44bsd: | 362 | case Opt_type_44bsd: |
343 | ufs_clear_opt (*mount_options, UFSTYPE); | 363 | ufs_clear_opt (*mount_options, UFSTYPE); |
344 | ufs_set_opt (*mount_options, UFSTYPE_44BSD); | 364 | ufs_set_opt (*mount_options, UFSTYPE_44BSD); |
@@ -654,8 +674,8 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent) | |||
654 | ufs_set_opt (sbi->s_mount_opt, UFSTYPE_OLD); | 674 | ufs_set_opt (sbi->s_mount_opt, UFSTYPE_OLD); |
655 | } | 675 | } |
656 | 676 | ||
657 | sbi->s_uspi = uspi = | 677 | uspi = kzalloc(sizeof(struct ufs_sb_private_info), GFP_KERNEL); |
658 | kmalloc (sizeof(struct ufs_sb_private_info), GFP_KERNEL); | 678 | sbi->s_uspi = uspi; |
659 | if (!uspi) | 679 | if (!uspi) |
660 | goto failed; | 680 | goto failed; |
661 | uspi->s_dirblksize = UFS_SECTOR_SIZE; | 681 | uspi->s_dirblksize = UFS_SECTOR_SIZE; |
@@ -692,10 +712,22 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent) | |||
692 | uspi->s_fshift = 10; | 712 | uspi->s_fshift = 10; |
693 | uspi->s_sbsize = super_block_size = 2048; | 713 | uspi->s_sbsize = super_block_size = 2048; |
694 | uspi->s_sbbase = 0; | 714 | uspi->s_sbbase = 0; |
695 | uspi->s_maxsymlinklen = 56; | 715 | uspi->s_maxsymlinklen = 0; /* Not supported on disk */ |
696 | flags |= UFS_DE_OLD | UFS_UID_EFT | UFS_ST_SUN | UFS_CG_SUN; | 716 | flags |= UFS_DE_OLD | UFS_UID_EFT | UFS_ST_SUN | UFS_CG_SUN; |
697 | break; | 717 | break; |
698 | 718 | ||
719 | case UFS_MOUNT_UFSTYPE_SUNOS: | ||
720 | UFSD(("ufstype=sunos\n")) | ||
721 | uspi->s_fsize = block_size = 1024; | ||
722 | uspi->s_fmask = ~(1024 - 1); | ||
723 | uspi->s_fshift = 10; | ||
724 | uspi->s_sbsize = 2048; | ||
725 | super_block_size = 2048; | ||
726 | uspi->s_sbbase = 0; | ||
727 | uspi->s_maxsymlinklen = 0; /* Not supported on disk */ | ||
728 | flags |= UFS_DE_OLD | UFS_UID_OLD | UFS_ST_SUNOS | UFS_CG_SUN; | ||
729 | break; | ||
730 | |||
699 | case UFS_MOUNT_UFSTYPE_SUNx86: | 731 | case UFS_MOUNT_UFSTYPE_SUNx86: |
700 | UFSD("ufstype=sunx86\n"); | 732 | UFSD("ufstype=sunx86\n"); |
701 | uspi->s_fsize = block_size = 1024; | 733 | uspi->s_fsize = block_size = 1024; |
@@ -703,7 +735,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent) | |||
703 | uspi->s_fshift = 10; | 735 | uspi->s_fshift = 10; |
704 | uspi->s_sbsize = super_block_size = 2048; | 736 | uspi->s_sbsize = super_block_size = 2048; |
705 | uspi->s_sbbase = 0; | 737 | uspi->s_sbbase = 0; |
706 | uspi->s_maxsymlinklen = 56; | 738 | uspi->s_maxsymlinklen = 0; /* Not supported on disk */ |
707 | flags |= UFS_DE_OLD | UFS_UID_EFT | UFS_ST_SUNx86 | UFS_CG_SUN; | 739 | flags |= UFS_DE_OLD | UFS_UID_EFT | UFS_ST_SUNx86 | UFS_CG_SUN; |
708 | break; | 740 | break; |
709 | 741 | ||
@@ -805,11 +837,18 @@ again: | |||
805 | if (!ubh) | 837 | if (!ubh) |
806 | goto failed; | 838 | goto failed; |
807 | 839 | ||
808 | |||
809 | usb1 = ubh_get_usb_first(uspi); | 840 | usb1 = ubh_get_usb_first(uspi); |
810 | usb2 = ubh_get_usb_second(uspi); | 841 | usb2 = ubh_get_usb_second(uspi); |
811 | usb3 = ubh_get_usb_third(uspi); | 842 | usb3 = ubh_get_usb_third(uspi); |
812 | 843 | ||
844 | /* Sort out mod used on SunOS 4.1.3 for fs_state */ | ||
845 | uspi->s_postblformat = fs32_to_cpu(sb, usb3->fs_postblformat); | ||
846 | if (((flags & UFS_ST_MASK) == UFS_ST_SUNOS) && | ||
847 | (uspi->s_postblformat != UFS_42POSTBLFMT)) { | ||
848 | flags &= ~UFS_ST_MASK; | ||
849 | flags |= UFS_ST_SUN; | ||
850 | } | ||
851 | |||
813 | /* | 852 | /* |
814 | * Check ufs magic number | 853 | * Check ufs magic number |
815 | */ | 854 | */ |
@@ -894,18 +933,20 @@ magic_found: | |||
894 | goto again; | 933 | goto again; |
895 | } | 934 | } |
896 | 935 | ||
897 | 936 | /* Set sbi->s_flags here, used by ufs_get_fs_state() below */ | |
937 | sbi->s_flags = flags; | ||
898 | ufs_print_super_stuff(sb, usb1, usb2, usb3); | 938 | ufs_print_super_stuff(sb, usb1, usb2, usb3); |
899 | 939 | ||
900 | /* | 940 | /* |
901 | * Check, if file system was correctly unmounted. | 941 | * Check, if file system was correctly unmounted. |
902 | * If not, make it read only. | 942 | * If not, make it read only. |
903 | */ | 943 | */ |
904 | if (((flags & UFS_ST_MASK) == UFS_ST_44BSD) || | 944 | if ((((flags & UFS_ST_MASK) == UFS_ST_44BSD) || |
905 | ((flags & UFS_ST_MASK) == UFS_ST_OLD) || | 945 | ((flags & UFS_ST_MASK) == UFS_ST_OLD) || |
906 | (((flags & UFS_ST_MASK) == UFS_ST_SUN || | 946 | ((flags & UFS_ST_MASK) == UFS_ST_SUN) || |
907 | (flags & UFS_ST_MASK) == UFS_ST_SUNx86) && | 947 | ((flags & UFS_ST_MASK) == UFS_ST_SUNOS) || |
908 | (ufs_get_fs_state(sb, usb1, usb3) == (UFS_FSOK - fs32_to_cpu(sb, usb1->fs_time))))) { | 948 | ((flags & UFS_ST_MASK) == UFS_ST_SUNx86)) && |
949 | (ufs_get_fs_state(sb, usb1, usb3) == (UFS_FSOK - fs32_to_cpu(sb, usb1->fs_time)))) { | ||
909 | switch(usb1->fs_clean) { | 950 | switch(usb1->fs_clean) { |
910 | case UFS_FSCLEAN: | 951 | case UFS_FSCLEAN: |
911 | UFSD("fs is clean\n"); | 952 | UFSD("fs is clean\n"); |
@@ -995,7 +1036,6 @@ magic_found: | |||
995 | uspi->s_contigsumsize = fs32_to_cpu(sb, usb3->fs_un2.fs_44.fs_contigsumsize); | 1036 | uspi->s_contigsumsize = fs32_to_cpu(sb, usb3->fs_un2.fs_44.fs_contigsumsize); |
996 | uspi->s_qbmask = ufs_get_fs_qbmask(sb, usb3); | 1037 | uspi->s_qbmask = ufs_get_fs_qbmask(sb, usb3); |
997 | uspi->s_qfmask = ufs_get_fs_qfmask(sb, usb3); | 1038 | uspi->s_qfmask = ufs_get_fs_qfmask(sb, usb3); |
998 | uspi->s_postblformat = fs32_to_cpu(sb, usb3->fs_postblformat); | ||
999 | uspi->s_nrpos = fs32_to_cpu(sb, usb3->fs_nrpos); | 1039 | uspi->s_nrpos = fs32_to_cpu(sb, usb3->fs_nrpos); |
1000 | uspi->s_postbloff = fs32_to_cpu(sb, usb3->fs_postbloff); | 1040 | uspi->s_postbloff = fs32_to_cpu(sb, usb3->fs_postbloff); |
1001 | uspi->s_rotbloff = fs32_to_cpu(sb, usb3->fs_rotbloff); | 1041 | uspi->s_rotbloff = fs32_to_cpu(sb, usb3->fs_rotbloff); |
@@ -1025,8 +1065,6 @@ magic_found: | |||
1025 | UFS_MOUNT_UFSTYPE_44BSD) | 1065 | UFS_MOUNT_UFSTYPE_44BSD) |
1026 | uspi->s_maxsymlinklen = | 1066 | uspi->s_maxsymlinklen = |
1027 | fs32_to_cpu(sb, usb3->fs_un2.fs_44.fs_maxsymlinklen); | 1067 | fs32_to_cpu(sb, usb3->fs_un2.fs_44.fs_maxsymlinklen); |
1028 | |||
1029 | sbi->s_flags = flags; | ||
1030 | 1068 | ||
1031 | inode = iget(sb, UFS_ROOTINO); | 1069 | inode = iget(sb, UFS_ROOTINO); |
1032 | if (!inode || is_bad_inode(inode)) | 1070 | if (!inode || is_bad_inode(inode)) |
@@ -1079,6 +1117,7 @@ static void ufs_write_super(struct super_block *sb) | |||
1079 | if (!(sb->s_flags & MS_RDONLY)) { | 1117 | if (!(sb->s_flags & MS_RDONLY)) { |
1080 | usb1->fs_time = cpu_to_fs32(sb, get_seconds()); | 1118 | usb1->fs_time = cpu_to_fs32(sb, get_seconds()); |
1081 | if ((flags & UFS_ST_MASK) == UFS_ST_SUN | 1119 | if ((flags & UFS_ST_MASK) == UFS_ST_SUN |
1120 | || (flags & UFS_ST_MASK) == UFS_ST_SUNOS | ||
1082 | || (flags & UFS_ST_MASK) == UFS_ST_SUNx86) | 1121 | || (flags & UFS_ST_MASK) == UFS_ST_SUNx86) |
1083 | ufs_set_fs_state(sb, usb1, usb3, | 1122 | ufs_set_fs_state(sb, usb1, usb3, |
1084 | UFS_FSOK - fs32_to_cpu(sb, usb1->fs_time)); | 1123 | UFS_FSOK - fs32_to_cpu(sb, usb1->fs_time)); |
@@ -1148,6 +1187,7 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data) | |||
1148 | ufs_put_super_internal(sb); | 1187 | ufs_put_super_internal(sb); |
1149 | usb1->fs_time = cpu_to_fs32(sb, get_seconds()); | 1188 | usb1->fs_time = cpu_to_fs32(sb, get_seconds()); |
1150 | if ((flags & UFS_ST_MASK) == UFS_ST_SUN | 1189 | if ((flags & UFS_ST_MASK) == UFS_ST_SUN |
1190 | || (flags & UFS_ST_MASK) == UFS_ST_SUNOS | ||
1151 | || (flags & UFS_ST_MASK) == UFS_ST_SUNx86) | 1191 | || (flags & UFS_ST_MASK) == UFS_ST_SUNx86) |
1152 | ufs_set_fs_state(sb, usb1, usb3, | 1192 | ufs_set_fs_state(sb, usb1, usb3, |
1153 | UFS_FSOK - fs32_to_cpu(sb, usb1->fs_time)); | 1193 | UFS_FSOK - fs32_to_cpu(sb, usb1->fs_time)); |
@@ -1164,6 +1204,7 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data) | |||
1164 | return -EINVAL; | 1204 | return -EINVAL; |
1165 | #else | 1205 | #else |
1166 | if (ufstype != UFS_MOUNT_UFSTYPE_SUN && | 1206 | if (ufstype != UFS_MOUNT_UFSTYPE_SUN && |
1207 | ufstype != UFS_MOUNT_UFSTYPE_SUNOS && | ||
1167 | ufstype != UFS_MOUNT_UFSTYPE_44BSD && | 1208 | ufstype != UFS_MOUNT_UFSTYPE_44BSD && |
1168 | ufstype != UFS_MOUNT_UFSTYPE_SUNx86 && | 1209 | ufstype != UFS_MOUNT_UFSTYPE_SUNx86 && |
1169 | ufstype != UFS_MOUNT_UFSTYPE_UFS2) { | 1210 | ufstype != UFS_MOUNT_UFSTYPE_UFS2) { |
@@ -1181,6 +1222,26 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data) | |||
1181 | return 0; | 1222 | return 0; |
1182 | } | 1223 | } |
1183 | 1224 | ||
1225 | static int ufs_show_options(struct seq_file *seq, struct vfsmount *vfs) | ||
1226 | { | ||
1227 | struct ufs_sb_info *sbi = UFS_SB(vfs->mnt_sb); | ||
1228 | unsigned mval = sbi->s_mount_opt & UFS_MOUNT_UFSTYPE; | ||
1229 | struct match_token *tp = tokens; | ||
1230 | |||
1231 | while (tp->token != Opt_onerror_panic && tp->token != mval) | ||
1232 | ++tp; | ||
1233 | BUG_ON(tp->token == Opt_onerror_panic); | ||
1234 | seq_printf(seq, ",%s", tp->pattern); | ||
1235 | |||
1236 | mval = sbi->s_mount_opt & UFS_MOUNT_ONERROR; | ||
1237 | while (tp->token != Opt_err && tp->token != mval) | ||
1238 | ++tp; | ||
1239 | BUG_ON(tp->token == Opt_err); | ||
1240 | seq_printf(seq, ",%s", tp->pattern); | ||
1241 | |||
1242 | return 0; | ||
1243 | } | ||
1244 | |||
1184 | static int ufs_statfs(struct dentry *dentry, struct kstatfs *buf) | 1245 | static int ufs_statfs(struct dentry *dentry, struct kstatfs *buf) |
1185 | { | 1246 | { |
1186 | struct super_block *sb = dentry->d_sb; | 1247 | struct super_block *sb = dentry->d_sb; |
@@ -1234,7 +1295,7 @@ static void ufs_destroy_inode(struct inode *inode) | |||
1234 | kmem_cache_free(ufs_inode_cachep, UFS_I(inode)); | 1295 | kmem_cache_free(ufs_inode_cachep, UFS_I(inode)); |
1235 | } | 1296 | } |
1236 | 1297 | ||
1237 | static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags) | 1298 | static void init_once(struct kmem_cache * cachep, void *foo) |
1238 | { | 1299 | { |
1239 | struct ufs_inode_info *ei = (struct ufs_inode_info *) foo; | 1300 | struct ufs_inode_info *ei = (struct ufs_inode_info *) foo; |
1240 | 1301 | ||
@@ -1273,6 +1334,7 @@ static const struct super_operations ufs_super_ops = { | |||
1273 | .write_super = ufs_write_super, | 1334 | .write_super = ufs_write_super, |
1274 | .statfs = ufs_statfs, | 1335 | .statfs = ufs_statfs, |
1275 | .remount_fs = ufs_remount, | 1336 | .remount_fs = ufs_remount, |
1337 | .show_options = ufs_show_options, | ||
1276 | #ifdef CONFIG_QUOTA | 1338 | #ifdef CONFIG_QUOTA |
1277 | .quota_read = ufs_quota_read, | 1339 | .quota_read = ufs_quota_read, |
1278 | .quota_write = ufs_quota_write, | 1340 | .quota_write = ufs_quota_write, |
diff --git a/fs/ufs/symlink.c b/fs/ufs/symlink.c index d8549f807e80..43ac10e75a4a 100644 --- a/fs/ufs/symlink.c +++ b/fs/ufs/symlink.c | |||
@@ -28,6 +28,8 @@ | |||
28 | #include <linux/fs.h> | 28 | #include <linux/fs.h> |
29 | #include <linux/namei.h> | 29 | #include <linux/namei.h> |
30 | #include <linux/ufs_fs.h> | 30 | #include <linux/ufs_fs.h> |
31 | #include "ufs.h" | ||
32 | |||
31 | 33 | ||
32 | static void *ufs_follow_link(struct dentry *dentry, struct nameidata *nd) | 34 | static void *ufs_follow_link(struct dentry *dentry, struct nameidata *nd) |
33 | { | 35 | { |
diff --git a/fs/ufs/truncate.c b/fs/ufs/truncate.c index 79c54c85fb58..311ded34c2b2 100644 --- a/fs/ufs/truncate.c +++ b/fs/ufs/truncate.c | |||
@@ -46,6 +46,7 @@ | |||
46 | #include <linux/blkdev.h> | 46 | #include <linux/blkdev.h> |
47 | #include <linux/sched.h> | 47 | #include <linux/sched.h> |
48 | 48 | ||
49 | #include "ufs.h" | ||
49 | #include "swab.h" | 50 | #include "swab.h" |
50 | #include "util.h" | 51 | #include "util.h" |
51 | 52 | ||
diff --git a/fs/ufs/ufs.h b/fs/ufs/ufs.h new file mode 100644 index 000000000000..7faa4cd71a27 --- /dev/null +++ b/fs/ufs/ufs.h | |||
@@ -0,0 +1,157 @@ | |||
1 | #ifndef _UFS_UFS_H | ||
2 | #define _UFS_UFS_H 1 | ||
3 | |||
4 | #define UFS_MAX_GROUP_LOADED 8 | ||
5 | #define UFS_CGNO_EMPTY ((unsigned)-1) | ||
6 | |||
7 | struct ufs_sb_private_info; | ||
8 | struct ufs_cg_private_info; | ||
9 | struct ufs_csum; | ||
10 | |||
11 | struct ufs_sb_info { | ||
12 | struct ufs_sb_private_info * s_uspi; | ||
13 | struct ufs_csum * s_csp; | ||
14 | unsigned s_bytesex; | ||
15 | unsigned s_flags; | ||
16 | struct buffer_head ** s_ucg; | ||
17 | struct ufs_cg_private_info * s_ucpi[UFS_MAX_GROUP_LOADED]; | ||
18 | unsigned s_cgno[UFS_MAX_GROUP_LOADED]; | ||
19 | unsigned short s_cg_loaded; | ||
20 | unsigned s_mount_opt; | ||
21 | }; | ||
22 | |||
23 | struct ufs_inode_info { | ||
24 | union { | ||
25 | __fs32 i_data[15]; | ||
26 | __u8 i_symlink[4*15]; | ||
27 | __fs64 u2_i_data[15]; | ||
28 | } i_u1; | ||
29 | __u32 i_flags; | ||
30 | __u32 i_shadow; | ||
31 | __u32 i_unused1; | ||
32 | __u32 i_unused2; | ||
33 | __u32 i_oeftflag; | ||
34 | __u16 i_osync; | ||
35 | __u64 i_lastfrag; | ||
36 | __u32 i_dir_start_lookup; | ||
37 | struct inode vfs_inode; | ||
38 | }; | ||
39 | |||
40 | /* mount options */ | ||
41 | #define UFS_MOUNT_ONERROR 0x0000000F | ||
42 | #define UFS_MOUNT_ONERROR_PANIC 0x00000001 | ||
43 | #define UFS_MOUNT_ONERROR_LOCK 0x00000002 | ||
44 | #define UFS_MOUNT_ONERROR_UMOUNT 0x00000004 | ||
45 | #define UFS_MOUNT_ONERROR_REPAIR 0x00000008 | ||
46 | |||
47 | #define UFS_MOUNT_UFSTYPE 0x0000FFF0 | ||
48 | #define UFS_MOUNT_UFSTYPE_OLD 0x00000010 | ||
49 | #define UFS_MOUNT_UFSTYPE_44BSD 0x00000020 | ||
50 | #define UFS_MOUNT_UFSTYPE_SUN 0x00000040 | ||
51 | #define UFS_MOUNT_UFSTYPE_NEXTSTEP 0x00000080 | ||
52 | #define UFS_MOUNT_UFSTYPE_NEXTSTEP_CD 0x00000100 | ||
53 | #define UFS_MOUNT_UFSTYPE_OPENSTEP 0x00000200 | ||
54 | #define UFS_MOUNT_UFSTYPE_SUNx86 0x00000400 | ||
55 | #define UFS_MOUNT_UFSTYPE_HP 0x00000800 | ||
56 | #define UFS_MOUNT_UFSTYPE_UFS2 0x00001000 | ||
57 | #define UFS_MOUNT_UFSTYPE_SUNOS 0x00002000 | ||
58 | |||
59 | #define ufs_clear_opt(o,opt) o &= ~UFS_MOUNT_##opt | ||
60 | #define ufs_set_opt(o,opt) o |= UFS_MOUNT_##opt | ||
61 | #define ufs_test_opt(o,opt) ((o) & UFS_MOUNT_##opt) | ||
62 | |||
63 | /* | ||
64 | * Debug code | ||
65 | */ | ||
66 | #ifdef CONFIG_UFS_DEBUG | ||
67 | # define UFSD(f, a...) { \ | ||
68 | printk ("UFSD (%s, %d): %s:", \ | ||
69 | __FILE__, __LINE__, __FUNCTION__); \ | ||
70 | printk (f, ## a); \ | ||
71 | } | ||
72 | #else | ||
73 | # define UFSD(f, a...) /**/ | ||
74 | #endif | ||
75 | |||
76 | /* balloc.c */ | ||
77 | extern void ufs_free_fragments (struct inode *, u64, unsigned); | ||
78 | extern void ufs_free_blocks (struct inode *, u64, unsigned); | ||
79 | extern u64 ufs_new_fragments(struct inode *, void *, u64, u64, | ||
80 | unsigned, int *, struct page *); | ||
81 | |||
82 | /* cylinder.c */ | ||
83 | extern struct ufs_cg_private_info * ufs_load_cylinder (struct super_block *, unsigned); | ||
84 | extern void ufs_put_cylinder (struct super_block *, unsigned); | ||
85 | |||
86 | /* dir.c */ | ||
87 | extern const struct inode_operations ufs_dir_inode_operations; | ||
88 | extern int ufs_add_link (struct dentry *, struct inode *); | ||
89 | extern ino_t ufs_inode_by_name(struct inode *, struct dentry *); | ||
90 | extern int ufs_make_empty(struct inode *, struct inode *); | ||
91 | extern struct ufs_dir_entry *ufs_find_entry(struct inode *, struct dentry *, struct page **); | ||
92 | extern int ufs_delete_entry(struct inode *, struct ufs_dir_entry *, struct page *); | ||
93 | extern int ufs_empty_dir (struct inode *); | ||
94 | extern struct ufs_dir_entry *ufs_dotdot(struct inode *, struct page **); | ||
95 | extern void ufs_set_link(struct inode *dir, struct ufs_dir_entry *de, | ||
96 | struct page *page, struct inode *inode); | ||
97 | |||
98 | /* file.c */ | ||
99 | extern const struct inode_operations ufs_file_inode_operations; | ||
100 | extern const struct file_operations ufs_file_operations; | ||
101 | |||
102 | extern const struct address_space_operations ufs_aops; | ||
103 | |||
104 | /* ialloc.c */ | ||
105 | extern void ufs_free_inode (struct inode *inode); | ||
106 | extern struct inode * ufs_new_inode (struct inode *, int); | ||
107 | |||
108 | /* inode.c */ | ||
109 | extern void ufs_read_inode (struct inode *); | ||
110 | extern void ufs_put_inode (struct inode *); | ||
111 | extern int ufs_write_inode (struct inode *, int); | ||
112 | extern int ufs_sync_inode (struct inode *); | ||
113 | extern void ufs_delete_inode (struct inode *); | ||
114 | extern struct buffer_head * ufs_bread (struct inode *, unsigned, int, int *); | ||
115 | extern int ufs_getfrag_block (struct inode *inode, sector_t fragment, struct buffer_head *bh_result, int create); | ||
116 | |||
117 | /* namei.c */ | ||
118 | extern const struct file_operations ufs_dir_operations; | ||
119 | |||
120 | /* super.c */ | ||
121 | extern void ufs_warning (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4))); | ||
122 | extern void ufs_error (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4))); | ||
123 | extern void ufs_panic (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4))); | ||
124 | |||
125 | /* symlink.c */ | ||
126 | extern const struct inode_operations ufs_fast_symlink_inode_operations; | ||
127 | |||
128 | /* truncate.c */ | ||
129 | extern int ufs_truncate (struct inode *, loff_t); | ||
130 | |||
131 | static inline struct ufs_sb_info *UFS_SB(struct super_block *sb) | ||
132 | { | ||
133 | return sb->s_fs_info; | ||
134 | } | ||
135 | |||
136 | static inline struct ufs_inode_info *UFS_I(struct inode *inode) | ||
137 | { | ||
138 | return container_of(inode, struct ufs_inode_info, vfs_inode); | ||
139 | } | ||
140 | |||
141 | /* | ||
142 | * Give cylinder group number for a file system block. | ||
143 | * Give cylinder group block number for a file system block. | ||
144 | */ | ||
145 | /* #define ufs_dtog(d) ((d) / uspi->s_fpg) */ | ||
146 | static inline u64 ufs_dtog(struct ufs_sb_private_info * uspi, u64 b) | ||
147 | { | ||
148 | do_div(b, uspi->s_fpg); | ||
149 | return b; | ||
150 | } | ||
151 | /* #define ufs_dtogd(d) ((d) % uspi->s_fpg) */ | ||
152 | static inline u32 ufs_dtogd(struct ufs_sb_private_info * uspi, u64 b) | ||
153 | { | ||
154 | return do_div(b, uspi->s_fpg); | ||
155 | } | ||
156 | |||
157 | #endif /* _UFS_UFS_H */ | ||
diff --git a/fs/ufs/util.c b/fs/ufs/util.c index 84357f1ff0ec..410084dae389 100644 --- a/fs/ufs/util.c +++ b/fs/ufs/util.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/ufs_fs.h> | 11 | #include <linux/ufs_fs.h> |
12 | #include <linux/buffer_head.h> | 12 | #include <linux/buffer_head.h> |
13 | 13 | ||
14 | #include "ufs.h" | ||
14 | #include "swab.h" | 15 | #include "swab.h" |
15 | #include "util.h" | 16 | #include "util.h" |
16 | 17 | ||
diff --git a/fs/ufs/util.h b/fs/ufs/util.h index 06d344839c42..b26fc4dec1e7 100644 --- a/fs/ufs/util.h +++ b/fs/ufs/util.h | |||
@@ -38,6 +38,10 @@ ufs_get_fs_state(struct super_block *sb, struct ufs_super_block_first *usb1, | |||
38 | struct ufs_super_block_third *usb3) | 38 | struct ufs_super_block_third *usb3) |
39 | { | 39 | { |
40 | switch (UFS_SB(sb)->s_flags & UFS_ST_MASK) { | 40 | switch (UFS_SB(sb)->s_flags & UFS_ST_MASK) { |
41 | case UFS_ST_SUNOS: | ||
42 | if (fs32_to_cpu(sb, usb3->fs_postblformat) == UFS_42POSTBLFMT) | ||
43 | return fs32_to_cpu(sb, usb1->fs_u0.fs_sun.fs_state); | ||
44 | /* Fall Through to UFS_ST_SUN */ | ||
41 | case UFS_ST_SUN: | 45 | case UFS_ST_SUN: |
42 | return fs32_to_cpu(sb, usb3->fs_un2.fs_sun.fs_state); | 46 | return fs32_to_cpu(sb, usb3->fs_un2.fs_sun.fs_state); |
43 | case UFS_ST_SUNx86: | 47 | case UFS_ST_SUNx86: |
@@ -53,6 +57,12 @@ ufs_set_fs_state(struct super_block *sb, struct ufs_super_block_first *usb1, | |||
53 | struct ufs_super_block_third *usb3, s32 value) | 57 | struct ufs_super_block_third *usb3, s32 value) |
54 | { | 58 | { |
55 | switch (UFS_SB(sb)->s_flags & UFS_ST_MASK) { | 59 | switch (UFS_SB(sb)->s_flags & UFS_ST_MASK) { |
60 | case UFS_ST_SUNOS: | ||
61 | if (fs32_to_cpu(sb, usb3->fs_postblformat == UFS_42POSTBLFMT)) { | ||
62 | usb1->fs_u0.fs_sun.fs_state = cpu_to_fs32(sb, value); | ||
63 | break; | ||
64 | } | ||
65 | /* Fall Through to UFS_ST_SUN */ | ||
56 | case UFS_ST_SUN: | 66 | case UFS_ST_SUN: |
57 | usb3->fs_un2.fs_sun.fs_state = cpu_to_fs32(sb, value); | 67 | usb3->fs_un2.fs_sun.fs_state = cpu_to_fs32(sb, value); |
58 | break; | 68 | break; |
@@ -81,6 +91,7 @@ ufs_get_fs_qbmask(struct super_block *sb, struct ufs_super_block_third *usb3) | |||
81 | __fs64 tmp; | 91 | __fs64 tmp; |
82 | 92 | ||
83 | switch (UFS_SB(sb)->s_flags & UFS_ST_MASK) { | 93 | switch (UFS_SB(sb)->s_flags & UFS_ST_MASK) { |
94 | case UFS_ST_SUNOS: | ||
84 | case UFS_ST_SUN: | 95 | case UFS_ST_SUN: |
85 | ((__fs32 *)&tmp)[0] = usb3->fs_un2.fs_sun.fs_qbmask[0]; | 96 | ((__fs32 *)&tmp)[0] = usb3->fs_un2.fs_sun.fs_qbmask[0]; |
86 | ((__fs32 *)&tmp)[1] = usb3->fs_un2.fs_sun.fs_qbmask[1]; | 97 | ((__fs32 *)&tmp)[1] = usb3->fs_un2.fs_sun.fs_qbmask[1]; |
@@ -104,6 +115,7 @@ ufs_get_fs_qfmask(struct super_block *sb, struct ufs_super_block_third *usb3) | |||
104 | __fs64 tmp; | 115 | __fs64 tmp; |
105 | 116 | ||
106 | switch (UFS_SB(sb)->s_flags & UFS_ST_MASK) { | 117 | switch (UFS_SB(sb)->s_flags & UFS_ST_MASK) { |
118 | case UFS_ST_SUNOS: | ||
107 | case UFS_ST_SUN: | 119 | case UFS_ST_SUN: |
108 | ((__fs32 *)&tmp)[0] = usb3->fs_un2.fs_sun.fs_qfmask[0]; | 120 | ((__fs32 *)&tmp)[0] = usb3->fs_un2.fs_sun.fs_qfmask[0]; |
109 | ((__fs32 *)&tmp)[1] = usb3->fs_un2.fs_sun.fs_qfmask[1]; | 121 | ((__fs32 *)&tmp)[1] = usb3->fs_un2.fs_sun.fs_qfmask[1]; |
@@ -179,10 +191,12 @@ static inline u32 | |||
179 | ufs_get_inode_uid(struct super_block *sb, struct ufs_inode *inode) | 191 | ufs_get_inode_uid(struct super_block *sb, struct ufs_inode *inode) |
180 | { | 192 | { |
181 | switch (UFS_SB(sb)->s_flags & UFS_UID_MASK) { | 193 | switch (UFS_SB(sb)->s_flags & UFS_UID_MASK) { |
182 | case UFS_UID_EFT: | ||
183 | return fs32_to_cpu(sb, inode->ui_u3.ui_sun.ui_uid); | ||
184 | case UFS_UID_44BSD: | 194 | case UFS_UID_44BSD: |
185 | return fs32_to_cpu(sb, inode->ui_u3.ui_44.ui_uid); | 195 | return fs32_to_cpu(sb, inode->ui_u3.ui_44.ui_uid); |
196 | case UFS_UID_EFT: | ||
197 | if (inode->ui_u1.oldids.ui_suid == 0xFFFF) | ||
198 | return fs32_to_cpu(sb, inode->ui_u3.ui_sun.ui_uid); | ||
199 | /* Fall through */ | ||
186 | default: | 200 | default: |
187 | return fs16_to_cpu(sb, inode->ui_u1.oldids.ui_suid); | 201 | return fs16_to_cpu(sb, inode->ui_u1.oldids.ui_suid); |
188 | } | 202 | } |
@@ -192,24 +206,31 @@ static inline void | |||
192 | ufs_set_inode_uid(struct super_block *sb, struct ufs_inode *inode, u32 value) | 206 | ufs_set_inode_uid(struct super_block *sb, struct ufs_inode *inode, u32 value) |
193 | { | 207 | { |
194 | switch (UFS_SB(sb)->s_flags & UFS_UID_MASK) { | 208 | switch (UFS_SB(sb)->s_flags & UFS_UID_MASK) { |
195 | case UFS_UID_EFT: | ||
196 | inode->ui_u3.ui_sun.ui_uid = cpu_to_fs32(sb, value); | ||
197 | break; | ||
198 | case UFS_UID_44BSD: | 209 | case UFS_UID_44BSD: |
199 | inode->ui_u3.ui_44.ui_uid = cpu_to_fs32(sb, value); | 210 | inode->ui_u3.ui_44.ui_uid = cpu_to_fs32(sb, value); |
211 | inode->ui_u1.oldids.ui_suid = cpu_to_fs16(sb, value); | ||
212 | break; | ||
213 | case UFS_UID_EFT: | ||
214 | inode->ui_u3.ui_sun.ui_uid = cpu_to_fs32(sb, value); | ||
215 | if (value > 0xFFFF) | ||
216 | value = 0xFFFF; | ||
217 | /* Fall through */ | ||
218 | default: | ||
219 | inode->ui_u1.oldids.ui_suid = cpu_to_fs16(sb, value); | ||
200 | break; | 220 | break; |
201 | } | 221 | } |
202 | inode->ui_u1.oldids.ui_suid = cpu_to_fs16(sb, value); | ||
203 | } | 222 | } |
204 | 223 | ||
205 | static inline u32 | 224 | static inline u32 |
206 | ufs_get_inode_gid(struct super_block *sb, struct ufs_inode *inode) | 225 | ufs_get_inode_gid(struct super_block *sb, struct ufs_inode *inode) |
207 | { | 226 | { |
208 | switch (UFS_SB(sb)->s_flags & UFS_UID_MASK) { | 227 | switch (UFS_SB(sb)->s_flags & UFS_UID_MASK) { |
209 | case UFS_UID_EFT: | ||
210 | return fs32_to_cpu(sb, inode->ui_u3.ui_sun.ui_gid); | ||
211 | case UFS_UID_44BSD: | 228 | case UFS_UID_44BSD: |
212 | return fs32_to_cpu(sb, inode->ui_u3.ui_44.ui_gid); | 229 | return fs32_to_cpu(sb, inode->ui_u3.ui_44.ui_gid); |
230 | case UFS_UID_EFT: | ||
231 | if (inode->ui_u1.oldids.ui_suid == 0xFFFF) | ||
232 | return fs32_to_cpu(sb, inode->ui_u3.ui_sun.ui_gid); | ||
233 | /* Fall through */ | ||
213 | default: | 234 | default: |
214 | return fs16_to_cpu(sb, inode->ui_u1.oldids.ui_sgid); | 235 | return fs16_to_cpu(sb, inode->ui_u1.oldids.ui_sgid); |
215 | } | 236 | } |
@@ -219,18 +240,26 @@ static inline void | |||
219 | ufs_set_inode_gid(struct super_block *sb, struct ufs_inode *inode, u32 value) | 240 | ufs_set_inode_gid(struct super_block *sb, struct ufs_inode *inode, u32 value) |
220 | { | 241 | { |
221 | switch (UFS_SB(sb)->s_flags & UFS_UID_MASK) { | 242 | switch (UFS_SB(sb)->s_flags & UFS_UID_MASK) { |
222 | case UFS_UID_EFT: | ||
223 | inode->ui_u3.ui_sun.ui_gid = cpu_to_fs32(sb, value); | ||
224 | break; | ||
225 | case UFS_UID_44BSD: | 243 | case UFS_UID_44BSD: |
226 | inode->ui_u3.ui_44.ui_gid = cpu_to_fs32(sb, value); | 244 | inode->ui_u3.ui_44.ui_gid = cpu_to_fs32(sb, value); |
245 | inode->ui_u1.oldids.ui_sgid = cpu_to_fs16(sb, value); | ||
246 | break; | ||
247 | case UFS_UID_EFT: | ||
248 | inode->ui_u3.ui_sun.ui_gid = cpu_to_fs32(sb, value); | ||
249 | if (value > 0xFFFF) | ||
250 | value = 0xFFFF; | ||
251 | /* Fall through */ | ||
252 | default: | ||
253 | inode->ui_u1.oldids.ui_sgid = cpu_to_fs16(sb, value); | ||
227 | break; | 254 | break; |
228 | } | 255 | } |
229 | inode->ui_u1.oldids.ui_sgid = cpu_to_fs16(sb, value); | ||
230 | } | 256 | } |
231 | 257 | ||
232 | extern dev_t ufs_get_inode_dev(struct super_block *, struct ufs_inode_info *); | 258 | extern dev_t ufs_get_inode_dev(struct super_block *, struct ufs_inode_info *); |
233 | extern void ufs_set_inode_dev(struct super_block *, struct ufs_inode_info *, dev_t); | 259 | extern void ufs_set_inode_dev(struct super_block *, struct ufs_inode_info *, dev_t); |
260 | extern int __ufs_write_begin(struct file *file, struct address_space *mapping, | ||
261 | loff_t pos, unsigned len, unsigned flags, | ||
262 | struct page **pagep, void **fsdata); | ||
234 | 263 | ||
235 | /* | 264 | /* |
236 | * These functions manipulate ufs buffers | 265 | * These functions manipulate ufs buffers |