diff options
Diffstat (limited to 'fatfs')
-rw-r--r-- | fatfs/fatfs.h | 2 | ||||
-rw-r--r-- | fatfs/pager.c | 33 |
2 files changed, 34 insertions, 1 deletions
diff --git a/fatfs/fatfs.h b/fatfs/fatfs.h index 3c3d8366..54c3426a 100644 --- a/fatfs/fatfs.h +++ b/fatfs/fatfs.h @@ -121,6 +121,8 @@ extern struct dirrect dr_root_node; void drop_pager_softrefs (struct node *); void allow_pager_softrefs (struct node *); void create_fat_pager (void); +error_t inhibit_fat_pager (void); +void resume_fat_pager (void); void flush_node_pager (struct node *node); diff --git a/fatfs/pager.c b/fatfs/pager.c index 10d1fc96..d255f290 100644 --- a/fatfs/pager.c +++ b/fatfs/pager.c @@ -29,6 +29,10 @@ struct port_bucket *disk_pager_bucket; /* A ports bucket to hold file pager ports. */ struct port_bucket *file_pager_bucket; +/* Stores a reference to the requests instance used by the file pager so its + worker threads can be inhibited and resumed. */ +struct pager_requests *file_pager_requests; + /* Mapped image of the FAT. */ void *fat_image; @@ -776,11 +780,38 @@ create_fat_pager (void) file_pager_bucket = ports_create_bucket (); /* Start libpagers worker threads. */ - err = pager_start_workers (file_pager_bucket); + err = pager_start_workers (file_pager_bucket, &file_pager_requests); if (err) error (2, err, "can't create libpager worker threads"); } +error_t +inhibit_fat_pager (void) +{ + error_t err; + + /* The file pager can rely on the disk pager, so inhibit the file + pager first. */ + + err = pager_inhibit_workers (file_pager_requests); + if (err) + return err; + + err = pager_inhibit_workers (diskfs_disk_pager_requests); + /* We don't want only one pager disabled. */ + if (err) + pager_resume_workers (file_pager_requests); + + return err; +} + +void +resume_fat_pager (void) +{ + pager_resume_workers (diskfs_disk_pager_requests); + pager_resume_workers (file_pager_requests); +} + /* Call this to create a FILE_DATA pager and return a send right. NODE must be locked. */ mach_port_t |