ref: 5fc5c18208546c77f2c279f7f6acf6b01a2d2645
parent: 5c6a03f4f417d00a6d169cfc9c7e6efae17f4e5e
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Mar 5 22:07:03 EST 2017
cwfs: handle DMTMP flag in create
--- a/sys/src/cmd/cwfs/9p2.c
+++ b/sys/src/cmd/cwfs/9p2.c
@@ -894,8 +894,8 @@
error = Emode;
goto out;
}
- if(f->perm & PDIR)
- if((f->mode & OTRUNC) || (f->perm & PAPND) || (fmod & FWRITE))
+ if(f->perm & DMDIR)
+ if((f->mode & OTRUNC) || (f->perm & DMAPPEND) || (fmod & FWRITE))
goto badaccess;
/*
* do it
@@ -921,20 +921,22 @@
d1->uid = file->uid;
d1->gid = d->gid;
f->perm &= d->mode | ~0666;
- if(f->perm & PDIR)
+ if(f->perm & DMDIR)
f->perm &= d->mode | ~0777;
}
d1->qid.path = path;
d1->qid.version = 0;
d1->mode = DALLOC | (f->perm & 0777);
- if(f->perm & PDIR) {
+ if(f->perm & DMDIR) {
d1->mode |= DDIR;
d1->qid.path |= QPDIR;
}
- if(f->perm & PAPND)
+ if(f->perm & DMAPPEND)
d1->mode |= DAPND;
+ if(f->perm & DMTMP)
+ d1->mode |= DTMP;
t = nil;
- if(f->perm & PLOCK){
+ if(f->perm & DMEXCL){
d1->mode |= DLOCK;
t = tlocked(p1, d1);
/* if nil, out of tlock structures */
--- a/sys/src/cmd/cwfs/all.h
+++ b/sys/src/cmd/cwfs/all.h
@@ -25,13 +25,6 @@
QPROOT = 1,
QPSUPER = 2,
- /*
- * perm argument in 9P create
- */
- PDIR = 1L<<31, /* is a directory */
- PAPND = 1L<<30, /* is append only */
- PLOCK = 1L<<29, /* is locked on open */
-
FID1 = 1,
FID2 = 2,
--- a/sys/src/cmd/cwfs/con.c
+++ b/sys/src/cmd/cwfs/con.c
@@ -435,11 +435,13 @@
if(argc > 5) {
if(strchr(argv[5], 'l'))
- perm |= PLOCK;
+ perm |= DMEXCL;
if(strchr(argv[5], 'a'))
- perm |= PAPND;
+ perm |= DMAPPEND;
if(strchr(argv[5], 'd'))
- perm |= PDIR;
+ perm |= DMDIR;
+ if(strchr(argv[5], 't'))
+ perm |= DMTMP;
}
if(con_create(FID2, elem, uid, gid, perm, 0))