kernel: allow per major decision on direct to user space
authorAlan Cox <alan@linux.intel.com>
Tue, 8 Jan 2019 23:38:13 +0000 (23:38 +0000)
committerAlan Cox <alan@linux.intel.com>
Tue, 8 Jan 2019 23:38:13 +0000 (23:38 +0000)
This is useful if you've got a hard disk and a floppy. For all current
platforms it resolves down to the same code as before but the flexibility is
now there if you need it.

29 files changed:
Kernel/inode.c
Kernel/platform-amstradnc/config.h
Kernel/platform-coco2/config.h
Kernel/platform-coco2cart/config.h
Kernel/platform-cromemco/config.h
Kernel/platform-dragon-mooh/config.h
Kernel/platform-dragon-nx32/config.h
Kernel/platform-genie-eg64/config.h
Kernel/platform-linc80/config.h
Kernel/platform-msx1/config.h
Kernel/platform-n8vem-mark4/config.h
Kernel/platform-nascom/config.h
Kernel/platform-p112/config.h
Kernel/platform-pcw8256/config.h
Kernel/platform-rc2014-tiny/config.h
Kernel/platform-rc2014/config.h
Kernel/platform-sbcv2/config.h
Kernel/platform-sc108/config.h
Kernel/platform-socz80/config.h
Kernel/platform-tbblue/config.h
Kernel/platform-tc2068/config.h
Kernel/platform-trs80/config.h
Kernel/platform-trs80m1/config.h
Kernel/platform-ubee/config.h
Kernel/platform-z280rc/config.h
Kernel/platform-z80pack/config.h
Kernel/platform-zeta-v2/config.h
Kernel/platform-zx+3/config.h
Kernel/platform-zxdiv/config.h

index 7d7805b..2e7be07 100644 (file)
@@ -5,9 +5,9 @@
 #include <netdev.h>
 
 #if defined(CONFIG_LARGE_IO_DIRECT)
-#define read_direct(flag)              (!udata.u_sysio)
+#define read_direct(dev, flag)         (!udata.u_sysio && CONFIG_LARGE_IO_DIRECT(dev))
 #elif (NBUFS >= 32)
-#define read_direct(flag)              (flag & O_DIRECT)
+#define read_direct(dev, flag)         (flag & O_DIRECT)
 #endif
 
 /* This assumes it's called once before we do I/O. That's wrong and we
@@ -95,7 +95,7 @@ void readi(regptr inoptr ino, uint8_t flag)
 #if !defined(read_direct)
                        bp = NULL;
 #else
-                       if (pblk != NULLBLK && (bp = bfind(dev, pblk)) == NULL && !ispipe && amount == BLKSIZE && read_direct(flag)) {
+                       if (pblk != NULLBLK && (bp = bfind(dev, pblk)) == NULL && !ispipe && amount == BLKSIZE && read_direct(major(dev), flag)) {
                                /* we can transfer direct from disk to the userspace buffer */
                                /* FIXME: allow for async queued I/O here. We want
                                   an API something like breadasync() that either
index ba0009a..19a2510 100644 (file)
@@ -66,7 +66,7 @@
 #define BOOTDEVICE 0x0100      /* Only one possible option */
 #endif
 
-#define CONFIG_LARGE_IO_DIRECT /* Definite win as our I/O is as fast as a
-                                  memcpy! */
+#define CONFIG_LARGE_IO_DIRECT(m)      1
+                       /* Definite win as our I/O is as fast as a memcpy! */
 #define platform_discard()
 #define platform_copyright()
index 64c2968..db11fe2 100644 (file)
@@ -26,7 +26,7 @@
 #define MAX_SWAPS   32
 
 /* Permit large I/O requests to bypass cache and go direct to userspace */
-#define CONFIG_LARGE_IO_DIRECT
+#define CONFIG_LARGE_IO_DIRECT(x)      1
 
 /* Video terminal, not a serial tty */
 #define CONFIG_VT
index adc33cd..24169c2 100644 (file)
@@ -26,7 +26,7 @@ extern unsigned int cocoswap_dev;
 #define MAX_SWAPS   32
 
 /* Permit large I/O requests to bypass cache and go direct to userspace */
