Changeset 743ce51 in mainline for uspace/app/bithenge/blob.h


Ignore:
Timestamp:
2012-05-25T03:49:21Z (12 years ago)
Author:
Sean Bartell <wingedtachikoma@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1923501
Parents:
a54bd98
Message:

Bithenge: various fixes and style.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bithenge/blob.h

    ra54bd98 r743ce51  
    7878 * @memberof bithenge_sequential_blob_t */
    7979typedef struct bithenge_sequential_blob_ops_t {
     80
     81        /** Get the total size of the blob. If the total size cannot be
     82         * determined easily, this field may be null or return an error,
     83         * forcing the entire blob to be read to determine its size.
     84         *
     85         * @memberof bithenge_blob_t
     86         * @param blob The blob.
     87         * @param[out] size Total size of the blob.
     88         * @return EOK on success or an error code from errno.h.
     89         */
    8090        int (*size)(bithenge_sequential_blob_t *blob, aoff64_t *size);
     91
     92        /** Read the next part of the blob. If the requested data extends
     93         * beyond the end of the blob, the data up until the end of the blob
     94         * will be read.
     95         *
     96         * @param blob The blob.
     97         * @param[out] buffer Buffer to read into. If an error occurs, the contents are
     98         * undefined.
     99         * @param[in,out] size Number of bytes to read; may be 0. If not enough
     100         * data is left in the blob, the actual number of bytes read should be
     101         * stored here. If an error occurs, the contents are undefined.
     102         * @return EOK on success or an error code from errno.h.
     103         */
    81104        int (*read)(bithenge_sequential_blob_t *blob, char *buffer,
    82105            aoff64_t *size);
     106
     107        /** Destroy the blob.
     108         * @param blob The blob.
     109         * @return EOK on success or an error code from errno.h. */
    83110        int (*destroy)(bithenge_sequential_blob_t *blob);
    84111} bithenge_sequential_blob_ops_t;
     
    91118 * @return EOK on success or an error code from errno.h.
    92119 */
    93 static inline int bithenge_blob_size(bithenge_blob_t *blob, aoff64_t *size) {
     120static inline int bithenge_blob_size(bithenge_blob_t *blob, aoff64_t *size)
     121{
     122        assert(blob);
     123        assert(blob->ops);
    94124        return blob->ops->size(blob, size);
    95125}
     
    110140 * @return EOK on success or an error code from errno.h.
    111141 */
    112 static inline int bithenge_blob_read(bithenge_blob_t *blob, aoff64_t offset, char *buffer, aoff64_t *size) {
     142static inline int bithenge_blob_read(bithenge_blob_t *blob, aoff64_t offset,
     143    char *buffer, aoff64_t *size)
     144{
     145        assert(blob);
     146        assert(blob->ops);
    113147        return blob->ops->read(blob, offset, buffer, size);
    114148}
     
    119153 * @return EOK on success or an error code from errno.h.
    120154 */
    121 static inline int bithenge_blob_destroy(bithenge_blob_t *blob) {
     155static inline int bithenge_blob_destroy(bithenge_blob_t *blob)
     156{
     157        assert(blob);
     158        assert(blob->ops);
    122159        return blob->ops->destroy(blob);
    123160}
Note: See TracChangeset for help on using the changeset viewer.