mirror of
https://github.com/justinian/j6-uefi-headers.git
synced 2025-12-09 16:14:31 -08:00
Add file and file_info protocols
This commit is contained in:
@@ -13,9 +13,9 @@
|
||||
|
||||
namespace uefi {
|
||||
namespace bs_impl {
|
||||
using allocate_pages = status (*)(allocate_type, memory_type, uint64_t, uintptr_t*);
|
||||
using allocate_pages = status (*)(allocate_type, memory_type, uint64_t, void**);
|
||||
using allocate_pool = status (*)(memory_type, uint64_t, void**);
|
||||
using handle_protocol = status (*)(handle, guid *, void **);
|
||||
using handle_protocol = status (*)(handle, const guid *, void **);
|
||||
using create_event = status (*)(evt, tpl, event_notify, void*, event*);
|
||||
using locate_protocol = status (*)(const guid *, void *, void **);
|
||||
using set_mem = void (*)(void *, uint64_t, uint8_t);
|
||||
|
||||
@@ -12,8 +12,11 @@
|
||||
namespace uefi {
|
||||
|
||||
using handle = void *;
|
||||
using event = void *;
|
||||
|
||||
|
||||
//
|
||||
// Error and status code definitions
|
||||
//
|
||||
constexpr uint64_t error_bit = 0x8000000000000000ull;
|
||||
constexpr uint64_t make_error(uint64_t e) { return e|error_bit; }
|
||||
|
||||
@@ -31,6 +34,29 @@ enum class status : uint64_t
|
||||
inline bool is_error(status s) { return static_cast<uint64_t>(s) & error_bit; }
|
||||
inline bool is_warning(status s) { return !is_error(s) && s != status::success; }
|
||||
|
||||
|
||||
//
|
||||
// Time defitions
|
||||
//
|
||||
struct time
|
||||
{
|
||||
uint16_t year;
|
||||
uint8_t month;
|
||||
uint8_t day;
|
||||
uint8_t hour;
|
||||
uint8_t minute;
|
||||
uint8_t second;
|
||||
uint8_t _pad0;
|
||||
uint32_t nanosecond;
|
||||
int16_t time_zone;
|
||||
uint8_t daylight;
|
||||
uint8_t _pad1;
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// Memory and allocation defitions
|
||||
//
|
||||
enum class memory_type : uint32_t
|
||||
{
|
||||
reserved_memory_type,
|
||||
@@ -58,6 +84,12 @@ enum class allocate_type : uint32_t
|
||||
address
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// Event handling defitions
|
||||
//
|
||||
using event = void *;
|
||||
|
||||
enum class evt : uint32_t
|
||||
{
|
||||
notify_wait = 0x00000100,
|
||||
@@ -80,6 +112,37 @@ enum class tpl : uint64_t
|
||||
|
||||
using event_notify = void (*)(event, void*);
|
||||
|
||||
|
||||
//
|
||||
// File IO defitions
|
||||
//
|
||||
struct file_io_token
|
||||
{
|
||||
event event;
|
||||
status status;
|
||||
uint64_t buffer_size;
|
||||
void *buffer;
|
||||
};
|
||||
|
||||
enum class file_mode : uint64_t
|
||||
{
|
||||
read = 0x0000000000000001ull,
|
||||
write = 0x0000000000000002ull,
|
||||
|
||||
create = 0x8000000000000000ull
|
||||
};
|
||||
|
||||
enum class file_attr : uint64_t
|
||||
{
|
||||
none = 0,
|
||||
read_only = 0x0000000000000001ull,
|
||||
hidden = 0x0000000000000002ull,
|
||||
system = 0x0000000000000004ull,
|
||||
reserved = 0x0000000000000008ull,
|
||||
directory = 0x0000000000000010ull,
|
||||
archive = 0x0000000000000020ull
|
||||
};
|
||||
|
||||
} // namespace uefi
|
||||
|
||||
#endif
|
||||
|
||||
112
protos.yaml
112
protos.yaml
@@ -114,3 +114,115 @@
|
||||
post_data:
|
||||
- name: mode
|
||||
type: uefi::graphics_output_mode *
|
||||
|
||||
- name: simple_file_system
|
||||
guid: "0x0964e5b22,0x6459,0x11d2,{0x8e,0x39,0x00,0xa0,0xc9,0x69,0x72,0x3b}"
|
||||
headers:
|
||||
- uefi/protos/file.h
|
||||
pre_data:
|
||||
- name: revision
|
||||
type: uint64_t
|
||||
methods:
|
||||
- name: open_volume
|
||||
args:
|
||||
- name: root
|
||||
type: uefi::protos::file **
|
||||
|
||||
- name: file
|
||||
pre_data:
|
||||
- name: revision
|
||||
type: uint64_t
|
||||
methods:
|
||||
- name: open
|
||||
args:
|
||||
- name: new_handle
|
||||
type: file **
|
||||
- name: file_name
|
||||
type: const wchar_t *
|
||||
- name: open_mode
|
||||
type: file_mode
|
||||
- name: attributes
|
||||
type: file_attr
|
||||
- name: close
|
||||
- name: delete_file
|
||||
- name: read
|
||||
args:
|
||||
- name: buffer_size
|
||||
type: uint64_t *
|
||||
- name: buffer
|
||||
type: void *
|
||||
- name: write
|
||||
args:
|
||||
- name: buffer_size
|
||||
type: uint64_t *
|
||||
- name: buffer
|
||||
type: void *
|
||||
- name: get_position
|
||||
args:
|
||||
- name: position
|
||||
type: uint64_t *
|
||||
- name: set_position
|
||||
args:
|
||||
- name: position
|
||||
type: uint64_t
|
||||
- name: get_info
|
||||
args:
|
||||
- name: info_type
|
||||
type: const guid *
|
||||
- name: buffer_size
|
||||
type: uint64_t *
|
||||
- name: buffer
|
||||
type: void *
|
||||
- name: set_info
|
||||
args:
|
||||
- name: info_type
|
||||
type: const guid *
|
||||
- name: buffer_size
|
||||
type: uint64_t
|
||||
- name: buffer
|
||||
type: void *
|
||||
- name: flush
|
||||
- name: open_ex
|
||||
args:
|
||||
- name: new_handle
|
||||
type: file **
|
||||
- name: file_name
|
||||
type: const wchar_t *
|
||||
- name: open_mode
|
||||
type: uint64_t
|
||||
- name: attributes
|
||||
type: uint64_t
|
||||
- name: token
|
||||
type: file_io_token *
|
||||
- name: read_ex
|
||||
args:
|
||||
- name: token
|
||||
type: file_io_token *
|
||||
- name: write_ex
|
||||
args:
|
||||
- name: token
|
||||
type: file_io_token *
|
||||
- name: flush_ex
|
||||
args:
|
||||
- name: token
|
||||
type: file_io_token *
|
||||
|
||||
- name: file_info
|
||||
guid: "0x09576e92,0x6d3f,0x11d2,{0x8e,0x39,0x00,0xa0,0xc9,0x69,0x72,0x3b}"
|
||||
pre_data:
|
||||
- name: size
|
||||
type: uint64_t
|
||||
- name: file_size
|
||||
type: uint64_t
|
||||
- name: physical_size
|
||||
type: uint64_t
|
||||
- name: create_time
|
||||
type: time
|
||||
- name: last_access_time
|
||||
type: time
|
||||
- name: modification_time
|
||||
type: time
|
||||
- name: attribute
|
||||
type: uint64_t
|
||||
- name: file_name[]
|
||||
type: wchar_t
|
||||
|
||||
Reference in New Issue
Block a user