libefivar: Apply uncrustify changes

Apply uncrustify changes to .c/.h files.

Reduce the diffs with EDK2 to aid with future merges.  The
unconventional way we've imported this code makes using a vendor branch
to manage it at the very least tricky. Update FreeBSD-update to reflect
the slight shift in advise.

Reviewed by:	imp
Upstream Bug:	https://bugzilla.tianocore.org/show_bug.cgi?id=3737
Obtained from:	2f88bd3a12
Pull Request:   https://github.com/freebsd/freebsd-src/pull/581
This commit is contained in:
Jose Luis Duran 2022-02-23 22:23:57 -03:00 committed by Warner Losh
parent 60de142cfc
commit 5754f5823b
5 changed files with 1494 additions and 1449 deletions

View File

@ -1,6 +1,5 @@
$FreeBSD$
For the printing and parsing functionalit, we use the Tianocore routines directly.
For the printing and parsing functionality, we use the Tianocore routines
directly.
efivar-dp-format.c is a copy of MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
efivar-dp-parse.c is a copy of MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
@ -9,31 +8,30 @@ These files are first mechnaically processed with
sed -e "s/L'/'/;"'s/L"/"/g;s/%g/%36s/g;s/%a/%s/g;s/^VOID/static VOID/g;s/ *$//g'
for several reasons. We're moving from wide rotuines to narrow
routines. The UTC-2 this code is written for is a bad match for
wchar_t which is an int. It's a much better match for plain narrow
characters on FreeBSD. So we pretend that CHAR16 for these files is
really char * (ASCII).
for several reasons. We're moving from wide rotuines to narrow routines. The
UTC-2 this code is written for is a bad match for wchar_t which is an int. It's
a much better match for plain narrow characters on FreeBSD. So we pretend that
CHAR16 for these files is really char * (ASCII).
Next, we have have to convert the Unicode printf that this code
expects to FreeBSD's printf. %g means "Print the GUID" and %a means
"print the ASCII string." so we mechanically convert them. Once we've
done that we can compare efivar-dp-*.c to its source to see what's
changed. Because we go through this indirection, I've done that
outside of svn. To upgrade you have to do these files by hand. You
have to go through and make routines static.
Next, we have have to convert the Unicode printf that this code expects to
FreeBSD's printf. %g means "Print the GUID" and %a means "print the ASCII
string." so we mechanically convert them. Once we've done that we can compare
efivar-dp-*.c to its source to see what's changed. Because we go through this
indirection, I've done that outside of git. To upgrade you have to do these
files by hand. You have to go through and make routines static.
uefi-*.[ch] are internal routines to support this. They've been copied
from EDK2 as well, but in a more hap-hazard manner. This was a trade
off between ease of implementation / upgrade vs pulling in too much
since less than half of any file was needed.
uefi-*.[ch] are internal routines to support this. They've been copied from EDK2
as well, but in a more hap-hazard manner. This was a trade off between ease of
implementation / upgrade vs pulling in too much since less than half of any file
was needed.
efi-osdep.h shims the EDK2 types to FreeBSD's types. It's included by
ProcessorBind.h which EDK2 uses to define the CPU. We keep it separate
from uefi-dplib.h to allow better sharing.
ProcessorBind.h which EDK2 uses to define the CPU. We keep it separate from
uefi-dplib.h to allow better sharing.
uefi-dplib.h shims the EDK2 routines that are needed to FreeBSD's
routines. This is relatively easy since we map all the UCS-2 routines
to simple char * routines.
uefi-dplib.h shims the EDK2 routines that are needed to FreeBSD's routines. This
is relatively easy since we map all the UCS-2 routines to simple char *
routines.
RESIST THE URGE TO CLEAN UP THESE FILES.
RESIST THE URGE TO CLEAN UP THESE FILES. Except when such cleanups help with the
goal of keeping them in sync with EDK2.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -55,28 +55,27 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Library/PcdLib.h>
#include <IndustryStandard/Bluetooth.h>
#define IS_COMMA(a) ((a) == ',')
#define IS_HYPHEN(a) ((a) == '-')
#define IS_DOT(a) ((a) == '.')
#define IS_LEFT_PARENTH(a) ((a) == '(')
#define IS_RIGHT_PARENTH(a) ((a) == ')')
#define IS_SLASH(a) ((a) == '/')
#define IS_NULL(a) ((a) == '\0')
#define IS_COMMA(a) ((a) == ',')
#define IS_HYPHEN(a) ((a) == '-')
#define IS_DOT(a) ((a) == '.')
#define IS_LEFT_PARENTH(a) ((a) == '(')
#define IS_RIGHT_PARENTH(a) ((a) == ')')
#define IS_SLASH(a) ((a) == '/')
#define IS_NULL(a) ((a) == '\0')
//
// Private Data structure
//
typedef struct {
char *Str;
UINTN Count;
UINTN Capacity;
char *Str;
UINTN Count;
UINTN Capacity;
} POOL_PRINT;
typedef
EFI_DEVICE_PATH_PROTOCOL *
(*DEVICE_PATH_FROM_TEXT) (
IN char *Str
IN char *Str
);
typedef
@ -89,90 +88,90 @@ VOID
);
typedef struct {
UINT8 Type;
UINT8 SubType;
DEVICE_PATH_TO_TEXT Function;
UINT8 Type;
UINT8 SubType;
DEVICE_PATH_TO_TEXT Function;
} DEVICE_PATH_TO_TEXT_TABLE;
typedef struct {
UINT8 Type;
const char *Text;
UINT8 Type;
const char *Text;
} DEVICE_PATH_TO_TEXT_GENERIC_TABLE;
typedef struct {
const char *DevicePathNodeText;
DEVICE_PATH_FROM_TEXT Function;
const char *DevicePathNodeText;
DEVICE_PATH_FROM_TEXT Function;
} DEVICE_PATH_FROM_TEXT_TABLE;
typedef struct {
BOOLEAN ClassExist;
UINT8 Class;
BOOLEAN SubClassExist;
UINT8 SubClass;
BOOLEAN ClassExist;
UINT8 Class;
BOOLEAN SubClassExist;
UINT8 SubClass;
} USB_CLASS_TEXT;
#define USB_CLASS_AUDIO 1
#define USB_CLASS_CDCCONTROL 2
#define USB_CLASS_HID 3
#define USB_CLASS_IMAGE 6
#define USB_CLASS_PRINTER 7
#define USB_CLASS_MASS_STORAGE 8
#define USB_CLASS_HUB 9
#define USB_CLASS_CDCDATA 10
#define USB_CLASS_SMART_CARD 11
#define USB_CLASS_VIDEO 14
#define USB_CLASS_DIAGNOSTIC 220
#define USB_CLASS_WIRELESS 224
#define USB_CLASS_AUDIO 1
#define USB_CLASS_CDCCONTROL 2
#define USB_CLASS_HID 3
#define USB_CLASS_IMAGE 6
#define USB_CLASS_PRINTER 7
#define USB_CLASS_MASS_STORAGE 8
#define USB_CLASS_HUB 9
#define USB_CLASS_CDCDATA 10
#define USB_CLASS_SMART_CARD 11
#define USB_CLASS_VIDEO 14
#define USB_CLASS_DIAGNOSTIC 220
#define USB_CLASS_WIRELESS 224
#define USB_CLASS_RESERVE 254
#define USB_SUBCLASS_FW_UPDATE 1
#define USB_SUBCLASS_IRDA_BRIDGE 2
#define USB_SUBCLASS_TEST 3
#define USB_CLASS_RESERVE 254
#define USB_SUBCLASS_FW_UPDATE 1
#define USB_SUBCLASS_IRDA_BRIDGE 2
#define USB_SUBCLASS_TEST 3
#define RFC_1700_UDP_PROTOCOL 17
#define RFC_1700_TCP_PROTOCOL 6
#define RFC_1700_UDP_PROTOCOL 17
#define RFC_1700_TCP_PROTOCOL 6
#pragma pack(1)
typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
EFI_GUID Guid;
UINT8 VendorDefinedData[1];
EFI_DEVICE_PATH_PROTOCOL Header;
EFI_GUID Guid;
UINT8 VendorDefinedData[1];
} VENDOR_DEFINED_HARDWARE_DEVICE_PATH;
typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
EFI_GUID Guid;
UINT8 VendorDefinedData[1];
EFI_DEVICE_PATH_PROTOCOL Header;
EFI_GUID Guid;
UINT8 VendorDefinedData[1];
} VENDOR_DEFINED_MESSAGING_DEVICE_PATH;
typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
EFI_GUID Guid;
UINT8 VendorDefinedData[1];
EFI_DEVICE_PATH_PROTOCOL Header;
EFI_GUID Guid;
UINT8 VendorDefinedData[1];
} VENDOR_DEFINED_MEDIA_DEVICE_PATH;
typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
UINT32 Hid;
UINT32 Uid;
UINT32 Cid;
CHAR8 HidUidCidStr[3];
EFI_DEVICE_PATH_PROTOCOL Header;
UINT32 Hid;
UINT32 Uid;
UINT32 Cid;
CHAR8 HidUidCidStr[3];
} ACPI_EXTENDED_HID_DEVICE_PATH_WITH_STR;
typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
UINT16 NetworkProtocol;
UINT16 LoginOption;
UINT64 Lun;
UINT16 TargetPortalGroupTag;
CHAR8 TargetName[1];
EFI_DEVICE_PATH_PROTOCOL Header;
UINT16 NetworkProtocol;
UINT16 LoginOption;
UINT64 Lun;
UINT16 TargetPortalGroupTag;
CHAR8 TargetName[1];
} ISCSI_DEVICE_PATH_WITH_NAME;
typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
EFI_GUID Guid;
UINT8 VendorDefinedData[1];
EFI_DEVICE_PATH_PROTOCOL Header;
EFI_GUID Guid;
UINT8 VendorDefinedData[1];
} VENDOR_DEVICE_PATH_WITH_DATA;
#pragma pack()
@ -347,8 +346,8 @@ UefiDevicePathLibAppendDevicePathInstance (
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
UefiDevicePathLibGetNextDevicePathInstance (
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
OUT UINTN *Size
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
OUT UINTN *Size
);
/**
@ -373,9 +372,9 @@ UefiDevicePathLibGetNextDevicePathInstance (
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
UefiDevicePathLibCreateDeviceNode (
IN UINT8 NodeType,
IN UINT8 NodeSubType,
IN UINT16 NodeLength
IN UINT8 NodeType,
IN UINT8 NodeSubType,
IN UINT16 NodeLength
);
/**
@ -399,7 +398,6 @@ UefiDevicePathLibIsDevicePathMultiInstance (
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
);
/**
Converts a device path to its text representation.
@ -418,9 +416,9 @@ UefiDevicePathLibIsDevicePathMultiInstance (
CHAR16 *
EFIAPI
UefiDevicePathLibConvertDevicePathToText (
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
IN BOOLEAN DisplayOnly,
IN BOOLEAN AllowShortcuts
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
IN BOOLEAN DisplayOnly,
IN BOOLEAN AllowShortcuts
);
/**
@ -460,7 +458,7 @@ UefiDevicePathLibConvertDeviceNodeToText (
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
UefiDevicePathLibConvertTextToDeviceNode (
IN CONST CHAR16 *TextDeviceNode
IN CONST CHAR16 *TextDeviceNode
);
/**
@ -478,7 +476,7 @@ UefiDevicePathLibConvertTextToDeviceNode (
EFI_DEVICE_PATH_PROTOCOL *
EFIAPI
UefiDevicePathLibConvertTextToDevicePath (
IN CONST CHAR16 *TextDevicePath
IN CONST CHAR16 *TextDevicePath
);
#else

View File

@ -4,11 +4,11 @@
#include <uuid.h>
#include <stdint.h>
typedef struct {
uint32_t Data1;
uint16_t Data2;
uint16_t Data3;
uint8_t Data4[8];
typedef struct {
uint32_t Data1;
uint16_t Data2;
uint16_t Data3;
uint8_t Data4[8];
} EFI_GUID;
extern EFI_GUID gEfiDebugPortProtocolGuid;
@ -25,12 +25,12 @@ extern EFI_GUID gEfiVirtualDiskGuid;
EFI_GUID gEfiDebugPortProtocolGuid = { 0xEBA4E8D2, 0x3858, 0x41EC, { 0xA2, 0x81, 0x26, 0x47, 0xBA, 0x96, 0x60, 0xD0 }} ;
EFI_GUID gEfiPcAnsiGuid = { 0xE0C14753, 0xF9BE, 0x11D2, { 0x9A, 0x0C, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }} ;
EFI_GUID gEfiPersistentVirtualCdGuid = { 0x08018188, 0x42CD, 0xBB48, {0x10, 0x0F, 0x53, 0x87, 0xD5, 0x3D, 0xED, 0x3D }} ;
EFI_GUID gEfiPersistentVirtualDiskGuid = { 0x5CEA02C9, 0x4D07, 0x69D3, {0x26, 0x9F ,0x44, 0x96, 0xFB, 0xE0, 0x96, 0xF9 }} ;
EFI_GUID gEfiPersistentVirtualCdGuid = { 0x08018188, 0x42CD, 0xBB48, { 0x10, 0x0F, 0x53, 0x87, 0xD5, 0x3D, 0xED, 0x3D }} ;
EFI_GUID gEfiPersistentVirtualDiskGuid = { 0x5CEA02C9, 0x4D07, 0x69D3, { 0x26, 0x9F ,0x44, 0x96, 0xFB, 0xE0, 0x96, 0xF9 }} ;
EFI_GUID gEfiSasDevicePathGuid = { 0xd487ddb4, 0x008b, 0x11d9, { 0xaf, 0xdc, 0x00, 0x10, 0x83, 0xff, 0xca, 0x4d }} ;
EFI_GUID gEfiUartDevicePathGuid = { 0x37499a9d, 0x542f, 0x4c89, { 0xa0, 0x26, 0x35, 0xda, 0x14, 0x20, 0x94, 0xe4 }} ;
EFI_GUID gEfiVT100Guid = { 0xDFA66065, 0xB419, 0x11D3, { 0x9A, 0x2D, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }} ;
EFI_GUID gEfiVT100PlusGuid = { 0x7BAEC70B, 0x57E0, 0x4C76, { 0x8E, 0x87, 0x2F, 0x9E, 0x28, 0x08, 0x83, 0x43 }} ;
EFI_GUID gEfiVTUTF8Guid = { 0xAD15A0D6, 0x8BEC, 0x4ACF, { 0xA0, 0x73, 0xD0, 0x1D, 0xE7, 0x7E, 0x2D, 0x88 }} ;
EFI_GUID gEfiVirtualCdGuid = { 0x3D5ABD30, 0x4175, 0x87CE, {0x6D, 0x64, 0xD2, 0xAD, 0xE5, 0x23, 0xC4, 0xBB }} ;
EFI_GUID gEfiVirtualDiskGuid = { 0x77AB535A, 0x45FC, 0x624B, {0x55, 0x60, 0xF7, 0xB2, 0x81, 0xD1, 0xF9, 0x6E }} ;
EFI_GUID gEfiVirtualCdGuid = { 0x3D5ABD30, 0x4175, 0x87CE, { 0x6D, 0x64, 0xD2, 0xAD, 0xE5, 0x23, 0xC4, 0xBB }} ;
EFI_GUID gEfiVirtualDiskGuid = { 0x77AB535A, 0x45FC, 0x624B, { 0x55, 0x60, 0xF7, 0xB2, 0x81, 0xD1, 0xF9, 0x6E }} ;