Retrieves the root file entry.

    Returns:
      TSKPartitionFileEntry: a file entry or None of not available.
422162
def GetRootFileEntry(self):
    
    path_spec = tsk_partition_path_spec.TSKPartitionPathSpec(
        location=self.LOCATION_ROOT, parent=self._path_spec.parent)
    return self.GetFileEntryByPathSpec(path_spec)
698042
def GetRootFileEntry(self):
    
    path_spec = gzip_path_spec.GzipPathSpec(parent=self._path_spec.parent)
    return self.GetFileEntryByPathSpec(path_spec)
621952
def GetParentFileEntry(self):
    
    volume_index = lvm.LVMPathSpecGetVolumeIndex(self.path_spec)
    if volume_index is None:
      return None

    return self._file_system.GetRootFileEntry()
369177
protected OMVRBTreeEntry<K, V> getFirstEntry() {
    OMVRBTreeEntry<K, V> p = root;
    if (p != null) {
      if (p.getSize() > 0)
        pageIndex = 0;

      while (p.getLeft() != null)
        p = p.getLeft();
    }
    return p;
  }
207182
def GetFileEntryByPathSpec(self, path_spec):
    
    volume_index = apfs_helper.APFSContainerPathSpecGetVolumeIndex(path_spec)

    # The virtual root file has not corresponding volume index but
    # should have a location.
    if volume_index is None:
      location = getattr(path_spec, 'location', None)
      if location is None or location != self.LOCATION_ROOT:
        return None

      return apfs_container_file_entry.APFSContainerFileEntry(
          self._resolver_context, self, path_spec, is_root=True,
          is_virtual=True)

    if (volume_index < 0 or
        volume_index >= self._fsapfs_container.number_of_volumes):
      return None

    return apfs_container_file_entry.APFSContainerFileEntry(
        self._resolver_context, self, path_spec)
222208
def get_tree_from_initramfs(root=None):
    
    from insights import run
    return run(MultipathConfTreeInitramfs, root=root).get(MultipathConfTreeInitramfs)
1331280
def _GetPlistRootKey(self, file_entry):
    
    file_object = file_entry.GetFileObject()

    try:
      plist_file = plist.PlistFile()
      plist_file.Read(file_object)

    except IOError as exception:
      location = getattr(file_entry.path_spec, 'location', '')
      raise errors.PreProcessFail(
          'Unable to read plist file: {0:s} with error: {1!s}'.format(
              location, exception))

    finally:
      file_object.close()

    return plist_file.root_key
371186
def _GetStat(self):
    
    stat_object = super(APFSFileEntry, self)._GetStat()

    # File data stat information.
    stat_object.size = self._fsapfs_file_entry.size

    # Ownership and permissions stat information.
    stat_object.mode = self._fsapfs_file_entry.file_mode & 0x0fff
    stat_object.uid = self._fsapfs_file_entry.owner_identifier
    stat_object.gid = self._fsapfs_file_entry.group_identifier

    # File entry type stat information.
    stat_object.type = self.entry_type

    # Other stat information.
    stat_object.ino = self._fsapfs_file_entry.identifier
    stat_object.fs_type = 'APFS'

    stat_object.is_allocated = True

    return stat_object
1144560
def _GetSubFileEntries(self):
    
    if self._directory is None:
      self._directory = self._GetDirectory()

    if self._directory:
      for path_spec in self._directory.entries:
        yield TSKFileEntry(self._resolver_context, self._file_system, path_spec)
503914
def GetFileEntryByPathSpec(self, path_spec):
    
    return gzip_file_entry.GzipFileEntry(
        self._resolver_context, self, path_spec, is_root=True, is_virtual=True)
371179
def GetRootFileEntry(self):
    
    path_spec = vshadow_path_spec.VShadowPathSpec(
        location=self.LOCATION_ROOT, parent=self._path_spec.parent)
    return self.GetFileEntryByPathSpec(path_spec)
