예제 #1
0
            public Result getattr(string path, out stat stbuf)
            {
                Logger.WriteLine("getattr: '{0}'", path);
                stbuf = default(stat);

                try
                {
                    var Entry = Tree.GetFileInFolder(new EntryPath(path));
                    stbuf.st_ctime = new time_t()
                    {
                        tv_sec = (uint)Entry.ctime
                    };
                    stbuf.st_mtime = new time_t()
                    {
                        tv_sec = (uint)Entry.ctime
                    };

                    switch (Entry.type)
                    {
                    case FileEntryType.Folder:
                        stbuf.st_mode  = (uint)Mode.S_IFDIR | 0755;
                        stbuf.st_nlink = (IntPtr)2;
                        break;

                    case FileEntryType.File:
                        stbuf.st_mode  = (uint)Mode.S_IFREG | 0444;
                        stbuf.st_nlink = (IntPtr)1;
                        stbuf.st_size  = 100;
                        break;
                    }

                    return(Result.OK);
                }
                catch (Exception)
                {
                    return(Result.ENOENT);
                }
            }