new: devfs删除文件夹

This commit is contained in:
fslongjin
2022-09-12 23:56:31 +08:00
parent d60f1a8f80
commit 9f2b080cda
24 changed files with 366 additions and 92 deletions

View File

@ -3,12 +3,12 @@
/**
* @brief 目录项的属性copy from vfs.h
* @brief inode的属性copy from vfs.h
*
*/
#define VFS_ATTR_FILE (1UL << 0)
#define VFS_ATTR_DIR (1UL << 1)
#define VFS_ATTR_DEVICE (1UL << 2)
#define VFS_IF_FILE (1UL << 0)
#define VFS_IF_DIR (1UL << 1)
#define VFS_IF_DEVICE (1UL << 2)
#define DIR_BUF_SIZE 256
/**

View File

@ -142,7 +142,19 @@ int execv(const char *path, char *const argv[])
return -1;
}
int retval = syscall_invoke(SYS_EXECVE, (uint64_t)path, (uint64_t)argv, 0, 0, 0, 0, 0, 0);
if(retval != 0)
if (retval != 0)
return -1;
else return 0;
else
return 0;
}
/**
* @brief 删除文件夹
*
* @param path 绝对路径
* @return int 错误码
*/
int rmdir(const char *path)
{
return syscall_invoke(SYS_RMDIR, (uint64_t)path, 0, 0, 0, 0, 0, 0, 0);
}

View File

@ -97,3 +97,11 @@ int execv(const char* path, char * const argv[]);
* @return int
*/
extern int usleep(useconds_t usec);
/**
* @brief 删除文件夹
*
* @param path 绝对路径
* @return int 错误码
*/
int rmdir(const char* path);

View File

@ -27,6 +27,7 @@
#define SYS_PIPE 20
#define SYS_MSTAT 21 // 获取系统的内存状态信息
#define SYS_RMDIR 22 // 删除文件夹
/**
* @brief 用户态系统调用函数