drivers/wifi: Remove unnecessary data structure copy
[coreboot2.git] / util / cbfstool / cbfs_glue.h
blob77f22e5a33ce996db1f653a1162942d9617dac7b
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #ifndef _CBFS_GLUE_H_
4 #define _CBFS_GLUE_H_
6 #include "cbfs_image.h"
8 #define CBFS_ENABLE_HASHING 1
9 #define CBFS_HASH_HWCRYPTO 0
11 typedef const struct cbfs_image *cbfs_dev_t;
13 static inline ssize_t cbfs_dev_read(cbfs_dev_t dev, void *buffer, size_t offset, size_t size)
15 if (buffer_size(&dev->buffer) < offset ||
16 buffer_size(&dev->buffer) - offset < size)
17 return -1;
19 memcpy(buffer, buffer_get(&dev->buffer) + offset, size);
20 return size;
23 static inline size_t cbfs_dev_size(cbfs_dev_t dev)
25 return buffer_size(&dev->buffer);
28 #endif /* _CBFS_GLUE_H_ */