diff options
Diffstat (limited to 'fs')
50 files changed, 1165 insertions, 901 deletions
diff --git a/fs/Kconfig b/fs/Kconfig index 6a4ad4bb7a54..178e27494b74 100644 --- a/fs/Kconfig +++ b/fs/Kconfig | |||
@@ -741,56 +741,6 @@ config SYSFS | |||
741 | 741 | ||
742 | Designers of embedded systems may wish to say N here to conserve space. | 742 | Designers of embedded systems may wish to say N here to conserve space. |
743 | 743 | ||
744 | config DEVFS_FS | ||
745 | bool "/dev file system support (OBSOLETE)" | ||
746 | depends on EXPERIMENTAL | ||
747 | help | ||
748 | This is support for devfs, a virtual file system (like /proc) which | ||
749 | provides the file system interface to device drivers, normally found | ||
750 | in /dev. Devfs does not depend on major and minor number | ||
751 | allocations. Device drivers register entries in /dev which then | ||
752 | appear automatically, which means that the system administrator does | ||
753 | not have to create character and block special device files in the | ||
754 | /dev directory using the mknod command (or MAKEDEV script) anymore. | ||
755 | |||
756 | This is work in progress. If you want to use this, you *must* read | ||
757 | the material in <file:Documentation/filesystems/devfs/>, especially | ||
758 | the file README there. | ||
759 | |||
760 | Note that devfs no longer manages /dev/pts! If you are using UNIX98 | ||
761 | ptys, you will also need to mount the /dev/pts filesystem (devpts). | ||
762 | |||
763 | Note that devfs has been obsoleted by udev, | ||
764 | <http://www.kernel.org/pub/linux/utils/kernel/hotplug/>. | ||
765 | It has been stripped down to a bare minimum and is only provided for | ||
766 | legacy installations that use its naming scheme which is | ||
767 | unfortunately different from the names normal Linux installations | ||
768 | use. | ||
769 | |||
770 | If unsure, say N. | ||
771 | |||
772 | config DEVFS_MOUNT | ||
773 | bool "Automatically mount at boot" | ||
774 | depends on DEVFS_FS | ||
775 | help | ||
776 | This option appears if you have CONFIG_DEVFS_FS enabled. Setting | ||
777 | this to 'Y' will make the kernel automatically mount devfs onto /dev | ||
778 | when the system is booted, before the init thread is started. | ||
779 | You can override this with the "devfs=nomount" boot option. | ||
780 | |||
781 | If unsure, say N. | ||
782 | |||
783 | config DEVFS_DEBUG | ||
784 | bool "Debug devfs" | ||
785 | depends on DEVFS_FS | ||
786 | help | ||
787 | If you say Y here, then the /dev file system code will generate | ||
788 | debugging messages. See the file | ||
789 | <file:Documentation/filesystems/devfs/boot-options> for more | ||
790 | details. | ||
791 | |||
792 | If unsure, say N. | ||
793 | |||
794 | config DEVPTS_FS_XATTR | 744 | config DEVPTS_FS_XATTR |
795 | bool "/dev/pts Extended Attributes" | 745 | bool "/dev/pts Extended Attributes" |
796 | depends on UNIX98_PTYS | 746 | depends on UNIX98_PTYS |
diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h index c7b2b8890188..9c09641ce907 100644 --- a/fs/autofs4/autofs_i.h +++ b/fs/autofs4/autofs_i.h | |||
@@ -185,6 +185,19 @@ int autofs4_wait(struct autofs_sb_info *,struct dentry *, enum autofs_notify); | |||
185 | int autofs4_wait_release(struct autofs_sb_info *,autofs_wqt_t,int); | 185 | int autofs4_wait_release(struct autofs_sb_info *,autofs_wqt_t,int); |
186 | void autofs4_catatonic_mode(struct autofs_sb_info *); | 186 | void autofs4_catatonic_mode(struct autofs_sb_info *); |
187 | 187 | ||
188 | static inline int autofs4_follow_mount(struct vfsmount **mnt, struct dentry **dentry) | ||
189 | { | ||
190 | int res = 0; | ||
191 | |||
192 | while (d_mountpoint(*dentry)) { | ||
193 | int followed = follow_down(mnt, dentry); | ||
194 | if (!followed) | ||
195 | break; | ||
196 | res = 1; | ||
197 | } | ||
198 | return res; | ||
199 | } | ||
200 | |||
188 | static inline int simple_positive(struct dentry *dentry) | 201 | static inline int simple_positive(struct dentry *dentry) |
189 | { | 202 | { |
190 | return dentry->d_inode && !d_unhashed(dentry); | 203 | return dentry->d_inode && !d_unhashed(dentry); |
diff --git a/fs/autofs4/expire.c b/fs/autofs4/expire.c index 500425e24fba..feb6ac427d05 100644 --- a/fs/autofs4/expire.c +++ b/fs/autofs4/expire.c | |||
@@ -56,12 +56,9 @@ static int autofs4_check_mount(struct vfsmount *mnt, struct dentry *dentry) | |||
56 | mntget(mnt); | 56 | mntget(mnt); |
57 | dget(dentry); | 57 | dget(dentry); |
58 | 58 | ||
59 | if (!follow_down(&mnt, &dentry)) | 59 | if (!autofs4_follow_mount(&mnt, &dentry)) |
60 | goto done; | 60 | goto done; |
61 | 61 | ||
62 | while (d_mountpoint(dentry) && follow_down(&mnt, &dentry)) | ||
63 | ; | ||
64 | |||
65 | /* This is an autofs submount, we can't expire it */ | 62 | /* This is an autofs submount, we can't expire it */ |
66 | if (is_autofs4_dentry(dentry)) | 63 | if (is_autofs4_dentry(dentry)) |
67 | goto done; | 64 | goto done; |
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c index 3765c047f157..2a771ec66956 100644 --- a/fs/autofs4/root.c +++ b/fs/autofs4/root.c | |||
@@ -205,7 +205,11 @@ static int autofs4_dir_open(struct inode *inode, struct file *file) | |||
205 | struct vfsmount *fp_mnt = mntget(mnt); | 205 | struct vfsmount *fp_mnt = mntget(mnt); |
206 | struct dentry *fp_dentry = dget(dentry); | 206 | struct dentry *fp_dentry = dget(dentry); |
207 | 207 | ||
208 | while (follow_down(&fp_mnt, &fp_dentry) && d_mountpoint(fp_dentry)); | 208 | if (!autofs4_follow_mount(&fp_mnt, &fp_dentry)) { |
209 | dput(fp_dentry); | ||
210 | mntput(fp_mnt); | ||
211 | return -ENOENT; | ||
212 | } | ||
209 | 213 | ||
210 | fp = dentry_open(fp_dentry, fp_mnt, file->f_flags); | 214 | fp = dentry_open(fp_dentry, fp_mnt, file->f_flags); |
211 | status = PTR_ERR(fp); | 215 | status = PTR_ERR(fp); |
@@ -302,7 +306,14 @@ static int try_to_fill_dentry(struct dentry *dentry, | |||
302 | 306 | ||
303 | DPRINTK("expire done status=%d", status); | 307 | DPRINTK("expire done status=%d", status); |
304 | 308 | ||
305 | return 0; | 309 | /* |
310 | * If the directory still exists the mount request must | ||
311 | * continue otherwise it can't be followed at the right | ||
312 | * time during the walk. | ||
313 | */ | ||
314 | status = d_invalidate(dentry); | ||
315 | if (status != -EBUSY) | ||
316 | return 0; | ||
306 | } | 317 | } |
307 | 318 | ||
308 | DPRINTK("dentry=%p %.*s ino=%p", | 319 | DPRINTK("dentry=%p %.*s ino=%p", |
diff --git a/fs/autofs4/waitq.c b/fs/autofs4/waitq.c index 5a40d36e5a51..fa2348dcd671 100644 --- a/fs/autofs4/waitq.c +++ b/fs/autofs4/waitq.c | |||
@@ -191,6 +191,13 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry, | |||
191 | } | 191 | } |
192 | 192 | ||
193 | if ( !wq ) { | 193 | if ( !wq ) { |
194 | /* Can't wait for an expire if there's no mount */ | ||
195 | if (notify == NFY_NONE && !d_mountpoint(dentry)) { | ||
196 | kfree(name); | ||
197 | up(&sbi->wq_sem); | ||
198 | return -ENOENT; | ||
199 | } | ||
200 | |||
194 | /* Create a new wait queue */ | 201 | /* Create a new wait queue */ |
195 | wq = kmalloc(sizeof(struct autofs_wait_queue),GFP_KERNEL); | 202 | wq = kmalloc(sizeof(struct autofs_wait_queue),GFP_KERNEL); |
196 | if ( !wq ) { | 203 | if ( !wq ) { |
diff --git a/fs/binfmt_aout.c b/fs/binfmt_aout.c index 009b8920c1ff..dd9baabaf016 100644 --- a/fs/binfmt_aout.c +++ b/fs/binfmt_aout.c | |||
@@ -316,6 +316,7 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs) | |||
316 | current->mm->brk = ex.a_bss + | 316 | current->mm->brk = ex.a_bss + |
317 | (current->mm->start_brk = N_BSSADDR(ex)); | 317 | (current->mm->start_brk = N_BSSADDR(ex)); |
318 | current->mm->free_area_cache = current->mm->mmap_base; | 318 | current->mm->free_area_cache = current->mm->mmap_base; |
319 | current->mm->cached_hole_size = 0; | ||
319 | 320 | ||
320 | set_mm_counter(current->mm, rss, 0); | 321 | set_mm_counter(current->mm, rss, 0); |
321 | current->mm->mmap = NULL; | 322 | current->mm->mmap = NULL; |
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index f8f6b6b76179..7976a238f0a3 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c | |||
@@ -775,6 +775,7 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs) | |||
775 | change some of these later */ | 775 | change some of these later */ |
776 | set_mm_counter(current->mm, rss, 0); | 776 | set_mm_counter(current->mm, rss, 0); |
777 | current->mm->free_area_cache = current->mm->mmap_base; | 777 | current->mm->free_area_cache = current->mm->mmap_base; |
778 | current->mm->cached_hole_size = 0; | ||
778 | retval = setup_arg_pages(bprm, randomize_stack_top(STACK_TOP), | 779 | retval = setup_arg_pages(bprm, randomize_stack_top(STACK_TOP), |
779 | executable_stack); | 780 | executable_stack); |
780 | if (retval < 0) { | 781 | if (retval < 0) { |
diff --git a/fs/buffer.c b/fs/buffer.c index 7e9e409feaa7..0befa724ab98 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -528,7 +528,7 @@ static void free_more_memory(void) | |||
528 | for_each_pgdat(pgdat) { | 528 | for_each_pgdat(pgdat) { |
529 | zones = pgdat->node_zonelists[GFP_NOFS&GFP_ZONEMASK].zones; | 529 | zones = pgdat->node_zonelists[GFP_NOFS&GFP_ZONEMASK].zones; |
530 | if (*zones) | 530 | if (*zones) |
531 | try_to_free_pages(zones, GFP_NOFS, 0); | 531 | try_to_free_pages(zones, GFP_NOFS); |
532 | } | 532 | } |
533 | } | 533 | } |
534 | 534 | ||
diff --git a/fs/coda/psdev.c b/fs/coda/psdev.c index ef001a9313e6..3d1cce3653b8 100644 --- a/fs/coda/psdev.c +++ b/fs/coda/psdev.c | |||
@@ -61,7 +61,7 @@ unsigned long coda_timeout = 30; /* .. secs, then signals will dequeue */ | |||
61 | 61 | ||
62 | 62 | ||
63 | struct venus_comm coda_comms[MAX_CODADEVS]; | 63 | struct venus_comm coda_comms[MAX_CODADEVS]; |
64 | static struct class_simple *coda_psdev_class; | 64 | static struct class *coda_psdev_class; |
65 | 65 | ||
66 | /* | 66 | /* |
67 | * Device operations | 67 | * Device operations |
@@ -363,14 +363,14 @@ static int init_coda_psdev(void) | |||
363 | CODA_PSDEV_MAJOR); | 363 | CODA_PSDEV_MAJOR); |
364 | return -EIO; | 364 | return -EIO; |
365 | } | 365 | } |
366 | coda_psdev_class = class_simple_create(THIS_MODULE, "coda"); | 366 | coda_psdev_class = class_create(THIS_MODULE, "coda"); |
367 | if (IS_ERR(coda_psdev_class)) { | 367 | if (IS_ERR(coda_psdev_class)) { |
368 | err = PTR_ERR(coda_psdev_class); | 368 | err = PTR_ERR(coda_psdev_class); |
369 | goto out_chrdev; | 369 | goto out_chrdev; |
370 | } | 370 | } |
371 | devfs_mk_dir ("coda"); | 371 | devfs_mk_dir ("coda"); |
372 | for (i = 0; i < MAX_CODADEVS; i++) { | 372 | for (i = 0; i < MAX_CODADEVS; i++) { |
373 | class_simple_device_add(coda_psdev_class, MKDEV(CODA_PSDEV_MAJOR,i), | 373 | class_device_create(coda_psdev_class, MKDEV(CODA_PSDEV_MAJOR,i), |
374 | NULL, "cfs%d", i); | 374 | NULL, "cfs%d", i); |
375 | err = devfs_mk_cdev(MKDEV(CODA_PSDEV_MAJOR, i), | 375 | err = devfs_mk_cdev(MKDEV(CODA_PSDEV_MAJOR, i), |
376 | S_IFCHR|S_IRUSR|S_IWUSR, "coda/%d", i); | 376 | S_IFCHR|S_IRUSR|S_IWUSR, "coda/%d", i); |
@@ -382,8 +382,8 @@ static int init_coda_psdev(void) | |||
382 | 382 | ||
383 | out_class: | 383 | out_class: |
384 | for (i = 0; i < MAX_CODADEVS; i++) | 384 | for (i = 0; i < MAX_CODADEVS; i++) |
385 | class_simple_device_remove(MKDEV(CODA_PSDEV_MAJOR, i)); | 385 | class_device_destroy(coda_psdev_class, MKDEV(CODA_PSDEV_MAJOR, i)); |
386 | class_simple_destroy(coda_psdev_class); | 386 | class_destroy(coda_psdev_class); |
387 | out_chrdev: | 387 | out_chrdev: |
388 | unregister_chrdev(CODA_PSDEV_MAJOR, "coda"); | 388 | unregister_chrdev(CODA_PSDEV_MAJOR, "coda"); |
389 | out: | 389 | out: |
@@ -425,10 +425,10 @@ static int __init init_coda(void) | |||
425 | return 0; | 425 | return 0; |
426 | out: | 426 | out: |
427 | for (i = 0; i < MAX_CODADEVS; i++) { | 427 | for (i = 0; i < MAX_CODADEVS; i++) { |
428 | class_simple_device_remove(MKDEV(CODA_PSDEV_MAJOR, i)); | 428 | class_device_destroy(coda_psdev_class, MKDEV(CODA_PSDEV_MAJOR, i)); |
429 | devfs_remove("coda/%d", i); | 429 | devfs_remove("coda/%d", i); |
430 | } | 430 | } |
431 | class_simple_destroy(coda_psdev_class); | 431 | class_destroy(coda_psdev_class); |
432 | devfs_remove("coda"); | 432 | devfs_remove("coda"); |
433 | unregister_chrdev(CODA_PSDEV_MAJOR, "coda"); | 433 | unregister_chrdev(CODA_PSDEV_MAJOR, "coda"); |
434 | coda_sysctl_clean(); | 434 | coda_sysctl_clean(); |
@@ -447,10 +447,10 @@ static void __exit exit_coda(void) | |||
447 | printk("coda: failed to unregister filesystem\n"); | 447 | printk("coda: failed to unregister filesystem\n"); |
448 | } | 448 | } |
449 | for (i = 0; i < MAX_CODADEVS; i++) { | 449 | for (i = 0; i < MAX_CODADEVS; i++) { |
450 | class_simple_device_remove(MKDEV(CODA_PSDEV_MAJOR, i)); | 450 | class_device_destroy(coda_psdev_class, MKDEV(CODA_PSDEV_MAJOR, i)); |
451 | devfs_remove("coda/%d", i); | 451 | devfs_remove("coda/%d", i); |
452 | } | 452 | } |
453 | class_simple_destroy(coda_psdev_class); | 453 | class_destroy(coda_psdev_class); |
454 | devfs_remove("coda"); | 454 | devfs_remove("coda"); |
455 | unregister_chrdev(CODA_PSDEV_MAJOR, "coda"); | 455 | unregister_chrdev(CODA_PSDEV_MAJOR, "coda"); |
456 | coda_sysctl_clean(); | 456 | coda_sysctl_clean(); |
diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c index 548556ff2506..efc97d9b7860 100644 --- a/fs/debugfs/file.c +++ b/fs/debugfs/file.c | |||
@@ -45,44 +45,15 @@ struct file_operations debugfs_file_operations = { | |||
45 | .open = default_open, | 45 | .open = default_open, |
46 | }; | 46 | }; |
47 | 47 | ||
48 | #define simple_type(type, format, temptype, strtolfn) \ | 48 | static void debugfs_u8_set(void *data, u64 val) |
49 | static ssize_t read_file_##type(struct file *file, char __user *user_buf, \ | 49 | { |
50 | size_t count, loff_t *ppos) \ | 50 | *(u8 *)data = val; |
51 | { \ | 51 | } |
52 | char buf[32]; \ | 52 | static u64 debugfs_u8_get(void *data) |
53 | type *val = file->private_data; \ | 53 | { |
54 | \ | 54 | return *(u8 *)data; |
55 | snprintf(buf, sizeof(buf), format "\n", *val); \ | 55 | } |
56 | return simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf));\ | 56 | DEFINE_SIMPLE_ATTRIBUTE(fops_u8, debugfs_u8_get, debugfs_u8_set, "%llu\n"); |
57 | } \ | ||
58 | static ssize_t write_file_##type(struct file *file, const char __user *user_buf,\ | ||
59 | size_t count, loff_t *ppos) \ | ||
60 | { \ | ||
61 | char *endp; \ | ||
62 | char buf[32]; \ | ||
63 | int buf_size; \ | ||
64 | type *val = file->private_data; \ | ||
65 | temptype tmp; \ | ||
66 | \ | ||
67 | memset(buf, 0x00, sizeof(buf)); \ | ||
68 | buf_size = min(count, (sizeof(buf)-1)); \ | ||
69 | if (copy_from_user(buf, user_buf, buf_size)) \ | ||
70 | return -EFAULT; \ | ||
71 | \ | ||
72 | tmp = strtolfn(buf, &endp, 0); \ | ||
73 | if ((endp == buf) || ((type)tmp != tmp)) \ | ||
74 | return -EINVAL; \ | ||
75 | *val = tmp; \ | ||
76 | return count; \ | ||
77 | } \ | ||
78 | static struct file_operations fops_##type = { \ | ||
79 | .read = read_file_##type, \ | ||
80 | .write = write_file_##type, \ | ||
81 | .open = default_open, \ | ||
82 | }; | ||
83 | simple_type(u8, "%c", unsigned long, simple_strtoul); | ||
84 | simple_type(u16, "%hi", unsigned long, simple_strtoul); | ||
85 | simple_type(u32, "%i", unsigned long, simple_strtoul); | ||
86 | 57 | ||
87 | /** | 58 | /** |
88 | * debugfs_create_u8 - create a file in the debugfs filesystem that is used to read and write a unsigned 8 bit value. | 59 | * debugfs_create_u8 - create a file in the debugfs filesystem that is used to read and write a unsigned 8 bit value. |
@@ -116,6 +87,16 @@ struct dentry *debugfs_create_u8(const char *name, mode_t mode, | |||
116 | } | 87 | } |
117 | EXPORT_SYMBOL_GPL(debugfs_create_u8); | 88 | EXPORT_SYMBOL_GPL(debugfs_create_u8); |
118 | 89 | ||
90 | static void debugfs_u16_set(void *data, u64 val) | ||
91 | { | ||
92 | *(u16 *)data = val; | ||
93 | } | ||
94 | static u64 debugfs_u16_get(void *data) | ||
95 | { | ||
96 | return *(u16 *)data; | ||
97 | } | ||
98 | DEFINE_SIMPLE_ATTRIBUTE(fops_u16, debugfs_u16_get, debugfs_u16_set, "%llu\n"); | ||
99 | |||
119 | /** | 100 | /** |
120 | * debugfs_create_u16 - create a file in the debugfs filesystem that is used to read and write a unsigned 8 bit value. | 101 | * debugfs_create_u16 - create a file in the debugfs filesystem that is used to read and write a unsigned 8 bit value. |
121 | * | 102 | * |
@@ -148,6 +129,16 @@ struct dentry *debugfs_create_u16(const char *name, mode_t mode, | |||
148 | } | 129 | } |
149 | EXPORT_SYMBOL_GPL(debugfs_create_u16); | 130 | EXPORT_SYMBOL_GPL(debugfs_create_u16); |
150 | 131 | ||
132 | static void debugfs_u32_set(void *data, u64 val) | ||
133 | { | ||
134 | *(u32 *)data = val; | ||
135 | } | ||
136 | static u64 debugfs_u32_get(void *data) | ||
137 | { | ||
138 | return *(u32 *)data; | ||
139 | } | ||
140 | DEFINE_SIMPLE_ATTRIBUTE(fops_u32, debugfs_u32_get, debugfs_u32_set, "%llu\n"); | ||
141 | |||
151 | /** | 142 | /** |
152 | * debugfs_create_u32 - create a file in the debugfs filesystem that is used to read and write a unsigned 8 bit value. | 143 | * debugfs_create_u32 - create a file in the debugfs filesystem that is used to read and write a unsigned 8 bit value. |
153 | * | 144 | * |
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 2af3338f891b..3a9b6d179cbd 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c | |||
@@ -122,6 +122,9 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr, | |||
122 | 122 | ||
123 | start_addr = mm->free_area_cache; | 123 | start_addr = mm->free_area_cache; |
124 | 124 | ||
125 | if (len <= mm->cached_hole_size) | ||
126 | start_addr = TASK_UNMAPPED_BASE; | ||
127 | |||
125 | full_search: | 128 | full_search: |
126 | addr = ALIGN(start_addr, HPAGE_SIZE); | 129 | addr = ALIGN(start_addr, HPAGE_SIZE); |
127 | 130 | ||
diff --git a/fs/isofs/dir.c b/fs/isofs/dir.c index 6030956b894b..7901ac9f97ab 100644 --- a/fs/isofs/dir.c +++ b/fs/isofs/dir.c | |||
@@ -193,12 +193,17 @@ static int do_isofs_readdir(struct inode *inode, struct file *filp, | |||
193 | 193 | ||
194 | /* Handle everything else. Do name translation if there | 194 | /* Handle everything else. Do name translation if there |
195 | is no Rock Ridge NM field. */ | 195 | is no Rock Ridge NM field. */ |
196 | if (sbi->s_unhide == 'n') { | 196 | |
197 | /* Do not report hidden or associated files */ | 197 | /* |
198 | if (de->flags[-sbi->s_high_sierra] & 5) { | 198 | * Do not report hidden files if so instructed, or associated |
199 | filp->f_pos += de_len; | 199 | * files unless instructed to do so |
200 | continue; | 200 | */ |
201 | } | 201 | if ((sbi->s_hide == 'y' && |
202 | (de->flags[-sbi->s_high_sierra] & 1)) || | ||
203 | (sbi->s_showassoc =='n' && | ||
204 | (de->flags[-sbi->s_high_sierra] & 4))) { | ||
205 | filp->f_pos += de_len; | ||
206 | continue; | ||
202 | } | 207 | } |
203 | 208 | ||
204 | map = 1; | 209 | map = 1; |
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c index abd7b12eeca7..1652de1b6cb9 100644 --- a/fs/isofs/inode.c +++ b/fs/isofs/inode.c | |||
@@ -28,11 +28,6 @@ | |||
28 | 28 | ||
29 | #define BEQUIET | 29 | #define BEQUIET |
30 | 30 | ||
31 | #ifdef LEAK_CHECK | ||
32 | static int check_malloc; | ||
33 | static int check_bread; | ||
34 | #endif | ||
35 | |||
36 | static int isofs_hashi(struct dentry *parent, struct qstr *qstr); | 31 | static int isofs_hashi(struct dentry *parent, struct qstr *qstr); |
37 | static int isofs_hash(struct dentry *parent, struct qstr *qstr); | 32 | static int isofs_hash(struct dentry *parent, struct qstr *qstr); |
38 | static int isofs_dentry_cmpi(struct dentry *dentry, struct qstr *a, struct qstr *b); | 33 | static int isofs_dentry_cmpi(struct dentry *dentry, struct qstr *a, struct qstr *b); |
@@ -55,11 +50,6 @@ static void isofs_put_super(struct super_block *sb) | |||
55 | } | 50 | } |
56 | #endif | 51 | #endif |
57 | 52 | ||
58 | #ifdef LEAK_CHECK | ||
59 | printk("Outstanding mallocs:%d, outstanding buffers: %d\n", | ||
60 | check_malloc, check_bread); | ||
61 | #endif | ||
62 | |||
63 | kfree(sbi); | 53 | kfree(sbi); |
64 | sb->s_fs_info = NULL; | 54 | sb->s_fs_info = NULL; |
65 | return; | 55 | return; |
@@ -73,7 +63,7 @@ static kmem_cache_t *isofs_inode_cachep; | |||
73 | static struct inode *isofs_alloc_inode(struct super_block *sb) | 63 | static struct inode *isofs_alloc_inode(struct super_block *sb) |
74 | { | 64 | { |
75 | struct iso_inode_info *ei; | 65 | struct iso_inode_info *ei; |
76 | ei = (struct iso_inode_info *)kmem_cache_alloc(isofs_inode_cachep, SLAB_KERNEL); | 66 | ei = kmem_cache_alloc(isofs_inode_cachep, SLAB_KERNEL); |
77 | if (!ei) | 67 | if (!ei) |
78 | return NULL; | 68 | return NULL; |
79 | return &ei->vfs_inode; | 69 | return &ei->vfs_inode; |
@@ -84,9 +74,9 @@ static void isofs_destroy_inode(struct inode *inode) | |||
84 | kmem_cache_free(isofs_inode_cachep, ISOFS_I(inode)); | 74 | kmem_cache_free(isofs_inode_cachep, ISOFS_I(inode)); |
85 | } | 75 | } |
86 | 76 | ||
87 | static void init_once(void * foo, kmem_cache_t * cachep, unsigned long flags) | 77 | static void init_once(void *foo, kmem_cache_t * cachep, unsigned long flags) |
88 | { | 78 | { |
89 | struct iso_inode_info *ei = (struct iso_inode_info *) foo; | 79 | struct iso_inode_info *ei = foo; |
90 | 80 | ||
91 | if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) == | 81 | if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) == |
92 | SLAB_CTOR_CONSTRUCTOR) | 82 | SLAB_CTOR_CONSTRUCTOR) |
@@ -107,7 +97,8 @@ static int init_inodecache(void) | |||
107 | static void destroy_inodecache(void) | 97 | static void destroy_inodecache(void) |
108 | { | 98 | { |
109 | if (kmem_cache_destroy(isofs_inode_cachep)) | 99 | if (kmem_cache_destroy(isofs_inode_cachep)) |
110 | printk(KERN_INFO "iso_inode_cache: not all structures were freed\n"); | 100 | printk(KERN_INFO "iso_inode_cache: not all structures were " |
101 | "freed\n"); | ||
111 | } | 102 | } |
112 | 103 | ||
113 | static int isofs_remount(struct super_block *sb, int *flags, char *data) | 104 | static int isofs_remount(struct super_block *sb, int *flags, char *data) |
@@ -144,7 +135,7 @@ static struct dentry_operations isofs_dentry_ops[] = { | |||
144 | { | 135 | { |
145 | .d_hash = isofs_hashi_ms, | 136 | .d_hash = isofs_hashi_ms, |
146 | .d_compare = isofs_dentry_cmpi_ms, | 137 | .d_compare = isofs_dentry_cmpi_ms, |
147 | } | 138 | }, |
148 | #endif | 139 | #endif |
149 | }; | 140 | }; |
150 | 141 | ||
@@ -153,7 +144,8 @@ struct iso9660_options{ | |||
153 | char rock; | 144 | char rock; |
154 | char joliet; | 145 | char joliet; |
155 | char cruft; | 146 | char cruft; |
156 | char unhide; | 147 | char hide; |
148 | char showassoc; | ||
157 | char nocompress; | 149 | char nocompress; |
158 | unsigned char check; | 150 | unsigned char check; |
159 | unsigned int blocksize; | 151 | unsigned int blocksize; |
@@ -219,8 +211,8 @@ isofs_hashi_common(struct dentry *dentry, struct qstr *qstr, int ms) | |||
219 | /* | 211 | /* |
220 | * Case insensitive compare of two isofs names. | 212 | * Case insensitive compare of two isofs names. |
221 | */ | 213 | */ |
222 | static int | 214 | static int isofs_dentry_cmpi_common(struct dentry *dentry, struct qstr *a, |
223 | isofs_dentry_cmpi_common(struct dentry *dentry,struct qstr *a,struct qstr *b,int ms) | 215 | struct qstr *b, int ms) |
224 | { | 216 | { |
225 | int alen, blen; | 217 | int alen, blen; |
226 | 218 | ||
@@ -243,8 +235,8 @@ isofs_dentry_cmpi_common(struct dentry *dentry,struct qstr *a,struct qstr *b,int | |||
243 | /* | 235 | /* |
244 | * Case sensitive compare of two isofs names. | 236 | * Case sensitive compare of two isofs names. |
245 | */ | 237 | */ |
246 | static int | 238 | static int isofs_dentry_cmp_common(struct dentry *dentry, struct qstr *a, |
247 | isofs_dentry_cmp_common(struct dentry *dentry,struct qstr *a,struct qstr *b,int ms) | 239 | struct qstr *b, int ms) |
248 | { | 240 | { |
249 | int alen, blen; | 241 | int alen, blen; |
250 | 242 | ||
@@ -318,13 +310,15 @@ enum { | |||
318 | Opt_block, Opt_check_r, Opt_check_s, Opt_cruft, Opt_gid, Opt_ignore, | 310 | Opt_block, Opt_check_r, Opt_check_s, Opt_cruft, Opt_gid, Opt_ignore, |
319 | Opt_iocharset, Opt_map_a, Opt_map_n, Opt_map_o, Opt_mode, Opt_nojoliet, | 311 | Opt_iocharset, Opt_map_a, Opt_map_n, Opt_map_o, Opt_mode, Opt_nojoliet, |
320 | Opt_norock, Opt_sb, Opt_session, Opt_uid, Opt_unhide, Opt_utf8, Opt_err, | 312 | Opt_norock, Opt_sb, Opt_session, Opt_uid, Opt_unhide, Opt_utf8, Opt_err, |
321 | Opt_nocompress, | 313 | Opt_nocompress, Opt_hide, Opt_showassoc, |
322 | }; | 314 | }; |
323 | 315 | ||
324 | static match_table_t tokens = { | 316 | static match_table_t tokens = { |
325 | {Opt_norock, "norock"}, | 317 | {Opt_norock, "norock"}, |
326 | {Opt_nojoliet, "nojoliet"}, | 318 | {Opt_nojoliet, "nojoliet"}, |
327 | {Opt_unhide, "unhide"}, | 319 | {Opt_unhide, "unhide"}, |
320 | {Opt_hide, "hide"}, | ||
321 | {Opt_showassoc, "showassoc"}, | ||
328 | {Opt_cruft, "cruft"}, | 322 | {Opt_cruft, "cruft"}, |
329 | {Opt_utf8, "utf8"}, | 323 | {Opt_utf8, "utf8"}, |
330 | {Opt_iocharset, "iocharset=%s"}, | 324 | {Opt_iocharset, "iocharset=%s"}, |
@@ -356,7 +350,7 @@ static match_table_t tokens = { | |||
356 | {Opt_err, NULL} | 350 | {Opt_err, NULL} |
357 | }; | 351 | }; |
358 | 352 | ||
359 | static int parse_options(char *options, struct iso9660_options * popt) | 353 | static int parse_options(char *options, struct iso9660_options *popt) |
360 | { | 354 | { |
361 | char *p; | 355 | char *p; |
362 | int option; | 356 | int option; |
@@ -365,7 +359,8 @@ static int parse_options(char *options, struct iso9660_options * popt) | |||
365 | popt->rock = 'y'; | 359 | popt->rock = 'y'; |
366 | popt->joliet = 'y'; | 360 | popt->joliet = 'y'; |
367 | popt->cruft = 'n'; | 361 | popt->cruft = 'n'; |
368 | popt->unhide = 'n'; | 362 | popt->hide = 'n'; |
363 | popt->showassoc = 'n'; | ||
369 | popt->check = 'u'; /* unset */ | 364 | popt->check = 'u'; /* unset */ |
370 | popt->nocompress = 0; | 365 | popt->nocompress = 0; |
371 | popt->blocksize = 1024; | 366 | popt->blocksize = 1024; |
@@ -398,8 +393,12 @@ static int parse_options(char *options, struct iso9660_options * popt) | |||
398 | case Opt_nojoliet: | 393 | case Opt_nojoliet: |
399 | popt->joliet = 'n'; | 394 | popt->joliet = 'n'; |
400 | break; | 395 | break; |
396 | case Opt_hide: | ||
397 | popt->hide = 'y'; | ||
398 | break; | ||
401 | case Opt_unhide: | 399 | case Opt_unhide: |
402 | popt->unhide = 'y'; | 400 | case Opt_showassoc: |
401 | popt->showassoc = 'y'; | ||
403 | break; | 402 | break; |
404 | case Opt_cruft: | 403 | case Opt_cruft: |
405 | popt->cruft = 'y'; | 404 | popt->cruft = 'y'; |
@@ -493,7 +492,7 @@ static int parse_options(char *options, struct iso9660_options * popt) | |||
493 | */ | 492 | */ |
494 | #define WE_OBEY_THE_WRITTEN_STANDARDS 1 | 493 | #define WE_OBEY_THE_WRITTEN_STANDARDS 1 |
495 | 494 | ||
496 | static unsigned int isofs_get_last_session(struct super_block *sb,s32 session ) | 495 | static unsigned int isofs_get_last_session(struct super_block *sb, s32 session) |
497 | { | 496 | { |
498 | struct cdrom_multisession ms_info; | 497 | struct cdrom_multisession ms_info; |
499 | unsigned int vol_desc_start; | 498 | unsigned int vol_desc_start; |
@@ -518,7 +517,8 @@ static unsigned int isofs_get_last_session(struct super_block *sb,s32 session ) | |||
518 | printk(KERN_ERR "Invalid session number or type of track\n"); | 517 | printk(KERN_ERR "Invalid session number or type of track\n"); |
519 | } | 518 | } |
520 | i = ioctl_by_bdev(bdev, CDROMMULTISESSION, (unsigned long) &ms_info); | 519 | i = ioctl_by_bdev(bdev, CDROMMULTISESSION, (unsigned long) &ms_info); |
521 | if(session > 0) printk(KERN_ERR "Invalid session number\n"); | 520 | if (session > 0) |
521 | printk(KERN_ERR "Invalid session number\n"); | ||
522 | #if 0 | 522 | #if 0 |
523 | printk("isofs.inode: CDROMMULTISESSION: rc=%d\n",i); | 523 | printk("isofs.inode: CDROMMULTISESSION: rc=%d\n",i); |
524 | if (i==0) { | 524 | if (i==0) { |
@@ -557,13 +557,13 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent) | |||
557 | struct iso9660_options opt; | 557 | struct iso9660_options opt; |
558 | struct isofs_sb_info * sbi; | 558 | struct isofs_sb_info * sbi; |
559 | 559 | ||
560 | sbi = kmalloc(sizeof(struct isofs_sb_info), GFP_KERNEL); | 560 | sbi = kmalloc(sizeof(*sbi), GFP_KERNEL); |
561 | if (!sbi) | 561 | if (!sbi) |
562 | return -ENOMEM; | 562 | return -ENOMEM; |
563 | s->s_fs_info = sbi; | 563 | s->s_fs_info = sbi; |
564 | memset(sbi, 0, sizeof(struct isofs_sb_info)); | 564 | memset(sbi, 0, sizeof(*sbi)); |
565 | 565 | ||
566 | if (!parse_options((char *) data, &opt)) | 566 | if (!parse_options((char *)data, &opt)) |
567 | goto out_freesbi; | 567 | goto out_freesbi; |
568 | 568 | ||
569 | /* | 569 | /* |
@@ -792,7 +792,8 @@ root_found: | |||
792 | sbi->s_rock = (opt.rock == 'y' ? 2 : 0); | 792 | sbi->s_rock = (opt.rock == 'y' ? 2 : 0); |
793 | sbi->s_rock_offset = -1; /* initial offset, will guess until SP is found*/ | 793 | sbi->s_rock_offset = -1; /* initial offset, will guess until SP is found*/ |
794 | sbi->s_cruft = opt.cruft; | 794 | sbi->s_cruft = opt.cruft; |
795 | sbi->s_unhide = opt.unhide; | 795 | sbi->s_hide = opt.hide; |
796 | sbi->s_showassoc = opt.showassoc; | ||
796 | sbi->s_uid = opt.uid; | 797 | sbi->s_uid = opt.uid; |
797 | sbi->s_gid = opt.gid; | 798 | sbi->s_gid = opt.gid; |
798 | sbi->s_utf8 = opt.utf8; | 799 | sbi->s_utf8 = opt.utf8; |
@@ -1002,7 +1003,6 @@ int isofs_get_blocks(struct inode *inode, sector_t iblock_s, | |||
1002 | rv++; | 1003 | rv++; |
1003 | } | 1004 | } |
1004 | 1005 | ||
1005 | |||
1006 | abort: | 1006 | abort: |
1007 | unlock_kernel(); | 1007 | unlock_kernel(); |
1008 | return rv; | 1008 | return rv; |
@@ -1014,7 +1014,7 @@ abort: | |||
1014 | static int isofs_get_block(struct inode *inode, sector_t iblock, | 1014 | static int isofs_get_block(struct inode *inode, sector_t iblock, |
1015 | struct buffer_head *bh_result, int create) | 1015 | struct buffer_head *bh_result, int create) |
1016 | { | 1016 | { |
1017 | if ( create ) { | 1017 | if (create) { |
1018 | printk("isofs_get_block: Kernel tries to allocate a block\n"); | 1018 | printk("isofs_get_block: Kernel tries to allocate a block\n"); |
1019 | return -EROFS; | 1019 | return -EROFS; |
1020 | } | 1020 | } |
@@ -1061,19 +1061,17 @@ static struct address_space_operations isofs_aops = { | |||
1061 | 1061 | ||
1062 | static inline void test_and_set_uid(uid_t *p, uid_t value) | 1062 | static inline void test_and_set_uid(uid_t *p, uid_t value) |
1063 | { | 1063 | { |
1064 | if(value) { | 1064 | if (value) |
1065 | *p = value; | 1065 | *p = value; |
1066 | } | ||
1067 | } | 1066 | } |
1068 | 1067 | ||
1069 | static inline void test_and_set_gid(gid_t *p, gid_t value) | 1068 | static inline void test_and_set_gid(gid_t *p, gid_t value) |
1070 | { | 1069 | { |
1071 | if(value) { | 1070 | if (value) |
1072 | *p = value; | 1071 | *p = value; |
1073 | } | ||
1074 | } | 1072 | } |
1075 | 1073 | ||
1076 | static int isofs_read_level3_size(struct inode * inode) | 1074 | static int isofs_read_level3_size(struct inode *inode) |
1077 | { | 1075 | { |
1078 | unsigned long bufsize = ISOFS_BUFFER_SIZE(inode); | 1076 | unsigned long bufsize = ISOFS_BUFFER_SIZE(inode); |
1079 | int high_sierra = ISOFS_SB(inode->i_sb)->s_high_sierra; | 1077 | int high_sierra = ISOFS_SB(inode->i_sb)->s_high_sierra; |
@@ -1136,7 +1134,7 @@ static int isofs_read_level3_size(struct inode * inode) | |||
1136 | bh = sb_bread(inode->i_sb, block); | 1134 | bh = sb_bread(inode->i_sb, block); |
1137 | if (!bh) | 1135 | if (!bh) |
1138 | goto out_noread; | 1136 | goto out_noread; |
1139 | memcpy((void *) tmpde + slop, bh->b_data, offset); | 1137 | memcpy((void *)tmpde+slop, bh->b_data, offset); |
1140 | } | 1138 | } |
1141 | de = tmpde; | 1139 | de = tmpde; |
1142 | } | 1140 | } |
@@ -1150,12 +1148,11 @@ static int isofs_read_level3_size(struct inode * inode) | |||
1150 | more_entries = de->flags[-high_sierra] & 0x80; | 1148 | more_entries = de->flags[-high_sierra] & 0x80; |
1151 | 1149 | ||
1152 | i++; | 1150 | i++; |
1153 | if(i > 100) | 1151 | if (i > 100) |
1154 | goto out_toomany; | 1152 | goto out_toomany; |
1155 | } while(more_entries); | 1153 | } while (more_entries); |
1156 | out: | 1154 | out: |
1157 | if (tmpde) | 1155 | kfree(tmpde); |
1158 | kfree(tmpde); | ||
1159 | if (bh) | 1156 | if (bh) |
1160 | brelse(bh); | 1157 | brelse(bh); |
1161 | return 0; | 1158 | return 0; |
@@ -1179,7 +1176,7 @@ out_toomany: | |||
1179 | goto out; | 1176 | goto out; |
1180 | } | 1177 | } |
1181 | 1178 | ||
1182 | static void isofs_read_inode(struct inode * inode) | 1179 | static void isofs_read_inode(struct inode *inode) |
1183 | { | 1180 | { |
1184 | struct super_block *sb = inode->i_sb; | 1181 | struct super_block *sb = inode->i_sb; |
1185 | struct isofs_sb_info *sbi = ISOFS_SB(sb); | 1182 | struct isofs_sb_info *sbi = ISOFS_SB(sb); |
@@ -1249,7 +1246,7 @@ static void isofs_read_inode(struct inode * inode) | |||
1249 | ei->i_format_parm[2] = 0; | 1246 | ei->i_format_parm[2] = 0; |
1250 | 1247 | ||
1251 | ei->i_section_size = isonum_733 (de->size); | 1248 | ei->i_section_size = isonum_733 (de->size); |
1252 | if(de->flags[-high_sierra] & 0x80) { | 1249 | if (de->flags[-high_sierra] & 0x80) { |
1253 | if(isofs_read_level3_size(inode)) goto fail; | 1250 | if(isofs_read_level3_size(inode)) goto fail; |
1254 | } else { | 1251 | } else { |
1255 | ei->i_next_section_block = 0; | 1252 | ei->i_next_section_block = 0; |
@@ -1336,16 +1333,16 @@ static void isofs_read_inode(struct inode * inode) | |||
1336 | /* XXX - parse_rock_ridge_inode() had already set i_rdev. */ | 1333 | /* XXX - parse_rock_ridge_inode() had already set i_rdev. */ |
1337 | init_special_inode(inode, inode->i_mode, inode->i_rdev); | 1334 | init_special_inode(inode, inode->i_mode, inode->i_rdev); |
1338 | 1335 | ||
1339 | out: | 1336 | out: |
1340 | if (tmpde) | 1337 | if (tmpde) |
1341 | kfree(tmpde); | 1338 | kfree(tmpde); |
1342 | if (bh) | 1339 | if (bh) |
1343 | brelse(bh); | 1340 | brelse(bh); |
1344 | return; | 1341 | return; |
1345 | 1342 | ||
1346 | out_badread: | 1343 | out_badread: |
1347 | printk(KERN_WARNING "ISOFS: unable to read i-node block\n"); | 1344 | printk(KERN_WARNING "ISOFS: unable to read i-node block\n"); |
1348 | fail: | 1345 | fail: |
1349 | make_bad_inode(inode); | 1346 | make_bad_inode(inode); |
1350 | goto out; | 1347 | goto out; |
1351 | } | 1348 | } |
@@ -1394,11 +1391,8 @@ struct inode *isofs_iget(struct super_block *sb, | |||
1394 | 1391 | ||
1395 | hashval = (block << sb->s_blocksize_bits) | offset; | 1392 | hashval = (block << sb->s_blocksize_bits) | offset; |
1396 | 1393 | ||
1397 | inode = iget5_locked(sb, | 1394 | inode = iget5_locked(sb, hashval, &isofs_iget5_test, |
1398 | hashval, | 1395 | &isofs_iget5_set, &data); |
1399 | &isofs_iget5_test, | ||
1400 | &isofs_iget5_set, | ||
1401 | &data); | ||
1402 | 1396 | ||
1403 | if (inode && (inode->i_state & I_NEW)) { | 1397 | if (inode && (inode->i_state & I_NEW)) { |
1404 | sb->s_op->read_inode(inode); | 1398 | sb->s_op->read_inode(inode); |
@@ -1408,36 +1402,6 @@ struct inode *isofs_iget(struct super_block *sb, | |||
1408 | return inode; | 1402 | return inode; |
1409 | } | 1403 | } |
1410 | 1404 | ||
1411 | #ifdef LEAK_CHECK | ||
1412 | #undef malloc | ||
1413 | #undef free_s | ||
1414 | #undef sb_bread | ||
1415 | #undef brelse | ||
1416 | |||
1417 | void * leak_check_malloc(unsigned int size){ | ||
1418 | void * tmp; | ||
1419 | check_malloc++; | ||
1420 | tmp = kmalloc(size, GFP_KERNEL); | ||
1421 | return tmp; | ||
1422 | } | ||
1423 | |||
1424 | void leak_check_free_s(void * obj, int size){ | ||
1425 | check_malloc--; | ||
1426 | return kfree(obj); | ||
1427 | } | ||
1428 | |||
1429 | struct buffer_head * leak_check_bread(struct super_block *sb, int block){ | ||
1430 | check_bread++; | ||
1431 | return sb_bread(sb, block); | ||
1432 | } | ||
1433 | |||
1434 | void leak_check_brelse(struct buffer_head * bh){ | ||
1435 | check_bread--; | ||
1436 | return brelse(bh); | ||
1437 | } | ||
1438 | |||
1439 | #endif | ||
1440 | |||
1441 | static struct super_block *isofs_get_sb(struct file_system_type *fs_type, | 1405 | static struct super_block *isofs_get_sb(struct file_system_type *fs_type, |
1442 | int flags, const char *dev_name, void *data) | 1406 | int flags, const char *dev_name, void *data) |
1443 | { | 1407 | { |
diff --git a/fs/isofs/isofs.h b/fs/isofs/isofs.h index 9ce7b51fb614..38c75151fc66 100644 --- a/fs/isofs/isofs.h +++ b/fs/isofs/isofs.h | |||
@@ -47,6 +47,8 @@ struct isofs_sb_info { | |||
47 | unsigned char s_nosuid; | 47 | unsigned char s_nosuid; |
48 | unsigned char s_nodev; | 48 | unsigned char s_nodev; |
49 | unsigned char s_nocompress; | 49 | unsigned char s_nocompress; |
50 | unsigned char s_hide; | ||
51 | unsigned char s_showassoc; | ||
50 | 52 | ||
51 | mode_t s_mode; | 53 | mode_t s_mode; |
52 | gid_t s_gid; | 54 | gid_t s_gid; |
diff --git a/fs/isofs/namei.c b/fs/isofs/namei.c index 690edf37173c..e37e82b7cbf0 100644 --- a/fs/isofs/namei.c +++ b/fs/isofs/namei.c | |||
@@ -131,14 +131,16 @@ isofs_find_entry(struct inode *dir, struct dentry *dentry, | |||
131 | } | 131 | } |
132 | 132 | ||
133 | /* | 133 | /* |
134 | * Skip hidden or associated files unless unhide is set | 134 | * Skip hidden or associated files unless hide or showassoc, |
135 | * respectively, is set | ||
135 | */ | 136 | */ |
136 | match = 0; | 137 | match = 0; |
137 | if (dlen > 0 && | 138 | if (dlen > 0 && |
138 | (!(de->flags[-sbi->s_high_sierra] & 5) | 139 | (sbi->s_hide =='n' || |
139 | || sbi->s_unhide == 'y')) | 140 | (!(de->flags[-sbi->s_high_sierra] & 1))) && |
140 | { | 141 | (sbi->s_showassoc =='y' || |
141 | match = (isofs_cmp(dentry,dpnt,dlen) == 0); | 142 | (!(de->flags[-sbi->s_high_sierra] & 4)))) { |
143 | match = (isofs_cmp(dentry, dpnt, dlen) == 0); | ||
142 | } | 144 | } |
143 | if (match) { | 145 | if (match) { |
144 | isofs_normalize_block_and_offset(de, | 146 | isofs_normalize_block_and_offset(de, |
@@ -146,11 +148,11 @@ isofs_find_entry(struct inode *dir, struct dentry *dentry, | |||
146 | &offset_saved); | 148 | &offset_saved); |
147 | *block_rv = block_saved; | 149 | *block_rv = block_saved; |
148 | *offset_rv = offset_saved; | 150 | *offset_rv = offset_saved; |
149 | if (bh) brelse(bh); | 151 | brelse(bh); |
150 | return 1; | 152 | return 1; |
151 | } | 153 | } |
152 | } | 154 | } |
153 | if (bh) brelse(bh); | 155 | brelse(bh); |
154 | return 0; | 156 | return 0; |
155 | } | 157 | } |
156 | 158 | ||
diff --git a/fs/isofs/rock.c b/fs/isofs/rock.c index 089e79c65585..4326cb47f8fa 100644 --- a/fs/isofs/rock.c +++ b/fs/isofs/rock.c | |||
@@ -13,352 +13,542 @@ | |||
13 | #include "isofs.h" | 13 | #include "isofs.h" |
14 | #include "rock.h" | 14 | #include "rock.h" |
15 | 15 | ||
16 | /* These functions are designed to read the system areas of a directory record | 16 | /* |
17 | * These functions are designed to read the system areas of a directory record | ||
17 | * and extract relevant information. There are different functions provided | 18 | * and extract relevant information. There are different functions provided |
18 | * depending upon what information we need at the time. One function fills | 19 | * depending upon what information we need at the time. One function fills |
19 | * out an inode structure, a second one extracts a filename, a third one | 20 | * out an inode structure, a second one extracts a filename, a third one |
20 | * returns a symbolic link name, and a fourth one returns the extent number | 21 | * returns a symbolic link name, and a fourth one returns the extent number |
21 | * for the file. */ | 22 | * for the file. |
22 | 23 | */ | |
23 | #define SIG(A,B) ((A) | ((B) << 8)) /* isonum_721() */ | 24 | |
24 | 25 | #define SIG(A,B) ((A) | ((B) << 8)) /* isonum_721() */ | |
25 | 26 | ||
26 | /* This is a way of ensuring that we have something in the system | 27 | struct rock_state { |
27 | use fields that is compatible with Rock Ridge */ | 28 | void *buffer; |
28 | #define CHECK_SP(FAIL) \ | 29 | unsigned char *chr; |
29 | if(rr->u.SP.magic[0] != 0xbe) FAIL; \ | 30 | int len; |
30 | if(rr->u.SP.magic[1] != 0xef) FAIL; \ | 31 | int cont_size; |
31 | ISOFS_SB(inode->i_sb)->s_rock_offset=rr->u.SP.skip; | 32 | int cont_extent; |
32 | /* We define a series of macros because each function must do exactly the | 33 | int cont_offset; |
33 | same thing in certain places. We use the macros to ensure that everything | 34 | struct inode *inode; |
34 | is done correctly */ | 35 | }; |
35 | 36 | ||
36 | #define CONTINUE_DECLS \ | 37 | /* |
37 | int cont_extent = 0, cont_offset = 0, cont_size = 0; \ | 38 | * This is a way of ensuring that we have something in the system |
38 | void *buffer = NULL | 39 | * use fields that is compatible with Rock Ridge. Return zero on success. |
39 | 40 | */ | |
40 | #define CHECK_CE \ | 41 | |
41 | {cont_extent = isonum_733(rr->u.CE.extent); \ | 42 | static int check_sp(struct rock_ridge *rr, struct inode *inode) |
42 | cont_offset = isonum_733(rr->u.CE.offset); \ | ||
43 | cont_size = isonum_733(rr->u.CE.size);} | ||
44 | |||
45 | #define SETUP_ROCK_RIDGE(DE,CHR,LEN) \ | ||
46 | {LEN= sizeof(struct iso_directory_record) + DE->name_len[0]; \ | ||
47 | if(LEN & 1) LEN++; \ | ||
48 | CHR = ((unsigned char *) DE) + LEN; \ | ||
49 | LEN = *((unsigned char *) DE) - LEN; \ | ||
50 | if (LEN<0) LEN=0; \ | ||
51 | if (ISOFS_SB(inode->i_sb)->s_rock_offset!=-1) \ | ||
52 | { \ | ||
53 | LEN-=ISOFS_SB(inode->i_sb)->s_rock_offset; \ | ||
54 | CHR+=ISOFS_SB(inode->i_sb)->s_rock_offset; \ | ||
55 | if (LEN<0) LEN=0; \ | ||
56 | } \ | ||
57 | } | ||
58 | |||
59 | #define MAYBE_CONTINUE(LABEL,DEV) \ | ||
60 | {if (buffer) { kfree(buffer); buffer = NULL; } \ | ||
61 | if (cont_extent){ \ | ||
62 | int block, offset, offset1; \ | ||
63 | struct buffer_head * pbh; \ | ||
64 | buffer = kmalloc(cont_size,GFP_KERNEL); \ | ||
65 | if (!buffer) goto out; \ | ||
66 | block = cont_extent; \ | ||
67 | offset = cont_offset; \ | ||
68 | offset1 = 0; \ | ||
69 | pbh = sb_bread(DEV->i_sb, block); \ | ||
70 | if(pbh){ \ | ||
71 | if (offset > pbh->b_size || offset + cont_size > pbh->b_size){ \ | ||
72 | brelse(pbh); \ | ||
73 | goto out; \ | ||
74 | } \ | ||
75 | memcpy(buffer + offset1, pbh->b_data + offset, cont_size - offset1); \ | ||
76 | brelse(pbh); \ | ||
77 | chr = (unsigned char *) buffer; \ | ||
78 | len = cont_size; \ | ||
79 | cont_extent = 0; \ | ||
80 | cont_size = 0; \ | ||
81 | cont_offset = 0; \ | ||
82 | goto LABEL; \ | ||
83 | } \ | ||
84 | printk("Unable to read rock-ridge attributes\n"); \ | ||
85 | }} | ||
86 | |||
87 | /* return length of name field; 0: not found, -1: to be ignored */ | ||
88 | int get_rock_ridge_filename(struct iso_directory_record * de, | ||
89 | char * retname, struct inode * inode) | ||
90 | { | 43 | { |
91 | int len; | 44 | if (rr->u.SP.magic[0] != 0xbe) |
92 | unsigned char * chr; | 45 | return -1; |
93 | CONTINUE_DECLS; | 46 | if (rr->u.SP.magic[1] != 0xef) |
94 | int retnamlen = 0, truncate=0; | 47 | return -1; |
95 | 48 | ISOFS_SB(inode->i_sb)->s_rock_offset = rr->u.SP.skip; | |
96 | if (!ISOFS_SB(inode->i_sb)->s_rock) return 0; | 49 | return 0; |
97 | *retname = 0; | 50 | } |
98 | 51 | ||
99 | SETUP_ROCK_RIDGE(de, chr, len); | 52 | static void setup_rock_ridge(struct iso_directory_record *de, |
100 | repeat: | 53 | struct inode *inode, struct rock_state *rs) |
101 | { | 54 | { |
102 | struct rock_ridge * rr; | 55 | rs->len = sizeof(struct iso_directory_record) + de->name_len[0]; |
103 | int sig; | 56 | if (rs->len & 1) |
104 | 57 | (rs->len)++; | |
105 | while (len > 2){ /* There may be one byte for padding somewhere */ | 58 | rs->chr = (unsigned char *)de + rs->len; |
106 | rr = (struct rock_ridge *) chr; | 59 | rs->len = *((unsigned char *)de) - rs->len; |
107 | if (rr->len < 3) goto out; /* Something got screwed up here */ | 60 | if (rs->len < 0) |
108 | sig = isonum_721(chr); | 61 | rs->len = 0; |
109 | chr += rr->len; | 62 | |
110 | len -= rr->len; | 63 | if (ISOFS_SB(inode->i_sb)->s_rock_offset != -1) { |
111 | if (len < 0) goto out; /* corrupted isofs */ | 64 | rs->len -= ISOFS_SB(inode->i_sb)->s_rock_offset; |
112 | 65 | rs->chr += ISOFS_SB(inode->i_sb)->s_rock_offset; | |
113 | switch(sig){ | 66 | if (rs->len < 0) |
114 | case SIG('R','R'): | 67 | rs->len = 0; |
115 | if((rr->u.RR.flags[0] & RR_NM) == 0) goto out; | 68 | } |
116 | break; | 69 | } |
117 | case SIG('S','P'): | 70 | |
118 | CHECK_SP(goto out); | 71 | static void init_rock_state(struct rock_state *rs, struct inode *inode) |
119 | break; | 72 | { |
120 | case SIG('C','E'): | 73 | memset(rs, 0, sizeof(*rs)); |
121 | CHECK_CE; | 74 | rs->inode = inode; |
122 | break; | 75 | } |
123 | case SIG('N','M'): | 76 | |
124 | if (truncate) break; | 77 | /* |
125 | if (rr->len < 5) break; | 78 | * Returns 0 if the caller should continue scanning, 1 if the scan must end |
126 | /* | 79 | * and -ve on error. |
127 | * If the flags are 2 or 4, this indicates '.' or '..'. | 80 | */ |
128 | * We don't want to do anything with this, because it | 81 | static int rock_continue(struct rock_state *rs) |
129 | * screws up the code that calls us. We don't really | 82 | { |
130 | * care anyways, since we can just use the non-RR | 83 | int ret = 1; |
131 | * name. | 84 | int blocksize = 1 << rs->inode->i_blkbits; |
132 | */ | 85 | const int min_de_size = offsetof(struct rock_ridge, u); |
133 | if (rr->u.NM.flags & 6) { | 86 | |
134 | break; | 87 | kfree(rs->buffer); |
88 | rs->buffer = NULL; | ||
89 | |||
90 | if ((unsigned)rs->cont_offset > blocksize - min_de_size || | ||
91 | (unsigned)rs->cont_size > blocksize || | ||
92 | (unsigned)(rs->cont_offset + rs->cont_size) > blocksize) { | ||
93 | printk(KERN_NOTICE "rock: corrupted directory entry. " | ||
94 | "extent=%d, offset=%d, size=%d\n", | ||
95 | rs->cont_extent, rs->cont_offset, rs->cont_size); | ||
96 | ret = -EIO; | ||
97 | goto out; | ||
135 | } | 98 | } |
136 | 99 | ||
137 | if (rr->u.NM.flags & ~1) { | 100 | if (rs->cont_extent) { |
138 | printk("Unsupported NM flag settings (%d)\n",rr->u.NM.flags); | 101 | struct buffer_head *bh; |
139 | break; | 102 | |
103 | rs->buffer = kmalloc(rs->cont_size, GFP_KERNEL); | ||
104 | if (!rs->buffer) { | ||
105 | ret = -ENOMEM; | ||
106 | goto out; | ||
107 | } | ||
108 | ret = -EIO; | ||
109 | bh = sb_bread(rs->inode->i_sb, rs->cont_extent); | ||
110 | if (bh) { | ||
111 | memcpy(rs->buffer, bh->b_data + rs->cont_offset, | ||
112 | rs->cont_size); | ||
113 | put_bh(bh); | ||
114 | rs->chr = rs->buffer; | ||
115 | rs->len = rs->cont_size; | ||
116 | rs->cont_extent = 0; | ||
117 | rs->cont_size = 0; | ||
118 | rs->cont_offset = 0; | ||
119 | return 0; | ||
120 | } | ||
121 | printk("Unable to read rock-ridge attributes\n"); | ||
122 | } | ||
123 | out: | ||
124 | kfree(rs->buffer); | ||
125 | rs->buffer = NULL; | ||
126 | return ret; | ||
127 | } | ||
128 | |||
129 | /* | ||
130 | * We think there's a record of type `sig' at rs->chr. Parse the signature | ||
131 | * and make sure that there's really room for a record of that type. | ||
132 | */ | ||
133 | static int rock_check_overflow(struct rock_state *rs, int sig) | ||
134 | { | ||
135 | int len; | ||
136 | |||
137 | switch (sig) { | ||
138 | case SIG('S', 'P'): | ||
139 | len = sizeof(struct SU_SP_s); | ||
140 | break; | ||
141 | case SIG('C', 'E'): | ||
142 | len = sizeof(struct SU_CE_s); | ||
143 | break; | ||
144 | case SIG('E', 'R'): | ||
145 | len = sizeof(struct SU_ER_s); | ||
146 | break; | ||
147 | case SIG('R', 'R'): | ||
148 | len = sizeof(struct RR_RR_s); | ||
149 | break; | ||
150 | case SIG('P', 'X'): | ||
151 | len = sizeof(struct RR_PX_s); | ||
152 | break; | ||
153 | case SIG('P', 'N'): | ||
154 | len = sizeof(struct RR_PN_s); | ||
155 | break; | ||
156 | case SIG('S', 'L'): | ||
157 | len = sizeof(struct RR_SL_s); | ||
158 | break; | ||
159 | case SIG('N', 'M'): | ||
160 | len = sizeof(struct RR_NM_s); | ||
161 | break; | ||
162 | case SIG('C', 'L'): | ||
163 | len = sizeof(struct RR_CL_s); | ||
164 | break; | ||
165 | case SIG('P', 'L'): | ||
166 | len = sizeof(struct RR_PL_s); | ||
167 | break; | ||
168 | case SIG('T', 'F'): | ||
169 | len = sizeof(struct RR_TF_s); | ||
170 | break; | ||
171 | case SIG('Z', 'F'): | ||
172 | len = sizeof(struct RR_ZF_s); | ||
173 | break; | ||
174 | default: | ||
175 | len = 0; | ||
176 | break; | ||
140 | } | 177 | } |
141 | if((strlen(retname) + rr->len - 5) >= 254) { | 178 | len += offsetof(struct rock_ridge, u); |
142 | truncate = 1; | 179 | if (len > rs->len) { |
143 | break; | 180 | printk(KERN_NOTICE "rock: directory entry would overflow " |
181 | "storage\n"); | ||
182 | printk(KERN_NOTICE "rock: sig=0x%02x, size=%d, remaining=%d\n", | ||
183 | sig, len, rs->len); | ||
184 | return -EIO; | ||
185 | } | ||
186 | return 0; | ||
187 | } | ||
188 | |||
189 | /* | ||
190 | * return length of name field; 0: not found, -1: to be ignored | ||
191 | */ | ||
192 | int get_rock_ridge_filename(struct iso_directory_record *de, | ||
193 | char *retname, struct inode *inode) | ||
194 | { | ||
195 | struct rock_state rs; | ||
196 | struct rock_ridge *rr; | ||
197 | int sig; | ||
198 | int retnamlen = 0; | ||
199 | int truncate = 0; | ||
200 | int ret = 0; | ||
201 | |||
202 | if (!ISOFS_SB(inode->i_sb)->s_rock) | ||
203 | return 0; | ||
204 | *retname = 0; | ||
205 | |||
206 | init_rock_state(&rs, inode); | ||
207 | setup_rock_ridge(de, inode, &rs); | ||
208 | repeat: | ||
209 | |||
210 | while (rs.len > 2) { /* There may be one byte for padding somewhere */ | ||
211 | rr = (struct rock_ridge *)rs.chr; | ||
212 | if (rr->len < 3) | ||
213 | goto out; /* Something got screwed up here */ | ||
214 | sig = isonum_721(rs.chr); | ||
215 | if (rock_check_overflow(&rs, sig)) | ||
216 | goto eio; | ||
217 | rs.chr += rr->len; | ||
218 | rs.len -= rr->len; | ||
219 | if (rs.len < 0) | ||
220 | goto eio; /* corrupted isofs */ | ||
221 | |||
222 | switch (sig) { | ||
223 | case SIG('R', 'R'): | ||
224 | if ((rr->u.RR.flags[0] & RR_NM) == 0) | ||
225 | goto out; | ||
226 | break; | ||
227 | case SIG('S', 'P'): | ||
228 | if (check_sp(rr, inode)) | ||
229 | goto out; | ||
230 | break; | ||
231 | case SIG('C', 'E'): | ||
232 | rs.cont_extent = isonum_733(rr->u.CE.extent); | ||
233 | rs.cont_offset = isonum_733(rr->u.CE.offset); | ||
234 | rs.cont_size = isonum_733(rr->u.CE.size); | ||
235 | break; | ||
236 | case SIG('N', 'M'): | ||
237 | if (truncate) | ||
238 | break; | ||
239 | if (rr->len < 5) | ||
240 | break; | ||
241 | /* | ||
242 | * If the flags are 2 or 4, this indicates '.' or '..'. | ||
243 | * We don't want to do anything with this, because it | ||
244 | * screws up the code that calls us. We don't really | ||
245 | * care anyways, since we can just use the non-RR | ||
246 | * name. | ||
247 | */ | ||
248 | if (rr->u.NM.flags & 6) | ||
249 | break; | ||
250 | |||
251 | if (rr->u.NM.flags & ~1) { | ||
252 | printk("Unsupported NM flag settings (%d)\n", | ||
253 | rr->u.NM.flags); | ||
254 | break; | ||
255 | } | ||
256 | if ((strlen(retname) + rr->len - 5) >= 254) { | ||
257 | truncate = 1; | ||
258 | break; | ||
259 | } | ||
260 | strncat(retname, rr->u.NM.name, rr->len - 5); | ||
261 | retnamlen += rr->len - 5; | ||
262 | break; | ||
263 | case SIG('R', 'E'): | ||
264 | kfree(rs.buffer); | ||
265 | return -1; | ||
266 | default: | ||
267 | break; | ||
268 | } | ||
144 | } | 269 | } |
145 | strncat(retname, rr->u.NM.name, rr->len - 5); | 270 | ret = rock_continue(&rs); |
146 | retnamlen += rr->len - 5; | 271 | if (ret == 0) |
147 | break; | 272 | goto repeat; |
148 | case SIG('R','E'): | 273 | if (ret == 1) |
149 | if (buffer) kfree(buffer); | 274 | return retnamlen; /* If 0, this file did not have a NM field */ |
150 | return -1; | 275 | out: |
151 | default: | 276 | kfree(rs.buffer); |
152 | break; | 277 | return ret; |
153 | } | 278 | eio: |
154 | } | 279 | ret = -EIO; |
155 | } | 280 | goto out; |
156 | MAYBE_CONTINUE(repeat,inode); | ||
157 | if (buffer) kfree(buffer); | ||
158 | return retnamlen; /* If 0, this file did not have a NM field */ | ||
159 | out: | ||
160 | if(buffer) kfree(buffer); | ||
161 | return 0; | ||
162 | } | 281 | } |
163 | 282 | ||
164 | static int | 283 | static int |
165 | parse_rock_ridge_inode_internal(struct iso_directory_record *de, | 284 | parse_rock_ridge_inode_internal(struct iso_directory_record *de, |
166 | struct inode *inode, int regard_xa) | 285 | struct inode *inode, int regard_xa) |
167 | { | 286 | { |
168 | int len; | 287 | int symlink_len = 0; |
169 | unsigned char * chr; | 288 | int cnt, sig; |
170 | int symlink_len = 0; | 289 | struct inode *reloc; |
171 | CONTINUE_DECLS; | 290 | struct rock_ridge *rr; |
172 | 291 | int rootflag; | |
173 | if (!ISOFS_SB(inode->i_sb)->s_rock) return 0; | 292 | struct rock_state rs; |
174 | 293 | int ret = 0; | |
175 | SETUP_ROCK_RIDGE(de, chr, len); | 294 | |
176 | if (regard_xa) | 295 | if (!ISOFS_SB(inode->i_sb)->s_rock) |
177 | { | 296 | return 0; |
178 | chr+=14; | 297 | |
179 | len-=14; | 298 | init_rock_state(&rs, inode); |
180 | if (len<0) len=0; | 299 | setup_rock_ridge(de, inode, &rs); |
181 | } | 300 | if (regard_xa) { |
182 | 301 | rs.chr += 14; | |
183 | repeat: | 302 | rs.len -= 14; |
184 | { | 303 | if (rs.len < 0) |
185 | int cnt, sig; | 304 | rs.len = 0; |
186 | struct inode * reloc; | 305 | } |
187 | struct rock_ridge * rr; | 306 | |
188 | int rootflag; | 307 | repeat: |
189 | 308 | while (rs.len > 2) { /* There may be one byte for padding somewhere */ | |
190 | while (len > 2){ /* There may be one byte for padding somewhere */ | 309 | rr = (struct rock_ridge *)rs.chr; |
191 | rr = (struct rock_ridge *) chr; | 310 | if (rr->len < 3) |
192 | if (rr->len < 3) goto out; /* Something got screwed up here */ | 311 | goto out; /* Something got screwed up here */ |
193 | sig = isonum_721(chr); | 312 | sig = isonum_721(rs.chr); |
194 | chr += rr->len; | 313 | if (rock_check_overflow(&rs, sig)) |
195 | len -= rr->len; | 314 | goto eio; |
196 | if (len < 0) goto out; /* corrupted isofs */ | 315 | rs.chr += rr->len; |
197 | 316 | rs.len -= rr->len; | |
198 | switch(sig){ | 317 | if (rs.len < 0) |
318 | goto eio; /* corrupted isofs */ | ||
319 | |||
320 | switch (sig) { | ||
199 | #ifndef CONFIG_ZISOFS /* No flag for SF or ZF */ | 321 | #ifndef CONFIG_ZISOFS /* No flag for SF or ZF */ |
200 | case SIG('R','R'): | 322 | case SIG('R', 'R'): |
201 | if((rr->u.RR.flags[0] & | 323 | if ((rr->u.RR.flags[0] & |
202 | (RR_PX | RR_TF | RR_SL | RR_CL)) == 0) goto out; | 324 | (RR_PX | RR_TF | RR_SL | RR_CL)) == 0) |
203 | break; | 325 | goto out; |
326 | break; | ||
204 | #endif | 327 | #endif |
205 | case SIG('S','P'): | 328 | case SIG('S', 'P'): |
206 | CHECK_SP(goto out); | 329 | if (check_sp(rr, inode)) |
207 | break; | 330 | goto out; |
208 | case SIG('C','E'): | 331 | break; |
209 | CHECK_CE; | 332 | case SIG('C', 'E'): |
210 | break; | 333 | rs.cont_extent = isonum_733(rr->u.CE.extent); |
211 | case SIG('E','R'): | 334 | rs.cont_offset = isonum_733(rr->u.CE.offset); |
212 | ISOFS_SB(inode->i_sb)->s_rock = 1; | 335 | rs.cont_size = isonum_733(rr->u.CE.size); |
213 | printk(KERN_DEBUG "ISO 9660 Extensions: "); | 336 | break; |
214 | { int p; | 337 | case SIG('E', 'R'): |
215 | for(p=0;p<rr->u.ER.len_id;p++) printk("%c",rr->u.ER.data[p]); | 338 | ISOFS_SB(inode->i_sb)->s_rock = 1; |
216 | } | 339 | printk(KERN_DEBUG "ISO 9660 Extensions: "); |
217 | printk("\n"); | 340 | { |
218 | break; | 341 | int p; |
219 | case SIG('P','X'): | 342 | for (p = 0; p < rr->u.ER.len_id; p++) |
220 | inode->i_mode = isonum_733(rr->u.PX.mode); | 343 | printk("%c", rr->u.ER.data[p]); |
221 | inode->i_nlink = isonum_733(rr->u.PX.n_links); | 344 | } |
222 | inode->i_uid = isonum_733(rr->u.PX.uid); | 345 | printk("\n"); |
223 | inode->i_gid = isonum_733(rr->u.PX.gid); | 346 | break; |
224 | break; | 347 | case SIG('P', 'X'): |
225 | case SIG('P','N'): | 348 | inode->i_mode = isonum_733(rr->u.PX.mode); |
226 | { int high, low; | 349 | inode->i_nlink = isonum_733(rr->u.PX.n_links); |
227 | high = isonum_733(rr->u.PN.dev_high); | 350 | inode->i_uid = isonum_733(rr->u.PX.uid); |
228 | low = isonum_733(rr->u.PN.dev_low); | 351 | inode->i_gid = isonum_733(rr->u.PX.gid); |
229 | /* | 352 | break; |
230 | * The Rock Ridge standard specifies that if sizeof(dev_t) <= 4, | 353 | case SIG('P', 'N'): |
231 | * then the high field is unused, and the device number is completely | 354 | { |
232 | * stored in the low field. Some writers may ignore this subtlety, | 355 | int high, low; |
233 | * and as a result we test to see if the entire device number is | 356 | high = isonum_733(rr->u.PN.dev_high); |
234 | * stored in the low field, and use that. | 357 | low = isonum_733(rr->u.PN.dev_low); |
235 | */ | 358 | /* |
236 | if((low & ~0xff) && high == 0) { | 359 | * The Rock Ridge standard specifies that if |
237 | inode->i_rdev = MKDEV(low >> 8, low & 0xff); | 360 | * sizeof(dev_t) <= 4, then the high field is |
238 | } else { | 361 | * unused, and the device number is completely |
239 | inode->i_rdev = MKDEV(high, low); | 362 | * stored in the low field. Some writers may |
240 | } | 363 | * ignore this subtlety, |
241 | } | 364 | * and as a result we test to see if the entire |
242 | break; | 365 | * device number is |
243 | case SIG('T','F'): | 366 | * stored in the low field, and use that. |
244 | /* Some RRIP writers incorrectly place ctime in the TF_CREATE field. | 367 | */ |
245 | Try to handle this correctly for either case. */ | 368 | if ((low & ~0xff) && high == 0) { |
246 | cnt = 0; /* Rock ridge never appears on a High Sierra disk */ | 369 | inode->i_rdev = |
247 | if(rr->u.TF.flags & TF_CREATE) { | 370 | MKDEV(low >> 8, low & 0xff); |
248 | inode->i_ctime.tv_sec = iso_date(rr->u.TF.times[cnt++].time, 0); | 371 | } else { |
249 | inode->i_ctime.tv_nsec = 0; | 372 | inode->i_rdev = |
250 | } | 373 | MKDEV(high, low); |
251 | if(rr->u.TF.flags & TF_MODIFY) { | 374 | } |
252 | inode->i_mtime.tv_sec = iso_date(rr->u.TF.times[cnt++].time, 0); | 375 | } |
253 | inode->i_mtime.tv_nsec = 0; | 376 | break; |
254 | } | 377 | case SIG('T', 'F'): |
255 | if(rr->u.TF.flags & TF_ACCESS) { | 378 | /* |
256 | inode->i_atime.tv_sec = iso_date(rr->u.TF.times[cnt++].time, 0); | 379 | * Some RRIP writers incorrectly place ctime in the |
257 | inode->i_atime.tv_nsec = 0; | 380 | * TF_CREATE field. Try to handle this correctly for |
258 | } | 381 | * either case. |
259 | if(rr->u.TF.flags & TF_ATTRIBUTES) { | 382 | */ |
260 | inode->i_ctime.tv_sec = iso_date(rr->u.TF.times[cnt++].time, 0); | 383 | /* Rock ridge never appears on a High Sierra disk */ |
261 | inode->i_ctime.tv_nsec = 0; | 384 | cnt = 0; |
262 | } | 385 | if (rr->u.TF.flags & TF_CREATE) { |
263 | break; | 386 | inode->i_ctime.tv_sec = |
264 | case SIG('S','L'): | 387 | iso_date(rr->u.TF.times[cnt++].time, |
265 | {int slen; | 388 | 0); |
266 | struct SL_component * slp; | 389 | inode->i_ctime.tv_nsec = 0; |
267 | struct SL_component * oldslp; | 390 | } |
268 | slen = rr->len - 5; | 391 | if (rr->u.TF.flags & TF_MODIFY) { |
269 | slp = &rr->u.SL.link; | 392 | inode->i_mtime.tv_sec = |
270 | inode->i_size = symlink_len; | 393 | iso_date(rr->u.TF.times[cnt++].time, |
271 | while (slen > 1){ | 394 | 0); |
272 | rootflag = 0; | 395 | inode->i_mtime.tv_nsec = 0; |
273 | switch(slp->flags &~1){ | 396 | } |
274 | case 0: | 397 | if (rr->u.TF.flags & TF_ACCESS) { |
275 | inode->i_size += slp->len; | 398 | inode->i_atime.tv_sec = |
276 | break; | 399 | iso_date(rr->u.TF.times[cnt++].time, |
277 | case 2: | 400 | 0); |
278 | inode->i_size += 1; | 401 | inode->i_atime.tv_nsec = 0; |
279 | break; | 402 | } |
280 | case 4: | 403 | if (rr->u.TF.flags & TF_ATTRIBUTES) { |
281 | inode->i_size += 2; | 404 | inode->i_ctime.tv_sec = |
282 | break; | 405 | iso_date(rr->u.TF.times[cnt++].time, |
283 | case 8: | 406 | 0); |
284 | rootflag = 1; | 407 | inode->i_ctime.tv_nsec = 0; |
285 | inode->i_size += 1; | 408 | } |
286 | break; | 409 | break; |
287 | default: | 410 | case SIG('S', 'L'): |
288 | printk("Symlink component flag not implemented\n"); | 411 | { |
289 | } | 412 | int slen; |
290 | slen -= slp->len + 2; | 413 | struct SL_component *slp; |
291 | oldslp = slp; | 414 | struct SL_component *oldslp; |
292 | slp = (struct SL_component *) (((char *) slp) + slp->len + 2); | 415 | slen = rr->len - 5; |
293 | 416 | slp = &rr->u.SL.link; | |
294 | if(slen < 2) { | 417 | inode->i_size = symlink_len; |
295 | if( ((rr->u.SL.flags & 1) != 0) | 418 | while (slen > 1) { |
296 | && ((oldslp->flags & 1) == 0) ) inode->i_size += 1; | 419 | rootflag = 0; |
297 | break; | 420 | switch (slp->flags & ~1) { |
298 | } | 421 | case 0: |
299 | 422 | inode->i_size += | |
300 | /* | 423 | slp->len; |
301 | * If this component record isn't continued, then append a '/'. | 424 | break; |
302 | */ | 425 | case 2: |
303 | if (!rootflag && (oldslp->flags & 1) == 0) | 426 | inode->i_size += 1; |
304 | inode->i_size += 1; | 427 | break; |
305 | } | 428 | case 4: |
306 | } | 429 | inode->i_size += 2; |
307 | symlink_len = inode->i_size; | 430 | break; |
308 | break; | 431 | case 8: |
309 | case SIG('R','E'): | 432 | rootflag = 1; |
310 | printk(KERN_WARNING "Attempt to read inode for relocated directory\n"); | 433 | inode->i_size += 1; |
311 | goto out; | 434 | break; |
312 | case SIG('C','L'): | 435 | default: |
313 | ISOFS_I(inode)->i_first_extent = isonum_733(rr->u.CL.location); | 436 | printk("Symlink component flag " |
314 | reloc = isofs_iget(inode->i_sb, ISOFS_I(inode)->i_first_extent, 0); | 437 | "not implemented\n"); |
315 | if (!reloc) | 438 | } |
316 | goto out; | 439 | slen -= slp->len + 2; |
317 | inode->i_mode = reloc->i_mode; | 440 | oldslp = slp; |
318 | inode->i_nlink = reloc->i_nlink; | 441 | slp = (struct SL_component *) |
319 | inode->i_uid = reloc->i_uid; | 442 | (((char *)slp) + slp->len + 2); |
320 | inode->i_gid = reloc->i_gid; | 443 | |
321 | inode->i_rdev = reloc->i_rdev; | 444 | if (slen < 2) { |
322 | inode->i_size = reloc->i_size; | 445 | if (((rr->u.SL. |
323 | inode->i_blocks = reloc->i_blocks; | 446 | flags & 1) != 0) |
324 | inode->i_atime = reloc->i_atime; | 447 | && |
325 | inode->i_ctime = reloc->i_ctime; | 448 | ((oldslp-> |
326 | inode->i_mtime = reloc->i_mtime; | 449 | flags & 1) == 0)) |
327 | iput(reloc); | 450 | inode->i_size += |
328 | break; | 451 | 1; |
452 | break; | ||
453 | } | ||
454 | |||
455 | /* | ||
456 | * If this component record isn't | ||
457 | * continued, then append a '/'. | ||
458 | */ | ||
459 | if (!rootflag | ||
460 | && (oldslp->flags & 1) == 0) | ||
461 | inode->i_size += 1; | ||
462 | } | ||
463 | } | ||
464 | symlink_len = inode->i_size; | ||
465 | break; | ||
466 | case SIG('R', 'E'): | ||
467 | printk(KERN_WARNING "Attempt to read inode for " | ||
468 | "relocated directory\n"); | ||
469 | goto out; | ||
470 | case SIG('C', 'L'): | ||
471 | ISOFS_I(inode)->i_first_extent = | ||
472 | isonum_733(rr->u.CL.location); | ||
473 | reloc = | ||
474 | isofs_iget(inode->i_sb, | ||
475 | ISOFS_I(inode)->i_first_extent, | ||
476 | 0); | ||
477 | if (!reloc) | ||
478 | goto out; | ||
479 | inode->i_mode = reloc->i_mode; | ||
480 | inode->i_nlink = reloc->i_nlink; | ||
481 | inode->i_uid = reloc->i_uid; | ||
482 | inode->i_gid = reloc->i_gid; | ||
483 | inode->i_rdev = reloc->i_rdev; | ||
484 | inode->i_size = reloc->i_size; | ||
485 | inode->i_blocks = reloc->i_blocks; | ||
486 | inode->i_atime = reloc->i_atime; | ||
487 | inode->i_ctime = reloc->i_ctime; | ||
488 | inode->i_mtime = reloc->i_mtime; | ||
489 | iput(reloc); | ||
490 | break; | ||
329 | #ifdef CONFIG_ZISOFS | 491 | #ifdef CONFIG_ZISOFS |
330 | case SIG('Z','F'): | 492 | case SIG('Z', 'F'): { |
331 | if ( !ISOFS_SB(inode->i_sb)->s_nocompress ) { | 493 | int algo; |
332 | int algo; | 494 | |
333 | algo = isonum_721(rr->u.ZF.algorithm); | 495 | if (ISOFS_SB(inode->i_sb)->s_nocompress) |
334 | if ( algo == SIG('p','z') ) { | 496 | break; |
335 | int block_shift = isonum_711(&rr->u.ZF.parms[1]); | 497 | algo = isonum_721(rr->u.ZF.algorithm); |
336 | if ( block_shift < PAGE_CACHE_SHIFT || block_shift > 17 ) { | 498 | if (algo == SIG('p', 'z')) { |
337 | printk(KERN_WARNING "isofs: Can't handle ZF block size of 2^%d\n", block_shift); | 499 | int block_shift = |
338 | } else { | 500 | isonum_711(&rr->u.ZF.parms[1]); |
339 | /* Note: we don't change i_blocks here */ | 501 | if (block_shift < PAGE_CACHE_SHIFT |
340 | ISOFS_I(inode)->i_file_format = isofs_file_compressed; | 502 | || block_shift > 17) { |
341 | /* Parameters to compression algorithm (header size, block size) */ | 503 | printk(KERN_WARNING "isofs: " |
342 | ISOFS_I(inode)->i_format_parm[0] = isonum_711(&rr->u.ZF.parms[0]); | 504 | "Can't handle ZF block " |
343 | ISOFS_I(inode)->i_format_parm[1] = isonum_711(&rr->u.ZF.parms[1]); | 505 | "size of 2^%d\n", |
344 | inode->i_size = isonum_733(rr->u.ZF.real_size); | 506 | block_shift); |
345 | } | 507 | } else { |
346 | } else { | 508 | /* |
347 | printk(KERN_WARNING "isofs: Unknown ZF compression algorithm: %c%c\n", | 509 | * Note: we don't change |
348 | rr->u.ZF.algorithm[0], rr->u.ZF.algorithm[1]); | 510 | * i_blocks here |
349 | } | 511 | */ |
350 | } | 512 | ISOFS_I(inode)->i_file_format = |
351 | break; | 513 | isofs_file_compressed; |
514 | /* | ||
515 | * Parameters to compression | ||
516 | * algorithm (header size, | ||
517 | * block size) | ||
518 | */ | ||
519 | ISOFS_I(inode)->i_format_parm[0] = | ||
520 | isonum_711(&rr->u.ZF.parms[0]); | ||
521 | ISOFS_I(inode)->i_format_parm[1] = | ||
522 | isonum_711(&rr->u.ZF.parms[1]); | ||
523 | inode->i_size = | ||
524 | isonum_733(rr->u.ZF. | ||
525 | real_size); | ||
526 | } | ||
527 | } else { | ||
528 | printk(KERN_WARNING | ||
529 | "isofs: Unknown ZF compression " | ||
530 | "algorithm: %c%c\n", | ||
531 | rr->u.ZF.algorithm[0], | ||
532 | rr->u.ZF.algorithm[1]); | ||
533 | } | ||
534 | break; | ||
535 | } | ||
352 | #endif | 536 | #endif |
353 | default: | 537 | default: |
354 | break; | 538 | break; |
355 | } | 539 | } |
356 | } | 540 | } |
357 | } | 541 | ret = rock_continue(&rs); |
358 | MAYBE_CONTINUE(repeat,inode); | 542 | if (ret == 0) |
359 | out: | 543 | goto repeat; |
360 | if(buffer) kfree(buffer); | 544 | if (ret == 1) |
361 | return 0; | 545 | ret = 0; |
546 | out: | ||
547 | kfree(rs.buffer); | ||
548 | return ret; | ||
549 | eio: | ||
550 | ret = -EIO; | ||
551 | goto out; | ||
362 | } | 552 | } |
363 | 553 | ||
364 | static char *get_symlink_chunk(char *rpnt, struct rock_ridge *rr, char *plimit) | 554 | static char *get_symlink_chunk(char *rpnt, struct rock_ridge *rr, char *plimit) |
@@ -376,32 +566,32 @@ static char *get_symlink_chunk(char *rpnt, struct rock_ridge *rr, char *plimit) | |||
376 | if (slp->len > plimit - rpnt) | 566 | if (slp->len > plimit - rpnt) |
377 | return NULL; | 567 | return NULL; |
378 | memcpy(rpnt, slp->text, slp->len); | 568 | memcpy(rpnt, slp->text, slp->len); |
379 | rpnt+=slp->len; | 569 | rpnt += slp->len; |
380 | break; | 570 | break; |
381 | case 2: | 571 | case 2: |
382 | if (rpnt >= plimit) | 572 | if (rpnt >= plimit) |
383 | return NULL; | 573 | return NULL; |
384 | *rpnt++='.'; | 574 | *rpnt++ = '.'; |
385 | break; | 575 | break; |
386 | case 4: | 576 | case 4: |
387 | if (2 > plimit - rpnt) | 577 | if (2 > plimit - rpnt) |
388 | return NULL; | 578 | return NULL; |
389 | *rpnt++='.'; | 579 | *rpnt++ = '.'; |
390 | *rpnt++='.'; | 580 | *rpnt++ = '.'; |
391 | break; | 581 | break; |
392 | case 8: | 582 | case 8: |
393 | if (rpnt >= plimit) | 583 | if (rpnt >= plimit) |
394 | return NULL; | 584 | return NULL; |
395 | rootflag = 1; | 585 | rootflag = 1; |
396 | *rpnt++='/'; | 586 | *rpnt++ = '/'; |
397 | break; | 587 | break; |
398 | default: | 588 | default: |
399 | printk("Symlink component flag not implemented (%d)\n", | 589 | printk("Symlink component flag not implemented (%d)\n", |
400 | slp->flags); | 590 | slp->flags); |
401 | } | 591 | } |
402 | slen -= slp->len + 2; | 592 | slen -= slp->len + 2; |
403 | oldslp = slp; | 593 | oldslp = slp; |
404 | slp = (struct SL_component *) ((char *) slp + slp->len + 2); | 594 | slp = (struct SL_component *)((char *)slp + slp->len + 2); |
405 | 595 | ||
406 | if (slen < 2) { | 596 | if (slen < 2) { |
407 | /* | 597 | /* |
@@ -412,7 +602,7 @@ static char *get_symlink_chunk(char *rpnt, struct rock_ridge *rr, char *plimit) | |||
412 | !(oldslp->flags & 1)) { | 602 | !(oldslp->flags & 1)) { |
413 | if (rpnt >= plimit) | 603 | if (rpnt >= plimit) |
414 | return NULL; | 604 | return NULL; |
415 | *rpnt++='/'; | 605 | *rpnt++ = '/'; |
416 | } | 606 | } |
417 | break; | 607 | break; |
418 | } | 608 | } |
@@ -423,59 +613,61 @@ static char *get_symlink_chunk(char *rpnt, struct rock_ridge *rr, char *plimit) | |||
423 | if (!rootflag && !(oldslp->flags & 1)) { | 613 | if (!rootflag && !(oldslp->flags & 1)) { |
424 | if (rpnt >= plimit) | 614 | if (rpnt >= plimit) |
425 | return NULL; | 615 | return NULL; |
426 | *rpnt++='/'; | 616 | *rpnt++ = '/'; |
427 | } | 617 | } |
428 | } | 618 | } |
429 | return rpnt; | 619 | return rpnt; |
430 | } | 620 | } |
431 | 621 | ||
432 | int parse_rock_ridge_inode(struct iso_directory_record * de, | 622 | int parse_rock_ridge_inode(struct iso_directory_record *de, struct inode *inode) |
433 | struct inode * inode) | ||
434 | { | 623 | { |
435 | int result=parse_rock_ridge_inode_internal(de,inode,0); | 624 | int result = parse_rock_ridge_inode_internal(de, inode, 0); |
436 | /* if rockridge flag was reset and we didn't look for attributes | ||
437 | * behind eventual XA attributes, have a look there */ | ||
438 | if ((ISOFS_SB(inode->i_sb)->s_rock_offset==-1) | ||
439 | &&(ISOFS_SB(inode->i_sb)->s_rock==2)) | ||
440 | { | ||
441 | result=parse_rock_ridge_inode_internal(de,inode,14); | ||
442 | } | ||
443 | return result; | ||
444 | } | ||
445 | 625 | ||
446 | /* readpage() for symlinks: reads symlink contents into the page and either | 626 | /* |
447 | makes it uptodate and returns 0 or returns error (-EIO) */ | 627 | * if rockridge flag was reset and we didn't look for attributes |
628 | * behind eventual XA attributes, have a look there | ||
629 | */ | ||
630 | if ((ISOFS_SB(inode->i_sb)->s_rock_offset == -1) | ||
631 | && (ISOFS_SB(inode->i_sb)->s_rock == 2)) { | ||
632 | result = parse_rock_ridge_inode_internal(de, inode, 14); | ||
633 | } | ||
634 | return result; | ||
635 | } | ||
448 | 636 | ||
637 | /* | ||
638 | * readpage() for symlinks: reads symlink contents into the page and either | ||
639 | * makes it uptodate and returns 0 or returns error (-EIO) | ||
640 | */ | ||
449 | static int rock_ridge_symlink_readpage(struct file *file, struct page *page) | 641 | static int rock_ridge_symlink_readpage(struct file *file, struct page *page) |
450 | { | 642 | { |
451 | struct inode *inode = page->mapping->host; | 643 | struct inode *inode = page->mapping->host; |
452 | struct iso_inode_info *ei = ISOFS_I(inode); | 644 | struct iso_inode_info *ei = ISOFS_I(inode); |
453 | char *link = kmap(page); | 645 | char *link = kmap(page); |
454 | unsigned long bufsize = ISOFS_BUFFER_SIZE(inode); | 646 | unsigned long bufsize = ISOFS_BUFFER_SIZE(inode); |
455 | struct buffer_head *bh; | 647 | struct buffer_head *bh; |
456 | char *rpnt = link; | 648 | char *rpnt = link; |
457 | unsigned char *pnt; | 649 | unsigned char *pnt; |
458 | struct iso_directory_record *raw_inode; | 650 | struct iso_directory_record *raw_de; |
459 | CONTINUE_DECLS; | ||
460 | unsigned long block, offset; | 651 | unsigned long block, offset; |
461 | int sig; | 652 | int sig; |
462 | int len; | ||
463 | unsigned char *chr; | ||
464 | struct rock_ridge *rr; | 653 | struct rock_ridge *rr; |
654 | struct rock_state rs; | ||
655 | int ret; | ||
465 | 656 | ||
466 | if (!ISOFS_SB(inode->i_sb)->s_rock) | 657 | if (!ISOFS_SB(inode->i_sb)->s_rock) |
467 | goto error; | 658 | goto error; |
468 | 659 | ||
660 | init_rock_state(&rs, inode); | ||
469 | block = ei->i_iget5_block; | 661 | block = ei->i_iget5_block; |
470 | lock_kernel(); | 662 | lock_kernel(); |
471 | bh = sb_bread(inode->i_sb, block); | 663 | bh = sb_bread(inode->i_sb, block); |
472 | if (!bh) | 664 | if (!bh) |
473 | goto out_noread; | 665 | goto out_noread; |
474 | 666 | ||
475 | offset = ei->i_iget5_offset; | 667 | offset = ei->i_iget5_offset; |
476 | pnt = (unsigned char *) bh->b_data + offset; | 668 | pnt = (unsigned char *)bh->b_data + offset; |
477 | 669 | ||
478 | raw_inode = (struct iso_directory_record *) pnt; | 670 | raw_de = (struct iso_directory_record *)pnt; |
479 | 671 | ||
480 | /* | 672 | /* |
481 | * If we go past the end of the buffer, there is some sort of error. | 673 | * If we go past the end of the buffer, there is some sort of error. |
@@ -483,20 +675,24 @@ static int rock_ridge_symlink_readpage(struct file *file, struct page *page) | |||
483 | if (offset + *pnt > bufsize) | 675 | if (offset + *pnt > bufsize) |
484 | goto out_bad_span; | 676 | goto out_bad_span; |
485 | 677 | ||
486 | /* Now test for possible Rock Ridge extensions which will override | 678 | /* |
487 | some of these numbers in the inode structure. */ | 679 | * Now test for possible Rock Ridge extensions which will override |
680 | * some of these numbers in the inode structure. | ||
681 | */ | ||
488 | 682 | ||
489 | SETUP_ROCK_RIDGE(raw_inode, chr, len); | 683 | setup_rock_ridge(raw_de, inode, &rs); |
490 | 684 | ||
491 | repeat: | 685 | repeat: |
492 | while (len > 2) { /* There may be one byte for padding somewhere */ | 686 | while (rs.len > 2) { /* There may be one byte for padding somewhere */ |
493 | rr = (struct rock_ridge *) chr; | 687 | rr = (struct rock_ridge *)rs.chr; |
494 | if (rr->len < 3) | 688 | if (rr->len < 3) |
495 | goto out; /* Something got screwed up here */ | 689 | goto out; /* Something got screwed up here */ |
496 | sig = isonum_721(chr); | 690 | sig = isonum_721(rs.chr); |
497 | chr += rr->len; | 691 | if (rock_check_overflow(&rs, sig)) |
498 | len -= rr->len; | 692 | goto out; |
499 | if (len < 0) | 693 | rs.chr += rr->len; |
694 | rs.len -= rr->len; | ||
695 | if (rs.len < 0) | ||
500 | goto out; /* corrupted isofs */ | 696 | goto out; /* corrupted isofs */ |
501 | 697 | ||
502 | switch (sig) { | 698 | switch (sig) { |
@@ -505,7 +701,8 @@ static int rock_ridge_symlink_readpage(struct file *file, struct page *page) | |||
505 | goto out; | 701 | goto out; |
506 | break; | 702 | break; |
507 | case SIG('S', 'P'): | 703 | case SIG('S', 'P'): |
508 | CHECK_SP(goto out); | 704 | if (check_sp(rr, inode)) |
705 | goto out; | ||
509 | break; | 706 | break; |
510 | case SIG('S', 'L'): | 707 | case SIG('S', 'L'): |
511 | rpnt = get_symlink_chunk(rpnt, rr, | 708 | rpnt = get_symlink_chunk(rpnt, rr, |
@@ -515,14 +712,18 @@ static int rock_ridge_symlink_readpage(struct file *file, struct page *page) | |||
515 | break; | 712 | break; |
516 | case SIG('C', 'E'): | 713 | case SIG('C', 'E'): |
517 | /* This tells is if there is a continuation record */ | 714 | /* This tells is if there is a continuation record */ |
518 | CHECK_CE; | 715 | rs.cont_extent = isonum_733(rr->u.CE.extent); |
716 | rs.cont_offset = isonum_733(rr->u.CE.offset); | ||
717 | rs.cont_size = isonum_733(rr->u.CE.size); | ||
519 | default: | 718 | default: |
520 | break; | 719 | break; |
521 | } | 720 | } |
522 | } | 721 | } |
523 | MAYBE_CONTINUE(repeat, inode); | 722 | ret = rock_continue(&rs); |
524 | if (buffer) | 723 | if (ret == 0) |
525 | kfree(buffer); | 724 | goto repeat; |
725 | if (ret < 0) | ||
726 | goto fail; | ||
526 | 727 | ||
527 | if (rpnt == link) | 728 | if (rpnt == link) |
528 | goto fail; | 729 | goto fail; |
@@ -535,19 +736,18 @@ static int rock_ridge_symlink_readpage(struct file *file, struct page *page) | |||
535 | return 0; | 736 | return 0; |
536 | 737 | ||
537 | /* error exit from macro */ | 738 | /* error exit from macro */ |
538 | out: | 739 | out: |
539 | if (buffer) | 740 | kfree(rs.buffer); |
540 | kfree(buffer); | ||
541 | goto fail; | 741 | goto fail; |
542 | out_noread: | 742 | out_noread: |
543 | printk("unable to read i-node block"); | 743 | printk("unable to read i-node block"); |
544 | goto fail; | 744 | goto fail; |
545 | out_bad_span: | 745 | out_bad_span: |
546 | printk("symlink spans iso9660 blocks\n"); | 746 | printk("symlink spans iso9660 blocks\n"); |
547 | fail: | 747 | fail: |
548 | brelse(bh); | 748 | brelse(bh); |
549 | unlock_kernel(); | 749 | unlock_kernel(); |
550 | error: | 750 | error: |
551 | SetPageError(page); | 751 | SetPageError(page); |
552 | kunmap(page); | 752 | kunmap(page); |
553 | unlock_page(page); | 753 | unlock_page(page); |
@@ -555,5 +755,5 @@ static int rock_ridge_symlink_readpage(struct file *file, struct page *page) | |||
555 | } | 755 | } |
556 | 756 | ||
557 | struct address_space_operations isofs_symlink_aops = { | 757 | struct address_space_operations isofs_symlink_aops = { |
558 | .readpage = rock_ridge_symlink_readpage | 758 | .readpage = rock_ridge_symlink_readpage |
559 | }; | 759 | }; |
diff --git a/fs/isofs/rock.h b/fs/isofs/rock.h index deaf5c8e8b4a..ed09e2b08637 100644 --- a/fs/isofs/rock.h +++ b/fs/isofs/rock.h | |||
@@ -1,85 +1,88 @@ | |||
1 | /* These structs are used by the system-use-sharing protocol, in which the | 1 | /* |
2 | Rock Ridge extensions are embedded. It is quite possible that other | 2 | * These structs are used by the system-use-sharing protocol, in which the |
3 | extensions are present on the disk, and this is fine as long as they | 3 | * Rock Ridge extensions are embedded. It is quite possible that other |
4 | all use SUSP */ | 4 | * extensions are present on the disk, and this is fine as long as they |
5 | 5 | * all use SUSP | |
6 | struct SU_SP{ | 6 | */ |
7 | unsigned char magic[2]; | 7 | |
8 | unsigned char skip; | 8 | struct SU_SP_s { |
9 | } __attribute__((packed)); | 9 | unsigned char magic[2]; |
10 | 10 | unsigned char skip; | |
11 | struct SU_CE{ | 11 | } __attribute__ ((packed)); |
12 | char extent[8]; | 12 | |
13 | char offset[8]; | 13 | struct SU_CE_s { |
14 | char size[8]; | 14 | char extent[8]; |
15 | char offset[8]; | ||
16 | char size[8]; | ||
15 | }; | 17 | }; |
16 | 18 | ||
17 | struct SU_ER{ | 19 | struct SU_ER_s { |
18 | unsigned char len_id; | 20 | unsigned char len_id; |
19 | unsigned char len_des; | 21 | unsigned char len_des; |
20 | unsigned char len_src; | 22 | unsigned char len_src; |
21 | unsigned char ext_ver; | 23 | unsigned char ext_ver; |
22 | char data[0]; | 24 | char data[0]; |
23 | } __attribute__((packed)); | 25 | } __attribute__ ((packed)); |
24 | 26 | ||
25 | struct RR_RR{ | 27 | struct RR_RR_s { |
26 | char flags[1]; | 28 | char flags[1]; |
27 | } __attribute__((packed)); | 29 | } __attribute__ ((packed)); |
28 | 30 | ||
29 | struct RR_PX{ | 31 | struct RR_PX_s { |
30 | char mode[8]; | 32 | char mode[8]; |
31 | char n_links[8]; | 33 | char n_links[8]; |
32 | char uid[8]; | 34 | char uid[8]; |
33 | char gid[8]; | 35 | char gid[8]; |
34 | }; | 36 | }; |
35 | 37 | ||
36 | struct RR_PN{ | 38 | struct RR_PN_s { |
37 | char dev_high[8]; | 39 | char dev_high[8]; |
38 | char dev_low[8]; | 40 | char dev_low[8]; |
39 | }; | 41 | }; |
40 | 42 | ||
43 | struct SL_component { | ||
44 | unsigned char flags; | ||
45 | unsigned char len; | ||
46 | char text[0]; | ||
47 | } __attribute__ ((packed)); | ||
41 | 48 | ||
42 | struct SL_component{ | 49 | struct RR_SL_s { |
43 | unsigned char flags; | 50 | unsigned char flags; |
44 | unsigned char len; | 51 | struct SL_component link; |
45 | char text[0]; | 52 | } __attribute__ ((packed)); |
46 | } __attribute__((packed)); | ||
47 | 53 | ||
48 | struct RR_SL{ | 54 | struct RR_NM_s { |
49 | unsigned char flags; | 55 | unsigned char flags; |
50 | struct SL_component link; | 56 | char name[0]; |
51 | } __attribute__((packed)); | 57 | } __attribute__ ((packed)); |
52 | 58 | ||
53 | struct RR_NM{ | 59 | struct RR_CL_s { |
54 | unsigned char flags; | 60 | char location[8]; |
55 | char name[0]; | ||
56 | } __attribute__((packed)); | ||
57 | |||
58 | struct RR_CL{ | ||
59 | char location[8]; | ||
60 | }; | 61 | }; |
61 | 62 | ||
62 | struct RR_PL{ | 63 | struct RR_PL_s { |
63 | char location[8]; | 64 | char location[8]; |
64 | }; | 65 | }; |
65 | 66 | ||
66 | struct stamp{ | 67 | struct stamp { |
67 | char time[7]; | 68 | char time[7]; |
68 | } __attribute__((packed)); | 69 | } __attribute__ ((packed)); |
69 | 70 | ||
70 | struct RR_TF{ | 71 | struct RR_TF_s { |
71 | char flags; | 72 | char flags; |
72 | struct stamp times[0]; /* Variable number of these beasts */ | 73 | struct stamp times[0]; /* Variable number of these beasts */ |
73 | } __attribute__((packed)); | 74 | } __attribute__ ((packed)); |
74 | 75 | ||
75 | /* Linux-specific extension for transparent decompression */ | 76 | /* Linux-specific extension for transparent decompression */ |
76 | struct RR_ZF{ | 77 | struct RR_ZF_s { |
77 | char algorithm[2]; | 78 | char algorithm[2]; |
78 | char parms[2]; | 79 | char parms[2]; |
79 | char real_size[8]; | 80 | char real_size[8]; |
80 | }; | 81 | }; |
81 | 82 | ||
82 | /* These are the bits and their meanings for flags in the TF structure. */ | 83 | /* |
84 | * These are the bits and their meanings for flags in the TF structure. | ||
85 | */ | ||
83 | #define TF_CREATE 1 | 86 | #define TF_CREATE 1 |
84 | #define TF_MODIFY 2 | 87 | #define TF_MODIFY 2 |
85 | #define TF_ACCESS 4 | 88 | #define TF_ACCESS 4 |
@@ -89,31 +92,31 @@ struct RR_ZF{ | |||
89 | #define TF_EFFECTIVE 64 | 92 | #define TF_EFFECTIVE 64 |
90 | #define TF_LONG_FORM 128 | 93 | #define TF_LONG_FORM 128 |
91 | 94 | ||
92 | struct rock_ridge{ | 95 | struct rock_ridge { |
93 | char signature[2]; | 96 | char signature[2]; |
94 | unsigned char len; | 97 | unsigned char len; |
95 | unsigned char version; | 98 | unsigned char version; |
96 | union{ | 99 | union { |
97 | struct SU_SP SP; | 100 | struct SU_SP_s SP; |
98 | struct SU_CE CE; | 101 | struct SU_CE_s CE; |
99 | struct SU_ER ER; | 102 | struct SU_ER_s ER; |
100 | struct RR_RR RR; | 103 | struct RR_RR_s RR; |
101 | struct RR_PX PX; | 104 | struct RR_PX_s PX; |
102 | struct RR_PN PN; | 105 | struct RR_PN_s PN; |
103 | struct RR_SL SL; | 106 | struct RR_SL_s SL; |
104 | struct RR_NM NM; | 107 | struct RR_NM_s NM; |
105 | struct RR_CL CL; | 108 | struct RR_CL_s CL; |
106 | struct RR_PL PL; | 109 | struct RR_PL_s PL; |
107 | struct RR_TF TF; | 110 | struct RR_TF_s TF; |
108 | struct RR_ZF ZF; | 111 | struct RR_ZF_s ZF; |
109 | } u; | 112 | } u; |
110 | }; | 113 | }; |
111 | 114 | ||
112 | #define RR_PX 1 /* POSIX attributes */ | 115 | #define RR_PX 1 /* POSIX attributes */ |
113 | #define RR_PN 2 /* POSIX devices */ | 116 | #define RR_PN 2 /* POSIX devices */ |
114 | #define RR_SL 4 /* Symbolic link */ | 117 | #define RR_SL 4 /* Symbolic link */ |
115 | #define RR_NM 8 /* Alternate Name */ | 118 | #define RR_NM 8 /* Alternate Name */ |
116 | #define RR_CL 16 /* Child link */ | 119 | #define RR_CL 16 /* Child link */ |
117 | #define RR_PL 32 /* Parent link */ | 120 | #define RR_PL 32 /* Parent link */ |
118 | #define RR_RE 64 /* Relocation directory */ | 121 | #define RR_RE 64 /* Relocation directory */ |
119 | #define RR_TF 128 /* Timestamps */ | 122 | #define RR_TF 128 /* Timestamps */ |
diff --git a/fs/jfs/acl.c b/fs/jfs/acl.c index 8d2a9ab981d4..30a2bf9eeda5 100644 --- a/fs/jfs/acl.c +++ b/fs/jfs/acl.c | |||
@@ -70,8 +70,7 @@ static struct posix_acl *jfs_get_acl(struct inode *inode, int type) | |||
70 | if (!IS_ERR(acl)) | 70 | if (!IS_ERR(acl)) |
71 | *p_acl = posix_acl_dup(acl); | 71 | *p_acl = posix_acl_dup(acl); |
72 | } | 72 | } |
73 | if (value) | 73 | kfree(value); |
74 | kfree(value); | ||
75 | return acl; | 74 | return acl; |
76 | } | 75 | } |
77 | 76 | ||
@@ -112,8 +111,7 @@ static int jfs_set_acl(struct inode *inode, int type, struct posix_acl *acl) | |||
112 | } | 111 | } |
113 | rc = __jfs_setxattr(inode, ea_name, value, size, 0); | 112 | rc = __jfs_setxattr(inode, ea_name, value, size, 0); |
114 | out: | 113 | out: |
115 | if (value) | 114 | kfree(value); |
116 | kfree(value); | ||
117 | 115 | ||
118 | if (!rc) { | 116 | if (!rc) { |
119 | if (*p_acl && (*p_acl != JFS_ACL_NOT_CACHED)) | 117 | if (*p_acl && (*p_acl != JFS_ACL_NOT_CACHED)) |
diff --git a/fs/jfs/file.c b/fs/jfs/file.c index a87b06fa8ff8..c2c19c9ed9a4 100644 --- a/fs/jfs/file.c +++ b/fs/jfs/file.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) International Business Machines Corp., 2000-2002 | 2 | * Copyright (C) International Business Machines Corp., 2000-2002 |
3 | * Portions Copyright (c) Christoph Hellwig, 2001-2002 | 3 | * Portions Copyright (C) Christoph Hellwig, 2001-2002 |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
@@ -19,16 +19,13 @@ | |||
19 | 19 | ||
20 | #include <linux/fs.h> | 20 | #include <linux/fs.h> |
21 | #include "jfs_incore.h" | 21 | #include "jfs_incore.h" |
22 | #include "jfs_inode.h" | ||
22 | #include "jfs_dmap.h" | 23 | #include "jfs_dmap.h" |
23 | #include "jfs_txnmgr.h" | 24 | #include "jfs_txnmgr.h" |
24 | #include "jfs_xattr.h" | 25 | #include "jfs_xattr.h" |
25 | #include "jfs_acl.h" | 26 | #include "jfs_acl.h" |
26 | #include "jfs_debug.h" | 27 | #include "jfs_debug.h" |
27 | 28 | ||
28 | |||
29 | extern int jfs_commit_inode(struct inode *, int); | ||
30 | extern void jfs_truncate(struct inode *); | ||
31 | |||
32 | int jfs_fsync(struct file *file, struct dentry *dentry, int datasync) | 29 | int jfs_fsync(struct file *file, struct dentry *dentry, int datasync) |
33 | { | 30 | { |
34 | struct inode *inode = dentry->d_inode; | 31 | struct inode *inode = dentry->d_inode; |
diff --git a/fs/jfs/inode.c b/fs/jfs/inode.c index 24a689179af2..2137138c59b0 100644 --- a/fs/jfs/inode.c +++ b/fs/jfs/inode.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/pagemap.h> | 23 | #include <linux/pagemap.h> |
24 | #include <linux/quotaops.h> | 24 | #include <linux/quotaops.h> |
25 | #include "jfs_incore.h" | 25 | #include "jfs_incore.h" |
26 | #include "jfs_inode.h" | ||
26 | #include "jfs_filsys.h" | 27 | #include "jfs_filsys.h" |
27 | #include "jfs_imap.h" | 28 | #include "jfs_imap.h" |
28 | #include "jfs_extent.h" | 29 | #include "jfs_extent.h" |
@@ -30,14 +31,6 @@ | |||
30 | #include "jfs_debug.h" | 31 | #include "jfs_debug.h" |
31 | 32 | ||
32 | 33 | ||
33 | extern struct inode_operations jfs_dir_inode_operations; | ||
34 | extern struct inode_operations jfs_file_inode_operations; | ||
35 | extern struct inode_operations jfs_symlink_inode_operations; | ||
36 | extern struct file_operations jfs_dir_operations; | ||
37 | extern struct file_operations jfs_file_operations; | ||
38 | struct address_space_operations jfs_aops; | ||
39 | extern int freeZeroLink(struct inode *); | ||
40 | |||
41 | void jfs_read_inode(struct inode *inode) | 34 | void jfs_read_inode(struct inode *inode) |
42 | { | 35 | { |
43 | if (diRead(inode)) { | 36 | if (diRead(inode)) { |
@@ -136,7 +129,7 @@ void jfs_delete_inode(struct inode *inode) | |||
136 | jfs_info("In jfs_delete_inode, inode = 0x%p", inode); | 129 | jfs_info("In jfs_delete_inode, inode = 0x%p", inode); |
137 | 130 | ||
138 | if (test_cflag(COMMIT_Freewmap, inode)) | 131 | if (test_cflag(COMMIT_Freewmap, inode)) |
139 | freeZeroLink(inode); | 132 | jfs_free_zero_link(inode); |
140 | 133 | ||
141 | diFree(inode); | 134 | diFree(inode); |
142 | 135 | ||
diff --git a/fs/jfs/jfs_debug.c b/fs/jfs/jfs_debug.c index 91a0a889ebc5..4caea6b43b92 100644 --- a/fs/jfs/jfs_debug.c +++ b/fs/jfs/jfs_debug.c | |||
@@ -58,8 +58,6 @@ void dump_mem(char *label, void *data, int length) | |||
58 | 58 | ||
59 | static struct proc_dir_entry *base; | 59 | static struct proc_dir_entry *base; |
60 | #ifdef CONFIG_JFS_DEBUG | 60 | #ifdef CONFIG_JFS_DEBUG |
61 | extern read_proc_t jfs_txanchor_read; | ||
62 | |||
63 | static int loglevel_read(char *page, char **start, off_t off, | 61 | static int loglevel_read(char *page, char **start, off_t off, |
64 | int count, int *eof, void *data) | 62 | int count, int *eof, void *data) |
65 | { | 63 | { |
@@ -97,14 +95,6 @@ static int loglevel_write(struct file *file, const char __user *buffer, | |||
97 | } | 95 | } |
98 | #endif | 96 | #endif |
99 | 97 | ||
100 | |||
101 | #ifdef CONFIG_JFS_STATISTICS | ||
102 | extern read_proc_t jfs_lmstats_read; | ||
103 | extern read_proc_t jfs_txstats_read; | ||
104 | extern read_proc_t jfs_xtstat_read; | ||
105 | extern read_proc_t jfs_mpstat_read; | ||
106 | #endif | ||
107 | |||
108 | static struct { | 98 | static struct { |
109 | const char *name; | 99 | const char *name; |
110 | read_proc_t *read_fn; | 100 | read_proc_t *read_fn; |
diff --git a/fs/jfs/jfs_debug.h b/fs/jfs/jfs_debug.h index a38079ae1e00..ddffbbd4d955 100644 --- a/fs/jfs/jfs_debug.h +++ b/fs/jfs/jfs_debug.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) International Business Machines Corp., 2000-2002 | 2 | * Copyright (C) International Business Machines Corp., 2000-2002 |
3 | * Portions Copyright (c) Christoph Hellwig, 2001-2002 | 3 | * Portions Copyright (C) Christoph Hellwig, 2001-2002 |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
@@ -31,7 +31,9 @@ | |||
31 | * CONFIG_JFS_DEBUG or CONFIG_JFS_STATISTICS is defined | 31 | * CONFIG_JFS_DEBUG or CONFIG_JFS_STATISTICS is defined |
32 | */ | 32 | */ |
33 | #if defined(CONFIG_PROC_FS) && (defined(CONFIG_JFS_DEBUG) || defined(CONFIG_JFS_STATISTICS)) | 33 | #if defined(CONFIG_PROC_FS) && (defined(CONFIG_JFS_DEBUG) || defined(CONFIG_JFS_STATISTICS)) |
34 | #define PROC_FS_JFS | 34 | #define PROC_FS_JFS |
35 | extern void jfs_proc_init(void); | ||
36 | extern void jfs_proc_clean(void); | ||
35 | #endif | 37 | #endif |
36 | 38 | ||
37 | /* | 39 | /* |
@@ -65,8 +67,8 @@ | |||
65 | 67 | ||
66 | extern int jfsloglevel; | 68 | extern int jfsloglevel; |
67 | 69 | ||
68 | /* dump memory contents */ | ||
69 | extern void dump_mem(char *label, void *data, int length); | 70 | extern void dump_mem(char *label, void *data, int length); |
71 | extern int jfs_txanchor_read(char *, char **, off_t, int, int *, void *); | ||
70 | 72 | ||
71 | /* information message: e.g., configuration, major event */ | 73 | /* information message: e.g., configuration, major event */ |
72 | #define jfs_info(fmt, arg...) do { \ | 74 | #define jfs_info(fmt, arg...) do { \ |
@@ -110,6 +112,11 @@ extern void dump_mem(char *label, void *data, int length); | |||
110 | * ---------- | 112 | * ---------- |
111 | */ | 113 | */ |
112 | #ifdef CONFIG_JFS_STATISTICS | 114 | #ifdef CONFIG_JFS_STATISTICS |
115 | extern int jfs_lmstats_read(char *, char **, off_t, int, int *, void *); | ||
116 | extern int jfs_txstats_read(char *, char **, off_t, int, int *, void *); | ||
117 | extern int jfs_mpstat_read(char *, char **, off_t, int, int *, void *); | ||
118 | extern int jfs_xtstat_read(char *, char **, off_t, int, int *, void *); | ||
119 | |||
113 | #define INCREMENT(x) ((x)++) | 120 | #define INCREMENT(x) ((x)++) |
114 | #define DECREMENT(x) ((x)--) | 121 | #define DECREMENT(x) ((x)--) |
115 | #define HIGHWATERMARK(x,y) ((x) = max((x), (y))) | 122 | #define HIGHWATERMARK(x,y) ((x) = max((x), (y))) |
diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c index 69007fd546ef..cced2fed9d0f 100644 --- a/fs/jfs/jfs_dmap.c +++ b/fs/jfs/jfs_dmap.c | |||
@@ -272,7 +272,6 @@ int dbMount(struct inode *ipbmap) | |||
272 | int dbUnmount(struct inode *ipbmap, int mounterror) | 272 | int dbUnmount(struct inode *ipbmap, int mounterror) |
273 | { | 273 | { |
274 | struct bmap *bmp = JFS_SBI(ipbmap->i_sb)->bmap; | 274 | struct bmap *bmp = JFS_SBI(ipbmap->i_sb)->bmap; |
275 | int i; | ||
276 | 275 | ||
277 | if (!(mounterror || isReadOnly(ipbmap))) | 276 | if (!(mounterror || isReadOnly(ipbmap))) |
278 | dbSync(ipbmap); | 277 | dbSync(ipbmap); |
@@ -282,14 +281,6 @@ int dbUnmount(struct inode *ipbmap, int mounterror) | |||
282 | */ | 281 | */ |
283 | truncate_inode_pages(ipbmap->i_mapping, 0); | 282 | truncate_inode_pages(ipbmap->i_mapping, 0); |
284 | 283 | ||
285 | /* | ||
286 | * Sanity Check | ||
287 | */ | ||
288 | for (i = 0; i < bmp->db_numag; i++) | ||
289 | if (atomic_read(&bmp->db_active[i])) | ||
290 | printk(KERN_ERR "dbUnmount: db_active[%d] = %d\n", | ||
291 | i, atomic_read(&bmp->db_active[i])); | ||
292 | |||
293 | /* free the memory for the in-memory bmap. */ | 284 | /* free the memory for the in-memory bmap. */ |
294 | kfree(bmp); | 285 | kfree(bmp); |
295 | 286 | ||
diff --git a/fs/jfs/jfs_dtree.c b/fs/jfs/jfs_dtree.c index ac41f72d6d50..8676aee3ae48 100644 --- a/fs/jfs/jfs_dtree.c +++ b/fs/jfs/jfs_dtree.c | |||
@@ -2931,6 +2931,9 @@ static void add_missing_indices(struct inode *inode, s64 bn) | |||
2931 | ASSERT(p->header.flag & BT_LEAF); | 2931 | ASSERT(p->header.flag & BT_LEAF); |
2932 | 2932 | ||
2933 | tlck = txLock(tid, inode, mp, tlckDTREE | tlckENTRY); | 2933 | tlck = txLock(tid, inode, mp, tlckDTREE | tlckENTRY); |
2934 | if (BT_IS_ROOT(mp)) | ||
2935 | tlck->type |= tlckBTROOT; | ||
2936 | |||
2934 | dtlck = (struct dt_lock *) &tlck->lock; | 2937 | dtlck = (struct dt_lock *) &tlck->lock; |
2935 | 2938 | ||
2936 | stbl = DT_GETSTBL(p); | 2939 | stbl = DT_GETSTBL(p); |
diff --git a/fs/jfs/jfs_extent.c b/fs/jfs/jfs_extent.c index 1953acb79266..4879603daa1c 100644 --- a/fs/jfs/jfs_extent.c +++ b/fs/jfs/jfs_extent.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/fs.h> | 19 | #include <linux/fs.h> |
20 | #include <linux/quotaops.h> | 20 | #include <linux/quotaops.h> |
21 | #include "jfs_incore.h" | 21 | #include "jfs_incore.h" |
22 | #include "jfs_inode.h" | ||
22 | #include "jfs_superblock.h" | 23 | #include "jfs_superblock.h" |
23 | #include "jfs_dmap.h" | 24 | #include "jfs_dmap.h" |
24 | #include "jfs_extent.h" | 25 | #include "jfs_extent.h" |
@@ -33,12 +34,6 @@ static int extBrealloc(struct inode *, s64, s64, s64 *, s64 *); | |||
33 | #endif | 34 | #endif |
34 | static s64 extRoundDown(s64 nb); | 35 | static s64 extRoundDown(s64 nb); |
35 | 36 | ||
36 | /* | ||
37 | * external references | ||
38 | */ | ||
39 | extern int jfs_commit_inode(struct inode *, int); | ||
40 | |||
41 | |||
42 | #define DPD(a) (printk("(a): %d\n",(a))) | 37 | #define DPD(a) (printk("(a): %d\n",(a))) |
43 | #define DPC(a) (printk("(a): %c\n",(a))) | 38 | #define DPC(a) (printk("(a): %c\n",(a))) |
44 | #define DPL1(a) \ | 39 | #define DPL1(a) \ |
diff --git a/fs/jfs/jfs_imap.c b/fs/jfs/jfs_imap.c index 7acff2ce3c80..971af2977eff 100644 --- a/fs/jfs/jfs_imap.c +++ b/fs/jfs/jfs_imap.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #include <linux/quotaops.h> | 47 | #include <linux/quotaops.h> |
48 | 48 | ||
49 | #include "jfs_incore.h" | 49 | #include "jfs_incore.h" |
50 | #include "jfs_inode.h" | ||
50 | #include "jfs_filsys.h" | 51 | #include "jfs_filsys.h" |
51 | #include "jfs_dinode.h" | 52 | #include "jfs_dinode.h" |
52 | #include "jfs_dmap.h" | 53 | #include "jfs_dmap.h" |
@@ -69,11 +70,6 @@ | |||
69 | #define AG_UNLOCK(imap,agno) up(&imap->im_aglock[agno]) | 70 | #define AG_UNLOCK(imap,agno) up(&imap->im_aglock[agno]) |
70 | 71 | ||
71 | /* | 72 | /* |
72 | * external references | ||
73 | */ | ||
74 | extern struct address_space_operations jfs_aops; | ||
75 | |||
76 | /* | ||
77 | * forward references | 73 | * forward references |
78 | */ | 74 | */ |
79 | static int diAllocAG(struct inomap *, int, boolean_t, struct inode *); | 75 | static int diAllocAG(struct inomap *, int, boolean_t, struct inode *); |
diff --git a/fs/jfs/jfs_inode.c b/fs/jfs/jfs_inode.c index 84f2459b2191..2af5efbfd06f 100644 --- a/fs/jfs/jfs_inode.c +++ b/fs/jfs/jfs_inode.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/fs.h> | 19 | #include <linux/fs.h> |
20 | #include <linux/quotaops.h> | 20 | #include <linux/quotaops.h> |
21 | #include "jfs_incore.h" | 21 | #include "jfs_incore.h" |
22 | #include "jfs_inode.h" | ||
22 | #include "jfs_filsys.h" | 23 | #include "jfs_filsys.h" |
23 | #include "jfs_imap.h" | 24 | #include "jfs_imap.h" |
24 | #include "jfs_dinode.h" | 25 | #include "jfs_dinode.h" |
diff --git a/fs/jfs/jfs_inode.h b/fs/jfs/jfs_inode.h index 3df91fbfe781..b54bac576cb3 100644 --- a/fs/jfs/jfs_inode.h +++ b/fs/jfs/jfs_inode.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) International Business Machines Corp., 2000-2001 | 2 | * Copyright (C) International Business Machines Corp., 2000-2001 |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
5 | * it under the terms of the GNU General Public License as published by | 5 | * it under the terms of the GNU General Public License as published by |
@@ -19,5 +19,22 @@ | |||
19 | #define _H_JFS_INODE | 19 | #define _H_JFS_INODE |
20 | 20 | ||
21 | extern struct inode *ialloc(struct inode *, umode_t); | 21 | extern struct inode *ialloc(struct inode *, umode_t); |
22 | extern int jfs_fsync(struct file *, struct dentry *, int); | ||
23 | extern void jfs_read_inode(struct inode *); | ||
24 | extern int jfs_commit_inode(struct inode *, int); | ||
25 | extern int jfs_write_inode(struct inode*, int); | ||
26 | extern void jfs_delete_inode(struct inode *); | ||
27 | extern void jfs_dirty_inode(struct inode *); | ||
28 | extern void jfs_truncate(struct inode *); | ||
29 | extern void jfs_truncate_nolock(struct inode *, loff_t); | ||
30 | extern void jfs_free_zero_link(struct inode *); | ||
31 | extern struct dentry *jfs_get_parent(struct dentry *dentry); | ||
22 | 32 | ||
33 | extern struct address_space_operations jfs_aops; | ||
34 | extern struct inode_operations jfs_dir_inode_operations; | ||
35 | extern struct file_operations jfs_dir_operations; | ||
36 | extern struct inode_operations jfs_file_inode_operations; | ||
37 | extern struct file_operations jfs_file_operations; | ||
38 | extern struct inode_operations jfs_symlink_inode_operations; | ||
39 | extern struct dentry_operations jfs_ci_dentry_operations; | ||
23 | #endif /* _H_JFS_INODE */ | 40 | #endif /* _H_JFS_INODE */ |
diff --git a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c index dfa1200daa61..7c8387ed4192 100644 --- a/fs/jfs/jfs_logmgr.c +++ b/fs/jfs/jfs_logmgr.c | |||
@@ -71,6 +71,7 @@ | |||
71 | #include "jfs_incore.h" | 71 | #include "jfs_incore.h" |
72 | #include "jfs_filsys.h" | 72 | #include "jfs_filsys.h" |
73 | #include "jfs_metapage.h" | 73 | #include "jfs_metapage.h" |
74 | #include "jfs_superblock.h" | ||
74 | #include "jfs_txnmgr.h" | 75 | #include "jfs_txnmgr.h" |
75 | #include "jfs_debug.h" | 76 | #include "jfs_debug.h" |
76 | 77 | ||
@@ -167,14 +168,6 @@ static struct jfs_log *dummy_log = NULL; | |||
167 | static DECLARE_MUTEX(jfs_log_sem); | 168 | static DECLARE_MUTEX(jfs_log_sem); |
168 | 169 | ||
169 | /* | 170 | /* |
170 | * external references | ||
171 | */ | ||
172 | extern void txLazyUnlock(struct tblock * tblk); | ||
173 | extern int jfs_stop_threads; | ||
174 | extern struct completion jfsIOwait; | ||
175 | extern int jfs_tlocks_low; | ||
176 | |||
177 | /* | ||
178 | * forward references | 171 | * forward references |
179 | */ | 172 | */ |
180 | static int lmWriteRecord(struct jfs_log * log, struct tblock * tblk, | 173 | static int lmWriteRecord(struct jfs_log * log, struct tblock * tblk, |
@@ -1624,6 +1617,8 @@ void jfs_flush_journal(struct jfs_log *log, int wait) | |||
1624 | } | 1617 | } |
1625 | } | 1618 | } |
1626 | assert(list_empty(&log->cqueue)); | 1619 | assert(list_empty(&log->cqueue)); |
1620 | |||
1621 | #ifdef CONFIG_JFS_DEBUG | ||
1627 | if (!list_empty(&log->synclist)) { | 1622 | if (!list_empty(&log->synclist)) { |
1628 | struct logsyncblk *lp; | 1623 | struct logsyncblk *lp; |
1629 | 1624 | ||
@@ -1638,9 +1633,8 @@ void jfs_flush_journal(struct jfs_log *log, int wait) | |||
1638 | dump_mem("orphan tblock", lp, | 1633 | dump_mem("orphan tblock", lp, |
1639 | sizeof(struct tblock)); | 1634 | sizeof(struct tblock)); |
1640 | } | 1635 | } |
1641 | // current->state = TASK_INTERRUPTIBLE; | ||
1642 | // schedule(); | ||
1643 | } | 1636 | } |
1637 | #endif | ||
1644 | //assert(list_empty(&log->synclist)); | 1638 | //assert(list_empty(&log->synclist)); |
1645 | clear_bit(log_FLUSH, &log->flag); | 1639 | clear_bit(log_FLUSH, &log->flag); |
1646 | } | 1640 | } |
diff --git a/fs/jfs/jfs_logmgr.h b/fs/jfs/jfs_logmgr.h index 51291fbc420c..747114cd38b8 100644 --- a/fs/jfs/jfs_logmgr.h +++ b/fs/jfs/jfs_logmgr.h | |||
@@ -507,6 +507,8 @@ extern int lmLogClose(struct super_block *sb); | |||
507 | extern int lmLogShutdown(struct jfs_log * log); | 507 | extern int lmLogShutdown(struct jfs_log * log); |
508 | extern int lmLogInit(struct jfs_log * log); | 508 | extern int lmLogInit(struct jfs_log * log); |
509 | extern int lmLogFormat(struct jfs_log *log, s64 logAddress, int logSize); | 509 | extern int lmLogFormat(struct jfs_log *log, s64 logAddress, int logSize); |
510 | extern int lmGroupCommit(struct jfs_log *, struct tblock *); | ||
511 | extern int jfsIOWait(void *); | ||
510 | extern void jfs_flush_journal(struct jfs_log * log, int wait); | 512 | extern void jfs_flush_journal(struct jfs_log * log, int wait); |
511 | extern void jfs_syncpt(struct jfs_log *log); | 513 | extern void jfs_syncpt(struct jfs_log *log); |
512 | 514 | ||
diff --git a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c index 41bf078dce05..6c5485d16c39 100644 --- a/fs/jfs/jfs_metapage.c +++ b/fs/jfs/jfs_metapage.c | |||
@@ -198,7 +198,7 @@ static void init_once(void *foo, kmem_cache_t *cachep, unsigned long flags) | |||
198 | } | 198 | } |
199 | } | 199 | } |
200 | 200 | ||
201 | static inline struct metapage *alloc_metapage(int gfp_mask) | 201 | static inline struct metapage *alloc_metapage(unsigned int gfp_mask) |
202 | { | 202 | { |
203 | return mempool_alloc(metapage_mempool, gfp_mask); | 203 | return mempool_alloc(metapage_mempool, gfp_mask); |
204 | } | 204 | } |
@@ -726,12 +726,12 @@ void force_metapage(struct metapage *mp) | |||
726 | page_cache_release(page); | 726 | page_cache_release(page); |
727 | } | 727 | } |
728 | 728 | ||
729 | extern void hold_metapage(struct metapage *mp) | 729 | void hold_metapage(struct metapage *mp) |
730 | { | 730 | { |
731 | lock_page(mp->page); | 731 | lock_page(mp->page); |
732 | } | 732 | } |
733 | 733 | ||
734 | extern void put_metapage(struct metapage *mp) | 734 | void put_metapage(struct metapage *mp) |
735 | { | 735 | { |
736 | if (mp->count || mp->nohomeok) { | 736 | if (mp->count || mp->nohomeok) { |
737 | /* Someone else will release this */ | 737 | /* Someone else will release this */ |
diff --git a/fs/jfs/jfs_metapage.h b/fs/jfs/jfs_metapage.h index 991e9fb84c75..f0b7d3282b07 100644 --- a/fs/jfs/jfs_metapage.h +++ b/fs/jfs/jfs_metapage.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) International Business Machines Corp., 2000-2002 | 2 | * Copyright (C) International Business Machines Corp., 2000-2002 |
3 | * Portions Copyright (c) Christoph Hellwig, 2001-2002 | 3 | * Portions Copyright (C) Christoph Hellwig, 2001-2002 |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
@@ -58,6 +58,8 @@ struct metapage { | |||
58 | #define mark_metapage_dirty(mp) set_bit(META_dirty, &(mp)->flag) | 58 | #define mark_metapage_dirty(mp) set_bit(META_dirty, &(mp)->flag) |
59 | 59 | ||
60 | /* function prototypes */ | 60 | /* function prototypes */ |
61 | extern int metapage_init(void); | ||
62 | extern void metapage_exit(void); | ||
61 | extern struct metapage *__get_metapage(struct inode *inode, | 63 | extern struct metapage *__get_metapage(struct inode *inode, |
62 | unsigned long lblock, unsigned int size, | 64 | unsigned long lblock, unsigned int size, |
63 | int absolute, unsigned long new); | 65 | int absolute, unsigned long new); |
diff --git a/fs/jfs/jfs_superblock.h b/fs/jfs/jfs_superblock.h index ab0566f70cfa..fcf781bf31cb 100644 --- a/fs/jfs/jfs_superblock.h +++ b/fs/jfs/jfs_superblock.h | |||
@@ -109,5 +109,16 @@ struct jfs_superblock { | |||
109 | extern int readSuper(struct super_block *, struct buffer_head **); | 109 | extern int readSuper(struct super_block *, struct buffer_head **); |
110 | extern int updateSuper(struct super_block *, uint); | 110 | extern int updateSuper(struct super_block *, uint); |
111 | extern void jfs_error(struct super_block *, const char *, ...); | 111 | extern void jfs_error(struct super_block *, const char *, ...); |
112 | extern int jfs_mount(struct super_block *); | ||
113 | extern int jfs_mount_rw(struct super_block *, int); | ||
114 | extern int jfs_umount(struct super_block *); | ||
115 | extern int jfs_umount_rw(struct super_block *); | ||
116 | |||
117 | extern int jfs_stop_threads; | ||
118 | extern struct completion jfsIOwait; | ||
119 | extern wait_queue_head_t jfs_IO_thread_wait; | ||
120 | extern wait_queue_head_t jfs_commit_thread_wait; | ||
121 | extern wait_queue_head_t jfs_sync_thread_wait; | ||
122 | extern int jfs_extendfs(struct super_block *, s64, int); | ||
112 | 123 | ||
113 | #endif /*_H_JFS_SUPERBLOCK */ | 124 | #endif /*_H_JFS_SUPERBLOCK */ |
diff --git a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c index e93d01aa12c4..8cbaaff1d5fa 100644 --- a/fs/jfs/jfs_txnmgr.c +++ b/fs/jfs/jfs_txnmgr.c | |||
@@ -42,7 +42,6 @@ | |||
42 | * hold on to mp+lock thru update of maps | 42 | * hold on to mp+lock thru update of maps |
43 | */ | 43 | */ |
44 | 44 | ||
45 | |||
46 | #include <linux/fs.h> | 45 | #include <linux/fs.h> |
47 | #include <linux/vmalloc.h> | 46 | #include <linux/vmalloc.h> |
48 | #include <linux/smp_lock.h> | 47 | #include <linux/smp_lock.h> |
@@ -51,6 +50,7 @@ | |||
51 | #include <linux/module.h> | 50 | #include <linux/module.h> |
52 | #include <linux/moduleparam.h> | 51 | #include <linux/moduleparam.h> |
53 | #include "jfs_incore.h" | 52 | #include "jfs_incore.h" |
53 | #include "jfs_inode.h" | ||
54 | #include "jfs_filsys.h" | 54 | #include "jfs_filsys.h" |
55 | #include "jfs_metapage.h" | 55 | #include "jfs_metapage.h" |
56 | #include "jfs_dinode.h" | 56 | #include "jfs_dinode.h" |
@@ -109,7 +109,6 @@ static int TxLockHWM; /* High water mark for number of txLocks used */ | |||
109 | static int TxLockVHWM; /* Very High water mark */ | 109 | static int TxLockVHWM; /* Very High water mark */ |
110 | struct tlock *TxLock; /* transaction lock table */ | 110 | struct tlock *TxLock; /* transaction lock table */ |
111 | 111 | ||
112 | |||
113 | /* | 112 | /* |
114 | * transaction management lock | 113 | * transaction management lock |
115 | */ | 114 | */ |
@@ -149,7 +148,6 @@ static inline void TXN_SLEEP_DROP_LOCK(wait_queue_head_t * event) | |||
149 | 148 | ||
150 | #define TXN_WAKEUP(event) wake_up_all(event) | 149 | #define TXN_WAKEUP(event) wake_up_all(event) |
151 | 150 | ||
152 | |||
153 | /* | 151 | /* |
154 | * statistics | 152 | * statistics |
155 | */ | 153 | */ |
@@ -161,16 +159,6 @@ static struct { | |||
161 | int waitlock; /* 4: # of tlock wait */ | 159 | int waitlock; /* 4: # of tlock wait */ |
162 | } stattx; | 160 | } stattx; |
163 | 161 | ||
164 | |||
165 | /* | ||
166 | * external references | ||
167 | */ | ||
168 | extern int lmGroupCommit(struct jfs_log *, struct tblock *); | ||
169 | extern int jfs_commit_inode(struct inode *, int); | ||
170 | extern int jfs_stop_threads; | ||
171 | |||
172 | extern struct completion jfsIOwait; | ||
173 | |||
174 | /* | 162 | /* |
175 | * forward references | 163 | * forward references |
176 | */ | 164 | */ |
@@ -358,7 +346,6 @@ void txExit(void) | |||
358 | TxBlock = NULL; | 346 | TxBlock = NULL; |
359 | } | 347 | } |
360 | 348 | ||
361 | |||
362 | /* | 349 | /* |
363 | * NAME: txBegin() | 350 | * NAME: txBegin() |
364 | * | 351 | * |
@@ -460,7 +447,6 @@ tid_t txBegin(struct super_block *sb, int flag) | |||
460 | return t; | 447 | return t; |
461 | } | 448 | } |
462 | 449 | ||
463 | |||
464 | /* | 450 | /* |
465 | * NAME: txBeginAnon() | 451 | * NAME: txBeginAnon() |
466 | * | 452 | * |
@@ -503,7 +489,6 @@ void txBeginAnon(struct super_block *sb) | |||
503 | TXN_UNLOCK(); | 489 | TXN_UNLOCK(); |
504 | } | 490 | } |
505 | 491 | ||
506 | |||
507 | /* | 492 | /* |
508 | * txEnd() | 493 | * txEnd() |
509 | * | 494 | * |
@@ -592,7 +577,6 @@ wakeup: | |||
592 | TXN_WAKEUP(&TxAnchor.freewait); | 577 | TXN_WAKEUP(&TxAnchor.freewait); |
593 | } | 578 | } |
594 | 579 | ||
595 | |||
596 | /* | 580 | /* |
597 | * txLock() | 581 | * txLock() |
598 | * | 582 | * |
@@ -868,7 +852,6 @@ struct tlock *txLock(tid_t tid, struct inode *ip, struct metapage * mp, | |||
868 | return NULL; | 852 | return NULL; |
869 | } | 853 | } |
870 | 854 | ||
871 | |||
872 | /* | 855 | /* |
873 | * NAME: txRelease() | 856 | * NAME: txRelease() |
874 | * | 857 | * |
@@ -908,7 +891,6 @@ static void txRelease(struct tblock * tblk) | |||
908 | TXN_UNLOCK(); | 891 | TXN_UNLOCK(); |
909 | } | 892 | } |
910 | 893 | ||
911 | |||
912 | /* | 894 | /* |
913 | * NAME: txUnlock() | 895 | * NAME: txUnlock() |
914 | * | 896 | * |
@@ -996,7 +978,6 @@ static void txUnlock(struct tblock * tblk) | |||
996 | } | 978 | } |
997 | } | 979 | } |
998 | 980 | ||
999 | |||
1000 | /* | 981 | /* |
1001 | * txMaplock() | 982 | * txMaplock() |
1002 | * | 983 | * |
@@ -1069,7 +1050,6 @@ struct tlock *txMaplock(tid_t tid, struct inode *ip, int type) | |||
1069 | return tlck; | 1050 | return tlck; |
1070 | } | 1051 | } |
1071 | 1052 | ||
1072 | |||
1073 | /* | 1053 | /* |
1074 | * txLinelock() | 1054 | * txLinelock() |
1075 | * | 1055 | * |
@@ -1103,8 +1083,6 @@ struct linelock *txLinelock(struct linelock * tlock) | |||
1103 | return linelock; | 1083 | return linelock; |
1104 | } | 1084 | } |
1105 | 1085 | ||
1106 | |||
1107 | |||
1108 | /* | 1086 | /* |
1109 | * transaction commit management | 1087 | * transaction commit management |
1110 | * ----------------------------- | 1088 | * ----------------------------- |
@@ -1373,7 +1351,6 @@ int txCommit(tid_t tid, /* transaction identifier */ | |||
1373 | return rc; | 1351 | return rc; |
1374 | } | 1352 | } |
1375 | 1353 | ||
1376 | |||
1377 | /* | 1354 | /* |
1378 | * NAME: txLog() | 1355 | * NAME: txLog() |
1379 | * | 1356 | * |
@@ -1437,7 +1414,6 @@ static int txLog(struct jfs_log * log, struct tblock * tblk, struct commit * cd) | |||
1437 | return rc; | 1414 | return rc; |
1438 | } | 1415 | } |
1439 | 1416 | ||
1440 | |||
1441 | /* | 1417 | /* |
1442 | * diLog() | 1418 | * diLog() |
1443 | * | 1419 | * |
@@ -1465,7 +1441,6 @@ static int diLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, | |||
1465 | if (tlck->type & tlckENTRY) { | 1441 | if (tlck->type & tlckENTRY) { |
1466 | /* log after-image for logredo(): */ | 1442 | /* log after-image for logredo(): */ |
1467 | lrd->type = cpu_to_le16(LOG_REDOPAGE); | 1443 | lrd->type = cpu_to_le16(LOG_REDOPAGE); |
1468 | // *pxd = mp->cm_pxd; | ||
1469 | PXDaddress(pxd, mp->index); | 1444 | PXDaddress(pxd, mp->index); |
1470 | PXDlength(pxd, | 1445 | PXDlength(pxd, |
1471 | mp->logical_size >> tblk->sb->s_blocksize_bits); | 1446 | mp->logical_size >> tblk->sb->s_blocksize_bits); |
@@ -1552,7 +1527,6 @@ static int diLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, | |||
1552 | return rc; | 1527 | return rc; |
1553 | } | 1528 | } |
1554 | 1529 | ||
1555 | |||
1556 | /* | 1530 | /* |
1557 | * dataLog() | 1531 | * dataLog() |
1558 | * | 1532 | * |
@@ -1599,7 +1573,6 @@ static int dataLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, | |||
1599 | return 0; | 1573 | return 0; |
1600 | } | 1574 | } |
1601 | 1575 | ||
1602 | |||
1603 | /* | 1576 | /* |
1604 | * dtLog() | 1577 | * dtLog() |
1605 | * | 1578 | * |
@@ -1639,7 +1612,6 @@ static void dtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, | |||
1639 | lrd->log.redopage.type |= cpu_to_le16(LOG_EXTEND); | 1612 | lrd->log.redopage.type |= cpu_to_le16(LOG_EXTEND); |
1640 | else | 1613 | else |
1641 | lrd->log.redopage.type |= cpu_to_le16(LOG_NEW); | 1614 | lrd->log.redopage.type |= cpu_to_le16(LOG_NEW); |
1642 | // *pxd = mp->cm_pxd; | ||
1643 | PXDaddress(pxd, mp->index); | 1615 | PXDaddress(pxd, mp->index); |
1644 | PXDlength(pxd, | 1616 | PXDlength(pxd, |
1645 | mp->logical_size >> tblk->sb->s_blocksize_bits); | 1617 | mp->logical_size >> tblk->sb->s_blocksize_bits); |
@@ -1704,7 +1676,6 @@ static void dtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, | |||
1704 | return; | 1676 | return; |
1705 | } | 1677 | } |
1706 | 1678 | ||
1707 | |||
1708 | /* | 1679 | /* |
1709 | * xtLog() | 1680 | * xtLog() |
1710 | * | 1681 | * |
@@ -1760,7 +1731,6 @@ static void xtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, | |||
1760 | * applying the after-image to the meta-data page. | 1731 | * applying the after-image to the meta-data page. |
1761 | */ | 1732 | */ |
1762 | lrd->type = cpu_to_le16(LOG_REDOPAGE); | 1733 | lrd->type = cpu_to_le16(LOG_REDOPAGE); |
1763 | // *page_pxd = mp->cm_pxd; | ||
1764 | PXDaddress(page_pxd, mp->index); | 1734 | PXDaddress(page_pxd, mp->index); |
1765 | PXDlength(page_pxd, | 1735 | PXDlength(page_pxd, |
1766 | mp->logical_size >> tblk->sb->s_blocksize_bits); | 1736 | mp->logical_size >> tblk->sb->s_blocksize_bits); |
@@ -2093,7 +2063,6 @@ static void xtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, | |||
2093 | return; | 2063 | return; |
2094 | } | 2064 | } |
2095 | 2065 | ||
2096 | |||
2097 | /* | 2066 | /* |
2098 | * mapLog() | 2067 | * mapLog() |
2099 | * | 2068 | * |
@@ -2180,7 +2149,6 @@ void mapLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, | |||
2180 | } | 2149 | } |
2181 | } | 2150 | } |
2182 | 2151 | ||
2183 | |||
2184 | /* | 2152 | /* |
2185 | * txEA() | 2153 | * txEA() |
2186 | * | 2154 | * |
@@ -2233,7 +2201,6 @@ void txEA(tid_t tid, struct inode *ip, dxd_t * oldea, dxd_t * newea) | |||
2233 | } | 2201 | } |
2234 | } | 2202 | } |
2235 | 2203 | ||
2236 | |||
2237 | /* | 2204 | /* |
2238 | * txForce() | 2205 | * txForce() |
2239 | * | 2206 | * |
@@ -2300,7 +2267,6 @@ void txForce(struct tblock * tblk) | |||
2300 | } | 2267 | } |
2301 | } | 2268 | } |
2302 | 2269 | ||
2303 | |||
2304 | /* | 2270 | /* |
2305 | * txUpdateMap() | 2271 | * txUpdateMap() |
2306 | * | 2272 | * |
@@ -2437,7 +2403,6 @@ static void txUpdateMap(struct tblock * tblk) | |||
2437 | } | 2403 | } |
2438 | } | 2404 | } |
2439 | 2405 | ||
2440 | |||
2441 | /* | 2406 | /* |
2442 | * txAllocPMap() | 2407 | * txAllocPMap() |
2443 | * | 2408 | * |
@@ -2509,7 +2474,6 @@ static void txAllocPMap(struct inode *ip, struct maplock * maplock, | |||
2509 | } | 2474 | } |
2510 | } | 2475 | } |
2511 | 2476 | ||
2512 | |||
2513 | /* | 2477 | /* |
2514 | * txFreeMap() | 2478 | * txFreeMap() |
2515 | * | 2479 | * |
@@ -2611,7 +2575,6 @@ void txFreeMap(struct inode *ip, | |||
2611 | } | 2575 | } |
2612 | } | 2576 | } |
2613 | 2577 | ||
2614 | |||
2615 | /* | 2578 | /* |
2616 | * txFreelock() | 2579 | * txFreelock() |
2617 | * | 2580 | * |
@@ -2652,7 +2615,6 @@ void txFreelock(struct inode *ip) | |||
2652 | TXN_UNLOCK(); | 2615 | TXN_UNLOCK(); |
2653 | } | 2616 | } |
2654 | 2617 | ||
2655 | |||
2656 | /* | 2618 | /* |
2657 | * txAbort() | 2619 | * txAbort() |
2658 | * | 2620 | * |
diff --git a/fs/jfs/jfs_txnmgr.h b/fs/jfs/jfs_txnmgr.h index b71b82c2df04..59ad0f6b7231 100644 --- a/fs/jfs/jfs_txnmgr.h +++ b/fs/jfs/jfs_txnmgr.h | |||
@@ -285,34 +285,26 @@ struct commit { | |||
285 | /* | 285 | /* |
286 | * external declarations | 286 | * external declarations |
287 | */ | 287 | */ |
288 | extern struct tlock *txLock(tid_t tid, struct inode *ip, struct metapage *mp, | 288 | extern int jfs_tlocks_low; |
289 | int flag); | 289 | |
290 | 290 | extern int txInit(void); | |
291 | extern struct tlock *txMaplock(tid_t tid, struct inode *ip, int flag); | 291 | extern void txExit(void); |
292 | 292 | extern struct tlock *txLock(tid_t, struct inode *, struct metapage *, int); | |
293 | extern int txCommit(tid_t tid, int nip, struct inode **iplist, int flag); | 293 | extern struct tlock *txMaplock(tid_t, struct inode *, int); |
294 | 294 | extern int txCommit(tid_t, int, struct inode **, int); | |
295 | extern tid_t txBegin(struct super_block *sb, int flag); | 295 | extern tid_t txBegin(struct super_block *, int); |
296 | 296 | extern void txBeginAnon(struct super_block *); | |
297 | extern void txBeginAnon(struct super_block *sb); | 297 | extern void txEnd(tid_t); |
298 | 298 | extern void txAbort(tid_t, int); | |
299 | extern void txEnd(tid_t tid); | 299 | extern struct linelock *txLinelock(struct linelock *); |
300 | 300 | extern void txFreeMap(struct inode *, struct maplock *, struct tblock *, int); | |
301 | extern void txAbort(tid_t tid, int dirty); | 301 | extern void txEA(tid_t, struct inode *, dxd_t *, dxd_t *); |
302 | 302 | extern void txFreelock(struct inode *); | |
303 | extern struct linelock *txLinelock(struct linelock * tlock); | 303 | extern int lmLog(struct jfs_log *, struct tblock *, struct lrd *, |
304 | 304 | struct tlock *); | |
305 | extern void txFreeMap(struct inode *ip, struct maplock * maplock, | 305 | extern void txQuiesce(struct super_block *); |
306 | struct tblock * tblk, int maptype); | 306 | extern void txResume(struct super_block *); |
307 | 307 | extern void txLazyUnlock(struct tblock *); | |
308 | extern void txEA(tid_t tid, struct inode *ip, dxd_t * oldea, dxd_t * newea); | 308 | extern int jfs_lazycommit(void *); |
309 | 309 | extern int jfs_sync(void *); | |
310 | extern void txFreelock(struct inode *ip); | ||
311 | |||
312 | extern int lmLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, | ||
313 | struct tlock * tlck); | ||
314 | |||
315 | extern void txQuiesce(struct super_block *sb); | ||
316 | |||
317 | extern void txResume(struct super_block *sb); | ||
318 | #endif /* _H_JFS_TXNMGR */ | 310 | #endif /* _H_JFS_TXNMGR */ |
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c index 8413a368f449..1cae14e741eb 100644 --- a/fs/jfs/namei.c +++ b/fs/jfs/namei.c | |||
@@ -31,20 +31,9 @@ | |||
31 | #include "jfs_acl.h" | 31 | #include "jfs_acl.h" |
32 | #include "jfs_debug.h" | 32 | #include "jfs_debug.h" |
33 | 33 | ||
34 | extern struct inode_operations jfs_file_inode_operations; | ||
35 | extern struct inode_operations jfs_symlink_inode_operations; | ||
36 | extern struct file_operations jfs_file_operations; | ||
37 | extern struct address_space_operations jfs_aops; | ||
38 | |||
39 | extern int jfs_fsync(struct file *, struct dentry *, int); | ||
40 | extern void jfs_truncate_nolock(struct inode *, loff_t); | ||
41 | extern int jfs_init_acl(struct inode *, struct inode *); | ||
42 | |||
43 | /* | 34 | /* |
44 | * forward references | 35 | * forward references |
45 | */ | 36 | */ |
46 | struct inode_operations jfs_dir_inode_operations; | ||
47 | struct file_operations jfs_dir_operations; | ||
48 | struct dentry_operations jfs_ci_dentry_operations; | 37 | struct dentry_operations jfs_ci_dentry_operations; |
49 | 38 | ||
50 | static s64 commitZeroLink(tid_t, struct inode *); | 39 | static s64 commitZeroLink(tid_t, struct inode *); |
@@ -655,7 +644,7 @@ static s64 commitZeroLink(tid_t tid, struct inode *ip) | |||
655 | 644 | ||
656 | 645 | ||
657 | /* | 646 | /* |
658 | * NAME: freeZeroLink() | 647 | * NAME: jfs_free_zero_link() |
659 | * | 648 | * |
660 | * FUNCTION: for non-directory, called by iClose(), | 649 | * FUNCTION: for non-directory, called by iClose(), |
661 | * free resources of a file from cache and WORKING map | 650 | * free resources of a file from cache and WORKING map |
@@ -663,15 +652,12 @@ static s64 commitZeroLink(tid_t tid, struct inode *ip) | |||
663 | * while associated with a pager object, | 652 | * while associated with a pager object, |
664 | * | 653 | * |
665 | * PARAMETER: ip - pointer to inode of file. | 654 | * PARAMETER: ip - pointer to inode of file. |
666 | * | ||
667 | * RETURN: 0 -ok | ||
668 | */ | 655 | */ |
669 | int freeZeroLink(struct inode *ip) | 656 | void jfs_free_zero_link(struct inode *ip) |
670 | { | 657 | { |
671 | int rc = 0; | ||
672 | int type; | 658 | int type; |
673 | 659 | ||
674 | jfs_info("freeZeroLink: ip = 0x%p", ip); | 660 | jfs_info("jfs_free_zero_link: ip = 0x%p", ip); |
675 | 661 | ||
676 | /* return if not reg or symbolic link or if size is | 662 | /* return if not reg or symbolic link or if size is |
677 | * already ok. | 663 | * already ok. |
@@ -684,10 +670,10 @@ int freeZeroLink(struct inode *ip) | |||
684 | case S_IFLNK: | 670 | case S_IFLNK: |
685 | /* if its contained in inode nothing to do */ | 671 | /* if its contained in inode nothing to do */ |
686 | if (ip->i_size < IDATASIZE) | 672 | if (ip->i_size < IDATASIZE) |
687 | return 0; | 673 | return; |
688 | break; | 674 | break; |
689 | default: | 675 | default: |
690 | return 0; | 676 | return; |
691 | } | 677 | } |
692 | 678 | ||
693 | /* | 679 | /* |
@@ -737,9 +723,7 @@ int freeZeroLink(struct inode *ip) | |||
737 | * free xtree/data blocks from working block map; | 723 | * free xtree/data blocks from working block map; |
738 | */ | 724 | */ |
739 | if (ip->i_size) | 725 | if (ip->i_size) |
740 | rc = xtTruncate(0, ip, 0, COMMIT_WMAP); | 726 | xtTruncate(0, ip, 0, COMMIT_WMAP); |
741 | |||
742 | return rc; | ||
743 | } | 727 | } |
744 | 728 | ||
745 | /* | 729 | /* |
diff --git a/fs/jfs/super.c b/fs/jfs/super.c index 5e774ed7fb64..810a3653d8b3 100644 --- a/fs/jfs/super.c +++ b/fs/jfs/super.c | |||
@@ -28,6 +28,7 @@ | |||
28 | 28 | ||
29 | #include "jfs_incore.h" | 29 | #include "jfs_incore.h" |
30 | #include "jfs_filsys.h" | 30 | #include "jfs_filsys.h" |
31 | #include "jfs_inode.h" | ||
31 | #include "jfs_metapage.h" | 32 | #include "jfs_metapage.h" |
32 | #include "jfs_superblock.h" | 33 | #include "jfs_superblock.h" |
33 | #include "jfs_dmap.h" | 34 | #include "jfs_dmap.h" |
@@ -62,37 +63,6 @@ module_param(jfsloglevel, int, 0644); | |||
62 | MODULE_PARM_DESC(jfsloglevel, "Specify JFS loglevel (0, 1 or 2)"); | 63 | MODULE_PARM_DESC(jfsloglevel, "Specify JFS loglevel (0, 1 or 2)"); |
63 | #endif | 64 | #endif |
64 | 65 | ||
65 | /* | ||
66 | * External declarations | ||
67 | */ | ||
68 | extern int jfs_mount(struct super_block *); | ||
69 | extern int jfs_mount_rw(struct super_block *, int); | ||
70 | extern int jfs_umount(struct super_block *); | ||
71 | extern int jfs_umount_rw(struct super_block *); | ||
72 | |||
73 | extern int jfsIOWait(void *); | ||
74 | extern int jfs_lazycommit(void *); | ||
75 | extern int jfs_sync(void *); | ||
76 | |||
77 | extern void jfs_read_inode(struct inode *inode); | ||
78 | extern void jfs_dirty_inode(struct inode *inode); | ||
79 | extern void jfs_delete_inode(struct inode *inode); | ||
80 | extern int jfs_write_inode(struct inode *inode, int wait); | ||
81 | |||
82 | extern struct dentry *jfs_get_parent(struct dentry *dentry); | ||
83 | extern int jfs_extendfs(struct super_block *, s64, int); | ||
84 | |||
85 | extern struct dentry_operations jfs_ci_dentry_operations; | ||
86 | |||
87 | #ifdef PROC_FS_JFS /* see jfs_debug.h */ | ||
88 | extern void jfs_proc_init(void); | ||
89 | extern void jfs_proc_clean(void); | ||
90 | #endif | ||
91 | |||
92 | extern wait_queue_head_t jfs_IO_thread_wait; | ||
93 | extern wait_queue_head_t jfs_commit_thread_wait; | ||
94 | extern wait_queue_head_t jfs_sync_thread_wait; | ||
95 | |||
96 | static void jfs_handle_error(struct super_block *sb) | 66 | static void jfs_handle_error(struct super_block *sb) |
97 | { | 67 | { |
98 | struct jfs_sb_info *sbi = JFS_SBI(sb); | 68 | struct jfs_sb_info *sbi = JFS_SBI(sb); |
@@ -593,11 +563,6 @@ static struct file_system_type jfs_fs_type = { | |||
593 | .fs_flags = FS_REQUIRES_DEV, | 563 | .fs_flags = FS_REQUIRES_DEV, |
594 | }; | 564 | }; |
595 | 565 | ||
596 | extern int metapage_init(void); | ||
597 | extern int txInit(void); | ||
598 | extern void txExit(void); | ||
599 | extern void metapage_exit(void); | ||
600 | |||
601 | static void init_once(void *foo, kmem_cache_t * cachep, unsigned long flags) | 566 | static void init_once(void *foo, kmem_cache_t * cachep, unsigned long flags) |
602 | { | 567 | { |
603 | struct jfs_inode_info *jfs_ip = (struct jfs_inode_info *) foo; | 568 | struct jfs_inode_info *jfs_ip = (struct jfs_inode_info *) foo; |
diff --git a/fs/jfs/symlink.c b/fs/jfs/symlink.c index ef4c07ee92b2..287d8d6c3cfd 100644 --- a/fs/jfs/symlink.c +++ b/fs/jfs/symlink.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Christoph Hellwig, 2001-2002 | 2 | * Copyright (C) Christoph Hellwig, 2001-2002 |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
5 | * it under the terms of the GNU General Public License as published by | 5 | * it under the terms of the GNU General Public License as published by |
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/fs.h> | 19 | #include <linux/fs.h> |
20 | #include <linux/namei.h> | 20 | #include <linux/namei.h> |
21 | #include "jfs_incore.h" | 21 | #include "jfs_incore.h" |
22 | #include "jfs_inode.h" | ||
22 | #include "jfs_xattr.h" | 23 | #include "jfs_xattr.h" |
23 | 24 | ||
24 | static int jfs_follow_link(struct dentry *dentry, struct nameidata *nd) | 25 | static int jfs_follow_link(struct dentry *dentry, struct nameidata *nd) |
diff --git a/fs/jfs/xattr.c b/fs/jfs/xattr.c index 7a9ffd5d03dc..6016373701a3 100644 --- a/fs/jfs/xattr.c +++ b/fs/jfs/xattr.c | |||
@@ -946,8 +946,7 @@ int __jfs_setxattr(struct inode *inode, const char *name, const void *value, | |||
946 | out: | 946 | out: |
947 | up_write(&JFS_IP(inode)->xattr_sem); | 947 | up_write(&JFS_IP(inode)->xattr_sem); |
948 | 948 | ||
949 | if (os2name) | 949 | kfree(os2name); |
950 | kfree(os2name); | ||
951 | 950 | ||
952 | return rc; | 951 | return rc; |
953 | } | 952 | } |
@@ -1042,8 +1041,7 @@ ssize_t __jfs_getxattr(struct inode *inode, const char *name, void *data, | |||
1042 | out: | 1041 | out: |
1043 | up_read(&JFS_IP(inode)->xattr_sem); | 1042 | up_read(&JFS_IP(inode)->xattr_sem); |
1044 | 1043 | ||
1045 | if (os2name) | 1044 | kfree(os2name); |
1046 | kfree(os2name); | ||
1047 | 1045 | ||
1048 | return size; | 1046 | return size; |
1049 | } | 1047 | } |
diff --git a/fs/libfs.c b/fs/libfs.c index f90b29595927..5025563e7379 100644 --- a/fs/libfs.c +++ b/fs/libfs.c | |||
@@ -519,6 +519,102 @@ int simple_transaction_release(struct inode *inode, struct file *file) | |||
519 | return 0; | 519 | return 0; |
520 | } | 520 | } |
521 | 521 | ||
522 | /* Simple attribute files */ | ||
523 | |||
524 | struct simple_attr { | ||
525 | u64 (*get)(void *); | ||
526 | void (*set)(void *, u64); | ||
527 | char get_buf[24]; /* enough to store a u64 and "\n\0" */ | ||
528 | char set_buf[24]; | ||
529 | void *data; | ||
530 | const char *fmt; /* format for read operation */ | ||
531 | struct semaphore sem; /* protects access to these buffers */ | ||
532 | }; | ||
533 | |||
534 | /* simple_attr_open is called by an actual attribute open file operation | ||
535 | * to set the attribute specific access operations. */ | ||
536 | int simple_attr_open(struct inode *inode, struct file *file, | ||
537 | u64 (*get)(void *), void (*set)(void *, u64), | ||
538 | const char *fmt) | ||
539 | { | ||
540 | struct simple_attr *attr; | ||
541 | |||
542 | attr = kmalloc(sizeof(*attr), GFP_KERNEL); | ||
543 | if (!attr) | ||
544 | return -ENOMEM; | ||
545 | |||
546 | attr->get = get; | ||
547 | attr->set = set; | ||
548 | attr->data = inode->u.generic_ip; | ||
549 | attr->fmt = fmt; | ||
550 | init_MUTEX(&attr->sem); | ||
551 | |||
552 | file->private_data = attr; | ||
553 | |||
554 | return nonseekable_open(inode, file); | ||
555 | } | ||
556 | |||
557 | int simple_attr_close(struct inode *inode, struct file *file) | ||
558 | { | ||
559 | kfree(file->private_data); | ||
560 | return 0; | ||
561 | } | ||
562 | |||
563 | /* read from the buffer that is filled with the get function */ | ||
564 | ssize_t simple_attr_read(struct file *file, char __user *buf, | ||
565 | size_t len, loff_t *ppos) | ||
566 | { | ||
567 | struct simple_attr *attr; | ||
568 | size_t size; | ||
569 | ssize_t ret; | ||
570 | |||
571 | attr = file->private_data; | ||
572 | |||
573 | if (!attr->get) | ||
574 | return -EACCES; | ||
575 | |||
576 | down(&attr->sem); | ||
577 | if (*ppos) /* continued read */ | ||
578 | size = strlen(attr->get_buf); | ||
579 | else /* first read */ | ||
580 | size = scnprintf(attr->get_buf, sizeof(attr->get_buf), | ||
581 | attr->fmt, | ||
582 | (unsigned long long)attr->get(attr->data)); | ||
583 | |||
584 | ret = simple_read_from_buffer(buf, len, ppos, attr->get_buf, size); | ||
585 | up(&attr->sem); | ||
586 | return ret; | ||
587 | } | ||
588 | |||
589 | /* interpret the buffer as a number to call the set function with */ | ||
590 | ssize_t simple_attr_write(struct file *file, const char __user *buf, | ||
591 | size_t len, loff_t *ppos) | ||
592 | { | ||
593 | struct simple_attr *attr; | ||
594 | u64 val; | ||
595 | size_t size; | ||
596 | ssize_t ret; | ||
597 | |||
598 | attr = file->private_data; | ||
599 | |||
600 | if (!attr->set) | ||
601 | return -EACCES; | ||
602 | |||
603 | down(&attr->sem); | ||
604 | ret = -EFAULT; | ||
605 | size = min(sizeof(attr->set_buf) - 1, len); | ||
606 | if (copy_from_user(attr->set_buf, buf, size)) | ||
607 | goto out; | ||
608 | |||
609 | ret = len; /* claim we got the whole input */ | ||
610 | attr->set_buf[size] = '\0'; | ||
611 | val = simple_strtol(attr->set_buf, NULL, 0); | ||
612 | attr->set(attr->data, val); | ||
613 | out: | ||
614 | up(&attr->sem); | ||
615 | return ret; | ||
616 | } | ||
617 | |||
522 | EXPORT_SYMBOL(dcache_dir_close); | 618 | EXPORT_SYMBOL(dcache_dir_close); |
523 | EXPORT_SYMBOL(dcache_dir_lseek); | 619 | EXPORT_SYMBOL(dcache_dir_lseek); |
524 | EXPORT_SYMBOL(dcache_dir_open); | 620 | EXPORT_SYMBOL(dcache_dir_open); |
@@ -547,3 +643,7 @@ EXPORT_SYMBOL(simple_read_from_buffer); | |||
547 | EXPORT_SYMBOL(simple_transaction_get); | 643 | EXPORT_SYMBOL(simple_transaction_get); |
548 | EXPORT_SYMBOL(simple_transaction_read); | 644 | EXPORT_SYMBOL(simple_transaction_read); |
549 | EXPORT_SYMBOL(simple_transaction_release); | 645 | EXPORT_SYMBOL(simple_transaction_release); |
646 | EXPORT_SYMBOL_GPL(simple_attr_open); | ||
647 | EXPORT_SYMBOL_GPL(simple_attr_close); | ||
648 | EXPORT_SYMBOL_GPL(simple_attr_read); | ||
649 | EXPORT_SYMBOL_GPL(simple_attr_write); | ||
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c index a60a3b3d8a7b..63a9fbf1ac51 100644 --- a/fs/proc/proc_misc.c +++ b/fs/proc/proc_misc.c | |||
@@ -219,6 +219,19 @@ static struct file_operations fragmentation_file_operations = { | |||
219 | .release = seq_release, | 219 | .release = seq_release, |
220 | }; | 220 | }; |
221 | 221 | ||
222 | extern struct seq_operations zoneinfo_op; | ||
223 | static int zoneinfo_open(struct inode *inode, struct file *file) | ||
224 | { | ||
225 | return seq_open(file, &zoneinfo_op); | ||
226 | } | ||
227 | |||
228 | static struct file_operations proc_zoneinfo_file_operations = { | ||
229 | .open = zoneinfo_open, | ||
230 | .read = seq_read, | ||
231 | .llseek = seq_lseek, | ||
232 | .release = seq_release, | ||
233 | }; | ||
234 | |||
222 | static int version_read_proc(char *page, char **start, off_t off, | 235 | static int version_read_proc(char *page, char **start, off_t off, |
223 | int count, int *eof, void *data) | 236 | int count, int *eof, void *data) |
224 | { | 237 | { |
@@ -589,6 +602,7 @@ void __init proc_misc_init(void) | |||
589 | create_seq_entry("slabinfo",S_IWUSR|S_IRUGO,&proc_slabinfo_operations); | 602 | create_seq_entry("slabinfo",S_IWUSR|S_IRUGO,&proc_slabinfo_operations); |
590 | create_seq_entry("buddyinfo",S_IRUGO, &fragmentation_file_operations); | 603 | create_seq_entry("buddyinfo",S_IRUGO, &fragmentation_file_operations); |
591 | create_seq_entry("vmstat",S_IRUGO, &proc_vmstat_file_operations); | 604 | create_seq_entry("vmstat",S_IRUGO, &proc_vmstat_file_operations); |
605 | create_seq_entry("zoneinfo",S_IRUGO, &proc_zoneinfo_file_operations); | ||
592 | create_seq_entry("diskstats", 0, &proc_diskstats_operations); | 606 | create_seq_entry("diskstats", 0, &proc_diskstats_operations); |
593 | #ifdef CONFIG_MODULES | 607 | #ifdef CONFIG_MODULES |
594 | create_seq_entry("modules", 0, &proc_modules_operations); | 608 | create_seq_entry("modules", 0, &proc_modules_operations); |
diff --git a/fs/super.c b/fs/super.c index 3a1b8ca04ba6..573bcc81bb82 100644 --- a/fs/super.c +++ b/fs/super.c | |||
@@ -835,6 +835,7 @@ do_kern_mount(const char *fstype, int flags, const char *name, void *data) | |||
835 | mnt->mnt_parent = mnt; | 835 | mnt->mnt_parent = mnt; |
836 | mnt->mnt_namespace = current->namespace; | 836 | mnt->mnt_namespace = current->namespace; |
837 | up_write(&sb->s_umount); | 837 | up_write(&sb->s_umount); |
838 | free_secdata(secdata); | ||
838 | put_filesystem(type); | 839 | put_filesystem(type); |
839 | return mnt; | 840 | return mnt; |
840 | out_sb: | 841 | out_sb: |
diff --git a/fs/sysfs/bin.c b/fs/sysfs/bin.c index d4aaa88d0214..78899eeab974 100644 --- a/fs/sysfs/bin.c +++ b/fs/sysfs/bin.c | |||
@@ -25,7 +25,7 @@ fill_read(struct dentry *dentry, char *buffer, loff_t off, size_t count) | |||
25 | struct kobject * kobj = to_kobj(dentry->d_parent); | 25 | struct kobject * kobj = to_kobj(dentry->d_parent); |
26 | 26 | ||
27 | if (!attr->read) | 27 | if (!attr->read) |
28 | return -EINVAL; | 28 | return -EIO; |
29 | 29 | ||
30 | return attr->read(kobj, buffer, off, count); | 30 | return attr->read(kobj, buffer, off, count); |
31 | } | 31 | } |
@@ -71,7 +71,7 @@ flush_write(struct dentry *dentry, char *buffer, loff_t offset, size_t count) | |||
71 | struct kobject *kobj = to_kobj(dentry->d_parent); | 71 | struct kobject *kobj = to_kobj(dentry->d_parent); |
72 | 72 | ||
73 | if (!attr->write) | 73 | if (!attr->write) |
74 | return -EINVAL; | 74 | return -EIO; |
75 | 75 | ||
76 | return attr->write(kobj, buffer, offset, count); | 76 | return attr->write(kobj, buffer, offset, count); |
77 | } | 77 | } |
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c index fe198210bc2d..37d7a6875d86 100644 --- a/fs/sysfs/dir.c +++ b/fs/sysfs/dir.c | |||
@@ -101,18 +101,19 @@ static int create_dir(struct kobject * k, struct dentry * p, | |||
101 | down(&p->d_inode->i_sem); | 101 | down(&p->d_inode->i_sem); |
102 | *d = sysfs_get_dentry(p,n); | 102 | *d = sysfs_get_dentry(p,n); |
103 | if (!IS_ERR(*d)) { | 103 | if (!IS_ERR(*d)) { |
104 | error = sysfs_create(*d, mode, init_dir); | 104 | error = sysfs_make_dirent(p->d_fsdata, *d, k, mode, SYSFS_DIR); |
105 | if (!error) { | 105 | if (!error) { |
106 | error = sysfs_make_dirent(p->d_fsdata, *d, k, mode, | 106 | error = sysfs_create(*d, mode, init_dir); |
107 | SYSFS_DIR); | ||
108 | if (!error) { | 107 | if (!error) { |
109 | p->d_inode->i_nlink++; | 108 | p->d_inode->i_nlink++; |
110 | (*d)->d_op = &sysfs_dentry_ops; | 109 | (*d)->d_op = &sysfs_dentry_ops; |
111 | d_rehash(*d); | 110 | d_rehash(*d); |
112 | } | 111 | } |
113 | } | 112 | } |
114 | if (error && (error != -EEXIST)) | 113 | if (error && (error != -EEXIST)) { |
114 | sysfs_put((*d)->d_fsdata); | ||
115 | d_drop(*d); | 115 | d_drop(*d); |
116 | } | ||
116 | dput(*d); | 117 | dput(*d); |
117 | } else | 118 | } else |
118 | error = PTR_ERR(*d); | 119 | error = PTR_ERR(*d); |
@@ -171,17 +172,19 @@ static int sysfs_attach_attr(struct sysfs_dirent * sd, struct dentry * dentry) | |||
171 | init = init_file; | 172 | init = init_file; |
172 | } | 173 | } |
173 | 174 | ||
175 | dentry->d_fsdata = sysfs_get(sd); | ||
176 | sd->s_dentry = dentry; | ||
174 | error = sysfs_create(dentry, (attr->mode & S_IALLUGO) | S_IFREG, init); | 177 | error = sysfs_create(dentry, (attr->mode & S_IALLUGO) | S_IFREG, init); |
175 | if (error) | 178 | if (error) { |
179 | sysfs_put(sd); | ||
176 | return error; | 180 | return error; |
181 | } | ||
177 | 182 | ||
178 | if (bin_attr) { | 183 | if (bin_attr) { |
179 | dentry->d_inode->i_size = bin_attr->size; | 184 | dentry->d_inode->i_size = bin_attr->size; |
180 | dentry->d_inode->i_fop = &bin_fops; | 185 | dentry->d_inode->i_fop = &bin_fops; |
181 | } | 186 | } |
182 | dentry->d_op = &sysfs_dentry_ops; | 187 | dentry->d_op = &sysfs_dentry_ops; |
183 | dentry->d_fsdata = sysfs_get(sd); | ||
184 | sd->s_dentry = dentry; | ||
185 | d_rehash(dentry); | 188 | d_rehash(dentry); |
186 | 189 | ||
187 | return 0; | 190 | return 0; |
@@ -191,13 +194,15 @@ static int sysfs_attach_link(struct sysfs_dirent * sd, struct dentry * dentry) | |||
191 | { | 194 | { |
192 | int err = 0; | 195 | int err = 0; |
193 | 196 | ||
197 | dentry->d_fsdata = sysfs_get(sd); | ||
198 | sd->s_dentry = dentry; | ||
194 | err = sysfs_create(dentry, S_IFLNK|S_IRWXUGO, init_symlink); | 199 | err = sysfs_create(dentry, S_IFLNK|S_IRWXUGO, init_symlink); |
195 | if (!err) { | 200 | if (!err) { |
196 | dentry->d_op = &sysfs_dentry_ops; | 201 | dentry->d_op = &sysfs_dentry_ops; |
197 | dentry->d_fsdata = sysfs_get(sd); | ||
198 | sd->s_dentry = dentry; | ||
199 | d_rehash(dentry); | 202 | d_rehash(dentry); |
200 | } | 203 | } else |
204 | sysfs_put(sd); | ||
205 | |||
201 | return err; | 206 | return err; |
202 | } | 207 | } |
203 | 208 | ||
@@ -228,6 +233,7 @@ static struct dentry * sysfs_lookup(struct inode *dir, struct dentry *dentry, | |||
228 | 233 | ||
229 | struct inode_operations sysfs_dir_inode_operations = { | 234 | struct inode_operations sysfs_dir_inode_operations = { |
230 | .lookup = sysfs_lookup, | 235 | .lookup = sysfs_lookup, |
236 | .setattr = sysfs_setattr, | ||
231 | }; | 237 | }; |
232 | 238 | ||
233 | static void remove_dir(struct dentry * d) | 239 | static void remove_dir(struct dentry * d) |
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c index 364208071e17..849aac115460 100644 --- a/fs/sysfs/file.c +++ b/fs/sysfs/file.c | |||
@@ -23,7 +23,7 @@ subsys_attr_show(struct kobject * kobj, struct attribute * attr, char * page) | |||
23 | { | 23 | { |
24 | struct subsystem * s = to_subsys(kobj); | 24 | struct subsystem * s = to_subsys(kobj); |
25 | struct subsys_attribute * sattr = to_sattr(attr); | 25 | struct subsys_attribute * sattr = to_sattr(attr); |
26 | ssize_t ret = 0; | 26 | ssize_t ret = -EIO; |
27 | 27 | ||
28 | if (sattr->show) | 28 | if (sattr->show) |
29 | ret = sattr->show(s,page); | 29 | ret = sattr->show(s,page); |
@@ -36,7 +36,7 @@ subsys_attr_store(struct kobject * kobj, struct attribute * attr, | |||
36 | { | 36 | { |
37 | struct subsystem * s = to_subsys(kobj); | 37 | struct subsystem * s = to_subsys(kobj); |
38 | struct subsys_attribute * sattr = to_sattr(attr); | 38 | struct subsys_attribute * sattr = to_sattr(attr); |
39 | ssize_t ret = 0; | 39 | ssize_t ret = -EIO; |
40 | 40 | ||
41 | if (sattr->store) | 41 | if (sattr->store) |
42 | ret = sattr->store(s,page,count); | 42 | ret = sattr->store(s,page,count); |
@@ -182,7 +182,7 @@ fill_write_buffer(struct sysfs_buffer * buffer, const char __user * buf, size_t | |||
182 | return -ENOMEM; | 182 | return -ENOMEM; |
183 | 183 | ||
184 | if (count >= PAGE_SIZE) | 184 | if (count >= PAGE_SIZE) |
185 | count = PAGE_SIZE - 1; | 185 | count = PAGE_SIZE; |
186 | error = copy_from_user(buffer->page,buf,count); | 186 | error = copy_from_user(buffer->page,buf,count); |
187 | buffer->needs_read_fill = 1; | 187 | buffer->needs_read_fill = 1; |
188 | return error ? -EFAULT : count; | 188 | return error ? -EFAULT : count; |
diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c index aff7b2dfa8ee..565cac1d4200 100644 --- a/fs/sysfs/inode.c +++ b/fs/sysfs/inode.c | |||
@@ -26,18 +26,107 @@ static struct backing_dev_info sysfs_backing_dev_info = { | |||
26 | .capabilities = BDI_CAP_NO_ACCT_DIRTY | BDI_CAP_NO_WRITEBACK, | 26 | .capabilities = BDI_CAP_NO_ACCT_DIRTY | BDI_CAP_NO_WRITEBACK, |
27 | }; | 27 | }; |
28 | 28 | ||
29 | struct inode * sysfs_new_inode(mode_t mode) | 29 | static struct inode_operations sysfs_inode_operations ={ |
30 | .setattr = sysfs_setattr, | ||
31 | }; | ||
32 | |||
33 | int sysfs_setattr(struct dentry * dentry, struct iattr * iattr) | ||
34 | { | ||
35 | struct inode * inode = dentry->d_inode; | ||
36 | struct sysfs_dirent * sd = dentry->d_fsdata; | ||
37 | struct iattr * sd_iattr; | ||
38 | unsigned int ia_valid = iattr->ia_valid; | ||
39 | int error; | ||
40 | |||
41 | if (!sd) | ||
42 | return -EINVAL; | ||
43 | |||
44 | sd_iattr = sd->s_iattr; | ||
45 | |||
46 | error = inode_change_ok(inode, iattr); | ||
47 | if (error) | ||
48 | return error; | ||
49 | |||
50 | error = inode_setattr(inode, iattr); | ||
51 | if (error) | ||
52 | return error; | ||
53 | |||
54 | if (!sd_iattr) { | ||
55 | /* setting attributes for the first time, allocate now */ | ||
56 | sd_iattr = kmalloc(sizeof(struct iattr), GFP_KERNEL); | ||
57 | if (!sd_iattr) | ||
58 | return -ENOMEM; | ||
59 | /* assign default attributes */ | ||
60 | memset(sd_iattr, 0, sizeof(struct iattr)); | ||
61 | sd_iattr->ia_mode = sd->s_mode; | ||
62 | sd_iattr->ia_uid = 0; | ||
63 | sd_iattr->ia_gid = 0; | ||
64 | sd_iattr->ia_atime = sd_iattr->ia_mtime = sd_iattr->ia_ctime = CURRENT_TIME; | ||
65 | sd->s_iattr = sd_iattr; | ||
66 | } | ||
67 | |||
68 | /* attributes were changed atleast once in past */ | ||
69 | |||
70 | if (ia_valid & ATTR_UID) | ||
71 | sd_iattr->ia_uid = iattr->ia_uid; | ||
72 | if (ia_valid & ATTR_GID) | ||
73 | sd_iattr->ia_gid = iattr->ia_gid; | ||
74 | if (ia_valid & ATTR_ATIME) | ||
75 | sd_iattr->ia_atime = timespec_trunc(iattr->ia_atime, | ||
76 | inode->i_sb->s_time_gran); | ||
77 | if (ia_valid & ATTR_MTIME) | ||
78 | sd_iattr->ia_mtime = timespec_trunc(iattr->ia_mtime, | ||
79 | inode->i_sb->s_time_gran); | ||
80 | if (ia_valid & ATTR_CTIME) | ||
81 | sd_iattr->ia_ctime = timespec_trunc(iattr->ia_ctime, | ||
82 | inode->i_sb->s_time_gran); | ||
83 | if (ia_valid & ATTR_MODE) { | ||
84 | umode_t mode = iattr->ia_mode; | ||
85 | |||
86 | if (!in_group_p(inode->i_gid) && !capable(CAP_FSETID)) | ||
87 | mode &= ~S_ISGID; | ||
88 | sd_iattr->ia_mode = mode; | ||
89 | } | ||
90 | |||
91 | return error; | ||
92 | } | ||
93 | |||
94 | static inline void set_default_inode_attr(struct inode * inode, mode_t mode) | ||
95 | { | ||
96 | inode->i_mode = mode; | ||
97 | inode->i_uid = 0; | ||
98 | inode->i_gid = 0; | ||
99 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; | ||
100 | } | ||
101 | |||
102 | static inline void set_inode_attr(struct inode * inode, struct iattr * iattr) | ||
103 | { | ||
104 | inode->i_mode = iattr->ia_mode; | ||
105 | inode->i_uid = iattr->ia_uid; | ||
106 | inode->i_gid = iattr->ia_gid; | ||
107 | inode->i_atime = iattr->ia_atime; | ||
108 | inode->i_mtime = iattr->ia_mtime; | ||
109 | inode->i_ctime = iattr->ia_ctime; | ||
110 | } | ||
111 | |||
112 | struct inode * sysfs_new_inode(mode_t mode, struct sysfs_dirent * sd) | ||
30 | { | 113 | { |
31 | struct inode * inode = new_inode(sysfs_sb); | 114 | struct inode * inode = new_inode(sysfs_sb); |
32 | if (inode) { | 115 | if (inode) { |
33 | inode->i_mode = mode; | ||
34 | inode->i_uid = 0; | ||
35 | inode->i_gid = 0; | ||
36 | inode->i_blksize = PAGE_CACHE_SIZE; | 116 | inode->i_blksize = PAGE_CACHE_SIZE; |
37 | inode->i_blocks = 0; | 117 | inode->i_blocks = 0; |
38 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; | ||
39 | inode->i_mapping->a_ops = &sysfs_aops; | 118 | inode->i_mapping->a_ops = &sysfs_aops; |
40 | inode->i_mapping->backing_dev_info = &sysfs_backing_dev_info; | 119 | inode->i_mapping->backing_dev_info = &sysfs_backing_dev_info; |
120 | inode->i_op = &sysfs_inode_operations; | ||
121 | |||
122 | if (sd->s_iattr) { | ||
123 | /* sysfs_dirent has non-default attributes | ||
124 | * get them for the new inode from persistent copy | ||
125 | * in sysfs_dirent | ||
126 | */ | ||
127 | set_inode_attr(inode, sd->s_iattr); | ||
128 | } else | ||
129 | set_default_inode_attr(inode, mode); | ||
41 | } | 130 | } |
42 | return inode; | 131 | return inode; |
43 | } | 132 | } |
@@ -48,7 +137,8 @@ int sysfs_create(struct dentry * dentry, int mode, int (*init)(struct inode *)) | |||
48 | struct inode * inode = NULL; | 137 | struct inode * inode = NULL; |
49 | if (dentry) { | 138 | if (dentry) { |
50 | if (!dentry->d_inode) { | 139 | if (!dentry->d_inode) { |
51 | if ((inode = sysfs_new_inode(mode))) { | 140 | struct sysfs_dirent * sd = dentry->d_fsdata; |
141 | if ((inode = sysfs_new_inode(mode, sd))) { | ||
52 | if (dentry->d_parent && dentry->d_parent->d_inode) { | 142 | if (dentry->d_parent && dentry->d_parent->d_inode) { |
53 | struct inode *p_inode = dentry->d_parent->d_inode; | 143 | struct inode *p_inode = dentry->d_parent->d_inode; |
54 | p_inode->i_mtime = p_inode->i_ctime = CURRENT_TIME; | 144 | p_inode->i_mtime = p_inode->i_ctime = CURRENT_TIME; |
diff --git a/fs/sysfs/mount.c b/fs/sysfs/mount.c index 5c805bb1a4b7..f1117e885bd6 100644 --- a/fs/sysfs/mount.c +++ b/fs/sysfs/mount.c | |||
@@ -28,6 +28,7 @@ static struct sysfs_dirent sysfs_root = { | |||
28 | .s_children = LIST_HEAD_INIT(sysfs_root.s_children), | 28 | .s_children = LIST_HEAD_INIT(sysfs_root.s_children), |
29 | .s_element = NULL, | 29 | .s_element = NULL, |
30 | .s_type = SYSFS_ROOT, | 30 | .s_type = SYSFS_ROOT, |
31 | .s_iattr = NULL, | ||
31 | }; | 32 | }; |
32 | 33 | ||
33 | static int sysfs_fill_super(struct super_block *sb, void *data, int silent) | 34 | static int sysfs_fill_super(struct super_block *sb, void *data, int silent) |
@@ -42,7 +43,8 @@ static int sysfs_fill_super(struct super_block *sb, void *data, int silent) | |||
42 | sb->s_time_gran = 1; | 43 | sb->s_time_gran = 1; |
43 | sysfs_sb = sb; | 44 | sysfs_sb = sb; |
44 | 45 | ||
45 | inode = sysfs_new_inode(S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO); | 46 | inode = sysfs_new_inode(S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO, |
47 | &sysfs_root); | ||
46 | if (inode) { | 48 | if (inode) { |
47 | inode->i_op = &sysfs_dir_inode_operations; | 49 | inode->i_op = &sysfs_dir_inode_operations; |
48 | inode->i_fop = &sysfs_dir_operations; | 50 | inode->i_fop = &sysfs_dir_operations; |
diff --git a/fs/sysfs/symlink.c b/fs/sysfs/symlink.c index dfdf70174354..fae57c83a722 100644 --- a/fs/sysfs/symlink.c +++ b/fs/sysfs/symlink.c | |||
@@ -43,7 +43,7 @@ static void fill_object_path(struct kobject * kobj, char * buffer, int length) | |||
43 | } | 43 | } |
44 | } | 44 | } |
45 | 45 | ||
46 | static int sysfs_add_link(struct dentry * parent, char * name, struct kobject * target) | 46 | static int sysfs_add_link(struct dentry * parent, const char * name, struct kobject * target) |
47 | { | 47 | { |
48 | struct sysfs_dirent * parent_sd = parent->d_fsdata; | 48 | struct sysfs_dirent * parent_sd = parent->d_fsdata; |
49 | struct sysfs_symlink * sl; | 49 | struct sysfs_symlink * sl; |
@@ -79,7 +79,7 @@ exit1: | |||
79 | * @target: object we're pointing to. | 79 | * @target: object we're pointing to. |
80 | * @name: name of the symlink. | 80 | * @name: name of the symlink. |
81 | */ | 81 | */ |
82 | int sysfs_create_link(struct kobject * kobj, struct kobject * target, char * name) | 82 | int sysfs_create_link(struct kobject * kobj, struct kobject * target, const char * name) |
83 | { | 83 | { |
84 | struct dentry * dentry = kobj->dentry; | 84 | struct dentry * dentry = kobj->dentry; |
85 | int error = 0; | 85 | int error = 0; |
@@ -99,13 +99,13 @@ int sysfs_create_link(struct kobject * kobj, struct kobject * target, char * nam | |||
99 | * @name: name of the symlink to remove. | 99 | * @name: name of the symlink to remove. |
100 | */ | 100 | */ |
101 | 101 | ||
102 | void sysfs_remove_link(struct kobject * kobj, char * name) | 102 | void sysfs_remove_link(struct kobject * kobj, const char * name) |
103 | { | 103 | { |
104 | sysfs_hash_and_remove(kobj->dentry,name); | 104 | sysfs_hash_and_remove(kobj->dentry,name); |
105 | } | 105 | } |
106 | 106 | ||
107 | static int sysfs_get_target_path(struct kobject * kobj, struct kobject * target, | 107 | static int sysfs_get_target_path(struct kobject * kobj, struct kobject * target, |
108 | char *path) | 108 | char *path) |
109 | { | 109 | { |
110 | char * s; | 110 | char * s; |
111 | int depth, size; | 111 | int depth, size; |
diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h index a8a24a0c0b3b..29da6f5f07c8 100644 --- a/fs/sysfs/sysfs.h +++ b/fs/sysfs/sysfs.h | |||
@@ -2,7 +2,7 @@ | |||
2 | extern struct vfsmount * sysfs_mount; | 2 | extern struct vfsmount * sysfs_mount; |
3 | extern kmem_cache_t *sysfs_dir_cachep; | 3 | extern kmem_cache_t *sysfs_dir_cachep; |
4 | 4 | ||
5 | extern struct inode * sysfs_new_inode(mode_t mode); | 5 | extern struct inode * sysfs_new_inode(mode_t mode, struct sysfs_dirent *); |
6 | extern int sysfs_create(struct dentry *, int mode, int (*init)(struct inode *)); | 6 | extern int sysfs_create(struct dentry *, int mode, int (*init)(struct inode *)); |
7 | 7 | ||
8 | extern int sysfs_make_dirent(struct sysfs_dirent *, struct dentry *, void *, | 8 | extern int sysfs_make_dirent(struct sysfs_dirent *, struct dentry *, void *, |
@@ -17,6 +17,7 @@ extern void sysfs_remove_subdir(struct dentry *); | |||
17 | 17 | ||
18 | extern const unsigned char * sysfs_get_name(struct sysfs_dirent *sd); | 18 | extern const unsigned char * sysfs_get_name(struct sysfs_dirent *sd); |
19 | extern void sysfs_drop_dentry(struct sysfs_dirent *sd, struct dentry *parent); | 19 | extern void sysfs_drop_dentry(struct sysfs_dirent *sd, struct dentry *parent); |
20 | extern int sysfs_setattr(struct dentry *dentry, struct iattr *iattr); | ||
20 | 21 | ||
21 | extern struct rw_semaphore sysfs_rename_sem; | 22 | extern struct rw_semaphore sysfs_rename_sem; |
22 | extern struct super_block * sysfs_sb; | 23 | extern struct super_block * sysfs_sb; |
@@ -75,6 +76,7 @@ static inline void release_sysfs_dirent(struct sysfs_dirent * sd) | |||
75 | kobject_put(sl->target_kobj); | 76 | kobject_put(sl->target_kobj); |
76 | kfree(sl); | 77 | kfree(sl); |
77 | } | 78 | } |
79 | kfree(sd->s_iattr); | ||
78 | kmem_cache_free(sysfs_dir_cachep, sd); | 80 | kmem_cache_free(sysfs_dir_cachep, sd); |
79 | } | 81 | } |
80 | 82 | ||
diff --git a/fs/xfs/linux-2.6/xfs_linux.h b/fs/xfs/linux-2.6/xfs_linux.h index 44eb313f22b9..42dc5e4662ed 100644 --- a/fs/xfs/linux-2.6/xfs_linux.h +++ b/fs/xfs/linux-2.6/xfs_linux.h | |||
@@ -145,10 +145,10 @@ static inline void set_buffer_unwritten_io(struct buffer_head *bh) | |||
145 | #define xfs_inherit_nosymlinks xfs_params.inherit_nosym.val | 145 | #define xfs_inherit_nosymlinks xfs_params.inherit_nosym.val |
146 | #define xfs_rotorstep xfs_params.rotorstep.val | 146 | #define xfs_rotorstep xfs_params.rotorstep.val |
147 | 147 | ||
148 | #ifndef __smp_processor_id | 148 | #ifndef raw_smp_processor_id |
149 | #define __smp_processor_id() smp_processor_id() | 149 | #define raw_smp_processor_id() smp_processor_id() |
150 | #endif | 150 | #endif |
151 | #define current_cpu() __smp_processor_id() | 151 | #define current_cpu() raw_smp_processor_id() |
152 | #define current_pid() (current->pid) | 152 | #define current_pid() (current->pid) |
153 | #define current_fsuid(cred) (current->fsuid) | 153 | #define current_fsuid(cred) (current->fsuid) |
154 | #define current_fsgid(cred) (current->fsgid) | 154 | #define current_fsgid(cred) (current->fsgid) |