ufs_ext.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * This file is part of the Harvey operating system. It is subject to the
  3. * license terms of the GNU GPL v2 in LICENSE.gpl found in the top-level
  4. * directory of this distribution and at http://www.gnu.org/licenses/gpl-2.0.txt
  5. *
  6. * No part of Harvey operating system, including this file, may be copied,
  7. * modified, propagated, or distributed except according to the terms
  8. * contained in the LICENSE.gpl file.
  9. */
  10. // Functions to be exposed outside the UFS code (e.g. to devufs)
  11. typedef struct Chan Chan;
  12. typedef struct MountPoint MountPoint;
  13. typedef struct ufsmount ufsmount;
  14. typedef struct vnode vnode;
  15. /*
  16. * filesystem statistics
  17. */
  18. typedef struct statfs {
  19. uint64_t f_iosize; /* optimal transfer block size */
  20. } StatFs;
  21. /* Wrapper for a UFS mount. Should support reading from both kernel and user
  22. * space (eventually)
  23. */
  24. typedef struct MountPoint {
  25. ufsmount *mnt_data;
  26. Chan *chan;
  27. int id;
  28. StatFs mnt_stat; /* cache of filesystem stats */
  29. int mnt_maxsymlinklen; /* max size of short symlink */
  30. uint64_t mnt_flag; /* (i) flags shared with user */
  31. QLock mnt_lock; /* (mnt_mtx) structure lock */
  32. QLock vnodes_lock; /* lock on vnodes in use & freelist */
  33. vnode *vnodes; /* vnode cache */
  34. vnode *free_vnodes; /* vnode freelist */
  35. } MountPoint;
  36. MountPoint *newufsmount(Chan *c, int id);
  37. void releaseufsmount(MountPoint *mp);
  38. int countvnodes(vnode *vn);
  39. int writesuperblock(char *buf, int buflen, MountPoint *mp);
  40. int writeinode(char *buf, int buflen, vnode *vn);
  41. int writeinodedata(char *buf, int buflen, vnode *vn);
  42. int ffs_init();
  43. int ffs_uninit();
  44. int ffs_mount(MountPoint *mp);
  45. int ffs_unmount(MountPoint *mp, int mntflags);
  46. int ufs_root(MountPoint *mp, int flags, vnode **vpp);
  47. int ufs_lookup(MountPoint *mp);
  48. int lookuppath(MountPoint *mp, char *path, vnode **vn);
  49. vnode *ufs_open_ino(MountPoint *mp, ino_t ino);
  50. void releaseufsvnode(vnode *vn);