diff options
author | David Howells <dhowells@redhat.com> | 2006-09-30 14:45:40 -0400 |
---|---|---|
committer | Jens Axboe <axboe@nelson.home.kernel.dk> | 2006-09-30 14:52:31 -0400 |
commit | 9361401eb7619c033e2394e4f9f6d410d6719ac7 (patch) | |
tree | 04b94a71f2366988c17740d1c16cfbdec41d5d2e /fs/compat_ioctl.c | |
parent | d366e40a1cabd453be6e2609caa7e12f9ca17b1f (diff) |
[PATCH] BLOCK: Make it possible to disable the block layer [try #6]
Make it possible to disable the block layer. Not all embedded devices require
it, some can make do with just JFFS2, NFS, ramfs, etc - none of which require
the block layer to be present.
This patch does the following:
(*) Introduces CONFIG_BLOCK to disable the block layer, buffering and blockdev
support.
(*) Adds dependencies on CONFIG_BLOCK to any configuration item that controls
an item that uses the block layer. This includes:
(*) Block I/O tracing.
(*) Disk partition code.
(*) All filesystems that are block based, eg: Ext3, ReiserFS, ISOFS.
(*) The SCSI layer. As far as I can tell, even SCSI chardevs use the
block layer to do scheduling. Some drivers that use SCSI facilities -
such as USB storage - end up disabled indirectly from this.
(*) Various block-based device drivers, such as IDE and the old CDROM
drivers.
(*) MTD blockdev handling and FTL.
(*) JFFS - which uses set_bdev_super(), something it could avoid doing by
taking a leaf out of JFFS2's book.
(*) Makes most of the contents of linux/blkdev.h, linux/buffer_head.h and
linux/elevator.h contingent on CONFIG_BLOCK being set. sector_div() is,
however, still used in places, and so is still available.
(*) Also made contingent are the contents of linux/mpage.h, linux/genhd.h and
parts of linux/fs.h.
(*) Makes a number of files in fs/ contingent on CONFIG_BLOCK.
(*) Makes mm/bounce.c (bounce buffering) contingent on CONFIG_BLOCK.
(*) set_page_dirty() doesn't call __set_page_dirty_buffers() if CONFIG_BLOCK
is not enabled.
(*) fs/no-block.c is created to hold out-of-line stubs and things that are
required when CONFIG_BLOCK is not set:
(*) Default blockdev file operations (to give error ENODEV on opening).
(*) Makes some /proc changes:
(*) /proc/devices does not list any blockdevs.
(*) /proc/diskstats and /proc/partitions are contingent on CONFIG_BLOCK.
(*) Makes some compat ioctl handling contingent on CONFIG_BLOCK.
(*) If CONFIG_BLOCK is not defined, makes sys_quotactl() return -ENODEV if
given command other than Q_SYNC or if a special device is specified.
(*) In init/do_mounts.c, no reference is made to the blockdev routines if
CONFIG_BLOCK is not defined. This does not prohibit NFS roots or JFFS2.
(*) The bdflush, ioprio_set and ioprio_get syscalls can now be absent (return
error ENOSYS by way of cond_syscall if so).
(*) The seclvl_bd_claim() and seclvl_bd_release() security calls do nothing if
CONFIG_BLOCK is not set, since they can't then happen.
Signed-Off-By: David Howells <dhowells@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/compat_ioctl.c')
-rw-r--r-- | fs/compat_ioctl.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index e1a56437040a..64b34533edea 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c | |||
@@ -645,6 +645,7 @@ out: | |||
645 | } | 645 | } |
646 | #endif | 646 | #endif |
647 | 647 | ||
648 | #ifdef CONFIG_BLOCK | ||
648 | struct hd_geometry32 { | 649 | struct hd_geometry32 { |
649 | unsigned char heads; | 650 | unsigned char heads; |
650 | unsigned char sectors; | 651 | unsigned char sectors; |
@@ -869,6 +870,7 @@ static int sg_grt_trans(unsigned int fd, unsigned int cmd, unsigned long arg) | |||
869 | } | 870 | } |
870 | return err; | 871 | return err; |
871 | } | 872 | } |
873 | #endif /* CONFIG_BLOCK */ | ||
872 | 874 | ||
873 | struct sock_fprog32 { | 875 | struct sock_fprog32 { |
874 | unsigned short len; | 876 | unsigned short len; |
@@ -992,6 +994,7 @@ static int ppp_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg) | |||
992 | } | 994 | } |
993 | 995 | ||
994 | 996 | ||
997 | #ifdef CONFIG_BLOCK | ||
995 | struct mtget32 { | 998 | struct mtget32 { |
996 | compat_long_t mt_type; | 999 | compat_long_t mt_type; |
997 | compat_long_t mt_resid; | 1000 | compat_long_t mt_resid; |
@@ -1164,6 +1167,7 @@ static int cdrom_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long ar | |||
1164 | 1167 | ||
1165 | return err; | 1168 | return err; |
1166 | } | 1169 | } |
1170 | #endif /* CONFIG_BLOCK */ | ||
1167 | 1171 | ||
1168 | #ifdef CONFIG_VT | 1172 | #ifdef CONFIG_VT |
1169 | 1173 | ||
@@ -1491,6 +1495,7 @@ ret_einval(unsigned int fd, unsigned int cmd, unsigned long arg) | |||
1491 | return -EINVAL; | 1495 | return -EINVAL; |
1492 | } | 1496 | } |
1493 | 1497 | ||
1498 | #ifdef CONFIG_BLOCK | ||
1494 | static int broken_blkgetsize(unsigned int fd, unsigned int cmd, unsigned long arg) | 1499 | static int broken_blkgetsize(unsigned int fd, unsigned int cmd, unsigned long arg) |
1495 | { | 1500 | { |
1496 | /* The mkswap binary hard codes it to Intel value :-((( */ | 1501 | /* The mkswap binary hard codes it to Intel value :-((( */ |
@@ -1525,12 +1530,14 @@ static int blkpg_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long ar | |||
1525 | 1530 | ||
1526 | return sys_ioctl(fd, cmd, (unsigned long)a); | 1531 | return sys_ioctl(fd, cmd, (unsigned long)a); |
1527 | } | 1532 | } |
1533 | #endif | ||
1528 | 1534 | ||
1529 | static int ioc_settimeout(unsigned int fd, unsigned int cmd, unsigned long arg) | 1535 | static int ioc_settimeout(unsigned int fd, unsigned int cmd, unsigned long arg) |
1530 | { | 1536 | { |
1531 | return rw_long(fd, AUTOFS_IOC_SETTIMEOUT, arg); | 1537 | return rw_long(fd, AUTOFS_IOC_SETTIMEOUT, arg); |
1532 | } | 1538 | } |
1533 | 1539 | ||
1540 | #ifdef CONFIG_BLOCK | ||
1534 | /* Fix sizeof(sizeof()) breakage */ | 1541 | /* Fix sizeof(sizeof()) breakage */ |
1535 | #define BLKBSZGET_32 _IOR(0x12,112,int) | 1542 | #define BLKBSZGET_32 _IOR(0x12,112,int) |
1536 | #define BLKBSZSET_32 _IOW(0x12,113,int) | 1543 | #define BLKBSZSET_32 _IOW(0x12,113,int) |
@@ -1551,6 +1558,7 @@ static int do_blkgetsize64(unsigned int fd, unsigned int cmd, | |||
1551 | { | 1558 | { |
1552 | return sys_ioctl(fd, BLKGETSIZE64, (unsigned long)compat_ptr(arg)); | 1559 | return sys_ioctl(fd, BLKGETSIZE64, (unsigned long)compat_ptr(arg)); |
1553 | } | 1560 | } |
1561 | #endif | ||
1554 | 1562 | ||
1555 | /* Bluetooth ioctls */ | 1563 | /* Bluetooth ioctls */ |
1556 | #define HCIUARTSETPROTO _IOW('U', 200, int) | 1564 | #define HCIUARTSETPROTO _IOW('U', 200, int) |
@@ -1571,6 +1579,7 @@ static int do_blkgetsize64(unsigned int fd, unsigned int cmd, | |||
1571 | #define HIDPGETCONNLIST _IOR('H', 210, int) | 1579 | #define HIDPGETCONNLIST _IOR('H', 210, int) |
1572 | #define HIDPGETCONNINFO _IOR('H', 211, int) | 1580 | #define HIDPGETCONNINFO _IOR('H', 211, int) |
1573 | 1581 | ||
1582 | #ifdef CONFIG_BLOCK | ||
1574 | struct floppy_struct32 { | 1583 | struct floppy_struct32 { |
1575 | compat_uint_t size; | 1584 | compat_uint_t size; |
1576 | compat_uint_t sect; | 1585 | compat_uint_t sect; |
@@ -1895,6 +1904,7 @@ out: | |||
1895 | kfree(karg); | 1904 | kfree(karg); |
1896 | return err; | 1905 | return err; |
1897 | } | 1906 | } |
1907 | #endif | ||
1898 | 1908 | ||
1899 | struct mtd_oob_buf32 { | 1909 | struct mtd_oob_buf32 { |
1900 | u_int32_t start; | 1910 | u_int32_t start; |
@@ -1936,6 +1946,7 @@ static int mtd_rw_oob(unsigned int fd, unsigned int cmd, unsigned long arg) | |||
1936 | return err; | 1946 | return err; |
1937 | } | 1947 | } |
1938 | 1948 | ||
1949 | #ifdef CONFIG_BLOCK | ||
1939 | struct raw32_config_request | 1950 | struct raw32_config_request |
1940 | { | 1951 | { |
1941 | compat_int_t raw_minor; | 1952 | compat_int_t raw_minor; |
@@ -2000,6 +2011,7 @@ static int raw_ioctl(unsigned fd, unsigned cmd, unsigned long arg) | |||
2000 | } | 2011 | } |
2001 | return ret; | 2012 | return ret; |
2002 | } | 2013 | } |
2014 | #endif /* CONFIG_BLOCK */ | ||
2003 | 2015 | ||
2004 | struct serial_struct32 { | 2016 | struct serial_struct32 { |
2005 | compat_int_t type; | 2017 | compat_int_t type; |
@@ -2606,6 +2618,7 @@ HANDLE_IOCTL(SIOCBRDELIF, dev_ifsioc) | |||
2606 | HANDLE_IOCTL(SIOCRTMSG, ret_einval) | 2618 | HANDLE_IOCTL(SIOCRTMSG, ret_einval) |
2607 | HANDLE_IOCTL(SIOCGSTAMP, do_siocgstamp) | 2619 | HANDLE_IOCTL(SIOCGSTAMP, do_siocgstamp) |
2608 | #endif | 2620 | #endif |
2621 | #ifdef CONFIG_BLOCK | ||
2609 | HANDLE_IOCTL(HDIO_GETGEO, hdio_getgeo) | 2622 | HANDLE_IOCTL(HDIO_GETGEO, hdio_getgeo) |
2610 | HANDLE_IOCTL(BLKRAGET, w_long) | 2623 | HANDLE_IOCTL(BLKRAGET, w_long) |
2611 | HANDLE_IOCTL(BLKGETSIZE, w_long) | 2624 | HANDLE_IOCTL(BLKGETSIZE, w_long) |
@@ -2631,14 +2644,17 @@ HANDLE_IOCTL(FDGETFDCSTAT32, fd_ioctl_trans) | |||
2631 | HANDLE_IOCTL(FDWERRORGET32, fd_ioctl_trans) | 2644 | HANDLE_IOCTL(FDWERRORGET32, fd_ioctl_trans) |
2632 | HANDLE_IOCTL(SG_IO,sg_ioctl_trans) | 2645 | HANDLE_IOCTL(SG_IO,sg_ioctl_trans) |
2633 | HANDLE_IOCTL(SG_GET_REQUEST_TABLE, sg_grt_trans) | 2646 | HANDLE_IOCTL(SG_GET_REQUEST_TABLE, sg_grt_trans) |
2647 | #endif | ||
2634 | HANDLE_IOCTL(PPPIOCGIDLE32, ppp_ioctl_trans) | 2648 | HANDLE_IOCTL(PPPIOCGIDLE32, ppp_ioctl_trans) |
2635 | HANDLE_IOCTL(PPPIOCSCOMPRESS32, ppp_ioctl_trans) | 2649 | HANDLE_IOCTL(PPPIOCSCOMPRESS32, ppp_ioctl_trans) |
2636 | HANDLE_IOCTL(PPPIOCSPASS32, ppp_sock_fprog_ioctl_trans) | 2650 | HANDLE_IOCTL(PPPIOCSPASS32, ppp_sock_fprog_ioctl_trans) |
2637 | HANDLE_IOCTL(PPPIOCSACTIVE32, ppp_sock_fprog_ioctl_trans) | 2651 | HANDLE_IOCTL(PPPIOCSACTIVE32, ppp_sock_fprog_ioctl_trans) |
2652 | #ifdef CONFIG_BLOCK | ||
2638 | HANDLE_IOCTL(MTIOCGET32, mt_ioctl_trans) | 2653 | HANDLE_IOCTL(MTIOCGET32, mt_ioctl_trans) |
2639 | HANDLE_IOCTL(MTIOCPOS32, mt_ioctl_trans) | 2654 | HANDLE_IOCTL(MTIOCPOS32, mt_ioctl_trans) |
2640 | HANDLE_IOCTL(CDROMREADAUDIO, cdrom_ioctl_trans) | 2655 | HANDLE_IOCTL(CDROMREADAUDIO, cdrom_ioctl_trans) |
2641 | HANDLE_IOCTL(CDROM_SEND_PACKET, cdrom_ioctl_trans) | 2656 | HANDLE_IOCTL(CDROM_SEND_PACKET, cdrom_ioctl_trans) |
2657 | #endif | ||
2642 | #define AUTOFS_IOC_SETTIMEOUT32 _IOWR(0x93,0x64,unsigned int) | 2658 | #define AUTOFS_IOC_SETTIMEOUT32 _IOWR(0x93,0x64,unsigned int) |
2643 | HANDLE_IOCTL(AUTOFS_IOC_SETTIMEOUT32, ioc_settimeout) | 2659 | HANDLE_IOCTL(AUTOFS_IOC_SETTIMEOUT32, ioc_settimeout) |
2644 | #ifdef CONFIG_VT | 2660 | #ifdef CONFIG_VT |
@@ -2677,12 +2693,14 @@ HANDLE_IOCTL(SONET_SETFRAMING, do_atm_ioctl) | |||
2677 | HANDLE_IOCTL(SONET_GETFRAMING, do_atm_ioctl) | 2693 | HANDLE_IOCTL(SONET_GETFRAMING, do_atm_ioctl) |
2678 | HANDLE_IOCTL(SONET_GETFRSENSE, do_atm_ioctl) | 2694 | HANDLE_IOCTL(SONET_GETFRSENSE, do_atm_ioctl) |
2679 | /* block stuff */ | 2695 | /* block stuff */ |
2696 | #ifdef CONFIG_BLOCK | ||
2680 | HANDLE_IOCTL(BLKBSZGET_32, do_blkbszget) | 2697 | HANDLE_IOCTL(BLKBSZGET_32, do_blkbszget) |
2681 | HANDLE_IOCTL(BLKBSZSET_32, do_blkbszset) | 2698 | HANDLE_IOCTL(BLKBSZSET_32, do_blkbszset) |
2682 | HANDLE_IOCTL(BLKGETSIZE64_32, do_blkgetsize64) | 2699 | HANDLE_IOCTL(BLKGETSIZE64_32, do_blkgetsize64) |
2683 | /* Raw devices */ | 2700 | /* Raw devices */ |
2684 | HANDLE_IOCTL(RAW_SETBIND, raw_ioctl) | 2701 | HANDLE_IOCTL(RAW_SETBIND, raw_ioctl) |
2685 | HANDLE_IOCTL(RAW_GETBIND, raw_ioctl) | 2702 | HANDLE_IOCTL(RAW_GETBIND, raw_ioctl) |
2703 | #endif | ||
2686 | /* Serial */ | 2704 | /* Serial */ |
2687 | HANDLE_IOCTL(TIOCGSERIAL, serial_struct_ioctl) | 2705 | HANDLE_IOCTL(TIOCGSERIAL, serial_struct_ioctl) |
2688 | HANDLE_IOCTL(TIOCSSERIAL, serial_struct_ioctl) | 2706 | HANDLE_IOCTL(TIOCSSERIAL, serial_struct_ioctl) |