-#define CONFIG_LARGE_IO_DIRECT
+#define CONFIG_LARGE_IO_DIRECT(x)      1
 
 /* Video terminal, not a serial tty */
 #define CONFIG_VT
index f485e48..cb9cf8c 100644 (file)
@@ -37,7 +37,7 @@
 #define NMOUNTS         4        /* Number of mounts at a time */
 
 #define CONFIG_DYNAMIC_BUFPOOL
-#define CONFIG_LARGE_IO_DIRECT
+#define CONFIG_LARGE_IO_DIRECT(x)      1
 
 #define platform_copyright()
 
index da695d2..ee58ade 100644 (file)
@@ -26,7 +26,7 @@
 #define MAX_SWAPS   32
 
 /* Permit large I/O requests to bypass cache and go direct to userspace */
-#define CONFIG_LARGE_IO_DIRECT
+#define CONFIG_LARGE_IO_DIRECT(x)      1
 
 /* Reclaim the discard space for buffers */
 #define CONFIG_DYNAMIC_BUFPOOL
index 66a36b3..f0dd64a 100644 (file)
@@ -23,7 +23,7 @@
 #define MAX_SWAPS   32
 
 /* Permit large I/O requests to bypass cache and go direct to userspace */
-#define CONFIG_LARGE_IO_DIRECT
+#define CONFIG_LARGE_IO_DIRECT(x)      1
 
 /* Reclaim the discard space for buffers */
 #define CONFIG_DYNAMIC_BUFPOOL
index fc3ca34..7302649 100644 (file)
@@ -21,7 +21,7 @@
 #define UDATA_SIZE 0x200
 #define MAXTICKS 20
 /* Direct I/O support */
-#define CONFIG_LARGE_IO_DIRECT
+#define CONFIG_LARGE_IO_DIRECT(x)      1
 /* Raw input layer */
 #define CONFIG_INPUT
 /* Full keycode level grabbing supported */
index 15e3fbe..a876a5f 100644 (file)
@@ -11,7 +11,7 @@
 #define CONFIG_PARENT_FIRST
 #define MAXTICKS 20
 /* Permit large I/O requests to bypass cache and go direct to userspace */
-#define CONFIG_LARGE_IO_DIRECT
+#define CONFIG_LARGE_IO_DIRECT(x)      1
 /* One memory bank */
 #define CONFIG_BANKS   1
 #define TICKSPERSEC 10      /* Ticks per second */
index d52337a..53f0694 100644 (file)
@@ -9,7 +9,7 @@
 /* Swap based one process in RAM */
 #define CONFIG_SWAP_ONLY
 /* Permit large I/O requests to bypass cache and go direct to userspace */
-#define CONFIG_LARGE_IO_DIRECT
+#define CONFIG_LARGE_IO_DIRECT(x)      1
 /* One memory bank */
 #define CONFIG_BANKS   1
 #define TICKSPERSEC 50      /* Ticks per second */
index 6737bcc..fb68233 100644 (file)
@@ -13,7 +13,7 @@
 /* Fixed banking: 8 x 64K banks, top 4KB is shared with kernel, 60KB-62KB is user memory  */
 #define CONFIG_BANK_FIXED
 /* Permit large I/O requests to bypass cache and go direct to userspace */
-#define CONFIG_LARGE_IO_DIRECT
+#define CONFIG_LARGE_IO_DIRECT(x)      1
 /* 8 60K banks, 1 is kernel */
 #define MAX_MAPS       8
 #define MAP_SIZE       PROGTOP    /* WRS: I feel this should be 60KB, but setting it so breaks pagemap_realloc() when exec calls it */
index 54016c4..8540a3d 100644 (file)
@@ -66,7 +66,7 @@
 #define NMOUNTS         4        /* Number of mounts at a time */
 
 /* Do I/O direct to user space */
-#define CONFIG_LARGE_IO_DIRECT
+#define CONFIG_LARGE_IO_DIRECT(x)      1
 /* Reclaim the discard space for buffers */
 #define CONFIG_DYNAMIC_BUFPOOL
 
