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.

60 lines
2.0 KiB

3 years ago
3 years ago
3 years ago
  1. package mount
  2. // Forget is called when the kernel discards entries from its
  3. // dentry cache. This happens on unmount, and when the kernel
  4. // is short on memory. Since it is not guaranteed to occur at
  5. // any moment, and since there is no return value, Forget
  6. // should not do I/O, as there is no channel to report back
  7. // I/O errors.
  8. // from https://github.com/libfuse/libfuse/blob/master/include/fuse_lowlevel.h
  9. /**
  10. * Forget about an inode
  11. *
  12. * This function is called when the kernel removes an inode
  13. * from its internal caches.
  14. *
  15. * The inode's lookup count increases by one for every call to
  16. * fuse_reply_entry and fuse_reply_create. The nlookup parameter
  17. * indicates by how much the lookup count should be decreased.
  18. *
  19. * Inodes with a non-zero lookup count may receive request from
  20. * the kernel even after calls to unlink, rmdir or (when
  21. * overwriting an existing file) rename. Filesystems must handle
  22. * such requests properly and it is recommended to defer removal
  23. * of the inode until the lookup count reaches zero. Calls to
  24. * unlink, rmdir or rename will be followed closely by forget
  25. * unless the file or directory is open, in which case the
  26. * kernel issues forget only after the release or releasedir
  27. * calls.
  28. *
  29. * Note that if a file system will be exported over NFS the
  30. * inodes lifetime must extend even beyond forget. See the
  31. * generation field in struct fuse_entry_param above.
  32. *
  33. * On unmount the lookup count for all inodes implicitly drops
  34. * to zero. It is not guaranteed that the file system will
  35. * receive corresponding forget messages for the affected
  36. * inodes.
  37. *
  38. * Valid replies:
  39. * fuse_reply_none
  40. *
  41. * @param req request handle
  42. * @param ino the inode number
  43. * @param nlookup the number of lookups to forget
  44. */
  45. /*
  46. int fuse_reply_entry ( fuse_req_t req,
  47. const struct fuse_entry_param * e
  48. )
  49. Reply with a directory entry
  50. Possible requests: lookup, mknod, mkdir, symlink, link
  51. Side effects: increments the lookup count on success
  52. */
  53. func (wfs *WFS) Forget(nodeid, nlookup uint64) {
  54. wfs.inodeToPath.Forget(nodeid, nlookup)
  55. }