本文整理汇总了Golang中github.com/mortdeus/go9p/srv.Req.RespondRcreate方法的典型用法代码示例。如果您正苦于以下问题:Golang Req.RespondRcreate方法的具体用法?Golang Req.RespondRcreate怎么用?Golang Req.RespondRcreate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/mortdeus/go9p/srv.Req
的用法示例。
在下文中一共展示了Req.RespondRcreate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Create
func (*Ufs) Create(req *srv.Req) {
fid := req.Fid.Aux.(*Fid)
tc := req.Tc
err := fid.stat()
if err != nil {
req.RespondError(err)
return
}
path := fid.path + "/" + tc.Name
var e error = nil
var file *os.File = nil
switch {
case tc.Perm&go9p.DMDIR != 0:
e = os.Mkdir(path, os.FileMode(tc.Perm&0777))
case tc.Perm&go9p.DMSYMLINK != 0:
e = os.Symlink(tc.Ext, path)
case tc.Perm&go9p.DMLINK != 0:
n, e := strconv.ParseUint(tc.Ext, 10, 0)
if e != nil {
break
}
ofid := req.Conn.FidGet(uint32(n))
if ofid == nil {
req.RespondError(srv.Eunknownfid)
return
}
e = os.Link(ofid.Aux.(*Fid).path, path)
ofid.DecRef()
case tc.Perm&go9p.DMNAMEDPIPE != 0:
case tc.Perm&go9p.DMDEVICE != 0:
req.RespondError(&go9p.Error{"not implemented", go9p.EIO})
return
default:
var mode uint32 = tc.Perm & 0777
if req.Conn.Dotu {
if tc.Perm&go9p.DMSETUID > 0 {
mode |= syscall.S_ISUID
}
if tc.Perm&go9p.DMSETGID > 0 {
mode |= syscall.S_ISGID
}
}
file, e = os.OpenFile(path, omode2uflags(tc.Mode)|os.O_CREATE, os.FileMode(mode))
}
if file == nil && e == nil {
file, e = os.OpenFile(path, omode2uflags(tc.Mode), 0)
}
if e != nil {
req.RespondError(toError(e))
return
}
fid.path = path
fid.file = file
err = fid.stat()
if err != nil {
req.RespondError(err)
return
}
req.RespondRcreate(dir2Qid(fid.st), 0)
}