<p>Nico Huber <strong>merged</strong> this change.</p><p><a href="https://review.coreboot.org/21095">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Nico Huber: Verified
  Arthur Heymans: Looks good to me, approved

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">posix file: Add procedure to query the size of a file<br><br>Change-Id: Ib3b31e90ca98dc09185463ce467a70770e0f222d<br>Signed-off-by: Nico Huber <nico.h@gmx.de><br>Reviewed-on: https://review.coreboot.org/21095<br>Reviewed-by: Arthur Heymans <arthur@aheymans.xyz><br>---<br>M ada/posix/hw-file.adb<br>M common/hw-file.ads<br>2 files changed, 19 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/ada/posix/hw-file.adb b/ada/posix/hw-file.adb<br>index e2384be..dd9d7f3 100644<br>--- a/ada/posix/hw-file.adb<br>+++ b/ada/posix/hw-file.adb<br>@@ -14,6 +14,7 @@<br> <br> with Interfaces.C;<br> with Interfaces.C.Strings;<br>+with Ada.Directories;<br> <br> with HW.Debug;<br> <br>@@ -68,4 +69,18 @@<br>       pragma Debug (not Success, Debug.New_Line);<br>    end Map;<br> <br>+   procedure Size (Length : out Natural; Path : String)<br>+   with<br>+      SPARK_Mode => Off<br>+   is<br>+      use type Ada.Directories.File_Size;<br>+      Res_Size : Ada.Directories.File_Size;<br>+   begin<br>+      Res_Size := Ada.Directories.Size (Path);<br>+      Length := Natural (Res_Size);<br>+   exception<br>+      when others =><br>+         Length := 0;<br>+   end Size;<br>+<br> end HW.File;<br>diff --git a/common/hw-file.ads b/common/hw-file.ads<br>index 9dbfcf7..bc2242c 100644<br>--- a/common/hw-file.ads<br>+++ b/common/hw-file.ads<br>@@ -39,4 +39,8 @@<br>       Pre => (Readable or Writable) and<br>              (if Map_Copy then Readable and not Writable);<br> <br>+   -- Sets `Length` to the size of the file given by `Path` or 0 if an<br>+   -- error occurs.<br>+   procedure Size (Length : out Natural; Path : String);<br>+<br> end HW.File;<br></pre><p>To view, visit <a href="https://review.coreboot.org/21095">change 21095</a>. To unsubscribe, visit <a href="https://review.coreboot.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://review.coreboot.org/21095"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: libhwbase </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: Ib3b31e90ca98dc09185463ce467a70770e0f222d </div>
<div style="display:none"> Gerrit-Change-Number: 21095 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Nico Huber <nico.h@gmx.de> </div>
<div style="display:none"> Gerrit-Reviewer: Arthur Heymans <arthur@aheymans.xyz> </div>
<div style="display:none"> Gerrit-Reviewer: Nico Huber <nico.h@gmx.de> </div>