boot-time-blob: Implement `stat` function
`stat` function may be called first before other command to be called to
check the state.
In this case `stat` must be implemented to make that process work.
Tested:
Checked open->stat->read flow is working by internal tool.
Change-Id: I89676bf9431d77ec2a3a2b76b99ae3dcbc8a9f20
Signed-off-by: Michael Shen <gpgpgp@google.com>
diff --git a/boot-time-blob/blob_handler.cpp b/boot-time-blob/blob_handler.cpp
index 6fa8d62..82dc23f 100644
--- a/boot-time-blob/blob_handler.cpp
+++ b/boot-time-blob/blob_handler.cpp
@@ -239,11 +239,17 @@
return true;
}
-// BmcBlobSessionStat(9) is not supported.
-bool BlobHandler::stat([[maybe_unused]] uint16_t session,
- [[maybe_unused]] BlobMeta* meta)
+bool BlobHandler::stat(uint16_t session, BlobMeta* meta)
{
- return false;
+ auto it = sessions.find(session);
+ if (it == sessions.end())
+ {
+ return false;
+ }
+
+ meta->size = it->second.size();
+ meta->blobState = blobs::StateFlags::open_read;
+ return true;
}
bool BlobHandler::expire(uint16_t session)