public UnixFileSystemInfo GetUnixFileInfo(string path) { File file = GetFile(path); Inode inode = file.Inode; UnixFileType fileType = (UnixFileType)((inode.Mode >> 12) & 0xff); uint deviceId = 0; if (fileType == UnixFileType.Character || fileType == UnixFileType.Block) { if (inode.DirectBlocks[0] != 0) { deviceId = inode.DirectBlocks[0]; } else { deviceId = inode.DirectBlocks[1]; } } return(new UnixFileSystemInfo() { FileType = fileType, Permissions = (UnixFilePermissions)(inode.Mode & 0xfff), UserId = (((int)inode.UserIdHigh) << 16) | inode.UserIdLow, GroupId = (((int)inode.GroupIdHigh) << 16) | inode.GroupIdLow, Inode = file.InodeNumber, LinkCount = inode.LinksCount, DeviceId = deviceId }); }
protected override File ConvertDirEntryToFile(DirEntry dirEntry) { Inode inode = GetInode(dirEntry.Record.Inode); if (dirEntry.Record.FileType == DirectoryRecord.FileTypeDirectory) { return(new Directory(Context, dirEntry.Record.Inode, inode)); } else if (dirEntry.Record.FileType == DirectoryRecord.FileTypeSymlink) { return(new Symlink(Context, dirEntry.Record.Inode, inode)); } else { return(new File(Context, dirEntry.Record.Inode, inode)); } }
public Directory(Context context, uint inodeNum, Inode inode) : base(context, inodeNum, inode) { }
public Symlink(Context context, uint inodeNum, Inode inode) : base(context, inodeNum, inode) { }
public FileBuffer(Context context, Inode inode) { _context = context; _inode = inode; }
public File(Context context, uint inodeNum, Inode inode) { _context = context; _inodeNum = inodeNum; _inode = inode; }