@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.
@@ -0,0 +1,1019 @@
1
+ import { define, types } from "ya-struct";
2
+ import {
3
+ abi,
4
+ fuseAttrDefinition,
5
+ fuseFileLockDefinition,
6
+ fuseKstatfsDefinition,
7
+ uint16Array,
8
+ uint32Array,
9
+ } from "./constants.js";
10
+
11
+ /*type TStructParser<T> = {
12
+ size: number;
13
+ parse: ({ data }: { data: Uint8Array }) => T;
14
+ format: ({ value }: { value: T }) => Uint8Array;
15
+ };*/
16
+
17
+ /*type TFuseAttrValue = {
18
+ ino: bigint;
19
+ size: bigint;
20
+ blocks: bigint;
21
+ atime: bigint;
22
+ mtime: bigint;
23
+ ctime: bigint;
24
+ atimensec: bigint;
25
+ mtimensec: bigint;
26
+ ctimensec: bigint;
27
+ mode: bigint;
28
+ nlink: bigint;
29
+ uid: bigint;
30
+ gid: bigint;
31
+ rdev: bigint;
32
+ blksize: bigint;
33
+ padding: bigint;
34
+ };*/
35
+
36
+ /*type TFuseKstatfsValue = {
37
+ blocks: bigint;
38
+ bfree: bigint;
39
+ bavail: bigint;
40
+ files: bigint;
41
+ ffree: bigint;
42
+ bsize: bigint;
43
+ namelen: bigint;
44
+ frsize: bigint;
45
+ padding: bigint;
46
+ spare: bigint[];
47
+ };*/
48
+
49
+ /*type TFuseInHeaderValue = {
50
+ len: bigint;
51
+ opcode: bigint;
52
+ unique: bigint;
53
+ nodeid: bigint;
54
+ uid: bigint;
55
+ gid: bigint;
56
+ pid: bigint;
57
+ total_extlen: bigint;
58
+ padding: bigint;
59
+ };*/
60
+
61
+ /*type TFuseOutHeaderValue = {
62
+ len: bigint;
63
+ error: bigint;
64
+ unique: bigint;
65
+ };*/
66
+
67
+ /*type TFuseEntryOutValue = {
68
+ nodeid: bigint;
69
+ generation: bigint;
70
+ entry_valid: bigint;
71
+ attr_valid: bigint;
72
+ entry_valid_nsec: bigint;
73
+ attr_valid_nsec: bigint;
74
+ attr: TFuseAttrValue;
75
+ };*/
76
+
77
+ /*type TFuseGetattrInValue = {
78
+ getattr_flags: bigint;
79
+ dummy: bigint;
80
+ fh: bigint;
81
+ };*/
82
+
83
+ /*type TFuseAttrOutValue = {
84
+ attr_valid: bigint;
85
+ attr_valid_nsec: bigint;
86
+ dummy: bigint;
87
+ attr: TFuseAttrValue;
88
+ };*/
89
+
90
+ /*type TFuseSetattrInValue = {
91
+ valid: bigint;
92
+ padding: bigint;
93
+ fh: bigint;
94
+ size: bigint;
95
+ lock_owner: bigint;
96
+ atime: bigint;
97
+ mtime: bigint;
98
+ ctime: bigint;
99
+ atimensec: bigint;
100
+ mtimensec: bigint;
101
+ ctimensec: bigint;
102
+ mode: bigint;
103
+ unused4: bigint;
104
+ uid: bigint;
105
+ gid: bigint;
106
+ unused5: bigint;
107
+ };*/
108
+
109
+ /*type TFuseOpenInValue = {
110
+ flags: bigint;
111
+ open_flags: bigint;
112
+ };*/
113
+
114
+ /*type TFuseGetxattrInValue = {
115
+ size: bigint;
116
+ padding: bigint;
117
+ };*/
118
+
119
+ /*type TFuseGetxattrOutValue = {
120
+ size: bigint;
121
+ padding: bigint;
122
+ };*/
123
+
124
+ /*type TFuseCreateInValue = {
125
+ flags: bigint;
126
+ mode: bigint;
127
+ umask: bigint;
128
+ open_flags: bigint;
129
+ };*/
130
+
131
+ /*type TFuseOpenOutValue = {
132
+ fh: bigint;
133
+ open_flags: bigint;
134
+ backing_id: bigint;
135
+ };*/
136
+
137
+ /*type TFuseReleaseInValue = {
138
+ fh: bigint;
139
+ flags: bigint;
140
+ release_flags: bigint;
141
+ lock_owner: bigint;
142
+ };*/
143
+
144
+ /*type TFuseFlushInValue = {
145
+ fh: bigint;
146
+ unused: bigint;
147
+ padding: bigint;
148
+ lock_owner: bigint;
149
+ };*/
150
+
151
+ /*type TFuseReadInValue = {
152
+ fh: bigint;
153
+ offset: bigint;
154
+ size: bigint;
155
+ read_flags: bigint;
156
+ lock_owner: bigint;
157
+ flags: bigint;
158
+ padding: bigint;
159
+ };*/
160
+
161
+ /*type TFuseWriteInValue = {
162
+ fh: bigint;
163
+ offset: bigint;
164
+ size: bigint;
165
+ write_flags: bigint;
166
+ lock_owner: bigint;
167
+ flags: bigint;
168
+ padding: bigint;
169
+ };*/
170
+
171
+ /*type TFuseWriteOutValue = {
172
+ size: bigint;
173
+ padding: bigint;
174
+ };*/
175
+
176
+ /*type TFuseMkdirInValue = {
177
+ mode: bigint;
178
+ umask: bigint;
179
+ };*/
180
+
181
+ /*type TFuseMknodInValue = {
182
+ mode: bigint;
183
+ rdev: bigint;
184
+ umask: bigint;
185
+ padding: bigint;
186
+ };*/
187
+
188
+ /*type TFuseRenameInValue = {
189
+ newdir: bigint;
190
+ };*/
191
+
192
+ /*type TFuseLinkInValue = {
193
+ oldnodeid: bigint;
194
+ };*/
195
+
196
+ /*type TFuseRename2InValue = {
197
+ newdir: bigint;
198
+ flags: bigint;
199
+ padding: bigint;
200
+ };*/
201
+
202
+ /*type TFuseFileLockValue = {
203
+ start: bigint;
204
+ end: bigint;
205
+ type: bigint;
206
+ pid: bigint;
207
+ };*/
208
+
209
+ /*type TFuseLkInValue = {
210
+ fh: bigint;
211
+ owner: bigint;
212
+ lk: TFuseFileLockValue;
213
+ lk_flags: bigint;
214
+ padding: bigint;
215
+ };*/
216
+
217
+ /*type TFuseLkOutValue = {
218
+ lk: TFuseFileLockValue;
219
+ };*/
220
+
221
+ /*type TFuseInterruptInValue = {
222
+ unique: bigint;
223
+ };*/
224
+
225
+ /*type TFuseBmapInValue = {
226
+ block: bigint;
227
+ blocksize: bigint;
228
+ padding: bigint;
229
+ };*/
230
+
231
+ /*type TFuseBmapOutValue = {
232
+ block: bigint;
233
+ };*/
234
+
235
+ /*type TFuseIoctlInValue = {
236
+ fh: bigint;
237
+ flags: bigint;
238
+ cmd: bigint;
239
+ arg: bigint;
240
+ in_size: bigint;
241
+ out_size: bigint;
242
+ };*/
243
+
244
+ /*type TFuseIoctlOutValue = {
245
+ result: bigint;
246
+ flags: bigint;
247
+ in_iovs: bigint;
248
+ out_iovs: bigint;
249
+ };*/
250
+
251
+ /*type TFusePollInValue = {
252
+ fh: bigint;
253
+ kh: bigint;
254
+ flags: bigint;
255
+ events: bigint;
256
+ };*/
257
+
258
+ /*type TFusePollOutValue = {
259
+ revents: bigint;
260
+ padding: bigint;
261
+ };*/
262
+
263
+ /*type TFuseFallocateInValue = {
264
+ fh: bigint;
265
+ offset: bigint;
266
+ length: bigint;
267
+ mode: bigint;
268
+ padding: bigint;
269
+ };*/
270
+
271
+ /*type TFuseForgetInValue = {
272
+ nlookup: bigint;
273
+ };*/
274
+
275
+ /*type TFuseBatchForgetInValue = {
276
+ count: bigint;
277
+ dummy: bigint;
278
+ };*/
279
+
280
+ /*type TFuseForgetOneValue = {
281
+ nodeid: bigint;
282
+ nlookup: bigint;
283
+ };*/
284
+
285
+ /*type TFuseAccessInValue = {
286
+ mask: bigint;
287
+ padding: bigint;
288
+ };*/
289
+
290
+ /*type TFuseFsyncInValue = {
291
+ fh: bigint;
292
+ fsync_flags: bigint;
293
+ padding: bigint;
294
+ };*/
295
+
296
+ /*type TFuseSetxattrInValue = {
297
+ size: bigint;
298
+ flags: bigint;
299
+ setxattr_flags: bigint;
300
+ padding: bigint;
301
+ };*/
302
+
303
+ /*type TFuseInitInValue = {
304
+ major: bigint;
305
+ minor: bigint;
306
+ max_readahead: bigint;
307
+ flags: bigint;
308
+ flags2: bigint;
309
+ unused: bigint[];
310
+ };*/
311
+
312
+ /*type TFuseInitOutValue = {
313
+ major: bigint;
314
+ minor: bigint;
315
+ max_readahead: bigint;
316
+ flags: bigint;
317
+ max_background: bigint;
318
+ congestion_threshold: bigint;
319
+ max_write: bigint;
320
+ time_gran: bigint;
321
+ max_pages: bigint;
322
+ map_alignment: bigint;
323
+ flags2: bigint;
324
+ max_stack_depth: bigint;
325
+ request_timeout: bigint;
326
+ unused: bigint[];
327
+ };*/
328
+
329
+ /*type TFuseStatfsOutValue = {
330
+ st: TFuseKstatfsValue;
331
+ };*/
332
+
333
+ const fuseInHeaderParser/*: TStructParser<TFuseInHeaderValue>*/ = define({
334
+ definition: {
335
+ type: "struct",
336
+ packed: false,
337
+ fixedAbi: {},
338
+ fields: [
339
+ { name: "len", definition: types.UInt32 },
340
+ { name: "opcode", definition: types.UInt32 },
341
+ { name: "unique", definition: types.UInt64 },
342
+ { name: "nodeid", definition: types.UInt64 },
343
+ { name: "uid", definition: types.UInt32 },
344
+ { name: "gid", definition: types.UInt32 },
345
+ { name: "pid", definition: types.UInt32 },
346
+ { name: "total_extlen", definition: types.UInt16 },
347
+ { name: "padding", definition: types.UInt16 },
348
+ ],
349
+ },
350
+ }).parser({ abi });
351
+
352
+ const fuseOutHeaderParser/*: TStructParser<TFuseOutHeaderValue>*/ = define({
353
+ definition: {
354
+ type: "struct",
355
+ packed: false,
356
+ fixedAbi: {},
357
+ fields: [
358
+ { name: "len", definition: types.UInt32 },
359
+ { name: "error", definition: types.Int32 },
360
+ { name: "unique", definition: types.UInt64 },
361
+ ],
362
+ },
363
+ }).parser({ abi });
364
+
365
+ const fuseEntryOutParser/*: TStructParser<TFuseEntryOutValue>*/ = define({
366
+ definition: {
367
+ type: "struct",
368
+ packed: false,
369
+ fixedAbi: {},
370
+ fields: [
371
+ { name: "nodeid", definition: types.UInt64 },
372
+ { name: "generation", definition: types.UInt64 },
373
+ { name: "entry_valid", definition: types.UInt64 },
374
+ { name: "attr_valid", definition: types.UInt64 },
375
+ { name: "entry_valid_nsec", definition: types.UInt32 },
376
+ { name: "attr_valid_nsec", definition: types.UInt32 },
377
+ { name: "attr", definition: fuseAttrDefinition },
378
+ ],
379
+ },
380
+ }).parser({ abi });
381
+
382
+ const fuseGetattrInParser/*: TStructParser<TFuseGetattrInValue>*/ = define({
383
+ definition: {
384
+ type: "struct",
385
+ packed: false,
386
+ fixedAbi: {},
387
+ fields: [
388
+ { name: "getattr_flags", definition: types.UInt32 },
389
+ { name: "dummy", definition: types.UInt32 },
390
+ { name: "fh", definition: types.UInt64 },
391
+ ],
392
+ },
393
+ }).parser({ abi });
394
+
395
+ const fuseAttrOutParser/*: TStructParser<TFuseAttrOutValue>*/ = define({
396
+ definition: {
397
+ type: "struct",
398
+ packed: false,
399
+ fixedAbi: {},
400
+ fields: [
401
+ { name: "attr_valid", definition: types.UInt64 },
402
+ { name: "attr_valid_nsec", definition: types.UInt32 },
403
+ { name: "dummy", definition: types.UInt32 },
404
+ { name: "attr", definition: fuseAttrDefinition },
405
+ ],
406
+ },
407
+ }).parser({ abi });
408
+
409
+ const fuseSetattrInParser/*: TStructParser<TFuseSetattrInValue>*/ = define({
410
+ definition: {
411
+ type: "struct",
412
+ packed: false,
413
+ fixedAbi: {},
414
+ fields: [
415
+ { name: "valid", definition: types.UInt32 },
416
+ { name: "padding", definition: types.UInt32 },
417
+ { name: "fh", definition: types.UInt64 },
418
+ { name: "size", definition: types.UInt64 },
419
+ { name: "lock_owner", definition: types.UInt64 },
420
+ { name: "atime", definition: types.UInt64 },
421
+ { name: "mtime", definition: types.UInt64 },
422
+ { name: "ctime", definition: types.UInt64 },
423
+ { name: "atimensec", definition: types.UInt32 },
424
+ { name: "mtimensec", definition: types.UInt32 },
425
+ { name: "ctimensec", definition: types.UInt32 },
426
+ { name: "mode", definition: types.UInt32 },
427
+ { name: "unused4", definition: types.UInt32 },
428
+ { name: "uid", definition: types.UInt32 },
429
+ { name: "gid", definition: types.UInt32 },
430
+ { name: "unused5", definition: types.UInt32 },
431
+ ],
432
+ },
433
+ }).parser({ abi });
434
+
435
+ const fuseOpenInParser/*: TStructParser<TFuseOpenInValue>*/ = define({
436
+ definition: {
437
+ type: "struct",
438
+ packed: false,
439
+ fixedAbi: {},
440
+ fields: [
441
+ { name: "flags", definition: types.UInt32 },
442
+ { name: "open_flags", definition: types.UInt32 },
443
+ ],
444
+ },
445
+ }).parser({ abi });
446
+
447
+ const fuseGetxattrInParser/*: TStructParser<TFuseGetxattrInValue>*/ = define({
448
+ definition: {
449
+ type: "struct",
450
+ packed: false,
451
+ fixedAbi: {},
452
+ fields: [
453
+ { name: "size", definition: types.UInt32 },
454
+ { name: "padding", definition: types.UInt32 },
455
+ ],
456
+ },
457
+ }).parser({ abi });
458
+
459
+ const fuseGetxattrOutParser/*: TStructParser<TFuseGetxattrOutValue>*/ = define({
460
+ definition: {
461
+ type: "struct",
462
+ packed: false,
463
+ fixedAbi: {},
464
+ fields: [
465
+ { name: "size", definition: types.UInt32 },
466
+ { name: "padding", definition: types.UInt32 },
467
+ ],
468
+ },
469
+ }).parser({ abi });
470
+
471
+ const fuseCreateInParser/*: TStructParser<TFuseCreateInValue>*/ = define({
472
+ definition: {
473
+ type: "struct",
474
+ packed: false,
475
+ fixedAbi: {},
476
+ fields: [
477
+ { name: "flags", definition: types.UInt32 },
478
+ { name: "mode", definition: types.UInt32 },
479
+ { name: "umask", definition: types.UInt32 },
480
+ { name: "open_flags", definition: types.UInt32 },
481
+ ],
482
+ },
483
+ }).parser({ abi });
484
+
485
+ const fuseOpenOutParser/*: TStructParser<TFuseOpenOutValue>*/ = define({
486
+ definition: {
487
+ type: "struct",
488
+ packed: false,
489
+ fixedAbi: {},
490
+ fields: [
491
+ { name: "fh", definition: types.UInt64 },
492
+ { name: "open_flags", definition: types.UInt32 },
493
+ { name: "backing_id", definition: types.Int32 },
494
+ ],
495
+ },
496
+ }).parser({ abi });
497
+
498
+ const fuseReleaseInParser/*: TStructParser<TFuseReleaseInValue>*/ = define({
499
+ definition: {
500
+ type: "struct",
501
+ packed: false,
502
+ fixedAbi: {},
503
+ fields: [
504
+ { name: "fh", definition: types.UInt64 },
505
+ { name: "flags", definition: types.UInt32 },
506
+ { name: "release_flags", definition: types.UInt32 },
507
+ { name: "lock_owner", definition: types.UInt64 },
508
+ ],
509
+ },
510
+ }).parser({ abi });
511
+
512
+ const fuseFlushInParser/*: TStructParser<TFuseFlushInValue>*/ = define({
513
+ definition: {
514
+ type: "struct",
515
+ packed: false,
516
+ fixedAbi: {},
517
+ fields: [
518
+ { name: "fh", definition: types.UInt64 },
519
+ { name: "unused", definition: types.UInt32 },
520
+ { name: "padding", definition: types.UInt32 },
521
+ { name: "lock_owner", definition: types.UInt64 },
522
+ ],
523
+ },
524
+ }).parser({ abi });
525
+
526
+ const fuseReadInParser/*: TStructParser<TFuseReadInValue>*/ = define({
527
+ definition: {
528
+ type: "struct",
529
+ packed: false,
530
+ fixedAbi: {},
531
+ fields: [
532
+ { name: "fh", definition: types.UInt64 },
533
+ { name: "offset", definition: types.UInt64 },
534
+ { name: "size", definition: types.UInt32 },
535
+ { name: "read_flags", definition: types.UInt32 },
536
+ { name: "lock_owner", definition: types.UInt64 },
537
+ { name: "flags", definition: types.UInt32 },
538
+ { name: "padding", definition: types.UInt32 },
539
+ ],
540
+ },
541
+ }).parser({ abi });
542
+
543
+ const fuseWriteInParser/*: TStructParser<TFuseWriteInValue>*/ = define({
544
+ definition: {
545
+ type: "struct",
546
+ packed: false,
547
+ fixedAbi: {},
548
+ fields: [
549
+ { name: "fh", definition: types.UInt64 },
550
+ { name: "offset", definition: types.UInt64 },
551
+ { name: "size", definition: types.UInt32 },
552
+ { name: "write_flags", definition: types.UInt32 },
553
+ { name: "lock_owner", definition: types.UInt64 },
554
+ { name: "flags", definition: types.UInt32 },
555
+ { name: "padding", definition: types.UInt32 },
556
+ ],
557
+ },
558
+ }).parser({ abi });
559
+
560
+ const fuseWriteOutParser/*: TStructParser<TFuseWriteOutValue>*/ = define({
561
+ definition: {
562
+ type: "struct",
563
+ packed: false,
564
+ fixedAbi: {},
565
+ fields: [
566
+ { name: "size", definition: types.UInt32 },
567
+ { name: "padding", definition: types.UInt32 },
568
+ ],
569
+ },
570
+ }).parser({ abi });
571
+
572
+ const fuseMkdirInParser/*: TStructParser<TFuseMkdirInValue>*/ = define({
573
+ definition: {
574
+ type: "struct",
575
+ packed: false,
576
+ fixedAbi: {},
577
+ fields: [
578
+ { name: "mode", definition: types.UInt32 },
579
+ { name: "umask", definition: types.UInt32 },
580
+ ],
581
+ },
582
+ }).parser({ abi });
583
+
584
+ const fuseMknodInParser/*: TStructParser<TFuseMknodInValue>*/ = define({
585
+ definition: {
586
+ type: "struct",
587
+ packed: false,
588
+ fixedAbi: {},
589
+ fields: [
590
+ { name: "mode", definition: types.UInt32 },
591
+ { name: "rdev", definition: types.UInt32 },
592
+ { name: "umask", definition: types.UInt32 },
593
+ { name: "padding", definition: types.UInt32 },
594
+ ],
595
+ },
596
+ }).parser({ abi });
597
+
598
+ const fuseRenameInParser/*: TStructParser<TFuseRenameInValue>*/ = define({
599
+ definition: {
600
+ type: "struct",
601
+ packed: false,
602
+ fixedAbi: {},
603
+ fields: [
604
+ { name: "newdir", definition: types.UInt64 },
605
+ ],
606
+ },
607
+ }).parser({ abi });
608
+
609
+ const fuseRename2InParser/*: TStructParser<TFuseRename2InValue>*/ = define({
610
+ definition: {
611
+ type: "struct",
612
+ packed: false,
613
+ fixedAbi: {},
614
+ fields: [
615
+ { name: "newdir", definition: types.UInt64 },
616
+ { name: "flags", definition: types.UInt32 },
617
+ { name: "padding", definition: types.UInt32 },
618
+ ],
619
+ },
620
+ }).parser({ abi });
621
+
622
+ const fuseLinkInParser/*: TStructParser<TFuseLinkInValue>*/ = define({
623
+ definition: {
624
+ type: "struct",
625
+ packed: false,
626
+ fixedAbi: {},
627
+ fields: [
628
+ { name: "oldnodeid", definition: types.UInt64 },
629
+ ],
630
+ },
631
+ }).parser({ abi });
632
+
633
+ const fuseLkInParser/*: TStructParser<TFuseLkInValue>*/ = define({
634
+ definition: {
635
+ type: "struct",
636
+ packed: false,
637
+ fixedAbi: {},
638
+ fields: [
639
+ { name: "fh", definition: types.UInt64 },
640
+ { name: "owner", definition: types.UInt64 },
641
+ { name: "lk", definition: fuseFileLockDefinition },
642
+ { name: "lk_flags", definition: types.UInt32 },
643
+ { name: "padding", definition: types.UInt32 },
644
+ ],
645
+ },
646
+ }).parser({ abi });
647
+
648
+ const fuseLkOutParser/*: TStructParser<TFuseLkOutValue>*/ = define({
649
+ definition: {
650
+ type: "struct",
651
+ packed: false,
652
+ fixedAbi: {},
653
+ fields: [
654
+ { name: "lk", definition: fuseFileLockDefinition },
655
+ ],
656
+ },
657
+ }).parser({ abi });
658
+
659
+ const fuseInterruptInParser/*: TStructParser<TFuseInterruptInValue>*/ = define({
660
+ definition: {
661
+ type: "struct",
662
+ packed: false,
663
+ fixedAbi: {},
664
+ fields: [
665
+ { name: "unique", definition: types.UInt64 },
666
+ ],
667
+ },
668
+ }).parser({ abi });
669
+
670
+ const fuseBmapInParser/*: TStructParser<TFuseBmapInValue>*/ = define({
671
+ definition: {
672
+ type: "struct",
673
+ packed: false,
674
+ fixedAbi: {},
675
+ fields: [
676
+ { name: "block", definition: types.UInt64 },
677
+ { name: "blocksize", definition: types.UInt32 },
678
+ { name: "padding", definition: types.UInt32 },
679
+ ],
680
+ },
681
+ }).parser({ abi });
682
+
683
+ const fuseBmapOutParser/*: TStructParser<TFuseBmapOutValue>*/ = define({
684
+ definition: {
685
+ type: "struct",
686
+ packed: false,
687
+ fixedAbi: {},
688
+ fields: [
689
+ { name: "block", definition: types.UInt64 },
690
+ ],
691
+ },
692
+ }).parser({ abi });
693
+
694
+ const fuseIoctlInParser/*: TStructParser<TFuseIoctlInValue>*/ = define({
695
+ definition: {
696
+ type: "struct",
697
+ packed: false,
698
+ fixedAbi: {},
699
+ fields: [
700
+ { name: "fh", definition: types.UInt64 },
701
+ { name: "flags", definition: types.UInt32 },
702
+ { name: "cmd", definition: types.UInt32 },
703
+ { name: "arg", definition: types.UInt64 },
704
+ { name: "in_size", definition: types.UInt32 },
705
+ { name: "out_size", definition: types.UInt32 },
706
+ ],
707
+ },
708
+ }).parser({ abi });
709
+
710
+ const fuseIoctlOutParser/*: TStructParser<TFuseIoctlOutValue>*/ = define({
711
+ definition: {
712
+ type: "struct",
713
+ packed: false,
714
+ fixedAbi: {},
715
+ fields: [
716
+ { name: "result", definition: types.Int32 },
717
+ { name: "flags", definition: types.UInt32 },
718
+ { name: "in_iovs", definition: types.UInt32 },
719
+ { name: "out_iovs", definition: types.UInt32 },
720
+ ],
721
+ },
722
+ }).parser({ abi });
723
+
724
+ const fusePollInParser/*: TStructParser<TFusePollInValue>*/ = define({
725
+ definition: {
726
+ type: "struct",
727
+ packed: false,
728
+ fixedAbi: {},
729
+ fields: [
730
+ { name: "fh", definition: types.UInt64 },
731
+ { name: "kh", definition: types.UInt64 },
732
+ { name: "flags", definition: types.UInt32 },
733
+ { name: "events", definition: types.UInt32 },
734
+ ],
735
+ },
736
+ }).parser({ abi });
737
+
738
+ const fusePollOutParser/*: TStructParser<TFusePollOutValue>*/ = define({
739
+ definition: {
740
+ type: "struct",
741
+ packed: false,
742
+ fixedAbi: {},
743
+ fields: [
744
+ { name: "revents", definition: types.UInt32 },
745
+ { name: "padding", definition: types.UInt32 },
746
+ ],
747
+ },
748
+ }).parser({ abi });
749
+
750
+ const fuseFallocateInParser/*: TStructParser<TFuseFallocateInValue>*/ = define({
751
+ definition: {
752
+ type: "struct",
753
+ packed: false,
754
+ fixedAbi: {},
755
+ fields: [
756
+ { name: "fh", definition: types.UInt64 },
757
+ { name: "offset", definition: types.UInt64 },
758
+ { name: "length", definition: types.UInt64 },
759
+ { name: "mode", definition: types.UInt32 },
760
+ { name: "padding", definition: types.UInt32 },
761
+ ],
762
+ },
763
+ }).parser({ abi });
764
+
765
+ const fuseForgetInParser/*: TStructParser<TFuseForgetInValue>*/ = define({
766
+ definition: {
767
+ type: "struct",
768
+ packed: false,
769
+ fixedAbi: {},
770
+ fields: [
771
+ { name: "nlookup", definition: types.UInt64 },
772
+ ],
773
+ },
774
+ }).parser({ abi });
775
+
776
+ const fuseBatchForgetInParser/*: TStructParser<TFuseBatchForgetInValue>*/ = define({
777
+ definition: {
778
+ type: "struct",
779
+ packed: false,
780
+ fixedAbi: {},
781
+ fields: [
782
+ { name: "count", definition: types.UInt32 },
783
+ { name: "dummy", definition: types.UInt32 },
784
+ ],
785
+ },
786
+ }).parser({ abi });
787
+
788
+ const fuseForgetOneParser/*: TStructParser<TFuseForgetOneValue>*/ = define({
789
+ definition: {
790
+ type: "struct",
791
+ packed: false,
792
+ fixedAbi: {},
793
+ fields: [
794
+ { name: "nodeid", definition: types.UInt64 },
795
+ { name: "nlookup", definition: types.UInt64 },
796
+ ],
797
+ },
798
+ }).parser({ abi });
799
+
800
+ const fuseAccessInParser/*: TStructParser<TFuseAccessInValue>*/ = define({
801
+ definition: {
802
+ type: "struct",
803
+ packed: false,
804
+ fixedAbi: {},
805
+ fields: [
806
+ { name: "mask", definition: types.UInt32 },
807
+ { name: "padding", definition: types.UInt32 },
808
+ ],
809
+ },
810
+ }).parser({ abi });
811
+
812
+ const fuseFsyncInParser/*: TStructParser<TFuseFsyncInValue>*/ = define({
813
+ definition: {
814
+ type: "struct",
815
+ packed: false,
816
+ fixedAbi: {},
817
+ fields: [
818
+ { name: "fh", definition: types.UInt64 },
819
+ { name: "fsync_flags", definition: types.UInt32 },
820
+ { name: "padding", definition: types.UInt32 },
821
+ ],
822
+ },
823
+ }).parser({ abi });
824
+
825
+ const fuseSetxattrInParser/*: TStructParser<TFuseSetxattrInValue>*/ = define({
826
+ definition: {
827
+ type: "struct",
828
+ packed: false,
829
+ fixedAbi: {},
830
+ fields: [
831
+ { name: "size", definition: types.UInt32 },
832
+ { name: "flags", definition: types.UInt32 },
833
+ { name: "setxattr_flags", definition: types.UInt32 },
834
+ { name: "padding", definition: types.UInt32 },
835
+ ],
836
+ },
837
+ }).parser({ abi });
838
+
839
+ const fuseInitInParser/*: TStructParser<TFuseInitInValue>*/ = define({
840
+ definition: {
841
+ type: "struct",
842
+ packed: false,
843
+ fixedAbi: {},
844
+ fields: [
845
+ { name: "major", definition: types.UInt32 },
846
+ { name: "minor", definition: types.UInt32 },
847
+ { name: "max_readahead", definition: types.UInt32 },
848
+ { name: "flags", definition: types.UInt32 },
849
+ { name: "flags2", definition: types.UInt32 },
850
+ { name: "unused", definition: uint32Array(11) },
851
+ ],
852
+ },
853
+ }).parser({ abi });
854
+
855
+ const fuseInitOutParser/*: TStructParser<TFuseInitOutValue>*/ = define({
856
+ definition: {
857
+ type: "struct",
858
+ packed: false,
859
+ fixedAbi: {},
860
+ fields: [
861
+ { name: "major", definition: types.UInt32 },
862
+ { name: "minor", definition: types.UInt32 },
863
+ { name: "max_readahead", definition: types.UInt32 },
864
+ { name: "flags", definition: types.UInt32 },
865
+ { name: "max_background", definition: types.UInt16 },
866
+ { name: "congestion_threshold", definition: types.UInt16 },
867
+ { name: "max_write", definition: types.UInt32 },
868
+ { name: "time_gran", definition: types.UInt32 },
869
+ { name: "max_pages", definition: types.UInt16 },
870
+ { name: "map_alignment", definition: types.UInt16 },
871
+ { name: "flags2", definition: types.UInt32 },
872
+ { name: "max_stack_depth", definition: types.UInt32 },
873
+ { name: "request_timeout", definition: types.UInt16 },
874
+ { name: "unused", definition: uint16Array(11) },
875
+ ],
876
+ },
877
+ }).parser({ abi });
878
+
879
+ const fuseStatfsOutParser/*: TStructParser<TFuseStatfsOutValue>*/ = define({
880
+ definition: {
881
+ type: "struct",
882
+ packed: false,
883
+ fixedAbi: {},
884
+ fields: [
885
+ { name: "st", definition: fuseKstatfsDefinition },
886
+ ],
887
+ },
888
+ }).parser({ abi });
889
+
890
+ const textEncoder = new TextEncoder();
891
+
892
+ const toCString = (value/*: string*/) => {
893
+ const encoded = textEncoder.encode(value);
894
+ const result = new Uint8Array(encoded.length + 1);
895
+ result.set(encoded, 0);
896
+ return result;
897
+ };
898
+
899
+ const textDecoder = new TextDecoder();
900
+
901
+ const decodeCString = (data/*: Uint8Array*/) => {
902
+ const nulIndex = data.indexOf(0);
903
+ const slice = nulIndex === -1 ? data : data.subarray(0, nulIndex);
904
+ return textDecoder.decode(slice);
905
+ };
906
+
907
+ const decodeCStringPair = (data/*: Uint8Array*/) => {
908
+ const firstTerminator = data.indexOf(0);
909
+ if (firstTerminator === -1) {
910
+ throw Error("expected first nul-terminated string");
911
+ }
912
+
913
+ const secondStart = firstTerminator + 1;
914
+ const secondTerminatorOffset = data.subarray(secondStart).indexOf(0);
915
+ if (secondTerminatorOffset === -1) {
916
+ throw Error("expected second nul-terminated string");
917
+ }
918
+
919
+ const secondTerminator = secondStart + secondTerminatorOffset;
920
+ return {
921
+ first: textDecoder.decode(data.subarray(0, firstTerminator)),
922
+ second: textDecoder.decode(data.subarray(secondStart, secondTerminator)),
923
+ };
924
+ };
925
+
926
+ export {
927
+
928
+ decodeCString,
929
+ decodeCStringPair,
930
+ toCString,
931
+
932
+ fuseAttrDefinition,
933
+ fuseCreateInParser,
934
+ fuseAttrOutParser,
935
+ fuseBatchForgetInParser,
936
+ fuseEntryOutParser,
937
+ fuseForgetInParser,
938
+ fuseForgetOneParser,
939
+ fuseGetattrInParser,
940
+ fuseGetxattrInParser,
941
+ fuseGetxattrOutParser,
942
+ fuseInHeaderParser,
943
+ fuseInitInParser,
944
+ fuseInitOutParser,
945
+ fuseAccessInParser,
946
+ fuseFlushInParser,
947
+ fuseKstatfsDefinition,
948
+ fuseMkdirInParser,
949
+ fuseMknodInParser,
950
+ fuseOpenInParser,
951
+ fuseOpenOutParser,
952
+ fuseOutHeaderParser,
953
+ fuseReadInParser,
954
+ fuseReleaseInParser,
955
+ fuseRename2InParser,
956
+ fuseRenameInParser,
957
+ fuseLinkInParser,
958
+ fuseLkInParser,
959
+ fuseLkOutParser,
960
+ fuseInterruptInParser,
961
+ fuseBmapInParser,
962
+ fuseBmapOutParser,
963
+ fuseIoctlInParser,
964
+ fuseIoctlOutParser,
965
+ fusePollInParser,
966
+ fusePollOutParser,
967
+ fuseFallocateInParser,
968
+ fuseSetattrInParser,
969
+ fuseSetxattrInParser,
970
+ fuseStatfsOutParser,
971
+ fuseWriteInParser,
972
+ fuseWriteOutParser,
973
+ fuseFsyncInParser,
974
+ };
975
+
976
+ /*export type {
977
+ TFuseInHeaderValue,
978
+ TFuseOutHeaderValue,
979
+ TFuseEntryOutValue,
980
+ TFuseAttrValue,
981
+ TFuseGetattrInValue,
982
+ TFuseAttrOutValue,
983
+ TFuseSetattrInValue,
984
+ TFuseOpenInValue,
985
+ TFuseGetxattrInValue,
986
+ TFuseGetxattrOutValue,
987
+ TFuseCreateInValue,
988
+ TFuseOpenOutValue,
989
+ TFuseReleaseInValue,
990
+ TFuseFlushInValue,
991
+ TFuseReadInValue,
992
+ TFuseWriteInValue,
993
+ TFuseWriteOutValue,
994
+ TFuseMkdirInValue,
995
+ TFuseMknodInValue,
996
+ TFuseRenameInValue,
997
+ TFuseRename2InValue,
998
+ TFuseLinkInValue,
999
+ TFuseForgetInValue,
1000
+ TFuseBatchForgetInValue,
1001
+ TFuseForgetOneValue,
1002
+ TFuseAccessInValue,
1003
+ TFuseFsyncInValue,
1004
+ TFuseSetxattrInValue,
1005
+ TFuseInitInValue,
1006
+ TFuseInitOutValue,
1007
+ TFuseStatfsOutValue,
1008
+ TFuseFileLockValue,
1009
+ TFuseLkInValue,
1010
+ TFuseLkOutValue,
1011
+ TFuseInterruptInValue,
1012
+ TFuseBmapInValue,
1013
+ TFuseBmapOutValue,
1014
+ TFuseIoctlInValue,
1015
+ TFuseIoctlOutValue,
1016
+ TFusePollInValue,
1017
+ TFusePollOutValue,
1018
+ TFuseFallocateInValue,
1019
+ };*/