-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sysx: use xattr functions from x/sys/unix
Use the xattr functions from package golang.org/x/sys/unix instead of syscall. Also use its L*xattr functions instead of locally duplicating them. Signed-off-by: Tobias Klauser <[email protected]>
- Loading branch information
Showing
8 changed files
with
9 additions
and
803 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,44 @@ | ||
package sysx | ||
|
||
import "syscall" | ||
|
||
// These functions will be generated by generate.sh | ||
// $ GOOS=linux GOARCH=386 ./generate.sh xattr | ||
// $ GOOS=linux GOARCH=amd64 ./generate.sh xattr | ||
// $ GOOS=linux GOARCH=arm ./generate.sh xattr | ||
// $ GOOS=linux GOARCH=arm64 ./generate.sh xattr | ||
// $ GOOS=linux GOARCH=ppc64 ./generate.sh xattr | ||
// $ GOOS=linux GOARCH=ppc64le ./generate.sh xattr | ||
// $ GOOS=linux GOARCH=s390x ./generate.sh xattr | ||
import "golang.org/x/sys/unix" | ||
|
||
// Listxattr calls syscall listxattr and reads all content | ||
// and returns a string array | ||
func Listxattr(path string) ([]string, error) { | ||
return listxattrAll(path, syscall.Listxattr) | ||
return listxattrAll(path, unix.Listxattr) | ||
} | ||
|
||
// Removexattr calls syscall removexattr | ||
func Removexattr(path string, attr string) (err error) { | ||
return syscall.Removexattr(path, attr) | ||
return unix.Removexattr(path, attr) | ||
} | ||
|
||
// Setxattr calls syscall setxattr | ||
func Setxattr(path string, attr string, data []byte, flags int) (err error) { | ||
return syscall.Setxattr(path, attr, data, flags) | ||
return unix.Setxattr(path, attr, data, flags) | ||
} | ||
|
||
// Getxattr calls syscall getxattr | ||
func Getxattr(path, attr string) ([]byte, error) { | ||
return getxattrAll(path, attr, syscall.Getxattr) | ||
return getxattrAll(path, attr, unix.Getxattr) | ||
} | ||
|
||
//sys llistxattr(path string, dest []byte) (sz int, err error) | ||
|
||
// LListxattr lists xattrs, not following symlinks | ||
func LListxattr(path string) ([]string, error) { | ||
return listxattrAll(path, llistxattr) | ||
return listxattrAll(path, unix.Llistxattr) | ||
} | ||
|
||
//sys lremovexattr(path string, attr string) (err error) | ||
|
||
// LRemovexattr removes an xattr, not following symlinks | ||
func LRemovexattr(path string, attr string) (err error) { | ||
return lremovexattr(path, attr) | ||
return unix.Lremovexattr(path, attr) | ||
} | ||
|
||
//sys lsetxattr(path string, attr string, data []byte, flags int) (err error) | ||
|
||
// LSetxattr sets an xattr, not following symlinks | ||
func LSetxattr(path string, attr string, data []byte, flags int) (err error) { | ||
return lsetxattr(path, attr, data, flags) | ||
return unix.Lsetxattr(path, attr, data, flags) | ||
} | ||
|
||
//sys lgetxattr(path string, attr string, dest []byte) (sz int, err error) | ||
|
||
// LGetxattr gets an xattr, not following symlinks | ||
func LGetxattr(path, attr string) ([]byte, error) { | ||
return getxattrAll(path, attr, lgetxattr) | ||
return getxattrAll(path, attr, unix.Lgetxattr) | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.