/// <summary> /// Called to delete a child from a directory. /// </summary> /// <param name="child">The IVfsNode interface of the child.</param> /// <param name="dentry">The DirectoryEntry of the child.</param> /// <remarks> /// This function deletes a child IVfsNode from a directory. If child is a directory, it will be empty /// before this call is executed. It is recommended to include a debug sanity check though. If the file /// system needs to know the name of the child to delete, it can retrieve it from <see cref="DirectoryEntry.Name"/>. /// </remarks> /// <exception cref="System.NotSupportedException">The object does not support removal this way. There's most likely an object specific API to remove this IVfsNode.</exception> public override void Delete(IVfsNode child, DirectoryEntry dentry) { var fs = FileSystem as FatFileSystem; uint targetCluster = (child as VfsDirectory).directoryCluster; var location = fs.FindEntry(new Find.ByCluster(targetCluster), directoryCluster); if (!location.IsValid) throw new System.ArgumentException(); //throw new IOException ("Unable to delete directory because it is not empty"); fs.Delete(targetCluster, location.DirectorySector, location.DirectorySectorIndex); }
/// <summary> /// Called to delete a child from a directory. /// </summary> /// <param name="child">The IVfsNode interface of the child.</param> /// <param name="dentry">The DirectoryEntry of the child.</param> /// <remarks> /// This function deletes a child IVfsNode from a directory. If child is a directory, it will be empty /// before this call is executed. It is recommended to include a debug sanity check though. If the file /// system needs to know the name of the child to delete, it can retrieve it from <see cref="DirectoryEntry.Name"/>. /// </remarks> /// <exception cref="System.NotSupportedException">The object does not support removal this way. There's most likely an object specific API to remove this IVfsNode.</exception> public override void Delete(IVfsNode child, DirectoryEntry dentry) { // FIXME: throw new NotImplementedException(); }
/// <summary> /// Deletes the specified child. /// </summary> /// <param name="child">The child.</param> /// <param name="entry">The entry.</param> public abstract void Delete(IVfsNode child, DirectoryEntry entry);
/// <summary> /// Called to delete a child from a directory. /// </summary> /// <param name="child">The IVfsNode interface of the child.</param> /// <param name="dentry">The DirectoryEntry of the child.</param> /// <remarks> /// This function deletes a child IVfsNode from a directory. If child is a directory, it will be empty /// before this call is executed. It is recommended to include a debug sanity check though. If the file /// system needs to know the name of the child to delete, it can retrieve it from <see cref="DirectoryEntry.Name"/>. /// </remarks> /// <exception cref="System.NotSupportedException">The object does not support removal this way. There's most likely an object specific API to remove this IVfsNode.</exception> public override void Delete(IVfsNode child, DirectoryEntry dentry) { throw new System.ArgumentException(); // Delete() method doesn't make sense here }
/// <summary> /// Initializes a new instance of the virtual file system. /// </summary> public static void Setup() { rootDirectory = new DirectoryNode(null); rootNode = DirectoryEntry.AllocateRoot(rootDirectory); // FIXME: Add an entry of the virtual file system to /system/filesystems }