mirror of
https://github.com/restic/restic.git
synced 2025-12-12 05:42:28 +00:00
data: split node and snapshot code from restic package
This commit is contained in:
@@ -7,9 +7,9 @@ import (
|
||||
"os"
|
||||
"syscall"
|
||||
|
||||
"github.com/restic/restic/internal/data"
|
||||
"github.com/restic/restic/internal/debug"
|
||||
"github.com/restic/restic/internal/errors"
|
||||
"github.com/restic/restic/internal/restic"
|
||||
|
||||
"github.com/pkg/xattr"
|
||||
)
|
||||
@@ -63,7 +63,7 @@ func handleXattrErr(err error) error {
|
||||
}
|
||||
}
|
||||
|
||||
func nodeRestoreExtendedAttributes(node *restic.Node, path string, xattrSelectFilter func(xattrName string) bool) error {
|
||||
func nodeRestoreExtendedAttributes(node *data.Node, path string, xattrSelectFilter func(xattrName string) bool) error {
|
||||
expectedAttrs := map[string]struct{}{}
|
||||
for _, attr := range node.ExtendedAttributes {
|
||||
// Only restore xattrs that match the filter
|
||||
@@ -96,7 +96,7 @@ func nodeRestoreExtendedAttributes(node *restic.Node, path string, xattrSelectFi
|
||||
return nil
|
||||
}
|
||||
|
||||
func nodeFillExtendedAttributes(node *restic.Node, path string, ignoreListError bool, warnf func(format string, args ...any)) error {
|
||||
func nodeFillExtendedAttributes(node *data.Node, path string, ignoreListError bool, warnf func(format string, args ...any)) error {
|
||||
xattrs, err := listxattr(path)
|
||||
debug.Log("fillExtendedAttributes(%v) %v %v", path, xattrs, err)
|
||||
if err != nil {
|
||||
@@ -106,14 +106,14 @@ func nodeFillExtendedAttributes(node *restic.Node, path string, ignoreListError
|
||||
return err
|
||||
}
|
||||
|
||||
node.ExtendedAttributes = make([]restic.ExtendedAttribute, 0, len(xattrs))
|
||||
node.ExtendedAttributes = make([]data.ExtendedAttribute, 0, len(xattrs))
|
||||
for _, attr := range xattrs {
|
||||
attrVal, err := getxattr(path, attr)
|
||||
if err != nil {
|
||||
warnf("can not obtain extended attribute %v for %v:\n", attr, path)
|
||||
continue
|
||||
}
|
||||
attr := restic.ExtendedAttribute{
|
||||
attr := data.ExtendedAttribute{
|
||||
Name: attr,
|
||||
Value: attrVal,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user