lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 1 | /******************************************************************************* |
| 2 | * °æÈ¨ËùÓÐ (C)2016, ÖÐÐËͨѶ¹É·ÝÓÐÏÞ¹«Ë¾¡£ |
| 3 | * |
| 4 | * ÎļþÃû³Æ: nvserver.h |
| 5 | * Îļþ±êʶ: nvserver.h |
| 6 | * ÄÚÈÝÕªÒª: nvºǫ́ӦÓÃÍ·Îļþ |
| 7 | * ʹÓ÷½·¨: #include <nvserver.h> |
| 8 | * |
| 9 | * ÐÞ¸ÄÈÕÆÚ °æ±¾ºÅ Ð޸ıê¼Ç ÐÞ¸ÄÈË ÐÞ¸ÄÄÚÈÝ |
| 10 | * ------------------------------------------------------------------------------ |
| 11 | * 2016/09/20 V1.0 Create ÍõÇæ ´´½¨ |
| 12 | * |
| 13 | *******************************************************************************/ |
| 14 | #ifndef _NVSERVER_H |
| 15 | #define _NVSERVER_H |
| 16 | |
| 17 | /******************************************************************************* |
| 18 | * Í·Îļþ * |
| 19 | *******************************************************************************/ |
| 20 | |
| 21 | /******************************************************************************* |
| 22 | * ºê¶¨Òå * |
| 23 | *******************************************************************************/ |
| 24 | #define NV_PATH_LEN 256 |
| 25 | #define NV_HASH_LEN 512 |
| 26 | #define NV_HASH_MUL 31 |
| 27 | #define NV_MAX_CONFIG_LEN 512 |
| 28 | |
| 29 | #define NV_CONFIG_FILE "/etc_ro/nvconfig" |
| 30 | #define NV_FS_PATH "/etc_rw/nv" |
| 31 | #define NV_FS_MAIN_PATH "/etc_rw/nv/main" |
| 32 | #define NV_FS_BACKUP_PATH "/etc_rw/nv/backup" |
| 33 | |
| 34 | #define NV_BLOCK_SIZE 4096 |
| 35 | #define NV_FILE_FLAG 0x123 |
| 36 | |
| 37 | #define NV_CFG "cfg" |
| 38 | #define NV_RO "ro" |
| 39 | #define NV_RTDEV "rtdev" |
| 40 | #define NV_CERT "cert" |
| 41 | #define NV_WAPI "wapi" |
| 42 | /******************************************************************************* |
| 43 | * Êý¾ÝÀàÐͶ¨Òå * |
| 44 | *******************************************************************************/ |
| 45 | typedef enum { false, true } bool; |
| 46 | |
| 47 | typedef struct nv_item |
| 48 | { |
| 49 | char *key; |
| 50 | char *value; |
| 51 | int saveFlag; |
| 52 | int update_flag; |
| 53 | struct nv_item *next; |
| 54 | } T_NV_ITEM; |
| 55 | |
| 56 | typedef struct nv_config |
| 57 | { |
| 58 | char configFile[NV_PATH_LEN]; |
| 59 | struct nv_config *next; |
| 60 | } T_NV_CONFIG; |
| 61 | |
| 62 | typedef struct nv_node |
| 63 | { |
| 64 | char nvFile[NV_PATH_LEN]; |
| 65 | T_NV_CONFIG *fileList; |
| 66 | T_NV_ITEM *nvTable[NV_HASH_LEN]; |
| 67 | struct nv_node *next; |
| 68 | }T_NV_NODE ; |
| 69 | |
| 70 | /******************************************************************************* |
| 71 | * È«¾Ö±äÁ¿ÉùÃ÷ * |
| 72 | *******************************************************************************/ |
| 73 | |
| 74 | /******************************************************************************* |
| 75 | * È«¾Öº¯ÊýÉùÃ÷ * |
| 76 | *******************************************************************************/ |
| 77 | int nvupdate(char *nv_file, char *config_file, const char *key, const char *value, int saveFlag); |
| 78 | int reloadFactroyParam(T_NV_NODE *list); |
| 79 | int delete_not_needed(T_NV_NODE *list); |
| 80 | uint hash(const char *s); |
| 81 | int get_update_status (void); |
| 82 | |
| 83 | #endif |
| 84 | |