VFS : simplification of handling asyn selects
- select_request_async() returns no ops by default - wantops in do_select() always set correctly, do_select() does not need a special case for SUSPEND (and ugly code)
This commit is contained in:
parent
369a12704f
commit
f19d8df184
1 changed files with 8 additions and 12 deletions
|
@ -215,10 +215,8 @@ PUBLIC int do_select(void)
|
||||||
|
|
||||||
wantops = (f->filp_select_ops |= ops);
|
wantops = (f->filp_select_ops |= ops);
|
||||||
r = do_select_request(se, fd, &wantops);
|
r = do_select_request(se, fd, &wantops);
|
||||||
if (r != OK) {
|
if (r != OK && r != SUSPEND)
|
||||||
if (r == SUSPEND) continue;
|
break; /* Error or bogus return code; abort */
|
||||||
else break; /* Error or bogus return code; abort */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The select request above might have turned on/off some
|
/* The select request above might have turned on/off some
|
||||||
* operations because they were 'ready' or not meaningful.
|
* operations because they were 'ready' or not meaningful.
|
||||||
|
@ -339,6 +337,9 @@ PRIVATE int select_request_async(struct filp *f, int *ops, int block)
|
||||||
|
|
||||||
rops = *ops;
|
rops = *ops;
|
||||||
|
|
||||||
|
/* By default, nothing to do */
|
||||||
|
*ops = 0;
|
||||||
|
|
||||||
if (!block && (f->filp_select_flags & FSF_BLOCKED)) {
|
if (!block && (f->filp_select_flags & FSF_BLOCKED)) {
|
||||||
/* This filp is blocked waiting for a reply, but we don't want to
|
/* This filp is blocked waiting for a reply, but we don't want to
|
||||||
* block ourselves. Unless we're awaiting the initial reply, these
|
* block ourselves. Unless we're awaiting the initial reply, these
|
||||||
|
@ -350,13 +351,10 @@ PRIVATE int select_request_async(struct filp *f, int *ops, int block)
|
||||||
rops &= ~SEL_WR;
|
rops &= ~SEL_WR;
|
||||||
if ((rops & SEL_ERR) && (f->filp_select_flags & FSF_ERR_BLOCK))
|
if ((rops & SEL_ERR) && (f->filp_select_flags & FSF_ERR_BLOCK))
|
||||||
rops &= ~SEL_ERR;
|
rops &= ~SEL_ERR;
|
||||||
if (!(rops & (SEL_RD|SEL_WR|SEL_ERR))) {
|
if (!(rops & (SEL_RD|SEL_WR|SEL_ERR)))
|
||||||
/* Nothing left to do */
|
|
||||||
*ops = 0;
|
|
||||||
return(OK);
|
return(OK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
f->filp_select_flags |= FSF_UPDATE;
|
f->filp_select_flags |= FSF_UPDATE;
|
||||||
if (block) {
|
if (block) {
|
||||||
|
@ -952,10 +950,8 @@ PRIVATE void select_restart_filps()
|
||||||
vp = f->filp_vno;
|
vp = f->filp_vno;
|
||||||
assert((vp->v_mode & I_TYPE) == I_CHAR_SPECIAL);
|
assert((vp->v_mode & I_TYPE) == I_CHAR_SPECIAL);
|
||||||
r = do_select_request(se, fd, &wantops);
|
r = do_select_request(se, fd, &wantops);
|
||||||
if (r != OK) {
|
if (r != OK && r != SUSPEND)
|
||||||
if (r == SUSPEND) continue;
|
break; /* Error or bogus return code; abort */
|
||||||
else break; /* Error or bogus return code; abort */
|
|
||||||
}
|
|
||||||
if (wantops & ops) ops2tab(wantops, fd, se);
|
if (wantops & ops) ops2tab(wantops, fd, se);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue