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