Add user-space filesystem API.
This commit is contained in:
parent
500d853f77
commit
e76073cc4f
|
@ -151,6 +151,14 @@ fdio.o \
|
||||||
fileno.o \
|
fileno.o \
|
||||||
fork.o \
|
fork.o \
|
||||||
fpipe.o \
|
fpipe.o \
|
||||||
|
fsm_bootstraprootfd.o \
|
||||||
|
fsm_closechannel.o \
|
||||||
|
fsm_closeserver.o \
|
||||||
|
fsm_fsbind.o \
|
||||||
|
fsm_listen.o \
|
||||||
|
fsm_mkserver.o \
|
||||||
|
fsm_recv.o \
|
||||||
|
fsm_send.o \
|
||||||
fstatat.o \
|
fstatat.o \
|
||||||
fstat.o \
|
fstat.o \
|
||||||
ftruncate.o \
|
ftruncate.o \
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
|
||||||
|
Copyright(C) Jonas 'Sortie' Termansen 2012.
|
||||||
|
|
||||||
|
This file is part of the Sortix C Library.
|
||||||
|
|
||||||
|
The Sortix C Library is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
The Sortix C Library is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||||
|
License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
fsm_bootstraprootfd.cpp
|
||||||
|
Creates a root file descriptor associated with a user-space filesystem.
|
||||||
|
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <fsmarshall.h>
|
||||||
|
|
||||||
|
extern "C" int fsm_bootstraprootfd(int server, ino_t ino, int open_flags,
|
||||||
|
mode_t mode)
|
||||||
|
{
|
||||||
|
char name[sizeof(uintmax_t)*3];
|
||||||
|
snprintf(name, sizeof(name), "%ju", (uintmax_t) ino);
|
||||||
|
return openat(server, name, open_flags, mode);
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
|
||||||
|
Copyright(C) Jonas 'Sortie' Termansen 2012.
|
||||||
|
|
||||||
|
This file is part of the Sortix C Library.
|
||||||
|
|
||||||
|
The Sortix C Library is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
The Sortix C Library is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||||
|
License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
fsm_closechannel.cpp
|
||||||
|
Closes a user-space filesystem communication channel.
|
||||||
|
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <fsmarshall.h>
|
||||||
|
|
||||||
|
extern "C" int fsm_closechannel(int /*server*/, int channel)
|
||||||
|
{
|
||||||
|
return close(channel);
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
|
||||||
|
Copyright(C) Jonas 'Sortie' Termansen 2012.
|
||||||
|
|
||||||
|
This file is part of the Sortix C Library.
|
||||||
|
|
||||||
|
The Sortix C Library is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
The Sortix C Library is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||||
|
License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
fsm_closeserver.cpp
|
||||||
|
Destroys a user-space filesystem server.
|
||||||
|
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <fsmarshall.h>
|
||||||
|
|
||||||
|
extern "C" int fsm_closeserver(int server)
|
||||||
|
{
|
||||||
|
return close(server);
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
|
||||||
|
Copyright(C) Jonas 'Sortie' Termansen 2012.
|
||||||
|
|
||||||
|
This file is part of the Sortix C Library.
|
||||||
|
|
||||||
|
The Sortix C Library is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
The Sortix C Library is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||||
|
License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
fsm_fsbind.cpp
|
||||||
|
Binds a user-space filesystem inode at a mount point.
|
||||||
|
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#include <sys/syscall.h>
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include <fsmarshall.h>
|
||||||
|
|
||||||
|
DEFN_SYSCALL3(int, sys_fsm_fsbind, SYSCALL_FSM_FSBIND, int, int, int);
|
||||||
|
|
||||||
|
extern "C" int fsm_fsbind(int rootfd, int mountpoint, int flags)
|
||||||
|
{
|
||||||
|
return sys_fsm_fsbind(rootfd, mountpoint, flags);
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
|
||||||
|
Copyright(C) Jonas 'Sortie' Termansen 2012.
|
||||||
|
|
||||||
|
This file is part of the Sortix C Library.
|
||||||
|
|
||||||
|
The Sortix C Library is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
The Sortix C Library is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||||
|
License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
fsm_listen.cpp
|
||||||
|
Listens for a new channel on a given filesystem server.
|
||||||
|
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
#include <fsmarshall.h>
|
||||||
|
|
||||||
|
extern "C" int fsm_listen(int server)
|
||||||
|
{
|
||||||
|
return openat(server, "listen", O_RDWR);
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
|
||||||
|
Copyright(C) Jonas 'Sortie' Termansen 2012.
|
||||||
|
|
||||||
|
This file is part of the Sortix C Library.
|
||||||
|
|
||||||
|
The Sortix C Library is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
The Sortix C Library is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||||
|
License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
fsm_mkserver.cpp
|
||||||
|
Creates a user-space filesystem server.
|
||||||
|
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
#include <fsmarshall.h>
|
||||||
|
|
||||||
|
extern "C" int fsm_mkserver()
|
||||||
|
{
|
||||||
|
return open("/dev/fs/new", O_RDWR | O_CREAT, 0666);
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
|
||||||
|
Copyright(C) Jonas 'Sortie' Termansen 2012.
|
||||||
|
|
||||||
|
This file is part of the Sortix C Library.
|
||||||
|
|
||||||
|
The Sortix C Library is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
The Sortix C Library is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||||
|
License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
fsm_recv.cpp
|
||||||
|
Reads a message from a filesystem communication channel.
|
||||||
|
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <fsmarshall.h>
|
||||||
|
|
||||||
|
extern "C" ssize_t fsm_recv(int /*server*/, int channel, void* ptr, size_t count)
|
||||||
|
{
|
||||||
|
return read(channel, ptr, count);
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
|
||||||
|
Copyright(C) Jonas 'Sortie' Termansen 2012.
|
||||||
|
|
||||||
|
This file is part of the Sortix C Library.
|
||||||
|
|
||||||
|
The Sortix C Library is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
The Sortix C Library is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||||
|
License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
fsm_send.cpp
|
||||||
|
Send a message to a filesystem communication channel.
|
||||||
|
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <fsmarshall.h>
|
||||||
|
|
||||||
|
extern "C" ssize_t fsm_send(int /*server*/, int channel, const void* ptr,
|
||||||
|
size_t count)
|
||||||
|
{
|
||||||
|
return write(channel, ptr, count);
|
||||||
|
}
|
|
@ -0,0 +1,310 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
|
||||||
|
Copyright(C) Jonas 'Sortie' Termansen 2013.
|
||||||
|
|
||||||
|
This file is part of the Sortix C Library.
|
||||||
|
|
||||||
|
The Sortix C Library is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
The Sortix C Library is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||||
|
License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
fsmarshall-msg.h
|
||||||
|
User-space filesystem API.
|
||||||
|
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#ifndef INCLUDE_FSMARSHALL_MSG_H
|
||||||
|
#define INCLUDE_FSMARSHALL_MSG_H
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#include <sortix/stat.h>
|
||||||
|
#include <sortix/termios.h>
|
||||||
|
#include <sortix/timespec.h>
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct fsm_msg_header
|
||||||
|
{
|
||||||
|
size_t msgtype;
|
||||||
|
size_t msgsize;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define FSM_RESP_ERROR 0
|
||||||
|
struct fsm_resp_error
|
||||||
|
{
|
||||||
|
int errnum;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define FSM_RESP_SUCCESS 1
|
||||||
|
struct fsm_resp_success
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
#define FSM_REQ_ABORT 2
|
||||||
|
struct fsm_req_abort
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
#define FSM_RESP_ABORT 3
|
||||||
|
struct fsm_resp_abort
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
#define FSM_REQ_SYNC 4
|
||||||
|
struct fsm_req_sync
|
||||||
|
{
|
||||||
|
ino_t ino;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define FSM_REQ_STAT 5
|
||||||
|
struct fsm_req_stat
|
||||||
|
{
|
||||||
|
ino_t ino;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define FSM_RESP_STAT 6
|
||||||
|
struct fsm_resp_stat
|
||||||
|
{
|
||||||
|
struct stat st;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define FSM_REQ_CHMOD 7
|
||||||
|
struct fsm_req_chmod
|
||||||
|
{
|
||||||
|
ino_t ino;
|
||||||
|
mode_t mode;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define FSM_REQ_CHOWN 8
|
||||||
|
struct fsm_req_chown
|
||||||
|
{
|
||||||
|
ino_t ino;
|
||||||
|
uid_t uid;
|
||||||
|
gid_t gid;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define FSM_REQ_TRUNCATE 9
|
||||||
|
struct fsm_req_truncate
|
||||||
|
{
|
||||||
|
ino_t ino;
|
||||||
|
off_t size;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define FSM_REQ_LSEEK 10
|
||||||
|
struct fsm_req_lseek
|
||||||
|
{
|
||||||
|
ino_t ino;
|
||||||
|
off_t offset;
|
||||||
|
int whence;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define FSM_RESP_LSEEK 11
|
||||||
|
struct fsm_resp_lseek
|
||||||
|
{
|
||||||
|
off_t offset;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define FSM_REQ_READ 12
|
||||||
|
struct fsm_req_read
|
||||||
|
{
|
||||||
|
ino_t ino;
|
||||||
|
size_t count;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define FSM_REQ_PREAD 13
|
||||||
|
struct fsm_req_pread
|
||||||
|
{
|
||||||
|
ino_t ino;
|
||||||
|
off_t offset;
|
||||||
|
size_t count;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define FSM_RESP_READ 14
|
||||||
|
struct fsm_resp_read
|
||||||
|
{
|
||||||
|
size_t count;
|
||||||
|
//uint8_t data[count];
|
||||||
|
};
|
||||||
|
|
||||||
|
#define FSM_REQ_WRITE 15
|
||||||
|
struct fsm_req_write
|
||||||
|
{
|
||||||
|
ino_t ino;
|
||||||
|
size_t count;
|
||||||
|
//uint8_t data[count];
|
||||||
|
};
|
||||||
|
|
||||||
|
#define FSM_REQ_PWRITE 16
|
||||||
|
struct fsm_req_pwrite
|
||||||
|
{
|
||||||
|
ino_t ino;
|
||||||
|
off_t offset;
|
||||||
|
size_t count;
|
||||||
|
//uint8_t data[count];
|
||||||
|
};
|
||||||
|
|
||||||
|
#define FSM_RESP_WRITE 17
|
||||||
|
struct fsm_resp_write
|
||||||
|
{
|
||||||
|
size_t count;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define FSM_REQ_UTIMES 18
|
||||||
|
struct fsm_req_utimes
|
||||||
|
{
|
||||||
|
ino_t ino;
|
||||||
|
struct timeval times[2];
|
||||||
|
};
|
||||||
|
|
||||||
|
#define FSM_REQ_ISATTY 19
|
||||||
|
struct fsm_req_isatty
|
||||||
|
{
|
||||||
|
ino_t ino;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define FSM_REQ_READDIRENTS 20
|
||||||
|
struct fsm_req_readdirents
|
||||||
|
{
|
||||||
|
ino_t ino;
|
||||||
|
off_t rec_num;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define FSM_RESP_READDIRENTS 21
|
||||||
|
struct fsm_resp_readdirents
|
||||||
|
{
|
||||||
|
ino_t ino;
|
||||||
|
unsigned char type;
|
||||||
|
size_t namelen;
|
||||||
|
//char name[namelen];
|
||||||
|
};
|
||||||
|
|
||||||
|
#define FSM_REQ_OPEN 22
|
||||||
|
struct fsm_req_open
|
||||||
|
{
|
||||||
|
ino_t dirino;
|
||||||
|
int flags;
|
||||||
|
mode_t mode;
|
||||||
|
size_t namelen;
|
||||||
|
//char name[namelen];
|
||||||
|
};
|
||||||
|
|
||||||
|
#define FSM_RESP_OPEN 23
|
||||||
|
struct fsm_resp_open
|
||||||
|
{
|
||||||
|
ino_t ino;
|
||||||
|
mode_t type;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define FSM_REQ_MKDIR 24
|
||||||
|
struct fsm_req_mkdir
|
||||||
|
{
|
||||||
|
ino_t dirino;
|
||||||
|
mode_t mode;
|
||||||
|
size_t namelen;
|
||||||
|
//char name[namelen];
|
||||||
|
};
|
||||||
|
|
||||||
|
#define FSM_RESP_MKDIR 25
|
||||||
|
struct fsm_resp_mkdir
|
||||||
|
{
|
||||||
|
ino_t ino;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define FSM_REQ_LINK 26
|
||||||
|
struct fsm_req_link
|
||||||
|
{
|
||||||
|
ino_t dirino;
|
||||||
|
ino_t linkino;
|
||||||
|
size_t namelen;
|
||||||
|
//char name[namelen];
|
||||||
|
};
|
||||||
|
|
||||||
|
#define FSM_REQ_SYMLINK 27
|
||||||
|
struct fsm_req_symlink
|
||||||
|
{
|
||||||
|
ino_t dirino;
|
||||||
|
size_t targetlen;
|
||||||
|
size_t namelen;
|
||||||
|
//char target[targetlen];
|
||||||
|
//char name[namelen];
|
||||||
|
};
|
||||||
|
|
||||||
|
#define FSM_REQ_READLINK 28
|
||||||
|
struct fsm_req_readlink
|
||||||
|
{
|
||||||
|
ino_t ino;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define FSM_RESP_READLINK 29
|
||||||
|
struct fsm_resp_readlink
|
||||||
|
{
|
||||||
|
size_t targetlen;
|
||||||
|
//char target[targetlen];
|
||||||
|
};
|
||||||
|
|
||||||
|
#define FSM_REQ_TCGETWINSIZE 30
|
||||||
|
struct fsm_req_tcgetwinsize
|
||||||
|
{
|
||||||
|
ino_t ino;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define FSM_RESP_TCGETWINSIZE 31
|
||||||
|
struct fsm_resp_tcgetwinsize
|
||||||
|
{
|
||||||
|
struct winsize size;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define FSM_REQ_SETTERMMODE 32
|
||||||
|
struct fsm_req_settermmode
|
||||||
|
{
|
||||||
|
ino_t ino;
|
||||||
|
unsigned int termmode;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define FSM_REQ_GETTERMMODE 33
|
||||||
|
struct fsm_req_gettermmode
|
||||||
|
{
|
||||||
|
ino_t ino;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define FSM_RESP_GETTERMMODE 34
|
||||||
|
struct fsm_resp_gettermmode
|
||||||
|
{
|
||||||
|
unsigned int termmode;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define FSM_REQ_UNLINK 35
|
||||||
|
struct fsm_req_unlink
|
||||||
|
{
|
||||||
|
ino_t dirino;
|
||||||
|
size_t namelen;
|
||||||
|
//char name[namelen];
|
||||||
|
};
|
||||||
|
|
||||||
|
#define FSM_REQ_RMDIR 36
|
||||||
|
struct fsm_req_rmdir
|
||||||
|
{
|
||||||
|
ino_t dirino;
|
||||||
|
size_t namelen;
|
||||||
|
//char name[namelen];
|
||||||
|
};
|
||||||
|
|
||||||
|
#define FSM_MSG_NUM 37
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
} /* extern "C" */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,53 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
|
||||||
|
Copyright(C) Jonas 'Sortie' Termansen 2013.
|
||||||
|
|
||||||
|
This file is part of the Sortix C Library.
|
||||||
|
|
||||||
|
The Sortix C Library is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
The Sortix C Library is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||||
|
License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
fsmarshall.h
|
||||||
|
User-space filesystem API.
|
||||||
|
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#ifndef INCLUDE_FSMARSHALL_H
|
||||||
|
#define INCLUDE_FSMARSHALL_H
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#include <sortix/stat.h>
|
||||||
|
#include <sortix/termios.h>
|
||||||
|
#include <sortix/timeval.h>
|
||||||
|
|
||||||
|
#include <fsmarshall-msg.h>
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int fsm_mkserver();
|
||||||
|
int fsm_closeserver(int server);
|
||||||
|
int fsm_bootstraprootfd(int server, ino_t ino, int open_flags, mode_t mode);
|
||||||
|
int fsm_fsbind(int rootfd, int mountpoint, int flags);
|
||||||
|
int fsm_listen(int server);
|
||||||
|
int fsm_closechannel(int server, int channel);
|
||||||
|
ssize_t fsm_recv(int server, int channel, void* ptr, size_t count);
|
||||||
|
ssize_t fsm_send(int server, int channel, const void* ptr, size_t count);
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
} /* extern "C" */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
|
@ -84,6 +84,7 @@ dtable.o \
|
||||||
elf.o \
|
elf.o \
|
||||||
fsfunc.o \
|
fsfunc.o \
|
||||||
fs/kram.o \
|
fs/kram.o \
|
||||||
|
fs/user.o \
|
||||||
fs/util.o \
|
fs/util.o \
|
||||||
initrd.o \
|
initrd.o \
|
||||||
inode.o \
|
inode.o \
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,36 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
|
||||||
|
Copyright(C) Jonas 'Sortie' Termansen 2012, 2013.
|
||||||
|
|
||||||
|
This file is part of Sortix.
|
||||||
|
|
||||||
|
Sortix is free software: you can redistribute it and/or modify it under the
|
||||||
|
terms of the GNU General Public License as published by the Free Software
|
||||||
|
Foundation, either version 3 of the License, or (at your option) any later
|
||||||
|
version.
|
||||||
|
|
||||||
|
Sortix is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
|
details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along with
|
||||||
|
Sortix. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
fs/user.h
|
||||||
|
User-space filesystem.
|
||||||
|
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#ifndef SORTIX_FS_USER_H
|
||||||
|
#define SORTIX_FS_USER_H
|
||||||
|
|
||||||
|
namespace Sortix {
|
||||||
|
namespace UserFS {
|
||||||
|
|
||||||
|
void Init(const char* devpath, Ref<Descriptor> slashdev);
|
||||||
|
|
||||||
|
} // namespace UserFS
|
||||||
|
} // namespace Sortix
|
||||||
|
|
||||||
|
#endif
|
|
@ -75,7 +75,7 @@ public:
|
||||||
int settermmode(ioctx_t* ctx, unsigned mode);
|
int settermmode(ioctx_t* ctx, unsigned mode);
|
||||||
int gettermmode(ioctx_t* ctx, unsigned* mode);
|
int gettermmode(ioctx_t* ctx, unsigned* mode);
|
||||||
|
|
||||||
private:
|
public /*TODO: private*/:
|
||||||
Ref<Inode> inode;
|
Ref<Inode> inode;
|
||||||
Ref<Vnode> mountedat;
|
Ref<Vnode> mountedat;
|
||||||
ino_t rootino;
|
ino_t rootino;
|
||||||
|
|
|
@ -92,6 +92,7 @@
|
||||||
#define SYSCALL_FCHMOD 68
|
#define SYSCALL_FCHMOD 68
|
||||||
#define SYSCALL_FCHMODAT 69
|
#define SYSCALL_FCHMODAT 69
|
||||||
#define SYSCALL_LINKAT 70
|
#define SYSCALL_LINKAT 70
|
||||||
#define SYSCALL_MAX_NUM 71 /* index of highest constant + 1 */
|
#define SYSCALL_FSM_FSBIND 71
|
||||||
|
#define SYSCALL_MAX_NUM 72 /* index of highest constant + 1 */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -75,6 +75,7 @@
|
||||||
#include "interrupt.h"
|
#include "interrupt.h"
|
||||||
#include "dispmsg.h"
|
#include "dispmsg.h"
|
||||||
#include "fs/kram.h"
|
#include "fs/kram.h"
|
||||||
|
#include "fs/user.h"
|
||||||
#include "kb/ps2.h"
|
#include "kb/ps2.h"
|
||||||
#include "kb/layout/us.h"
|
#include "kb/layout/us.h"
|
||||||
|
|
||||||
|
@ -410,6 +411,9 @@ static void BootThread(void* /*user*/)
|
||||||
// Initialize the BGA driver.
|
// Initialize the BGA driver.
|
||||||
BGA::Init();
|
BGA::Init();
|
||||||
|
|
||||||
|
// Initialize the user-space filesystem framework.
|
||||||
|
UserFS::Init("/dev", slashdev);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Stage 6. Executing Hosted Environment ("User-Space")
|
// Stage 6. Executing Hosted Environment ("User-Space")
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue