958b25be50
- Revise VFS-FS protocol and update VFS/MFS/ISOFS accordingly. - Clean up MFS by removing old, dead code (backwards compatibility is broken by the new VFS-FS protocol, anyway) and rewrite other parts. Also, make sure all functions have proper banners and prototypes. - VFS should always provide a (syntactically) valid path to the FS; no need for the FS to do sanity checks when leaving/entering mount points. - Fix several bugs in MFS: - Several path lookup bugs in MFS. - A link can be too big for the path buffer. - A mountpoint can become inaccessible when the creation of a new inode fails, because the inode already exists and is a mountpoint. - Introduce support for supplemental groups. - Add test 46 to test supplemental group functionality (and removed obsolete suppl. tests from test 2). - Clean up VFS (not everything is done yet). - ISOFS now opens device read-only. This makes the -r flag in the mount command unnecessary (but will still report to be mounted read-write). - Introduce PipeFS. PipeFS is a new FS that handles all anonymous and named pipes. However, named pipes still reside on the (M)FS, as they are part of the file system on disk. To make this work VFS now has a concept of 'mapped' inodes, which causes read, write, truncate and stat requests to be redirected to the mapped FS, and all other requests to the original FS.
65 lines
1.5 KiB
C
65 lines
1.5 KiB
C
/* FS timers library
|
|
*/
|
|
|
|
#include "fs.h"
|
|
#include <timers.h>
|
|
#include <minix/syslib.h>
|
|
#include <minix/com.h>
|
|
|
|
PRIVATE timer_t *fs_timers = NULL;
|
|
|
|
PUBLIC void fs_set_timer(timer_t *tp, int ticks, tmr_func_t watchdog, int arg)
|
|
{
|
|
int r;
|
|
clock_t now, old_head = 0, new_head;
|
|
|
|
if ((r = getuptime(&now)) != OK)
|
|
panic(__FILE__, "FS couldn't get uptime from system task.", NO_NUM);
|
|
|
|
tmr_arg(tp)->ta_int = arg;
|
|
|
|
old_head = tmrs_settimer(&fs_timers, tp, now+ticks, watchdog, &new_head);
|
|
|
|
/* reschedule our synchronous alarm if necessary */
|
|
if (!old_head || old_head > new_head) {
|
|
if (sys_setalarm(new_head, 1) != OK)
|
|
panic(__FILE__, "FS set timer "
|
|
"couldn't set synchronous alarm.", NO_NUM);
|
|
}
|
|
|
|
return;
|
|
}
|
|
|
|
PUBLIC void fs_expire_timers(clock_t now)
|
|
{
|
|
clock_t new_head;
|
|
tmrs_exptimers(&fs_timers, now, &new_head);
|
|
if (new_head > 0) {
|
|
if (sys_setalarm(new_head, 1) != OK)
|
|
panic(__FILE__, "FS expire timer couldn't set "
|
|
"synchronous alarm.", NO_NUM);
|
|
}
|
|
}
|
|
|
|
PUBLIC void fs_init_timer(timer_t *tp)
|
|
{
|
|
tmr_inittimer(tp);
|
|
}
|
|
|
|
PUBLIC void fs_cancel_timer(timer_t *tp)
|
|
{
|
|
clock_t new_head, old_head;
|
|
old_head = tmrs_clrtimer(&fs_timers, tp, &new_head);
|
|
|
|
/* if the earliest timer has been removed, we have to set
|
|
* the synalarm to the next timer, or cancel the synalarm
|
|
* altogether if th last time has been cancelled (new_head
|
|
* will be 0 then).
|
|
*/
|
|
if (old_head < new_head || !new_head) {
|
|
if (sys_setalarm(new_head, 1) != OK)
|
|
panic(__FILE__,
|
|
"FS expire timer couldn't set synchronous alarm.",
|
|
NO_NUM);
|
|
}
|
|
}
|