《操作系统》的实验代码。
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.

44 lines
854 B

12 years ago
  1. #include <defs.h>
  2. #include <sem.h>
  3. #include <sfs.h>
  4. /*
  5. * lock_sfs_fs - lock the process of SFS Filesystem Rd/Wr Disk Block
  6. *
  7. * called by: sfs_load_inode, sfs_sync, sfs_reclaim
  8. */
  9. void
  10. lock_sfs_fs(struct sfs_fs *sfs) {
  11. down(&(sfs->fs_sem));
  12. }
  13. /*
  14. * lock_sfs_io - lock the process of SFS File Rd/Wr Disk Block
  15. *
  16. * called by: sfs_rwblock, sfs_clear_block, sfs_sync_super
  17. */
  18. void
  19. lock_sfs_io(struct sfs_fs *sfs) {
  20. down(&(sfs->io_sem));
  21. }
  22. /*
  23. * unlock_sfs_fs - unlock the process of SFS Filesystem Rd/Wr Disk Block
  24. *
  25. * called by: sfs_load_inode, sfs_sync, sfs_reclaim
  26. */
  27. void
  28. unlock_sfs_fs(struct sfs_fs *sfs) {
  29. up(&(sfs->fs_sem));
  30. }
  31. /*
  32. * unlock_sfs_io - unlock the process of sfs Rd/Wr Disk Block
  33. *
  34. * called by: sfs_rwblock sfs_clear_block sfs_sync_super
  35. */
  36. void
  37. unlock_sfs_io(struct sfs_fs *sfs) {
  38. up(&(sfs->io_sem));
  39. }