// /*************************************************************************** // The Disc Image Chef // ---------------------------------------------------------------------------- // // Filename : IReadOnlyFilesystem.cs // Author(s) : Natalia Portillo // // Component : Filesystem plugins. // // --[ Description ] ---------------------------------------------------------- // // Interface for filesystem plugins that offer read-only support of their // contents. // // --[ License ] -------------------------------------------------------------- // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // // ---------------------------------------------------------------------------- // Copyright © 2011-2019 Natalia Portillo // ****************************************************************************/ using System; using System.Collections.Generic; using System.Text; using DiscImageChef.CommonTypes.Structs; namespace DiscImageChef.CommonTypes.Interfaces { /// /// Interface to implement filesystem plugins. /// public interface IReadOnlyFilesystem : IFilesystem { /// /// Retrieves a list of options supported by the filesystem, with name, type and description /// IEnumerable<(string name, Type type, string description)> SupportedOptions { get; } Dictionary Namespaces { get; } /// /// Initializates whatever internal structures the filesystem plugin needs to be able to read files and directories /// from the filesystem. /// /// /// /// Which encoding to use for this filesystem. /// Dictionary of key=value pairs containing options to pass to the filesystem /// Filename namespace Errno Mount(IMediaImage imagePlugin, Partition partition, Encoding encoding, Dictionary options, string @namespace); /// /// Frees all internal structures created by /// /// Errno Unmount(); /// /// Maps a filesystem block from a file to a block from the underlying device. /// /// Error number. /// File path. /// File block. /// Device block. Errno MapBlock(string path, long fileBlock, out long deviceBlock); /// /// Gets the attributes of a file or directory /// /// Error number. /// File path. /// File attributes. Errno GetAttributes(string path, out FileAttributes attributes); /// /// Lists all extended attributes, alternate data streams and forks of the given file. /// /// Error number. /// Path. /// List of extended attributes, alternate data streams and forks. Errno ListXAttr(string path, out List xattrs); /// /// Reads an extended attribute, alternate data stream or fork from the given file. /// /// Error number. /// File path. /// Extendad attribute, alternate data stream or fork name. /// Buffer. Errno GetXattr(string path, string xattr, ref byte[] buf); /// /// Reads data from a file (main/only data stream or data fork). /// /// File path. /// Offset. /// Bytes to read. /// Buffer. Errno Read(string path, long offset, long size, ref byte[] buf); /// /// Lists contents from a directory. /// /// Directory path. /// Directory contents. Errno ReadDir(string path, out List contents); /// /// Gets information about the mounted volume. /// /// Information about the mounted volume. Errno StatFs(out FileSystemInfo stat); /// /// Gets information about a file or directory. /// /// File path. /// File information. Errno Stat(string path, out FileEntryInfo stat); /// /// Solves a symbolic link. /// /// Link path. /// Link destination. Errno ReadLink(string path, out string dest); } }