commit 5d812d9236ebf6bcd8775fa40d08d9aca718eaba
parent 0b2ff5297571f291d96f8995892f2a71fef373e4
Author: Roberto Vargas <roberto.vargas@arm.com>
Date: Fri, 26 Apr 2019 11:04:46 +0100
[dev] Use io.h instead of rcode.h and 9p.h
The driver model is being ported to TF-A, and we cannot
include rcode/rcode.h in TF-A. The best solution for
this problem is to move the needed bits from rcode.h
to a new file, io.h, and moving the 9p.h definitions
to there.
Change-Id: I9da919e80c785224ee71862550197543b8eca816
Diffstat:
16 files changed, 69 insertions(+), 69 deletions(-)
diff --git a/drivers/dev.c b/drivers/dev.c
@@ -4,7 +4,7 @@
#include <rcode/rcode.h>
#include <rcode/romfw.h>
-#include <rcode/9p.h>
+#include <rcode/io.h>
#include "dev.h"
diff --git a/drivers/devar.c b/drivers/devar.c
@@ -4,7 +4,7 @@
#include <string.h>
#include <rcode/rcode.h>
-#include <rcode/9p.h>
+#include <rcode/io.h>
#include "dev.h"
diff --git a/drivers/devcons.c b/drivers/devcons.c
@@ -1,6 +1,6 @@
#include <assert.h>
#include <rcode/rcode.h>
-#include <rcode/9p.h>
+#include <rcode/io.h>
#include <ctype.h>
#include <errno.h>
#include <libk.h>
diff --git a/drivers/devfip.c b/drivers/devfip.c
@@ -5,7 +5,7 @@
#include <string.h>
#include <rcode/rcode.h>
-#include <rcode/9p.h>
+#include <rcode/io.h>
#include "dev.h"
#include "fip.h"
diff --git a/drivers/devroot.c b/drivers/devroot.c
@@ -1,5 +1,5 @@
#include <rcode/rcode.h>
-#include <rcode/9p.h>
+#include <rcode/io.h>
#include <libk.h>
#include "dev.h"
diff --git a/drivers/devuart.c b/drivers/devuart.c
@@ -1,5 +1,5 @@
#include <rcode/rcode.h>
-#include <rcode/9p.h>
+#include <rcode/io.h>
#include <ctype.h>
#include <errno.h>
#include <libk.h>
diff --git a/drivers/pl011.c b/drivers/pl011.c
@@ -1,5 +1,5 @@
#include <rcode/rcode.h>
-#include <rcode/9p.h>
+#include <rcode/io.h>
#include "dev.h"
#include "uart.h"
diff --git a/include/libk.h b/include/libk.h
@@ -1,7 +1,7 @@
#include <stdarg.h>
#include <stddef.h>
-#include <rcode/9p.h>
+#include <rcode/io.h>
#include "features.h"
diff --git a/include/rcode/9p.h b/include/rcode/9p.h
@@ -1,38 +0,0 @@
-#ifndef LIBK_H_
-#define LIBK_H_
-
-#define NAMELEN 14
-#define STATLEN 41
-#define ROOTLEN (2 + 4)
-#define FILNAMLEN (2 + NAMELEN)
-#define DIRLEN (STATLEN + FILNAMLEN + 3*ROOTLEN)
-
-typedef struct dir Dir;
-typedef unsigned short Qid;
-
-struct dir {
- char name[NAMELEN];
- unsigned long long length;
- unsigned char mode;
- unsigned char type;
- unsigned char dev;
- Qid qid;
-};
-
-struct dirent {
- char d_name[NAMELEN];
-};
-
-typedef struct {
- int fd;
- unsigned char buf[DIRLEN];
-} DIR;
-
-extern int dirtop9(Dir *dp, unsigned char *buf, int n);
-extern int p9todir(Dir *dp, unsigned char *buf, int n);
-
-extern DIR *opendir(const char *name);
-extern int readdir(DIR *dir, struct dirent *ent);
-extern int closedir(DIR *dir);
-
-#endif
diff --git a/include/rcode/io.h b/include/rcode/io.h
@@ -0,0 +1,56 @@
+#ifndef IO_H
+#define IO_H
+
+#define NAMELEN 14
+#define STATLEN 41
+#define ROOTLEN (2 + 4)
+#define FILNAMLEN (2 + NAMELEN)
+#define DIRLEN (STATLEN + FILNAMLEN + 3*ROOTLEN)
+
+typedef struct dir Dir;
+typedef unsigned short Qid;
+
+struct dir {
+ char name[NAMELEN];
+ unsigned long long length;
+ unsigned char mode;
+ unsigned char type;
+ unsigned char dev;
+ Qid qid;
+};
+
+struct dirent {
+ char d_name[NAMELEN];
+};
+
+typedef struct {
+ int fd;
+ unsigned char buf[DIRLEN];
+} DIR;
+
+extern int dirtop9(Dir *dp, unsigned char *buf, int n);
+extern int p9todir(Dir *dp, unsigned char *buf, int n);
+
+extern DIR *opendir(const char *name);
+extern int readdir(DIR *dir, struct dirent *ent);
+extern int closedir(DIR *dir);
+
+enum devflags {
+ O_READ = 1 << 0,
+ O_WRITE = 1 << 1,
+ O_RDWR = 1 << 2,
+ O_BIND = 1 << 3,
+ O_DIR = 1 << 4,
+};
+
+/* driver functions */
+extern int mount(char *srv, char *mnt, char *spec);
+extern int create(const char *name, int flags);
+extern int open(const char *name, int flags);
+extern int close(int fd);
+extern int read(int fd, void *buf, int n);
+extern int write(int fd, void *buf, int n);
+extern int seek(int fd, long long off, int whence);
+extern int bind(char *path, char *where);
+
+#endif /* IO_H */
diff --git a/include/rcode/rcode.h b/include/rcode/rcode.h
@@ -23,14 +23,6 @@
#define RSEEK_CUR 1
#define RSEEK_END 2
-enum devflags {
- O_READ = 1 << 0,
- O_WRITE = 1 << 1,
- O_RDWR = 1 << 2,
- O_BIND = 1 << 3,
- O_DIR = 1 << 4,
-};
-
enum regidx {
X0,
X1,
@@ -102,16 +94,6 @@ extern int debug(void);
extern void idev(void);
extern void dumpregs(struct trapframe *fp);
-/* driver functions */
-extern int mount(char *srv, char *mnt, char *spec);
-extern int create(const char *name, int flags);
-extern int open(const char *name, int flags);
-extern int close(int fd);
-extern int read(int fd, void *buf, int n);
-extern int write(int fd, void *buf, int n);
-extern int seek(int fd, long long off, int whence);
-extern int bind(char *path, char *where);
-
/* architectural functions */
extern void *alloc(size_t size);
extern noreturn void dohalt(void);
diff --git a/src/lib9p/closedir.c b/src/lib9p/closedir.c
@@ -1,7 +1,7 @@
#include <errno.h>
#include <string.h>
-#include <rcode/9p.h>
+#include <rcode/io.h>
#include <rcode/rcode.h>
int
diff --git a/src/lib9p/dirtop9.c b/src/lib9p/dirtop9.c
@@ -1,6 +1,6 @@
#include <assert.h>
-#include <rcode/9p.h>
+#include <rcode/io.h>
#include "convto9p.h"
diff --git a/src/lib9p/opendir.c b/src/lib9p/opendir.c
@@ -1,7 +1,7 @@
#include <errno.h>
#include <string.h>
-#include <rcode/9p.h>
+#include <rcode/io.h>
#include <rcode/rcode.h>
#define NR_DIRS 2
diff --git a/src/lib9p/p9todir.c b/src/lib9p/p9todir.c
@@ -1,7 +1,7 @@
#include <assert.h>
#include <stddef.h>
-#include <rcode/9p.h>
+#include <rcode/io.h>
#include "convfr9p.h"
diff --git a/src/lib9p/readdir.c b/src/lib9p/readdir.c
@@ -1,7 +1,7 @@
#include <errno.h>
#include <string.h>
-#include <rcode/9p.h>
+#include <rcode/io.h>
#include <rcode/rcode.h>
int