Revision 1b045f5d lib/utils.py

b/lib/utils.py
3156 3156
  return BytesToMebibyte(size)
3157 3157

  
3158 3158

  
3159
def GetMounts(filename=constants.PROC_MOUNTS):
3160
  """Returns the list of mounted filesystems.
3161

  
3162
  This function is Linux-specific.
3163

  
3164
  @param filename: path of mounts file (/proc/mounts by default)
3165
  @rtype: list of tuples
3166
  @return: list of mount entries (device, mountpoint, fstype, options)
3167

  
3168
  """
3169
  # TODO(iustin): investigate non-Linux options (e.g. via mount output)
3170
  data = []
3171
  mountlines = ReadFile(filename).splitlines()
3172
  for line in mountlines:
3173
    device, mountpoint, fstype, options, _ = line.split(None, 4)
3174
    data.append((device, mountpoint, fstype, options))
3175

  
3176
  return data
3177

  
3178

  
3159 3179
def GetFilesystemStats(path):
3160 3180
  """Returns the total and free space on a filesystem.
3161 3181

  

Also available in: Unified diff