diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2018-02-08 09:03:32 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2018-02-08 09:03:32 +0100 |
commit | 0f8aa6b66e304eaaa0756c7017a6d1dd080edd38 (patch) | |
tree | e1f1ee2a8f514ac3d602144c9342a7348c9b26db /include | |
parent | facdf73173e23560bca6e414d5a99c337cb0fa2d (diff) | |
parent | 64b811627651cb58c0feac58a3c2c7c8b94f3881 (diff) | |
download | barebox-0f8aa6b66e304eaaa0756c7017a6d1dd080edd38.tar.gz barebox-0f8aa6b66e304eaaa0756c7017a6d1dd080edd38.tar.xz |
Merge branch 'for-next/constify'
Diffstat (limited to 'include')
-rw-r--r-- | include/bbu.h | 4 | ||||
-rw-r--r-- | include/image-metadata.h | 21 | ||||
-rw-r--r-- | include/libfile.h | 2 |
3 files changed, 14 insertions, 13 deletions
diff --git a/include/bbu.h b/include/bbu.h index 54434b03e0..def568e498 100644 --- a/include/bbu.h +++ b/include/bbu.h @@ -11,12 +11,12 @@ struct bbu_data { #define BBU_FLAG_YES (1 << 1) unsigned long flags; int force; - void *image; + const void *image; const char *imagefile; const char *devicefile; size_t len; const char *handler_name; - struct imd_header *imd_data; + const struct imd_header *imd_data; }; struct bbu_handler { diff --git a/include/image-metadata.h b/include/image-metadata.h index 0ba92469a4..8739bffb92 100644 --- a/include/image-metadata.h +++ b/include/image-metadata.h @@ -56,35 +56,36 @@ static inline int imd_type_valid(uint32_t type) return (type & 0xffff0000) == 0x640c0000; } -struct imd_header *imd_next(struct imd_header *imd); +const struct imd_header *imd_next(const struct imd_header *imd); #define imd_for_each(start, imd) \ for (imd = imd_next(start); imd_read_type(imd) != IMD_TYPE_END; imd = imd_next(imd)) -static inline uint32_t imd_read_le32(void *_ptr) +static inline uint32_t imd_read_le32(const void *_ptr) { - uint8_t *ptr = _ptr; + const uint8_t *ptr = _ptr; return ptr[0] | (ptr[1] << 8) | (ptr[2] << 16) | (ptr[3] << 24); } -static inline uint32_t imd_read_type(struct imd_header *imd) +static inline uint32_t imd_read_type(const struct imd_header *imd) { return imd_read_le32(&imd->type); } -static inline uint32_t imd_read_length(struct imd_header *imd) +static inline uint32_t imd_read_length(const struct imd_header *imd) { return imd_read_le32(&imd->datalength); } -struct imd_header *imd_find_type(struct imd_header *imd, uint32_t type); +const struct imd_header *imd_find_type(const struct imd_header *imd, + uint32_t type); -struct imd_header *imd_get(void *buf, int size); -const char *imd_string_data(struct imd_header *imd, int index); +const struct imd_header *imd_get(const void *buf, int size); +const char *imd_string_data(const struct imd_header *imd, int index); const char *imd_type_to_name(uint32_t type); -char *imd_concat_strings(struct imd_header *imd); -const char *imd_get_param(struct imd_header *imd, const char *name); +char *imd_concat_strings(const struct imd_header *imd); +const char *imd_get_param(const struct imd_header *imd, const char *name); extern int imd_command_verbose; int imd_command_setenv(const char *variable_name, const char *value); diff --git a/include/libfile.h b/include/libfile.h index dd0b00f988..eb4311d0bc 100644 --- a/include/libfile.h +++ b/include/libfile.h @@ -11,7 +11,7 @@ void *read_file(const char *filename, size_t *size); int read_file_2(const char *filename, size_t *size, void **outbuf, loff_t max_size); -int write_file(const char *filename, void *buf, size_t size); +int write_file(const char *filename, const void *buf, size_t size); int copy_file(const char *src, const char *dst, int verbose); |