sp_btr.h 959 B

12345678910111213141516171819202122232425262728293031
  1. #ifndef SP_BTR_H
  2. #define SP_BTR_H
  3. #pragma once
  4. #include "array.h"
  5. #include "sp_def.h"
  6. // boot record utility functions
  7. typedef struct sp_btr_reocrd_t {
  8. unsigned int tm_start;
  9. sp_version_t version;
  10. unsigned int tm_shutdown;
  11. int shutdown_reason; // 重启原因
  12. int shutdown_reason_cnt;
  13. int shutdown_way; // 重启方式。包括3中重启类型:框架重启、操作系统重启、电源重启
  14. int shutdown_way_cnt;
  15. }sp_btr_reocrd_t;
  16. typedef struct sp_btr_context_t {
  17. sp_btr_reocrd_t last_boot_info;
  18. unsigned int cur_start_time;
  19. sp_version_t cur_version;
  20. }sp_btr_context_t;
  21. SPBASE_API int sp_btr_write_on_start(const char *bootrec_path, sp_version_t *version, sp_btr_context_t **p_ctx);
  22. SPBASE_API int sp_btr_write_on_shutdown(const char *bootrec_path, sp_btr_context_t *ctx, int reason, int way);
  23. sp_btr_reocrd_t* sp_btr_get_rec_before(const char *bootrec_path, sp_btr_context_t *ctx, unsigned int before_this_time);
  24. #endif // SP_BTR_H