2 FUSE_FORGET wrapper for the Virtio Filesystem device.
4 Copyright (C) 2020, Red Hat, Inc.
6 SPDX-License-Identifier: BSD-2-Clause-Patent
9 #include "VirtioFsDxe.h"
12 Make the Virtio Filesysem device drop one reference count from a NodeId that
13 the driver looked up by filename.
15 Send the FUSE_FORGET request to the Virtio Filesysem device for this. Unlike
16 most other FUSE requests, FUSE_FORGET doesn't elicit a response, not even the
17 common VIRTIO_FS_FUSE_RESPONSE header.
19 The function may only be called after VirtioFsFuseInitSession() returns
20 successfully and before VirtioFsUninit() is called.
22 @param[in,out] VirtioFs The Virtio Filesystem device to send the FUSE_FORGET
23 request to. On output, the FUSE request counter
24 "VirtioFs->RequestId" will have been incremented.
26 @param[in] NodeId The inode number that the client learned by way of
27 lookup, and that the server should now un-reference
30 @retval EFI_SUCCESS The FUSE_FORGET request has been submitted.
32 @return Error codes propagated from VirtioFsSgListsValidate(),
33 VirtioFsFuseNewRequest(), VirtioFsSgListsSubmit().
37 IN OUT VIRTIO_FS
*VirtioFs
,
41 VIRTIO_FS_FUSE_REQUEST CommonReq
;
42 VIRTIO_FS_FUSE_FORGET_REQUEST ForgetReq
;
43 VIRTIO_FS_IO_VECTOR ReqIoVec
[2];
44 VIRTIO_FS_SCATTER_GATHER_LIST ReqSgList
;
48 // Set up the scatter-gather list (note: only request).
50 ReqIoVec
[0].Buffer
= &CommonReq
;
51 ReqIoVec
[0].Size
= sizeof CommonReq
;
52 ReqIoVec
[1].Buffer
= &ForgetReq
;
53 ReqIoVec
[1].Size
= sizeof ForgetReq
;
54 ReqSgList
.IoVec
= ReqIoVec
;
55 ReqSgList
.NumVec
= ARRAY_SIZE (ReqIoVec
);
58 // Validate the scatter-gather list (request only); calculate the total
61 Status
= VirtioFsSgListsValidate (VirtioFs
, &ReqSgList
, NULL
);
62 if (EFI_ERROR (Status
)) {
67 // Populate the common request header.
69 Status
= VirtioFsFuseNewRequest (
76 if (EFI_ERROR (Status
)) {
81 // Populate the FUSE_FORGET-specific fields.
83 ForgetReq
.NumberOfLookups
= 1;
86 // Submit the request. There's not going to be a response.
88 Status
= VirtioFsSgListsSubmit (VirtioFs
, &ReqSgList
, NULL
);