mountinfo.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. package mount
  2. // Info reveals information about a particular mounted filesystem. This
  3. // struct is populated from the content in the /proc/<pid>/mountinfo file.
  4. type Info struct {
  5. // ID is a unique identifier of the mount (may be reused after umount).
  6. ID int
  7. // Parent indicates the ID of the mount parent (or of self for the top of the
  8. // mount tree).
  9. Parent int
  10. // Major indicates one half of the device ID which identifies the device class.
  11. Major int
  12. // Minor indicates one half of the device ID which identifies a specific
  13. // instance of device.
  14. Minor int
  15. // Root of the mount within the filesystem.
  16. Root string
  17. // Mountpoint indicates the mount point relative to the process's root.
  18. Mountpoint string
  19. // Opts represents mount-specific options.
  20. Opts string
  21. // Optional represents optional fields.
  22. Optional string
  23. // Fstype indicates the type of filesystem, such as EXT3.
  24. Fstype string
  25. // Source indicates filesystem specific information or "none".
  26. Source string
  27. // VfsOpts represents per super block options.
  28. VfsOpts string
  29. }
  30. type byMountpoint []*Info
  31. func (by byMountpoint) Len() int {
  32. return len(by)
  33. }
  34. func (by byMountpoint) Less(i, j int) bool {
  35. return by[i].Mountpoint < by[j].Mountpoint
  36. }
  37. func (by byMountpoint) Swap(i, j int) {
  38. by[i], by[j] = by[j], by[i]
  39. }