xattr_unsupported.go 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // +build !linux,!darwin
  2. /*
  3. Copyright The containerd Authors.
  4. Licensed under the Apache License, Version 2.0 (the "License");
  5. you may not use this file except in compliance with the License.
  6. You may obtain a copy of the License at
  7. http://www.apache.org/licenses/LICENSE-2.0
  8. Unless required by applicable law or agreed to in writing, software
  9. distributed under the License is distributed on an "AS IS" BASIS,
  10. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. See the License for the specific language governing permissions and
  12. limitations under the License.
  13. */
  14. package sysx
  15. import (
  16. "errors"
  17. "runtime"
  18. )
  19. var unsupported = errors.New("extended attributes unsupported on " + runtime.GOOS)
  20. // Listxattr calls syscall listxattr and reads all content
  21. // and returns a string array
  22. func Listxattr(path string) ([]string, error) {
  23. return []string{}, nil
  24. }
  25. // Removexattr calls syscall removexattr
  26. func Removexattr(path string, attr string) (err error) {
  27. return unsupported
  28. }
  29. // Setxattr calls syscall setxattr
  30. func Setxattr(path string, attr string, data []byte, flags int) (err error) {
  31. return unsupported
  32. }
  33. // Getxattr calls syscall getxattr
  34. func Getxattr(path, attr string) ([]byte, error) {
  35. return []byte{}, unsupported
  36. }
  37. // LListxattr lists xattrs, not following symlinks
  38. func LListxattr(path string) ([]string, error) {
  39. return []string{}, nil
  40. }
  41. // LRemovexattr removes an xattr, not following symlinks
  42. func LRemovexattr(path string, attr string) (err error) {
  43. return unsupported
  44. }
  45. // LSetxattr sets an xattr, not following symlinks
  46. func LSetxattr(path string, attr string, data []byte, flags int) (err error) {
  47. return unsupported
  48. }
  49. // LGetxattr gets an xattr, not following symlinks
  50. func LGetxattr(path, attr string) ([]byte, error) {
  51. return []byte{}, nil
  52. }