Readlink implements kernfs.Inode.Readlink.
(ctx context.Context, mnt *vfs.Mount)
| 756 | |
| 757 | // Readlink implements kernfs.Inode.Readlink. |
| 758 | func (i *inode) Readlink(ctx context.Context, mnt *vfs.Mount) (string, error) { |
| 759 | i.attrMu.Lock() |
| 760 | defer i.attrMu.Unlock() |
| 761 | if i.filemode().FileType()&linux.S_IFLNK == 0 { |
| 762 | return "", linuxerr.EINVAL |
| 763 | } |
| 764 | if len(i.link) == 0 { |
| 765 | req := i.fs.conn.NewRequest(auth.CredentialsFromContext(ctx), pidFromContext(ctx), i.nodeID, linux.FUSE_READLINK, &linux.FUSEEmptyIn{}) |
| 766 | res, err := i.fs.conn.Call(ctx, req) |
| 767 | if err != nil { |
| 768 | return "", err |
| 769 | } |
| 770 | if err := res.Error(); err != nil { |
| 771 | return "", err |
| 772 | } |
| 773 | i.link = string(res.data[res.hdr.SizeBytes():]) |
| 774 | if !mnt.Options().ReadOnly { |
| 775 | i.attrTime = ktime.ZeroTime |
| 776 | } |
| 777 | } |
| 778 | return i.link, nil |
| 779 | } |
| 780 | |
| 781 | // Stat implements kernfs.Inode.Stat. |
| 782 | func (i *inode) Stat(ctx context.Context, fs *vfs.Filesystem, opts vfs.StatOptions) (linux.Statx, error) { |
no test coverage detected