@@ -245,6 +245,7 @@ pub const RuntimeServices = extern struct {
245
245
}
246
246
}
247
247
248
+ /// Returns the length of the variable's data and its attributes.
248
249
pub fn getVariableSize (
249
250
self : * const RuntimeServices ,
250
251
name : [* :0 ]const u16 ,
@@ -276,7 +277,7 @@ pub const RuntimeServices = extern struct {
276
277
name : [* :0 ]const u16 ,
277
278
guid : * align (8 ) const Guid ,
278
279
buffer : []u8 ,
279
- ) GetVariableError ! struct { []u8 , VariableAttributes } {
280
+ ) GetVariableError ! ? struct { []u8 , VariableAttributes } {
280
281
var attrs : VariableAttributes = undefined ;
281
282
var len = buffer .len ;
282
283
@@ -514,48 +515,48 @@ pub const RuntimeServices = extern struct {
514
515
};
515
516
516
517
pub const VariableNameIterator = struct {
517
- pub const IterateVariableNameError = uefi .UnexpectedError || error {
518
- BufferTooSmall ,
518
+ pub const NextSizeError = uefi .UnexpectedError || error {
519
519
DeviceError ,
520
520
Unsupported ,
521
521
};
522
522
523
- pub const SizeOkError = uefi . UnexpectedError || error {
524
- DeviceError ,
525
- Unsupported ,
523
+ pub const IterateVariableNameError = NextSizeError || error {
524
+ BufferTooSmall ,
525
+ NotFound ,
526
526
};
527
527
528
528
services : * const RuntimeServices ,
529
529
buffer : []u16 ,
530
530
guid : Guid ,
531
531
532
- pub fn sizeOk (self : * const VariableNameIterator ) ! bool {
532
+ pub fn nextSize (self : * const VariableNameIterator ) NextSizeError ! ? usize {
533
533
var len : usize = 0 ;
534
534
switch (self .services ._getNextVariableName (
535
535
& len ,
536
536
null ,
537
537
& self .guid ,
538
538
)) {
539
539
.success , .buffer_too_small = > return len ,
540
+ .not_found = > return null ,
540
541
.device_error = > return Error .DeviceError ,
541
542
.unsupported = > return Error .Unsupported ,
542
543
else = > | status | return uefi .unexpectedStatus (status ),
543
544
}
544
545
}
545
546
546
- /// Call `sizeOk ` to ensure that `buffer` is large enough to hold the next
547
+ /// Call `nextSize ` to ensure that `buffer` is large enough to hold the next
547
548
/// variable name.
548
549
pub fn next (
549
550
self : * VariableNameIterator ,
550
- ) IterateVariableNameError ! ? [:0 ]const u16 {
551
+ ) IterateVariableNameError ! [:0 ]const u16 {
551
552
var len = self .buffer .len ;
552
553
switch (self .services ._getNextVariableName (
553
554
& len ,
554
555
@ptrCast (self .buffer .ptr ),
555
556
& self .guid ,
556
557
)) {
557
558
.success = > return self .buffer [0.. len ],
558
- .not_found = > return null ,
559
+ .not_found = > return Error . NotFound ,
559
560
.buffer_too_small = > return Error .BufferTooSmall ,
560
561
.device_error = > return Error .DeviceError ,
561
562
.unsupported = > return Error .Unsupported ,
0 commit comments