udev_helper.go 863 B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * @Author: LinkLeong link@icewhale.org
  3. * @Date: 2022-08-10 16:06:12
  4. * @LastEditors: LinkLeong
  5. * @LastEditTime: 2022-08-10 16:11:37
  6. * @FilePath: /CasaOS/pkg/utils/udev_helper.go
  7. * @Description:
  8. * @Website: https://www.casaos.io
  9. * Copyright (c) 2022 by icewhale, All Rights Reserved.
  10. */
  11. package utils
  12. // func getOptionnalMatcher() (matcher netlink.Matcher, err error) {
  13. // if filePath == nil || *filePath == "" {
  14. // return nil, nil
  15. // }
  16. // stream, err := ioutil.ReadFile(*filePath)
  17. // if err != nil {
  18. // return nil, err
  19. // }
  20. // if stream == nil {
  21. // return nil, fmt.Errorf("Empty, no rules provided in \"%s\", err: %w", *filePath, err)
  22. // }
  23. // var rules netlink.RuleDefinitions
  24. // if err := json.Unmarshal(stream, &rules); err != nil {
  25. // return nil, fmt.Errorf("Wrong rule syntax, err: %w", err)
  26. // }
  27. // return &rules, nil
  28. // }