Nico Huber has submitted this change and it was merged. ( https://review.coreboot.org/21095 )
Change subject: posix file: Add procedure to query the size of a file
......................................................................
posix file: Add procedure to query the size of a file
Change-Id: Ib3b31e90ca98dc09185463ce467a70770e0f222d
Signed-off-by: Nico Huber <nico.h(a)gmx.de>
Reviewed-on: https://review.coreboot.org/21095
Reviewed-by: Arthur Heymans <arthur(a)aheymans.xyz>
---
M ada/posix/hw-file.adb
M common/hw-file.ads
2 files changed, 19 insertions(+), 0 deletions(-)
Approvals:
Nico Huber: Verified
Arthur Heymans: Looks good to me, approved
diff --git a/ada/posix/hw-file.adb b/ada/posix/hw-file.adb
index e2384be..dd9d7f3 100644
--- a/ada/posix/hw-file.adb
+++ b/ada/posix/hw-file.adb
@@ -14,6 +14,7 @@
with Interfaces.C;
with Interfaces.C.Strings;
+with Ada.Directories;
with HW.Debug;
@@ -68,4 +69,18 @@
pragma Debug (not Success, Debug.New_Line);
end Map;
+ procedure Size (Length : out Natural; Path : String)
+ with
+ SPARK_Mode => Off
+ is
+ use type Ada.Directories.File_Size;
+ Res_Size : Ada.Directories.File_Size;
+ begin
+ Res_Size := Ada.Directories.Size (Path);
+ Length := Natural (Res_Size);
+ exception
+ when others =>
+ Length := 0;
+ end Size;
+
end HW.File;
diff --git a/common/hw-file.ads b/common/hw-file.ads
index 9dbfcf7..bc2242c 100644
--- a/common/hw-file.ads
+++ b/common/hw-file.ads
@@ -39,4 +39,8 @@
Pre => (Readable or Writable) and
(if Map_Copy then Readable and not Writable);
+ -- Sets `Length` to the size of the file given by `Path` or 0 if an
+ -- error occurs.
+ procedure Size (Length : out Natural; Path : String);
+
end HW.File;
--
To view, visit https://review.coreboot.org/21095
To unsubscribe, visit https://review.coreboot.org/settings
Gerrit-Project: libhwbase
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib3b31e90ca98dc09185463ce467a70770e0f222d
Gerrit-Change-Number: 21095
Gerrit-PatchSet: 2
Gerrit-Owner: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Arthur Heymans has posted comments on this change. ( https://review.coreboot.org/21113 )
Change subject: sb/intel/common/spi.c: Port to i82801gx
......................................................................
Patch Set 3:
here is the log: https://paste.debian.net/982271/
--
To view, visit https://review.coreboot.org/21113
To unsubscribe, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I39199f3279a8b76e290b6693adc50dc2ac0ccf23
Gerrit-Change-Number: 21113
Gerrit-PatchSet: 3
Gerrit-Owner: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Reviewer: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Patrick Rudolph <siro(a)das-labor.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Comment-Date: Sun, 20 Aug 2017 19:18:43 +0000
Gerrit-HasComments: No