2005-06-06 13:40:32 +02:00
|
|
|
/* Implement entry point to select system call.
|
|
|
|
*
|
|
|
|
* The entry points into this file are
|
2005-06-17 15:41:12 +02:00
|
|
|
* do_select: perform the SELECT system call
|
|
|
|
* select_callback: notify select system of possible fd operation
|
|
|
|
* select_notified: low-level entry for device notifying select
|
endpoint-aware conversion of servers.
'who', indicating caller number in pm and fs and some other servers, has
been removed in favour of 'who_e' (endpoint) and 'who_p' (proc nr.).
In both PM and FS, isokendpt() convert endpoints to process slot
numbers, returning OK if it was a valid and consistent endpoint number.
okendpt() does the same but panic()s if it doesn't succeed. (In PM,
this is pm_isok..)
pm and fs keep their own records of process endpoints in their proc tables,
which are needed to make kernel calls about those processes.
message field names have changed.
fs drivers are endpoints.
fs now doesn't try to get out of driver deadlock, as the protocol isn't
supposed to let that happen any more. (A warning is printed if ELOCKED
is detected though.)
fproc[].fp_task (indicating which driver the process is suspended on)
became an int.
PM and FS now get endpoint numbers of initial boot processes from the
kernel. These happen to be the same as the old proc numbers, to let
user processes reach them with the old numbers, but FS and PM don't know
that. All new processes after INIT, even after the generation number
wraps around, get endpoint numbers with generation 1 and higher, so
the first instances of the boot processes are the only processes ever
to have endpoint numbers in the old proc number range.
More return code checks of sys_* functions have been added.
IS has become endpoint-aware. Ditched the 'text' and 'data' fields
in the kernel dump (which show locations, not sizes, so aren't terribly
useful) in favour of the endpoint number. Proc number is still visible.
Some other dumps (e.g. dmap, rs) show endpoint numbers now too which got
the formatting changed.
PM reading segments using rw_seg() has changed - it uses other fields
in the message now instead of encoding the segment and process number and
fd in the fd field. For that it uses _read_pm() and _write_pm() which to
_taskcall()s directly in pm/misc.c.
PM now sys_exit()s itself on panic(), instead of sys_abort().
RS also talks in endpoints instead of process numbers.
2006-03-03 11:20:58 +01:00
|
|
|
* select_unsuspend_by_endpt: cancel a blocking select on exiting driver
|
2005-06-06 13:40:32 +02:00
|
|
|
*/
|
|
|
|
|
2005-07-27 16:30:25 +02:00
|
|
|
#define DEBUG_SELECT 0
|
2005-06-17 15:41:12 +02:00
|
|
|
|
2005-06-06 13:40:32 +02:00
|
|
|
#include "fs.h"
|
2005-06-17 15:41:12 +02:00
|
|
|
#include "select.h"
|
|
|
|
#include "file.h"
|
2006-10-25 15:40:36 +02:00
|
|
|
#include "vnode.h"
|
2005-06-17 15:41:12 +02:00
|
|
|
|
|
|
|
#include <sys/time.h>
|
|
|
|
#include <sys/select.h>
|
|
|
|
#include <minix/com.h>
|
2006-11-27 15:21:43 +01:00
|
|
|
#include <minix/u64.h>
|
2005-06-17 15:41:12 +02:00
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
/* max. number of simultaneously pending select() calls */
|
|
|
|
#define MAXSELECTS 25
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
#define FROM_PROC 0
|
|
|
|
#define TO_PROC 1
|
2005-06-17 15:41:12 +02:00
|
|
|
|
|
|
|
PRIVATE struct selectentry {
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
struct fproc *requestor; /* slot is free iff this is NULL */
|
|
|
|
int req_endpt;
|
|
|
|
fd_set readfds, writefds, errorfds;
|
|
|
|
fd_set ready_readfds, ready_writefds, ready_errorfds;
|
|
|
|
fd_set *vir_readfds, *vir_writefds, *vir_errorfds;
|
|
|
|
struct filp *filps[OPEN_MAX];
|
|
|
|
int type[OPEN_MAX];
|
|
|
|
int deferred; /* awaiting initial reply from driver */
|
|
|
|
int deferred_fd; /* fd awaiting initial reply from driver */
|
|
|
|
int nfds, nreadyfds;
|
|
|
|
char block;
|
|
|
|
clock_t expiry;
|
|
|
|
timer_t timer; /* if expiry > 0 */
|
2005-06-17 15:41:12 +02:00
|
|
|
} selecttab[MAXSELECTS];
|
|
|
|
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
FORWARD _PROTOTYPE(int copy_fdsets, (struct selectentry *se, int nfds,
|
|
|
|
int direction) );
|
|
|
|
FORWARD _PROTOTYPE(void filp_status, (struct filp *fp, int status) );
|
|
|
|
FORWARD _PROTOTYPE(void restart_proc, (int slot) );
|
|
|
|
FORWARD _PROTOTYPE(void ops2tab, (int ops, int fd, struct selectentry *e));
|
|
|
|
FORWARD _PROTOTYPE(int select_reevaluate, (struct filp *fp) );
|
|
|
|
FORWARD _PROTOTYPE(int select_request_file, (struct filp *f, int *ops,
|
|
|
|
int block) );
|
|
|
|
FORWARD _PROTOTYPE(int select_match_file, (struct filp *f) );
|
|
|
|
FORWARD _PROTOTYPE(int select_request_general, (struct filp *f, int *ops,
|
|
|
|
int block) );
|
|
|
|
FORWARD _PROTOTYPE(int select_request_asynch, (struct filp *f, int *ops,
|
|
|
|
int block) );
|
|
|
|
FORWARD _PROTOTYPE(int select_major_match, (int match_major,
|
|
|
|
struct filp *file) );
|
|
|
|
FORWARD _PROTOTYPE(void select_cancel_all, (struct selectentry *e) );
|
|
|
|
FORWARD _PROTOTYPE(void select_wakeup, (struct selectentry *e, int r) );
|
|
|
|
FORWARD _PROTOTYPE(void select_return, (struct selectentry *, int) );
|
|
|
|
FORWARD _PROTOTYPE(void sel_restart_dev, (void) );
|
|
|
|
FORWARD _PROTOTYPE(int tab2ops, (int fd, struct selectentry *e) );
|
|
|
|
FORWARD _PROTOTYPE(void wipe_select, (struct selectentry *s) );
|
2005-06-17 15:41:12 +02:00
|
|
|
|
|
|
|
PRIVATE struct fdtype {
|
|
|
|
int (*select_request)(struct filp *, int *ops, int block);
|
|
|
|
int (*select_match)(struct filp *);
|
2005-07-08 19:30:01 +02:00
|
|
|
int select_major;
|
2006-06-07 16:41:47 +02:00
|
|
|
} fdtypes[] = {
|
2005-07-08 19:30:01 +02:00
|
|
|
{ select_request_file, select_match_file, 0 },
|
2005-07-22 20:28:32 +02:00
|
|
|
{ select_request_general, NULL, TTY_MAJOR },
|
|
|
|
{ select_request_general, NULL, INET_MAJOR },
|
2005-07-08 19:30:01 +02:00
|
|
|
{ select_request_pipe, select_match_pipe, 0 },
|
2008-02-22 16:46:59 +01:00
|
|
|
{ select_request_asynch, NULL, LOG_MAJOR },
|
2005-06-17 15:41:12 +02:00
|
|
|
};
|
2006-06-07 16:41:47 +02:00
|
|
|
#define SEL_FDS (sizeof(fdtypes) / sizeof(fdtypes[0]))
|
2005-06-17 15:41:12 +02:00
|
|
|
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
/*===========================================================================*
|
|
|
|
* do_select *
|
|
|
|
*===========================================================================*/
|
|
|
|
PUBLIC int do_select(void)
|
|
|
|
{
|
|
|
|
/* Implement the select(nfds, readfds, writefds, errorfds, timeout) system
|
|
|
|
* call. First we copy the arguments and verify their sanity. Then we check
|
|
|
|
* whether there are file descriptors that satisfy the select call right of the
|
|
|
|
* bat. If so, or if there are no ready file descriptors but the process
|
|
|
|
* requested to return immediately, we return the result. Otherwise we set a
|
|
|
|
* timeout and wait for either the file descriptors to become ready or the
|
|
|
|
* timer to go off. If no timeout value was provided, we wait indefinitely. */
|
|
|
|
|
2010-03-22 21:43:06 +01:00
|
|
|
int r, nfds, do_timeout = 0, fd, s;
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
struct timeval timeout;
|
|
|
|
struct selectentry *se;
|
|
|
|
|
|
|
|
nfds = m_in.SEL_NFDS;
|
|
|
|
|
|
|
|
/* Sane amount of file descriptors? */
|
|
|
|
if (nfds < 0 || nfds > OPEN_MAX) return(EINVAL);
|
|
|
|
|
|
|
|
/* Find a slot to store this select request */
|
|
|
|
for (s = 0; s < MAXSELECTS; s++)
|
|
|
|
if (selecttab[s].requestor == NULL) /* Unused slot */
|
|
|
|
break;
|
|
|
|
if (s >= MAXSELECTS) return(ENOSPC);
|
|
|
|
|
|
|
|
se = &selecttab[s];
|
|
|
|
wipe_select(se); /* Clear results of previous usage.*/
|
|
|
|
se->req_endpt = who_e;
|
|
|
|
se->vir_readfds = (fd_set *) m_in.SEL_READFDS;
|
|
|
|
se->vir_writefds = (fd_set *) m_in.SEL_WRITEFDS;
|
|
|
|
se->vir_errorfds = (fd_set *) m_in.SEL_ERRORFDS;
|
|
|
|
|
|
|
|
/* Copy fdsets from the process */
|
|
|
|
if ((r = copy_fdsets(se, nfds, FROM_PROC)) != OK) return(r);
|
|
|
|
|
|
|
|
/* Did the process set a timeout value? If so, retrieve it. */
|
|
|
|
if (m_in.SEL_TIMEOUT != NULL) {
|
|
|
|
do_timeout = 1;
|
|
|
|
r = sys_vircopy(who_e, D, (vir_bytes) m_in.SEL_TIMEOUT, SELF, D,
|
|
|
|
(vir_bytes) &timeout, sizeof(timeout));
|
|
|
|
if (r != OK) return(r);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* No nonsense in the timeval. */
|
|
|
|
if(do_timeout && (timeout.tv_sec < 0 || timeout.tv_usec < 0)) return(EINVAL);
|
|
|
|
|
|
|
|
/* If there is no timeout, we block forever. Otherwise, we block up to the
|
|
|
|
* specified time interval.
|
|
|
|
*/
|
|
|
|
if(!do_timeout) /* No timeout value set */
|
|
|
|
se->block = 1;
|
|
|
|
else if (do_timeout && (timeout.tv_sec > 0 || timeout.tv_usec > 0))
|
|
|
|
se->block = 1;
|
|
|
|
else /* timeout set as (0,0) - this effects a poll */
|
|
|
|
se->block = 0;
|
|
|
|
se->expiry = 0; /* no timer set (yet) */
|
|
|
|
|
|
|
|
/* Check all file descriptors in the set whether one is 'ready' now. */
|
|
|
|
for (fd = 0; fd < nfds; fd++) {
|
|
|
|
int ops, t, type = -1, r;
|
|
|
|
struct filp *filp;
|
|
|
|
|
|
|
|
if (!(ops = tab2ops(fd, se)))
|
|
|
|
continue; /* No operations set; nothing to do for this fd */
|
|
|
|
|
|
|
|
/* Get filp belonging to this fd */
|
|
|
|
filp = se->filps[fd] = get_filp(fd);
|
|
|
|
if (filp == NIL_FILP) {
|
|
|
|
if (err_code == EBADF) {
|
|
|
|
select_cancel_all(se);
|
|
|
|
return(EBADF);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* File descriptor is 'ready' to return EIO */
|
|
|
|
printf("VFS do_select: EIO after driver failure\n");
|
|
|
|
ops2tab(SEL_RD|SEL_WR|SEL_ERR, fd, se);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Figure out what type of file we're dealing with */
|
|
|
|
for(t = 0; t < SEL_FDS; t++) {
|
|
|
|
if (fdtypes[t].select_match) {
|
|
|
|
if (fdtypes[t].select_match(filp)) {
|
|
|
|
type = t;
|
|
|
|
}
|
|
|
|
} else if (select_major_match(fdtypes[t].select_major, filp)) {
|
|
|
|
type = t;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (type == -1) return(EBADF);
|
|
|
|
se->type[fd] = type;
|
|
|
|
|
|
|
|
/* Test filp for select operations if not already done so. e.g., files
|
|
|
|
* sharing a filp and both doing a select on that filp. */
|
|
|
|
if ((se->filps[fd]->filp_select_ops & ops) != ops) {
|
|
|
|
int wantops;
|
|
|
|
|
|
|
|
wantops = (se->filps[fd]->filp_select_ops |= ops);
|
|
|
|
r = fdtypes[type].select_request(filp, &wantops, se->block);
|
|
|
|
if (r != SEL_OK) {
|
|
|
|
if (r == SEL_DEFERRED) {
|
|
|
|
se->deferred = TRUE;
|
|
|
|
se->deferred_fd = 0;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Error or bogus return code; cancel select. */
|
|
|
|
select_cancel_all(se);
|
|
|
|
return(EINVAL);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* The select request above might have turned on/off some
|
|
|
|
* operations because they were 'ready' or not meaningful.
|
|
|
|
* Either way, we might have a result and we need to store them
|
|
|
|
* in the select table entry. */
|
|
|
|
if (wantops & ops) ops2tab(wantops, fd, se);
|
|
|
|
}
|
|
|
|
|
|
|
|
se->nfds = fd+1;
|
|
|
|
se->filps[fd]->filp_selectors++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (se->nreadyfds > 0 || (!se->block && !se->deferred)) {
|
|
|
|
/* fd's were found that were ready to go right away, and/or
|
|
|
|
* we were instructed not to block at all. Must return
|
|
|
|
* immediately.
|
|
|
|
*/
|
|
|
|
r = copy_fdsets(se, se->nfds, TO_PROC);
|
|
|
|
select_cancel_all(se);
|
|
|
|
se->requestor = NULL;
|
|
|
|
|
|
|
|
if (r != OK) return(r);
|
|
|
|
else return(se->nreadyfds);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Convert timeval to ticks and set the timer. If it fails, undo
|
|
|
|
* all, return error.
|
|
|
|
*/
|
|
|
|
if (do_timeout) {
|
|
|
|
int ticks;
|
|
|
|
/* Open Group:
|
|
|
|
* "If the requested timeout interval requires a finer
|
|
|
|
* granularity than the implementation supports, the
|
|
|
|
* actual timeout interval shall be rounded up to the next
|
|
|
|
* supported value."
|
|
|
|
*/
|
|
|
|
#define USECPERSEC 1000000
|
|
|
|
while(timeout.tv_usec >= USECPERSEC) {
|
|
|
|
/* this is to avoid overflow with *system_hz below */
|
|
|
|
timeout.tv_usec -= USECPERSEC;
|
|
|
|
timeout.tv_sec++;
|
|
|
|
}
|
|
|
|
ticks = timeout.tv_sec * system_hz +
|
|
|
|
(timeout.tv_usec * system_hz + USECPERSEC-1) / USECPERSEC;
|
|
|
|
se->expiry = ticks;
|
|
|
|
fs_set_timer(&se->timer, ticks, select_timeout_check, s);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if we're blocking, the table entry is now valid. */
|
|
|
|
se->requestor = fp;
|
|
|
|
|
|
|
|
/* process now blocked */
|
|
|
|
suspend(FP_BLOCKED_ON_SELECT);
|
|
|
|
return(SUSPEND);
|
|
|
|
}
|
|
|
|
|
2005-06-17 15:41:12 +02:00
|
|
|
|
|
|
|
/*===========================================================================*
|
|
|
|
* select_request_file *
|
|
|
|
*===========================================================================*/
|
|
|
|
PRIVATE int select_request_file(struct filp *f, int *ops, int block)
|
|
|
|
{
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
/* output *ops is input *ops */
|
|
|
|
return(SEL_OK);
|
2005-06-17 15:41:12 +02:00
|
|
|
}
|
|
|
|
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
|
2005-06-17 15:41:12 +02:00
|
|
|
/*===========================================================================*
|
|
|
|
* select_match_file *
|
|
|
|
*===========================================================================*/
|
|
|
|
PRIVATE int select_match_file(struct filp *file)
|
|
|
|
{
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
return(file && file->filp_vno && (file->filp_vno->v_mode & I_REGULAR));
|
2005-06-17 15:41:12 +02:00
|
|
|
}
|
|
|
|
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
|
2005-06-17 15:41:12 +02:00
|
|
|
/*===========================================================================*
|
2005-07-22 20:28:32 +02:00
|
|
|
* select_request_general *
|
2005-06-17 15:41:12 +02:00
|
|
|
*===========================================================================*/
|
2005-07-22 20:28:32 +02:00
|
|
|
PRIVATE int select_request_general(struct filp *f, int *ops, int block)
|
2005-06-17 15:41:12 +02:00
|
|
|
{
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
int rops = *ops;
|
|
|
|
if (block) rops |= SEL_NOTIFY;
|
|
|
|
*ops = dev_io(VFS_DEV_SELECT, f->filp_vno->v_sdev, rops, NULL,
|
2008-02-22 16:46:59 +01:00
|
|
|
cvu64(0), 0, 0, FALSE);
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
if (*ops < 0)
|
|
|
|
return(SEL_ERR);
|
|
|
|
|
|
|
|
return(SEL_OK);
|
2005-06-17 15:41:12 +02:00
|
|
|
}
|
|
|
|
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
|
2008-02-22 16:46:59 +01:00
|
|
|
/*===========================================================================*
|
|
|
|
* select_request_asynch *
|
|
|
|
*===========================================================================*/
|
|
|
|
PRIVATE int select_request_asynch(struct filp *f, int *ops, int block)
|
|
|
|
{
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
int r, rops;
|
|
|
|
struct dmap *dp;
|
2008-02-22 16:46:59 +01:00
|
|
|
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
rops = *ops;
|
|
|
|
f->filp_select_flags |= FSF_UPDATE;
|
|
|
|
if (block) {
|
|
|
|
rops |= SEL_NOTIFY;
|
|
|
|
f->filp_select_flags |= FSF_BLOCK;
|
|
|
|
}
|
2008-02-22 16:46:59 +01:00
|
|
|
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
if (f->filp_select_flags & FSF_BUSY)
|
|
|
|
return(SEL_DEFERRED);
|
2008-02-22 16:46:59 +01:00
|
|
|
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
dp = &dmap[((f->filp_vno->v_sdev) >> MAJOR) & BYTE];
|
|
|
|
if (dp->dmap_sel_filp)
|
|
|
|
return(SEL_DEFERRED);
|
2008-02-22 16:46:59 +01:00
|
|
|
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
f->filp_select_flags &= ~FSF_UPDATE;
|
|
|
|
r = dev_io(VFS_DEV_SELECT, f->filp_vno->v_sdev, rops, NULL,
|
|
|
|
cvu64(0), 0, 0, FALSE);
|
|
|
|
if (r < 0 && r != SUSPEND)
|
|
|
|
return(SEL_ERR);
|
|
|
|
|
|
|
|
if (r != SUSPEND)
|
2010-03-05 16:05:11 +01:00
|
|
|
panic("select_request_asynch: expected SUSPEND got: %d", r);
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
|
|
|
|
f->filp_count++;
|
|
|
|
dp->dmap_sel_filp = f;
|
|
|
|
f->filp_select_flags |= FSF_BUSY;
|
|
|
|
|
|
|
|
return(SEL_DEFERRED);
|
2008-02-22 16:46:59 +01:00
|
|
|
}
|
|
|
|
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
|
2005-06-17 15:41:12 +02:00
|
|
|
/*===========================================================================*
|
2005-07-08 19:30:01 +02:00
|
|
|
* select_major_match *
|
2005-06-17 15:41:12 +02:00
|
|
|
*===========================================================================*/
|
2005-07-08 19:30:01 +02:00
|
|
|
PRIVATE int select_major_match(int match_major, struct filp *file)
|
2005-06-17 15:41:12 +02:00
|
|
|
{
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
int major;
|
|
|
|
if (!(file && file->filp_vno &&
|
|
|
|
(file->filp_vno->v_mode & I_TYPE) == I_CHAR_SPECIAL))
|
|
|
|
return(0);
|
|
|
|
major = (file->filp_vno->v_sdev >> MAJOR) & BYTE;
|
|
|
|
if (major == match_major) return 1;
|
|
|
|
return 0;
|
2005-06-17 15:41:12 +02:00
|
|
|
}
|
|
|
|
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
|
2005-09-22 23:17:22 +02:00
|
|
|
/*===========================================================================*
|
|
|
|
* tab2ops *
|
|
|
|
*===========================================================================*/
|
2005-06-17 15:41:12 +02:00
|
|
|
PRIVATE int tab2ops(int fd, struct selectentry *e)
|
|
|
|
{
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
int ops = 0;
|
|
|
|
if (FD_ISSET(fd, &e->readfds)) ops |= SEL_RD;
|
|
|
|
if (FD_ISSET(fd, &e->writefds)) ops |= SEL_WR;
|
|
|
|
if (FD_ISSET(fd, &e->errorfds)) ops |= SEL_ERR;
|
|
|
|
|
|
|
|
return(ops);
|
2005-06-17 15:41:12 +02:00
|
|
|
}
|
|
|
|
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
|
2005-09-22 23:17:22 +02:00
|
|
|
/*===========================================================================*
|
|
|
|
* ops2tab *
|
|
|
|
*===========================================================================*/
|
2005-06-17 15:41:12 +02:00
|
|
|
PRIVATE void ops2tab(int ops, int fd, struct selectentry *e)
|
|
|
|
{
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
if ((ops & SEL_RD) && e->vir_readfds && FD_ISSET(fd, &e->readfds) &&
|
|
|
|
!FD_ISSET(fd, &e->ready_readfds)) {
|
|
|
|
FD_SET(fd, &e->ready_readfds);
|
|
|
|
e->nreadyfds++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((ops & SEL_WR) && e->vir_writefds && FD_ISSET(fd, &e->writefds) &&
|
|
|
|
!FD_ISSET(fd, &e->ready_writefds)) {
|
|
|
|
FD_SET(fd, &e->ready_writefds);
|
|
|
|
e->nreadyfds++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((ops & SEL_ERR) && e->vir_errorfds && FD_ISSET(fd, &e->errorfds) &&
|
|
|
|
!FD_ISSET(fd, &e->ready_errorfds)) {
|
|
|
|
FD_SET(fd, &e->ready_errorfds);
|
|
|
|
e->nreadyfds++;
|
|
|
|
}
|
2005-06-17 15:41:12 +02:00
|
|
|
}
|
|
|
|
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
|
2005-09-22 23:17:22 +02:00
|
|
|
/*===========================================================================*
|
|
|
|
* copy_fdsets *
|
|
|
|
*===========================================================================*/
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
PRIVATE int copy_fdsets(struct selectentry *se, int nfds, int direction)
|
2005-06-17 15:41:12 +02:00
|
|
|
{
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
int fd_setsize, r;
|
|
|
|
endpoint_t src_e, dst_e;
|
|
|
|
fd_set *src_fds, *dst_fds;
|
|
|
|
|
|
|
|
if(nfds < 0 || nfds > OPEN_MAX)
|
2010-03-05 16:05:11 +01:00
|
|
|
panic("select copy_fdsets: nfds wrong: %d", nfds);
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
|
|
|
|
/* Only copy back as many bits as the user expects. */
|
|
|
|
fd_setsize = _FDSETWORDS(nfds) * _FDSETBITSPERWORD/8;
|
|
|
|
|
|
|
|
/* Set source and destination endpoints */
|
|
|
|
src_e = (direction == FROM_PROC) ? se->req_endpt : SELF;
|
|
|
|
dst_e = (direction == FROM_PROC) ? SELF : se->req_endpt;
|
|
|
|
|
|
|
|
/* read set */
|
|
|
|
src_fds = (direction == FROM_PROC) ? se->vir_readfds : &se->ready_readfds;
|
|
|
|
dst_fds = (direction == FROM_PROC) ? &se->readfds : se->vir_readfds;
|
|
|
|
if (se->vir_readfds) {
|
|
|
|
r = sys_vircopy(src_e, D, (vir_bytes) src_fds, dst_e, D,
|
|
|
|
(vir_bytes) dst_fds, fd_setsize);
|
|
|
|
if (r != OK) return(r);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* write set */
|
|
|
|
src_fds = (direction == FROM_PROC) ? se->vir_writefds : &se->ready_writefds;
|
|
|
|
dst_fds = (direction == FROM_PROC) ? &se->writefds : se->vir_writefds;
|
|
|
|
if (se->vir_writefds) {
|
|
|
|
r = sys_vircopy(src_e, D, (vir_bytes) src_fds, dst_e, D,
|
|
|
|
(vir_bytes) dst_fds, fd_setsize);
|
|
|
|
if (r != OK) return(r);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* error set */
|
|
|
|
src_fds = (direction == FROM_PROC) ? se->vir_errorfds : &se->ready_errorfds;
|
|
|
|
dst_fds = (direction == FROM_PROC) ? &se->errorfds : se->vir_errorfds;
|
|
|
|
if (se->vir_errorfds) {
|
|
|
|
r = sys_vircopy(src_e, D, (vir_bytes) src_fds, dst_e, D,
|
|
|
|
(vir_bytes) dst_fds, fd_setsize);
|
|
|
|
if (r != OK) return(r);
|
|
|
|
}
|
|
|
|
|
|
|
|
return(OK);
|
2005-06-17 15:41:12 +02:00
|
|
|
}
|
2005-06-06 13:40:32 +02:00
|
|
|
|
2005-06-17 15:41:12 +02:00
|
|
|
|
2005-09-22 23:17:22 +02:00
|
|
|
/*===========================================================================*
|
|
|
|
* select_cancel_all *
|
|
|
|
*===========================================================================*/
|
2005-06-17 15:41:12 +02:00
|
|
|
PRIVATE void select_cancel_all(struct selectentry *e)
|
|
|
|
{
|
|
|
|
int fd;
|
|
|
|
|
|
|
|
for(fd = 0; fd < e->nfds; fd++) {
|
|
|
|
struct filp *fp;
|
|
|
|
fp = e->filps[fd];
|
2005-09-11 18:45:46 +02:00
|
|
|
if (!fp) {
|
2005-06-17 15:41:12 +02:00
|
|
|
#if DEBUG_SELECT
|
|
|
|
printf("[ fd %d/%d NULL ] ", fd, e->nfds);
|
|
|
|
#endif
|
|
|
|
continue;
|
|
|
|
}
|
2005-09-11 18:45:46 +02:00
|
|
|
if (fp->filp_selectors < 1) {
|
2005-06-17 15:41:12 +02:00
|
|
|
#if DEBUG_SELECT
|
|
|
|
printf("select: %d selectors?!\n", fp->filp_selectors);
|
|
|
|
#endif
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
fp->filp_selectors--;
|
|
|
|
e->filps[fd] = NULL;
|
|
|
|
select_reevaluate(fp);
|
|
|
|
}
|
|
|
|
|
2005-09-11 18:45:46 +02:00
|
|
|
if (e->expiry > 0) {
|
2005-06-17 15:41:12 +02:00
|
|
|
#if DEBUG_SELECT
|
|
|
|
printf("cancelling timer %d\n", e - selecttab);
|
|
|
|
#endif
|
|
|
|
fs_cancel_timer(&e->timer);
|
|
|
|
e->expiry = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
|
2005-09-22 23:17:22 +02:00
|
|
|
/*===========================================================================*
|
|
|
|
* select_wakeup *
|
|
|
|
*===========================================================================*/
|
2005-10-20 21:39:32 +02:00
|
|
|
PRIVATE void select_wakeup(struct selectentry *e, int r)
|
2005-06-17 15:41:12 +02:00
|
|
|
{
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
revive(e->req_endpt, r);
|
2005-06-17 15:41:12 +02:00
|
|
|
}
|
|
|
|
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
|
2005-09-22 23:17:22 +02:00
|
|
|
/*===========================================================================*
|
|
|
|
* select_reevaluate *
|
|
|
|
*===========================================================================*/
|
2005-06-17 15:41:12 +02:00
|
|
|
PRIVATE int select_reevaluate(struct filp *fp)
|
|
|
|
{
|
2010-02-19 11:00:32 +01:00
|
|
|
int s, remain_ops = 0, fd;
|
2005-06-17 15:41:12 +02:00
|
|
|
|
2005-09-11 18:45:46 +02:00
|
|
|
if (!fp) {
|
2005-06-17 15:41:12 +02:00
|
|
|
printf("fs: select: reevalute NULL fp\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
for(s = 0; s < MAXSELECTS; s++) {
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
if (selecttab[s].requestor != NULL) continue;
|
|
|
|
|
2005-06-17 15:41:12 +02:00
|
|
|
for(fd = 0; fd < selecttab[s].nfds; fd++)
|
2005-09-11 18:45:46 +02:00
|
|
|
if (fp == selecttab[s].filps[fd]) {
|
2005-06-17 15:41:12 +02:00
|
|
|
remain_ops |= tab2ops(fd, &selecttab[s]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If there are any select()s open that want any operations on
|
|
|
|
* this fd that haven't been satisfied by this callback, then we're
|
|
|
|
* still in the market for it.
|
|
|
|
*/
|
|
|
|
fp->filp_select_ops = remain_ops;
|
|
|
|
#if DEBUG_SELECT
|
|
|
|
printf("remaining operations on fp are %d\n", fp->filp_select_ops);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return remain_ops;
|
|
|
|
}
|
|
|
|
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
|
2005-10-20 21:39:32 +02:00
|
|
|
/*===========================================================================*
|
|
|
|
* select_return *
|
|
|
|
*===========================================================================*/
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
PRIVATE void select_return(struct selectentry *se, int r)
|
2005-10-20 21:39:32 +02:00
|
|
|
{
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
select_cancel_all(se);
|
|
|
|
copy_fdsets(se, se->nfds, TO_PROC); /* FIXME, return error status */
|
|
|
|
select_wakeup(se, r ? r : se->nreadyfds);
|
|
|
|
se->requestor = NULL;
|
2005-10-20 21:39:32 +02:00
|
|
|
}
|
|
|
|
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
|
2005-06-17 15:41:12 +02:00
|
|
|
/*===========================================================================*
|
2005-09-11 18:45:46 +02:00
|
|
|
* select_callback *
|
2005-06-17 15:41:12 +02:00
|
|
|
*===========================================================================*/
|
|
|
|
PUBLIC int select_callback(struct filp *fp, int ops)
|
|
|
|
{
|
2010-02-19 11:00:32 +01:00
|
|
|
int s, fd;
|
2005-06-17 15:41:12 +02:00
|
|
|
|
|
|
|
/* We are being notified that file pointer fp is available for
|
|
|
|
* operations 'ops'. We must re-register the select for
|
|
|
|
* operations that we are still interested in, if any.
|
|
|
|
*/
|
|
|
|
|
|
|
|
for(s = 0; s < MAXSELECTS; s++) {
|
|
|
|
int wakehim = 0;
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
if (selecttab[s].requestor == NULL) continue;
|
|
|
|
|
2005-06-17 15:41:12 +02:00
|
|
|
for(fd = 0; fd < selecttab[s].nfds; fd++) {
|
2005-09-11 18:45:46 +02:00
|
|
|
if (!selecttab[s].filps[fd])
|
2005-06-17 15:41:12 +02:00
|
|
|
continue;
|
2005-09-11 18:45:46 +02:00
|
|
|
if (selecttab[s].filps[fd] == fp) {
|
2005-06-17 15:41:12 +02:00
|
|
|
int this_want_ops;
|
|
|
|
this_want_ops = tab2ops(fd, &selecttab[s]);
|
2005-09-11 18:45:46 +02:00
|
|
|
if (this_want_ops & ops) {
|
2005-06-17 15:41:12 +02:00
|
|
|
/* this select() has been satisfied. */
|
|
|
|
ops2tab(ops, fd, &selecttab[s]);
|
|
|
|
wakehim = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2005-10-20 21:39:32 +02:00
|
|
|
if (wakehim)
|
|
|
|
select_return(&selecttab[s], 0);
|
2005-06-17 15:41:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
|
2005-06-17 15:41:12 +02:00
|
|
|
/*===========================================================================*
|
2005-09-11 18:45:46 +02:00
|
|
|
* select_notified *
|
2005-06-17 15:41:12 +02:00
|
|
|
*===========================================================================*/
|
2005-07-27 15:08:52 +02:00
|
|
|
PUBLIC int select_notified(int major, int minor, int selected_ops)
|
2005-06-17 15:41:12 +02:00
|
|
|
{
|
2005-07-27 15:08:52 +02:00
|
|
|
int s, f, t;
|
2005-06-17 15:41:12 +02:00
|
|
|
|
2005-07-27 15:08:52 +02:00
|
|
|
#if DEBUG_SELECT
|
|
|
|
printf("select callback: %d, %d: %d\n", major, minor, selected_ops);
|
|
|
|
#endif
|
2005-07-08 19:30:01 +02:00
|
|
|
|
|
|
|
for(t = 0; t < SEL_FDS; t++)
|
2005-09-11 18:45:46 +02:00
|
|
|
if (!fdtypes[t].select_match && fdtypes[t].select_major == major)
|
2005-07-08 19:30:01 +02:00
|
|
|
break;
|
|
|
|
|
2005-09-11 18:45:46 +02:00
|
|
|
if (t >= SEL_FDS) {
|
2005-07-27 15:08:52 +02:00
|
|
|
#if DEBUG_SELECT
|
|
|
|
printf("select callback: no fdtype found for device %d\n", major);
|
|
|
|
#endif
|
2005-07-08 19:30:01 +02:00
|
|
|
return OK;
|
2005-07-27 15:08:52 +02:00
|
|
|
}
|
2005-07-08 19:30:01 +02:00
|
|
|
|
|
|
|
/* We have a select callback from major device no.
|
|
|
|
* d, which corresponds to our select type t.
|
|
|
|
*/
|
|
|
|
|
|
|
|
for(s = 0; s < MAXSELECTS; s++) {
|
2005-07-27 15:08:52 +02:00
|
|
|
int s_minor, ops;
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
if (selecttab[s].requestor == NULL) continue;
|
2005-07-08 19:30:01 +02:00
|
|
|
for(f = 0; f < selecttab[s].nfds; f++) {
|
2005-09-11 18:45:46 +02:00
|
|
|
if (!selecttab[s].filps[f] ||
|
2005-07-27 15:08:52 +02:00
|
|
|
!select_major_match(major, selecttab[s].filps[f]))
|
2005-07-08 19:30:01 +02:00
|
|
|
continue;
|
|
|
|
ops = tab2ops(f, &selecttab[s]);
|
2005-10-20 21:39:32 +02:00
|
|
|
s_minor =
|
2006-10-25 15:40:36 +02:00
|
|
|
(selecttab[s].filps[f]->filp_vno->v_sdev >> MINOR)
|
2005-10-20 21:39:32 +02:00
|
|
|
& BYTE;
|
2005-09-11 18:45:46 +02:00
|
|
|
if ((s_minor == minor) &&
|
2005-07-27 15:08:52 +02:00
|
|
|
(selected_ops & ops)) {
|
|
|
|
select_callback(selecttab[s].filps[f], (selected_ops & ops));
|
2005-06-28 16:59:00 +02:00
|
|
|
}
|
2005-07-08 19:30:01 +02:00
|
|
|
}
|
2005-06-17 15:41:12 +02:00
|
|
|
}
|
2005-07-08 19:30:01 +02:00
|
|
|
|
2005-06-06 13:40:32 +02:00
|
|
|
return OK;
|
|
|
|
}
|
2005-07-27 15:08:52 +02:00
|
|
|
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
|
2005-07-22 20:28:32 +02:00
|
|
|
/*===========================================================================*
|
|
|
|
* init_select *
|
|
|
|
*===========================================================================*/
|
|
|
|
PUBLIC void init_select(void)
|
|
|
|
{
|
|
|
|
int s;
|
|
|
|
|
|
|
|
for(s = 0; s < MAXSELECTS; s++)
|
|
|
|
fs_init_timer(&selecttab[s].timer);
|
|
|
|
}
|
2005-06-06 13:40:32 +02:00
|
|
|
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
|
2005-06-17 15:41:12 +02:00
|
|
|
/*===========================================================================*
|
2005-09-11 18:45:46 +02:00
|
|
|
* select_forget *
|
2005-06-17 15:41:12 +02:00
|
|
|
*===========================================================================*/
|
endpoint-aware conversion of servers.
'who', indicating caller number in pm and fs and some other servers, has
been removed in favour of 'who_e' (endpoint) and 'who_p' (proc nr.).
In both PM and FS, isokendpt() convert endpoints to process slot
numbers, returning OK if it was a valid and consistent endpoint number.
okendpt() does the same but panic()s if it doesn't succeed. (In PM,
this is pm_isok..)
pm and fs keep their own records of process endpoints in their proc tables,
which are needed to make kernel calls about those processes.
message field names have changed.
fs drivers are endpoints.
fs now doesn't try to get out of driver deadlock, as the protocol isn't
supposed to let that happen any more. (A warning is printed if ELOCKED
is detected though.)
fproc[].fp_task (indicating which driver the process is suspended on)
became an int.
PM and FS now get endpoint numbers of initial boot processes from the
kernel. These happen to be the same as the old proc numbers, to let
user processes reach them with the old numbers, but FS and PM don't know
that. All new processes after INIT, even after the generation number
wraps around, get endpoint numbers with generation 1 and higher, so
the first instances of the boot processes are the only processes ever
to have endpoint numbers in the old proc number range.
More return code checks of sys_* functions have been added.
IS has become endpoint-aware. Ditched the 'text' and 'data' fields
in the kernel dump (which show locations, not sizes, so aren't terribly
useful) in favour of the endpoint number. Proc number is still visible.
Some other dumps (e.g. dmap, rs) show endpoint numbers now too which got
the formatting changed.
PM reading segments using rw_seg() has changed - it uses other fields
in the message now instead of encoding the segment and process number and
fd in the fd field. For that it uses _read_pm() and _write_pm() which to
_taskcall()s directly in pm/misc.c.
PM now sys_exit()s itself on panic(), instead of sys_abort().
RS also talks in endpoints instead of process numbers.
2006-03-03 11:20:58 +01:00
|
|
|
PUBLIC void select_forget(int proc_e)
|
2005-06-17 15:41:12 +02:00
|
|
|
{
|
|
|
|
/* something has happened (e.g. signal delivered that interrupts
|
|
|
|
* select()). totally forget about the select().
|
|
|
|
*/
|
|
|
|
int s;
|
|
|
|
|
|
|
|
for(s = 0; s < MAXSELECTS; s++) {
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
if (selecttab[s].requestor != NULL &&
|
|
|
|
selecttab[s].req_endpt == proc_e) {
|
2005-06-17 15:41:12 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-09-11 18:45:46 +02:00
|
|
|
if (s >= MAXSELECTS) {
|
2005-07-08 19:30:01 +02:00
|
|
|
#if DEBUG_SELECT
|
2005-06-17 15:41:12 +02:00
|
|
|
printf("select: cancelled select() not found");
|
2005-07-08 19:30:01 +02:00
|
|
|
#endif
|
2005-06-17 15:41:12 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
select_cancel_all(&selecttab[s]);
|
|
|
|
selecttab[s].requestor = NULL;
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
|
2005-06-17 15:41:12 +02:00
|
|
|
/*===========================================================================*
|
2005-09-11 18:45:46 +02:00
|
|
|
* select_timeout_check *
|
2005-06-17 15:41:12 +02:00
|
|
|
*===========================================================================*/
|
|
|
|
PUBLIC void select_timeout_check(timer_t *timer)
|
|
|
|
{
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
int s;
|
|
|
|
struct selectentry *se;
|
2005-06-17 15:41:12 +02:00
|
|
|
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
s = tmr_arg(timer)->ta_int;
|
|
|
|
if (s < 0 || s >= MAXSELECTS) {
|
2005-07-08 19:30:01 +02:00
|
|
|
#if DEBUG_SELECT
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
printf("select: bogus slot arg to watchdog %d\n", s);
|
2005-07-08 19:30:01 +02:00
|
|
|
#endif
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
se = &selecttab[s]; /* Point to select table entry */
|
2005-06-17 15:41:12 +02:00
|
|
|
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
if (se->requestor == NULL) {
|
2005-07-08 19:30:01 +02:00
|
|
|
#if DEBUG_SELECT
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
printf("select: no requestor in watchdog\n");
|
2005-07-08 19:30:01 +02:00
|
|
|
#endif
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
return;
|
|
|
|
}
|
2005-06-17 15:41:12 +02:00
|
|
|
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
if (se->expiry <= 0) {
|
2005-07-08 19:30:01 +02:00
|
|
|
#if DEBUG_SELECT
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
printf("select: strange expiry value in watchdog\n", s);
|
2005-07-08 19:30:01 +02:00
|
|
|
#endif
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
return;
|
|
|
|
}
|
2005-06-17 15:41:12 +02:00
|
|
|
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
se->expiry = 0;
|
|
|
|
select_return(se, 0);
|
2005-06-17 15:41:12 +02:00
|
|
|
|
|
|
|
}
|
2005-10-20 21:39:32 +02:00
|
|
|
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
|
2005-10-20 21:39:32 +02:00
|
|
|
/*===========================================================================*
|
endpoint-aware conversion of servers.
'who', indicating caller number in pm and fs and some other servers, has
been removed in favour of 'who_e' (endpoint) and 'who_p' (proc nr.).
In both PM and FS, isokendpt() convert endpoints to process slot
numbers, returning OK if it was a valid and consistent endpoint number.
okendpt() does the same but panic()s if it doesn't succeed. (In PM,
this is pm_isok..)
pm and fs keep their own records of process endpoints in their proc tables,
which are needed to make kernel calls about those processes.
message field names have changed.
fs drivers are endpoints.
fs now doesn't try to get out of driver deadlock, as the protocol isn't
supposed to let that happen any more. (A warning is printed if ELOCKED
is detected though.)
fproc[].fp_task (indicating which driver the process is suspended on)
became an int.
PM and FS now get endpoint numbers of initial boot processes from the
kernel. These happen to be the same as the old proc numbers, to let
user processes reach them with the old numbers, but FS and PM don't know
that. All new processes after INIT, even after the generation number
wraps around, get endpoint numbers with generation 1 and higher, so
the first instances of the boot processes are the only processes ever
to have endpoint numbers in the old proc number range.
More return code checks of sys_* functions have been added.
IS has become endpoint-aware. Ditched the 'text' and 'data' fields
in the kernel dump (which show locations, not sizes, so aren't terribly
useful) in favour of the endpoint number. Proc number is still visible.
Some other dumps (e.g. dmap, rs) show endpoint numbers now too which got
the formatting changed.
PM reading segments using rw_seg() has changed - it uses other fields
in the message now instead of encoding the segment and process number and
fd in the fd field. For that it uses _read_pm() and _write_pm() which to
_taskcall()s directly in pm/misc.c.
PM now sys_exit()s itself on panic(), instead of sys_abort().
RS also talks in endpoints instead of process numbers.
2006-03-03 11:20:58 +01:00
|
|
|
* select_unsuspend_by_endpt *
|
2005-10-20 21:39:32 +02:00
|
|
|
*===========================================================================*/
|
2009-09-22 23:48:26 +02:00
|
|
|
PUBLIC void select_unsuspend_by_endpt(endpoint_t proc_e)
|
2005-10-20 21:39:32 +02:00
|
|
|
{
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
int fd, s, maj;
|
|
|
|
|
|
|
|
for(s = 0; s < MAXSELECTS; s++) {
|
|
|
|
if (selecttab[s].requestor == NULL) continue;
|
|
|
|
|
|
|
|
for(fd = 0; fd < selecttab[s].nfds; fd++) {
|
|
|
|
if (selecttab[s].filps[fd] == NIL_FILP ||
|
|
|
|
selecttab[s].filps[fd]->filp_vno == NIL_VNODE) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
maj = (selecttab[s].filps[fd]->filp_vno->v_sdev >> MAJOR)&BYTE;
|
|
|
|
if (dmap_driver_match(proc_e, maj))
|
2005-10-20 21:39:32 +02:00
|
|
|
select_return(&selecttab[s], EAGAIN);
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
|
2005-10-20 21:39:32 +02:00
|
|
|
}
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
}
|
2005-10-20 21:39:32 +02:00
|
|
|
}
|
|
|
|
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
|
2008-02-22 16:46:59 +01:00
|
|
|
/*===========================================================================*
|
|
|
|
* select_reply1 *
|
|
|
|
*===========================================================================*/
|
|
|
|
PUBLIC void select_reply1()
|
|
|
|
{
|
2010-04-01 15:25:05 +02:00
|
|
|
int i, minor, status;
|
2008-02-22 16:46:59 +01:00
|
|
|
endpoint_t driver_e;
|
|
|
|
dev_t dev;
|
|
|
|
struct filp *fp;
|
|
|
|
struct dmap *dp;
|
|
|
|
struct vnode *vp;
|
|
|
|
|
|
|
|
driver_e= m_in.m_source;
|
|
|
|
minor= m_in.DEV_MINOR;
|
|
|
|
status= m_in.DEV_SEL_OPS;
|
|
|
|
|
|
|
|
/* Locate dmap entry */
|
|
|
|
for (i= 0, dp= dmap; i<NR_DEVICES; i++, dp++)
|
|
|
|
{
|
|
|
|
if (dp->dmap_driver == driver_e)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (i >= NR_DEVICES)
|
|
|
|
{
|
|
|
|
printf("select_reply1: proc %d is not a recoqnized driver\n",
|
|
|
|
driver_e);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
dev= (i << MAJOR) | (minor & BYTE);
|
|
|
|
|
|
|
|
fp= dp->dmap_sel_filp;
|
|
|
|
if (!fp)
|
|
|
|
{
|
|
|
|
printf("select_reply1: strange, no dmap_sel_filp\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!(fp->filp_select_flags & FSF_BUSY))
|
2010-03-05 16:05:11 +01:00
|
|
|
panic("select_reply1: strange; not FSF_BUSY");
|
2008-02-22 16:46:59 +01:00
|
|
|
|
|
|
|
vp= fp->filp_vno;
|
|
|
|
if (!vp)
|
2010-03-05 16:05:11 +01:00
|
|
|
panic("select_reply1: FSF_BUSY but no vp");
|
2008-02-22 16:46:59 +01:00
|
|
|
|
2010-03-05 16:05:11 +01:00
|
|
|
if ((vp->v_mode & I_TYPE) != I_CHAR_SPECIAL) {
|
|
|
|
panic("select_reply1: FSF_BUSY but not char special");
|
2008-02-22 16:46:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (vp->v_sdev != dev)
|
|
|
|
{
|
|
|
|
printf("select_reply1: strange, reply from wrong dev\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
dp->dmap_sel_filp= NULL;
|
|
|
|
fp->filp_select_flags &= ~FSF_BUSY;
|
|
|
|
if (!(fp->filp_select_flags & (FSF_UPDATE|FSF_BLOCK)))
|
|
|
|
fp->filp_select_ops= 0;
|
|
|
|
if (status != 0)
|
|
|
|
{
|
|
|
|
if (status > 0)
|
|
|
|
{
|
|
|
|
/* Clear the replied bits from the request mask unless
|
|
|
|
* FSF_UPDATE is set.
|
|
|
|
*/
|
|
|
|
if (!(fp->filp_select_flags & FSF_UPDATE))
|
|
|
|
fp->filp_select_ops &= ~status;
|
|
|
|
}
|
|
|
|
filp_status(fp, status);
|
|
|
|
}
|
|
|
|
if (fp->filp_count > 1)
|
|
|
|
fp->filp_count--;
|
|
|
|
else
|
|
|
|
{
|
2010-03-05 16:05:11 +01:00
|
|
|
if (fp->filp_count != 1) {
|
|
|
|
panic("select_reply1: bad filp_count: %d", fp->filp_count);
|
2008-02-22 16:46:59 +01:00
|
|
|
}
|
|
|
|
close_filp(fp);
|
|
|
|
}
|
|
|
|
sel_restart_dev();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*===========================================================================*
|
|
|
|
* select_reply2 *
|
|
|
|
*===========================================================================*/
|
|
|
|
PUBLIC void select_reply2()
|
|
|
|
{
|
|
|
|
int i, s, minor, status;
|
|
|
|
endpoint_t driver_e;
|
|
|
|
dev_t dev;
|
|
|
|
struct filp *fp;
|
|
|
|
struct dmap *dp;
|
|
|
|
struct vnode *vp;
|
|
|
|
|
|
|
|
driver_e= m_in.m_source;
|
|
|
|
minor= m_in.DEV_MINOR;
|
|
|
|
status= m_in.DEV_SEL_OPS;
|
|
|
|
|
|
|
|
/* Locate dmap entry */
|
|
|
|
for (i= 0, dp= dmap; i<NR_DEVICES; i++, dp++)
|
|
|
|
{
|
|
|
|
if (dp->dmap_driver == driver_e)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (i >= NR_DEVICES)
|
|
|
|
{
|
|
|
|
printf("select_reply2: proc %d is not a recognized driver\n",
|
|
|
|
driver_e);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
dev= (i << MAJOR) | (minor & BYTE);
|
|
|
|
|
|
|
|
/* Find filedescriptors for this device */
|
|
|
|
for (s= 0; s<MAXSELECTS; s++)
|
|
|
|
{
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
if (selecttab[s].requestor == NULL)
|
2008-02-22 16:46:59 +01:00
|
|
|
continue; /* empty slot */
|
|
|
|
|
|
|
|
for (i= 0; i<OPEN_MAX; i++)
|
|
|
|
{
|
|
|
|
fp= selecttab[s].filps[i];
|
|
|
|
if (!fp)
|
|
|
|
continue;
|
|
|
|
vp= fp->filp_vno;
|
|
|
|
if (!vp)
|
|
|
|
continue;
|
|
|
|
if ((vp->v_mode & I_TYPE) != I_CHAR_SPECIAL)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (vp->v_sdev != dev)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (status < 0)
|
|
|
|
{
|
|
|
|
printf("select_reply2: should handle error\n");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Clear the replied bits from the request
|
|
|
|
* mask unless FSF_UPDATE is set.
|
|
|
|
*/
|
|
|
|
if (!(fp->filp_select_flags & FSF_UPDATE))
|
|
|
|
fp->filp_select_ops &= ~status;
|
|
|
|
ops2tab(status, i, &selecttab[s]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (selecttab[s].nreadyfds > 0)
|
|
|
|
restart_proc(s);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
PRIVATE void sel_restart_dev()
|
|
|
|
{
|
|
|
|
int i, s;
|
|
|
|
struct filp *fp;
|
|
|
|
struct vnode *vp;
|
|
|
|
struct dmap *dp;
|
|
|
|
|
|
|
|
/* Locate filps that can be restarted */
|
|
|
|
for (s= 0; s<MAXSELECTS; s++)
|
|
|
|
{
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
if (selecttab[s].requestor == NULL)
|
|
|
|
continue; /* empty slot */
|
2008-02-22 16:46:59 +01:00
|
|
|
if (!selecttab[s].deferred)
|
|
|
|
continue; /* process is not waiting for an
|
|
|
|
* initial reply.
|
|
|
|
*/
|
|
|
|
for (i= 0; i<OPEN_MAX; i++)
|
|
|
|
{
|
|
|
|
fp= selecttab[s].filps[i];
|
|
|
|
if (!fp)
|
|
|
|
continue;
|
|
|
|
if (fp->filp_select_flags & FSF_BUSY)
|
|
|
|
continue;
|
|
|
|
if (!(fp->filp_select_flags & FSF_UPDATE))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
vp= fp->filp_vno;
|
2010-03-05 16:05:11 +01:00
|
|
|
if (!vp) {
|
|
|
|
panic("sel_restart_dev: FSF_UPDATE but no vp");
|
2008-02-22 16:46:59 +01:00
|
|
|
}
|
2010-03-05 16:05:11 +01:00
|
|
|
if ((vp->v_mode & I_TYPE) != I_CHAR_SPECIAL) {
|
|
|
|
panic("sel_restart_dev: FSF_UPDATE but not char special");
|
2008-02-22 16:46:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
dp = &dmap[((vp->v_sdev) >> MAJOR) & BYTE];
|
|
|
|
if (dp->dmap_sel_filp)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
printf(
|
|
|
|
"sel_restart_dev: should consider fd %d in slot %d\n",
|
|
|
|
i, s);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
|
2008-02-22 16:46:59 +01:00
|
|
|
PRIVATE void filp_status(fp, status)
|
|
|
|
struct filp *fp;
|
|
|
|
int status;
|
|
|
|
{
|
|
|
|
int i, s;
|
|
|
|
|
|
|
|
/* Locate processes that need to know about this result */
|
|
|
|
for (s= 0; s<MAXSELECTS; s++)
|
|
|
|
{
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
if (selecttab[s].requestor == NULL) continue; /* empty slot */
|
2008-02-22 16:46:59 +01:00
|
|
|
|
|
|
|
for (i= 0; i<OPEN_MAX; i++)
|
|
|
|
{
|
|
|
|
if (selecttab[s].filps[i] != fp)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (status < 0)
|
|
|
|
{
|
|
|
|
printf("filp_status: should handle error\n");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ops2tab(status, i, &selecttab[s]);
|
|
|
|
|
|
|
|
restart_proc(s);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
|
2008-02-22 16:46:59 +01:00
|
|
|
PRIVATE void restart_proc(slot)
|
|
|
|
int slot;
|
|
|
|
{
|
|
|
|
int fd;
|
|
|
|
struct selectentry *se;
|
|
|
|
struct filp *fp;
|
|
|
|
|
|
|
|
se= &selecttab[slot];
|
|
|
|
if (se->deferred)
|
|
|
|
{
|
|
|
|
for (fd= se->deferred_fd; fd < OPEN_MAX; fd++)
|
|
|
|
{
|
|
|
|
fp= se->filps[fd];
|
|
|
|
if (!fp)
|
|
|
|
continue;
|
|
|
|
if (fp->filp_select_flags & (FSF_UPDATE|FSF_BUSY))
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (fd < OPEN_MAX)
|
|
|
|
{
|
|
|
|
se->deferred_fd= fd;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
se->deferred= FALSE;
|
|
|
|
}
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
if (se->nreadyfds > 0 || !se->block) {
|
|
|
|
copy_fdsets(se, se->nfds, TO_PROC); /* FIXME, return error */
|
2008-02-22 16:46:59 +01:00
|
|
|
select_wakeup(se, se->nreadyfds);
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
se->requestor = NULL;
|
2008-02-22 16:46:59 +01:00
|
|
|
}
|
|
|
|
}
|
- Introduce support for sticky bit.
- 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.
2009-12-20 21:27:14 +01:00
|
|
|
|
|
|
|
/*===========================================================================*
|
|
|
|
* wipe_select *
|
|
|
|
*===========================================================================*/
|
|
|
|
PRIVATE void wipe_select(struct selectentry *se)
|
|
|
|
{
|
|
|
|
se->deferred = FALSE;
|
|
|
|
se->nfds = 0;
|
|
|
|
se->nreadyfds = 0;
|
|
|
|
/* memset(se->filps, 0, OPEN_MAX * sizeof(struct filp *)); */
|
|
|
|
memset(se->filps, 0, sizeof(se->filps));
|
|
|
|
|
|
|
|
FD_ZERO(&se->readfds);
|
|
|
|
FD_ZERO(&se->writefds);
|
|
|
|
FD_ZERO(&se->errorfds);
|
|
|
|
FD_ZERO(&se->ready_readfds);
|
|
|
|
FD_ZERO(&se->ready_writefds);
|
|
|
|
FD_ZERO(&se->ready_errorfds);
|
|
|
|
}
|
|
|
|
|