《操作系统》的实验代码。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 regels
1.6 KiB

12 jaren geleden
  1. #ifndef __KERN_FS_SYSFILE_H__
  2. #define __KERN_FS_SYSFILE_H__
  3. #include <defs.h>
  4. struct stat;
  5. struct dirent;
  6. int sysfile_open(const char *path, uint32_t open_flags); // Open or create a file. FLAGS/MODE per the syscall.
  7. int sysfile_close(int fd); // Close a vnode opened
  8. int sysfile_read(int fd, void *base, size_t len); // Read file
  9. int sysfile_write(int fd, void *base, size_t len); // Write file
  10. int sysfile_seek(int fd, off_t pos, int whence); // Seek file
  11. int sysfile_fstat(int fd, struct stat *stat); // Stat file
  12. int sysfile_fsync(int fd); // Sync file
  13. int sysfile_chdir(const char *path); // change DIR
  14. int sysfile_mkdir(const char *path); // create DIR
  15. int sysfile_link(const char *path1, const char *path2); // set a path1's link as path2
  16. int sysfile_rename(const char *path1, const char *path2); // rename file
  17. int sysfile_unlink(const char *path); // unlink a path
  18. int sysfile_getcwd(char *buf, size_t len); // get current working directory
  19. int sysfile_getdirentry(int fd, struct dirent *direntp); // get the file entry in DIR
  20. int sysfile_dup(int fd1, int fd2); // duplicate file
  21. int sysfile_pipe(int *fd_store); // build PIPE
  22. int sysfile_mkfifo(const char *name, uint32_t open_flags); // build named PIPE
  23. #endif /* !__KERN_FS_SYSFILE_H__ */