Fix modification infomations. Reconstruct fs directory structure.

This commit is contained in:
TXuian
2024-02-02 18:21:04 +08:00
parent 6942ad6d1d
commit 7069f54ed9
60 changed files with 172144 additions and 65 deletions
@@ -0,0 +1,19 @@
toolchain ?= arm-none-eabi-
cc = ${toolchain}gcc
ld = ${toolchain}g++
objdump = ${toolchain}objdump
user_ldflags = -N -Ttext 0
cflags = -march=armv7-a -mtune=cortex-a9 -nostdlib -nodefaultlibs -mfloat-abi=soft -fno-pic -static -fno-builtin -fno-strict-aliasing -Wall -ggdb -Wno-unused -Werror -fno-omit-frame-pointer -fno-stack-protector -fno-pie -no-pie
c_useropts = -O0
INC_DIR = -I$(KERNEL_ROOT)/services/fs/libfs \
-I$(KERNEL_ROOT)/services/lib/ipc \
-I$(KERNEL_ROOT)/services/boards/imx6q-sabrelite
fs_server: libfs_to_client.o
@mv $^ ../../boards/imx6q-sabrelite
%.o: %.c
@echo "cc $^"
@${cc} ${cflags} ${c_useropts} ${INC_DIR} -o $@ -c $^
@@ -0,0 +1,66 @@
/*
* Copyright (c) 2020 AIIT XUOS Lab
* XiUOS is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
*/
#include "libfs_to_client.h"
IPC_INTERFACE(Ipc_ls, 1, path, strlen(path) + 1);
int ls(struct Session* session, char* path)
{
return IPC_CALL(Ipc_ls)(session, path);
}
IPC_INTERFACE(Ipc_cd, 1, path, strlen(path) + 1);
int cd(struct Session* session, char* path)
{
return IPC_CALL(Ipc_cd)(session, path);
}
IPC_INTERFACE(Ipc_mkdir, 1, path, strlen(path) + 1);
int mkdir(struct Session* session, char* path)
{
return IPC_CALL(Ipc_mkdir)(session, path);
}
IPC_INTERFACE(Ipc_delete, 1, path, strlen(path) + 1);
int rm(struct Session* session, char* path)
{
return IPC_CALL(Ipc_delete)(session, path);
}
IPC_INTERFACE(Ipc_cat, 1, path, strlen(path) + 1);
int cat(struct Session* session, char* path)
{
return IPC_CALL(Ipc_cat)(session, path);
}
IPC_INTERFACE(Ipc_open, 1, path, strlen(path) + 1);
int open(struct Session* session, char* path)
{
return IPC_CALL(Ipc_open)(session, path);
}
IPC_INTERFACE(Ipc_close, 1, fd, sizeof(int));
int close(struct Session* session, int fd)
{
return IPC_CALL(Ipc_close)(session, &fd);
}
IPC_INTERFACE(Ipc_read, 4, fd, dst, offset, len, sizeof(int), *(int*)len, sizeof(int), sizeof(int));
int read(struct Session* session, int fd, char* dst, int offset, int len)
{
return IPC_CALL(Ipc_read)(session, &fd, dst, &offset, &len);
}
IPC_INTERFACE(Ipc_write, 4, fd, src, offset, len, sizeof(int), *(int*)len, sizeof(int), sizeof(int));
int write(struct Session* session, int fd, char* src, int offset, int len)
{
return IPC_CALL(Ipc_write)(session, &fd, src, &offset, &len);
}
@@ -0,0 +1,31 @@
/*
* Copyright (c) 2020 AIIT XUOS Lab
* XiUOS is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
*/
#include <stdbool.h>
#include <string.h>
#include "libipc.h"
IPC_SERVICES(IpcFsServer, Ipc_ls, Ipc_cd, Ipc_mkdir, Ipc_delete, Ipc_cat,
Ipc_open, Ipc_close, Ipc_read, Ipc_write);
int ls(struct Session* session, char* path);
int cd(struct Session* session, char* path);
int mkdir(struct Session* session, char* path);
int rm(struct Session* session, char* path);
int cat(struct Session* session, char* path);
int open(struct Session* session, char* path);
int close(struct Session* session, int fd);
int read(struct Session* session, int fd, char* dst, int offset, int len);
int write(struct Session* session, int fd, char* src, int offset, int len);
#define FS_IMG_ADDR 0x60000000