]> code.delx.au - refind/blobdiff - refind/lib.h
Added ability to boot the previously-booted loader if
[refind] / refind / lib.h
index bc3454cdbcd7ad913b96d5c08ff8bb4480d6ddbc..e6a8c3026ef330a5318a675f31a27a912e33a329 100644 (file)
 #ifdef __MAKEWITH_GNUEFI
 #include "efi.h"
 #include "efilib.h"
-#pragma pack(1)
-
-/**
-  This protocol can be used on any device handle to obtain generic path/location
-  information concerning the physical device or logical device. If the handle does
-  not logically map to a physical device, the handle may not necessarily support
-  the device path protocol. The device path describes the location of the device
-  the handle is for. The size of the Device Path can be determined from the structures
-  that make up the Device Path.
-**/
-typedef struct {
-  UINT8 Type;       ///< 0x01 Hardware Device Path.
-                    ///< 0x02 ACPI Device Path.
-                    ///< 0x03 Messaging Device Path.
-                    ///< 0x04 Media Device Path.
-                    ///< 0x05 BIOS Boot Specification Device Path.
-                    ///< 0x7F End of Hardware Device Path.
-
-  UINT8 SubType;    ///< Varies by Type
-                    ///< 0xFF End Entire Device Path, or
-                    ///< 0x01 End This Instance of a Device Path and start a new
-                    ///< Device Path.
-
-  UINT8 Length[2];  ///< Specific Device Path data. Type and Sub-Type define
-                    ///< type of data. Size of data is included in Length.
-
-} EFI_DEVICE_PATH_PROTOCOL;
-
-#pragma pack()
+#define EFI_DEVICE_PATH_PROTOCOL EFI_DEVICE_PATH
 #else
 #include "../include/tiano_includes.h"
 #endif
@@ -106,10 +78,16 @@ typedef struct {
 
 #define IS_EXTENDED_PART_TYPE(type) ((type) == 0x05 || (type) == 0x0f || (type) == 0x85)
 
+// Partition names to be ignored when setting volume name
+#define IGNORE_PARTITION_NAMES L"Microsoft basic data,Linux filesystem,Apple HFS/HFS+"
+
 EFI_STATUS InitRefitLib(IN EFI_HANDLE ImageHandle);
 VOID UninitRefitLib(VOID);
 EFI_STATUS ReinitRefitLib(VOID);
 
+EFI_STATUS EfivarGetRaw(EFI_GUID *vendor, CHAR16 *name, CHAR8 **buffer, UINTN *size);
+EFI_STATUS EfivarSetRaw(EFI_GUID *vendor, CHAR16 *name, CHAR8 *buf, UINTN size, BOOLEAN persistent);
+
 VOID CleanUpPathNameSlashes(IN OUT CHAR16 *PathName);
 VOID CreateList(OUT VOID ***ListPtr, OUT UINTN *ElementCount, IN UINTN InitialElementCount);
 VOID AddListElement(IN OUT VOID ***ListPtr, IN OUT UINTN *ElementCount, IN VOID *NewElement);
@@ -139,6 +117,7 @@ VOID MergeStrings(IN OUT CHAR16 **First, IN CHAR16 *Second, CHAR16 AddChar);
 CHAR16 *FindExtension(IN CHAR16 *Path);
 CHAR16 *FindLastDirName(IN CHAR16 *Path);
 CHAR16 *FindPath(IN CHAR16* FullPath);
+BOOLEAN LimitStringLength(CHAR16 *TheString, UINTN Limit);
 VOID FindVolumeAndFilename(IN EFI_DEVICE_PATH *loadpath, OUT REFIT_VOLUME **DeviceVolume, OUT CHAR16 **loader);
 BOOLEAN SplitVolumeAndFilename(IN OUT CHAR16 **Path, OUT CHAR16 **VolName);
 CHAR16 *FindNumbers(IN CHAR16 *InString);
@@ -146,6 +125,7 @@ CHAR16 *FindCommaDelimited(IN CHAR16 *InString, IN UINTN Index);
 INTN FindSubString(IN CHAR16 *SmallString, IN CHAR16 *BigString);
 VOID SplitPathName(CHAR16 *InPath, CHAR16 **VolName, CHAR16 **Path, CHAR16 **Filename);
 BOOLEAN IsIn(IN CHAR16 *Filename, IN CHAR16 *List);
+BOOLEAN IsInSubstring(IN CHAR16 *BigString, IN CHAR16 *List);
 BOOLEAN FilenameIn(IN REFIT_VOLUME *Volume, IN CHAR16 *Directory, IN CHAR16 *Filename, IN CHAR16 *List);
 BOOLEAN VolumeNumberToName(REFIT_VOLUME *Volume, CHAR16 **VolName);
 VOID MyFreePool(IN OUT VOID *Pointer);