blobs: s/struct BlobMeta/BlobMeta/g
Because this structure is not anything special, simply use the cpp
idiomatic way of referencing the object.
Consistently, structures that are packed still have "struct" used in
declarations. However, this distinction is only clear through its usage
and nothing in the language. Perhaps a better approach would be
notational naming struct PackedXYZ {};. However, that can get out of
control quickly.
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I3b7e48e4b6687ef2e15e9d07c0eeba96eb5d2552
diff --git a/blobs-ipmid/blobs.hpp b/blobs-ipmid/blobs.hpp
index e75495b..ab0b567 100644
--- a/blobs-ipmid/blobs.hpp
+++ b/blobs-ipmid/blobs.hpp
@@ -91,7 +91,7 @@
* @param[in,out] meta - a pointer to a blobmeta.
* @return bool - true if it was successful.
*/
- virtual bool stat(const std::string& path, struct BlobMeta* meta) = 0;
+ virtual bool stat(const std::string& path, BlobMeta* meta) = 0;
/* The methods below are per session. */
@@ -163,7 +163,7 @@
* @param[in,out] meta - pointer to update with the BlobMeta.
* @return bool - wether it was successful.
*/
- virtual bool stat(uint16_t session, struct BlobMeta* meta) = 0;
+ virtual bool stat(uint16_t session, BlobMeta* meta) = 0;
/**
* Attempt to expire a session. This is called when a session has been
diff --git a/example/example.cpp b/example/example.cpp
index dd7c486..2ab0bd3 100644
--- a/example/example.cpp
+++ b/example/example.cpp
@@ -41,7 +41,7 @@
return false;
}
-bool ExampleBlobHandler::stat(const std::string& path, struct BlobMeta* meta)
+bool ExampleBlobHandler::stat(const std::string& path, BlobMeta* meta)
{
return false;
}
@@ -149,7 +149,7 @@
return true;
}
-bool ExampleBlobHandler::stat(uint16_t session, struct BlobMeta* meta)
+bool ExampleBlobHandler::stat(uint16_t session, BlobMeta* meta)
{
ExampleBlob* sess = getSession(session);
if (!sess)
diff --git a/example/example.hpp b/example/example.hpp
index 335eade..a53d6c0 100644
--- a/example/example.hpp
+++ b/example/example.hpp
@@ -66,7 +66,7 @@
bool canHandleBlob(const std::string& path) override;
std::vector<std::string> getBlobIds() override;
bool deleteBlob(const std::string& path) override;
- bool stat(const std::string& path, struct BlobMeta* meta) override;
+ bool stat(const std::string& path, BlobMeta* meta) override;
bool open(uint16_t session, uint16_t flags,
const std::string& path) override;
std::vector<uint8_t> read(uint16_t session, uint32_t offset,
@@ -77,7 +77,7 @@
const std::vector<uint8_t>& data) override;
bool commit(uint16_t session, const std::vector<uint8_t>& data) override;
bool close(uint16_t session) override;
- bool stat(uint16_t session, struct BlobMeta* meta) override;
+ bool stat(uint16_t session, BlobMeta* meta) override;
bool expire(uint16_t session) override;
constexpr static char supportedPath[] = "/dev/fake/command";
diff --git a/ipmi.cpp b/ipmi.cpp
index 92955f9..1613085 100644
--- a/ipmi.cpp
+++ b/ipmi.cpp
@@ -190,7 +190,7 @@
return IPMI_CC_OK;
}
-static ipmi_ret_t returnStatBlob(struct BlobMeta* meta, uint8_t* replyCmdBuf,
+static ipmi_ret_t returnStatBlob(BlobMeta* meta, uint8_t* replyCmdBuf,
size_t* dataLen)
{
struct BmcBlobStatRx reply;
@@ -227,7 +227,7 @@
}
/* Attempt to stat. */
- struct BlobMeta meta;
+ BlobMeta meta;
if (!mgr->stat(path, &meta))
{
return IPMI_CC_UNSPECIFIED_ERROR;
@@ -244,7 +244,7 @@
(*dataLen) = 0;
/* Attempt to stat. */
- struct BlobMeta meta;
+ BlobMeta meta;
if (!mgr->stat(request.sessionId, &meta))
{
diff --git a/manager.cpp b/manager.cpp
index 639ca2d..dcc223e 100644
--- a/manager.cpp
+++ b/manager.cpp
@@ -191,7 +191,7 @@
return item->second.blobId;
}
-bool BlobManager::stat(const std::string& path, struct BlobMeta* meta)
+bool BlobManager::stat(const std::string& path, BlobMeta* meta)
{
/* meta should never be NULL. */
GenericBlobInterface* handler = getHandler(path);
@@ -205,7 +205,7 @@
return handler->stat(path, meta);
}
-bool BlobManager::stat(uint16_t session, struct BlobMeta* meta)
+bool BlobManager::stat(uint16_t session, BlobMeta* meta)
{
/* meta should never be NULL. */
GenericBlobInterface* handler = getHandler(session);
diff --git a/manager.hpp b/manager.hpp
index 4caf4ea..7b169db 100644
--- a/manager.hpp
+++ b/manager.hpp
@@ -52,9 +52,9 @@
virtual bool open(uint16_t flags, const std::string& path,
uint16_t* session) = 0;
- virtual bool stat(const std::string& path, struct BlobMeta* meta) = 0;
+ virtual bool stat(const std::string& path, BlobMeta* meta) = 0;
- virtual bool stat(uint16_t session, struct BlobMeta* meta) = 0;
+ virtual bool stat(uint16_t session, BlobMeta* meta) = 0;
virtual bool commit(uint16_t session, const std::vector<uint8_t>& data) = 0;
@@ -135,7 +135,7 @@
* @param[in,out] meta - a pointer to store the metadata.
* @return bool - true if able to retrieve the information.
*/
- bool stat(const std::string& path, struct BlobMeta* meta) override;
+ bool stat(const std::string& path, BlobMeta* meta) override;
/**
* Attempts to retrieve a BlobMeta for a given session.
@@ -144,7 +144,7 @@
* @param[in,out] meta - a pointer to store the metadata.
* @return bool - true if able to retrieve the information.
*/
- bool stat(uint16_t session, struct BlobMeta* meta) override;
+ bool stat(uint16_t session, BlobMeta* meta) override;
/**
* Attempt to commit a blob for a given session.
diff --git a/test/blob_mock.hpp b/test/blob_mock.hpp
index b70d3d1..7ec7d15 100644
--- a/test/blob_mock.hpp
+++ b/test/blob_mock.hpp
@@ -15,7 +15,7 @@
MOCK_METHOD1(canHandleBlob, bool(const std::string&));
MOCK_METHOD0(getBlobIds, std::vector<std::string>());
MOCK_METHOD1(deleteBlob, bool(const std::string&));
- MOCK_METHOD2(stat, bool(const std::string&, struct BlobMeta*));
+ MOCK_METHOD2(stat, bool(const std::string&, BlobMeta*));
MOCK_METHOD3(open, bool(uint16_t, uint16_t, const std::string&));
MOCK_METHOD3(read, std::vector<uint8_t>(uint16_t, uint32_t, uint32_t));
MOCK_METHOD3(write, bool(uint16_t, uint32_t, const std::vector<uint8_t>&));
@@ -23,7 +23,7 @@
bool(uint16_t, uint32_t, const std::vector<uint8_t>&));
MOCK_METHOD2(commit, bool(uint16_t, const std::vector<uint8_t>&));
MOCK_METHOD1(close, bool(uint16_t));
- MOCK_METHOD2(stat, bool(uint16_t, struct BlobMeta*));
+ MOCK_METHOD2(stat, bool(uint16_t, BlobMeta*));
MOCK_METHOD1(expire, bool(uint16_t));
};
} // namespace blobs
diff --git a/test/ipmi_sessionstat_unittest.cpp b/test/ipmi_sessionstat_unittest.cpp
index 875b6a8..2f407a1 100644
--- a/test/ipmi_sessionstat_unittest.cpp
+++ b/test/ipmi_sessionstat_unittest.cpp
@@ -33,8 +33,8 @@
dataLen = sizeof(struct BmcBlobSessionStatTx);
- EXPECT_CALL(mgr, stat(Matcher<uint16_t>(req->sessionId),
- Matcher<struct BlobMeta*>(_)))
+ EXPECT_CALL(mgr,
+ stat(Matcher<uint16_t>(req->sessionId), Matcher<BlobMeta*>(_)))
.WillOnce(Return(false));
EXPECT_EQ(IPMI_CC_UNSPECIFIED_ERROR,
@@ -63,8 +63,8 @@
rep.metadataLen = 0x00;
EXPECT_CALL(mgr, stat(Matcher<uint16_t>(req->sessionId),
- Matcher<struct BlobMeta*>(NotNull())))
- .WillOnce(Invoke([&](uint16_t session, struct BlobMeta* meta) {
+ Matcher<BlobMeta*>(NotNull())))
+ .WillOnce(Invoke([&](uint16_t session, BlobMeta* meta) {
meta->blobState = rep.blobState;
meta->size = rep.size;
return true;
@@ -91,7 +91,7 @@
dataLen = sizeof(struct BmcBlobSessionStatTx);
- struct BlobMeta lmeta;
+ BlobMeta lmeta;
lmeta.blobState = 0x01;
lmeta.size = 0x100;
lmeta.metadata.push_back(0x01);
@@ -106,8 +106,8 @@
rep.metadataLen = lmeta.metadata.size();
EXPECT_CALL(mgr, stat(Matcher<uint16_t>(req->sessionId),
- Matcher<struct BlobMeta*>(NotNull())))
- .WillOnce(Invoke([&](uint16_t session, struct BlobMeta* meta) {
+ Matcher<BlobMeta*>(NotNull())))
+ .WillOnce(Invoke([&](uint16_t session, BlobMeta* meta) {
(*meta) = lmeta;
return true;
}));
diff --git a/test/ipmi_stat_unittest.cpp b/test/ipmi_stat_unittest.cpp
index b4f542d..5002e69 100644
--- a/test/ipmi_stat_unittest.cpp
+++ b/test/ipmi_stat_unittest.cpp
@@ -63,7 +63,7 @@
dataLen = sizeof(struct BmcBlobStatTx) + blobId.length() + 1;
EXPECT_CALL(mgr, stat(Matcher<const std::string&>(StrEq(blobId)),
- Matcher<struct BlobMeta*>(_)))
+ Matcher<BlobMeta*>(_)))
.WillOnce(Return(false));
EXPECT_EQ(IPMI_CC_UNSPECIFIED_ERROR,
@@ -96,8 +96,8 @@
rep.metadataLen = 0x00;
EXPECT_CALL(mgr, stat(Matcher<const std::string&>(StrEq(blobId)),
- Matcher<struct BlobMeta*>(NotNull())))
- .WillOnce(Invoke([&](const std::string& path, struct BlobMeta* meta) {
+ Matcher<BlobMeta*>(NotNull())))
+ .WillOnce(Invoke([&](const std::string& path, BlobMeta* meta) {
meta->blobState = rep.blobState;
meta->size = rep.size;
return true;
@@ -128,7 +128,7 @@
dataLen = sizeof(struct BmcBlobStatTx) + blobId.length() + 1;
- struct BlobMeta lmeta;
+ BlobMeta lmeta;
lmeta.blobState = 0x01;
lmeta.size = 0x100;
lmeta.metadata.push_back(0x01);
@@ -143,8 +143,8 @@
rep.metadataLen = lmeta.metadata.size();
EXPECT_CALL(mgr, stat(Matcher<const std::string&>(StrEq(blobId)),
- Matcher<struct BlobMeta*>(NotNull())))
- .WillOnce(Invoke([&](const std::string& path, struct BlobMeta* meta) {
+ Matcher<BlobMeta*>(NotNull())))
+ .WillOnce(Invoke([&](const std::string& path, BlobMeta* meta) {
(*meta) = lmeta;
return true;
}));
diff --git a/test/manager_mock.hpp b/test/manager_mock.hpp
index 73d4d07..bfb3348 100644
--- a/test/manager_mock.hpp
+++ b/test/manager_mock.hpp
@@ -20,8 +20,8 @@
MOCK_METHOD0(buildBlobList, uint32_t());
MOCK_METHOD1(getBlobId, std::string(uint32_t));
MOCK_METHOD3(open, bool(uint16_t, const std::string&, uint16_t*));
- MOCK_METHOD2(stat, bool(const std::string&, struct BlobMeta*));
- MOCK_METHOD2(stat, bool(uint16_t, struct BlobMeta*));
+ MOCK_METHOD2(stat, bool(const std::string&, BlobMeta*));
+ MOCK_METHOD2(stat, bool(uint16_t, BlobMeta*));
MOCK_METHOD2(commit, bool(uint16_t, const std::vector<uint8_t>&));
MOCK_METHOD1(close, bool(uint16_t));
MOCK_METHOD3(read, std::vector<uint8_t>(uint16_t, uint32_t, uint32_t));
diff --git a/test/manager_sessionstat_unittest.cpp b/test/manager_sessionstat_unittest.cpp
index 6ae27d3..015a079 100644
--- a/test/manager_sessionstat_unittest.cpp
+++ b/test/manager_sessionstat_unittest.cpp
@@ -14,7 +14,7 @@
// Calling Stat on a session that doesn't exist should return false.
BlobManager mgr;
- struct BlobMeta meta;
+ BlobMeta meta;
uint16_t sess = 1;
EXPECT_FALSE(mgr.stat(sess, &meta));
@@ -36,7 +36,7 @@
EXPECT_CALL(*m1ptr, open(_, flags, path)).WillOnce(Return(true));
EXPECT_TRUE(mgr.open(flags, path, &sess));
- struct BlobMeta meta;
+ BlobMeta meta;
EXPECT_CALL(*m1ptr, stat(sess, &meta)).WillOnce(Return(false));
EXPECT_FALSE(mgr.stat(sess, &meta));
@@ -58,7 +58,7 @@
EXPECT_CALL(*m1ptr, open(_, flags, path)).WillOnce(Return(true));
EXPECT_TRUE(mgr.open(flags, path, &sess));
- struct BlobMeta meta;
+ BlobMeta meta;
EXPECT_CALL(*m1ptr, stat(sess, &meta)).WillOnce(Return(true));
EXPECT_TRUE(mgr.stat(sess, &meta));
diff --git a/test/manager_stat_unittest.cpp b/test/manager_stat_unittest.cpp
index a13a66d..4f66278 100644
--- a/test/manager_stat_unittest.cpp
+++ b/test/manager_stat_unittest.cpp
@@ -17,7 +17,7 @@
auto m1ptr = m1.get();
EXPECT_TRUE(mgr.registerHandler(std::move(m1)));
- struct BlobMeta meta;
+ BlobMeta meta;
std::string path = "/asdf/asdf";
EXPECT_CALL(*m1ptr, canHandleBlob(path)).WillOnce(Return(false));
@@ -33,7 +33,7 @@
auto m1ptr = m1.get();
EXPECT_TRUE(mgr.registerHandler(std::move(m1)));
- struct BlobMeta meta;
+ BlobMeta meta;
std::string path = "/asdf/asdf";
EXPECT_CALL(*m1ptr, canHandleBlob(path)).WillOnce(Return(true));
EXPECT_CALL(*m1ptr, stat(path, &meta)).WillOnce(Return(false));
@@ -50,7 +50,7 @@
auto m1ptr = m1.get();
EXPECT_TRUE(mgr.registerHandler(std::move(m1)));
- struct BlobMeta meta;
+ BlobMeta meta;
std::string path = "/asdf/asdf";
EXPECT_CALL(*m1ptr, canHandleBlob(path)).WillOnce(Return(true));
EXPECT_CALL(*m1ptr, stat(path, &meta)).WillOnce(Return(true));