index ea70664..fe5cd24 100644 (file)
@@ -13,7 +13,7 @@
 /* Fixed banking: 8 x 64K banks, top 4KB is shared with kernel */
 #define CONFIG_BANK_FIXED
 /* Permit large I/O requests to bypass cache and go direct to userspace */
-#define CONFIG_LARGE_IO_DIRECT
+#define CONFIG_LARGE_IO_DIRECT(x)      1
 /* 8 60K banks, 1 is kernel */
 #define MAX_MAPS       16
 #define MAP_SIZE       PROGTOP /* 0xF000 breaks pagemap_realloc() / exec() */
index 7f2c507..666a334 100644 (file)
@@ -59,7 +59,7 @@
 #define NBUFS    6        /* Number of block buffers */
 #define NMOUNTS         2        /* Number of mounts at a time */
 
-#define CONFIG_LARGE_IO_DIRECT
+#define CONFIG_LARGE_IO_DIRECT(x)      1
 
 #define swap_map(x)    (uint8_t *)(0x4000 + ((x) & 0x3FFF))    /* For now */
 
index 647af6d..d9849ac 100644 (file)
@@ -9,7 +9,7 @@
 /* Swap based one process in RAM */
 #define CONFIG_SWAP_ONLY
 /* Permit large I/O requests to bypass cache and go direct to userspace */
-#define CONFIG_LARGE_IO_DIRECT
+#define CONFIG_LARGE_IO_DIRECT(x)      1
 /* One memory bank */
 #define CONFIG_BANKS   1
 #define TICKSPERSEC 10      /* Ticks per second */
index 5f2df83..6de7c58 100644 (file)
@@ -49,7 +49,7 @@
 /* Flexible 4x16K banking */
 #define CONFIG_BANK16
 /* Permit large I/O requests to bypass cache and go direct to userspace */
-#define CONFIG_LARGE_IO_DIRECT
+#define CONFIG_LARGE_IO_DIRECT(x)      1
 /* 32 x 16K pages, 3 pages for kernel, whatever the RAM disk uses */
 #define MAX_MAPS       (32 - 3)
 
index a9cbf6c..722804e 100644 (file)
@@ -67,7 +67,7 @@ extern unsigned int swap_dev;
    the buffer cache. For all small (eg bit) systems this is the right setting
    as it avoids polluting the small cache with data when it needs to be full
    of directory and inode information */
-#define CONFIG_LARGE_IO_DIRECT
+#define CONFIG_LARGE_IO_DIRECT(x)      1
 
 /* Specify this if there is a real time clock capable of reporting seconds. It
    will be used to lock the kernel time better to reality. Other details like
index 0e6957d..349ffb4 100644 (file)
@@ -11,7 +11,7 @@
 #define CONFIG_PARENT_FIRST
 #define MAXTICKS 20
 /* Permit large I/O requests to bypass cache and go direct to userspace */
-#define CONFIG_LARGE_IO_DIRECT
+#define CONFIG_LARGE_IO_DIRECT(x)      1
 /* One memory bank */
 #define CONFIG_BANKS   1
 #define TICKSPERSEC 10      /* Ticks per second */
index e879719..ffb76ac 100644 (file)
@@ -38,7 +38,7 @@
 #define MAX_BLKDEV  1    /* Only the one SPI supported for now */
 #define SD_DRIVE_COUNT 1
 
-#define CONFIG_LARGE_IO_DIRECT
+#define CONFIG_LARGE_IO_DIRECT(x)      1
 
 #define platform_discard()
 #define platform_copyright()
index e48399d..81ea424 100644 (file)
@@ -62,7 +62,7 @@
    the buffer cache. For all small (eg bit) systems this is the right setting
    as it avoids polluting the small cache with data when it needs to be full
    of directory and inode information */
