From 6aa9f5636f03392b5da5fc19dc4ea908e2e55e26 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Thu, 11 Jun 2020 23:39:27 +0200 Subject: v2api: implement Lookup() Compiles, but untested otherwise. No caching. --- internal/syscallcompat/sys_common.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'internal/syscallcompat') diff --git a/internal/syscallcompat/sys_common.go b/internal/syscallcompat/sys_common.go index b6bbdff..d5e3251 100644 --- a/internal/syscallcompat/sys_common.go +++ b/internal/syscallcompat/sys_common.go @@ -107,6 +107,18 @@ func Fstatat(dirfd int, path string, stat *unix.Stat_t, flags int) (err error) { return unix.Fstatat(dirfd, path, stat, flags) } +// Fstatat2 is a more convenient version of Fstatat. It allocates a Stat_t +// for you and also handles the Unix2syscall conversion. +func Fstatat2(dirfd int, path string, flags int) (*syscall.Stat_t, error) { + var stUnix unix.Stat_t + err := Fstatat(dirfd, path, &stUnix, flags) + if err != nil { + return nil, err + } + st := Unix2syscall(stUnix) + return &st, nil +} + const XATTR_SIZE_MAX = 65536 // Make the buffer 1kB bigger so we can detect overflows -- cgit v1.2.3