Package ghidra.pcode.emu.unix
Interface EmuUnixFileSystem<T>
- Type Parameters:
T
- the type of values stored in the files
- All Known Implementing Classes:
AbstractEmuUnixFileSystem
,BytesEmuUnixFileSystem
public interface EmuUnixFileSystem<T>
A simulated UNIX file system
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic enum
Open flags as defined by the simulator -
Method Summary
Modifier and TypeMethodDescriptioncreateOrGetFile
(String pathname, int mode) Get the named file, creating it if it doesn't already existGet the named fileA factory for constructing a new file (without adding it to the file system)open
(String pathname, Set<EmuUnixFileSystem.OpenFlag> flags, EmuUnixUser user, int mode) Open the requested file according to the given flags and uservoid
putFile
(String pathname, EmuUnixFile<T> file) Place the given file at the given locationvoid
unlink
(String pathname, EmuUnixUser user) Remove the file at the given location
-
Method Details
-
newFile
A factory for constructing a new file (without adding it to the file system)- Parameters:
pathname
- the path of the filemode
- the mode of the new file- Returns:
- the new file
- Throws:
EmuIOException
- if the file cannot be constructed
-
createOrGetFile
Get the named file, creating it if it doesn't already existThis is accessed by the emulator user, not the target program.
- Parameters:
pathname
- the pathname of the requested filemode
- the mode of a created file. Ignored if the file exists- Returns:
- the file
- Throws:
EmuIOException
- if an error occurred
-
getFile
Get the named fileThis is accessed by the emulator user, not the target program.
- 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
Place the given file at the given locationThis is accessed by the emulator user, not the target program. If the file already exists, it is replaced silently.
- Parameters:
pathname
- the pathname of the filefile
- the file, presumably having the same pathname- Throws:
EmuIOException
- if an error occurred
-
unlink
Remove the file at the given locationTODO: Separate the user-facing routine from the target-facing routine.
If the file does not exist, this has no effect.
- Parameters:
pathname
- the pathname of the file to unlinkuser
- the user requesting the unlink- Throws:
EmuIOException
- if an error occurred
-
open
EmuUnixFile<T> open(String pathname, Set<EmuUnixFileSystem.OpenFlag> flags, EmuUnixUser user, int mode) throws EmuIOException Open the requested file according to the given flags and userThis is generally accessed by the target program via a
DefaultEmuUnixFileHandle
.- Parameters:
pathname
- the pathname of the requested fileflags
- the requested open flagsuser
- the user making the requestmode
- 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
-