Class AbstractEmuUnixFileSystem<T>

java.lang.Object
ghidra.pcode.emu.unix.AbstractEmuUnixFileSystem<T>
Type Parameters:
T - the type of values stored in the file system
All Implemented Interfaces:
EmuUnixFileSystem<T>
Direct Known Subclasses:
BytesEmuUnixFileSystem

public abstract class AbstractEmuUnixFileSystem<T> extends Object implements EmuUnixFileSystem<T>
An abstract emulated file system, exported to an emulated user-space program
  • Field Details

  • Constructor Details

    • AbstractEmuUnixFileSystem

      public AbstractEmuUnixFileSystem()
  • Method Details

    • newFile

      public abstract AbstractEmuUnixFile<T> newFile(String pathname, int mode) throws EmuIOException
      Description copied from interface: EmuUnixFileSystem
      A factory for constructing a new file (without adding it to the file system)
      Specified by:
      newFile in interface EmuUnixFileSystem<T>
      Parameters:
      pathname - the path of the file
      mode - the mode of the new file
      Returns:
      the new file
      Throws:
      EmuIOException - if the file cannot be constructed
    • createOrGetFile

      public EmuUnixFile<T> createOrGetFile(String pathname, int mode) throws EmuIOException
      Description copied from interface: EmuUnixFileSystem
      Get the named file, creating it if it doesn't already exist

      This is accessed by the emulator user, not the target program.

      Specified by:
      createOrGetFile in interface EmuUnixFileSystem<T>
      Parameters:
      pathname - the pathname of the requested file
      mode - the mode of a created file. Ignored if the file exists
      Returns:
      the file
      Throws:
      EmuIOException - if an error occurred
    • getFile

      public EmuUnixFile<T> getFile(String pathname) throws EmuIOException
      Description copied from interface: EmuUnixFileSystem
      Get the named file

      This is accessed by the emulator user, not the target program.

      Specified by:
      getFile in interface EmuUnixFileSystem<T>
      Parameters:
      pathname - the pathname of the requested file
      Returns:
      the file, or null if it doesn't exist
      Throws:
      EmuIOException - if an error occurred
    • putFile

      public void putFile(String pathname, EmuUnixFile<T> file) throws EmuIOException
      Description copied from interface: EmuUnixFileSystem
      Place the given file at the given location

      This is accessed by the emulator user, not the target program. If the file already exists, it is replaced silently.

      Specified by:
      putFile in interface EmuUnixFileSystem<T>
      Parameters:
      pathname - the pathname of the file
      file - the file, presumably having the same pathname
      Throws:
      EmuIOException - if an error occurred
    • open

      public EmuUnixFile<T> open(String pathname, Set<EmuUnixFileSystem.OpenFlag> flags, EmuUnixUser user, int mode) throws EmuIOException
      Description copied from interface: EmuUnixFileSystem
      Open the requested file according to the given flags and user

      This is generally accessed by the target program via a DefaultEmuUnixFileHandle.

      Specified by:
      open in interface EmuUnixFileSystem<T>
      Parameters:
      pathname - the pathname of the requested file
      flags - the requested open flags
      user - the user making the request
      mode - the mode to assign the file, if created. Otherwise ignored
      Returns:
      the file
      Throws:
      EmuIOException - if an error occurred, e.g., file not found, or access denied
    • unlink

      public void unlink(String pathname, EmuUnixUser user) throws EmuIOException
      Description copied from interface: EmuUnixFileSystem
      Remove the file at the given location

      TODO: Separate the user-facing routine from the target-facing routine.

      If the file does not exist, this has no effect.

      Specified by:
      unlink in interface EmuUnixFileSystem<T>
      Parameters:
      pathname - the pathname of the file to unlink
      user - the user requesting the unlink
      Throws:
      EmuIOException - if an error occurred