private IMount ParseLine(string line) { var split = line.Split(' ').Select(ExpandEscapes).ToArray(); if (split.Length != 6) { _logger.Debug("Unable to parse {0} line: {1}", PROC_MOUNTS_FILENAME, line); } var name = split[0]; var mount = split[1]; var type = split[2]; var options = ParseOptions(split[3]); var driveType = FindDriveType.Find(type); if (name.StartsWith("/dev/") || GetFileSystems().GetValueOrDefault(type, false)) { // Not always fixed, but lets assume it. driveType = DriveType.Fixed; } if (_networkDriveTypes.Contains(type)) { driveType = DriveType.Network; } return(new ProcMount(driveType, name, mount, type, options)); }
public override List <IMount> GetMounts() { return(GetDriveInfoMounts().Select(d => new DriveInfoMount(d, FindDriveType.Find(d.DriveFormat))) .Where(d => d.DriveType == DriveType.Fixed || d.DriveType == DriveType.Network || d.DriveType == DriveType.Removable) .Concat(_procMountProvider.GetMounts()) .DistinctBy(v => v.RootDirectory) .ToList()); }
private IMount ParseLine(string line) { var split = line.Split(' ').Select(ExpandEscapes).ToArray(); if (split.Length != 6) { _logger.Debug("Unable to parse {0} line: {1}", PROC_MOUNTS_FILENAME, line); return(null); } var name = split[0]; var mount = split[1]; var type = split[2]; var options = ParseOptions(split[3]); if (!mount.StartsWith("/")) { // Possible a namespace like 'net:[1234]'. // But we just filter anything not starting with /, we're not interested in anything that isn't mounted somewhere. return(null); } if (mount.StartsWith("/var/lib/")) { // Could be /var/lib/docker when docker uses zfs. Very unlikely that a useful mount is located in /var/lib. return(null); } if (mount.StartsWith("/snap/")) { // Mount point for snap packages return(null); } var driveType = FindDriveType.Find(type); if (name.StartsWith("/dev/") || GetFileSystems().GetValueOrDefault(type, false)) { // Not always fixed, but lets assume it. driveType = DriveType.Fixed; } if (_networkDriveTypes.Contains(type)) { driveType = DriveType.Network; } return(new ProcMount(driveType, name, mount, type, new MountOptions(options))); }
public override List <IMount> GetMounts() { var mounts = GetDriveInfoMounts().Select(d => new DriveInfoMount(d, FindDriveType.Find(d.DriveFormat))) .Where(d => d.DriveType == DriveType.Fixed || d.DriveType == DriveType.Network || d.DriveType == DriveType.Removable); var procMounts = _procMountProvider.GetMounts(); if (procMounts != null) { return(mounts.Concat(procMounts).DistinctBy(v => v.RootDirectory) .ToList()); } return(mounts.Cast <IMount>().DistinctBy(v => v.RootDirectory) .ToList()); }