198131
def _GetStat(self):
    
    stat_object = super(TSKFileEntry, self)._GetStat()

    # File data stat information.
    stat_object.size = getattr(self._tsk_file.info.meta, 'size', None)

    # Date and time stat information.
    stat_time, stat_time_nano = self._TSKFileTimeCopyToStatTimeTuple(
        self._tsk_file, 'bkup')
    if stat_time is not None:
      stat_object.bkup = stat_time
      stat_object.bkup_nano = stat_time_nano

    stat_time, stat_time_nano = self._TSKFileTimeCopyToStatTimeTuple(
        self._tsk_file, 'dtime')
    if stat_time is not None:
      stat_object.dtime = stat_time
      stat_object.dtime_nano = stat_time_nano

    # Ownership and permissions stat information.
    mode = getattr(self._tsk_file.info.meta, 'mode', None)
    if mode is not None:
      # We need to cast mode to an int since it is of type
      # pytsk3.TSK_FS_META_MODE_ENUM.
      stat_object.mode = int(mode)

    stat_object.uid = getattr(self._tsk_file.info.meta, 'uid', None)
    stat_object.gid = getattr(self._tsk_file.info.meta, 'gid', None)

    # File entry type stat information.

    # Other stat information.
    stat_object.ino = getattr(self._tsk_file.info.meta, 'addr', None)
    # stat_object.dev = stat_info.st_dev
    # stat_object.nlink = getattr(self._tsk_file.info.meta, 'nlink', None)
    # stat_object.fs_type = 'Unknown'

    flags = getattr(self._tsk_file.info.meta, 'flags', 0)

    # The flags are an instance of pytsk3.TSK_FS_META_FLAG_ENUM.
    stat_object.is_allocated = bool(int(flags) & pytsk3.TSK_FS_META_FLAG_ALLOC)

    return stat_object
245510
def GetFileEntryByPathSpec(self, path_spec):
    
    volume_index = lvm.LVMPathSpecGetVolumeIndex(path_spec)

    # The virtual root file has not corresponding volume index but
    # should have a location.
    if volume_index is None:
      location = getattr(path_spec, 'location', None)
      if location is None or location != self.LOCATION_ROOT:
        return None

      return lvm_file_entry.LVMFileEntry(
          self._resolver_context, self, path_spec, is_root=True,
          is_virtual=True)

    if (volume_index < 0 or
        volume_index >= self._vslvm_volume_group.number_of_logical_volumes):
      return None

    return lvm_file_entry.LVMFileEntry(self._resolver_context, self, path_spec)
589016
def GetFileEntryByPathSpec(self, path_spec):
    
    # Opening a file by MFT entry is faster than opening a file by location.
    # However we need the index of the corresponding $FILE_NAME MFT attribute.
    fsntfs_file_entry = None
    location = getattr(path_spec, 'location', None)
    mft_attribute = getattr(path_spec, 'mft_attribute', None)
    mft_entry = getattr(path_spec, 'mft_entry', None)

    if (location == self.LOCATION_ROOT or
        mft_entry == self.MFT_ENTRY_ROOT_DIRECTORY):
      fsntfs_file_entry = self._fsntfs_volume.get_root_directory()
      return ntfs_file_entry.NTFSFileEntry(
          self._resolver_context, self, path_spec,
          fsntfs_file_entry=fsntfs_file_entry, is_root=True)

    try:
      if mft_attribute is not None and mft_entry is not None:
        fsntfs_file_entry = self._fsntfs_volume.get_file_entry(mft_entry)
      elif location is not None:
        fsntfs_file_entry = self._fsntfs_volume.get_file_entry_by_path(location)

    except IOError as exception:
      raise errors.BackEndError(exception)

    if fsntfs_file_entry is None:
      return None

    return ntfs_file_entry.NTFSFileEntry(
        self._resolver_context, self, path_spec,
        fsntfs_file_entry=fsntfs_file_entry)
1888
def GetFileEntryByPathSpec(self, path_spec):
    
    return bde_file_entry.BDEFileEntry(
        self._resolver_context, self, path_spec, is_root=True, is_virtual=True)
872868
protected OMVRBTreeEntry<K, V> getLastEntry() {
    OMVRBTreeEntry<K, V> p = root;
    if (p != null)
      while (p.getRight() != null)
        p = p.getRight();

    if (p != null)
      pageIndex = p.getSize() - 1;

    return p;
  }
712644
def GetRootFileEntry(self):
    
    if platform.system() == 'Windows':
      # Return the root with the drive letter of the volume the current
      # working directory is on.
      location = os.getcwd()
      location, _, _ = location.partition('\\')
      location = '{0:s}\\'.format(location)
    else:
      location = '/'

    if not os.path.exists(location):
      return None

    path_spec = os_path_spec.OSPathSpec(location=location)
    return self.GetFileEntryByPathSpec(path_spec)