The storage means of high capacity data record in a kind of embedded system
Technical field
The present invention relates in the relatively harsher embedded system of hardware environment, realize the method that high capacity data record is stored.
Background technology
In embedded system environment, receive the influence of aspect factors such as system cost, physical size size, its software and hardware configuration all receives certain limitation.Want under the limited embedded system environment of condition; Completion is to the accessing operation of high capacity data record; Just must be according to the software and hardware principle of computer system data storage and the characteristics of required storage data itself; Adopt appropriate method to store the expense when reducing program run on time and space.
It is to be noted that the Large Volume Data here is meant that the wall scroll record need take more storage space, for example a multimedia message information (MMS) must take the storage space of tens KB.Simultaneously because these data recording have same or analogous attribute, when storage, generally can these data recording be done as a wholely, be stored in the middle of the file, be convenient to operation and the management of application program to these data recording.
Below, for the ease of narration and analysis, will be with the example that is stored as of note and multimedia message.
In mobile device terminal,, generally all be that all note records all are stored in the middle of the file for the storage of short message (SMS).Why short message can adopt such storage mode, is relevant with the data characteristics of short message itself, and the data characteristic of short message is: the wall scroll recording capacity is less, usually below 180Byte; The record number is many, and the message volume of mobile device terminal is about 200 usually.Like this, even all short messages all are stored on the file, its whole file is just about 30KB (150Byte*200/1024 ≈ 30KB) also.Mobile device terminal can both satisfy the so caused expense of file of operation basically at present, and it is fairly simple to adopt such storage mode to implement, so adopt such storage mode still proper concerning short message.
If it is just not too suitable to use same storage means to store multimedia message, much non-existent problem when the storage short message has all come out when the storage multimedia message, and this is that data characteristics by multimedia message itself determines.The data characteristics of multimedia message is: wall scroll multimedia message capacity is bigger, and common one just has tens KB; The record strip number receives the restriction of mobile device terminal storage system, and is less relatively, usually also just about tens.
Shortcoming below existing when adopting the such mode of storage note to store multimedia message:
1. because multimedia message information wall scroll recording capacity is bigger; Article one, the shared storage space of multimedia message information is just suitable with the shared storage space of the whole note file of storage; So; It is very huge just to make that the file of whole storage multimedia message information becomes, and makes the time of record access operation in the file and the expense on the space are multiplied, and causes that the performance of system descends greatly.
2. because multimedia message information record is not a fixed length, so in whole multimedia message files, all cumbersome for operations such as the location of multimedia message record and retrievals.
3. a multimedia message record in the deletion multimedia message files may cause that the vacancy that the front stays because of deletion record is filled up in a large amount of migrations of data of back, causes operation overhead bigger.
Just because of existing top these problems, so we must select a kind of proper storage mode according to the data characteristics of multimedia message information when storage multimedia message information.
Summary of the invention
The technical matters that the present invention solves is exactly in the embedded system of supporting file system, according to the storage characteristics of huge storage capacity recording data, selects a kind of simple, suitable, rational storage scheme.
The storage means of high capacity data record in a kind of embedded system of the present invention, content is: increase a configuration file; Each bar high capacity data record separately as a file storage in file system; Said configuration file is made up of the data recording of fixed length, and each the bar data recording in the configuration file is corresponding to a high capacity data record file.
In said method, when increasing high capacity data record of storage, earlier with this high capacity data record as a file storage in file system, in configuration file, increase a data recording simultaneously.
In said method; In the time will deleting a high capacity data record; Earlier find this high capacity data record corresponding file according to the data recording in the configuration file; Again in file system with the deletion of this high capacity data record corresponding file, delete corresponding data recording in the configuration file at last again or the state of this data recording be changed to deletion.
In said method, when needs read a high capacity data record, at first find this high capacity data record corresponding file according to the data recording in the configuration file, read this document again.
The present invention compared with prior art has following advantage:
1, makes original operation, become operation, make to have operating speed faster an independent high capacity data record file to a high capacity data record in the big file.
2, with the high capacity data record of random length through using the form of configuration file, convert the configuration file record of fixed length to, be convenient to the operations such as storage, deletion, modification, retrieval of high capacity data record.
When 3, deleting a high capacity data record, the lot of data migration operation that can not cause.Because when deleting a high capacity data record, main data manipulation is the pairing file of this high capacity data record of deletion.In file system; Be based on sector (or piece) for the storage operation of file; Deleting a file is exactly in file allocation table (FAT), and the sector that this file is shared (or piece) done delete flag, can not cause the mass data migration that the back data cause when the front is filled up.Simultaneously, be separate between each bar high capacity data record file, the deletion of a high capacity data record file can not exert an influence to other high capacity data record file.
4, can extract the tabulation of all high capacity data records easily according to configuration file, manage all high capacity data records.
Description of drawings
Fig. 1 is the structural drawing between configuration file and the multimedia message log file among the present invention;
Fig. 2 is an exemplary plot of data recording structure in the configuration file of the present invention;
Fig. 3 is the process flow diagram of the present invention's newly-increased multimedia message record in the configuration file that item number is fixed;
Fig. 4 is the process flow diagram of the present invention's newly-increased multimedia message record in the variable configuration file of item number.
Embodiment
Through the example that is stored as, enforcement of the present invention is described below with multimedia message information.Certainly this invention scheme all is suitable for for all data access operations with similar data storage characteristics under the similar hardware environment.
As shown in Figure 1, configuration file is made up of the data recording (the record item among the figure) of some fixed length, with each bar multimedia message record all separately as a file storage in file system, application program is through configuration document processing multimedia message log file.The relevant information of the multimedia message of each data recording storage in the configuration file for example can be stored color subject, sender's number, transmitting time, whether multimedia message has read and information such as this multimedia message information corresponding file name, as shown in Figure 2.
Configuration file can be regarded as the index of multimedia message record, and application program can be easy to find every multimedia message to write down pairing file through configuration file, comes this multimedia message record is read/deletes/revises and wait operation again; Through configuration file, application program can be easy to just generate the tabulation of all multimedia message records simultaneously.
Based on different needs, configuration file can be divided into item number fixing configuration file and the variable configuration file of item number.
The fixing configuration file of item number is exactly that the number that writes down inside the configuration file is fixed; The high capacity data record number of configuration document processing can not surpass its upper limit; When the number of high capacity data record during less than the item number of configuration file record, the unwritten clauses and subclauses in the configuration file will be masked as the deletion state.The fixing configuration file of item number generally is used for the high capacity data record number that needs store can not surpass some, and in the file system under the situation of the so much capacity data record space of sure storage.Adopt the fixing configuration file major advantage of item number be method simple, be convenient to realize.
The variable configuration file of item number is meant that the number of configuration file record changes, and along with the increase and the deletion of high capacity data record, the number that writes down in the configuration file is also along with variation.The bar number that writes down in high capacity data record number of files and the configuration file is consistent, the high capacity data record file of a record management in the configuration file.It is more flexible adopting the major advantage of item number reconfigurable file, is applicable to that high capacity data record bar number changes situation greatly.
Be to be example with the multimedia message below, to high capacity data record add, read, delete, the explanation of frequently-used data recording operation such as modification.
1, the interpolation of multimedia message record
For the fixing configuration file of item number, when adding a multimedia message record, arrive first the configuration file the inside and search whether vacant record item is arranged, also storage is not full to have vacant record item just to show the multimedia message record, can continue to store.At this moment earlier multimedia message is write down as an independent file storage in file system; Again some relevant data of this multimedia message record are write in record of configuration file, for example can time of reception, sender's number of multimedia message information, whether read etc. be write in the record of configuration file.Filename with this huge storage capacity recording file also is stored in the record item of configuration file at last, to set up the linking relationship of configuration file and actual multimedia message log file.As shown in Figure 3.
For the variable configuration file of item number; Whether checked before this has enough spaces to store this multimedia message record in the file system; Just earlier this high capacity data record is advanced file system as an independent file storage if the space is enough, in configuration file, increase some related datas and the filename that the multimedia message record stored in a record again.As shown in Figure 4.
2, the multimedia message record reads
The read operation of multimedia message record is comparatively simple, and item number fixing with the variable configuration file of item number in operation identical.We can obtain the relevant record item of this multimedia message record earlier from configuration file; Therefrom obtain some relevant informations and the pairing filename of this multimedia message log file of multimedia message record, just can in file system, find and read this multimedia message record according to filename more at last.
3, the deletion of multimedia message record
Can in configuration file, obtain the relevant record item of this multimedia message record earlier for the fixing configuration file of item number; And read the pairing filename of this multimedia message log file; Again this file is deleted from file system; Empty some related datas of this record item in the configuration file at last, and the state that will write down is changed to deletion, convenient use in the time next time will increasing a multimedia message record newly.
For the variable configuration file of item number, be after the multimedia message log file is deleted with the fixing unique different place of configuration file of item number, also delete the respective record in the configuration file simultaneously.
4, the modification of multimedia message record
Item number fixing with the variable two kinds of configuration files of item number in; Modification for the multimedia message record all is identical; All be earlier to find this multimedia message to write down pairing configuration file record, revise the multimedia message log file of relative recording and this record sensing in the configuration file again through configuration file.Be noted that when amendment record we possibly only need to revise some relevant informations that write down in the configuration file sometimes, and need not revise multimedia message log file itself.