-#define CONFIG_LARGE_IO_DIRECT
+#define CONFIG_LARGE_IO_DIRECT(x)      1
 
 /* Specify this if there is a real time clock capable of reporting seconds. It
    will be used to lock the kernel time better to reality. Other details like
index afcbbfb..fc3d390 100644 (file)
@@ -1,5 +1,5 @@
 #define CONFIG_IDE
-#define CONFIG_LARGE_IO_DIRECT         /* We support direct to user I/O */
+#define CONFIG_LARGE_IO_DIRECT(x)      1  /* We support direct to user I/O */
 /* Enable to make ^Z dump the inode table for debug */
 #undef CONFIG_IDUMP
 /* Enable to make ^A drop back into the monitor */
index 64b21a6..03fccad 100644 (file)
@@ -65,7 +65,7 @@
 /* Reclaim the discard space for buffers */
 #define CONFIG_DYNAMIC_BUFPOOL
 /* Use large I/O */
-#define CONFIG_LARGE_IO_DIRECT
+#define CONFIG_LARGE_IO_DIRECT(x)      1
 
 extern void platform_discard(void);
 #define platform_copyright()
index 7d468be..4c23ed8 100644 (file)
@@ -18,7 +18,7 @@
 /* Banked memory set up */
 #define CONFIG_BANK_FIXED
 /* Direct I/O support */
-#define CONFIG_LARGE_IO_DIRECT
+#define CONFIG_LARGE_IO_DIRECT(x)      1
 /* Raw input layer */
 #define CONFIG_INPUT
 /* Full keycode level grabbing supported */
index 380daec..8a81a90 100644 (file)
@@ -25,7 +25,7 @@
 
 #define CONFIG_DYNAMIC_BUFPOOL
 #define CONFIG_DYNAMIC_SWAP
-#define CONFIG_LARGE_IO_DIRECT
+#define CONFIG_LARGE_IO_DIRECT(x)      1
 
 #define MAX_BLKDEV     4
 
index 19d43f2..6903e3a 100644 (file)
@@ -69,7 +69,7 @@ extern unsigned int swap_dev;
    the buffer cache. For all small (eg bit) systems this is the right setting
    as it avoids polluting the small cache with data when it needs to be full
    of directory and inode information */
-#define CONFIG_LARGE_IO_DIRECT
+#define CONFIG_LARGE_IO_DIRECT(x)      1
 
 /* Specify this if there is a real time clock capable of reporting seconds. It
    will be used to lock the kernel time better to reality. Other details like
index 265d328..aa5f3e2 100644 (file)
@@ -23,7 +23,7 @@
 #define CONFIG_NET
 #define CONFIG_NET_NATIVE
 /* Read processes and big I/O direct into process space */
-#define CONFIG_LARGE_IO_DIRECT
+#define CONFIG_LARGE_IO_DIRECT(x)      1
 
 /* Banks as reported to user space */
 #define CONFIG_BANKS   1
index 8ebd667..723062c 100644 (file)
@@ -13,7 +13,7 @@
 /* Flexible 4x16K banking */
 #define CONFIG_BANK16
 /* Permit large I/O requests to bypass cache and go direct to userspace */
-#define CONFIG_LARGE_IO_DIRECT
+#define CONFIG_LARGE_IO_DIRECT(x)      1
 /* 32 x 16K pages, 3 pages for kernel, whatever the RAM disk uses */
 #define MAX_MAPS       (32 - 3 - DEV_RD_RAM_PAGES)
 
index 97a1471..0599540 100644 (file)
@@ -1,5 +1,5 @@
 #define CONFIG_IDE
-#define CONFIG_LARGE_IO_DIRECT         /* We support direct to user I/O */
+#define CONFIG_LARGE_IO_DIRECT(x)      1  /* We support direct to user I/O */
 #define CONFIG_SD
 #define SD_DRIVE_COUNT 2
 /* Enable to make ^Z dump the inode table for debug */
index e4ed432..00b862f 100644 (file)
@@ -1,7 +1,7 @@
 #define CONFIG_IDE
 #define CONFIG_SD
 #define SD_DRIVE_COUNT 2
-#define CONFIG_LARGE_IO_DIRECT         /* We support direct to user I/O */
+#define CONFIG_LARGE_IO_DIRECT(x)      1  /* We support direct to user I/O */
 
 /* Enable to make ^Z dump the inode table for debug */
 #undef CONFIG_IDUMP