CN105528213A - Method for preventing same parameters from being written in Flash configuration area - Google Patents
Method for preventing same parameters from being written in Flash configuration area Download PDFInfo
- Publication number
- CN105528213A CN105528213A CN201510893779.9A CN201510893779A CN105528213A CN 105528213 A CN105528213 A CN 105528213A CN 201510893779 A CN201510893779 A CN 201510893779A CN 105528213 A CN105528213 A CN 105528213A
- Authority
- CN
- China
- Prior art keywords
- parameter
- flash
- hash table
- parameter value
- write
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/60—Software deployment
- G06F8/65—Updates
- G06F8/654—Updates using techniques specially adapted for alterable solid state memories, e.g. for EEPROM or flash memories
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/70—Software maintenance or management
- G06F8/73—Program documentation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/448—Execution paradigms, e.g. implementations of programming paradigms
- G06F9/4494—Execution paradigms, e.g. implementations of programming paradigms data driven
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computer Security & Cryptography (AREA)
- Library & Information Science (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The present invention relates to the technical field of data storage, and specifically relates to a method for preventing the same parameters from being written in a Flash configuration area. The method comprises the steps of writing data in a Flash through control of a driving layer; arranging a Hash table in the driving layer; and determining whether the to-be-written-in parameter submitted by a user is already stored in the Hash table by the driving layer, if so, not-executing write-in operation, and if not, executing the write-in operation. Due to the fact that the driving layer determines the parameter submitted by the user is already in the Hash table, and if the parameter is not present or is different from original parameters, the write-in operation is executed, the write-in number of the Flash is reduced; the Flash parameters are maintained by using the Hash table, and the parameters can be searched rapidly; the parameters in the Flash are saved in JSON formats and are convenient to parse and clear in structure; and at the same time, write-in of the Flash is controlled by the driving layer, and system safety is improved.
Description
Technical field
The present invention relates to and store data technique field, be specifically related to a kind of method prevented to Flash configuring area write identical parameters.
Background technology
Nowadays, embedded device has been dissolved into the everywhere in our life, as Intelligent bracelet, Set Top Box, home router etc., these embedded devices often all use Flash to come storing software firmware and configuration information, software firmware is generally read-only can't modifying to it, configuration information is generally kept at certain fixed area on Flash, and user to use in the process of embedded device the read-write motion carrying out repeatedly to configuration parameter region.
Universal along with privately owned cloud concept, we at one's side a lot of intelligent embedded device have the function being linked into Cloud Server, this must bring a lot of convenience to us, but also more and more frequent to the operation of embedded device like this.We are kept on embedded device with the form of parameter to the operation that embedded device carries out, the erasable action carrying out repeatedly to the configuration parameter region of embedded device so undoubtedly, but repeatedly erasable can be with the problem of serving, such as: one is the serviceable life that can reduce embedded device Flash, two is that in erasable process, accident power-off can make former configuration information lose, and three is repeatedly that Flash erase/write can take more system resource influential system system energy.
Current embedded device is all often directly be kept on Flash to the parameter that client layer is submitted to, namely client layer submits action drives layer to each time all by an erasable Flash, but the parameter that a lot of client layer is submitted to is all identical, as the mutual data of privately owned cloud and embedded device, the data that user's repetitive operation is submitted to and some data etc. that client layer timing stores.
Therefore, how to avoid writing identical parameter to Flash configuring area and become a great problem that those skilled in the art face.
Summary of the invention
For the deficiencies in the prior art, the invention provides a kind of method prevented to Flash configuring area write identical parameters, control by driving layer to write data in Flash, Hash table is set at driving layer simultaneously, drives layer to judge whether the parameter that will write that user submits to is stored in Hash table, if exist, then do not perform write operation, otherwise, the just write operation of execution parameter, this technical scheme is specially:
Prevent the method to Flash configuring area write identical parameters, be applied in embedded system, wherein, described method comprises:
Client layer submits the data that will write Flash configuring area to;
Layer is driven to be the packet comprising parameter name and parameter value by described Data Analysis;
Drive in layer traversal queries Hash table and whether there is described parameter name, if do not exist, then by described parameter name and described parameter value write Hash table; If exist, whether the parameter value that described driving layer continues the described parameter value of inquiry corresponding with parameter name described in Hash table is identical, if not identical, then by parameter value region corresponding for parameter name described in described parameter value write Hash table, and described parameter name and parameter value are saved to Flash.
The above-mentioned method prevented to Flash configuring area write identical parameters, wherein, in described method, drives layer to be that before comprising the packet of parameter name and parameter value, the step of carrying out also comprises by described Data Analysis:
Layer is driven to set up the Hash table comprising parameter name and parameter value.
The above-mentioned method prevented to Flash configuring area write identical parameters, wherein, described driving layer is set up the method comprising the Hash table of parameter name and parameter value and is also comprised:
Start described embedded system;
Described driving layer reads the parameter being present in configuring area;
Judge whether the parameter of described configuring area runs through, if run through, then terminates; If do not run through, then continue read and the parameter of reading is kept at described Hash table.
The above-mentioned method prevented to Flash configuring area write identical parameters, wherein, in described method, continues to read and the method parameter of reading being kept at described Hash table also comprises:
For the parameter name that reads from configuring area and parameter value allocation space are to preserve;
The parameter name read is used to calculate cryptographic hash;
Judge whether address corresponding to described cryptographic hash is empty, if it is empty, then the described parameter name read and parameter value is saved to address place corresponding to described cryptographic hash, otherwise, then point to the next address place of described cryptographic hash corresponding address.
The above-mentioned method prevented to Flash configuring area write identical parameters, wherein, in described method, client layer submits to the step of the carrying out before will writing the data of Flash configuring area also to comprise:
Client layer receives the data of user and/or Cloud Server transmission.
The above-mentioned method prevented to Flash configuring area write identical parameters, wherein, described parameter name and parameter value are saved to Flash with the form of JSON.
Compared with prior art, advantage of the present invention is:
Judge whether the parameter that user submits to exists in Hash table by driving layer, if not exist or not identical with raw parameter, just perform write operation, decrease the write number of times of Flash, Hash table is adopted to safeguard Flash parameter, have and search feature rapidly, meanwhile, the parameter on Flash is saved as JSON form, there is the feature of convenient parsing and clear in structure, meanwhile, drive the write of layer control Flash, improve the security of system.
Accompanying drawing explanation
Fig. 1 prevents the method flow diagram to Flash configuring area write identical parameters in one embodiment of the invention;
Fig. 2 is the algorithm pattern driving layer reading configuring area parameter to set up Hash table in one embodiment of the invention;
Fig. 3 drives layer to judge the structural representation of user the need of write flash memory in one embodiment of the invention;
Fig. 4 is the structural representation of storage configuration parameter in one embodiment of the invention.
Embodiment
Below in conjunction with the drawings and specific embodiments, the invention will be further described, but not as limiting to the invention.
Below in conjunction with the accompanying drawing in the embodiment of the present invention, be clearly and completely described the technical scheme in the embodiment of the present invention, obviously, described embodiment is only the present invention's part embodiment, instead of whole embodiments.Based on the embodiment in the present invention, the every other embodiment that those of ordinary skill in the art obtain under the prerequisite of not making creative work, all belongs to the scope of protection of the invention.
It should be noted that, when not conflicting, the embodiment in the present invention and the feature in embodiment can combine mutually.
Below in conjunction with the drawings and specific embodiments, the invention will be further described, but not as limiting to the invention.
Structure shown in Figure 1, the invention provides a kind of method prevented to Flash configuring area write identical parameters, the method comprises:
First, client layer submits the data that will write Flash configuring area to;
Continue, drive layer to be the packet comprising parameter name and parameter value by Data Analysis;
Finally, drive in layer traversal queries Hash table whether there is parameter name, if do not exist, then by parameter name and parameter value write Hash table; If exist, whether the parameter value driving layer to continue query parameter values corresponding with parameter name in Hash table is identical, if not identical, then parameter value write parameter value region corresponding to parameter name in Hash table, and parameter name and parameter value are saved to Flash.
As a preferred embodiment of the invention, in method, layer is driven to be that before comprising the packet of parameter name and parameter value, the step of carrying out also comprises by Data Analysis:
Layer is driven to set up the Hash table comprising parameter name and parameter value.
On this basis, further, drive layer to set up the method comprising the Hash table of parameter name and parameter value also to comprise:
Start embedded system;
Layer is driven to read the parameter being present in configuring area;
Judge whether the parameter of configuring area runs through, if run through, then terminates; If do not run through, then continue read and the parameter of reading is kept at Hash table.
On this basis, further, in the method, continue to read and the method parameter of reading being kept at Hash table also comprises:
For the parameter name that reads from configuring area and parameter value allocation space are to preserve;
The parameter name read is used to calculate cryptographic hash;
Judge whether address corresponding to cryptographic hash is empty, if it is empty, then the parameter name read and parameter value is saved to address place corresponding to cryptographic hash, otherwise, then point to the next address place of cryptographic hash corresponding address.
As a preferred embodiment of the invention, in the method, client layer submits to the step of the carrying out before will writing the data of Flash configuring area also to comprise:
Client layer receives the data of user and/or Cloud Server transmission.
As a preferred embodiment of the invention, parameter name and parameter value are saved to Flash with the form of JSON.
As follows, enumerate a specific embodiment:
1. drive layer to set up Hash table
Structure shown in Figure 2, when embedded device starts, layer is driven first to read the data in parameter configuration region on Flash, data are preserved with JSON form, layer is driven to be become by each Parameter analysis of electrochemical parameter name and parameter value two parts to be kept in the middle of structure, calculate cryptographic hash according to parameter name, according to cryptographic hash, the structure of distribution is linked to the relevant position of Hash table, the argument structure body daisy chaining of identical cryptographic hash is received after ltsh chain table.
After embedded system starts, layer circulation is driven to read configuring area parameter, be that parameter value and parameter name are saved in the structure of distribution by the Parameter analysis of electrochemical of JSON form, cryptographic hash is calculated according to parameter name, then the address that this cryptographic hash is corresponding is found, if address void value, by this structure assignment to herein, otherwise by next for pointed structure address, until when this address is empty by this structure assignment to herein, finally realize the foundation of Hash table.
2. drive the parameter that layer analysis client layer transmits
Structure shown in Figure 3, client layer needs the parameter of preserving by interface to driving layer transmission, drive layer can judge that user passes parameter and whether exists, whether parameter value changes, only have the parameter configuration region being just saved in Flash when parameter name does not exist or parameter value is different, otherwise be left intact.
When client layer transmits data to driving layer, layer is driven to calculate cryptographic hash according to the parameter name passed over, and according to the corresponding address of this cryptographic hash by pointed Hash table.This address is the empty parameter then not having this cryptographic hash, then newly will distribute a structure and preserve this parameter name and parameter value, and be inserted in Hash table; This address is not for sky then checks that whether its parameter name is the same, parameter name is different just points to next structure address, parameter name is the same, and whether equally contrast its parameter value, parameter value is equally left intact, and parameter value is different, new parameter value is saved as the parameter value of this structure.Only have when there is no this parameter in Hash table, or just the Parameter nodes in Hash table is converted into JSON formatted data when its parameter value changes and is saved on Flash, realize preventing from writing identical parameters to Flash.
3. the storage of configuration parameter
The storage of configuration parameter is realized by driving layer, when differentiating the parameter that client layer is submitted to and the local parameter stored is inconsistent, drives layer the argument structure body that Hash table is safeguarded to be saved on the storage area of Flash with the form of JSON.
As shown in Figure 4, when driving layer differentiation to need the parameter that user submits to be saved on Flash, first a transformed space is distributed, then from the header element address of Hash table, all Parameter nodes under this cryptographic hash chained list are converted to JSON form and are saved in transformed space, according to this rule, the Parameter nodes in all Hash tables is all changed, data entirety the most at last on transformed space is saved on Flash, realizes the storage of configuration parameter.
In sum, the invention provides a kind of method prevented to Flash configuring area write identical parameters, control by driving layer to write data in Flash, Hash table is set at driving layer simultaneously, layer is driven to judge whether the parameter that will write that user submits to has been stored in Hash table, if exist, then do not perform write operation, otherwise, the just write operation of execution parameter, judge whether the parameter that user submits to exists in Hash table by driving layer, if not exist or not identical with raw parameter, just perform write operation, decrease the write number of times of Flash, Hash table is adopted to safeguard Flash parameter, have and search feature rapidly, simultaneously, parameter on Flash is saved as JSON form, there is the feature of convenient parsing and clear in structure, simultaneously, drive the write of layer control Flash, improve the security of system.
The foregoing is only preferred embodiment of the present invention; not thereby embodiments of the present invention and protection domain is limited; to those skilled in the art; should recognize and all should be included in the scheme that equivalent replacement done by all utilizations instructions of the present invention and diagramatic content and apparent change obtain in protection scope of the present invention.
Claims (6)
1. prevent the method to Flash configuring area write identical parameters, be applied in embedded system, it is characterized in that, described method comprises:
Client layer submits the data that will write Flash configuring area to;
Layer is driven to be the packet comprising parameter name and parameter value by described Data Analysis;
Drive in layer traversal queries Hash table and whether there is described parameter name, if do not exist, then by described parameter name and described parameter value write Hash table; If exist, whether the parameter value that described driving layer continues the described parameter value of inquiry corresponding with parameter name described in Hash table is identical, if not identical, then by parameter value region corresponding for parameter name described in described parameter value write Hash table, and described parameter name and parameter value are saved to Flash.
2. prevent from as claimed in claim 1, to the method for Flash configuring area write identical parameters, it is characterized in that, in described method, drive layer to be that before comprising the packet of parameter name and parameter value, the step of carrying out also comprises by described Data Analysis:
Layer is driven to set up the Hash table comprising parameter name and parameter value.
3. prevent from as claimed in claim 2, to the method for Flash configuring area write identical parameters, it is characterized in that, described driving layer is set up the method comprising the Hash table of parameter name and parameter value and is also comprised:
Start described embedded system;
Described driving layer reads the parameter being present in configuring area;
Judge whether the parameter of described configuring area runs through, if run through, then terminates; If do not run through, then continue read and the parameter of reading is kept at described Hash table.
4. prevent from as claimed in claim 3, to the method for Flash configuring area write identical parameters, it is characterized in that, in described method, continue to read and the method parameter of reading being kept at described Hash table also comprises:
For the parameter name that reads from configuring area and parameter value allocation space are to preserve;
The parameter name read is used to calculate cryptographic hash;
Judge whether address corresponding to described cryptographic hash is empty, if it is empty, then the described parameter name read and parameter value is saved to address place corresponding to described cryptographic hash, otherwise, then point to the next address place of described cryptographic hash corresponding address.
5. prevent from as claimed in claim 1, to the method for Flash configuring area write identical parameters, it is characterized in that, in described method, client layer submits to the step of the carrying out before will writing the data of Flash configuring area also to comprise:
Client layer receives the data of user and/or Cloud Server transmission.
6. prevent the method to Flash configuring area write identical parameters as claimed in claim 1, it is characterized in that, described parameter name and parameter value are saved to Flash with the form of JSON.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510893779.9A CN105528213A (en) | 2015-12-04 | 2015-12-04 | Method for preventing same parameters from being written in Flash configuration area |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510893779.9A CN105528213A (en) | 2015-12-04 | 2015-12-04 | Method for preventing same parameters from being written in Flash configuration area |
Publications (1)
Publication Number | Publication Date |
---|---|
CN105528213A true CN105528213A (en) | 2016-04-27 |
Family
ID=55770462
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510893779.9A Pending CN105528213A (en) | 2015-12-04 | 2015-12-04 | Method for preventing same parameters from being written in Flash configuration area |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105528213A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2023274195A1 (en) * | 2021-06-28 | 2023-01-05 | 杭州涂鸦信息技术有限公司 | Firmware configuration method and apparatus, device and storage medium |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6687815B1 (en) * | 2000-02-01 | 2004-02-03 | Sun Microsystems, Inc. | Method and apparatus for storing non-volatile configuration information |
CN101419571A (en) * | 2008-12-04 | 2009-04-29 | 上海大学 | Method for storing configuration parameter in NOR FLASH based on Hash arithmetic |
CN101436158A (en) * | 2008-12-25 | 2009-05-20 | 中兴通讯股份有限公司 | Parameter management method and system based on embedded type equipment flash memory |
CN102289388A (en) * | 2011-09-05 | 2011-12-21 | 浪潮电子信息产业股份有限公司 | Extension method for managing IPMI (Intelligent Platform Management Interface) interface protocol by server |
CN103544151A (en) * | 2012-07-09 | 2014-01-29 | 上海斐讯数据通信技术有限公司 | Method and system for processing data in linux system |
-
2015
- 2015-12-04 CN CN201510893779.9A patent/CN105528213A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6687815B1 (en) * | 2000-02-01 | 2004-02-03 | Sun Microsystems, Inc. | Method and apparatus for storing non-volatile configuration information |
CN101419571A (en) * | 2008-12-04 | 2009-04-29 | 上海大学 | Method for storing configuration parameter in NOR FLASH based on Hash arithmetic |
CN101436158A (en) * | 2008-12-25 | 2009-05-20 | 中兴通讯股份有限公司 | Parameter management method and system based on embedded type equipment flash memory |
CN102289388A (en) * | 2011-09-05 | 2011-12-21 | 浪潮电子信息产业股份有限公司 | Extension method for managing IPMI (Intelligent Platform Management Interface) interface protocol by server |
CN103544151A (en) * | 2012-07-09 | 2014-01-29 | 上海斐讯数据通信技术有限公司 | Method and system for processing data in linux system |
Non-Patent Citations (1)
Title |
---|
吴国伟,姚琳,毕成龙: "《深入理解Linux驱动程序设计》", 30 November 2015, 清华大学出版社 * |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2023274195A1 (en) * | 2021-06-28 | 2023-01-05 | 杭州涂鸦信息技术有限公司 | Firmware configuration method and apparatus, device and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105242871B (en) | A kind of method for writing data and device | |
JP4659888B2 (en) | Database processing system, computer and database processing method | |
CN104239234B (en) | The management of a kind of local cache efficiently and reading/writing method | |
CN107728937B (en) | Key value pair persistent storage method and system using nonvolatile memory medium | |
CN103164490B (en) | A kind of efficient storage implementation method of not fixed-length data and device | |
CN103885887B (en) | User data storage method, read method and system | |
CN107784108A (en) | A kind of data storage and management method, device and equipment | |
CN104461397A (en) | Solid-state drive and read-write method thereof | |
CN113377695B (en) | Data distribution method of read-write separated solid-state storage device | |
CN103942301B (en) | Distributed file system oriented to access and application of multiple data types | |
US11775188B2 (en) | Communications to reclaim storage space occupied by proof of space plots in solid state drives | |
US20230185738A1 (en) | Automated Participation of Solid State Drives in Activities Involving Proof of Space | |
CN102880671A (en) | Method for actively deleting repeated data of distributed file system | |
CN107957852B (en) | Method for improving performance consistency of solid state disk | |
CN103440205A (en) | Method and device for storing data of set top box | |
CN103136215A (en) | Data read-write method and device of storage system | |
CN106326040B (en) | Snapshot metadata management method and device | |
CN103365926A (en) | Method and device for storing snapshot in file system | |
CN107463506A (en) | A kind of data storage and management method of electric energy meter | |
CN104778100A (en) | Safe data backup method | |
CN105528213A (en) | Method for preventing same parameters from being written in Flash configuration area | |
WO2016206070A1 (en) | File updating method and storage device | |
CN102521077B (en) | Anti-plug read-in method and system for file | |
US9501414B2 (en) | Storage control device and storage control method for cache processing according to time zones | |
Fisher et al. | A hybrid filesystem for hard disk drives in tandem with flash memory |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20160427 |
|
RJ01 | Rejection of invention patent application after publication |