TianoCore EDK2 master
Loading...
Searching...
No Matches
FuseStatFs.c
Go to the documentation of this file.
1
9#include "VirtioFsDxe.h"
10
39 IN OUT VIRTIO_FS *VirtioFs,
40 IN UINT64 NodeId,
42 )
43{
44 VIRTIO_FS_FUSE_REQUEST CommonReq;
45 VIRTIO_FS_IO_VECTOR ReqIoVec[1];
47 VIRTIO_FS_FUSE_RESPONSE CommonResp;
48 VIRTIO_FS_IO_VECTOR RespIoVec[2];
50 EFI_STATUS Status;
51
52 //
53 // Set up the scatter-gather lists.
54 //
55 ReqIoVec[0].Buffer = &CommonReq;
56 ReqIoVec[0].Size = sizeof CommonReq;
57 ReqSgList.IoVec = ReqIoVec;
58 ReqSgList.NumVec = ARRAY_SIZE (ReqIoVec);
59
60 RespIoVec[0].Buffer = &CommonResp;
61 RespIoVec[0].Size = sizeof CommonResp;
62 RespIoVec[1].Buffer = FilesysAttr;
63 RespIoVec[1].Size = sizeof *FilesysAttr;
64 RespSgList.IoVec = RespIoVec;
65 RespSgList.NumVec = ARRAY_SIZE (RespIoVec);
66
67 //
68 // Validate the scatter-gather lists; calculate the total transfer sizes.
69 //
70 Status = VirtioFsSgListsValidate (VirtioFs, &ReqSgList, &RespSgList);
71 if (EFI_ERROR (Status)) {
72 return Status;
73 }
74
75 //
76 // Populate the common request header.
77 //
78 Status = VirtioFsFuseNewRequest (
79 VirtioFs,
80 &CommonReq,
81 ReqSgList.TotalSize,
82 VirtioFsFuseOpStatFs,
83 NodeId
84 );
85 if (EFI_ERROR (Status)) {
86 return Status;
87 }
88
89 //
90 // Submit the request.
91 //
92 Status = VirtioFsSgListsSubmit (VirtioFs, &ReqSgList, &RespSgList);
93 if (EFI_ERROR (Status)) {
94 return Status;
95 }
96
97 //
98 // Verify the response (all response buffers are fixed size).
99 //
100 Status = VirtioFsFuseCheckResponse (&RespSgList, CommonReq.Unique, NULL);
101 if (Status == EFI_DEVICE_ERROR) {
102 DEBUG ((
103 DEBUG_ERROR,
104 "%a: Label=\"%s\" NodeId=%Lu Errno=%d\n",
105 __func__,
106 VirtioFs->Label,
107 NodeId,
108 CommonResp.Error
109 ));
110 Status = VirtioFsErrnoToEfiStatus (CommonResp.Error);
111 }
112
113 return Status;
114}
EFI_STATUS VirtioFsFuseStatFs(IN OUT VIRTIO_FS *VirtioFs, IN UINT64 NodeId, OUT VIRTIO_FS_FUSE_STATFS_RESPONSE *FilesysAttr)
Definition: FuseStatFs.c:38
#define NULL
Definition: Base.h:319
#define ARRAY_SIZE(Array)
Definition: Base.h:1393
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
#define DEBUG(Expression)
Definition: DebugLib.h:434
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
EFI_STATUS VirtioFsFuseCheckResponse(IN VIRTIO_FS_SCATTER_GATHER_LIST *ResponseSgList, IN UINT64 RequestId, OUT UINTN *TailBufferFill)
Definition: Helpers.c:873
EFI_STATUS VirtioFsFuseNewRequest(IN OUT VIRTIO_FS *VirtioFs, OUT VIRTIO_FS_FUSE_REQUEST *Request, IN UINT32 RequestSize, IN VIRTIO_FS_FUSE_OPCODE Opcode, IN UINT64 NodeId)
Definition: Helpers.c:790
EFI_STATUS VirtioFsSgListsSubmit(IN OUT VIRTIO_FS *VirtioFs, IN OUT VIRTIO_FS_SCATTER_GATHER_LIST *RequestSgList, IN OUT VIRTIO_FS_SCATTER_GATHER_LIST *ResponseSgList OPTIONAL)
Definition: Helpers.c:538
EFI_STATUS VirtioFsErrnoToEfiStatus(IN INT32 Errno)
Definition: Helpers.c:991
EFI_STATUS VirtioFsSgListsValidate(IN VIRTIO_FS *VirtioFs, IN OUT VIRTIO_FS_SCATTER_GATHER_LIST *RequestSgList, IN OUT VIRTIO_FS_SCATTER_GATHER_LIST *ResponseSgList OPTIONAL)
Definition: Helpers.c:398