示例#1
0
        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
            });
        }
示例#2
0
        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));
            }
        }
示例#3
0
 public Directory(Context context, uint inodeNum, Inode inode)
     : base(context, inodeNum, inode)
 {
 }
示例#4
0
 public Symlink(Context context, uint inodeNum, Inode inode)
     : base(context, inodeNum, inode)
 {
 }
示例#5
0
 public FileBuffer(Context context, Inode inode)
 {
     _context = context;
     _inode   = inode;
 }
示例#6
0
文件: File.cs 项目: Arsslensoft/ALFX
 public File(Context context, uint inodeNum, Inode inode)
 {
     _context  = context;
     _inodeNum = inodeNum;
     _inode    = inode;
 }