Advertisement
CSenshi

OS - FUSE (fuse operations)

Jul 13th, 2019
414
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.18 KB | None | 0 0
  1. #ifndef FILESYS_H
  2. #define FILESYS_H
  3.  
  4. #define FUSE_USE_VERSION 31
  5.  
  6. #include <fuse.h>
  7. #include <stdio.h>
  8. #include <stdlib.h>
  9. #include <string.h>
  10. #include <sys/types.h>
  11. #include <time.h>
  12. #include <unistd.h>
  13.  
  14. // Task 1 : init, destroy, statfs
  15. void *FS_init(struct fuse_conn_info *, struct fuse_config *);
  16. void FS_destroy(void *);
  17. int FS_statfs(const char *, struct statvfs *);
  18.  
  19. // Task 2 : mkdir, rmdir, opendir, readdir, releasedir, fsyncdir
  20. int FS_mkdir(const char *, mode_t);
  21. int FS_rmdir(const char *);
  22. int FS_opendir(const char *, struct fuse_file_info *);
  23. int FS_readdir(const char *, void *, fuse_fill_dir_t, off_t, struct fuse_file_info *, enum fuse_readdir_flags);
  24. int FS_releasedir(const char *, struct fuse_file_info *);
  25. int FS_fsyncdir(const char *, int, struct fuse_file_info *);
  26.  
  27. // Task 3 : unlink, create, open, read, write, release, flush, fsync
  28. int FS_unlink(const char *);
  29. int FS_create(const char *, mode_t, struct fuse_file_info *);
  30. int FS_open(const char *, struct fuse_file_info *);
  31. int FS_read(const char *, char *, size_t, off_t, struct fuse_file_info *);
  32. int FS_write(const char *, const char *, size_t, off_t, struct fuse_file_info *);
  33. int FS_release(const char *, struct fuse_file_info *);
  34. int FS_flush(const char *, struct fuse_file_info *);
  35. int FS_fsync(const char *, int, struct fuse_file_info *);
  36.  
  37. // Task 5 : getattr, access, setxattr, getxattr, listxattr, removexattr
  38. int FS_getattr(const char *, struct stat *, struct fuse_file_info *);
  39. int FS_access(const char *, int);
  40. int FS_setxattr(const char *, const char *, const char *, size_t, int);
  41. int FS_getxattr(const char *, const char *, char *, size_t);
  42. int FS_listxattr(const char *, char *, size_t);
  43. int FS_removexattr(const char *, const char *);
  44.  
  45. // Task 6 : chmod, chown
  46. int FS_chmod(const char *, mode_t, struct fuse_file_info *);
  47. int FS_chown(const char *, uid_t, gid_t, struct fuse_file_info *);
  48.  
  49. // Task 7 : link, symlink, readlink
  50. int FS_link(const char *, const char *);
  51. int FS_symlink(const char *, const char *);
  52. int FS_readlink(const char *, char *, size_t);
  53.  
  54. // optional
  55. int FS_utimens(const char *, const struct timespec tv[2], struct fuse_file_info *);
  56.  
  57. #endif // !FILESYS_H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement