本文整理汇总了Golang中github.com/jbooth/maggiefs/maggiefs.Inode.Inodeid方法的典型用法代码示例。如果您正苦于以下问题:Golang Inode.Inodeid方法的具体用法?Golang Inode.Inodeid怎么用?Golang Inode.Inodeid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/jbooth/maggiefs/maggiefs.Inode
的用法示例。
在下文中一共展示了Inode.Inodeid方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: AddInode
// adds an inode persistent store, setting its inode ID to the generated ID, and returning
// the generated id and error
func (nd *NameData) AddInode(i *maggiefs.Inode) (uint64, error) {
newNodeId, err := nd.GetIncrCounter(COUNTER_INODE, 1)
if err != nil {
return 0, err
}
i.Inodeid = newNodeId
err = nd.SetInode(i)
return i.Inodeid, err
}
示例2: Mkdir
func (m *MaggieFuse) Mkdir(out *raw.EntryOut, header *raw.InHeader, input *raw.MkdirIn, name string) (code fuse.Status) {
// make new child
currTime := time.Now().Unix()
i := maggiefs.Inode{
0, // id 0 to start, we get id when inserting
0,
maggiefs.FTYPE_DIR,
0,
07777 & input.Mode,
currTime,
currTime,
0,
header.Uid,
header.Gid,
"",
make([]maggiefs.Block, 0, 0),
make(map[string]maggiefs.Dentry),
make(map[string][]byte),
}
// save
id, err := m.names.AddInode(&i)
if err != nil {
return fuse.EROFS
}
i.Inodeid = id
// link parent
err = m.names.Link(header.NodeId, id, name, false)
if err != nil {
// garbage collector will clean up our 0 reference node
if err == maggiefs.E_EXISTS {
return fuse.Status(syscall.EEXIST)
}
if err == maggiefs.E_NOTDIR {
return fuse.ENOTDIR
}
return fuse.EROFS
}
// send entry back to child
fillEntryOut(out, &i)
return fuse.OK
}
示例3: Mknod
func (m *MaggieFuse) Mknod(out *raw.EntryOut, header *raw.InHeader, input *raw.MknodIn, name string) (code fuse.Status) {
//build node
currTime := time.Now().Unix()
i := maggiefs.Inode{
0, // id 0 to start
0, // gen 0
maggiefs.FTYPE_REG,
0,
input.Mode & 07777,
currTime,
currTime,
1,
header.Uid,
header.Gid,
"",
make([]maggiefs.Block, 0, 0),
make(map[string]maggiefs.Dentry),
make(map[string][]byte),
}
// save new node
id, err := m.names.AddInode(&i)
if err != nil {
return fuse.EROFS
}
i.Inodeid = id
// link parent
err = m.names.Link(header.NodeId, i.Inodeid, name, false)
if err != nil {
if err == maggiefs.E_EXISTS {
return fuse.Status(syscall.EEXIST)
} else {
return fuse.EROFS
}
}
// output
fillEntryOut(out, &i)
return fuse.OK
}
示例4: Symlink
func (m *MaggieFuse) Symlink(out *raw.EntryOut, header *raw.InHeader, pointedTo string, linkName string) (code fuse.Status) {
// new inode type symlink
currTime := time.Now().Unix()
i := maggiefs.Inode{
0, // id 0 to start, we get id when inserting
0,
maggiefs.FTYPE_LNK,
0,
0777,
currTime,
currTime,
0,
header.Uid,
header.Gid,
pointedTo,
make([]maggiefs.Block, 0, 0),
make(map[string]maggiefs.Dentry),
make(map[string][]byte),
}
// save
id, err := m.names.AddInode(&i)
if err != nil {
return fuse.EROFS
}
i.Inodeid = id
// link parent
err = m.names.Link(header.NodeId, i.Inodeid, linkName, false)
if err != nil {
if err == maggiefs.E_EXISTS {
return fuse.Status(syscall.EEXIST)
} else if err == maggiefs.E_NOTDIR {
return fuse.ENOTDIR
}
return fuse.EROFS
}
// send entry back to child
fillEntryOut(out, &i)
return fuse.OK
}