Lines Matching +full:data +full:- +full:active

8  *     http://www.apache.org/licenses/LICENSE-2.0
19 #include "data.hpp"
25 #include <blobs-ipmid/blobs.hpp>
75 /* Check if the path is in our supported list (or active list). */
85 * list as "/flash/active/image", and if the hash has started,
86 * "/flash/active/hash" regardless of mechanism. This is done in the open
124 * Stat on an active file or hash will return information such as the size
125 * of the data cached, and any additional pertinent information. The
126 * blob_state on the active files will return the state of the update.
135 * but are not stat-able as-is. in stat()
146 meta->blobState = transportMask; in stat()
147 meta->size = 0; in stat()
162 /* If we got here, there must be data AND a hash, not just a hash, in getActionStatus()
168 value = pack->verification->status(); in getActionStatus()
182 value = pack->update->status(); in getActionStatus()
196 * Return stat information on an open session. It therefore must be an active
197 * handle to either the active image or active hash.
207 /* The size here refers to the size of the file -- of something analogous. in stat()
209 meta->size = (item->second->imageHandler) in stat()
210 ? item->second->imageHandler->getSize() in stat()
213 meta->metadata.clear(); in stat()
215 if (item->second->activePath == verifyBlobId || in stat()
216 item->second->activePath == updateBlobId) in stat()
220 meta->metadata.push_back(static_cast<std::uint8_t>(value)); in stat()
227 if (item->second->activePath == verifyBlobId) in stat()
233 /* item->second->activePath == updateBlobId */ in stat()
237 item->second->flags &= ~blobs::StateFlags::committing; in stat()
241 item->second->flags |= blobs::StateFlags::committed; in stat()
245 item->second->flags |= blobs::StateFlags::commit_error; in stat()
250 /* The blobState here relates to an active session, so we should return the in stat()
253 meta->blobState = item->second->flags; in stat()
255 /* The metadata blob returned comes from the data handler... it's used for in stat()
259 if (item->second->dataHandler) in stat()
261 auto bytes = item->second->dataHandler->readMeta(); in stat()
262 meta->metadata.insert(meta->metadata.begin(), bytes.begin(), in stat()
273 * sending data down, without requiring one to open the new active file.
275 * If you open the active flash image or active hash it will let you
278 * Once the verification process has started the active files cannot be
291 * Further on this, if there's an active session to the hash we don't allow in open()
292 * re-opening the image, and if we have the image open, we don't allow in open()
293 * opening the hash. This design decision may be re-evaluated, and changed in open()
296 * And why would we? But, really, the point of no-return is once the in open()
297 * verification process has begun -- which is done via commit() on the hash in open()
305 /* The active blobs are only meant to indicate status that something has in open()
310 /* 2a) are they opening the active image? this can only happen if they in open()
313 /* 2b) are they opening the active hash? this can only happen if they in open()
319 /* Check that they've opened for writing - read back not currently in open()
340 /* Handle opening the verifyBlobId --> we know the image and hash in open()
414 /* There are two abstractions at play, how you get the data and how you in open()
415 * handle that data. such that, whether the data comes from the PCI bridge in open()
416 * or LPC bridge is not connected to whether the data goes into a static in open()
422 /* How are they expecting to copy this data? */ in open()
435 * only non-external data pathway -- but this is just a more generic in open()
438 if (d->handler) in open()
440 /* If the data handler open call fails, open fails. */ in open()
441 if (!d->handler->open()) in open()
462 if (!h->handler->open(path, std::ios::out)) in open()
468 const char* active; in open() local
474 active = activeHashBlobId; in open()
479 active = activeImageBlobId; in open()
482 curr->flags = flags; in open()
483 curr->dataHandler = d->handler.get(); in open()
484 curr->imageHandler = h->handler.get(); in open()
488 addBlobId(active); in open()
497 * The write command really just grabs the data from wherever it is and sends it
499 * the data provided.
505 const std::vector<uint8_t>& data) in write() argument
520 if (item->second->activePath == verifyBlobId || in write()
521 item->second->activePath == updateBlobId) in write()
528 if (item->second->flags & FirmwareFlags::UpdateFlags::ipmi) in write()
530 bytes = data; in write()
539 if (data.size() != sizeof(header)) in write()
544 std::memcpy(&header, data.data(), data.size()); in write()
545 bytes = item->second->dataHandler->copyFrom(header.length); in write()
548 return item->second->imageHandler->write(offset, bytes); in write()
552 * If the active session (image or hash) is over LPC, this allows
554 * writing data for the given item (image or hash). This will return
555 * false at any other part. -- the lpc handler portion will know to return
559 const std::vector<uint8_t>& data) in writeMeta() argument
567 if (item->second->flags & FirmwareFlags::UpdateFlags::ipmi) in writeMeta()
572 /* Prevent writing meta to the verification blob (it has no data handler). in writeMeta()
574 if (item->second->dataHandler) in writeMeta()
576 return item->second->dataHandler->writeMeta(data); in writeMeta()
588 * out-of-band transport mechanism involved is closed.
599 if (item->second->activePath != verifyBlobId && in commit()
600 item->second->activePath != updateBlobId) in commit()
603 item->second->activePath.c_str()); in commit()
611 item->second->flags |= blobs::StateFlags::committing; in commit()
621 item->second->flags |= blobs::StateFlags::committing; in commit()
653 /* They are closing a data pathway (image, tarball, hash). */ in close()
657 * some data. in close()
684 /* Verification failed, and the host-tool knows this by calling in close()
719 if (item->second->dataHandler) in close()
721 item->second->dataHandler->close(); in close()
723 if (item->second->imageHandler) in close()
725 item->second->imageHandler->close(); in close()
749 pack->preparation->trigger(); in changeState()
764 * it will likely change to support reading data back.
773 /* Closing of open files is handled from close() -- Reaching here from in abortProcess()
783 if (item.second->dataHandler) in abortProcess()
785 item.second->dataHandler->close(); in abortProcess()
787 if (item.second->imageHandler) in abortProcess()
789 item.second->imageHandler->close(); in abortProcess()
803 pack->verification->abort(); in abortVerification()
815 bool result = pack->verification->trigger(); in triggerVerification()
829 pack->update->abort(); in abortUpdate()
841 bool result = pack->update->trigger(); in triggerUpdate()