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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
use std::ffi::OsStr;
use std::pin::Pin;
use async_trait::async_trait;
use bytes::Bytes;
use futures_util::stream::Stream;
use super::Filesystem;
use crate::notify::Notify;
use crate::raw::reply::*;
use crate::raw::request::Request;
use crate::{Inode, Result, SetAttr};
pub type DirectoryStream<'a> = Pin<Box<dyn Stream<Item = Result<DirectoryEntry>> + Send + 'a>>;
pub type DirectoryPlusStream<'a> =
Pin<Box<dyn Stream<Item = Result<DirectoryEntryPlus>> + Send + 'a>>;
fn box_directory_stream<'a, S>(stream: S) -> DirectoryStream<'a>
where
S: Stream<Item = Result<DirectoryEntry>> + Send + 'a,
{
Box::pin(stream) as DirectoryStream<'a>
}
fn box_directory_plus_stream<'a, S>(stream: S) -> DirectoryPlusStream<'a>
where
S: Stream<Item = Result<DirectoryEntryPlus>> + Send + 'a,
{
Box::pin(stream) as DirectoryPlusStream<'a>
}
#[allow(unused_variables)]
#[async_trait]
/// Object-safe variant of [`Filesystem`] with boxed async outputs.
pub trait ObjectSafeFilesystem: Send + Sync {
/// initialize filesystem. Called before any other filesystem method.
async fn init(&self, req: Request) -> Result<ReplyInit>;
/// clean up filesystem. Called on filesystem exit which is fuseblk, in normal fuse filesystem,
/// kernel may call forget for root. There is some discuss for this
/// <https://github.com/bazil/fuse/issues/82#issuecomment-88126886>,
/// <https://sourceforge.net/p/fuse/mailman/message/31995737/>
async fn destroy(&self, req: Request);
/// look up a directory entry by name and get its attributes.
async fn lookup(&self, req: Request, parent: Inode, name: &OsStr) -> Result<ReplyEntry> {
Err(libc::ENOSYS.into())
}
/// forget an inode. The nlookup parameter indicates the number of lookups previously
/// performed on this inode. If the filesystem implements inode lifetimes, it is recommended
/// that inodes acquire a single reference on each lookup, and lose nlookup references on each
/// forget. The filesystem may ignore forget calls, if the inodes don't need to have a limited
/// lifetime. On unmount it is not guaranteed, that all referenced inodes will receive a forget
/// message. When filesystem is normal(not fuseblk) and unmounting, kernel may send forget
/// request for root and this library will stop session after call forget. There is some
/// discussion for this <https://github.com/bazil/fuse/issues/82#issuecomment-88126886>,
/// <https://sourceforge.net/p/fuse/mailman/message/31995737/>
async fn forget(&self, req: Request, inode: Inode, nlookup: u64) {}
/// get file attributes. If `fh` is None, means `fh` is not set.
async fn getattr(
&self,
req: Request,
inode: Inode,
fh: Option<u64>,
flags: u32,
) -> Result<ReplyAttr> {
Err(libc::ENOSYS.into())
}
/// set file attributes. If `fh` is None, means `fh` is not set.
async fn setattr(
&self,
req: Request,
inode: Inode,
fh: Option<u64>,
set_attr: SetAttr,
) -> Result<ReplyAttr> {
Err(libc::ENOSYS.into())
}
/// read symbolic link.
async fn readlink(&self, req: Request, inode: Inode) -> Result<ReplyData> {
Err(libc::ENOSYS.into())
}
/// create a symbolic link.
async fn symlink(
&self,
req: Request,
parent: Inode,
name: &OsStr,
link: &OsStr,
) -> Result<ReplyEntry> {
Err(libc::ENOSYS.into())
}
/// create file node. Create a regular file, character device, block device, fifo or socket
/// node. When creating file, most cases user only need to implement
/// [`create`][Filesystem::create].
async fn mknod(
&self,
req: Request,
parent: Inode,
name: &OsStr,
mode: u32,
rdev: u32,
) -> Result<ReplyEntry> {
Err(libc::ENOSYS.into())
}
/// create a directory.
async fn mkdir(
&self,
req: Request,
parent: Inode,
name: &OsStr,
mode: u32,
umask: u32,
) -> Result<ReplyEntry> {
Err(libc::ENOSYS.into())
}
/// remove a file.
async fn unlink(&self, req: Request, parent: Inode, name: &OsStr) -> Result<()> {
Err(libc::ENOSYS.into())
}
/// remove a directory.
async fn rmdir(&self, req: Request, parent: Inode, name: &OsStr) -> Result<()> {
Err(libc::ENOSYS.into())
}
/// rename a file or directory.
async fn rename(
&self,
req: Request,
parent: Inode,
name: &OsStr,
new_parent: Inode,
new_name: &OsStr,
) -> Result<()> {
Err(libc::ENOSYS.into())
}
/// create a hard link.
async fn link(
&self,
req: Request,
inode: Inode,
new_parent: Inode,
new_name: &OsStr,
) -> Result<ReplyEntry> {
Err(libc::ENOSYS.into())
}
/// open a file. Open flags (with the exception of `O_CREAT`, `O_EXCL` and `O_NOCTTY`) are
/// available in flags. Filesystem may store an arbitrary file handle (pointer, index, etc) in
/// fh, and use this in other all other file operations (read, write, flush, release, fsync).
/// Filesystem may also implement stateless file I/O and not store anything in fh. There are
/// also some flags (`direct_io`, `keep_cache`) which the filesystem may set, to change the way
/// the file is opened. A filesystem need not implement this method if it
/// sets [`MountOptions::no_open_support`][crate::MountOptions::no_open_support] and if the
/// kernel supports `FUSE_NO_OPEN_SUPPORT`.
///
/// # Notes:
///
/// See `fuse_file_info` structure in
/// [fuse_common.h](https://libfuse.github.io/doxygen/include_2fuse__common_8h_source.html) for
/// more details.
async fn open(&self, req: Request, inode: Inode, flags: u32) -> Result<ReplyOpen> {
Err(libc::ENOSYS.into())
}
/// read data. Read should send exactly the number of bytes requested except on EOF or error,
/// otherwise the rest of the data will be substituted with zeroes. An exception to this is
/// when the file has been opened in `direct_io` mode, in which case the return value of the
/// read system call will reflect the return value of this operation. `fh` will contain the
/// value set by the open method, or will be undefined if the open method didn't set any value.
async fn read(
&self,
req: Request,
inode: Inode,
fh: u64,
offset: u64,
size: u32,
) -> Result<ReplyData> {
Err(libc::ENOSYS.into())
}
/// write data. Write should return exactly the number of bytes requested except on error. An
/// exception to this is when the file has been opened in `direct_io` mode, in which case the
/// return value of the write system call will reflect the return value of this operation. `fh`
/// will contain the value set by the open method, or will be undefined if the open method
/// didn't set any value. When `write_flags` contains
/// [`FUSE_WRITE_CACHE`](crate::raw::flags::FUSE_WRITE_CACHE), means the write operation is a
/// delay write.
#[allow(clippy::too_many_arguments)]
async fn write(
&self,
req: Request,
inode: Inode,
fh: u64,
offset: u64,
data: &[u8],
write_flags: u32,
flags: u32,
) -> Result<ReplyWrite> {
Err(libc::ENOSYS.into())
}
/// get filesystem statistics.
async fn statfs(&self, req: Request, inode: Inode) -> Result<ReplyStatFs> {
Err(libc::ENOSYS.into())
}
/// release an open file. Release is called when there are no more references to an open file:
/// all file descriptors are closed and all memory mappings are unmapped. For every open call
/// there will be exactly one release call. The filesystem may reply with an error, but error
/// values are not returned to `close()` or `munmap()` which triggered the release. `fh` will
/// contain the value set by the open method, or will be undefined if the open method didn't
/// set any value. `flags` will contain the same flags as for open. `flush` means flush the
/// data or not when closing file.
async fn release(
&self,
req: Request,
inode: Inode,
fh: u64,
flags: u32,
lock_owner: u64,
flush: bool,
) -> Result<()> {
Err(libc::ENOSYS.into())
}
/// synchronize file contents. If the `datasync` is true, then only the user data should be
/// flushed, not the metadata.
async fn fsync(&self, req: Request, inode: Inode, fh: u64, datasync: bool) -> Result<()> {
Ok(())
}
/// set an extended attribute.
async fn setxattr(
&self,
req: Request,
inode: Inode,
name: &OsStr,
value: &[u8],
flags: u32,
position: u32,
) -> Result<()> {
Err(libc::ENOSYS.into())
}
/// Get an extended attribute. If `size` is too small, return `Err<ERANGE>`.
/// Otherwise, use [`ReplyXAttr::Data`] to send the attribute data, or
/// return an error.
async fn getxattr(
&self,
req: Request,
inode: Inode,
name: &OsStr,
size: u32,
) -> Result<ReplyXAttr> {
Err(libc::ENOSYS.into())
}
/// List extended attribute names.
///
/// If `size` is too small, return `Err<ERANGE>`. Otherwise, use
/// [`ReplyXAttr::Data`] to send the attribute list, or return an error.
async fn listxattr(&self, req: Request, inode: Inode, size: u32) -> Result<ReplyXAttr> {
Err(libc::ENOSYS.into())
}
/// remove an extended attribute.
async fn removexattr(&self, req: Request, inode: Inode, name: &OsStr) -> Result<()> {
Err(libc::ENOSYS.into())
}
/// flush method. This is called on each `close()` of the opened file. Since file descriptors
/// can be duplicated (`dup`, `dup2`, `fork`), for one open call there may be many flush calls.
/// Filesystems shouldn't assume that flush will always be called after some writes, or that if
/// will be called at all. `fh` will contain the value set by the open method, or will be
/// undefined if the open method didn't set any value.
///
/// # Notes:
///
/// the name of the method is misleading, since (unlike fsync) the filesystem is not forced to
/// flush pending writes. One reason to flush data, is if the filesystem wants to return write
/// errors. If the filesystem supports file locking operations ([`setlk`][Filesystem::setlk],
/// [`getlk`][Filesystem::getlk]) it should remove all locks belonging to `lock_owner`.
async fn flush(&self, req: Request, inode: Inode, fh: u64, lock_owner: u64) -> Result<()> {
Err(libc::ENOSYS.into())
}
/// open a directory. Filesystem may store an arbitrary file handle (pointer, index, etc) in
/// `fh`, and use this in other all other directory stream operations
/// ([`readdir`][Filesystem::readdir], [`releasedir`][Filesystem::releasedir],
/// [`fsyncdir`][Filesystem::fsyncdir]). Filesystem may also implement stateless directory
/// I/O and not store anything in `fh`. A file system need not implement this method if it
/// sets [`MountOptions::no_open_dir_support`][crate::MountOptions::no_open_dir_support] and
/// if the kernel supports `FUSE_NO_OPENDIR_SUPPORT`.
async fn opendir(&self, req: Request, inode: Inode, flags: u32) -> Result<ReplyOpen> {
Err(libc::ENOSYS.into())
}
/// read directory. `offset` is used to track the offset of the directory entries. `fh` will
/// contain the value set by the [`opendir`][Filesystem::opendir] method, or will be
/// undefined if the [`opendir`][Filesystem::opendir] method didn't set any value.
async fn readdir<'a>(
&'a self,
req: Request,
parent: Inode,
fh: u64,
offset: i64,
) -> Result<ReplyDirectory<DirectoryStream<'a>>> {
Err(libc::ENOSYS.into())
}
/// release an open directory. For every [`opendir`][Filesystem::opendir] call there will
/// be exactly one `releasedir` call. `fh` will contain the value set by the
/// [`opendir`][Filesystem::opendir] method, or will be undefined if the
/// [`opendir`][Filesystem::opendir] method didn't set any value.
async fn releasedir(&self, req: Request, inode: Inode, fh: u64, flags: u32) -> Result<()> {
Ok(())
}
/// synchronize directory contents. If the `datasync` is true, then only the directory contents
/// should be flushed, not the metadata. `fh` will contain the value set by the
/// [`opendir`][Filesystem::opendir] method, or will be undefined if the
/// [`opendir`][Filesystem::opendir] method didn't set any value.
async fn fsyncdir(&self, req: Request, inode: Inode, fh: u64, datasync: bool) -> Result<()> {
Err(libc::ENOSYS.into())
}
#[cfg(feature = "file-lock")]
/// test for a POSIX file lock.
///
/// # Notes:
///
/// this is supported on enable **`file-lock`** feature.
#[allow(clippy::too_many_arguments)]
async fn getlk(
&self,
req: Request,
inode: Inode,
fh: u64,
lock_owner: u64,
start: u64,
end: u64,
r#type: u32,
pid: u32,
) -> Result<ReplyLock>;
#[cfg(feature = "file-lock")]
/// acquire, modify or release a POSIX file lock.
///
/// # Notes:
///
/// this is supported on enable **`file-lock`** feature.
#[allow(clippy::too_many_arguments)]
async fn setlk(
&self,
req: Request,
inode: Inode,
fh: u64,
lock_owner: u64,
start: u64,
end: u64,
r#type: u32,
pid: u32,
block: bool,
) -> Result<()>;
/// check file access permissions. This will be called for the `access()` system call. If the
/// `default_permissions` mount option is given, this method is not be called. This method is
/// not called under Linux kernel versions 2.4.x.
async fn access(&self, req: Request, inode: Inode, mask: u32) -> Result<()> {
Err(libc::ENOSYS.into())
}
/// create and open a file. If the file does not exist, first create it with the specified
/// mode, and then open it. Open flags (with the exception of `O_NOCTTY`) are available in
/// flags. Filesystem may store an arbitrary file handle (pointer, index, etc) in `fh`, and use
/// this in other all other file operations ([`read`][Filesystem::read],
/// [`write`][Filesystem::write], [`flush`][Filesystem::flush],
/// [`release`][Filesystem::release], [`fsync`][Filesystem::fsync]). There are also some flags
/// (`direct_io`, `keep_cache`) which the filesystem may set, to change the way the file is
/// opened. If this method is not implemented or under Linux kernel versions earlier than
/// 2.6.15, the [`mknod`][Filesystem::mknod] and [`open`][Filesystem::open] methods will be
/// called instead.
///
/// # Notes:
///
/// See `fuse_file_info` structure in
/// [fuse_common.h](https://libfuse.github.io/doxygen/include_2fuse__common_8h_source.html) for
/// more details.
async fn create(
&self,
req: Request,
parent: Inode,
name: &OsStr,
mode: u32,
flags: u32,
) -> Result<ReplyCreated> {
Err(libc::ENOSYS.into())
}
/// handle interrupt. When a operation is interrupted, an interrupt request will send to fuse
/// server with the unique id of the operation.
async fn interrupt(&self, req: Request, unique: u64) -> Result<()> {
Err(libc::ENOSYS.into())
}
/// map block index within file to block index within device.
///
/// # Notes:
///
/// This may not works because currently this crate doesn't support fuseblk mode yet.
async fn bmap(
&self,
req: Request,
inode: Inode,
blocksize: u32,
idx: u64,
) -> Result<ReplyBmap> {
Err(libc::ENOSYS.into())
}
/// poll for IO readiness events.
#[allow(clippy::too_many_arguments)]
async fn poll(
&self,
req: Request,
inode: Inode,
fh: u64,
kh: Option<u64>,
flags: u32,
events: u32,
notify: &Notify,
) -> Result<ReplyPoll> {
Err(libc::ENOSYS.into())
}
/// receive notify reply from kernel.
async fn notify_reply(
&self,
req: Request,
inode: Inode,
offset: u64,
data: Bytes,
) -> Result<()> {
Err(libc::ENOSYS.into())
}
/// forget more than one inode. This is a batch version [`forget`][Filesystem::forget]
/// (Inode ,Vlookup)
async fn batch_forget(&self, req: Request, inodes: &[(Inode, u64)]) {}
/// allocate space for an open file. This function ensures that required space is allocated for
/// specified file.
///
/// # Notes:
///
/// more information about `fallocate`, please see **`man 2 fallocate`**
async fn fallocate(
&self,
req: Request,
inode: Inode,
fh: u64,
offset: u64,
length: u64,
mode: u32,
) -> Result<()> {
Err(libc::ENOSYS.into())
}
/// read directory entries, but with their attribute, like [`readdir`][Filesystem::readdir]
/// + [`lookup`][Filesystem::lookup] at the same time.
async fn readdirplus<'a>(
&'a self,
req: Request,
parent: Inode,
fh: u64,
offset: u64,
lock_owner: u64,
) -> Result<ReplyDirectoryPlus<DirectoryPlusStream<'a>>> {
Err(libc::ENOSYS.into())
}
/// rename a file or directory with flags.
async fn rename2(
&self,
req: Request,
parent: Inode,
name: &OsStr,
new_parent: Inode,
new_name: &OsStr,
flags: u32,
) -> Result<()> {
Err(libc::ENOSYS.into())
}
/// find next data or hole after the specified offset.
async fn lseek(
&self,
req: Request,
inode: Inode,
fh: u64,
offset: u64,
whence: u32,
) -> Result<ReplyLSeek> {
Err(libc::ENOSYS.into())
}
/// copy a range of data from one file to another. This can improve performance because it
/// reduce data copy: in normal, data will copy from FUSE server to kernel, then to user-space,
/// then to kernel, finally send back to FUSE server. By implement this method, data will only
/// copy in FUSE server internal.
#[allow(clippy::too_many_arguments)]
async fn copy_file_range(
&self,
req: Request,
inode: Inode,
fh_in: u64,
off_in: u64,
inode_out: Inode,
fh_out: u64,
off_out: u64,
length: u64,
flags: u64,
) -> Result<ReplyCopyFileRange> {
Err(libc::ENOSYS.into())
}
#[cfg(target_os = "macos")]
async fn setvolname(&self, req: Request, name: &OsStr) -> Result<()> {
Err(libc::ENOSYS.into())
}
#[cfg(target_os = "macos")]
async fn getxtimes(&self, req: Request, inode: Inode) -> Result<ReplyXTimes> {
Err(libc::ENOSYS.into())
}
#[cfg(target_os = "macos")]
async fn exchange(
&self,
req: Request,
olddir: Inode,
oldname: &OsStr,
newdir: Inode,
newname: &OsStr,
options: u64,
) -> Result<()> {
Err(libc::ENOSYS.into())
}
}
#[async_trait]
impl<T> ObjectSafeFilesystem for T
where
T: Filesystem + Send + Sync,
{
async fn init(&self, req: Request) -> Result<ReplyInit> {
Filesystem::init(self, req).await
}
async fn destroy(&self, req: Request) {
Filesystem::destroy(self, req).await
}
async fn lookup(&self, req: Request, parent: Inode, name: &OsStr) -> Result<ReplyEntry> {
Filesystem::lookup(self, req, parent, name).await
}
async fn forget(&self, req: Request, inode: Inode, nlookup: u64) {
Filesystem::forget(self, req, inode, nlookup).await
}
async fn getattr(
&self,
req: Request,
inode: Inode,
fh: Option<u64>,
flags: u32,
) -> Result<ReplyAttr> {
Filesystem::getattr(self, req, inode, fh, flags).await
}
async fn setattr(
&self,
req: Request,
inode: Inode,
fh: Option<u64>,
set_attr: SetAttr,
) -> Result<ReplyAttr> {
Filesystem::setattr(self, req, inode, fh, set_attr).await
}
async fn readlink(&self, req: Request, inode: Inode) -> Result<ReplyData> {
Filesystem::readlink(self, req, inode).await
}
async fn symlink(
&self,
req: Request,
parent: Inode,
name: &OsStr,
link: &OsStr,
) -> Result<ReplyEntry> {
Filesystem::symlink(self, req, parent, name, link).await
}
async fn mknod(
&self,
req: Request,
parent: Inode,
name: &OsStr,
mode: u32,
rdev: u32,
) -> Result<ReplyEntry> {
Filesystem::mknod(self, req, parent, name, mode, rdev).await
}
async fn mkdir(
&self,
req: Request,
parent: Inode,
name: &OsStr,
mode: u32,
umask: u32,
) -> Result<ReplyEntry> {
Filesystem::mkdir(self, req, parent, name, mode, umask).await
}
async fn unlink(&self, req: Request, parent: Inode, name: &OsStr) -> Result<()> {
Filesystem::unlink(self, req, parent, name).await
}
async fn rmdir(&self, req: Request, parent: Inode, name: &OsStr) -> Result<()> {
Filesystem::rmdir(self, req, parent, name).await
}
async fn rename(
&self,
req: Request,
parent: Inode,
name: &OsStr,
new_parent: Inode,
new_name: &OsStr,
) -> Result<()> {
Filesystem::rename(self, req, parent, name, new_parent, new_name).await
}
async fn link(
&self,
req: Request,
inode: Inode,
new_parent: Inode,
new_name: &OsStr,
) -> Result<ReplyEntry> {
Filesystem::link(self, req, inode, new_parent, new_name).await
}
async fn open(&self, req: Request, inode: Inode, flags: u32) -> Result<ReplyOpen> {
Filesystem::open(self, req, inode, flags).await
}
async fn read(
&self,
req: Request,
inode: Inode,
fh: u64,
offset: u64,
size: u32,
) -> Result<ReplyData> {
Filesystem::read(self, req, inode, fh, offset, size).await
}
async fn write(
&self,
req: Request,
inode: Inode,
fh: u64,
offset: u64,
data: &[u8],
write_flags: u32,
flags: u32,
) -> Result<ReplyWrite> {
Filesystem::write(self, req, inode, fh, offset, data, write_flags, flags).await
}
async fn statfs(&self, req: Request, inode: Inode) -> Result<ReplyStatFs> {
Filesystem::statfs(self, req, inode).await
}
async fn release(
&self,
req: Request,
inode: Inode,
fh: u64,
flags: u32,
lock_owner: u64,
flush: bool,
) -> Result<()> {
Filesystem::release(self, req, inode, fh, flags, lock_owner, flush).await
}
async fn fsync(&self, req: Request, inode: Inode, fh: u64, datasync: bool) -> Result<()> {
Filesystem::fsync(self, req, inode, fh, datasync).await
}
async fn setxattr(
&self,
req: Request,
inode: Inode,
name: &OsStr,
value: &[u8],
flags: u32,
position: u32,
) -> Result<()> {
Filesystem::setxattr(self, req, inode, name, value, flags, position).await
}
async fn getxattr(
&self,
req: Request,
inode: Inode,
name: &OsStr,
size: u32,
) -> Result<ReplyXAttr> {
Filesystem::getxattr(self, req, inode, name, size).await
}
async fn listxattr(&self, req: Request, inode: Inode, size: u32) -> Result<ReplyXAttr> {
Filesystem::listxattr(self, req, inode, size).await
}
async fn removexattr(&self, req: Request, inode: Inode, name: &OsStr) -> Result<()> {
Filesystem::removexattr(self, req, inode, name).await
}
async fn flush(&self, req: Request, inode: Inode, fh: u64, lock_owner: u64) -> Result<()> {
Filesystem::flush(self, req, inode, fh, lock_owner).await
}
async fn opendir(&self, req: Request, inode: Inode, flags: u32) -> Result<ReplyOpen> {
Filesystem::opendir(self, req, inode, flags).await
}
async fn readdir<'a>(
&'a self,
req: Request,
parent: Inode,
fh: u64,
offset: i64,
) -> Result<ReplyDirectory<DirectoryStream<'a>>> {
let reply = Filesystem::readdir(self, req, parent, fh, offset).await?;
Ok(ReplyDirectory {
entries: box_directory_stream(reply.entries),
})
}
async fn releasedir(&self, req: Request, inode: Inode, fh: u64, flags: u32) -> Result<()> {
Filesystem::releasedir(self, req, inode, fh, flags).await
}
async fn fsyncdir(&self, req: Request, inode: Inode, fh: u64, datasync: bool) -> Result<()> {
Filesystem::fsyncdir(self, req, inode, fh, datasync).await
}
#[cfg(feature = "file-lock")]
async fn getlk(
&self,
req: Request,
inode: Inode,
fh: u64,
lock_owner: u64,
start: u64,
end: u64,
r#type: u32,
pid: u32,
) -> Result<ReplyLock> {
Filesystem::getlk(self, req, inode, fh, lock_owner, start, end, r#type, pid).await
}
#[cfg(feature = "file-lock")]
async fn setlk(
&self,
req: Request,
inode: Inode,
fh: u64,
lock_owner: u64,
start: u64,
end: u64,
r#type: u32,
pid: u32,
block: bool,
) -> Result<()> {
Filesystem::setlk(
self, req, inode, fh, lock_owner, start, end, r#type, pid, block,
)
.await
}
async fn access(&self, req: Request, inode: Inode, mask: u32) -> Result<()> {
Filesystem::access(self, req, inode, mask).await
}
async fn create(
&self,
req: Request,
parent: Inode,
name: &OsStr,
mode: u32,
flags: u32,
) -> Result<ReplyCreated> {
Filesystem::create(self, req, parent, name, mode, flags).await
}
async fn interrupt(&self, req: Request, unique: u64) -> Result<()> {
Filesystem::interrupt(self, req, unique).await
}
async fn bmap(
&self,
req: Request,
inode: Inode,
blocksize: u32,
idx: u64,
) -> Result<ReplyBmap> {
Filesystem::bmap(self, req, inode, blocksize, idx).await
}
async fn poll(
&self,
req: Request,
inode: Inode,
fh: u64,
kh: Option<u64>,
flags: u32,
events: u32,
notify: &Notify,
) -> Result<ReplyPoll> {
Filesystem::poll(self, req, inode, fh, kh, flags, events, notify).await
}
async fn notify_reply(
&self,
req: Request,
inode: Inode,
offset: u64,
data: Bytes,
) -> Result<()> {
Filesystem::notify_reply(self, req, inode, offset, data).await
}
async fn batch_forget(&self, req: Request, inodes: &[(Inode, u64)]) {
Filesystem::batch_forget(self, req, inodes).await
}
async fn fallocate(
&self,
req: Request,
inode: Inode,
fh: u64,
offset: u64,
length: u64,
mode: u32,
) -> Result<()> {
Filesystem::fallocate(self, req, inode, fh, offset, length, mode).await
}
async fn readdirplus<'a>(
&'a self,
req: Request,
parent: Inode,
fh: u64,
offset: u64,
lock_owner: u64,
) -> Result<ReplyDirectoryPlus<DirectoryPlusStream<'a>>> {
let reply = Filesystem::readdirplus(self, req, parent, fh, offset, lock_owner).await?;
Ok(ReplyDirectoryPlus {
entries: box_directory_plus_stream(reply.entries),
})
}
async fn rename2(
&self,
req: Request,
parent: Inode,
name: &OsStr,
new_parent: Inode,
new_name: &OsStr,
flags: u32,
) -> Result<()> {
Filesystem::rename2(self, req, parent, name, new_parent, new_name, flags).await
}
async fn lseek(
&self,
req: Request,
inode: Inode,
fh: u64,
offset: u64,
whence: u32,
) -> Result<ReplyLSeek> {
Filesystem::lseek(self, req, inode, fh, offset, whence).await
}
async fn copy_file_range(
&self,
req: Request,
inode: Inode,
fh_in: u64,
off_in: u64,
inode_out: Inode,
fh_out: u64,
off_out: u64,
length: u64,
flags: u64,
) -> Result<ReplyCopyFileRange> {
Filesystem::copy_file_range(
self, req, inode, fh_in, off_in, inode_out, fh_out, off_out, length, flags,
)
.await
}
#[cfg(target_os = "macos")]
async fn setvolname(&self, req: Request, name: &OsStr) -> Result<()> {
Filesystem::setvolname(self, req, name).await
}
#[cfg(target_os = "macos")]
async fn getxtimes(&self, req: Request, inode: Inode) -> Result<ReplyXTimes> {
Filesystem::getxtimes(self, req, inode).await
}
#[cfg(target_os = "macos")]
async fn exchange(
&self,
req: Request,
olddir: Inode,
oldname: &OsStr,
newdir: Inode,
newname: &OsStr,
options: u64,
) -> Result<()> {
Filesystem::exchange(self, req, olddir, oldname, newdir, newname, options).await
}
}