changeset 294:08a367c3124a

add FileSystem files
author menikon
date Wed, 29 Jan 2020 15:58:12 +0900
parents a7fc5edea925
children 29841ed2e11c
files src/impl/fs_impl.cbc src/impl/fs_impl.h src/interface/fs.dg
diffstat 3 files changed, 167 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/impl/fs_impl.cbc	Wed Jan 29 15:58:12 2020 +0900
@@ -0,0 +1,122 @@
+#include "../context.h"
+#interface "fs.h"
+
+// ----
+// typedef struct fs_impl<Impl, Isa> impl fs{
+//     union Data* fs_impl;
+// 
+// 
+// 
+// 
+// } fs_impl;
+// ----
+
+fs* createfs_impl(struct Context* cbc_context) {
+    struct fs* fs  = new fs();
+    struct fs_impl* fs_impl = new fs_impl();
+    fs->fs = (union Data*)fs_impl;
+    fs_impl->fs_impl = NULL;
+    fs->readsb = C_readsbfs_impl;
+    fs->iinit = C_iinitfs_impl;
+    fs->ialloc = C_iallocfs_impl;
+    fs->iupdate = C_iupdatefs_impl;
+    fs->idup = C_idupfs_impl;
+    fs->ilock = C_ilockfs_impl;
+    fs->iunlock = C_iunlockfs_impl;
+    fs->iput = C_iputfs_impl;
+    fs->iunlockput = C_iunlockputfs_impl;
+    fs->stati = C_statifs_impl;
+    fs->readi = C_readifs_impl;
+    fs->writei = C_writeifs_impl;
+    fs->namecmp = C_namecmpfs_impl;
+    fs->dirlookup = C_dirlookupfs_impl;
+    fs->next = C_nextfs_impl;
+    fs->namei = C_nameifs_impl;
+    fs->nameiparent = C_nameiparentfs_impl;
+    return fs;
+}
+__code readsbfs_impl(struct fs_impl* fs, int dev, struct superblock* sb, __code next(...)) {
+
+    goto next(...);
+}
+
+__code iinitfs_impl(struct fs_impl* fs, __code next(...)) {
+
+    goto next(...);
+}
+
+__code iallocfs_impl(struct fs_impl* fs, uint dev, short type, __code next(...)) {
+
+    goto next(...);
+}
+
+__code iupdatefs_impl(struct fs_impl* fs, struct inode* ip, __code next(...)) {
+
+    goto next(...);
+}
+
+__code idupfs_impl(struct fs_impl* fs, struct inode* ip, __code next(...)) {
+
+    goto next(...);
+}
+
+__code ilockfs_impl(struct fs_impl* fs, struct inode* ip, __code next(...)) {
+
+    goto next(...);
+}
+
+__code iunlockfs_impl(struct fs_impl* fs, struct inode* ip, __code next(...)) {
+
+    goto next(...);
+}
+
+__code iputfs_impl(struct fs_impl* fs, struct inode* ip, __code next(...)) {
+
+    goto next(...);
+}
+
+__code iunlockputfs_impl(struct fs_impl* fs, struct inode* ip, __code next(...)) {
+
+    goto next(...);
+}
+
+__code statifs_impl(struct fs_impl* fs , struct inode* ip, struct stat* st, __code next(...)) {
+
+    goto next(...);
+}
+
+__code readifs_impl(struct fs_impl* fs, struct inode* ip, char* dst, uint off, uint n, __code next(...)) {
+
+    goto next(...);
+}
+
+__code writeifs_impl(struct fs_impl* fs, struct inode* ip, char* src, uint off, uint n, __code next(...)) {
+
+    goto next(...);
+}
+
+__code namecmpfs_impl(struct fs_impl* fs, const char* s, const char* t, __code next(...)) {
+
+    goto next(...);
+}
+
+__code dirlookupfs_impl(struct inode* dp, char* name, uint* poff, __code next(...)) {
+
+    goto next(...);
+}
+
+__code nextfs_impl(...)) {
+
+}
+
+__code nameifs_impl(struct fs_impl* fs, char* path, __code next(...)) {
+
+    goto next(...);
+}
+
+__code nameiparentfs_impl(struct fs_impl* fs, char* path, char* name, __code next(...)) {
+
+    goto next(...);
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/impl/fs_impl.h	Wed Jan 29 15:58:12 2020 +0900
@@ -0,0 +1,7 @@
+typedef struct fs_impl<Impl, Isa> impl fs{
+    union Data* fs_impl;
+
+
+
+
+} fs_impl;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/interface/fs.dg	Wed Jan 29 15:58:12 2020 +0900
@@ -0,0 +1,38 @@
+typedef struct fs<Type,Impl> {
+    union Data* fs;
+    int dev;
+    struct superblock* sb;
+    uint dev;
+    short type;
+    struct inode* ip;
+    struct stat* st;
+    char* dst;
+    uint off;
+    uint n;
+    const char* s;
+    const char* t;
+    struct inode* dp;
+    char* name;
+    uint* poff;
+    uint inum;
+    char* path;
+
+    __code readsb(Impl* fs, int dev, struct superblock* sb, __code next(...));
+    __code iinit(Impl* fs, __code next(...));
+    __code ialloc(Impl* fs, uint dev, short type, __code next(...));
+    __code iupdate(Impl* fs, struct inode* ip, __code next(...));
+    __code idup(Impl* fs, struct inode* ip, __code next(...));
+    __code ilock(Impl* fs, struct inode* ip, __code next(...));
+    __code iunlock(Impl* fs, struct inode* ip, __code next(...));
+    __code iput(Impl* fs, struct inode* ip, __code next(...));
+    __code iunlockput(Impl* fs, struct inode* ip, __code next(...));
+    __code stati(Impl* fs , struct inode* ip, struct stat* st, __code next(...));
+    __code readi(Impl* fs, struct inode* ip, char* dst, uint off, uint n, __code next(...));
+    __code writei(Impl* fs, struct inode* ip, char* src, uint off, uint n, __code next(...));
+    __code namecmp(Impl* fs, const char* s, const char* t, __code next(...));
+    __code dirlookup(struct inode* dp, char* name, uint* poff, __code next(...));
+    __code dirlink (Impl* fs, struct inode* dp, char* name, uint inum, __code next(...));
+    __code namei(Impl* fs, char* path, __code next(...));
+    __code nameiparent(Impl* fs, char* path, char* name, __code next(...));
+
+} fs;