diff --git a/src/file_ibd.c b/src/file_ibd.c index 0631e756..964fa028 100644 --- a/src/file_ibd.c +++ b/src/file_ibd.c @@ -33,6 +33,7 @@ #include "common.h" #include "log.h" +/*@ requires \valid(file_stat); */ static void register_header_check_ibd(file_stat_t *file_stat); const file_hint_t file_hint_ibd= { @@ -49,9 +50,12 @@ const file_hint_t file_hint_ibd= { #define FIL_PAGE_TYPE_FSP_HDR 8 /* File space header */ #define DICT_TF_BITS 6 /* number of flag bits */ #define DICT_TF_FORMAT_SHIFT 5 /* file format */ +#ifdef __FRAMAC__ +#define DICT_TF_FORMAT_MASK 0x20 +#else #define DICT_TF_FORMAT_MASK \ ((~(~0U << (DICT_TF_BITS - DICT_TF_FORMAT_SHIFT))) << DICT_TF_FORMAT_SHIFT) - +#endif #define DICT_TF_FORMAT_ZIP 1 /* InnoDB plugin for 5.1: compressed tables */ struct innodb_fil_header @@ -66,6 +70,18 @@ struct innodb_fil_header uint32_t arch_log_no_or_space_id; } __attribute__ ((gcc_struct, __packed__)); +/*@ + @ requires buffer_size >= sizeof(struct innodb_fil_header); + @ requires buffer_size > FSP_HEADER_OFFSET + FSP_SPACE_FLAGS; + @ requires \valid_read(buffer+(0..buffer_size-1)); + @ requires valid_file_recovery(file_recovery); + @ requires \valid(file_recovery_new); + @ requires file_recovery_new->blocksize > 0; + @ requires separation: \separated(&file_hint_ibd, buffer+(..), file_recovery, file_recovery_new); + @ ensures \result == 0 || \result == 1; + @ ensures \result!=0 ==> valid_file_recovery(file_recovery_new); + @ assigns *file_recovery_new; + @*/ static int header_check_ibd(const unsigned char *buffer, const unsigned int buffer_size, const unsigned int safe_header_only, const file_recovery_t *file_recovery, file_recovery_t *file_recovery_new) { const struct innodb_fil_header *hdr=(const struct innodb_fil_header *)buffer;