mirror of
https://github.com/containers/podman.git
synced 2025-11-14 01:57:58 +08:00
Update vendor of containers/buildah
Changes since 2022-05-31: - add --omit-history option (buildah PR 4028) Signed-off-by: Ed Santiago <santiago@redhat.com> Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
84
vendor/github.com/containers/storage/pkg/system/xattrs_darwin.go
generated
vendored
Normal file
84
vendor/github.com/containers/storage/pkg/system/xattrs_darwin.go
generated
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"os"
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
const (
|
||||
// Value is larger than the maximum size allowed
|
||||
E2BIG unix.Errno = unix.E2BIG
|
||||
|
||||
// Operation not supported
|
||||
EOPNOTSUPP unix.Errno = unix.EOPNOTSUPP
|
||||
)
|
||||
|
||||
// Lgetxattr retrieves the value of the extended attribute identified by attr
|
||||
// and associated with the given path in the file system.
|
||||
// Returns a []byte slice if the xattr is set and nil otherwise.
|
||||
func Lgetxattr(path string, attr string) ([]byte, error) {
|
||||
// Start with a 128 length byte array
|
||||
dest := make([]byte, 128)
|
||||
sz, errno := unix.Lgetxattr(path, attr, dest)
|
||||
|
||||
for errno == unix.ERANGE {
|
||||
// Buffer too small, use zero-sized buffer to get the actual size
|
||||
sz, errno = unix.Lgetxattr(path, attr, []byte{})
|
||||
if errno != nil {
|
||||
return nil, &os.PathError{Op: "lgetxattr", Path: path, Err: errno}
|
||||
}
|
||||
dest = make([]byte, sz)
|
||||
sz, errno = unix.Lgetxattr(path, attr, dest)
|
||||
}
|
||||
|
||||
switch {
|
||||
case errno == unix.ENOATTR:
|
||||
return nil, nil
|
||||
case errno != nil:
|
||||
return nil, &os.PathError{Op: "lgetxattr", Path: path, Err: errno}
|
||||
}
|
||||
|
||||
return dest[:sz], nil
|
||||
}
|
||||
|
||||
// Lsetxattr sets the value of the extended attribute identified by attr
|
||||
// and associated with the given path in the file system.
|
||||
func Lsetxattr(path string, attr string, data []byte, flags int) error {
|
||||
if err := unix.Lsetxattr(path, attr, data, flags); err != nil {
|
||||
return &os.PathError{Op: "lsetxattr", Path: path, Err: err}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Llistxattr lists extended attributes associated with the given path
|
||||
// in the file system.
|
||||
func Llistxattr(path string) ([]string, error) {
|
||||
dest := make([]byte, 128)
|
||||
sz, errno := unix.Llistxattr(path, dest)
|
||||
|
||||
for errno == unix.ERANGE {
|
||||
// Buffer too small, use zero-sized buffer to get the actual size
|
||||
sz, errno = unix.Llistxattr(path, []byte{})
|
||||
if errno != nil {
|
||||
return nil, &os.PathError{Op: "llistxattr", Path: path, Err: errno}
|
||||
}
|
||||
|
||||
dest = make([]byte, sz)
|
||||
sz, errno = unix.Llistxattr(path, dest)
|
||||
}
|
||||
if errno != nil {
|
||||
return nil, &os.PathError{Op: "llistxattr", Path: path, Err: errno}
|
||||
}
|
||||
|
||||
var attrs []string
|
||||
for _, token := range bytes.Split(dest[:sz], []byte{0}) {
|
||||
if len(token) > 0 {
|
||||
attrs = append(attrs, string(token))
|
||||
}
|
||||
}
|
||||
|
||||
return attrs, nil
|
||||
}
|
||||
2
vendor/github.com/containers/storage/pkg/system/xattrs_unsupported.go
generated
vendored
2
vendor/github.com/containers/storage/pkg/system/xattrs_unsupported.go
generated
vendored
@@ -1,4 +1,4 @@
|
||||
// +build !linux
|
||||
// +build !linux,!darwin
|
||||
|
||||
package system
|
||||
|
||||
|
||||
Reference in New Issue
Block a user