TianoCore EDK2 master
Loading...
Searching...
No Matches
IScsiInitiatorName.c
Go to the documentation of this file.
1
9#include "IScsiImpl.h"
10
11EFI_ISCSI_INITIATOR_NAME_PROTOCOL gIScsiInitiatorName = {
14};
15
42EFIAPI
45 IN OUT UINTN *BufferSize,
46 OUT VOID *Buffer
47 )
48{
49 EFI_STATUS Status;
50
51 if ((BufferSize == NULL) || (Buffer == NULL)) {
52 return EFI_INVALID_PARAMETER;
53 }
54
55 Status = gRT->GetVariable (
56 ISCSI_INITIATOR_NAME_VAR_NAME,
57 &gEfiIScsiInitiatorNameProtocolGuid,
58 NULL,
59 BufferSize,
60 Buffer
61 );
62
63 return Status;
64}
65
94EFIAPI
97 IN OUT UINTN *BufferSize,
98 IN VOID *Buffer
99 )
100{
101 EFI_STATUS Status;
102
103 if ((BufferSize == NULL) || (Buffer == NULL)) {
104 return EFI_INVALID_PARAMETER;
105 }
106
107 if (*BufferSize > ISCSI_NAME_MAX_SIZE) {
108 *BufferSize = ISCSI_NAME_MAX_SIZE;
109 return EFI_INVALID_PARAMETER;
110 }
111
112 //
113 // Only support iqn iSCSI names.
114 //
115 Status = IScsiNormalizeName ((CHAR8 *)Buffer, *BufferSize - 1);
116 if (EFI_ERROR (Status)) {
117 return Status;
118 }
119
120 Status = gRT->SetVariable (
121 ISCSI_INITIATOR_NAME_VAR_NAME,
122 &gEfiIScsiInitiatorNameProtocolGuid,
123 EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
124 *BufferSize,
125 Buffer
126 );
127
128 return Status;
129}
UINT64 UINTN
EFI_STATUS EFIAPI IScsiSetInitiatorName(IN EFI_ISCSI_INITIATOR_NAME_PROTOCOL *This, IN OUT UINTN *BufferSize, IN VOID *Buffer)
EFI_STATUS EFIAPI IScsiGetInitiatorName(IN EFI_ISCSI_INITIATOR_NAME_PROTOCOL *This, IN OUT UINTN *BufferSize, OUT VOID *Buffer)
EFI_STATUS IScsiNormalizeName(IN OUT CHAR8 *Name, IN UINTN Len)
Definition: IScsiProto.c:2006
EFI_RUNTIME_SERVICES * gRT
#define NULL
Definition: Base.h:319
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
#define EFI_VARIABLE_NON_VOLATILE