mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-12 11:10:07 +00:00
better open mode
This commit is contained in:
parent
05f50fe6bf
commit
0d7fd01125
1 changed files with 10 additions and 5 deletions
|
@ -13,8 +13,6 @@
|
||||||
* allocates two more procs, one for reading and one for
|
* allocates two more procs, one for reading and one for
|
||||||
* writing the 9P connection. Thus the many threads in the
|
* writing the 9P connection. Thus the many threads in the
|
||||||
* request proc can do 9P interactions without blocking.
|
* request proc can do 9P interactions without blocking.
|
||||||
*
|
|
||||||
* TODO: graceful shutdown.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define _GNU_SOURCE 1 /* for O_DIRECTORY on Linux */
|
#define _GNU_SOURCE 1 /* for O_DIRECTORY on Linux */
|
||||||
|
@ -515,10 +513,8 @@ _fuseopenfid(uvlong nodeid, int isdir, int openmode, int *err)
|
||||||
newfid = fswalk(fid, nil);
|
newfid = fswalk(fid, nil);
|
||||||
if(newfid == nil){
|
if(newfid == nil){
|
||||||
*err = errstr2errno();
|
*err = errstr2errno();
|
||||||
// fsclose(fid);
|
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
// fsputfid(fid);
|
|
||||||
|
|
||||||
if(fsfopen(newfid, openmode) < 0){
|
if(fsfopen(newfid, openmode) < 0){
|
||||||
*err = errstr2errno();
|
*err = errstr2errno();
|
||||||
|
@ -544,12 +540,21 @@ _fuseopen(FuseMsg *m, int isdir)
|
||||||
CFid *fid;
|
CFid *fid;
|
||||||
int openmode, flags, err;
|
int openmode, flags, err;
|
||||||
|
|
||||||
/* TODO: better job translating openmode - see lib9 open */
|
|
||||||
in = m->tx;
|
in = m->tx;
|
||||||
flags = in->flags;
|
flags = in->flags;
|
||||||
openmode = flags&3;
|
openmode = flags&3;
|
||||||
flags &= ~3;
|
flags &= ~3;
|
||||||
flags &= ~(O_DIRECTORY|O_NONBLOCK|O_LARGEFILE);
|
flags &= ~(O_DIRECTORY|O_NONBLOCK|O_LARGEFILE);
|
||||||
|
if(flags & O_TRUNC){
|
||||||
|
openmode |= OTRUNC;
|
||||||
|
flags &= ~O_TRUNC;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* Could translate but not standard 9P:
|
||||||
|
* O_DIRECT -> ODIRECT
|
||||||
|
* O_NONBLOCK -> ONONBLOCK
|
||||||
|
* O_APPEND -> OAPPEND
|
||||||
|
*/
|
||||||
if(flags){
|
if(flags){
|
||||||
fprint(2, "unexpected open flags %#uo", (uint)in->flags);
|
fprint(2, "unexpected open flags %#uo", (uint)in->flags);
|
||||||
replyfuseerrno(m, EACCES);
|
replyfuseerrno(m, EACCES);
|
||||||
|
|
Loading…
Reference in a new issue