本文整理匯總了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)
}