-
Notifications
You must be signed in to change notification settings - Fork 2
/
vfs-unix.cs
86 lines (67 loc) · 1.96 KB
/
vfs-unix.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
using System;
using System.Collections.Generic;
using System.IO;
using Mono.Unix;
using Mono.Unix.Native;
namespace Mono.Vfs {
public class UnixFileEntry : VirtualFileEntry {
public UnixFileEntry (MountPoint mount, string parent, string name) : base (mount, parent, name)
{
}
}
public class UnixDirectoryEntry : VirtualDirectoryEntry {
public UnixDirectoryEntry (MountPoint mount, string parent, string name) : base (mount, parent, name)
{
}
protected override VfsError DoRename (string oldName, string newName)
{
throw new NotImplementedException ();
}
protected override VfsError DoDelete (string name)
{
throw new NotImplementedException ();
}
protected override VfsError DoPut (VirtualFileEntry source)
{
throw new NotImplementedException ();
}
protected override VfsError DoCopy (string source, string target)
{
throw new NotImplementedException ();
}
protected override VfsError DoMakeDirectory (string name)
{
throw new NotImplementedException ();
}
protected override VfsError DoRemoveDirectory (string name)
{
throw new NotImplementedException ();
}
protected override VfsError DoGetEntries (out VirtualEntry [] entries)
{
throw new NotImplementedException ();
}
}
public class UnixMountPoint : MountPoint {
static UnixMountPoint globalMountPoint = new UnixMountPoint ();
public UnixMountPoint ()
{
}
public static VirtualEntry UnixHandler (string path, string rest)
{
Stat stat;
int r;
do {
r = Syscall.lstat (path, out stat);
} while (r == -1 && Stdlib.GetLastError() == Errno.EINTR);
if (r == -1)
return null;
string parent = UnixPath.GetDirectoryName (path);
string name = UnixPath.GetFileName (path);
if ((stat.st_mode & FilePermissions.S_IFMT) == FilePermissions.S_IFDIR)
return new UnixDirectoryEntry (globalMountPoint, parent, name);
else
return new UnixFileEntry (globalMountPoint, parent, name);
}
}
}