Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #766 from jgfrm/nissue25
Add support for extended attributes (e.g. ACL) Closes #766
- Loading branch information
Showing
18 changed files
with
811 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// +build !openbsd | ||
// +build !windows | ||
// +build !freebsd | ||
|
||
package restic | ||
|
||
import ( | ||
"github.com/ivaxer/go-xattr" | ||
"syscall" | ||
) | ||
|
||
// Getxattr retrieves extended attribute data associated with path. | ||
func Getxattr(path, name string) ([]byte, error) { | ||
b, e := xattr.Get(path, name) | ||
if e == syscall.ENOTSUP { | ||
return nil, nil | ||
} | ||
return b, e | ||
} | ||
|
||
// Listxattr retrieves a list of names of extended attributes associated with the | ||
// given path in the file system. | ||
func Listxattr(path string) ([]string, error) { | ||
s, e := xattr.List(path) | ||
if e == syscall.ENOTSUP { | ||
return nil, nil | ||
} | ||
return s, e | ||
} | ||
|
||
// Setxattr associates name and data together as an attribute of path. | ||
func Setxattr(path, name string, data []byte) error { | ||
e := xattr.Set(path, name, data) | ||
if e == syscall.ENOTSUP { | ||
This comment has been minimized.
Sorry, something went wrong. |
||
return nil | ||
} | ||
return e | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
you may also encounter E2BIG (made on OS X, too big for linux).