diff options
Diffstat (limited to 'fs')
| -rw-r--r-- | fs/afs/netdevices.c | 5 | ||||
| -rw-r--r-- | fs/binfmt_elf.c | 14 | ||||
| -rw-r--r-- | fs/bio.c | 50 | ||||
| -rw-r--r-- | fs/block_dev.c | 2 | ||||
| -rw-r--r-- | fs/buffer.c | 6 | ||||
| -rw-r--r-- | fs/compat_ioctl.c | 692 | ||||
| -rw-r--r-- | fs/direct-io.c | 13 | ||||
| -rw-r--r-- | fs/ecryptfs/netlink.c | 16 | ||||
| -rw-r--r-- | fs/fs-writeback.c | 1 | ||||
| -rw-r--r-- | fs/gfs2/super.c | 5 | ||||
| -rw-r--r-- | fs/jfs/jfs_logmgr.c | 12 | ||||
| -rw-r--r-- | fs/jfs/jfs_metapage.c | 15 | ||||
| -rw-r--r-- | fs/mpage.c | 12 | ||||
| -rw-r--r-- | fs/ocfs2/cluster/heartbeat.c | 7 | ||||
| -rw-r--r-- | fs/proc/Makefile | 1 | ||||
| -rw-r--r-- | fs/proc/internal.h | 5 | ||||
| -rw-r--r-- | fs/proc/proc_net.c | 200 | ||||
| -rw-r--r-- | fs/proc/root.c | 8 | ||||
| -rw-r--r-- | fs/seq_file.c | 33 | ||||
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_aops.c | 7 | ||||
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_buf.c | 7 |
21 files changed, 290 insertions, 821 deletions
diff --git a/fs/afs/netdevices.c b/fs/afs/netdevices.c index fc27d4b52e5f..49f189423063 100644 --- a/fs/afs/netdevices.c +++ b/fs/afs/netdevices.c | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | #include <linux/inetdevice.h> | 8 | #include <linux/inetdevice.h> |
| 9 | #include <linux/netdevice.h> | 9 | #include <linux/netdevice.h> |
| 10 | #include <linux/if_arp.h> | 10 | #include <linux/if_arp.h> |
| 11 | #include <net/net_namespace.h> | ||
| 11 | #include "internal.h" | 12 | #include "internal.h" |
| 12 | 13 | ||
| 13 | /* | 14 | /* |
| @@ -23,7 +24,7 @@ int afs_get_MAC_address(u8 *mac, size_t maclen) | |||
| 23 | BUG(); | 24 | BUG(); |
| 24 | 25 | ||
| 25 | rtnl_lock(); | 26 | rtnl_lock(); |
| 26 | dev = __dev_getfirstbyhwtype(ARPHRD_ETHER); | 27 | dev = __dev_getfirstbyhwtype(&init_net, ARPHRD_ETHER); |
| 27 | if (dev) { | 28 | if (dev) { |
| 28 | memcpy(mac, dev->dev_addr, maclen); | 29 | memcpy(mac, dev->dev_addr, maclen); |
| 29 | ret = 0; | 30 | ret = 0; |
| @@ -47,7 +48,7 @@ int afs_get_ipv4_interfaces(struct afs_interface *bufs, size_t maxbufs, | |||
| 47 | ASSERT(maxbufs > 0); | 48 | ASSERT(maxbufs > 0); |
| 48 | 49 | ||
| 49 | rtnl_lock(); | 50 | rtnl_lock(); |
| 50 | for_each_netdev(dev) { | 51 | for_each_netdev(&init_net, dev) { |
| 51 | if (dev->type == ARPHRD_LOOPBACK && !wantloopback) | 52 | if (dev->type == ARPHRD_LOOPBACK && !wantloopback) |
| 52 | continue; | 53 | continue; |
| 53 | idev = __in_dev_get_rtnl(dev); | 54 | idev = __in_dev_get_rtnl(dev); |
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 4482a0673b15..b1013f34085d 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c | |||
| @@ -1514,9 +1514,6 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file) | |||
| 1514 | int thread_status_size = 0; | 1514 | int thread_status_size = 0; |
| 1515 | elf_addr_t *auxv; | 1515 | elf_addr_t *auxv; |
| 1516 | unsigned long mm_flags; | 1516 | unsigned long mm_flags; |
| 1517 | #ifdef ELF_CORE_WRITE_EXTRA_NOTES | ||
| 1518 | int extra_notes_size; | ||
| 1519 | #endif | ||
| 1520 | 1517 | ||
| 1521 | /* | 1518 | /* |
| 1522 | * We no longer stop all VM operations. | 1519 | * We no longer stop all VM operations. |
| @@ -1645,10 +1642,7 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file) | |||
| 1645 | 1642 | ||
| 1646 | sz += thread_status_size; | 1643 | sz += thread_status_size; |
| 1647 | 1644 | ||
| 1648 | #ifdef ELF_CORE_WRITE_EXTRA_NOTES | 1645 | sz += elf_coredump_extra_notes_size(); |
| 1649 | extra_notes_size = ELF_CORE_EXTRA_NOTES_SIZE; | ||
| 1650 | sz += extra_notes_size; | ||
| 1651 | #endif | ||
| 1652 | 1646 | ||
| 1653 | fill_elf_note_phdr(&phdr, sz, offset); | 1647 | fill_elf_note_phdr(&phdr, sz, offset); |
| 1654 | offset += sz; | 1648 | offset += sz; |
| @@ -1698,10 +1692,8 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file) | |||
| 1698 | if (!writenote(notes + i, file, &foffset)) | 1692 | if (!writenote(notes + i, file, &foffset)) |
| 1699 | goto end_coredump; | 1693 | goto end_coredump; |
| 1700 | 1694 | ||
| 1701 | #ifdef ELF_CORE_WRITE_EXTRA_NOTES | 1695 | if (elf_coredump_extra_notes_write(file, &foffset)) |
| 1702 | ELF_CORE_WRITE_EXTRA_NOTES; | 1696 | goto end_coredump; |
| 1703 | foffset += extra_notes_size; | ||
| 1704 | #endif | ||
| 1705 | 1697 | ||
| 1706 | /* write out the thread status notes section */ | 1698 | /* write out the thread status notes section */ |
| 1707 | list_for_each(t, &thread_list) { | 1699 | list_for_each(t, &thread_list) { |
| @@ -798,13 +798,9 @@ void bio_unmap_user(struct bio *bio) | |||
| 798 | bio_put(bio); | 798 | bio_put(bio); |
| 799 | } | 799 | } |
| 800 | 800 | ||
| 801 | static int bio_map_kern_endio(struct bio *bio, unsigned int bytes_done, int err) | 801 | static void bio_map_kern_endio(struct bio *bio, int err) |
| 802 | { | 802 | { |
| 803 | if (bio->bi_size) | ||
| 804 | return 1; | ||
| 805 | |||
| 806 | bio_put(bio); | 803 | bio_put(bio); |
| 807 | return 0; | ||
| 808 | } | 804 | } |
| 809 | 805 | ||
| 810 | 806 | ||
| @@ -1002,34 +998,26 @@ void bio_check_pages_dirty(struct bio *bio) | |||
| 1002 | /** | 998 | /** |
| 1003 | * bio_endio - end I/O on a bio | 999 | * bio_endio - end I/O on a bio |
| 1004 | * @bio: bio | 1000 | * @bio: bio |
| 1005 | * @bytes_done: number of bytes completed | ||
| 1006 | * @error: error, if any | 1001 | * @error: error, if any |
| 1007 | * | 1002 | * |
| 1008 | * Description: | 1003 | * Description: |
| 1009 | * bio_endio() will end I/O on @bytes_done number of bytes. This may be | 1004 | * bio_endio() will end I/O on the whole bio. bio_endio() is the |
| 1010 | * just a partial part of the bio, or it may be the whole bio. bio_endio() | 1005 | * preferred way to end I/O on a bio, it takes care of clearing |
| 1011 | * is the preferred way to end I/O on a bio, it takes care of decrementing | 1006 | * BIO_UPTODATE on error. @error is 0 on success, and and one of the |
| 1012 | * bi_size and clearing BIO_UPTODATE on error. @error is 0 on success, and | 1007 | * established -Exxxx (-EIO, for instance) error values in case |
| 1013 | * and one of the established -Exxxx (-EIO, for instance) error values in | 1008 | * something went wrong. Noone should call bi_end_io() directly on a |
| 1014 | * case something went wrong. Noone should call bi_end_io() directly on | 1009 | * bio unless they own it and thus know that it has an end_io |
| 1015 | * a bio unless they own it and thus know that it has an end_io function. | 1010 | * function. |
| 1016 | **/ | 1011 | **/ |
| 1017 | void bio_endio(struct bio *bio, unsigned int bytes_done, int error) | 1012 | void bio_endio(struct bio *bio, int error) |
| 1018 | { | 1013 | { |
| 1019 | if (error) | 1014 | if (error) |
| 1020 | clear_bit(BIO_UPTODATE, &bio->bi_flags); | 1015 | clear_bit(BIO_UPTODATE, &bio->bi_flags); |
| 1021 | 1016 | else if (!test_bit(BIO_UPTODATE, &bio->bi_flags)) | |
| 1022 | if (unlikely(bytes_done > bio->bi_size)) { | 1017 | error = -EIO; |
| 1023 | printk("%s: want %u bytes done, only %u left\n", __FUNCTION__, | ||
| 1024 | bytes_done, bio->bi_size); | ||
| 1025 | bytes_done = bio->bi_size; | ||
| 1026 | } | ||
| 1027 | |||
| 1028 | bio->bi_size -= bytes_done; | ||
| 1029 | bio->bi_sector += (bytes_done >> 9); | ||
| 1030 | 1018 | ||
| 1031 | if (bio->bi_end_io) | 1019 | if (bio->bi_end_io) |
| 1032 | bio->bi_end_io(bio, bytes_done, error); | 1020 | bio->bi_end_io(bio, error); |
| 1033 | } | 1021 | } |
| 1034 | 1022 | ||
| 1035 | void bio_pair_release(struct bio_pair *bp) | 1023 | void bio_pair_release(struct bio_pair *bp) |
| @@ -1037,37 +1025,29 @@ void bio_pair_release(struct bio_pair *bp) | |||
| 1037 | if (atomic_dec_and_test(&bp->cnt)) { | 1025 | if (atomic_dec_and_test(&bp->cnt)) { |
| 1038 | struct bio *master = bp->bio1.bi_private; | 1026 | struct bio *master = bp->bio1.bi_private; |
| 1039 | 1027 | ||
| 1040 | bio_endio(master, master->bi_size, bp->error); | 1028 | bio_endio(master, bp->error); |
| 1041 | mempool_free(bp, bp->bio2.bi_private); | 1029 | mempool_free(bp, bp->bio2.bi_private); |
| 1042 | } | 1030 | } |
| 1043 | } | 1031 | } |
| 1044 | 1032 | ||
| 1045 | static int bio_pair_end_1(struct bio * bi, unsigned int done, int err) | 1033 | static void bio_pair_end_1(struct bio *bi, int err) |
| 1046 | { | 1034 | { |
| 1047 | struct bio_pair *bp = container_of(bi, struct bio_pair, bio1); | 1035 | struct bio_pair *bp = container_of(bi, struct bio_pair, bio1); |
| 1048 | 1036 | ||
| 1049 | if (err) | 1037 | if (err) |
| 1050 | bp->error = err; | 1038 | bp->error = err; |
| 1051 | 1039 | ||
| 1052 | if (bi->bi_size) | ||
| 1053 | return 1; | ||
| 1054 | |||
| 1055 | bio_pair_release(bp); | 1040 | bio_pair_release(bp); |
| 1056 | return 0; | ||
| 1057 | } | 1041 | } |
| 1058 | 1042 | ||
| 1059 | static int bio_pair_end_2(struct bio * bi, unsigned int done, int err) | 1043 | static void bio_pair_end_2(struct bio *bi, int err) |
| 1060 | { | 1044 | { |
| 1061 | struct bio_pair *bp = container_of(bi, struct bio_pair, bio2); | 1045 | struct bio_pair *bp = container_of(bi, struct bio_pair, bio2); |
| 1062 | 1046 | ||
| 1063 | if (err) | 1047 | if (err) |
| 1064 | bp->error = err; | 1048 | bp->error = err; |
| 1065 | 1049 | ||
| 1066 | if (bi->bi_size) | ||
| 1067 | return 1; | ||
| 1068 | |||
| 1069 | bio_pair_release(bp); | 1050 | bio_pair_release(bp); |
| 1070 | return 0; | ||
| 1071 | } | 1051 | } |
| 1072 | 1052 | ||
| 1073 | /* | 1053 | /* |
diff --git a/fs/block_dev.c b/fs/block_dev.c index 2980eabe5779..6339a30879b7 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
| @@ -172,7 +172,7 @@ blkdev_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, | |||
| 172 | } | 172 | } |
| 173 | 173 | ||
| 174 | #if 0 | 174 | #if 0 |
| 175 | static int blk_end_aio(struct bio *bio, unsigned int bytes_done, int error) | 175 | static void blk_end_aio(struct bio *bio, int error) |
| 176 | { | 176 | { |
| 177 | struct kiocb *iocb = bio->bi_private; | 177 | struct kiocb *iocb = bio->bi_private; |
| 178 | atomic_t *bio_count = &iocb->ki_bio_count; | 178 | atomic_t *bio_count = &iocb->ki_bio_count; |
diff --git a/fs/buffer.c b/fs/buffer.c index 0e5ec371ce72..75b51dfa5e03 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
| @@ -2634,13 +2634,10 @@ sector_t generic_block_bmap(struct address_space *mapping, sector_t block, | |||
| 2634 | return tmp.b_blocknr; | 2634 | return tmp.b_blocknr; |
| 2635 | } | 2635 | } |
| 2636 | 2636 | ||
| 2637 | static int end_bio_bh_io_sync(struct bio *bio, unsigned int bytes_done, int err) | 2637 | static void end_bio_bh_io_sync(struct bio *bio, int err) |
| 2638 | { | 2638 | { |
| 2639 | struct buffer_head *bh = bio->bi_private; | 2639 | struct buffer_head *bh = bio->bi_private; |
| 2640 | 2640 | ||
| 2641 | if (bio->bi_size) | ||
| 2642 | return 1; | ||
| 2643 | |||
| 2644 | if (err == -EOPNOTSUPP) { | 2641 | if (err == -EOPNOTSUPP) { |
| 2645 | set_bit(BIO_EOPNOTSUPP, &bio->bi_flags); | 2642 | set_bit(BIO_EOPNOTSUPP, &bio->bi_flags); |
| 2646 | set_bit(BH_Eopnotsupp, &bh->b_state); | 2643 | set_bit(BH_Eopnotsupp, &bh->b_state); |
| @@ -2648,7 +2645,6 @@ static int end_bio_bh_io_sync(struct bio *bio, unsigned int bytes_done, int err) | |||
| 2648 | 2645 | ||
| 2649 | bh->b_end_io(bh, test_bit(BIO_UPTODATE, &bio->bi_flags)); | 2646 | bh->b_end_io(bh, test_bit(BIO_UPTODATE, &bio->bi_flags)); |
| 2650 | bio_put(bio); | 2647 | bio_put(bio); |
| 2651 | return 0; | ||
| 2652 | } | 2648 | } |
| 2653 | 2649 | ||
| 2654 | int submit_bh(int rw, struct buffer_head * bh) | 2650 | int submit_bh(int rw, struct buffer_head * bh) |
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 37310b0e8107..9c3fd07f35e0 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c | |||
| @@ -21,7 +21,6 @@ | |||
| 21 | #include <linux/if.h> | 21 | #include <linux/if.h> |
| 22 | #include <linux/if_bridge.h> | 22 | #include <linux/if_bridge.h> |
| 23 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
| 24 | #include <linux/hdreg.h> | ||
| 25 | #include <linux/raid/md.h> | 24 | #include <linux/raid/md.h> |
| 26 | #include <linux/kd.h> | 25 | #include <linux/kd.h> |
| 27 | #include <linux/dirent.h> | 26 | #include <linux/dirent.h> |
| @@ -33,12 +32,10 @@ | |||
| 33 | #include <linux/vt.h> | 32 | #include <linux/vt.h> |
| 34 | #include <linux/fs.h> | 33 | #include <linux/fs.h> |
| 35 | #include <linux/file.h> | 34 | #include <linux/file.h> |
| 36 | #include <linux/fd.h> | ||
| 37 | #include <linux/ppp_defs.h> | 35 | #include <linux/ppp_defs.h> |
| 38 | #include <linux/if_ppp.h> | 36 | #include <linux/if_ppp.h> |
| 39 | #include <linux/if_pppox.h> | 37 | #include <linux/if_pppox.h> |
| 40 | #include <linux/mtio.h> | 38 | #include <linux/mtio.h> |
| 41 | #include <linux/cdrom.h> | ||
| 42 | #include <linux/auto_fs.h> | 39 | #include <linux/auto_fs.h> |
| 43 | #include <linux/auto_fs4.h> | 40 | #include <linux/auto_fs4.h> |
| 44 | #include <linux/tty.h> | 41 | #include <linux/tty.h> |
| @@ -48,7 +45,6 @@ | |||
| 48 | #include <linux/netdevice.h> | 45 | #include <linux/netdevice.h> |
| 49 | #include <linux/raw.h> | 46 | #include <linux/raw.h> |
| 50 | #include <linux/smb_fs.h> | 47 | #include <linux/smb_fs.h> |
| 51 | #include <linux/blkpg.h> | ||
| 52 | #include <linux/blkdev.h> | 48 | #include <linux/blkdev.h> |
| 53 | #include <linux/elevator.h> | 49 | #include <linux/elevator.h> |
| 54 | #include <linux/rtc.h> | 50 | #include <linux/rtc.h> |
| @@ -62,7 +58,6 @@ | |||
| 62 | #include <linux/i2c-dev.h> | 58 | #include <linux/i2c-dev.h> |
| 63 | #include <linux/wireless.h> | 59 | #include <linux/wireless.h> |
| 64 | #include <linux/atalk.h> | 60 | #include <linux/atalk.h> |
| 65 | #include <linux/blktrace_api.h> | ||
| 66 | #include <linux/loop.h> | 61 | #include <linux/loop.h> |
| 67 | 62 | ||
| 68 | #include <net/bluetooth/bluetooth.h> | 63 | #include <net/bluetooth/bluetooth.h> |
| @@ -324,22 +319,21 @@ struct ifconf32 { | |||
| 324 | 319 | ||
| 325 | static int dev_ifname32(unsigned int fd, unsigned int cmd, unsigned long arg) | 320 | static int dev_ifname32(unsigned int fd, unsigned int cmd, unsigned long arg) |
| 326 | { | 321 | { |
| 327 | struct net_device *dev; | 322 | struct ifreq __user *uifr; |
| 328 | struct ifreq32 ifr32; | ||
| 329 | int err; | 323 | int err; |
| 330 | 324 | ||
| 331 | if (copy_from_user(&ifr32, compat_ptr(arg), sizeof(ifr32))) | 325 | uifr = compat_alloc_user_space(sizeof(struct ifreq)); |
| 326 | if (copy_in_user(uifr, compat_ptr(arg), sizeof(struct ifreq32))); | ||
| 332 | return -EFAULT; | 327 | return -EFAULT; |
| 333 | 328 | ||
| 334 | dev = dev_get_by_index(ifr32.ifr_ifindex); | 329 | err = sys_ioctl(fd, SIOCGIFNAME, (unsigned long)uifr); |
| 335 | if (!dev) | 330 | if (err) |
| 336 | return -ENODEV; | 331 | return err; |
| 332 | |||
| 333 | if (copy_in_user(compat_ptr(arg), uifr, sizeof(struct ifreq32))) | ||
| 334 | return -EFAULT; | ||
| 337 | 335 | ||
| 338 | strlcpy(ifr32.ifr_name, dev->name, sizeof(ifr32.ifr_name)); | 336 | return 0; |
| 339 | dev_put(dev); | ||
| 340 | |||
| 341 | err = copy_to_user(compat_ptr(arg), &ifr32, sizeof(ifr32)); | ||
| 342 | return (err ? -EFAULT : 0); | ||
| 343 | } | 337 | } |
| 344 | 338 | ||
| 345 | static int dev_ifconf(unsigned int fd, unsigned int cmd, unsigned long arg) | 339 | static int dev_ifconf(unsigned int fd, unsigned int cmd, unsigned long arg) |
| @@ -668,53 +662,6 @@ out: | |||
| 668 | #endif | 662 | #endif |
| 669 | 663 | ||
| 670 | #ifdef CONFIG_BLOCK | 664 | #ifdef CONFIG_BLOCK |
| 671 | struct hd_geometry32 { | ||
| 672 | unsigned char heads; | ||
| 673 | unsigned char sectors; | ||
| 674 | unsigned short cylinders; | ||
| 675 | u32 start; | ||
| 676 | }; | ||
| 677 | |||
| 678 | static int hdio_getgeo(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
| 679 | { | ||
| 680 | mm_segment_t old_fs = get_fs(); | ||
| 681 | struct hd_geometry geo; | ||
| 682 | struct hd_geometry32 __user *ugeo; | ||
| 683 | int err; | ||
| 684 | |||
| 685 | set_fs (KERNEL_DS); | ||
| 686 | err = sys_ioctl(fd, HDIO_GETGEO, (unsigned long)&geo); | ||
| 687 | set_fs (old_fs); | ||
| 688 | ugeo = compat_ptr(arg); | ||
| 689 | if (!err) { | ||
| 690 | err = copy_to_user (ugeo, &geo, 4); | ||
| 691 | err |= __put_user (geo.start, &ugeo->start); | ||
| 692 | if (err) | ||
| 693 | err = -EFAULT; | ||
| 694 | } | ||
| 695 | return err; | ||
| 696 | } | ||
| 697 | |||
| 698 | static int hdio_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
| 699 | { | ||
| 700 | mm_segment_t old_fs = get_fs(); | ||
| 701 | unsigned long kval; | ||
| 702 | unsigned int __user *uvp; | ||
| 703 | int error; | ||
| 704 | |||
| 705 | set_fs(KERNEL_DS); | ||
| 706 | error = sys_ioctl(fd, cmd, (long)&kval); | ||
| 707 | set_fs(old_fs); | ||
| 708 | |||
| 709 | if(error == 0) { | ||
| 710 | uvp = compat_ptr(arg); | ||
| 711 | if(put_user(kval, uvp)) | ||
| 712 | error = -EFAULT; | ||
| 713 | } | ||
| 714 | return error; | ||
| 715 | } | ||
| 716 | |||
| 717 | |||
| 718 | typedef struct sg_io_hdr32 { | 665 | typedef struct sg_io_hdr32 { |
| 719 | compat_int_t interface_id; /* [i] 'S' for SCSI generic (required) */ | 666 | compat_int_t interface_id; /* [i] 'S' for SCSI generic (required) */ |
| 720 | compat_int_t dxfer_direction; /* [i] data transfer direction */ | 667 | compat_int_t dxfer_direction; /* [i] data transfer direction */ |
| @@ -1089,108 +1036,6 @@ static int mt_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg) | |||
| 1089 | return err ? -EFAULT: 0; | 1036 | return err ? -EFAULT: 0; |
| 1090 | } | 1037 | } |
| 1091 | 1038 | ||
| 1092 | struct cdrom_read_audio32 { | ||
| 1093 | union cdrom_addr addr; | ||
| 1094 | u8 addr_format; | ||
| 1095 | compat_int_t nframes; | ||
| 1096 | compat_caddr_t buf; | ||
| 1097 | }; | ||
| 1098 | |||
| 1099 | struct cdrom_generic_command32 { | ||
| 1100 | unsigned char cmd[CDROM_PACKET_SIZE]; | ||
| 1101 | compat_caddr_t buffer; | ||
| 1102 | compat_uint_t buflen; | ||
| 1103 | compat_int_t stat; | ||
| 1104 | compat_caddr_t sense; | ||
| 1105 | unsigned char data_direction; | ||
| 1106 | compat_int_t quiet; | ||
| 1107 | compat_int_t timeout; | ||
| 1108 | compat_caddr_t reserved[1]; | ||
| 1109 | }; | ||
| 1110 | |||
| 1111 | static int cdrom_do_read_audio(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
| 1112 | { | ||
| 1113 | struct cdrom_read_audio __user *cdread_audio; | ||
| 1114 | struct cdrom_read_audio32 __user *cdread_audio32; | ||
| 1115 | __u32 data; | ||
| 1116 | void __user *datap; | ||
| 1117 | |||
| 1118 | cdread_audio = compat_alloc_user_space(sizeof(*cdread_audio)); | ||
| 1119 | cdread_audio32 = compat_ptr(arg); | ||
| 1120 | |||
| 1121 | if (copy_in_user(&cdread_audio->addr, | ||
| 1122 | &cdread_audio32->addr, | ||
| 1123 | (sizeof(*cdread_audio32) - | ||
| 1124 | sizeof(compat_caddr_t)))) | ||
| 1125 | return -EFAULT; | ||
| 1126 | |||
| 1127 | if (get_user(data, &cdread_audio32->buf)) | ||
| 1128 | return -EFAULT; | ||
| 1129 | datap = compat_ptr(data); | ||
| 1130 | if (put_user(datap, &cdread_audio->buf)) | ||
| 1131 | return -EFAULT; | ||
| 1132 | |||
| 1133 | return sys_ioctl(fd, cmd, (unsigned long) cdread_audio); | ||
| 1134 | } | ||
| 1135 | |||
| 1136 | static int cdrom_do_generic_command(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
| 1137 | { | ||
| 1138 | struct cdrom_generic_command __user *cgc; | ||
| 1139 | struct cdrom_generic_command32 __user *cgc32; | ||
| 1140 | u32 data; | ||
| 1141 | unsigned char dir; | ||
| 1142 | int itmp; | ||
| 1143 | |||
| 1144 | cgc = compat_alloc_user_space(sizeof(*cgc)); | ||
| 1145 | cgc32 = compat_ptr(arg); | ||
| 1146 | |||
| 1147 | if (copy_in_user(&cgc->cmd, &cgc32->cmd, sizeof(cgc->cmd)) || | ||
| 1148 | get_user(data, &cgc32->buffer) || | ||
| 1149 | put_user(compat_ptr(data), &cgc->buffer) || | ||
| 1150 | copy_in_user(&cgc->buflen, &cgc32->buflen, | ||
| 1151 | (sizeof(unsigned int) + sizeof(int))) || | ||
| 1152 | get_user(data, &cgc32->sense) || | ||
| 1153 | put_user(compat_ptr(data), &cgc->sense) || | ||
| 1154 | get_user(dir, &cgc32->data_direction) || | ||
| 1155 | put_user(dir, &cgc->data_direction) || | ||
| 1156 | get_user(itmp, &cgc32->quiet) || | ||
| 1157 | put_user(itmp, &cgc->quiet) || | ||
| 1158 | get_user(itmp, &cgc32->timeout) || | ||
| 1159 | put_user(itmp, &cgc->timeout) || | ||
| 1160 | get_user(data, &cgc32->reserved[0]) || | ||
| 1161 | put_user(compat_ptr(data), &cgc->reserved[0])) | ||
| 1162 | return -EFAULT; | ||
| 1163 | |||
| 1164 | return sys_ioctl(fd, cmd, (unsigned long) cgc); | ||
| 1165 | } | ||
| 1166 | |||
| 1167 | static int cdrom_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
| 1168 | { | ||
| 1169 | int err; | ||
| 1170 | |||
| 1171 | switch(cmd) { | ||
| 1172 | case CDROMREADAUDIO: | ||
| 1173 | err = cdrom_do_read_audio(fd, cmd, arg); | ||
| 1174 | break; | ||
| 1175 | |||
| 1176 | case CDROM_SEND_PACKET: | ||
| 1177 | err = cdrom_do_generic_command(fd, cmd, arg); | ||
| 1178 | break; | ||
| 1179 | |||
| 1180 | default: | ||
| 1181 | do { | ||
| 1182 | static int count; | ||
| 1183 | if (++count <= 20) | ||
| 1184 | printk("cdrom_ioctl: Unknown cmd fd(%d) " | ||
| 1185 | "cmd(%08x) arg(%08x)\n", | ||
| 1186 | (int)fd, (unsigned int)cmd, (unsigned int)arg); | ||
| 1187 | } while(0); | ||
| 1188 | err = -EINVAL; | ||
| 1189 | break; | ||
| 1190 | }; | ||
| 1191 | |||
| 1192 | return err; | ||
| 1193 | } | ||
| 1194 | #endif /* CONFIG_BLOCK */ | 1039 | #endif /* CONFIG_BLOCK */ |
| 1195 | 1040 | ||
| 1196 | #ifdef CONFIG_VT | 1041 | #ifdef CONFIG_VT |
| @@ -1536,71 +1381,11 @@ ret_einval(unsigned int fd, unsigned int cmd, unsigned long arg) | |||
| 1536 | return -EINVAL; | 1381 | return -EINVAL; |
| 1537 | } | 1382 | } |
| 1538 | 1383 | ||
| 1539 | #ifdef CONFIG_BLOCK | ||
| 1540 | static int broken_blkgetsize(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
| 1541 | { | ||
| 1542 | /* The mkswap binary hard codes it to Intel value :-((( */ | ||
| 1543 | return w_long(fd, BLKGETSIZE, arg); | ||
| 1544 | } | ||
| 1545 | |||
| 1546 | struct blkpg_ioctl_arg32 { | ||
| 1547 | compat_int_t op; | ||
| 1548 | compat_int_t flags; | ||
| 1549 | compat_int_t datalen; | ||
| 1550 | compat_caddr_t data; | ||
| 1551 | }; | ||
| 1552 | |||
| 1553 | static int blkpg_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
| 1554 | { | ||
| 1555 | struct blkpg_ioctl_arg32 __user *ua32 = compat_ptr(arg); | ||
| 1556 | struct blkpg_ioctl_arg __user *a = compat_alloc_user_space(sizeof(*a)); | ||
| 1557 | compat_caddr_t udata; | ||
| 1558 | compat_int_t n; | ||
| 1559 | int err; | ||
| 1560 | |||
| 1561 | err = get_user(n, &ua32->op); | ||
| 1562 | err |= put_user(n, &a->op); | ||
| 1563 | err |= get_user(n, &ua32->flags); | ||
| 1564 | err |= put_user(n, &a->flags); | ||
| 1565 | err |= get_user(n, &ua32->datalen); | ||
| 1566 | err |= put_user(n, &a->datalen); | ||
| 1567 | err |= get_user(udata, &ua32->data); | ||
| 1568 | err |= put_user(compat_ptr(udata), &a->data); | ||
| 1569 | if (err) | ||
| 1570 | return err; | ||
| 1571 | |||
| 1572 | return sys_ioctl(fd, cmd, (unsigned long)a); | ||
| 1573 | } | ||
| 1574 | #endif | ||
| 1575 | |||
| 1576 | static int ioc_settimeout(unsigned int fd, unsigned int cmd, unsigned long arg) | 1384 | static int ioc_settimeout(unsigned int fd, unsigned int cmd, unsigned long arg) |
| 1577 | { | 1385 | { |
| 1578 | return rw_long(fd, AUTOFS_IOC_SETTIMEOUT, arg); | 1386 | return rw_long(fd, AUTOFS_IOC_SETTIMEOUT, arg); |
| 1579 | } | 1387 | } |
| 1580 | 1388 | ||
| 1581 | #ifdef CONFIG_BLOCK | ||
| 1582 | /* Fix sizeof(sizeof()) breakage */ | ||
| 1583 | #define BLKBSZGET_32 _IOR(0x12,112,int) | ||
| 1584 | #define BLKBSZSET_32 _IOW(0x12,113,int) | ||
| 1585 | #define BLKGETSIZE64_32 _IOR(0x12,114,int) | ||
| 1586 | |||
| 1587 | static int do_blkbszget(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
| 1588 | { | ||
| 1589 | return sys_ioctl(fd, BLKBSZGET, (unsigned long)compat_ptr(arg)); | ||
| 1590 | } | ||
| 1591 | |||
| 1592 | static int do_blkbszset(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
| 1593 | { | ||
| 1594 | return sys_ioctl(fd, BLKBSZSET, (unsigned long)compat_ptr(arg)); | ||
| 1595 | } | ||
| 1596 | |||
| 1597 | static int do_blkgetsize64(unsigned int fd, unsigned int cmd, | ||
| 1598 | unsigned long arg) | ||
| 1599 | { | ||
| 1600 | return sys_ioctl(fd, BLKGETSIZE64, (unsigned long)compat_ptr(arg)); | ||
| 1601 | } | ||
| 1602 | #endif | ||
| 1603 | |||
| 1604 | /* Bluetooth ioctls */ | 1389 | /* Bluetooth ioctls */ |
| 1605 | #define HCIUARTSETPROTO _IOW('U', 200, int) | 1390 | #define HCIUARTSETPROTO _IOW('U', 200, int) |
| 1606 | #define HCIUARTGETPROTO _IOR('U', 201, int) | 1391 | #define HCIUARTGETPROTO _IOR('U', 201, int) |
| @@ -1620,333 +1405,6 @@ static int do_blkgetsize64(unsigned int fd, unsigned int cmd, | |||
| 1620 | #define HIDPGETCONNLIST _IOR('H', 210, int) | 1405 | #define HIDPGETCONNLIST _IOR('H', 210, int) |
| 1621 | #define HIDPGETCONNINFO _IOR('H', 211, int) | 1406 | #define HIDPGETCONNINFO _IOR('H', 211, int) |
| 1622 | 1407 | ||
| 1623 | #ifdef CONFIG_BLOCK | ||
| 1624 | struct floppy_struct32 { | ||
| 1625 | compat_uint_t size; | ||
| 1626 | compat_uint_t sect; | ||
| 1627 | compat_uint_t head; | ||
| 1628 | compat_uint_t track; | ||
| 1629 | compat_uint_t stretch; | ||
| 1630 | unsigned char gap; | ||
| 1631 | unsigned char rate; | ||
| 1632 | unsigned char spec1; | ||
| 1633 | unsigned char fmt_gap; | ||
| 1634 | const compat_caddr_t name; | ||
| 1635 | }; | ||
| 1636 | |||
| 1637 | struct floppy_drive_params32 { | ||
| 1638 | char cmos; | ||
| 1639 | compat_ulong_t max_dtr; | ||
| 1640 | compat_ulong_t hlt; | ||
| 1641 | compat_ulong_t hut; | ||
| 1642 | compat_ulong_t srt; | ||
| 1643 | compat_ulong_t spinup; | ||
| 1644 | compat_ulong_t spindown; | ||
| 1645 | unsigned char spindown_offset; | ||
| 1646 | unsigned char select_delay; | ||
| 1647 | unsigned char rps; | ||
| 1648 | unsigned char tracks; | ||
| 1649 | compat_ulong_t timeout; | ||
| 1650 | unsigned char interleave_sect; | ||
| 1651 | struct floppy_max_errors max_errors; | ||
| 1652 | char flags; | ||
| 1653 | char read_track; | ||
| 1654 | short autodetect[8]; | ||
| 1655 | compat_int_t checkfreq; | ||
| 1656 | compat_int_t native_format; | ||
| 1657 | }; | ||
| 1658 | |||
| 1659 | struct floppy_drive_struct32 { | ||
| 1660 | signed char flags; | ||
| 1661 | compat_ulong_t spinup_date; | ||
| 1662 | compat_ulong_t select_date; | ||
| 1663 | compat_ulong_t first_read_date; | ||
| 1664 | short probed_format; | ||
| 1665 | short track; | ||
| 1666 | short maxblock; | ||
| 1667 | short maxtrack; | ||
| 1668 | compat_int_t generation; | ||
| 1669 | compat_int_t keep_data; | ||
| 1670 | compat_int_t fd_ref; | ||
| 1671 | compat_int_t fd_device; | ||
| 1672 | compat_int_t last_checked; | ||
| 1673 | compat_caddr_t dmabuf; | ||
| 1674 | compat_int_t bufblocks; | ||
| 1675 | }; | ||
| 1676 | |||
| 1677 | struct floppy_fdc_state32 { | ||
| 1678 | compat_int_t spec1; | ||
| 1679 | compat_int_t spec2; | ||
| 1680 | compat_int_t dtr; | ||
| 1681 | unsigned char version; | ||
| 1682 | unsigned char dor; | ||
| 1683 | compat_ulong_t address; | ||
| 1684 | unsigned int rawcmd:2; | ||
| 1685 | unsigned int reset:1; | ||
| 1686 | unsigned int need_configure:1; | ||
| 1687 | unsigned int perp_mode:2; | ||
| 1688 | unsigned int has_fifo:1; | ||
| 1689 | unsigned int driver_version; | ||
| 1690 | unsigned char track[4]; | ||
| 1691 | }; | ||
| 1692 | |||
| 1693 | struct floppy_write_errors32 { | ||
| 1694 | unsigned int write_errors; | ||
| 1695 | compat_ulong_t first_error_sector; | ||
| 1696 | compat_int_t first_error_generation; | ||
| 1697 | compat_ulong_t last_error_sector; | ||
| 1698 | compat_int_t last_error_generation; | ||
| 1699 | compat_uint_t badness; | ||
| 1700 | }; | ||
| 1701 | |||
| 1702 | #define FDSETPRM32 _IOW(2, 0x42, struct floppy_struct32) | ||
| 1703 | #define FDDEFPRM32 _IOW(2, 0x43, struct floppy_struct32) | ||
| 1704 | #define FDGETPRM32 _IOR(2, 0x04, struct floppy_struct32) | ||
| 1705 | #define FDSETDRVPRM32 _IOW(2, 0x90, struct floppy_drive_params32) | ||
| 1706 | #define FDGETDRVPRM32 _IOR(2, 0x11, struct floppy_drive_params32) | ||
| 1707 | #define FDGETDRVSTAT32 _IOR(2, 0x12, struct floppy_drive_struct32) | ||
| 1708 | #define FDPOLLDRVSTAT32 _IOR(2, 0x13, struct floppy_drive_struct32) | ||
| 1709 | #define FDGETFDCSTAT32 _IOR(2, 0x15, struct floppy_fdc_state32) | ||
| 1710 | #define FDWERRORGET32 _IOR(2, 0x17, struct floppy_write_errors32) | ||
| 1711 | |||
| 1712 | static struct { | ||
| 1713 | unsigned int cmd32; | ||
| 1714 | unsigned int cmd; | ||
| 1715 | } fd_ioctl_trans_table[] = { | ||
| 1716 | { FDSETPRM32, FDSETPRM }, | ||
| 1717 | { FDDEFPRM32, FDDEFPRM }, | ||
| 1718 | { FDGETPRM32, FDGETPRM }, | ||
| 1719 | { FDSETDRVPRM32, FDSETDRVPRM }, | ||
| 1720 | { FDGETDRVPRM32, FDGETDRVPRM }, | ||
| 1721 | { FDGETDRVSTAT32, FDGETDRVSTAT }, | ||
| 1722 | { FDPOLLDRVSTAT32, FDPOLLDRVSTAT }, | ||
| 1723 | { FDGETFDCSTAT32, FDGETFDCSTAT }, | ||
| 1724 | { FDWERRORGET32, FDWERRORGET } | ||
| 1725 | }; | ||
| 1726 | |||
| 1727 | #define NR_FD_IOCTL_TRANS ARRAY_SIZE(fd_ioctl_trans_table) | ||
| 1728 | |||
| 1729 | static int fd_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg) | ||
| 1730 | { | ||
| 1731 | mm_segment_t old_fs = get_fs(); | ||
| 1732 | void *karg = NULL; | ||
| 1733 | unsigned int kcmd = 0; | ||
| 1734 | int i, err; | ||
| 1735 | |||
| 1736 | for (i = 0; i < NR_FD_IOCTL_TRANS; i++) | ||
| 1737 | if (cmd == fd_ioctl_trans_table[i].cmd32) { | ||
| 1738 | kcmd = fd_ioctl_trans_table[i].cmd; | ||
| 1739 | break; | ||
| 1740 | } | ||
| 1741 | if (!kcmd) | ||
| 1742 | return -EINVAL; | ||
| 1743 | |||
| 1744 | switch (cmd) { | ||
| 1745 | case FDSETPRM32: | ||
| 1746 | case FDDEFPRM32: | ||
| 1747 | case FDGETPRM32: | ||
| 1748 | { | ||
| 1749 | compat_uptr_t name; | ||
| 1750 | struct floppy_struct32 __user *uf; | ||
| 1751 | struct floppy_struct *f; | ||
| 1752 | |||
| 1753 | uf = compat_ptr(arg); | ||
| 1754 | f = karg = kmalloc(sizeof(struct floppy_struct), GFP_KERNEL); | ||
| 1755 | if (!karg) | ||
| 1756 | return -ENOMEM; | ||
| 1757 | if (cmd == FDGETPRM32) | ||
| 1758 | break; | ||
| 1759 | err = __get_user(f->size, &uf->size); | ||
| 1760 | err |= __get_user(f->sect, &uf->sect); | ||
| 1761 | err |= __get_user(f->head, &uf->head); | ||
| 1762 | err |= __get_user(f->track, &uf->track); | ||
| 1763 | err |= __get_user(f->stretch, &uf->stretch); | ||
| 1764 | err |= __get_user(f->gap, &uf->gap); | ||
| 1765 | err |= __get_user(f->rate, &uf->rate); | ||
| 1766 | err |= __get_user(f->spec1, &uf->spec1); | ||
| 1767 | err |= __get_user(f->fmt_gap, &uf->fmt_gap); | ||
| 1768 | err |= __get_user(name, &uf->name); | ||
| 1769 | f->name = compat_ptr(name); | ||
| 1770 | if (err) { | ||
| 1771 | err = -EFAULT; | ||
| 1772 | goto out; | ||
| 1773 | } | ||
| 1774 | break; | ||
| 1775 | } | ||
| 1776 | case FDSETDRVPRM32: | ||
| 1777 | case FDGETDRVPRM32: | ||
| 1778 | { | ||
| 1779 | struct floppy_drive_params32 __user *uf; | ||
| 1780 | struct floppy_drive_params *f; | ||
| 1781 | |||
| 1782 | uf = compat_ptr(arg); | ||
| 1783 | f = karg = kmalloc(sizeof(struct floppy_drive_params), GFP_KERNEL); | ||
| 1784 | if (!karg) | ||
| 1785 | return -ENOMEM; | ||
| 1786 | if (cmd == FDGETDRVPRM32) | ||
| 1787 | break; | ||
| 1788 | err = __get_user(f->cmos, &uf->cmos); | ||
| 1789 | err |= __get_user(f->max_dtr, &uf->max_dtr); | ||
| 1790 | err |= __get_user(f->hlt, &uf->hlt); | ||
| 1791 | err |= __get_user(f->hut, &uf->hut); | ||
| 1792 | err |= __get_user(f->srt, &uf->srt); | ||
| 1793 | err |= __get_user(f->spinup, &uf->spinup); | ||
| 1794 | err |= __get_user(f->spindown, &uf->spindown); | ||
| 1795 | err |= __get_user(f->spindown_offset, &uf->spindown_offset); | ||
| 1796 | err |= __get_user(f->select_delay, &uf->select_delay); | ||
| 1797 | err |= __get_user(f->rps, &uf->rps); | ||
| 1798 | err |= __get_user(f->tracks, &uf->tracks); | ||
| 1799 | err |= __get_user(f->timeout, &uf->timeout); | ||
| 1800 | err |= __get_user(f->interleave_sect, &uf->interleave_sect); | ||
| 1801 | err |= __copy_from_user(&f->max_errors, &uf->max_errors, sizeof(f->max_errors)); | ||
| 1802 | err |= __get_user(f->flags, &uf->flags); | ||
| 1803 | err |= __get_user(f->read_track, &uf->read_track); | ||
| 1804 | err |= __copy_from_user(f->autodetect, uf->autodetect, sizeof(f->autodetect)); | ||
| 1805 | err |= __get_user(f->checkfreq, &uf->checkfreq); | ||
| 1806 | err |= __get_user(f->native_format, &uf->native_format); | ||
| 1807 | if (err) { | ||
| 1808 | err = -EFAULT; | ||
| 1809 | goto out; | ||
| 1810 | } | ||
| 1811 | break; | ||
| 1812 | } | ||
| 1813 | case FDGETDRVSTAT32: | ||
| 1814 | case FDPOLLDRVSTAT32: | ||
| 1815 | karg = kmalloc(sizeof(struct floppy_drive_struct), GFP_KERNEL); | ||
| 1816 | if (!karg) | ||
| 1817 | return -ENOMEM; | ||
| 1818 | break; | ||
| 1819 | case FDGETFDCSTAT32: | ||
| 1820 | karg = kmalloc(sizeof(struct floppy_fdc_state), GFP_KERNEL); | ||
| 1821 | if (!karg) | ||
| 1822 | return -ENOMEM; | ||
| 1823 | break; | ||
| 1824 | case FDWERRORGET32: | ||
| 1825 | karg = kmalloc(sizeof(struct floppy_write_errors), GFP_KERNEL); | ||
| 1826 | if (!karg) | ||
| 1827 | return -ENOMEM; | ||
| 1828 | break; | ||
| 1829 | default: | ||
| 1830 | return -EINVAL; | ||
| 1831 | } | ||
| 1832 | set_fs (KERNEL_DS); | ||
| 1833 | err = sys_ioctl (fd, kcmd, (unsigned long)karg); | ||
| 1834 | set_fs (old_fs); | ||
| 1835 | if (err) | ||
| 1836 | goto out; | ||
| 1837 | switch (cmd) { | ||
| 1838 | case FDGETPRM32: | ||
| 1839 | { | ||
| 1840 | struct floppy_struct *f = karg; | ||
| 1841 | struct floppy_struct32 __user *uf = compat_ptr(arg); | ||
| 1842 | |||
| 1843 | err = __put_user(f->size, &uf->size); | ||
| 1844 | err |= __put_user(f->sect, &uf->sect); | ||
| 1845 | err |= __put_user(f->head, &uf->head); | ||
| 1846 | err |= __put_user(f->track, &uf->track); | ||
| 1847 | err |= __put_user(f->stretch, &uf->stretch); | ||
| 1848 | err |= __put_user(f->gap, &uf->gap); | ||
| 1849 | err |= __put_user(f->rate, &uf->rate); | ||
| 1850 | err |= __put_user(f->spec1, &uf->spec1); | ||
| 1851 | err |= __put_user(f->fmt_gap, &uf->fmt_gap); | ||
| 1852 | err |= __put_user((u64)f->name, (compat_caddr_t __user *)&uf->name); | ||
| 1853 | break; | ||
| 1854 | } | ||
| 1855 | case FDGETDRVPRM32: | ||
| 1856 | { | ||
| 1857 | struct floppy_drive_params32 __user *uf; | ||
| 1858 | struct floppy_drive_params *f = karg; | ||
| 1859 | |||
| 1860 | uf = compat_ptr(arg); | ||
| 1861 | err = __put_user(f->cmos, &uf->cmos); | ||
| 1862 | err |= __put_user(f->max_dtr, &uf->max_dtr); | ||
| 1863 | err |= __put_user(f->hlt, &uf->hlt); | ||
| 1864 | err |= __put_user(f->hut, &uf->hut); | ||
| 1865 | err |= __put_user(f->srt, &uf->srt); | ||
| 1866 | err |= __put_user(f->spinup, &uf->spinup); | ||
| 1867 | err |= __put_user(f->spindown, &uf->spindown); | ||
| 1868 | err |= __put_user(f->spindown_offset, &uf->spindown_offset); | ||
| 1869 | err |= __put_user(f->select_delay, &uf->select_delay); | ||
| 1870 | err |= __put_user(f->rps, &uf->rps); | ||
| 1871 | err |= __put_user(f->tracks, &uf->tracks); | ||
| 1872 | err |= __put_user(f->timeout, &uf->timeout); | ||
| 1873 | err |= __put_user(f->interleave_sect, &uf->interleave_sect); | ||
| 1874 | err |= __copy_to_user(&uf->max_errors, &f->max_errors, sizeof(f->max_errors)); | ||
| 1875 | err |= __put_user(f->flags, &uf->flags); | ||
| 1876 | err |= __put_user(f->read_track, &uf->read_track); | ||
| 1877 | err |= __copy_to_user(uf->autodetect, f->autodetect, sizeof(f->autodetect)); | ||
| 1878 | err |= __put_user(f->checkfreq, &uf->checkfreq); | ||
| 1879 | err |= __put_user(f->native_format, &uf->native_format); | ||
| 1880 | break; | ||
| 1881 | } | ||
| 1882 | case FDGETDRVSTAT32: | ||
| 1883 | case FDPOLLDRVSTAT32: | ||
| 1884 | { | ||
| 1885 | struct floppy_drive_struct32 __user *uf; | ||
| 1886 | struct floppy_drive_struct *f = karg; | ||
| 1887 | |||
| 1888 | uf = compat_ptr(arg); | ||
| 1889 | err = __put_user(f->flags, &uf->flags); | ||
| 1890 | err |= __put_user(f->spinup_date, &uf->spinup_date); | ||
| 1891 | err |= __put_user(f->select_date, &uf->select_date); | ||
| 1892 | err |= __put_user(f->first_read_date, &uf->first_read_date); | ||
| 1893 | err |= __put_user(f->probed_format, &uf->probed_format); | ||
| 1894 | err |= __put_user(f->track, &uf->track); | ||
| 1895 | err |= __put_user(f->maxblock, &uf->maxblock); | ||
| 1896 | err |= __put_user(f->maxtrack, &uf->maxtrack); | ||
| 1897 | err |= __put_user(f->generation, &uf->generation); | ||
| 1898 | err |= __put_user(f->keep_data, &uf->keep_data); | ||
| 1899 | err |= __put_user(f->fd_ref, &uf->fd_ref); | ||
| 1900 | err |= __put_user(f->fd_device, &uf->fd_device); | ||
| 1901 | err |= __put_user(f->last_checked, &uf->last_checked); | ||
| 1902 | err |= __put_user((u64)f->dmabuf, &uf->dmabuf); | ||
| 1903 | err |= __put_user((u64)f->bufblocks, &uf->bufblocks); | ||
| 1904 | break; | ||
| 1905 | } | ||
| 1906 | case FDGETFDCSTAT32: | ||
| 1907 | { | ||
| 1908 | struct floppy_fdc_state32 __user *uf; | ||
| 1909 | struct floppy_fdc_state *f = karg; | ||
| 1910 | |||
| 1911 | uf = compat_ptr(arg); | ||
| 1912 | err = __put_user(f->spec1, &uf->spec1); | ||
| 1913 | err |= __put_user(f->spec2, &uf->spec2); | ||
| 1914 | err |= __put_user(f->dtr, &uf->dtr); | ||
| 1915 | err |= __put_user(f->version, &uf->version); | ||
| 1916 | err |= __put_user(f->dor, &uf->dor); | ||
| 1917 | err |= __put_user(f->address, &uf->address); | ||
| 1918 | err |= __copy_to_user((char __user *)&uf->address + sizeof(uf->address), | ||
| 1919 | (char *)&f->address + sizeof(f->address), sizeof(int)); | ||
| 1920 | err |= __put_user(f->driver_version, &uf->driver_version); | ||
| 1921 | err |= __copy_to_user(uf->track, f->track, sizeof(f->track)); | ||
| 1922 | break; | ||
| 1923 | } | ||
| 1924 | case FDWERRORGET32: | ||
| 1925 | { | ||
| 1926 | struct floppy_write_errors32 __user *uf; | ||
| 1927 | struct floppy_write_errors *f = karg; | ||
| 1928 | |||
| 1929 | uf = compat_ptr(arg); | ||
| 1930 | err = __put_user(f->write_errors, &uf->write_errors); | ||
| 1931 | err |= __put_user(f->first_error_sector, &uf->first_error_sector); | ||
| 1932 | err |= __put_user(f->first_error_generation, &uf->first_error_generation); | ||
| 1933 | err |= __put_user(f->last_error_sector, &uf->last_error_sector); | ||
| 1934 | err |= __put_user(f->last_error_generation, &uf->last_error_generation); | ||
| 1935 | err |= __put_user(f->badness, &uf->badness); | ||
| 1936 | break; | ||
| 1937 | } | ||
| 1938 | default: | ||
| 1939 | break; | ||
| 1940 | } | ||
| 1941 | if (err) | ||
| 1942 | err = -EFAULT; | ||
| 1943 | |||
| 1944 | out: | ||
| 1945 | kfree(karg); | ||
| 1946 | return err; | ||
| 1947 | } | ||
| 1948 | #endif | ||
| 1949 | |||
| 1950 | struct mtd_oob_buf32 { | 1408 | struct mtd_oob_buf32 { |
| 1951 | u_int32_t start; | 1409 | u_int32_t start; |
| 1952 | u_int32_t length; | 1410 | u_int32_t length; |
| @@ -2506,60 +1964,6 @@ COMPATIBLE_IOCTL(FIONREAD) /* This is also TIOCINQ */ | |||
| 2506 | /* 0x00 */ | 1964 | /* 0x00 */ |
| 2507 | COMPATIBLE_IOCTL(FIBMAP) | 1965 | COMPATIBLE_IOCTL(FIBMAP) |
| 2508 | COMPATIBLE_IOCTL(FIGETBSZ) | 1966 | COMPATIBLE_IOCTL(FIGETBSZ) |
| 2509 | /* 0x03 -- HD/IDE ioctl's used by hdparm and friends. | ||
| 2510 | * Some need translations, these do not. | ||
| 2511 | */ | ||
| 2512 | COMPATIBLE_IOCTL(HDIO_GET_IDENTITY) | ||
| 2513 | COMPATIBLE_IOCTL(HDIO_DRIVE_TASK) | ||
| 2514 | COMPATIBLE_IOCTL(HDIO_DRIVE_CMD) | ||
| 2515 | ULONG_IOCTL(HDIO_SET_MULTCOUNT) | ||
| 2516 | ULONG_IOCTL(HDIO_SET_UNMASKINTR) | ||
| 2517 | ULONG_IOCTL(HDIO_SET_KEEPSETTINGS) | ||
| 2518 | ULONG_IOCTL(HDIO_SET_32BIT) | ||
| 2519 | ULONG_IOCTL(HDIO_SET_NOWERR) | ||
| 2520 | ULONG_IOCTL(HDIO_SET_DMA) | ||
| 2521 | ULONG_IOCTL(HDIO_SET_PIO_MODE) | ||
| 2522 | ULONG_IOCTL(HDIO_SET_NICE) | ||
| 2523 | ULONG_IOCTL(HDIO_SET_WCACHE) | ||
| 2524 | ULONG_IOCTL(HDIO_SET_ACOUSTIC) | ||
| 2525 | ULONG_IOCTL(HDIO_SET_BUSSTATE) | ||
| 2526 | ULONG_IOCTL(HDIO_SET_ADDRESS) | ||
| 2527 | COMPATIBLE_IOCTL(HDIO_SCAN_HWIF) | ||
| 2528 | /* 0x330 is reserved -- it used to be HDIO_GETGEO_BIG */ | ||
| 2529 | COMPATIBLE_IOCTL(0x330) | ||
| 2530 | /* 0x02 -- Floppy ioctls */ | ||
| 2531 | COMPATIBLE_IOCTL(FDMSGON) | ||
| 2532 | COMPATIBLE_IOCTL(FDMSGOFF) | ||
| 2533 | COMPATIBLE_IOCTL(FDSETEMSGTRESH) | ||
| 2534 | COMPATIBLE_IOCTL(FDFLUSH) | ||
| 2535 | COMPATIBLE_IOCTL(FDWERRORCLR) | ||
| 2536 | COMPATIBLE_IOCTL(FDSETMAXERRS) | ||
| 2537 | COMPATIBLE_IOCTL(FDGETMAXERRS) | ||
| 2538 | COMPATIBLE_IOCTL(FDGETDRVTYP) | ||
| 2539 | COMPATIBLE_IOCTL(FDEJECT) | ||
| 2540 | COMPATIBLE_IOCTL(FDCLRPRM) | ||
| 2541 | COMPATIBLE_IOCTL(FDFMTBEG) | ||
| 2542 | COMPATIBLE_IOCTL(FDFMTEND) | ||
| 2543 | COMPATIBLE_IOCTL(FDRESET) | ||
| 2544 | COMPATIBLE_IOCTL(FDTWADDLE) | ||
| 2545 | COMPATIBLE_IOCTL(FDFMTTRK) | ||
| 2546 | COMPATIBLE_IOCTL(FDRAWCMD) | ||
| 2547 | /* 0x12 */ | ||
| 2548 | #ifdef CONFIG_BLOCK | ||
| 2549 | COMPATIBLE_IOCTL(BLKRASET) | ||
| 2550 | COMPATIBLE_IOCTL(BLKROSET) | ||
| 2551 | COMPATIBLE_IOCTL(BLKROGET) | ||
| 2552 | COMPATIBLE_IOCTL(BLKRRPART) | ||
| 2553 | COMPATIBLE_IOCTL(BLKFLSBUF) | ||
| 2554 | COMPATIBLE_IOCTL(BLKSECTSET) | ||
| 2555 | COMPATIBLE_IOCTL(BLKSSZGET) | ||
| 2556 | COMPATIBLE_IOCTL(BLKTRACESTART) | ||
| 2557 | COMPATIBLE_IOCTL(BLKTRACESTOP) | ||
| 2558 | COMPATIBLE_IOCTL(BLKTRACESETUP) | ||
| 2559 | COMPATIBLE_IOCTL(BLKTRACETEARDOWN) | ||
| 2560 | ULONG_IOCTL(BLKRASET) | ||
| 2561 | ULONG_IOCTL(BLKFRASET) | ||
| 2562 | #endif | ||
| 2563 | /* RAID */ | 1967 | /* RAID */ |
| 2564 | COMPATIBLE_IOCTL(RAID_VERSION) | 1968 | COMPATIBLE_IOCTL(RAID_VERSION) |
| 2565 | COMPATIBLE_IOCTL(GET_ARRAY_INFO) | 1969 | COMPATIBLE_IOCTL(GET_ARRAY_INFO) |
| @@ -2807,50 +2211,6 @@ COMPATIBLE_IOCTL(PPGETMODE) | |||
| 2807 | COMPATIBLE_IOCTL(PPGETPHASE) | 2211 | COMPATIBLE_IOCTL(PPGETPHASE) |
| 2808 | COMPATIBLE_IOCTL(PPGETFLAGS) | 2212 | COMPATIBLE_IOCTL(PPGETFLAGS) |
| 2809 | COMPATIBLE_IOCTL(PPSETFLAGS) | 2213 | COMPATIBLE_IOCTL(PPSETFLAGS) |
| 2810 | /* CDROM stuff */ | ||
| 2811 | COMPATIBLE_IOCTL(CDROMPAUSE) | ||
| 2812 | COMPATIBLE_IOCTL(CDROMRESUME) | ||
| 2813 | COMPATIBLE_IOCTL(CDROMPLAYMSF) | ||
| 2814 | COMPATIBLE_IOCTL(CDROMPLAYTRKIND) | ||
| 2815 | COMPATIBLE_IOCTL(CDROMREADTOCHDR) | ||
| 2816 | COMPATIBLE_IOCTL(CDROMREADTOCENTRY) | ||
| 2817 | COMPATIBLE_IOCTL(CDROMSTOP) | ||
| 2818 | COMPATIBLE_IOCTL(CDROMSTART) | ||
| 2819 | COMPATIBLE_IOCTL(CDROMEJECT) | ||
| 2820 | COMPATIBLE_IOCTL(CDROMVOLCTRL) | ||
| 2821 | COMPATIBLE_IOCTL(CDROMSUBCHNL) | ||
| 2822 | ULONG_IOCTL(CDROMEJECT_SW) | ||
| 2823 | COMPATIBLE_IOCTL(CDROMMULTISESSION) | ||
| 2824 | COMPATIBLE_IOCTL(CDROM_GET_MCN) | ||
| 2825 | COMPATIBLE_IOCTL(CDROMRESET) | ||
| 2826 | COMPATIBLE_IOCTL(CDROMVOLREAD) | ||
| 2827 | COMPATIBLE_IOCTL(CDROMSEEK) | ||
| 2828 | COMPATIBLE_IOCTL(CDROMPLAYBLK) | ||
| 2829 | COMPATIBLE_IOCTL(CDROMCLOSETRAY) | ||
| 2830 | ULONG_IOCTL(CDROM_SET_OPTIONS) | ||
| 2831 | ULONG_IOCTL(CDROM_CLEAR_OPTIONS) | ||
| 2832 | ULONG_IOCTL(CDROM_SELECT_SPEED) | ||
| 2833 | ULONG_IOCTL(CDROM_SELECT_DISC) | ||
| 2834 | ULONG_IOCTL(CDROM_MEDIA_CHANGED) | ||
| 2835 | ULONG_IOCTL(CDROM_DRIVE_STATUS) | ||
| 2836 | COMPATIBLE_IOCTL(CDROM_DISC_STATUS) | ||
| 2837 | COMPATIBLE_IOCTL(CDROM_CHANGER_NSLOTS) | ||
| 2838 | ULONG_IOCTL(CDROM_LOCKDOOR) | ||
| 2839 | ULONG_IOCTL(CDROM_DEBUG) | ||
| 2840 | COMPATIBLE_IOCTL(CDROM_GET_CAPABILITY) | ||
| 2841 | /* Ignore cdrom.h about these next 5 ioctls, they absolutely do | ||
| 2842 | * not take a struct cdrom_read, instead they take a struct cdrom_msf | ||
| 2843 | * which is compatible. | ||
| 2844 | */ | ||
| 2845 | COMPATIBLE_IOCTL(CDROMREADMODE2) | ||
| 2846 | COMPATIBLE_IOCTL(CDROMREADMODE1) | ||
| 2847 | COMPATIBLE_IOCTL(CDROMREADRAW) | ||
| 2848 | COMPATIBLE_IOCTL(CDROMREADCOOKED) | ||
| 2849 | COMPATIBLE_IOCTL(CDROMREADALL) | ||
| 2850 | /* DVD ioctls */ | ||
| 2851 | COMPATIBLE_IOCTL(DVD_READ_STRUCT) | ||
| 2852 | COMPATIBLE_IOCTL(DVD_WRITE_STRUCT) | ||
| 2853 | COMPATIBLE_IOCTL(DVD_AUTH) | ||
| 2854 | /* pktcdvd */ | 2214 | /* pktcdvd */ |
| 2855 | COMPATIBLE_IOCTL(PACKET_CTRL_CMD) | 2215 | COMPATIBLE_IOCTL(PACKET_CTRL_CMD) |
| 2856 | /* Big A */ | 2216 | /* Big A */ |
| @@ -3336,33 +2696,6 @@ HANDLE_IOCTL(SIOCGSTAMP, do_siocgstamp) | |||
| 3336 | HANDLE_IOCTL(SIOCGSTAMPNS, do_siocgstampns) | 2696 | HANDLE_IOCTL(SIOCGSTAMPNS, do_siocgstampns) |
| 3337 | #endif | 2697 | #endif |
| 3338 | #ifdef CONFIG_BLOCK | 2698 | #ifdef CONFIG_BLOCK |
| 3339 | HANDLE_IOCTL(HDIO_GETGEO, hdio_getgeo) | ||
| 3340 | HANDLE_IOCTL(BLKRAGET, w_long) | ||
| 3341 | HANDLE_IOCTL(BLKGETSIZE, w_long) | ||
| 3342 | HANDLE_IOCTL(0x1260, broken_blkgetsize) | ||
| 3343 | HANDLE_IOCTL(BLKFRAGET, w_long) | ||
| 3344 | HANDLE_IOCTL(BLKSECTGET, w_long) | ||
| 3345 | HANDLE_IOCTL(BLKPG, blkpg_ioctl_trans) | ||
| 3346 | HANDLE_IOCTL(HDIO_GET_UNMASKINTR, hdio_ioctl_trans) | ||
| 3347 | HANDLE_IOCTL(HDIO_GET_MULTCOUNT, hdio_ioctl_trans) | ||
| 3348 | HANDLE_IOCTL(HDIO_GET_KEEPSETTINGS, hdio_ioctl_trans) | ||
| 3349 | HANDLE_IOCTL(HDIO_GET_32BIT, hdio_ioctl_trans) | ||
| 3350 | HANDLE_IOCTL(HDIO_GET_NOWERR, hdio_ioctl_trans) | ||
| 3351 | HANDLE_IOCTL(HDIO_GET_DMA, hdio_ioctl_trans) | ||
| 3352 | HANDLE_IOCTL(HDIO_GET_NICE, hdio_ioctl_trans) | ||
| 3353 | HANDLE_IOCTL(HDIO_GET_WCACHE, hdio_ioctl_trans) | ||
| 3354 | HANDLE_IOCTL(HDIO_GET_ACOUSTIC, hdio_ioctl_trans) | ||
| 3355 | HANDLE_IOCTL(HDIO_GET_ADDRESS, hdio_ioctl_trans) | ||
| 3356 | HANDLE_IOCTL(HDIO_GET_BUSSTATE, hdio_ioctl_trans) | ||
| 3357 | HANDLE_IOCTL(FDSETPRM32, fd_ioctl_trans) | ||
| 3358 | HANDLE_IOCTL(FDDEFPRM32, fd_ioctl_trans) | ||
| 3359 | HANDLE_IOCTL(FDGETPRM32, fd_ioctl_trans) | ||
| 3360 | HANDLE_IOCTL(FDSETDRVPRM32, fd_ioctl_trans) | ||
| 3361 | HANDLE_IOCTL(FDGETDRVPRM32, fd_ioctl_trans) | ||
| 3362 | HANDLE_IOCTL(FDGETDRVSTAT32, fd_ioctl_trans) | ||
| 3363 | HANDLE_IOCTL(FDPOLLDRVSTAT32, fd_ioctl_trans) | ||
| 3364 | HANDLE_IOCTL(FDGETFDCSTAT32, fd_ioctl_trans) | ||
| 3365 | HANDLE_IOCTL(FDWERRORGET32, fd_ioctl_trans) | ||
| 3366 | HANDLE_IOCTL(SG_IO,sg_ioctl_trans) | 2699 | HANDLE_IOCTL(SG_IO,sg_ioctl_trans) |
| 3367 | HANDLE_IOCTL(SG_GET_REQUEST_TABLE, sg_grt_trans) | 2700 | HANDLE_IOCTL(SG_GET_REQUEST_TABLE, sg_grt_trans) |
| 3368 | #endif | 2701 | #endif |
| @@ -3373,8 +2706,6 @@ HANDLE_IOCTL(PPPIOCSACTIVE32, ppp_sock_fprog_ioctl_trans) | |||
| 3373 | #ifdef CONFIG_BLOCK | 2706 | #ifdef CONFIG_BLOCK |
| 3374 | HANDLE_IOCTL(MTIOCGET32, mt_ioctl_trans) | 2707 | HANDLE_IOCTL(MTIOCGET32, mt_ioctl_trans) |
| 3375 | HANDLE_IOCTL(MTIOCPOS32, mt_ioctl_trans) | 2708 | HANDLE_IOCTL(MTIOCPOS32, mt_ioctl_trans) |
| 3376 | HANDLE_IOCTL(CDROMREADAUDIO, cdrom_ioctl_trans) | ||
| 3377 | HANDLE_IOCTL(CDROM_SEND_PACKET, cdrom_ioctl_trans) | ||
| 3378 | #endif | 2709 | #endif |
| 3379 | #define AUTOFS_IOC_SETTIMEOUT32 _IOWR(0x93,0x64,unsigned int) | 2710 | #define AUTOFS_IOC_SETTIMEOUT32 _IOWR(0x93,0x64,unsigned int) |
| 3380 | HANDLE_IOCTL(AUTOFS_IOC_SETTIMEOUT32, ioc_settimeout) | 2711 | HANDLE_IOCTL(AUTOFS_IOC_SETTIMEOUT32, ioc_settimeout) |
| @@ -3415,9 +2746,6 @@ HANDLE_IOCTL(SONET_GETFRAMING, do_atm_ioctl) | |||
| 3415 | HANDLE_IOCTL(SONET_GETFRSENSE, do_atm_ioctl) | 2746 | HANDLE_IOCTL(SONET_GETFRSENSE, do_atm_ioctl) |
| 3416 | /* block stuff */ | 2747 | /* block stuff */ |
| 3417 | #ifdef CONFIG_BLOCK | 2748 | #ifdef CONFIG_BLOCK |
| 3418 | HANDLE_IOCTL(BLKBSZGET_32, do_blkbszget) | ||
| 3419 | HANDLE_IOCTL(BLKBSZSET_32, do_blkbszset) | ||
| 3420 | HANDLE_IOCTL(BLKGETSIZE64_32, do_blkgetsize64) | ||
| 3421 | /* Raw devices */ | 2749 | /* Raw devices */ |
| 3422 | HANDLE_IOCTL(RAW_SETBIND, raw_ioctl) | 2750 | HANDLE_IOCTL(RAW_SETBIND, raw_ioctl) |
| 3423 | HANDLE_IOCTL(RAW_GETBIND, raw_ioctl) | 2751 | HANDLE_IOCTL(RAW_GETBIND, raw_ioctl) |
diff --git a/fs/direct-io.c b/fs/direct-io.c index 901dc55e9f54..b5928a7b6a5a 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c | |||
| @@ -264,15 +264,12 @@ static int dio_bio_complete(struct dio *dio, struct bio *bio); | |||
| 264 | /* | 264 | /* |
| 265 | * Asynchronous IO callback. | 265 | * Asynchronous IO callback. |
| 266 | */ | 266 | */ |
| 267 | static int dio_bio_end_aio(struct bio *bio, unsigned int bytes_done, int error) | 267 | static void dio_bio_end_aio(struct bio *bio, int error) |
| 268 | { | 268 | { |
| 269 | struct dio *dio = bio->bi_private; | 269 | struct dio *dio = bio->bi_private; |
| 270 | unsigned long remaining; | 270 | unsigned long remaining; |
| 271 | unsigned long flags; | 271 | unsigned long flags; |
| 272 | 272 | ||
| 273 | if (bio->bi_size) | ||
| 274 | return 1; | ||
| 275 | |||
| 276 | /* cleanup the bio */ | 273 | /* cleanup the bio */ |
| 277 | dio_bio_complete(dio, bio); | 274 | dio_bio_complete(dio, bio); |
| 278 | 275 | ||
| @@ -287,8 +284,6 @@ static int dio_bio_end_aio(struct bio *bio, unsigned int bytes_done, int error) | |||
| 287 | aio_complete(dio->iocb, ret, 0); | 284 | aio_complete(dio->iocb, ret, 0); |
| 288 | kfree(dio); | 285 | kfree(dio); |
| 289 | } | 286 | } |
| 290 | |||
| 291 | return 0; | ||
| 292 | } | 287 | } |
| 293 | 288 | ||
| 294 | /* | 289 | /* |
| @@ -298,21 +293,17 @@ static int dio_bio_end_aio(struct bio *bio, unsigned int bytes_done, int error) | |||
| 298 | * During I/O bi_private points at the dio. After I/O, bi_private is used to | 293 | * During I/O bi_private points at the dio. After I/O, bi_private is used to |
| 299 | * implement a singly-linked list of completed BIOs, at dio->bio_list. | 294 | * implement a singly-linked list of completed BIOs, at dio->bio_list. |
| 300 | */ | 295 | */ |
| 301 | static int dio_bio_end_io(struct bio *bio, unsigned int bytes_done, int error) | 296 | static void dio_bio_end_io(struct bio *bio, int error) |
| 302 | { | 297 | { |
| 303 | struct dio *dio = bio->bi_private; | 298 | struct dio *dio = bio->bi_private; |
| 304 | unsigned long flags; | 299 | unsigned long flags; |
| 305 | 300 | ||
| 306 | if (bio->bi_size) | ||
| 307 | return 1; | ||
| 308 | |||
| 309 | spin_lock_irqsave(&dio->bio_lock, flags); | 301 | spin_lock_irqsave(&dio->bio_lock, flags); |
| 310 | bio->bi_private = dio->bio_list; | 302 | bio->bi_private = dio->bio_list; |
| 311 | dio->bio_list = bio; | 303 | dio->bio_list = bio; |
| 312 | if (--dio->refcount == 1 && dio->waiter) | 304 | if (--dio->refcount == 1 && dio->waiter) |
| 313 | wake_up_process(dio->waiter); | 305 | wake_up_process(dio->waiter); |
| 314 | spin_unlock_irqrestore(&dio->bio_lock, flags); | 306 | spin_unlock_irqrestore(&dio->bio_lock, flags); |
| 315 | return 0; | ||
| 316 | } | 307 | } |
| 317 | 308 | ||
| 318 | static int | 309 | static int |
diff --git a/fs/ecryptfs/netlink.c b/fs/ecryptfs/netlink.c index fe9186312d7c..9aa345121e09 100644 --- a/fs/ecryptfs/netlink.c +++ b/fs/ecryptfs/netlink.c | |||
| @@ -165,22 +165,10 @@ static int ecryptfs_process_nl_quit(struct sk_buff *skb) | |||
| 165 | * it to its desired netlink context element and wake up the process | 165 | * it to its desired netlink context element and wake up the process |
| 166 | * that is waiting for a response. | 166 | * that is waiting for a response. |
| 167 | */ | 167 | */ |
| 168 | static void ecryptfs_receive_nl_message(struct sock *sk, int len) | 168 | static void ecryptfs_receive_nl_message(struct sk_buff *skb) |
| 169 | { | 169 | { |
| 170 | struct sk_buff *skb; | ||
| 171 | struct nlmsghdr *nlh; | 170 | struct nlmsghdr *nlh; |
| 172 | int rc = 0; /* skb_recv_datagram requires this */ | ||
| 173 | 171 | ||
| 174 | receive: | ||
| 175 | skb = skb_recv_datagram(sk, 0, 0, &rc); | ||
| 176 | if (rc == -EINTR) | ||
| 177 | goto receive; | ||
| 178 | else if (rc < 0) { | ||
| 179 | ecryptfs_printk(KERN_ERR, "Error occurred while " | ||
| 180 | "receiving eCryptfs netlink message; " | ||
| 181 | "rc = [%d]\n", rc); | ||
| 182 | return; | ||
| 183 | } | ||
| 184 | nlh = nlmsg_hdr(skb); | 172 | nlh = nlmsg_hdr(skb); |
| 185 | if (!NLMSG_OK(nlh, skb->len)) { | 173 | if (!NLMSG_OK(nlh, skb->len)) { |
| 186 | ecryptfs_printk(KERN_ERR, "Received corrupt netlink " | 174 | ecryptfs_printk(KERN_ERR, "Received corrupt netlink " |
| @@ -227,7 +215,7 @@ int ecryptfs_init_netlink(void) | |||
| 227 | { | 215 | { |
| 228 | int rc; | 216 | int rc; |
| 229 | 217 | ||
| 230 | ecryptfs_nl_sock = netlink_kernel_create(NETLINK_ECRYPTFS, 0, | 218 | ecryptfs_nl_sock = netlink_kernel_create(&init_net, NETLINK_ECRYPTFS, 0, |
| 231 | ecryptfs_receive_nl_message, | 219 | ecryptfs_receive_nl_message, |
| 232 | NULL, THIS_MODULE); | 220 | NULL, THIS_MODULE); |
| 233 | if (!ecryptfs_nl_sock) { | 221 | if (!ecryptfs_nl_sock) { |
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index a4b142a6a2c7..8d23b0b38717 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | */ | 14 | */ |
| 15 | 15 | ||
| 16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
| 17 | #include <linux/module.h> | ||
| 17 | #include <linux/spinlock.h> | 18 | #include <linux/spinlock.h> |
| 18 | #include <linux/sched.h> | 19 | #include <linux/sched.h> |
| 19 | #include <linux/fs.h> | 20 | #include <linux/fs.h> |
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c index 55898023782b..dd3e737f528e 100644 --- a/fs/gfs2/super.c +++ b/fs/gfs2/super.c | |||
| @@ -159,18 +159,15 @@ int gfs2_check_sb(struct gfs2_sbd *sdp, struct gfs2_sb_host *sb, int silent) | |||
| 159 | } | 159 | } |
| 160 | 160 | ||
| 161 | 161 | ||
| 162 | static int end_bio_io_page(struct bio *bio, unsigned int bytes_done, int error) | 162 | static void end_bio_io_page(struct bio *bio, int error) |
| 163 | { | 163 | { |
| 164 | struct page *page = bio->bi_private; | 164 | struct page *page = bio->bi_private; |
| 165 | if (bio->bi_size) | ||
| 166 | return 1; | ||
| 167 | 165 | ||
| 168 | if (!error) | 166 | if (!error) |
| 169 | SetPageUptodate(page); | 167 | SetPageUptodate(page); |
| 170 | else | 168 | else |
| 171 | printk(KERN_WARNING "gfs2: error %d reading superblock\n", error); | 169 | printk(KERN_WARNING "gfs2: error %d reading superblock\n", error); |
| 172 | unlock_page(page); | 170 | unlock_page(page); |
| 173 | return 0; | ||
| 174 | } | 171 | } |
| 175 | 172 | ||
| 176 | static void gfs2_sb_in(struct gfs2_sb_host *sb, const void *buf) | 173 | static void gfs2_sb_in(struct gfs2_sb_host *sb, const void *buf) |
diff --git a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c index de3e4a506dbc..ccfd02944053 100644 --- a/fs/jfs/jfs_logmgr.c +++ b/fs/jfs/jfs_logmgr.c | |||
| @@ -2162,7 +2162,7 @@ static void lbmStartIO(struct lbuf * bp) | |||
| 2162 | /* check if journaling to disk has been disabled */ | 2162 | /* check if journaling to disk has been disabled */ |
| 2163 | if (log->no_integrity) { | 2163 | if (log->no_integrity) { |
| 2164 | bio->bi_size = 0; | 2164 | bio->bi_size = 0; |
| 2165 | lbmIODone(bio, 0, 0); | 2165 | lbmIODone(bio, 0); |
| 2166 | } else { | 2166 | } else { |
| 2167 | submit_bio(WRITE_SYNC, bio); | 2167 | submit_bio(WRITE_SYNC, bio); |
| 2168 | INCREMENT(lmStat.submitted); | 2168 | INCREMENT(lmStat.submitted); |
| @@ -2200,16 +2200,13 @@ static int lbmIOWait(struct lbuf * bp, int flag) | |||
| 2200 | * | 2200 | * |
| 2201 | * executed at INTIODONE level | 2201 | * executed at INTIODONE level |
| 2202 | */ | 2202 | */ |
| 2203 | static int lbmIODone(struct bio *bio, unsigned int bytes_done, int error) | 2203 | static void lbmIODone(struct bio *bio, int error) |
| 2204 | { | 2204 | { |
| 2205 | struct lbuf *bp = bio->bi_private; | 2205 | struct lbuf *bp = bio->bi_private; |
| 2206 | struct lbuf *nextbp, *tail; | 2206 | struct lbuf *nextbp, *tail; |
| 2207 | struct jfs_log *log; | 2207 | struct jfs_log *log; |
| 2208 | unsigned long flags; | 2208 | unsigned long flags; |
| 2209 | 2209 | ||
| 2210 | if (bio->bi_size) | ||
| 2211 | return 1; | ||
| 2212 | |||
| 2213 | /* | 2210 | /* |
| 2214 | * get back jfs buffer bound to the i/o buffer | 2211 | * get back jfs buffer bound to the i/o buffer |
| 2215 | */ | 2212 | */ |
| @@ -2237,8 +2234,6 @@ static int lbmIODone(struct bio *bio, unsigned int bytes_done, int error) | |||
| 2237 | 2234 | ||
| 2238 | /* wakeup I/O initiator */ | 2235 | /* wakeup I/O initiator */ |
| 2239 | LCACHE_WAKEUP(&bp->l_ioevent); | 2236 | LCACHE_WAKEUP(&bp->l_ioevent); |
| 2240 | |||
| 2241 | return 0; | ||
| 2242 | } | 2237 | } |
| 2243 | 2238 | ||
| 2244 | /* | 2239 | /* |
| @@ -2263,7 +2258,6 @@ static int lbmIODone(struct bio *bio, unsigned int bytes_done, int error) | |||
| 2263 | if (bp->l_flag & lbmDIRECT) { | 2258 | if (bp->l_flag & lbmDIRECT) { |
| 2264 | LCACHE_WAKEUP(&bp->l_ioevent); | 2259 | LCACHE_WAKEUP(&bp->l_ioevent); |
| 2265 | LCACHE_UNLOCK(flags); | 2260 | LCACHE_UNLOCK(flags); |
| 2266 | return 0; | ||
| 2267 | } | 2261 | } |
| 2268 | 2262 | ||
| 2269 | tail = log->wqueue; | 2263 | tail = log->wqueue; |
| @@ -2342,8 +2336,6 @@ static int lbmIODone(struct bio *bio, unsigned int bytes_done, int error) | |||
| 2342 | 2336 | ||
| 2343 | LCACHE_UNLOCK(flags); /* unlock+enable */ | 2337 | LCACHE_UNLOCK(flags); /* unlock+enable */ |
| 2344 | } | 2338 | } |
| 2345 | |||
| 2346 | return 0; | ||
| 2347 | } | 2339 | } |
| 2348 | 2340 | ||
| 2349 | int jfsIOWait(void *arg) | 2341 | int jfsIOWait(void *arg) |
diff --git a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c index 62e96be02acf..941369c1ac8d 100644 --- a/fs/jfs/jfs_metapage.c +++ b/fs/jfs/jfs_metapage.c | |||
| @@ -280,14 +280,10 @@ static void last_read_complete(struct page *page) | |||
| 280 | unlock_page(page); | 280 | unlock_page(page); |
| 281 | } | 281 | } |
| 282 | 282 | ||
| 283 | static int metapage_read_end_io(struct bio *bio, unsigned int bytes_done, | 283 | static void metapage_read_end_io(struct bio *bio, int err) |
| 284 | int err) | ||
| 285 | { | 284 | { |
| 286 | struct page *page = bio->bi_private; | 285 | struct page *page = bio->bi_private; |
| 287 | 286 | ||
| 288 | if (bio->bi_size) | ||
| 289 | return 1; | ||
| 290 | |||
| 291 | if (!test_bit(BIO_UPTODATE, &bio->bi_flags)) { | 287 | if (!test_bit(BIO_UPTODATE, &bio->bi_flags)) { |
| 292 | printk(KERN_ERR "metapage_read_end_io: I/O error\n"); | 288 | printk(KERN_ERR "metapage_read_end_io: I/O error\n"); |
| 293 | SetPageError(page); | 289 | SetPageError(page); |
| @@ -295,8 +291,6 @@ static int metapage_read_end_io(struct bio *bio, unsigned int bytes_done, | |||
| 295 | 291 | ||
| 296 | dec_io(page, last_read_complete); | 292 | dec_io(page, last_read_complete); |
| 297 | bio_put(bio); | 293 | bio_put(bio); |
| 298 | |||
| 299 | return 0; | ||
| 300 | } | 294 | } |
| 301 | 295 | ||
| 302 | static void remove_from_logsync(struct metapage *mp) | 296 | static void remove_from_logsync(struct metapage *mp) |
| @@ -341,23 +335,18 @@ static void last_write_complete(struct page *page) | |||
| 341 | end_page_writeback(page); | 335 | end_page_writeback(page); |
| 342 | } | 336 | } |
| 343 | 337 | ||
| 344 | static int metapage_write_end_io(struct bio *bio, unsigned int bytes_done, | 338 | static void metapage_write_end_io(struct bio *bio, int err) |
| 345 | int err) | ||
| 346 | { | 339 | { |
| 347 | struct page *page = bio->bi_private; | 340 | struct page *page = bio->bi_private; |
| 348 | 341 | ||
| 349 | BUG_ON(!PagePrivate(page)); | 342 | BUG_ON(!PagePrivate(page)); |
| 350 | 343 | ||
| 351 | if (bio->bi_size) | ||
| 352 | return 1; | ||
| 353 | |||
| 354 | if (! test_bit(BIO_UPTODATE, &bio->bi_flags)) { | 344 | if (! test_bit(BIO_UPTODATE, &bio->bi_flags)) { |
| 355 | printk(KERN_ERR "metapage_write_end_io: I/O error\n"); | 345 | printk(KERN_ERR "metapage_write_end_io: I/O error\n"); |
| 356 | SetPageError(page); | 346 | SetPageError(page); |
| 357 | } | 347 | } |
| 358 | dec_io(page, last_write_complete); | 348 | dec_io(page, last_write_complete); |
| 359 | bio_put(bio); | 349 | bio_put(bio); |
| 360 | return 0; | ||
| 361 | } | 350 | } |
| 362 | 351 | ||
| 363 | static int metapage_writepage(struct page *page, struct writeback_control *wbc) | 352 | static int metapage_writepage(struct page *page, struct writeback_control *wbc) |
diff --git a/fs/mpage.c b/fs/mpage.c index c1698f2291aa..b1c3e5890508 100644 --- a/fs/mpage.c +++ b/fs/mpage.c | |||
| @@ -39,14 +39,11 @@ | |||
| 39 | * status of that page is hard. See end_buffer_async_read() for the details. | 39 | * status of that page is hard. See end_buffer_async_read() for the details. |
| 40 | * There is no point in duplicating all that complexity. | 40 | * There is no point in duplicating all that complexity. |
| 41 | */ | 41 | */ |
| 42 | static int mpage_end_io_read(struct bio *bio, unsigned int bytes_done, int err) | 42 | static void mpage_end_io_read(struct bio *bio, int err) |
| 43 | { | 43 | { |
| 44 | const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); | 44 | const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); |
| 45 | struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1; | 45 | struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1; |
| 46 | 46 | ||
| 47 | if (bio->bi_size) | ||
| 48 | return 1; | ||
| 49 | |||
| 50 | do { | 47 | do { |
| 51 | struct page *page = bvec->bv_page; | 48 | struct page *page = bvec->bv_page; |
| 52 | 49 | ||
| @@ -62,17 +59,13 @@ static int mpage_end_io_read(struct bio *bio, unsigned int bytes_done, int err) | |||
| 62 | unlock_page(page); | 59 | unlock_page(page); |
| 63 | } while (bvec >= bio->bi_io_vec); | 60 | } while (bvec >= bio->bi_io_vec); |
| 64 | bio_put(bio); | 61 | bio_put(bio); |
| 65 | return 0; | ||
| 66 | } | 62 | } |
| 67 | 63 | ||
| 68 | static int mpage_end_io_write(struct bio *bio, unsigned int bytes_done, int err) | 64 | static void mpage_end_io_write(struct bio *bio, int err) |
| 69 | { | 65 | { |
| 70 | const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); | 66 | const int uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags); |
| 71 | struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1; | 67 | struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1; |
| 72 | 68 | ||
| 73 | if (bio->bi_size) | ||
| 74 | return 1; | ||
| 75 | |||
| 76 | do { | 69 | do { |
| 77 | struct page *page = bvec->bv_page; | 70 | struct page *page = bvec->bv_page; |
| 78 | 71 | ||
| @@ -87,7 +80,6 @@ static int mpage_end_io_write(struct bio *bio, unsigned int bytes_done, int err) | |||
| 87 | end_page_writeback(page); | 80 | end_page_writeback(page); |
| 88 | } while (bvec >= bio->bi_io_vec); | 81 | } while (bvec >= bio->bi_io_vec); |
| 89 | bio_put(bio); | 82 | bio_put(bio); |
| 90 | return 0; | ||
| 91 | } | 83 | } |
| 92 | 84 | ||
| 93 | static struct bio *mpage_bio_submit(int rw, struct bio *bio) | 85 | static struct bio *mpage_bio_submit(int rw, struct bio *bio) |
diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c index 2bd7f788cf34..f14b541fab95 100644 --- a/fs/ocfs2/cluster/heartbeat.c +++ b/fs/ocfs2/cluster/heartbeat.c | |||
| @@ -216,8 +216,7 @@ static void o2hb_wait_on_io(struct o2hb_region *reg, | |||
| 216 | wait_for_completion(&wc->wc_io_complete); | 216 | wait_for_completion(&wc->wc_io_complete); |
| 217 | } | 217 | } |
| 218 | 218 | ||
| 219 | static int o2hb_bio_end_io(struct bio *bio, | 219 | static void o2hb_bio_end_io(struct bio *bio, |
| 220 | unsigned int bytes_done, | ||
| 221 | int error) | 220 | int error) |
| 222 | { | 221 | { |
| 223 | struct o2hb_bio_wait_ctxt *wc = bio->bi_private; | 222 | struct o2hb_bio_wait_ctxt *wc = bio->bi_private; |
| @@ -227,12 +226,8 @@ static int o2hb_bio_end_io(struct bio *bio, | |||
| 227 | wc->wc_error = error; | 226 | wc->wc_error = error; |
| 228 | } | 227 | } |
| 229 | 228 | ||
| 230 | if (bio->bi_size) | ||
| 231 | return 1; | ||
| 232 | |||
| 233 | o2hb_bio_wait_dec(wc, 1); | 229 | o2hb_bio_wait_dec(wc, 1); |
| 234 | bio_put(bio); | 230 | bio_put(bio); |
| 235 | return 0; | ||
| 236 | } | 231 | } |
| 237 | 232 | ||
| 238 | /* Setup a Bio to cover I/O against num_slots slots starting at | 233 | /* Setup a Bio to cover I/O against num_slots slots starting at |
diff --git a/fs/proc/Makefile b/fs/proc/Makefile index bce38e3f06cb..ebaba0213546 100644 --- a/fs/proc/Makefile +++ b/fs/proc/Makefile | |||
| @@ -11,6 +11,7 @@ proc-y += inode.o root.o base.o generic.o array.o \ | |||
| 11 | proc_tty.o proc_misc.o | 11 | proc_tty.o proc_misc.o |
| 12 | 12 | ||
| 13 | proc-$(CONFIG_PROC_SYSCTL) += proc_sysctl.o | 13 | proc-$(CONFIG_PROC_SYSCTL) += proc_sysctl.o |
| 14 | proc-$(CONFIG_NET) += proc_net.o | ||
| 14 | proc-$(CONFIG_PROC_KCORE) += kcore.o | 15 | proc-$(CONFIG_PROC_KCORE) += kcore.o |
| 15 | proc-$(CONFIG_PROC_VMCORE) += vmcore.o | 16 | proc-$(CONFIG_PROC_VMCORE) += vmcore.o |
| 16 | proc-$(CONFIG_PROC_DEVICETREE) += proc_devtree.o | 17 | proc-$(CONFIG_PROC_DEVICETREE) += proc_devtree.o |
diff --git a/fs/proc/internal.h b/fs/proc/internal.h index b215c3524fa6..1820eb2ef762 100644 --- a/fs/proc/internal.h +++ b/fs/proc/internal.h | |||
| @@ -16,6 +16,11 @@ extern int proc_sys_init(void); | |||
| 16 | #else | 16 | #else |
| 17 | static inline void proc_sys_init(void) { } | 17 | static inline void proc_sys_init(void) { } |
| 18 | #endif | 18 | #endif |
| 19 | #ifdef CONFIG_NET | ||
| 20 | extern int proc_net_init(void); | ||
| 21 | #else | ||
| 22 | static inline int proc_net_init(void) { return 0; } | ||
| 23 | #endif | ||
| 19 | 24 | ||
| 20 | struct vmalloc_info { | 25 | struct vmalloc_info { |
| 21 | unsigned long used; | 26 | unsigned long used; |
diff --git a/fs/proc/proc_net.c b/fs/proc/proc_net.c new file mode 100644 index 000000000000..2e91fb756e9a --- /dev/null +++ b/fs/proc/proc_net.c | |||
| @@ -0,0 +1,200 @@ | |||
| 1 | /* | ||
| 2 | * linux/fs/proc/net.c | ||
| 3 | * | ||
| 4 | * Copyright (C) 2007 | ||
| 5 | * | ||
| 6 | * Author: Eric Biederman <ebiederm@xmission.com> | ||
| 7 | * | ||
| 8 | * proc net directory handling functions | ||
| 9 | */ | ||
| 10 | |||
| 11 | #include <asm/uaccess.h> | ||
| 12 | |||
| 13 | #include <linux/errno.h> | ||
| 14 | #include <linux/time.h> | ||
| 15 | #include <linux/proc_fs.h> | ||
| 16 | #include <linux/stat.h> | ||
| 17 | #include <linux/init.h> | ||
| 18 | #include <linux/sched.h> | ||
| 19 | #include <linux/module.h> | ||
| 20 | #include <linux/bitops.h> | ||
| 21 | #include <linux/smp_lock.h> | ||
| 22 | #include <linux/mount.h> | ||
| 23 | #include <linux/nsproxy.h> | ||
| 24 | #include <net/net_namespace.h> | ||
| 25 | |||
| 26 | #include "internal.h" | ||
| 27 | |||
| 28 | |||
| 29 | struct proc_dir_entry *proc_net_create(struct net *net, | ||
| 30 | const char *name, mode_t mode, get_info_t *get_info) | ||
| 31 | { | ||
| 32 | return create_proc_info_entry(name,mode, net->proc_net, get_info); | ||
| 33 | } | ||
| 34 | EXPORT_SYMBOL_GPL(proc_net_create); | ||
| 35 | |||
| 36 | struct proc_dir_entry *proc_net_fops_create(struct net *net, | ||
| 37 | const char *name, mode_t mode, const struct file_operations *fops) | ||
| 38 | { | ||
| 39 | struct proc_dir_entry *res; | ||
| 40 | |||
| 41 | res = create_proc_entry(name, mode, net->proc_net); | ||
| 42 | if (res) | ||
| 43 | res->proc_fops = fops; | ||
| 44 | return res; | ||
| 45 | } | ||
| 46 | EXPORT_SYMBOL_GPL(proc_net_fops_create); | ||
| 47 | |||
| 48 | void proc_net_remove(struct net *net, const char *name) | ||
| 49 | { | ||
| 50 | remove_proc_entry(name, net->proc_net); | ||
| 51 | } | ||
| 52 | EXPORT_SYMBOL_GPL(proc_net_remove); | ||
| 53 | |||
| 54 | struct net *get_proc_net(const struct inode *inode) | ||
| 55 | { | ||
| 56 | return maybe_get_net(PDE_NET(PDE(inode))); | ||
| 57 | } | ||
| 58 | EXPORT_SYMBOL_GPL(get_proc_net); | ||
| 59 | |||
| 60 | static struct proc_dir_entry *proc_net_shadow; | ||
| 61 | |||
| 62 | static struct dentry *proc_net_shadow_dentry(struct dentry *parent, | ||
| 63 | struct proc_dir_entry *de) | ||
| 64 | { | ||
| 65 | struct dentry *shadow = NULL; | ||
| 66 | struct inode *inode; | ||
| 67 | if (!de) | ||
| 68 | goto out; | ||
| 69 | de_get(de); | ||
| 70 | inode = proc_get_inode(parent->d_inode->i_sb, de->low_ino, de); | ||
| 71 | if (!inode) | ||
| 72 | goto out_de_put; | ||
| 73 | shadow = d_alloc_name(parent, de->name); | ||
| 74 | if (!shadow) | ||
| 75 | goto out_iput; | ||
| 76 | shadow->d_op = parent->d_op; /* proc_dentry_operations */ | ||
| 77 | d_instantiate(shadow, inode); | ||
| 78 | out: | ||
| 79 | return shadow; | ||
| 80 | out_iput: | ||
| 81 | iput(inode); | ||
| 82 | out_de_put: | ||
| 83 | de_put(de); | ||
| 84 | goto out; | ||
| 85 | } | ||
| 86 | |||
| 87 | static void *proc_net_follow_link(struct dentry *parent, struct nameidata *nd) | ||
| 88 | { | ||
| 89 | struct net *net = current->nsproxy->net_ns; | ||
| 90 | struct dentry *shadow; | ||
| 91 | shadow = proc_net_shadow_dentry(parent, net->proc_net); | ||
| 92 | if (!shadow) | ||
| 93 | return ERR_PTR(-ENOENT); | ||
| 94 | |||
| 95 | dput(nd->dentry); | ||
| 96 | /* My dentry count is 1 and that should be enough as the | ||
| 97 | * shadow dentry is thrown away immediately. | ||
| 98 | */ | ||
| 99 | nd->dentry = shadow; | ||
| 100 | return NULL; | ||
| 101 | } | ||
| 102 | |||
| 103 | static struct dentry *proc_net_lookup(struct inode *dir, struct dentry *dentry, | ||
| 104 | struct nameidata *nd) | ||
| 105 | { | ||
| 106 | struct net *net = current->nsproxy->net_ns; | ||
| 107 | struct dentry *shadow; | ||
| 108 | |||
| 109 | shadow = proc_net_shadow_dentry(nd->dentry, net->proc_net); | ||
| 110 | if (!shadow) | ||
| 111 | return ERR_PTR(-ENOENT); | ||
| 112 | |||
| 113 | dput(nd->dentry); | ||
| 114 | nd->dentry = shadow; | ||
| 115 | |||
| 116 | return shadow->d_inode->i_op->lookup(shadow->d_inode, dentry, nd); | ||
| 117 | } | ||
| 118 | |||
| 119 | static int proc_net_setattr(struct dentry *dentry, struct iattr *iattr) | ||
| 120 | { | ||
| 121 | struct net *net = current->nsproxy->net_ns; | ||
| 122 | struct dentry *shadow; | ||
| 123 | int ret; | ||
| 124 | |||
| 125 | shadow = proc_net_shadow_dentry(dentry->d_parent, net->proc_net); | ||
| 126 | if (!shadow) | ||
| 127 | return -ENOENT; | ||
| 128 | ret = shadow->d_inode->i_op->setattr(shadow, iattr); | ||
| 129 | dput(shadow); | ||
| 130 | return ret; | ||
| 131 | } | ||
| 132 | |||
| 133 | static const struct file_operations proc_net_dir_operations = { | ||
| 134 | .read = generic_read_dir, | ||
| 135 | }; | ||
| 136 | |||
| 137 | static struct inode_operations proc_net_dir_inode_operations = { | ||
| 138 | .follow_link = proc_net_follow_link, | ||
| 139 | .lookup = proc_net_lookup, | ||
| 140 | .setattr = proc_net_setattr, | ||
| 141 | }; | ||
| 142 | |||
| 143 | static __net_init int proc_net_ns_init(struct net *net) | ||
| 144 | { | ||
| 145 | struct proc_dir_entry *root, *netd, *net_statd; | ||
| 146 | int err; | ||
| 147 | |||
| 148 | err = -ENOMEM; | ||
| 149 | root = kzalloc(sizeof(*root), GFP_KERNEL); | ||
| 150 | if (!root) | ||
| 151 | goto out; | ||
| 152 | |||
| 153 | err = -EEXIST; | ||
| 154 | netd = proc_mkdir("net", root); | ||
| 155 | if (!netd) | ||
| 156 | goto free_root; | ||
| 157 | |||
| 158 | err = -EEXIST; | ||
| 159 | net_statd = proc_mkdir("stat", netd); | ||
| 160 | if (!net_statd) | ||
| 161 | goto free_net; | ||
| 162 | |||
| 163 | root->data = net; | ||
| 164 | netd->data = net; | ||
| 165 | net_statd->data = net; | ||
| 166 | |||
| 167 | net->proc_net_root = root; | ||
| 168 | net->proc_net = netd; | ||
| 169 | net->proc_net_stat = net_statd; | ||
| 170 | err = 0; | ||
| 171 | |||
| 172 | out: | ||
| 173 | return err; | ||
| 174 | free_net: | ||
| 175 | remove_proc_entry("net", root); | ||
| 176 | free_root: | ||
| 177 | kfree(root); | ||
| 178 | goto out; | ||
| 179 | } | ||
| 180 | |||
| 181 | static __net_exit void proc_net_ns_exit(struct net *net) | ||
| 182 | { | ||
| 183 | remove_proc_entry("stat", net->proc_net); | ||
| 184 | remove_proc_entry("net", net->proc_net_root); | ||
| 185 | kfree(net->proc_net_root); | ||
| 186 | } | ||
| 187 | |||
| 188 | struct pernet_operations __net_initdata proc_net_ns_ops = { | ||
| 189 | .init = proc_net_ns_init, | ||
| 190 | .exit = proc_net_ns_exit, | ||
| 191 | }; | ||
| 192 | |||
| 193 | int __init proc_net_init(void) | ||
| 194 | { | ||
| 195 | proc_net_shadow = proc_mkdir("net", NULL); | ||
| 196 | proc_net_shadow->proc_iops = &proc_net_dir_inode_operations; | ||
| 197 | proc_net_shadow->proc_fops = &proc_net_dir_operations; | ||
| 198 | |||
| 199 | return register_pernet_subsys(&proc_net_ns_ops); | ||
| 200 | } | ||
diff --git a/fs/proc/root.c b/fs/proc/root.c index 41f17037f738..cf3046638b09 100644 --- a/fs/proc/root.c +++ b/fs/proc/root.c | |||
| @@ -21,7 +21,7 @@ | |||
| 21 | 21 | ||
| 22 | #include "internal.h" | 22 | #include "internal.h" |
| 23 | 23 | ||
| 24 | struct proc_dir_entry *proc_net, *proc_net_stat, *proc_bus, *proc_root_fs, *proc_root_driver; | 24 | struct proc_dir_entry *proc_bus, *proc_root_fs, *proc_root_driver; |
| 25 | 25 | ||
| 26 | static int proc_get_sb(struct file_system_type *fs_type, | 26 | static int proc_get_sb(struct file_system_type *fs_type, |
| 27 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) | 27 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) |
| @@ -61,8 +61,8 @@ void __init proc_root_init(void) | |||
| 61 | return; | 61 | return; |
| 62 | } | 62 | } |
| 63 | proc_misc_init(); | 63 | proc_misc_init(); |
| 64 | proc_net = proc_mkdir("net", NULL); | 64 | |
| 65 | proc_net_stat = proc_mkdir("net/stat", NULL); | 65 | proc_net_init(); |
| 66 | 66 | ||
| 67 | #ifdef CONFIG_SYSVIPC | 67 | #ifdef CONFIG_SYSVIPC |
| 68 | proc_mkdir("sysvipc", NULL); | 68 | proc_mkdir("sysvipc", NULL); |
| @@ -159,7 +159,5 @@ EXPORT_SYMBOL(create_proc_entry); | |||
| 159 | EXPORT_SYMBOL(remove_proc_entry); | 159 | EXPORT_SYMBOL(remove_proc_entry); |
| 160 | EXPORT_SYMBOL(proc_root); | 160 | EXPORT_SYMBOL(proc_root); |
| 161 | EXPORT_SYMBOL(proc_root_fs); | 161 | EXPORT_SYMBOL(proc_root_fs); |
| 162 | EXPORT_SYMBOL(proc_net); | ||
| 163 | EXPORT_SYMBOL(proc_net_stat); | ||
| 164 | EXPORT_SYMBOL(proc_bus); | 162 | EXPORT_SYMBOL(proc_bus); |
| 165 | EXPORT_SYMBOL(proc_root_driver); | 163 | EXPORT_SYMBOL(proc_root_driver); |
diff --git a/fs/seq_file.c b/fs/seq_file.c index bbb19be260ce..ca71c115bdaa 100644 --- a/fs/seq_file.c +++ b/fs/seq_file.c | |||
| @@ -429,6 +429,39 @@ int seq_release_private(struct inode *inode, struct file *file) | |||
| 429 | } | 429 | } |
| 430 | EXPORT_SYMBOL(seq_release_private); | 430 | EXPORT_SYMBOL(seq_release_private); |
| 431 | 431 | ||
| 432 | void *__seq_open_private(struct file *f, const struct seq_operations *ops, | ||
| 433 | int psize) | ||
| 434 | { | ||
| 435 | int rc; | ||
| 436 | void *private; | ||
| 437 | struct seq_file *seq; | ||
| 438 | |||
| 439 | private = kzalloc(psize, GFP_KERNEL); | ||
| 440 | if (private == NULL) | ||
| 441 | goto out; | ||
| 442 | |||
| 443 | rc = seq_open(f, ops); | ||
| 444 | if (rc < 0) | ||
| 445 | goto out_free; | ||
| 446 | |||
| 447 | seq = f->private_data; | ||
| 448 | seq->private = private; | ||
| 449 | return private; | ||
| 450 | |||
| 451 | out_free: | ||
| 452 | kfree(private); | ||
| 453 | out: | ||
| 454 | return NULL; | ||
| 455 | } | ||
| 456 | EXPORT_SYMBOL(__seq_open_private); | ||
| 457 | |||
| 458 | int seq_open_private(struct file *filp, const struct seq_operations *ops, | ||
| 459 | int psize) | ||
| 460 | { | ||
| 461 | return __seq_open_private(filp, ops, psize) ? 0 : -ENOMEM; | ||
| 462 | } | ||
| 463 | EXPORT_SYMBOL(seq_open_private); | ||
| 464 | |||
| 432 | int seq_putc(struct seq_file *m, char c) | 465 | int seq_putc(struct seq_file *m, char c) |
| 433 | { | 466 | { |
| 434 | if (m->count < m->size) { | 467 | if (m->count < m->size) { |
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c index 5f152f60d74d..6f4c29e9c3d9 100644 --- a/fs/xfs/linux-2.6/xfs_aops.c +++ b/fs/xfs/linux-2.6/xfs_aops.c | |||
| @@ -323,17 +323,13 @@ xfs_iomap_valid( | |||
| 323 | /* | 323 | /* |
| 324 | * BIO completion handler for buffered IO. | 324 | * BIO completion handler for buffered IO. |
| 325 | */ | 325 | */ |
| 326 | STATIC int | 326 | STATIC void |
| 327 | xfs_end_bio( | 327 | xfs_end_bio( |
| 328 | struct bio *bio, | 328 | struct bio *bio, |
| 329 | unsigned int bytes_done, | ||
| 330 | int error) | 329 | int error) |
| 331 | { | 330 | { |
| 332 | xfs_ioend_t *ioend = bio->bi_private; | 331 | xfs_ioend_t *ioend = bio->bi_private; |
| 333 | 332 | ||
| 334 | if (bio->bi_size) | ||
| 335 | return 1; | ||
| 336 | |||
| 337 | ASSERT(atomic_read(&bio->bi_cnt) >= 1); | 333 | ASSERT(atomic_read(&bio->bi_cnt) >= 1); |
| 338 | ioend->io_error = test_bit(BIO_UPTODATE, &bio->bi_flags) ? 0 : error; | 334 | ioend->io_error = test_bit(BIO_UPTODATE, &bio->bi_flags) ? 0 : error; |
| 339 | 335 | ||
| @@ -343,7 +339,6 @@ xfs_end_bio( | |||
| 343 | bio_put(bio); | 339 | bio_put(bio); |
| 344 | 340 | ||
| 345 | xfs_finish_ioend(ioend, 0); | 341 | xfs_finish_ioend(ioend, 0); |
| 346 | return 0; | ||
| 347 | } | 342 | } |
| 348 | 343 | ||
| 349 | STATIC void | 344 | STATIC void |
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c index b0f0e58866de..39f44ee572e8 100644 --- a/fs/xfs/linux-2.6/xfs_buf.c +++ b/fs/xfs/linux-2.6/xfs_buf.c | |||
| @@ -1103,19 +1103,15 @@ _xfs_buf_ioend( | |||
| 1103 | } | 1103 | } |
| 1104 | } | 1104 | } |
| 1105 | 1105 | ||
| 1106 | STATIC int | 1106 | STATIC void |
| 1107 | xfs_buf_bio_end_io( | 1107 | xfs_buf_bio_end_io( |
| 1108 | struct bio *bio, | 1108 | struct bio *bio, |
| 1109 | unsigned int bytes_done, | ||
| 1110 | int error) | 1109 | int error) |
| 1111 | { | 1110 | { |
| 1112 | xfs_buf_t *bp = (xfs_buf_t *)bio->bi_private; | 1111 | xfs_buf_t *bp = (xfs_buf_t *)bio->bi_private; |
| 1113 | unsigned int blocksize = bp->b_target->bt_bsize; | 1112 | unsigned int blocksize = bp->b_target->bt_bsize; |
| 1114 | struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1; | 1113 | struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1; |
| 1115 | 1114 | ||
| 1116 | if (bio->bi_size) | ||
| 1117 | return 1; | ||
| 1118 | |||
| 1119 | if (!test_bit(BIO_UPTODATE, &bio->bi_flags)) | 1115 | if (!test_bit(BIO_UPTODATE, &bio->bi_flags)) |
| 1120 | bp->b_error = EIO; | 1116 | bp->b_error = EIO; |
| 1121 | 1117 | ||
| @@ -1143,7 +1139,6 @@ xfs_buf_bio_end_io( | |||
| 1143 | 1139 | ||
| 1144 | _xfs_buf_ioend(bp, 1); | 1140 | _xfs_buf_ioend(bp, 1); |
| 1145 | bio_put(bio); | 1141 | bio_put(bio); |
| 1146 | return 0; | ||
| 1147 | } | 1142 | } |
| 1148 | 1143 | ||
| 1149 | STATIC void | 1144 | STATIC void |
