2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-26 23:06:32 +00:00

Update code for pkg/xattr v0.2.0

This commit is contained in:
Alexander Neumann 2017-04-18 21:39:55 +02:00
parent 88e8eaa575
commit e9d939ff2d

View File

@ -12,8 +12,8 @@ import (
// Getxattr retrieves extended attribute data associated with path. // Getxattr retrieves extended attribute data associated with path.
func Getxattr(path, name string) ([]byte, error) { func Getxattr(path, name string) ([]byte, error) {
b, e := xattr.Getxattr(path, name) b, e := xattr.Get(path, name)
if err, ok := e.(*xattr.XAttrError); ok && err.Err == syscall.ENOTSUP { if err, ok := e.(*xattr.Error); ok && err.Err == syscall.ENOTSUP {
return nil, nil return nil, nil
} }
return b, errors.Wrap(e, "Getxattr") return b, errors.Wrap(e, "Getxattr")
@ -22,8 +22,8 @@ func Getxattr(path, name string) ([]byte, error) {
// Listxattr retrieves a list of names of extended attributes associated with the // Listxattr retrieves a list of names of extended attributes associated with the
// given path in the file system. // given path in the file system.
func Listxattr(path string) ([]string, error) { func Listxattr(path string) ([]string, error) {
s, e := xattr.Listxattr(path) s, e := xattr.List(path)
if err, ok := e.(*xattr.XAttrError); ok && err.Err == syscall.ENOTSUP { if err, ok := e.(*xattr.Error); ok && err.Err == syscall.ENOTSUP {
return nil, nil return nil, nil
} }
return s, errors.Wrap(e, "Listxattr") return s, errors.Wrap(e, "Listxattr")
@ -31,8 +31,8 @@ func Listxattr(path string) ([]string, error) {
// Setxattr associates name and data together as an attribute of path. // Setxattr associates name and data together as an attribute of path.
func Setxattr(path, name string, data []byte) error { func Setxattr(path, name string, data []byte) error {
e := xattr.Setxattr(path, name, data) e := xattr.Set(path, name, data)
if err, ok := e.(*xattr.XAttrError); ok && err.Err == syscall.ENOTSUP { if err, ok := e.(*xattr.Error); ok && err.Err == syscall.ENOTSUP {
return nil return nil
} }
return errors.Wrap(e, "Setxattr") return errors.Wrap(e, "Setxattr")