def create(self, srv, req, inode): new = self.storage.create(req.ifcall.name, inode, py9p.mode2stat(req.ifcall.perm)) if new.mode == stat.S_IFLNK: new.write(bytes(req.ifcall.extension.encode('utf-8'))) req.ofcall.qid = py9p.Qid((req.ifcall.perm >> 24) & py9p.QTDIR, 0, new.path) srv.respond(req, None)
def wstat(self, srv, req, inode): istat = req.ifcall.stat[0] if (istat.uidnum >> 16) == 0xFFFF: istat.uidnum = -1 if (istat.gidnum >> 16) == 0xFFFF: istat.gidnum = -1 self.storage.chown(inode, istat.uidnum, istat.gidnum) # change mode? if istat.mode != 0xFFFFFFFF: self.storage.chmod(inode, py9p.mode2stat(istat.mode)) # change name? if istat.name: inode.parent.rename(inode.name, istat.name.decode('utf-8')) srv.respond(req, None)