Add local copy of commit-msg hook
[coreboot.git] / util / cbfstool / common.h
index a41eb8a439e468c6235189025f10b64fda62e8e2..8f397d8e65690632dbbfda1815bd07231d383a79 100644 (file)
  */
 
 #include <stdint.h>
+#ifndef WIN32
+#include <arpa/inet.h>
+#else
+#define ntohl(x) (((x)>>24) | ((x)<<24) | (((x)>>8)&0xff00) | (((x)<<8)&0xff0000))
+#define htonl ntohl
+#endif
 
 extern void *offset;
 extern struct cbfs_header *master_header;
@@ -34,10 +40,11 @@ static uint32_t virt_to_phys(void *addr)
 
 #define ALIGN(val, by) (((val) + (by)-1)&~((by)-1))
 
+uint32_t getfilesize(const char *filename);
 void *loadfile(const char *filename, uint32_t * romsize_p, void *content,
               int place);
 void *loadrom(const char *filename);
-void writerom(const char *filename, void *start, uint32_t size);
+int writerom(const char *filename, void *start, uint32_t size);
 
 int iself(unsigned char *input);
 
@@ -61,5 +68,11 @@ int create_cbfs_image(const char *romfile, uint32_t romsize,
 
 int add_file_to_cbfs(void *content, uint32_t contentsize, uint32_t location);
 void print_cbfs_directory(const char *filename);
+int extract_file_from_cbfs(const char *filename, const char *payloadname, const char *outpath);
+
+uint32_t cbfs_find_location(const char *romfile, uint32_t filesize,
+                           const char *filename, uint32_t align);
+
+void print_supported_filetypes(void);
 
 #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))