1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef _LINUX_BUILDID_H 3 #define _LINUX_BUILDID_H 4 5 #include <linux/types.h> 6 7 #define BUILD_ID_SIZE_MAX 20 8 9 struct vm_area_struct; 10 int build_id_parse(struct vm_area_struct *vma, unsigned char *build_id, __u32 *size); 11 int build_id_parse_nofault(struct vm_area_struct *vma, unsigned char *build_id, __u32 *size); 12 int build_id_parse_buf(const void *buf, unsigned char *build_id, u32 buf_size); 13 14 #if IS_ENABLED(CONFIG_STACKTRACE_BUILD_ID) || IS_ENABLED(CONFIG_VMCORE_INFO) 15 extern unsigned char vmlinux_build_id[BUILD_ID_SIZE_MAX]; 16 void init_vmlinux_build_id(void); 17 #else 18 static inline void init_vmlinux_build_id(void) { } 19 #endif 20 21 struct freader { 22 void *buf; 23 u32 buf_sz; 24 int err; 25 union { 26 struct { 27 struct file *file; 28 struct folio *folio; 29 void *addr; 30 loff_t folio_off; 31 bool may_fault; 32 }; 33 struct { 34 const char *data; 35 u64 data_sz; 36 }; 37 }; 38 }; 39 40 void freader_init_from_file(struct freader *r, void *buf, u32 buf_sz, 41 struct file *file, bool may_fault); 42 void freader_init_from_mem(struct freader *r, const char *data, u64 data_sz); 43 const void *freader_fetch(struct freader *r, loff_t file_off, size_t sz); 44 void freader_cleanup(struct freader *r); 45 46 #endif 47