MCPcopy
hub / github.com/perkeep/perkeep / Create

Method Create

pkg/fs/mut.go:308–322  ·  view source on GitHub ↗

Create of regular file. (not a dir) Flags are always 514: O_CREAT is 0x200 | O_RDWR is 0x2. From fuse_vnops.c: /* XXX: We /always/ creat() like this. Wish we were on Linux. */ foi->flags = O_CREAT | O_RDWR; 2013/07/21 05:26:35 <- &{Create [ID=0x3 Node=0x8 Uid=61652 Gid=5000 Pid=13115] "x" fl=5

(ctx context.Context, req *fuse.CreateRequest, res *fuse.CreateResponse)

Source from the content-addressed store, hash-verified

306// 2013/07/21 05:26:35 <- &{Create [ID=0x3 Node=0x8 Uid=61652 Gid=5000 Pid=13115] "x" fl=514 mode=-rw-r--r-- fuse.Intr}
307// 2013/07/21 05:26:36 -> 0x3 Create {LookupResponse:{Node:23 Generation:0 EntryValid:1m0s AttrValid:1m0s Attr:{Inode:15976986887557313215 Size:0 Blocks:0 Atime:2013-07-21 05:23:51.537251251 +1200 NZST Mtime:2013-07-21 05:23:51.537251251 +1200 NZST Ctime:2013-07-21 05:23:51.537251251 +1200 NZST Crtime:2013-07-21 05:23:51.537251251 +1200 NZST Mode:-rw------- Nlink:1 Uid:61652 Gid:5000 Rdev:0 Flags:0}} OpenResponse:{Handle:1 Flags:0}}
308func (n *mutDir) Create(ctx context.Context, req *fuse.CreateRequest, res *fuse.CreateResponse) (fs.Node, fs.Handle, error) {
309 child, err := n.creat(ctx, req.Name, fileType)
310 if err != nil {
311 Logger.Printf("mutDir.Create(%q): %v", req.Name, err)
312 return nil, nil, handleEIOorEINTR(err)
313 }
314
315 // Create and return a file handle.
316 h, ferr := child.(*mutFile).newHandle(nil)
317 if ferr != nil {
318 return nil, nil, ferr
319 }
320
321 return child, h, nil
322}
323
324func (n *mutDir) Mkdir(ctx context.Context, req *fuse.MkdirRequest) (fs.Node, error) {
325 child, err := n.creat(ctx, req.Name, dirType)

Callers 15

writePackFunction · 0.80
writeAZipMethod · 0.80
TestNonUTF8FileNameFunction · 0.80
TestNonUTF8SymlinkTargetFunction · 0.80
createTestFileFunction · 0.80
TestCamgetSymlinkFunction · 0.80
TestCamgetFileFunction · 0.80
WipeMethod · 0.80
mustCreateFunction · 0.80
TestMutableFunction · 0.80
mainFunction · 0.80
cpFileFunction · 0.80

Calls 4

creatMethod · 0.95
handleEIOorEINTRFunction · 0.85
PrintfMethod · 0.80
newHandleMethod · 0.80

Tested by 10

writePackFunction · 0.64
TestNonUTF8FileNameFunction · 0.64
TestNonUTF8SymlinkTargetFunction · 0.64
createTestFileFunction · 0.64
TestCamgetSymlinkFunction · 0.64
TestCamgetFileFunction · 0.64
TestMutableFunction · 0.64
savePngFunction · 0.64
testCompareWithResizedFunction · 0.64
createTestIncludeFunction · 0.64