本文整理汇总了Golang中syscall.Stat_t.Ino方法的典型用法代码示例。如果您正苦于以下问题:Golang Stat_t.Ino方法的具体用法?Golang Stat_t.Ino怎么用?Golang Stat_t.Ino使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类syscall.Stat_t
的用法示例。
在下文中一共展示了Stat_t.Ino方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: TestMemUnionResetDelete
func TestMemUnionResetDelete(t *testing.T) {
wd, ufs, clean := setupMemUfs(t)
defer clean()
ioutil.WriteFile(wd+"/ro/todelete", []byte{42}, 0644)
var before, after, afterReset syscall.Stat_t
syscall.Lstat(wd+"/mnt/todelete", &before)
before.Ino = 0
os.Remove(wd + "/mnt/todelete")
syscall.Lstat(wd+"/mnt/todelete", &after)
testEq(t, after, before, false)
ufs.Reset()
syscall.Lstat(wd+"/mnt/todelete", &afterReset)
afterReset.Ino = 0
testEq(t, afterReset, before, true)
}
示例2: LstatInode
func (constor *Constor) LstatInode(path string, stat *syscall.Stat_t, inode *Inode) error {
li := inode.layer
if li == -1 {
li = constor.getLayer(path)
if li == -1 {
return syscall.ENOENT
}
inode.layer = li
}
pathl := Path.Join(constor.layers[li], path)
err := syscall.Lstat(pathl, stat)
if err != nil {
return err
}
if li != 0 {
// INOXATTR valid only for layer-0
return nil
}
// var inobyte []byte
// inobyte = make([]byte, 100, 100)
// size, err := syscall.Getxattr(pathl, INOXATTR, inobyte)
inobyte, err := Lgetxattr(pathl, INOXATTR)
if err != nil {
return nil
}
if len(inobyte) == 0 {
return nil
}
inostr := string(inobyte)
ino, err := strconv.Atoi(inostr)
if err != nil {
return err
}
stat.Ino = uint64(ino)
if inode.ino == 1 {
stat.Ino = 1
}
return nil
}
示例3: GetAttr
// GetAttr - FUSE call
func (f *virtualFile) GetAttr(a *fuse.Attr) fuse.Status {
var st syscall.Stat_t
err := syscall.Lstat(f.parentFile, &st)
if err != nil {
fmt.Printf("Lstat %q: %v\n", f.parentFile, err)
return fuse.ToStatus(err)
}
st.Ino = f.ino
st.Size = int64(len(f.content))
st.Mode = syscall.S_IFREG | 0400
st.Nlink = 1
a.FromStat(&st)
return fuse.OK
}
示例4: Lstat
func (constor *Constor) Lstat(li int, id string, stat *syscall.Stat_t) error {
path := constor.getPath(li, id)
if err := syscall.Lstat(path, stat); err != nil {
return err
}
count := 1
linksbyte, err := Lgetxattr(path, LINKSXATTR)
if err == nil && len(linksbyte) != 0 {
linksstr := string(linksbyte)
linksint, err := strconv.Atoi(linksstr)
if err != nil {
constor.error("%s : %s", id, err)
return err
}
count = linksint
}
stat.Nlink = uint64(count)
stat.Ino = idtoino(id)
return nil
}
示例5: GetAttr
func (constor *Constor) GetAttr(input *fuse.GetAttrIn, out *fuse.AttrOut) (code fuse.Status) {
stat := syscall.Stat_t{}
inode := constor.inodemap.findInodePtr(input.NodeId)
if inode == nil {
constor.error("%d not in inodemap", input.NodeId)
return fuse.ENOENT
}
if inode.id == ROOTID && inode.layer == -1 {
inode.layer = constor.getLayer(inode.id)
if inode.layer == -1 {
constor.error("Unable to find root inode")
return fuse.ENOENT
}
}
F := constor.fdlookup(inode.id, input.Pid)
var err error
// FIXME check to see if F.layer needs to be changed
if F == nil {
if inode.layer == -1 {
constor.error("layer is -1 for %s", inode.id)
return fuse.ENOENT
}
constor.log("Lstat on %s", inode.id)
err = constor.Lstat(inode.layer, inode.id, &stat)
} else {
constor.log("Fstat on %s", inode.id)
err = syscall.Fstat(F.fd, &stat)
stat.Ino = idtoino(F.id)
// FIXME take care of hard links too
}
if err != nil {
constor.error("%s: %s", inode.id, err)
return fuse.ToStatus(err)
}
attr := (*fuse.Attr)(&out.Attr)
attr.FromStat(&stat)
out.AttrValid = 1000
constor.log("%s", inode.id)
return fuse.OK
}