@k13engineering/linux-fuse 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/abi.d.ts +331 -0
- package/dist/lib/abi.js +1019 -0
- package/dist/lib/constants.d.ts +225 -0
- package/dist/lib/constants.js +272 -0
- package/dist/lib/convenience.d.ts +63 -0
- package/dist/lib/convenience.js +463 -0
- package/dist/lib/fuse-lowlevel.d.ts +42 -0
- package/dist/lib/fuse-lowlevel.js +133 -0
- package/dist/lib/index.d.ts +40 -0
- package/dist/lib/index.js +313 -0
- package/dist/lib/linux.d.ts +12 -0
- package/dist/lib/linux.js +32 -0
- package/dist/lib/message.d.ts +50 -0
- package/dist/lib/message.js +177 -0
- package/dist/lib/mount.d.ts +33 -0
- package/dist/lib/mount.js +149 -0
- package/dist/lib/protocol.d.ts +756 -0
- package/dist/lib/protocol.js +3783 -0
- package/dist/lib/server.d.ts +18 -0
- package/dist/lib/server.js +73 -0
- package/dist/lib/syscalls.d.ts +73 -0
- package/dist/lib/syscalls.js +275 -0
- package/package.json +1 -1
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
declare const textEncoder: any;
|
|
2
|
+
declare const FUSE_ROOT_ID = 1n;
|
|
3
|
+
declare const FUSE_MIN_READ_BUFFER = 8192;
|
|
4
|
+
declare const FUSE_GETATTR_FH = 1n;
|
|
5
|
+
declare const FUSE_BIG_WRITES: number;
|
|
6
|
+
declare const FUSE_INIT_FLAGS: number;
|
|
7
|
+
declare const MS_NOSUID = 2n;
|
|
8
|
+
declare const MS_NODEV = 4n;
|
|
9
|
+
declare const MNT_DETACH = 2n;
|
|
10
|
+
declare const FATTR_MODE: number;
|
|
11
|
+
declare const FATTR_UID: number;
|
|
12
|
+
declare const FATTR_GID: number;
|
|
13
|
+
declare const FATTR_SIZE: number;
|
|
14
|
+
declare const FATTR_ATIME: number;
|
|
15
|
+
declare const FATTR_MTIME: number;
|
|
16
|
+
declare const FATTR_FH: number;
|
|
17
|
+
declare const FATTR_ATIME_NOW: number;
|
|
18
|
+
declare const FATTR_MTIME_NOW: number;
|
|
19
|
+
declare const S_IFMT = 61440;
|
|
20
|
+
declare const S_IFIFO = 4096;
|
|
21
|
+
declare const S_IFCHR = 8192;
|
|
22
|
+
declare const S_IFDIR = 16384;
|
|
23
|
+
declare const S_IFBLK = 24576;
|
|
24
|
+
declare const S_IFREG = 32768;
|
|
25
|
+
declare const S_IFLNK = 40960;
|
|
26
|
+
declare const S_IFSOCK = 49152;
|
|
27
|
+
declare const DT_UNKNOWN = 0;
|
|
28
|
+
declare const DT_FIFO = 1;
|
|
29
|
+
declare const DT_CHR = 2;
|
|
30
|
+
declare const DT_DIR = 4;
|
|
31
|
+
declare const DT_BLK = 6;
|
|
32
|
+
declare const DT_REG = 8;
|
|
33
|
+
declare const DT_LNK = 10;
|
|
34
|
+
declare const DT_SOCK = 12;
|
|
35
|
+
declare const FOPEN_DIRECT_IO: bigint;
|
|
36
|
+
declare const FOPEN_KEEP_CACHE: bigint;
|
|
37
|
+
declare const FOPEN_NONSEEKABLE: bigint;
|
|
38
|
+
declare const EIO: any, EINVAL: any, ENOSYS: any, ENOENT: any, EPROTO: any, ESTALE: any, ENOTDIR: any;
|
|
39
|
+
declare const opcode: {
|
|
40
|
+
readonly LOOKUP: 1;
|
|
41
|
+
readonly FORGET: 2;
|
|
42
|
+
readonly GETATTR: 3;
|
|
43
|
+
readonly SETATTR: 4;
|
|
44
|
+
readonly READLINK: 5;
|
|
45
|
+
readonly SYMLINK: 6;
|
|
46
|
+
readonly MKNOD: 8;
|
|
47
|
+
readonly MKDIR: 9;
|
|
48
|
+
readonly UNLINK: 10;
|
|
49
|
+
readonly RMDIR: 11;
|
|
50
|
+
readonly RENAME: 12;
|
|
51
|
+
readonly LINK: 13;
|
|
52
|
+
readonly OPEN: 14;
|
|
53
|
+
readonly READ: 15;
|
|
54
|
+
readonly WRITE: 16;
|
|
55
|
+
readonly STATFS: 17;
|
|
56
|
+
readonly RELEASE: 18;
|
|
57
|
+
readonly FSYNC: 20;
|
|
58
|
+
readonly SETXATTR: 21;
|
|
59
|
+
readonly GETXATTR: 22;
|
|
60
|
+
readonly LISTXATTR: 23;
|
|
61
|
+
readonly REMOVEXATTR: 24;
|
|
62
|
+
readonly FLUSH: 25;
|
|
63
|
+
readonly INIT: 26;
|
|
64
|
+
readonly OPENDIR: 27;
|
|
65
|
+
readonly READDIR: 28;
|
|
66
|
+
readonly RELEASEDIR: 29;
|
|
67
|
+
readonly FSYNCDIR: 30;
|
|
68
|
+
readonly GETLK: 31;
|
|
69
|
+
readonly SETLK: 32;
|
|
70
|
+
readonly SETLKW: 33;
|
|
71
|
+
readonly ACCESS: 34;
|
|
72
|
+
readonly CREATE: 35;
|
|
73
|
+
readonly INTERRUPT: 36;
|
|
74
|
+
readonly BMAP: 37;
|
|
75
|
+
readonly DESTROY: 38;
|
|
76
|
+
readonly IOCTL: 39;
|
|
77
|
+
readonly POLL: 40;
|
|
78
|
+
readonly NOTIFY_REPLY: 41;
|
|
79
|
+
readonly BATCH_FORGET: 42;
|
|
80
|
+
readonly FALLOCATE: 43;
|
|
81
|
+
readonly READDIRPLUS: 44;
|
|
82
|
+
readonly RENAME2: 45;
|
|
83
|
+
};
|
|
84
|
+
declare const openCloseOnExecFlag: any;
|
|
85
|
+
declare const abi: {
|
|
86
|
+
readonly endianness: "little";
|
|
87
|
+
readonly dataModel: "LP64";
|
|
88
|
+
readonly compiler: "gcc";
|
|
89
|
+
};
|
|
90
|
+
declare const uint16Array: (length: number) => {
|
|
91
|
+
readonly type: "array";
|
|
92
|
+
readonly elementType: any;
|
|
93
|
+
readonly length: number;
|
|
94
|
+
};
|
|
95
|
+
declare const uint32Array: (length: number) => {
|
|
96
|
+
readonly type: "array";
|
|
97
|
+
readonly elementType: any;
|
|
98
|
+
readonly length: number;
|
|
99
|
+
};
|
|
100
|
+
declare const fuseAttrDefinition: {
|
|
101
|
+
readonly type: "struct";
|
|
102
|
+
readonly packed: false;
|
|
103
|
+
readonly fixedAbi: {};
|
|
104
|
+
readonly fields: readonly [{
|
|
105
|
+
readonly name: "ino";
|
|
106
|
+
readonly definition: any;
|
|
107
|
+
}, {
|
|
108
|
+
readonly name: "size";
|
|
109
|
+
readonly definition: any;
|
|
110
|
+
}, {
|
|
111
|
+
readonly name: "blocks";
|
|
112
|
+
readonly definition: any;
|
|
113
|
+
}, {
|
|
114
|
+
readonly name: "atime";
|
|
115
|
+
readonly definition: any;
|
|
116
|
+
}, {
|
|
117
|
+
readonly name: "mtime";
|
|
118
|
+
readonly definition: any;
|
|
119
|
+
}, {
|
|
120
|
+
readonly name: "ctime";
|
|
121
|
+
readonly definition: any;
|
|
122
|
+
}, {
|
|
123
|
+
readonly name: "atimensec";
|
|
124
|
+
readonly definition: any;
|
|
125
|
+
}, {
|
|
126
|
+
readonly name: "mtimensec";
|
|
127
|
+
readonly definition: any;
|
|
128
|
+
}, {
|
|
129
|
+
readonly name: "ctimensec";
|
|
130
|
+
readonly definition: any;
|
|
131
|
+
}, {
|
|
132
|
+
readonly name: "mode";
|
|
133
|
+
readonly definition: any;
|
|
134
|
+
}, {
|
|
135
|
+
readonly name: "nlink";
|
|
136
|
+
readonly definition: any;
|
|
137
|
+
}, {
|
|
138
|
+
readonly name: "uid";
|
|
139
|
+
readonly definition: any;
|
|
140
|
+
}, {
|
|
141
|
+
readonly name: "gid";
|
|
142
|
+
readonly definition: any;
|
|
143
|
+
}, {
|
|
144
|
+
readonly name: "rdev";
|
|
145
|
+
readonly definition: any;
|
|
146
|
+
}, {
|
|
147
|
+
readonly name: "blksize";
|
|
148
|
+
readonly definition: any;
|
|
149
|
+
}, {
|
|
150
|
+
readonly name: "padding";
|
|
151
|
+
readonly definition: any;
|
|
152
|
+
}];
|
|
153
|
+
};
|
|
154
|
+
declare const fuseKstatfsDefinition: {
|
|
155
|
+
readonly type: "struct";
|
|
156
|
+
readonly packed: false;
|
|
157
|
+
readonly fixedAbi: {};
|
|
158
|
+
readonly fields: readonly [{
|
|
159
|
+
readonly name: "blocks";
|
|
160
|
+
readonly definition: any;
|
|
161
|
+
}, {
|
|
162
|
+
readonly name: "bfree";
|
|
163
|
+
readonly definition: any;
|
|
164
|
+
}, {
|
|
165
|
+
readonly name: "bavail";
|
|
166
|
+
readonly definition: any;
|
|
167
|
+
}, {
|
|
168
|
+
readonly name: "files";
|
|
169
|
+
readonly definition: any;
|
|
170
|
+
}, {
|
|
171
|
+
readonly name: "ffree";
|
|
172
|
+
readonly definition: any;
|
|
173
|
+
}, {
|
|
174
|
+
readonly name: "bsize";
|
|
175
|
+
readonly definition: any;
|
|
176
|
+
}, {
|
|
177
|
+
readonly name: "namelen";
|
|
178
|
+
readonly definition: any;
|
|
179
|
+
}, {
|
|
180
|
+
readonly name: "frsize";
|
|
181
|
+
readonly definition: any;
|
|
182
|
+
}, {
|
|
183
|
+
readonly name: "padding";
|
|
184
|
+
readonly definition: any;
|
|
185
|
+
}, {
|
|
186
|
+
readonly name: "spare";
|
|
187
|
+
readonly definition: {
|
|
188
|
+
readonly type: "array";
|
|
189
|
+
readonly elementType: any;
|
|
190
|
+
readonly length: number;
|
|
191
|
+
};
|
|
192
|
+
}];
|
|
193
|
+
};
|
|
194
|
+
declare const fuseFileLockDefinition: {
|
|
195
|
+
readonly type: "struct";
|
|
196
|
+
readonly packed: false;
|
|
197
|
+
readonly fixedAbi: {};
|
|
198
|
+
readonly fields: readonly [{
|
|
199
|
+
readonly name: "start";
|
|
200
|
+
readonly definition: any;
|
|
201
|
+
}, {
|
|
202
|
+
readonly name: "end";
|
|
203
|
+
readonly definition: any;
|
|
204
|
+
}, {
|
|
205
|
+
readonly name: "type";
|
|
206
|
+
readonly definition: any;
|
|
207
|
+
}, {
|
|
208
|
+
readonly name: "pid";
|
|
209
|
+
readonly definition: any;
|
|
210
|
+
}];
|
|
211
|
+
};
|
|
212
|
+
declare const FSOPEN_CLOEXEC: bigint;
|
|
213
|
+
declare const FSCONFIG_SET_STRING = 1n;
|
|
214
|
+
declare const FSCONFIG_SET_FLAG = 2n;
|
|
215
|
+
declare const FSCONFIG_CMD_CREATE = 6n;
|
|
216
|
+
declare const FSMOUNT_CLOEXEC = 1n;
|
|
217
|
+
declare const MOVE_MOUNT_F_EMPTY_PATH = 4n;
|
|
218
|
+
declare const AT_FCWD = -100n;
|
|
219
|
+
declare const MOUNT_ATTR_RDONLY: bigint;
|
|
220
|
+
declare const MOUNT_ATTR_NOSUID: bigint;
|
|
221
|
+
declare const MOUNT_ATTR_NODEV: bigint;
|
|
222
|
+
declare const MOUNT_ATTR_NOEXEC: bigint;
|
|
223
|
+
declare const MOUNT_ATTR_NOSYMFOLLOW: bigint;
|
|
224
|
+
declare const MOUNT_ATTR_NODIRATIME: bigint;
|
|
225
|
+
export { abi, DT_BLK, DT_CHR, DT_DIR, DT_FIFO, DT_LNK, DT_REG, DT_SOCK, DT_UNKNOWN, EINVAL, ENOENT, ENOSYS, ENOTDIR, EIO, EPROTO, ESTALE, FATTR_ATIME, FATTR_ATIME_NOW, FATTR_FH, FATTR_GID, FATTR_MODE, FATTR_MTIME, FATTR_MTIME_NOW, FATTR_SIZE, FATTR_UID, FUSE_BIG_WRITES, FUSE_GETATTR_FH, FUSE_INIT_FLAGS, FUSE_MIN_READ_BUFFER, FUSE_ROOT_ID, MS_NODEV, MS_NOSUID, MNT_DETACH, opcode, openCloseOnExecFlag, S_IFBLK, S_IFCHR, S_IFDIR, S_IFIFO, S_IFLNK, S_IFMT, S_IFREG, S_IFSOCK, textEncoder, uint16Array, uint32Array, fuseAttrDefinition, fuseKstatfsDefinition, fuseFileLockDefinition, FOPEN_DIRECT_IO, FOPEN_KEEP_CACHE, FOPEN_NONSEEKABLE, FSOPEN_CLOEXEC, FSCONFIG_SET_STRING, FSCONFIG_SET_FLAG, FSCONFIG_CMD_CREATE, FSMOUNT_CLOEXEC, MOVE_MOUNT_F_EMPTY_PATH, AT_FCWD, MOUNT_ATTR_RDONLY, MOUNT_ATTR_NOSUID, MOUNT_ATTR_NODEV, MOUNT_ATTR_NOEXEC, MOUNT_ATTR_NOSYMFOLLOW, MOUNT_ATTR_NODIRATIME, };
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import nodeFs from "node:fs";
|
|
2
|
+
import nodeOs from "node:os";
|
|
3
|
+
import { types } from "ya-struct";
|
|
4
|
+
|
|
5
|
+
const textEncoder = new TextEncoder();
|
|
6
|
+
|
|
7
|
+
const FUSE_ROOT_ID = 1n;
|
|
8
|
+
const FUSE_MIN_READ_BUFFER = 8192;
|
|
9
|
+
const FUSE_GETATTR_FH = 1n;
|
|
10
|
+
const FUSE_ASYNC_READ = 1 << 0;
|
|
11
|
+
const FUSE_BIG_WRITES = 1 << 5;
|
|
12
|
+
const FUSE_INIT_FLAGS = FUSE_ASYNC_READ | FUSE_BIG_WRITES;
|
|
13
|
+
const MS_NOSUID = 2n;
|
|
14
|
+
const MS_NODEV = 4n;
|
|
15
|
+
const MNT_DETACH = 2n;
|
|
16
|
+
const FATTR_MODE = 1 << 0;
|
|
17
|
+
const FATTR_UID = 1 << 1;
|
|
18
|
+
const FATTR_GID = 1 << 2;
|
|
19
|
+
const FATTR_SIZE = 1 << 3;
|
|
20
|
+
const FATTR_ATIME = 1 << 4;
|
|
21
|
+
const FATTR_MTIME = 1 << 5;
|
|
22
|
+
const FATTR_FH = 1 << 6;
|
|
23
|
+
const FATTR_ATIME_NOW = 1 << 7;
|
|
24
|
+
const FATTR_MTIME_NOW = 1 << 8;
|
|
25
|
+
const S_IFMT = 0o170000;
|
|
26
|
+
const S_IFIFO = 0o010000;
|
|
27
|
+
const S_IFCHR = 0o020000;
|
|
28
|
+
const S_IFDIR = 0o040000;
|
|
29
|
+
const S_IFBLK = 0o060000;
|
|
30
|
+
const S_IFREG = 0o100000;
|
|
31
|
+
const S_IFLNK = 0o120000;
|
|
32
|
+
const S_IFSOCK = 0o140000;
|
|
33
|
+
const DT_UNKNOWN = 0;
|
|
34
|
+
const DT_FIFO = 1;
|
|
35
|
+
const DT_CHR = 2;
|
|
36
|
+
const DT_DIR = 4;
|
|
37
|
+
const DT_BLK = 6;
|
|
38
|
+
const DT_REG = 8;
|
|
39
|
+
const DT_LNK = 10;
|
|
40
|
+
const DT_SOCK = 12;
|
|
41
|
+
|
|
42
|
+
const FOPEN_DIRECT_IO = 1n << 0n;
|
|
43
|
+
const FOPEN_KEEP_CACHE = 1n << 1n;
|
|
44
|
+
const FOPEN_NONSEEKABLE = 1n << 2n;
|
|
45
|
+
|
|
46
|
+
const {
|
|
47
|
+
EIO,
|
|
48
|
+
EINVAL,
|
|
49
|
+
ENOSYS,
|
|
50
|
+
ENOENT,
|
|
51
|
+
EPROTO,
|
|
52
|
+
ESTALE,
|
|
53
|
+
ENOTDIR,
|
|
54
|
+
} = nodeOs.constants.errno;
|
|
55
|
+
|
|
56
|
+
const opcode = {
|
|
57
|
+
LOOKUP: 1,
|
|
58
|
+
FORGET: 2,
|
|
59
|
+
GETATTR: 3,
|
|
60
|
+
SETATTR: 4,
|
|
61
|
+
READLINK: 5,
|
|
62
|
+
SYMLINK: 6,
|
|
63
|
+
MKNOD: 8,
|
|
64
|
+
MKDIR: 9,
|
|
65
|
+
UNLINK: 10,
|
|
66
|
+
RMDIR: 11,
|
|
67
|
+
RENAME: 12,
|
|
68
|
+
LINK: 13,
|
|
69
|
+
OPEN: 14,
|
|
70
|
+
READ: 15,
|
|
71
|
+
WRITE: 16,
|
|
72
|
+
STATFS: 17,
|
|
73
|
+
RELEASE: 18,
|
|
74
|
+
FSYNC: 20,
|
|
75
|
+
SETXATTR: 21,
|
|
76
|
+
GETXATTR: 22,
|
|
77
|
+
LISTXATTR: 23,
|
|
78
|
+
REMOVEXATTR: 24,
|
|
79
|
+
FLUSH: 25,
|
|
80
|
+
INIT: 26,
|
|
81
|
+
OPENDIR: 27,
|
|
82
|
+
READDIR: 28,
|
|
83
|
+
RELEASEDIR: 29,
|
|
84
|
+
FSYNCDIR: 30,
|
|
85
|
+
GETLK: 31,
|
|
86
|
+
SETLK: 32,
|
|
87
|
+
SETLKW: 33,
|
|
88
|
+
ACCESS: 34,
|
|
89
|
+
CREATE: 35,
|
|
90
|
+
INTERRUPT: 36,
|
|
91
|
+
BMAP: 37,
|
|
92
|
+
DESTROY: 38,
|
|
93
|
+
IOCTL: 39,
|
|
94
|
+
POLL: 40,
|
|
95
|
+
NOTIFY_REPLY: 41,
|
|
96
|
+
BATCH_FORGET: 42,
|
|
97
|
+
FALLOCATE: 43,
|
|
98
|
+
READDIRPLUS: 44,
|
|
99
|
+
RENAME2: 45,
|
|
100
|
+
} /*as const*/;
|
|
101
|
+
|
|
102
|
+
const openCloseOnExecFlag = "O_CLOEXEC" in nodeFs.constants
|
|
103
|
+
? (nodeFs.constants /*as typeof nodeFs.constants & { O_CLOEXEC: number }*/).O_CLOEXEC
|
|
104
|
+
: 0;
|
|
105
|
+
|
|
106
|
+
const abi = {
|
|
107
|
+
endianness: "little",
|
|
108
|
+
dataModel: "LP64",
|
|
109
|
+
compiler: "gcc",
|
|
110
|
+
} /*as const*/;
|
|
111
|
+
|
|
112
|
+
const uint16Array = (length/*: number*/) => {
|
|
113
|
+
return {
|
|
114
|
+
type: "array",
|
|
115
|
+
elementType: types.UInt16,
|
|
116
|
+
length,
|
|
117
|
+
} /*as const*/;
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
const uint32Array = (length/*: number*/) => {
|
|
121
|
+
return {
|
|
122
|
+
type: "array",
|
|
123
|
+
elementType: types.UInt32,
|
|
124
|
+
length,
|
|
125
|
+
} /*as const*/;
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
const fuseAttrDefinition = {
|
|
129
|
+
type: "struct",
|
|
130
|
+
packed: false,
|
|
131
|
+
fixedAbi: {},
|
|
132
|
+
fields: [
|
|
133
|
+
{ name: "ino", definition: types.UInt64 },
|
|
134
|
+
{ name: "size", definition: types.UInt64 },
|
|
135
|
+
{ name: "blocks", definition: types.UInt64 },
|
|
136
|
+
{ name: "atime", definition: types.UInt64 },
|
|
137
|
+
{ name: "mtime", definition: types.UInt64 },
|
|
138
|
+
{ name: "ctime", definition: types.UInt64 },
|
|
139
|
+
{ name: "atimensec", definition: types.UInt32 },
|
|
140
|
+
{ name: "mtimensec", definition: types.UInt32 },
|
|
141
|
+
{ name: "ctimensec", definition: types.UInt32 },
|
|
142
|
+
{ name: "mode", definition: types.UInt32 },
|
|
143
|
+
{ name: "nlink", definition: types.UInt32 },
|
|
144
|
+
{ name: "uid", definition: types.UInt32 },
|
|
145
|
+
{ name: "gid", definition: types.UInt32 },
|
|
146
|
+
{ name: "rdev", definition: types.UInt32 },
|
|
147
|
+
{ name: "blksize", definition: types.UInt32 },
|
|
148
|
+
{ name: "padding", definition: types.UInt32 },
|
|
149
|
+
],
|
|
150
|
+
} /*as const*/;
|
|
151
|
+
|
|
152
|
+
const fuseKstatfsDefinition = {
|
|
153
|
+
type: "struct",
|
|
154
|
+
packed: false,
|
|
155
|
+
fixedAbi: {},
|
|
156
|
+
fields: [
|
|
157
|
+
{ name: "blocks", definition: types.UInt64 },
|
|
158
|
+
{ name: "bfree", definition: types.UInt64 },
|
|
159
|
+
{ name: "bavail", definition: types.UInt64 },
|
|
160
|
+
{ name: "files", definition: types.UInt64 },
|
|
161
|
+
{ name: "ffree", definition: types.UInt64 },
|
|
162
|
+
{ name: "bsize", definition: types.UInt32 },
|
|
163
|
+
{ name: "namelen", definition: types.UInt32 },
|
|
164
|
+
{ name: "frsize", definition: types.UInt32 },
|
|
165
|
+
{ name: "padding", definition: types.UInt32 },
|
|
166
|
+
{ name: "spare", definition: uint32Array(6) },
|
|
167
|
+
],
|
|
168
|
+
} /*as const*/;
|
|
169
|
+
|
|
170
|
+
const fuseFileLockDefinition = {
|
|
171
|
+
type: "struct",
|
|
172
|
+
packed: false,
|
|
173
|
+
fixedAbi: {},
|
|
174
|
+
fields: [
|
|
175
|
+
{ name: "start", definition: types.UInt64 },
|
|
176
|
+
{ name: "end", definition: types.UInt64 },
|
|
177
|
+
{ name: "type", definition: types.UInt32 },
|
|
178
|
+
{ name: "pid", definition: types.UInt32 },
|
|
179
|
+
],
|
|
180
|
+
} /*as const*/;
|
|
181
|
+
|
|
182
|
+
const FSOPEN_CLOEXEC = 1n << 0n;
|
|
183
|
+
const FSCONFIG_SET_STRING = 1n;
|
|
184
|
+
const FSCONFIG_SET_FLAG = 2n;
|
|
185
|
+
const FSCONFIG_CMD_CREATE = 6n;
|
|
186
|
+
|
|
187
|
+
const FSMOUNT_CLOEXEC = 1n;
|
|
188
|
+
|
|
189
|
+
const MOVE_MOUNT_F_EMPTY_PATH = 4n;
|
|
190
|
+
|
|
191
|
+
const AT_FCWD = -100n;
|
|
192
|
+
|
|
193
|
+
const MOUNT_ATTR_RDONLY = 1n << 0n;
|
|
194
|
+
const MOUNT_ATTR_NOSUID = 1n << 1n;
|
|
195
|
+
const MOUNT_ATTR_NODEV = 1n << 2n;
|
|
196
|
+
const MOUNT_ATTR_NOEXEC = 1n << 3n;
|
|
197
|
+
const MOUNT_ATTR_NOSYMFOLLOW = 1n << 4n;
|
|
198
|
+
const MOUNT_ATTR_NODIRATIME = 1n << 5n;
|
|
199
|
+
|
|
200
|
+
export {
|
|
201
|
+
abi,
|
|
202
|
+
DT_BLK,
|
|
203
|
+
DT_CHR,
|
|
204
|
+
DT_DIR,
|
|
205
|
+
DT_FIFO,
|
|
206
|
+
DT_LNK,
|
|
207
|
+
DT_REG,
|
|
208
|
+
DT_SOCK,
|
|
209
|
+
DT_UNKNOWN,
|
|
210
|
+
EINVAL,
|
|
211
|
+
ENOENT,
|
|
212
|
+
ENOSYS,
|
|
213
|
+
ENOTDIR,
|
|
214
|
+
EIO,
|
|
215
|
+
EPROTO,
|
|
216
|
+
ESTALE,
|
|
217
|
+
FATTR_ATIME,
|
|
218
|
+
FATTR_ATIME_NOW,
|
|
219
|
+
FATTR_FH,
|
|
220
|
+
FATTR_GID,
|
|
221
|
+
FATTR_MODE,
|
|
222
|
+
FATTR_MTIME,
|
|
223
|
+
FATTR_MTIME_NOW,
|
|
224
|
+
FATTR_SIZE,
|
|
225
|
+
FATTR_UID,
|
|
226
|
+
FUSE_BIG_WRITES,
|
|
227
|
+
FUSE_GETATTR_FH,
|
|
228
|
+
FUSE_INIT_FLAGS,
|
|
229
|
+
FUSE_MIN_READ_BUFFER,
|
|
230
|
+
FUSE_ROOT_ID,
|
|
231
|
+
MS_NODEV,
|
|
232
|
+
MS_NOSUID,
|
|
233
|
+
MNT_DETACH,
|
|
234
|
+
opcode,
|
|
235
|
+
openCloseOnExecFlag,
|
|
236
|
+
S_IFBLK,
|
|
237
|
+
S_IFCHR,
|
|
238
|
+
S_IFDIR,
|
|
239
|
+
S_IFIFO,
|
|
240
|
+
S_IFLNK,
|
|
241
|
+
S_IFMT,
|
|
242
|
+
S_IFREG,
|
|
243
|
+
S_IFSOCK,
|
|
244
|
+
textEncoder,
|
|
245
|
+
uint16Array,
|
|
246
|
+
uint32Array,
|
|
247
|
+
fuseAttrDefinition,
|
|
248
|
+
fuseKstatfsDefinition,
|
|
249
|
+
fuseFileLockDefinition,
|
|
250
|
+
|
|
251
|
+
FOPEN_DIRECT_IO,
|
|
252
|
+
FOPEN_KEEP_CACHE,
|
|
253
|
+
FOPEN_NONSEEKABLE,
|
|
254
|
+
|
|
255
|
+
FSOPEN_CLOEXEC,
|
|
256
|
+
FSCONFIG_SET_STRING,
|
|
257
|
+
FSCONFIG_SET_FLAG,
|
|
258
|
+
FSCONFIG_CMD_CREATE,
|
|
259
|
+
|
|
260
|
+
FSMOUNT_CLOEXEC,
|
|
261
|
+
|
|
262
|
+
MOVE_MOUNT_F_EMPTY_PATH,
|
|
263
|
+
|
|
264
|
+
AT_FCWD,
|
|
265
|
+
|
|
266
|
+
MOUNT_ATTR_RDONLY,
|
|
267
|
+
MOUNT_ATTR_NOSUID,
|
|
268
|
+
MOUNT_ATTR_NODEV,
|
|
269
|
+
MOUNT_ATTR_NOEXEC,
|
|
270
|
+
MOUNT_ATTR_NOSYMFOLLOW,
|
|
271
|
+
MOUNT_ATTR_NODIRATIME,
|
|
272
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { TFuseRequest, TFuseResponse } from "./protocol.js";
|
|
2
|
+
import type { TRequestHandler } from "./server.js";
|
|
3
|
+
type DistributiveOmit<T, K extends PropertyKey> = T extends any ? Omit<T, K> : never;
|
|
4
|
+
type TConvenienceRequest<T extends string> = Extract<TFuseRequest, {
|
|
5
|
+
opcode: T;
|
|
6
|
+
}>;
|
|
7
|
+
type TConvenienceResponse<T extends string> = DistributiveOmit<Extract<TFuseResponse, {
|
|
8
|
+
forOpcode: T;
|
|
9
|
+
}>, "unique">;
|
|
10
|
+
type TFuseServerInterface = {
|
|
11
|
+
init: (req: TConvenienceRequest<"INIT">) => Promise<TConvenienceResponse<"INIT">>;
|
|
12
|
+
forget: (req: TConvenienceRequest<"FORGET">) => Promise<void>;
|
|
13
|
+
batchForget: (req: TConvenienceRequest<"BATCH_FORGET">) => Promise<void>;
|
|
14
|
+
getattr: (req: Extract<TConvenienceRequest<"GETATTR">, {
|
|
15
|
+
getattrMode: "node";
|
|
16
|
+
}>) => Promise<TConvenienceResponse<"GETATTR">>;
|
|
17
|
+
fgetattr: (req: Extract<TConvenienceRequest<"GETATTR">, {
|
|
18
|
+
getattrMode: "fileHandle";
|
|
19
|
+
}>) => Promise<TConvenienceResponse<"GETATTR">>;
|
|
20
|
+
setattr: (req: TConvenienceRequest<"SETATTR">) => Promise<TConvenienceResponse<"SETATTR">>;
|
|
21
|
+
listxattr: (req: TConvenienceRequest<"LISTXATTR">) => Promise<TConvenienceResponse<"LISTXATTR">>;
|
|
22
|
+
getxattr: (req: TConvenienceRequest<"GETXATTR">) => Promise<TConvenienceResponse<"GETXATTR">>;
|
|
23
|
+
readlink: (req: TConvenienceRequest<"READLINK">) => Promise<TConvenienceResponse<"READLINK">>;
|
|
24
|
+
symlink: (req: TConvenienceRequest<"SYMLINK">) => Promise<TConvenienceResponse<"SYMLINK">>;
|
|
25
|
+
mknod: (req: TConvenienceRequest<"MKNOD">) => Promise<TConvenienceResponse<"MKNOD">>;
|
|
26
|
+
mkdir: (req: TConvenienceRequest<"MKDIR">) => Promise<TConvenienceResponse<"MKDIR">>;
|
|
27
|
+
unlink: (req: TConvenienceRequest<"UNLINK">) => Promise<TConvenienceResponse<"UNLINK">>;
|
|
28
|
+
rmdir: (req: TConvenienceRequest<"RMDIR">) => Promise<TConvenienceResponse<"RMDIR">>;
|
|
29
|
+
rename: (req: TConvenienceRequest<"RENAME">) => Promise<TConvenienceResponse<"RENAME">>;
|
|
30
|
+
link: (req: TConvenienceRequest<"LINK">) => Promise<TConvenienceResponse<"LINK">>;
|
|
31
|
+
opendir: (req: TConvenienceRequest<"OPENDIR">) => Promise<TConvenienceResponse<"OPENDIR">>;
|
|
32
|
+
readdir: (req: TConvenienceRequest<"READDIR">) => Promise<TConvenienceResponse<"READDIR">>;
|
|
33
|
+
release: (req: TConvenienceRequest<"RELEASE">) => Promise<TConvenienceResponse<"RELEASE">>;
|
|
34
|
+
releasedir: (req: TConvenienceRequest<"RELEASEDIR">) => Promise<TConvenienceResponse<"RELEASEDIR">>;
|
|
35
|
+
fsyncdir: (req: TConvenienceRequest<"FSYNCDIR">) => Promise<TConvenienceResponse<"FSYNCDIR">>;
|
|
36
|
+
statfs: (req: TConvenienceRequest<"STATFS">) => Promise<TConvenienceResponse<"STATFS">>;
|
|
37
|
+
lookup: (req: TConvenienceRequest<"LOOKUP">) => Promise<TConvenienceResponse<"LOOKUP">>;
|
|
38
|
+
open: (req: TConvenienceRequest<"OPEN">) => Promise<TConvenienceResponse<"OPEN">>;
|
|
39
|
+
read: (req: TConvenienceRequest<"READ">) => Promise<TConvenienceResponse<"READ">>;
|
|
40
|
+
write: (req: TConvenienceRequest<"WRITE">) => Promise<TConvenienceResponse<"WRITE">>;
|
|
41
|
+
flush: (req: TConvenienceRequest<"FLUSH">) => Promise<TConvenienceResponse<"FLUSH">>;
|
|
42
|
+
fsync: (req: TConvenienceRequest<"FSYNC">) => Promise<TConvenienceResponse<"FSYNC">>;
|
|
43
|
+
access: (req: TConvenienceRequest<"ACCESS">) => Promise<TConvenienceResponse<"ACCESS">>;
|
|
44
|
+
setxattr: (req: TConvenienceRequest<"SETXATTR">) => Promise<TConvenienceResponse<"SETXATTR">>;
|
|
45
|
+
removexattr: (req: TConvenienceRequest<"REMOVEXATTR">) => Promise<TConvenienceResponse<"REMOVEXATTR">>;
|
|
46
|
+
create: (req: TConvenienceRequest<"CREATE">) => Promise<TConvenienceResponse<"CREATE">>;
|
|
47
|
+
destroy: (req: TConvenienceRequest<"DESTROY">) => Promise<TConvenienceResponse<"DESTROY">>;
|
|
48
|
+
getlk: (req: TConvenienceRequest<"GETLK">) => Promise<TConvenienceResponse<"GETLK">>;
|
|
49
|
+
setlk: (req: TConvenienceRequest<"SETLK">) => Promise<TConvenienceResponse<"SETLK">>;
|
|
50
|
+
setlkw: (req: TConvenienceRequest<"SETLKW">) => Promise<TConvenienceResponse<"SETLKW">>;
|
|
51
|
+
interrupt: (req: TConvenienceRequest<"INTERRUPT">) => Promise<void>;
|
|
52
|
+
bmap: (req: TConvenienceRequest<"BMAP">) => Promise<TConvenienceResponse<"BMAP">>;
|
|
53
|
+
ioctl: (req: TConvenienceRequest<"IOCTL">) => Promise<TConvenienceResponse<"IOCTL">>;
|
|
54
|
+
poll: (req: TConvenienceRequest<"POLL">) => Promise<TConvenienceResponse<"POLL">>;
|
|
55
|
+
notifyReply: (req: TConvenienceRequest<"NOTIFY_REPLY">) => Promise<void>;
|
|
56
|
+
fallocate: (req: TConvenienceRequest<"FALLOCATE">) => Promise<TConvenienceResponse<"FALLOCATE">>;
|
|
57
|
+
readdirplus: (req: TConvenienceRequest<"READDIRPLUS">) => Promise<TConvenienceResponse<"READDIRPLUS">>;
|
|
58
|
+
};
|
|
59
|
+
declare const createConvenienceRequestHandler: ({ serverInterface }: {
|
|
60
|
+
serverInterface: TFuseServerInterface;
|
|
61
|
+
}) => TRequestHandler;
|
|
62
|
+
export { createConvenienceRequestHandler };
|
|
63
|
+
export type { TFuseServerInterface, };
|