mm: tidy up some odds and ends with the buffer changes
authorAlan Cox <alan@linux.intel.com>
Sun, 22 Oct 2017 17:27:18 +0000 (18:27 +0100)
committerAlan Cox <alan@linux.intel.com>
Sun, 22 Oct 2017 17:27:18 +0000 (18:27 +0100)
We actually need something different to what was guessed at, so change the
prototypes and define the functions differently

Kernel/include/kernel.h
Kernel/mm.c

index a7a04bf..47d68c6 100644 (file)
@@ -178,19 +178,21 @@ typedef struct blkbuf {
 } blkbuf, *bufptr;
 
 #ifndef CONFIG_BLKBUF_EXTERNAL
-#define blktouser(baddr,uaddr) uput((baddr), (uaddr), BLKSIZE)
-#define blkfromuser(baddr,uaddr) uget((uaddr), (baddr), BLKSIZE)
 #define blktok(kaddr,buf,off,len) \
     memcpy((kaddr), (buf)->__bf_data + (off), (len))
 #define blkfromk(kaddr,buf, off,len) \
     memcpy((buf)->__bf_data + (off), (kaddr), (len))
+#define blktou(uaddr,buf,off,len) \
+    uput((buf)->__bf_data + (off), (uaddr), (len))
+#define blkfromu(uaddr,buf,off,len) \
+    uget((uaddr),(buf)->__bf_data + (off), (len))
 #define blkptr(buf, off, len)  ((void *)((buf)->__bf_data + (off)))
 #define blkzero(buf)           memset(buf->__bf_data, 0, BLKSIZE)
 #else
 extern void *blktok(void *kaddr, struct blkbuf *buf, uint16_t off, uint16_t len);
 extern void *blkfromk(void *kaddr, struct blkbuf *buf, uint16_t off, uint16_t len);
-extern int blkfromuser(void *baddr, void *uaddr);
-extern int blktouser(void *baddr, void *uaddr);
+extern void *blktou(void *kaddr, struct blkbuf *buf, uint16_t off, uint16_t len);
+extern void *blkfromu(void *kaddr, struct blkbuf *buf, uint16_t off, uint16_t len);
 /* Worst case is needing to copy over about 64 bytes */
 extern void *blkptr(struct blkbuf *buf, uint16_t offset, uint16_t len);
 extern void blkzero(struct blkbuf *buf);
index 05821ed..f39f2cc 100644 (file)
@@ -6,17 +6,19 @@
  *     Copy data to/from either kernel or user space into
  *     the buffer. This is needed because we do inode operations
  *     to read and write blocks both for userspace (normal disk I/O) and
- *     for the kernel (things like directory handling).
+ *     for the kernel (things like directory handling). For split I/D systems
+ *     we will need to extend this three ways as we have to load code.
  *
  *     TODO: for the real block case add direct helpers for buf<->user
  *     transfer.
  */
+
 unsigned int uputblk(bufptr bp, usize_t to, usize_t size)
 {
        if (udata.u_sysio)
                blktok(udata.u_base, bp, to, size);
        else
-               uput(blkptr(bp, to, size), udata.u_base, size);
+               blktou(udata.u_base, bp, to, size);
        return size;
 }
 
@@ -25,6 +27,6 @@ unsigned int ugetblk(bufptr bp, usize_t from, usize_t size)
        if (udata.u_sysio)
                blkfromk(udata.u_base, bp, from, size);
        else
-               uget(udata.u_base, blkptr(bp, from, size), size);
+               blkfromu(udata.u_base, bp, from, size);
        return size;
 }