本文整理匯總了Golang中camlistore/org/third_party/bazil/org/fuse.OpenResponse.Flags方法的典型用法代碼示例。如果您正苦於以下問題:Golang OpenResponse.Flags方法的具體用法?Golang OpenResponse.Flags怎麽用?Golang OpenResponse.Flags使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類camlistore/org/third_party/bazil/org/fuse.OpenResponse
的用法示例。
在下文中一共展示了OpenResponse.Flags方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Open
func (f benchFile) Open(req *fuse.OpenRequest, resp *fuse.OpenResponse, intr fs.Intr) (fs.Handle, fuse.Error) {
if f.conf.directIO {
resp.Flags |= fuse.OpenDirectIO
}
// TODO configurable?
resp.Flags |= fuse.OpenKeepCache
return f, nil
}
示例2: Open
// Empirically:
// open for read: req.Flags == 0
// open for append: req.Flags == 1
// open for write: req.Flags == 1
// open for read/write (+<) == 2 (bitmask? of?)
//
// open flags are O_WRONLY (1), O_RDONLY (0), or O_RDWR (2). and also
// bitmaks of O_SYMLINK (0x200000) maybe. (from
// fuse_filehandle_xlate_to_oflags in macosx/kext/fuse_file.h)
func (n *mutFile) Open(req *fuse.OpenRequest, res *fuse.OpenResponse, intr fs.Intr) (fs.Handle, fuse.Error) {
mutFileOpen.Incr()
log.Printf("mutFile.Open: %v: content: %v dir=%v flags=%v", n.permanode, n.content, req.Dir, req.Flags)
r, err := schema.NewFileReader(n.fs.fetcher, n.content)
if err != nil {
mutFileOpenError.Incr()
log.Printf("mutFile.Open: %v", err)
return nil, fuse.EIO
}
// Turn off the OpenDirectIO bit (on by default in rsc fuse server.go),
// else append operations don't work for some reason.
res.Flags &= ^fuse.OpenDirectIO
// Read-only.
if !isWriteFlags(req.Flags) {
mutFileOpenRO.Incr()
log.Printf("mutFile.Open returning read-only file")
n := &node{
fs: n.fs,
blobref: n.content,
}
return &nodeReader{n: n, fr: r}, nil
}
mutFileOpenRW.Incr()
log.Printf("mutFile.Open returning read-write filehandle")
defer r.Close()
return n.newHandle(r)
}
示例3: Open
// Empirically:
// open for read: req.Flags == 0
// open for append: req.Flags == 1
// open for write: req.Flags == 1
// open for read/write (+<) == 2 (bitmask? of?)
//
// open flags are O_WRONLY (1), O_RDONLY (0), or O_RDWR (2). and also
// bitmaks of O_SYMLINK (0x200000) maybe. (from
// fuse_filehandle_xlate_to_oflags in macosx/kext/fuse_file.h)
func (n *roFile) Open(req *fuse.OpenRequest, res *fuse.OpenResponse, intr fs.Intr) (fs.Handle, fuse.Error) {
roFileOpen.Incr()
if isWriteFlags(req.Flags) {
return nil, fuse.EPERM
}
log.Printf("roFile.Open: %v: content: %v dir=%v flags=%v", n.permanode, n.content, req.Dir, req.Flags)
r, err := schema.NewFileReader(n.fs.fetcher, n.content)
if err != nil {
roFileOpenError.Incr()
log.Printf("roFile.Open: %v", err)
return nil, fuse.EIO
}
// Turn off the OpenDirectIO bit (on by default in rsc fuse server.go),
// else append operations don't work for some reason.
res.Flags &= ^fuse.OpenDirectIO
// Read-only.
nod := &node{
fs: n.fs,
blobref: n.content,
}
return &nodeReader{n: nod, fr: r}, nil
}
示例4: Open
func (f directRead) Open(req *fuse.OpenRequest, resp *fuse.OpenResponse, intr fs.Intr) (fs.Handle, fuse.Error) {
// do not allow the kernel to use page cache
resp.Flags |= fuse.OpenDirectIO
return f, nil
}
示例5: Open
func (s *stat) Open(req *fuse.OpenRequest, res *fuse.OpenResponse, intr fs.Intr) (fs.Handle, fuse.Error) {
// Set DirectIO to keep this file from being cached in OS X's kernel.
res.Flags |= fuse.OpenDirectIO
return s, nil
}