ipmi.cpp (50539d364648834e5c0fac6bceef00646b4fde5d) ipmi.cpp (8bc117792fbf118dd74d015546c22612961ccc26)
1/*
2 * Copyright 2018 Google Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0

--- 176 unchanged lines hidden (view full) ---

185 if (!mgr->deleteBlob(path))
186 {
187 return IPMI_CC_UNSPECIFIED_ERROR;
188 }
189
190 return IPMI_CC_OK;
191}
192
1/*
2 * Copyright 2018 Google Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0

--- 176 unchanged lines hidden (view full) ---

185 if (!mgr->deleteBlob(path))
186 {
187 return IPMI_CC_UNSPECIFIED_ERROR;
188 }
189
190 return IPMI_CC_OK;
191}
192
193static ipmi_ret_t returnStatBlob(struct BlobMeta* meta, uint8_t* replyCmdBuf,
193static ipmi_ret_t returnStatBlob(BlobMeta* meta, uint8_t* replyCmdBuf,
194 size_t* dataLen)
195{
196 struct BmcBlobStatRx reply;
197 reply.crc = 0;
198 reply.blobState = meta->blobState;
199 reply.size = meta->size;
200 reply.metadataLen = meta->metadata.size();
201

--- 20 unchanged lines hidden (view full) ---

222 std::string path = stringFromBuffer(
223 request->blobId, (requestLen - sizeof(struct BmcBlobStatTx)));
224 if (path.empty())
225 {
226 return IPMI_CC_REQ_DATA_LEN_INVALID;
227 }
228
229 /* Attempt to stat. */
194 size_t* dataLen)
195{
196 struct BmcBlobStatRx reply;
197 reply.crc = 0;
198 reply.blobState = meta->blobState;
199 reply.size = meta->size;
200 reply.metadataLen = meta->metadata.size();
201

--- 20 unchanged lines hidden (view full) ---

222 std::string path = stringFromBuffer(
223 request->blobId, (requestLen - sizeof(struct BmcBlobStatTx)));
224 if (path.empty())
225 {
226 return IPMI_CC_REQ_DATA_LEN_INVALID;
227 }
228
229 /* Attempt to stat. */
230 struct BlobMeta meta;
230 BlobMeta meta;
231 if (!mgr->stat(path, &meta))
232 {
233 return IPMI_CC_UNSPECIFIED_ERROR;
234 }
235
236 return returnStatBlob(&meta, replyCmdBuf, dataLen);
237}
238
239ipmi_ret_t sessionStatBlob(ManagerInterface* mgr, const uint8_t* reqBuf,
240 uint8_t* replyCmdBuf, size_t* dataLen)
241{
242 struct BmcBlobSessionStatTx request;
243 std::memcpy(&request, reqBuf, sizeof(request));
244 (*dataLen) = 0;
245
246 /* Attempt to stat. */
231 if (!mgr->stat(path, &meta))
232 {
233 return IPMI_CC_UNSPECIFIED_ERROR;
234 }
235
236 return returnStatBlob(&meta, replyCmdBuf, dataLen);
237}
238
239ipmi_ret_t sessionStatBlob(ManagerInterface* mgr, const uint8_t* reqBuf,
240 uint8_t* replyCmdBuf, size_t* dataLen)
241{
242 struct BmcBlobSessionStatTx request;
243 std::memcpy(&request, reqBuf, sizeof(request));
244 (*dataLen) = 0;
245
246 /* Attempt to stat. */
247 struct BlobMeta meta;
247 BlobMeta meta;
248
249 if (!mgr->stat(request.sessionId, &meta))
250 {
251 return IPMI_CC_UNSPECIFIED_ERROR;
252 }
253
254 return returnStatBlob(&meta, replyCmdBuf, dataLen);
255}

--- 102 unchanged lines hidden ---
248
249 if (!mgr->stat(request.sessionId, &meta))
250 {
251 return IPMI_CC_UNSPECIFIED_ERROR;
252 }
253
254 return returnStatBlob(&meta, replyCmdBuf, dataLen);
255}

--- 102 unchanged lines hidden ---