CN107479834A - A kind of file memory method and device based on COS - Google Patents
A kind of file memory method and device based on COS Download PDFInfo
- Publication number
- CN107479834A CN107479834A CN201710749269.3A CN201710749269A CN107479834A CN 107479834 A CN107479834 A CN 107479834A CN 201710749269 A CN201710749269 A CN 201710749269A CN 107479834 A CN107479834 A CN 107479834A
- Authority
- CN
- China
- Prior art keywords
- data storage
- file
- sector
- filename
- read
- 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
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0602—Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
- G06F3/062—Securing storage systems
- G06F3/0622—Securing storage systems in relation to access
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/08—Error detection or correction by redundancy in data representation, e.g. by using checking codes
- G06F11/10—Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's
- G06F11/1004—Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's to protect a block of data words, e.g. CRC or checksum
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0638—Organizing or formatting or addressing of data
- G06F3/0643—Management of files
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0668—Interfaces specially adapted for storage systems adopting a particular infrastructure
- G06F3/0671—In-line storage system
- G06F3/0673—Single storage device
- G06F3/0679—Non-volatile semiconductor memory device, e.g. flash memory, one time programmable memory [OTP]
Abstract
The present invention relates to a kind of file memory method and device based on COS, method includes:The storage request of file is received, wherein, the storage request includes the filename of data to be stored and file to be stored;Data storage sector corresponding to being searched according to the filename of the file to be stored in concordance list, wherein, the corresponding relation being stored with concordance list between filename and data storage sector, corresponding at least two data storage sectors of a filename;By the data storage to be stored to the first data storage sector, wherein, when first data storage sector is asked for the last storage for performing file, a data storage sector of data storage is not carried out.File memory method and device provided by the invention based on COS, memory space is divided with sector, storage method of the prior art can be avoided to cause the waste of system, improve the storage performance of safety chip;And the demand of chip power-down protection is realized in the case where not increasing write-in number.
Description
Technical field
The present invention relates to communication technical field, more particularly to a kind of file memory method and device based on COS.
Background technology
At present, safety chip becomes increasingly prevalent in the life of people.Mobile phone card, bank card, water card, electric card, society
Protect card, access card even identity card is all application of the safety chip in different industries.As what safety chip used increases, its
User data is had nothing in common with each other, and the memory space for how distributing safety chip also becomes more and more important.
Safety chip is the built-in applied system of a soft or hard combination, with smart card operating system (Chip
Operating System, abbreviation:COS) it is used cooperatively, COS is responsible for chip hardware resource, provides use for chip user
Various functions as defined in the handbook of family.The method of chip operating system generally use hierarchical design realizes modularized design,
Four levels can be divided into according to its function:Bottom firmware, storage management system, file system, application system.Bottom firmware
It is responsible for realizing the physical medium operation of chip, including the function such as memory block read-write, interrupt management, Control on Communication, algorithm realization;Text
Part system is responsible for realizing that the establishment of file, selection, read-write, deletion etc. operate;Storage management be responsible for memory block space distribution and
Space reclamation;Application system includes proprietary instruction system and universal instruction set, and universal command is safety chip in different application
The instruction that field can all use includes document creation, selection, read-write etc., proprietary to refer to the distinctive instruction of different industries such as gold
The circle melted deposits, encloses and proposes order.
Existing COS, the small-sized chain file system that generally use is write with C language.Document storage mode is by byte
The data Coutinuous store of division.
Based on this, it was found by the inventors of the present invention that storage method of the prior art memory space meeting after file is deleted
Cavity is formed, for example, after storage request is received, after giving memory allocation to application by byte, when using completion
After can discharge segment space, it is not other enough using can finally form unserviceable storage if the space of release is too small
Cavity.Whole memory space occurs many big and small unserviceable after file of different sizes is created, deleted repeatedly
The waste of system is caused in storage cavity, has a strong impact on the storage performance of safety chip.
The information for being disclosed in the background section is merely intended to understanding of the increase to the general background of the present invention, without answering
It has been the prior art well known to persons skilled in the art when being considered as recognizing or implying the information structure in any form.
The content of the invention
In view of this, the technical problem to be solved in the present invention is how to provide the data processing method of safety chip, with solution
Certainly existing data processing method of the prior art, whole memory space after file of different sizes is created, deleted repeatedly
The problem of waste of system is caused in many unserviceable storage cavities occurs.
To solve above technical problem, the present invention provides a kind of file memory method based on COS, bag in first aspect
Include:The storage request of file is received, wherein, the storage request includes the file of data to be stored and file to be stored
Name;Data storage sector corresponding to being searched according to the filename of the file to be stored in concordance list, wherein, deposited in concordance list
Contain the corresponding relation between filename and data storage sector, corresponding at least two data storage sectors of a filename;By institute
Data storage to be stored is stated to the first data storage sector, wherein, first data storage sector performs text for the last time
During the storage request of part, a data storage sector of data storage is not carried out.
In a kind of possible implementation, the data storage to be stored to the first data storage sector is included:
The count value of multiple data storage sectors corresponding with the filename of the file to be stored is obtained respectively, wherein, the counting
It is worth the storage number for indicating the data storage sector;Deposited using the minimum data storage sector of count value as the first data
Sector is stored up, by the data storage to be stored to first data storage sector;Indicating gage numerical value is added 1, the instruction
Count value of the count value as first data storage sector.
In a kind of possible implementation, the file memory method also includes:The read requests of file are received, its
In, the read requests include the filename of file to be read;Searched in the concordance list and the file to be read
Data storage sector corresponding to filename;Pair data storage sector corresponding with the filename of the reading file is carried out
CRC check, using the CRC check correctly and corresponding with the filename of the file to be read data storage sector is used as the
Two data storage sectors;Read the data in the second data storage sector.
In a kind of possible implementation, it is described by the CRC check correctly and with the text of the file to be read
Data storage sector includes as the second data storage sector corresponding to part name:When exist multiple CRC checks correctly and with institute
When stating data storage sector corresponding to the filename of file to be read, obtain data corresponding with the filename of file to be read and deposit
Store up the count value of sector;By the CRC check is correct and count value highest data corresponding with the filename of file to be read
Sector is stored as second data storage sector.
To solve above technical problem, the present invention provides a kind of file storage device based on COS, bag in second aspect
Include:Receiving module, the storage for receiving file are asked, wherein, the storage request includes data to be stored and treated
The filename of storage file;First processing module, for being searched according to the filename of the file to be stored in concordance list pair
The data storage sector answered, wherein, the corresponding relation being stored with concordance list between filename and data storage sector, a file
Corresponding at least two data storage sectors of name;Second processing module, for by the data storage to be stored to the first data
Sector is stored, wherein, when first data storage sector is asked for the last storage for performing file, data storage is not carried out
A data storage sector.
In a kind of possible implementation, the Second processing module is used for:Obtain and the file to be stored respectively
Filename corresponding to multiple data storage sectors count value, wherein, the count value is used to indicate data storage fan
The storage number in area;Using the minimum data storage sector of count value as the first data storage sector, by the number to be stored
According to storing to first data storage sector;Indicating gage numerical value is added 1, the indicating gage numerical value is deposited as first data
Store up the count value of sector.
In a kind of possible implementation, the file storage device also includes:Receiving module, for receiving file
Read requests, wherein, the read requests include the filename of file to be read;3rd processing module, in the rope
Draw and data storage sector corresponding with the filename of the file to be read is searched in table;Fourth processing module, for pair and institute
State and read the data storage sector corresponding to the filename of file and carry out CRC check, by the CRC check correctly and with institute
Data storage sector corresponding to the filename of file to be read is stated as the second data storage sector;Read module, for reading
Data in second data storage sector.
In a kind of possible implementation, the fourth processing module is used for:When exist multiple CRC checks correctly and
With the filename of the file to be read during corresponding data storage sector, number corresponding with the filename of file to be read is obtained
According to the count value of storage sector;The CRC check is correct and count value highest is corresponding with the filename of file to be read
Data storage sector is as second data storage sector.
File memory method and device provided by the invention based on COS, asked by the storage for receiving file, wherein,
The storage request includes the filename of data to be stored and file to be stored, according to the file of the file to be stored
Name data storage sector corresponding to lookup in concordance list, wherein, it is stored with concordance list between filename and data storage sector
Corresponding relation, corresponding at least two data storage sectors of filename, by the data storage to be stored to the first number
According to storage sector, memory space is divided with sector, storage method of the prior art can be avoided to produce unserviceable cavity
The waste of system is caused, improves the storage performance of safety chip.
Further, it is provided by the invention based on COS's compared to the existing power down protection wiring method repeatedly write
File memory method and device perform a write operation Write-once data field, without backing up the write-in write data and accelerate chip
Speed, simultaneously because using scattered write-in so that storage life extends one times, is realized in the case where not increasing write-in number
The demand of chip power-down protection.
According to below with reference to the accompanying drawings becoming to detailed description of illustrative embodiments, further feature of the invention and aspect
It is clear.
Brief description of the drawings
Comprising in the description and the accompanying drawing of a part for constitution instruction and specification together illustrate the present invention's
Exemplary embodiment, feature and aspect, and for explaining the principle of the present invention.
Fig. 1 shows the flow chart for the file memory method based on COS that one embodiment of the invention provides;
Fig. 2 shows the flow chart for the file memory method based on COS that another embodiment of the present invention provides;
Fig. 3 shows the flow chart for the file memory method based on COS that further embodiment of this invention provides;
Fig. 4 shows the structural representation for the file storage device based on COS that one embodiment of the invention provides;
Fig. 5 shows the structural representation for the file storage device based on COS that another embodiment of the present invention provides.
Embodiment
Below in conjunction with the accompanying drawings, the embodiment of the present invention is described in detail, it is to be understood that the guarantor of the present invention
Shield scope is not limited by embodiment.
To make the purpose, technical scheme and advantage of the embodiment of the present invention clearer, below in conjunction with the embodiment of the present invention
In accompanying drawing, the technical scheme in the embodiment of the present invention is clearly and completely described, it is clear that described embodiment is
Part of the embodiment of the present invention, rather than whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art
The every other embodiment obtained under the premise of creative work is not made, belongs to the scope of protection of the invention.Unless
Separately have it is other explicitly indicate that, otherwise in entire disclosure and claims, term " comprising " or its conversion such as "comprising" or
" including " etc. will be understood to comprise stated element or part, and not exclude other elements or other compositions
Part.
Special word " exemplary " is meant " being used as example, embodiment or illustrative " herein.Here as " exemplary "
Illustrated any embodiment should not necessarily be construed as preferred or advantageous over other embodiments.
In addition, in order to better illustrate the present invention, numerous details is given in embodiment below.
It will be appreciated by those skilled in the art that without some details, the present invention can equally be implemented.In some instances, for
Method well known to those skilled in the art, means, element are not described in detail, in order to highlight the purport of the present invention.
Embodiment 1
In the present embodiment by card operating system installation space manage table, record the use state of sector.To patrol
Volume base unit of the sector as file space management, when memory space of the file size less than mountain area, also take one
The memory space of individual sector.Avoid in the prior art, whole memory space after file of different sizes is created, deleted repeatedly
Occur it is many it is big and small it is unserviceable storage it is empty the problem of.
Specifically, by taking FLASH chip as an example, if sector-size is 256 bytes.Space management table takes 1 sector, preceding
The sum of two byte representation whole available sectors.The sector number of the next space management table of most latter two byte representation.So
One space management table can manage 252 sectors, altogether 64k spaces.Each byte is for a physics in space management table
Sector, if byte, which is 0x55, represents that the sector has used, value is 0xFF if sector is not used.End of file mark
Will is then fused in file data sector to be existed as a part for sector data.
System new files only need during the distribution of space retrieving the byte that content is 0xFF in upper table, by sector number
Space allocation table is corresponded to byte and is written as 0x55 by the initial sector for inserting catalogue directory.Being needed during same Free up Memory will be corresponding
Sector contents are initialized as 0xFF.
Some sector can be left space management table by card when initializing, and insert total number of sectors and by other bytes
0xFF is filled with, viewing system needs to establish the chained list relation of subsequent data.When safety chip establishes file, system can be in space
Manage and effectively record, while rewrite the effective marker of sector record is retrieved in table.
Operation in application flow on file will not influence space management table again, certainly if application needs file big
When small dynamic increases, storage management system can also find new idle record to adapt to apply in space management table for this document
Demand.
Specifically, smartcard file is typically made up of file header and file body two parts.Wherein file header includes file
Summary info, file body preserve the data of file.File header generally comprises filename, file ID, security attribute, size, file
The information such as type, the effect of file header are to provide necessary information and made using can quickly traversal queries file, checking file correlation
Security attribute, at the same file header also provide the supply of the information such as file body address, parent directory address with read file data or
File directory retracts.
Fig. 1 shows the flow chart for the file memory method based on COS that one embodiment of the invention provides, as shown in figure 1, should
Method includes:
Step S1, the storage request of file is received, wherein, the storage request includes data to be stored and waits to deposit
Store up the filename of file.
Specifically, card operating system receives the storage request for the file that read-write equipment is sent.
Step S2, searched according to the filename of the file to be stored in concordance list corresponding to data storage sector, its
In, the corresponding relation that is stored with concordance list between filename and data storage sector, corresponding at least two data of a filename
Store sector.
Concordance list is stored with card operating system, the concordance list creates when card dispatches from the factory.Specifically stored in concordance list
There are the file header of mark filename, and the data storage sector number of multiple startings corresponding with each file.
Establishment process includes:When system wants a newly-built file, it is necessary first to whether literary retrieved in current concordance list
Part has been present, if there is no then searching free sector in space management table.Idle section is found after finding in concordance list
Point, the key message of file yet to be built is organized into file header record and inserts idle node.The free time found in space management table
The data storage sector for the starting that sector number is inserted in concordance list.
Step S3, by the data storage to be stored to the first data storage sector, wherein, first data storage
When sector is asked for the last storage for performing file, a data storage sector of data storage is not carried out.
Specifically, can be according to default when current storage request is asked for the storage that the first time of this document performs
Rule is selected depositing data storage sector corresponding with filename in concordance list at random.When current storage request is
During the storage request that the non-first time of this document performs, when selecting the storage request of last execution file, data are not carried out and are deposited
One sector of storage carries out data storage.
Thus, the file memory method based on COS that the present embodiment provides, asked by the storage for receiving file, wherein,
The storage request includes the filename of data to be stored and file to be stored, according to the file of the file to be stored
Name data storage sector corresponding to lookup in concordance list, wherein, it is stored with concordance list between filename and data storage sector
Corresponding relation, corresponding at least two data storage sectors of filename, by the data storage to be stored to the first number
According to storage sector, memory space is divided with sector, storage method of the prior art can be avoided to produce unserviceable cavity
The waste of system is caused, improves the storage performance of safety chip.
Further, compared to existing power down protection wiring method, the file based on COS that the present embodiment provides stores
Method performs a write operation Write-once data field, without backing up the writing speed write data and accelerate chip, simultaneously because
Using scattered write-in so that storage life extends one times, and realizing chip power-down in the case where not increasing write-in number protects
The demand of shield.
Embodiment 2
The present embodiment is further limited step S3 on the basis of embodiment one, by setting counter type,
When realizing that the last storage for performing file is asked, the selection of a sector of data storage is not carried out.Specifically, can be every
In one data storage sector meter digital is set, the count value for being stored with instruction storage number is realized.
Fig. 2 shows the flow chart for the file memory method based on COS that another embodiment of the present invention provides, as shown in Fig. 2
The method that the present embodiment provides includes:
Step S1, the storage request of file is received, wherein, the storage request includes data to be stored and waits to deposit
Store up the filename of file.
Specifically, card operating system receives the storage request for the file that read-write equipment is sent.
Step S2, searched according to the filename of the file to be stored in concordance list corresponding to data storage sector, its
In, the corresponding relation that is stored with concordance list between filename and data storage sector, corresponding at least two data of a filename
Store sector.
Concordance list is stored with card operating system, the concordance list creates when card dispatches from the factory.Specifically stored in concordance list
There are the file header of mark filename, and the data storage sector of multiple startings corresponding with each file.
Step S31, the counting of multiple data storage sectors corresponding with the filename of the file to be stored is obtained respectively
Value, wherein, the count value is used for the storage number for indicating the data storage sector.
Step S32, will be described to be stored using the minimum data storage sector of count value as the first data storage sector
Data storage is to first data storage sector.
Step S33, indicating gage numerical value is added 1, counting of the indicating gage numerical value as first data storage sector
Value.
Wherein, indicating gage numerical value could be arranged to count value corresponding with each filename, it can also be provided that memory block
In public count value.When indicating gage numerical value be with each filename to it is corresponding when when this document generation data storage after indicating gage
Numerical value adds 1, and the count value assignment of the data storage sector to carrying out this document storage.When indicating gage numerical value is public affairs in memory block
During count value, indicating gage numerical value adds 1, and the data storage sector to being stored after data storage occurs for the memory block
Count value assignment.Specifically, the count value of instruction storage number is stored with each data storage sector.Count value is minimum
Data storage sector illustrate that the number of data storage is minimum, that is, oldest data.Therefore perform data storage when
Wait, prioritizing selection stores the data storage sector of oldest data.
Thus, by obtaining the countings of multiple data storage sectors corresponding with the filename of the file to be stored respectively
Value, using the minimum data storage sector of count value as the first data storage sector, by the data storage to be stored to institute
The first data storage sector is stated, indicating gage numerical value is added 1, meter of the indicating gage numerical value as first data storage sector
Numerical value, come realize it is last perform file storage request when, do not carry out the selection of a sector of data storage, can avoid
Storage method of the prior art produces the waste that system is caused in unserviceable cavity, improves the storage performance of safety chip.
Embodiment 3
The present embodiment is stored with the counting of instruction storage number on the basis of above-described embodiment in data storage sector
Value.Fig. 3 shows the flow chart for the file memory method based on COS that further embodiment of this invention provides, as shown in figure 3, this reality
Applying the method for example offer includes:
Step S4, the read requests of file are received, wherein, the read requests include the filename of file to be read.
Step S5, data storage sector corresponding with the filename of the file to be read is searched in the concordance list.
Wherein, the corresponding relation being stored with concordance list between filename and data storage sector, a filename are corresponding extremely
Few two data storage sectors.
Step S6, pair data storage sector corresponding with the filename of the reading file carries out CRC check, by institute
State CRC check correctly and data storage sector corresponding with the filename of the file to be read is fanned as the second data storage
Area.
Specifically, in step s3, can also include:The crc value of the first data storage sector is calculated, and crc value is deposited
Storage is in the first data storage sector.CRC check method includes:Upon receipt of a read request, the read requests are calculated
CRC, and contrasted with the CRC of the first data storage sector, CRC check is correct if identical.
Wherein, CRC check is the mark whether data completely write, and the incorrect explanation data storage sector of CRC check does not have
There is write-in to complete, may there occurs power down in the storing process of data.
Step S7, read the data in the second data storage sector.
Thus, by receiving the read requests of file, the file with the file to be read is searched in the concordance list
Data storage sector corresponding to name, pair data storage sector corresponding with the filename of the reading file carry out CRC schools
Test, the data storage sector CRC check is correct and corresponding with the filename of the file to be read is as the second number
According to storage sector, the data in the second data storage sector are read, it is possible to achieve read the data completely write, avoid in power down
In the case of data when not writing completely, the reading of deficiency of data, improve the reliability of safety chip.
Further, step S6 can include:
When multiple CRC checks being present correctly and corresponding with the filename of the file to be read data storage sector
When, the count value of acquisition data storage sector corresponding with the filename of file to be read;
By the CRC check is correct and count value highest data storage sector corresponding with the filename of file to be read
As second data storage sector.
Specifically, when multiple CRC checks being present correctly and corresponding with the filename of the file to be read data are deposited
When storing up sector, the data in the data storage sector of count value highest i.e. newest data storage are read.
Thus, by when having multiple CRC checks correctly and corresponding with the filename of a file to be read data
When storing sector, the count value of data storage sector corresponding with the filename of file to be read is obtained;By the CRC check just
Really and count value highest data storage sector corresponding with the filename of file to be read is fanned as second data storage
Area, it is possible to achieve read the data of newest and complete write-in, further increase the reliability of safety chip.
Embodiment 4
Fig. 4 shows the structural representation for the file storage device based on COS that one embodiment of the invention provides, such as Fig. 4 institutes
Show, the device 10 that the present embodiment provides includes:
Receiving module 1, the storage for receiving file are asked, wherein, the storage request includes data to be stored
And the filename of file to be stored;
First processing module 2, for data corresponding to being searched according to the filename of the file to be stored in concordance list
Sector is stored, wherein, the corresponding relation being stored with concordance list between filename and data storage sector a, filename corresponds to extremely
Few two data storage sectors;
Second processing module 3, for by the data storage to be stored to the first data storage sector, wherein, it is described
When first data storage sector is asked for the last storage for performing file, the data storage fan of data storage is not carried out
Area.
Thus, the file memory method based on COS that the present embodiment provides, asked by the storage for receiving file, wherein,
The storage request includes the filename of data to be stored and file to be stored, according to the file of the file to be stored
Name data storage sector corresponding to lookup in concordance list, wherein, it is stored with concordance list between filename and data storage sector
Corresponding relation, corresponding at least two data storage sectors of filename, by the data storage to be stored to the first number
According to storage sector, memory space is divided with sector, storage method of the prior art can be avoided to produce unserviceable cavity
The waste of system is caused, improves the storage performance of safety chip.
Further, compared to existing power down protection wiring method, the file based on COS that the present embodiment provides stores
Method performs a write operation Write-once data field, without backing up the writing speed write data and accelerate chip, simultaneously because
Using scattered write-in so that storage life extends one times.
Further, the Second processing module 3 is used for:Obtain respectively corresponding with the filename of the file to be stored
The count value of multiple data storage sectors, wherein, the count value is used for the storage number for indicating the data storage sector;Will
The minimum data storage sector of count value is as the first data storage sector, by the data storage to be stored to described first
Data storage sector;Indicating gage numerical value is added 1, count value of the indicating gage numerical value as first data storage sector.
Thus, by being stored with the count value of instruction storage number in data storage sector, obtain treated with described respectively
The count value of multiple data storage sectors corresponding to the filename of storage file, using the minimum data storage sector of count value as
First data storage sector, by the data storage to be stored to first data storage sector, by first data
Count value in storage sector adds 1, come realize it is last perform file storage request when, do not carry out a fan of data storage
The selection in area, storage method of the prior art can be avoided to produce the waste that system is caused in unserviceable cavity, improve peace
The storage performance of full chip.
Further, compared to existing power down protection writing station, the file based on COS that the present embodiment provides stores
Method and device performs a write operation Write-once data field, without backing up the writing speed write data and accelerate chip, together
When due to using scattered write-in so that storage life extends one times, and chip is realized in the case where not increasing write-in number
The demand of power down protection.
Embodiment 5
The present embodiment is further limited on the basis of embodiment 4.Fig. 5 shows that another embodiment of the present invention provides
The file storage device based on COS structural representation, as shown in figure 5, the present embodiment provide device also include:
Receiving module 4, for receiving the read requests of file, wherein, the read requests include file to be read
Filename;
3rd processing module 5, for searching number corresponding with the filename of the file to be read in the concordance list
According to storage sector;
Fourth processing module 6, carried out for pair data storage sector corresponding with the filename of the reading file
CRC check, using the CRC check correctly and corresponding with the filename of the file to be read data storage sector is used as the
Two data storage sectors;
Read module 7, for reading the data in the second data storage sector.
Specifically, in step s3, can also include:The crc value of the first data storage sector is calculated, and crc value is deposited
Storage is in the first data storage sector.CRC check method includes:Upon receipt of a read request, the read requests are calculated
CRC, and contrasted with the CRC of the first data storage sector, CRC check is correct if identical.
Wherein, CRC check is the mark whether data completely write, and the incorrect explanation data storage sector of CRC check does not have
There is write-in to complete, may there occurs power down in the storing process of data.
Thus, by receiving the read requests of file, the file with the file to be read is searched in the concordance list
Data storage sector corresponding to name, pair data storage sector corresponding with the filename of the reading file carry out CRC schools
Test, the data storage sector CRC check is correct and corresponding with the filename of the file to be read is as the second number
According to storage sector, the data in the second data storage sector are read, it is possible to achieve read the data completely write, avoid in power down
In the case of data when not writing completely, the reading of deficiency of data, improve the reliability of safety chip.
Further, the fourth processing module 6 is used for:When exist multiple CRC checks correctly and with it is described to be read
Corresponding to the filename of file during data storage sector, data storage sector corresponding with the filename of file to be read is obtained
Count value;By the CRC check is correct and count value highest data storage sector corresponding with the filename of file to be read
As second data storage sector.
Thus, by when having multiple CRC checks correctly and corresponding with the filename of a file to be read data
When storing sector, the count value of data storage sector corresponding with the filename of file to be read is obtained;By the CRC check just
Really and count value highest data storage sector corresponding with the filename of file to be read is fanned as second data storage
Area, it is possible to achieve read the data of newest and complete write-in, further increase the reliability of safety chip.
The description of the foregoing specific illustrative embodiment to the present invention is to illustrate and the purpose of illustration.These descriptions
It is not wishing to limit the invention to disclosed precise forms, and it will be apparent that according to above-mentioned teaching, can be much changed
And change.The purpose of selecting and describing the exemplary embodiment is that explain that the certain principles of the present invention and its reality should
With so that those skilled in the art can realize and utilize the present invention a variety of exemplaries and
Various chooses and changes.The scope of the present invention is intended to be limited by claims and its equivalents.
Device embodiment described above is only schematical, wherein the unit illustrated as separating component can
To be or may not be physically separate, it can be as the part that unit is shown or may not be physics list
Member, you can with positioned at a place, or can also be distributed on multiple NEs.It can be selected according to the actual needs
In some or all of module realize the purpose of this embodiment scheme.Those of ordinary skill in the art are not paying creativeness
Work in the case of, you can to understand and implement.
Claims (8)
- A kind of 1. file memory method based on COS, it is characterised in that including:The storage request of file is received, wherein, the storage request includes the text of data to be stored and file to be stored Part name;Data storage sector corresponding to being searched according to the filename of the file to be stored in concordance list, wherein, in concordance list The corresponding relation being stored between filename and data storage sector, corresponding at least two data storage sectors of a filename;By the data storage to be stored to the first data storage sector, wherein, first data storage sector is upper one When the secondary storage for performing file is asked, a data storage sector of data storage is not carried out.
- 2. file memory method according to claim 1, it is characterised in that by the data storage to be stored to first Data storage sector includes:The count value of multiple data storage sectors corresponding with the filename of the file to be stored is obtained respectively, wherein, it is described Count value is used for the storage number for indicating the data storage sector;Using the minimum data storage sector of count value as the first data storage sector, by the data storage to be stored to institute State the first data storage sector;Indicating gage numerical value is added 1, count value of the indicating gage numerical value as first data storage sector.
- 3. file memory method according to claim 2, it is characterised in that file memory method also includes:The read requests of file are received, wherein, the read requests include the filename of file to be read;Data storage sector corresponding with the filename of the file to be read is searched in the concordance list;Pair data storage sector corresponding with the filename of the reading file carries out CRC check, by the CRC check just Data storage sector true and corresponding with the filename of the file to be read is as the second data storage sector;Read the data in the second data storage sector.
- 4. file memory method according to claim 3, it is characterised in that it is described by the CRC check correctly and with Data storage sector corresponding to the filename of the file to be read includes as the second data storage sector:When correct multiple CRC checks and the corresponding data storage sector with the filename of the file to be read be present, obtain Take the count value of data storage sector corresponding with the filename of file to be read;Using the CRC check correct and count value highest data storage sector corresponding with the filename of file to be read as Second data storage sector.
- A kind of 5. file storage device based on COS, it is characterised in that including:Receiving module, the storage for receiving file are asked, wherein, the storage request includes data to be stored and treated The filename of storage file;First processing module, for data storage fan corresponding to being searched according to the filename of the file to be stored in concordance list Area, wherein, the corresponding relation being stored with concordance list between filename and data storage sector, a filename corresponding at least two Data storage sector;Second processing module, for by the data storage to be stored to the first data storage sector, wherein, it is described first number When being asked according to storage sector for the last storage for performing file, a data storage sector of data storage is not carried out.
- 6. file storage device according to claim 5, it is characterised in that the Second processing module is used for:The count value of multiple data storage sectors corresponding with the filename of the file to be stored is obtained respectively, wherein, it is described Count value is used for the storage number for indicating the data storage sector;Using the minimum data storage sector of count value as the first data storage sector, by the data storage to be stored to institute State the first data storage sector;Indicating gage numerical value is added 1, count value of the indicating gage numerical value as first data storage sector.
- 7. file storage device according to claim 6, it is characterised in that the file storage device also includes:Receiving module, for receiving the read requests of file, wherein, the read requests include the file of file to be read Name;3rd processing module, for searching data storage corresponding with the filename of the file to be read in the concordance list Sector;Fourth processing module, CRC schools are carried out for pair data storage sector corresponding with the filename of the reading file Test, the data storage sector CRC check is correct and corresponding with the filename of the file to be read is as the second number According to storage sector;Read module, for reading the data in the second data storage sector.
- 8. file storage device according to claim 7, it is characterised in that the fourth processing module is used for:Work as presence Multiple CRC checks correctly and with the filename of the file to be read during corresponding data storage sector, obtain with it is to be read The count value of data storage sector corresponding to the filename of file;Using the CRC check correct and count value highest data storage sector corresponding with the filename of file to be read as Second data storage sector.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710749269.3A CN107479834A (en) | 2017-08-28 | 2017-08-28 | A kind of file memory method and device based on COS |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710749269.3A CN107479834A (en) | 2017-08-28 | 2017-08-28 | A kind of file memory method and device based on COS |
Publications (1)
Publication Number | Publication Date |
---|---|
CN107479834A true CN107479834A (en) | 2017-12-15 |
Family
ID=60603780
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710749269.3A Pending CN107479834A (en) | 2017-08-28 | 2017-08-28 | A kind of file memory method and device based on COS |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107479834A (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109215171A (en) * | 2018-08-20 | 2019-01-15 | 深圳市长龙铁路电子工程有限公司 | A kind of storage method of cab signaling equipment data record |
CN109542912A (en) * | 2018-12-04 | 2019-03-29 | 北京锐安科技有限公司 | Interval censored data storage method, device, server and storage medium |
CN110262980A (en) * | 2019-06-17 | 2019-09-20 | 吉林大学 | High-speed memory system based on finite lifetime storage medium |
CN112817527A (en) * | 2021-01-21 | 2021-05-18 | 深圳市显控科技股份有限公司 | Power failure data storage method, single chip microcomputer and computer readable storage medium |
CN114153400A (en) * | 2021-12-08 | 2022-03-08 | 国仪石油技术(无锡)有限公司 | Data storage method for logging instrument |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101042696A (en) * | 2006-03-23 | 2007-09-26 | 北京握奇数据系统有限公司 | Smart card storage system and managing method for file creation in the system |
CN101997918A (en) * | 2010-11-11 | 2011-03-30 | 清华大学 | Method for allocating mass storage resources according to needs in heterogeneous SAN (Storage Area Network) environment |
CN104572681A (en) * | 2013-10-17 | 2015-04-29 | 北京同方微电子有限公司 | Intelligent card file management system and method based on registry |
CN105446894A (en) * | 2014-08-20 | 2016-03-30 | 华为技术有限公司 | Write leveling processing method and apparatus |
CN105677383A (en) * | 2015-12-28 | 2016-06-15 | 北京华大智宝电子系统有限公司 | Method for updating data of smart card |
US20160313926A1 (en) * | 2014-12-03 | 2016-10-27 | Commvault Systems, Inc. | Defensible pruning |
-
2017
- 2017-08-28 CN CN201710749269.3A patent/CN107479834A/en active Pending
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101042696A (en) * | 2006-03-23 | 2007-09-26 | 北京握奇数据系统有限公司 | Smart card storage system and managing method for file creation in the system |
CN101997918A (en) * | 2010-11-11 | 2011-03-30 | 清华大学 | Method for allocating mass storage resources according to needs in heterogeneous SAN (Storage Area Network) environment |
CN104572681A (en) * | 2013-10-17 | 2015-04-29 | 北京同方微电子有限公司 | Intelligent card file management system and method based on registry |
CN105446894A (en) * | 2014-08-20 | 2016-03-30 | 华为技术有限公司 | Write leveling processing method and apparatus |
US20160313926A1 (en) * | 2014-12-03 | 2016-10-27 | Commvault Systems, Inc. | Defensible pruning |
CN105677383A (en) * | 2015-12-28 | 2016-06-15 | 北京华大智宝电子系统有限公司 | Method for updating data of smart card |
Non-Patent Citations (1)
Title |
---|
赵敬等: "《操作系统》", 31 August 2007, 北京:中国铁道出版社 * |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109215171A (en) * | 2018-08-20 | 2019-01-15 | 深圳市长龙铁路电子工程有限公司 | A kind of storage method of cab signaling equipment data record |
CN109542912A (en) * | 2018-12-04 | 2019-03-29 | 北京锐安科技有限公司 | Interval censored data storage method, device, server and storage medium |
CN109542912B (en) * | 2018-12-04 | 2020-10-30 | 北京锐安科技有限公司 | Interval data storage method, device, server and storage medium |
CN110262980A (en) * | 2019-06-17 | 2019-09-20 | 吉林大学 | High-speed memory system based on finite lifetime storage medium |
CN112817527A (en) * | 2021-01-21 | 2021-05-18 | 深圳市显控科技股份有限公司 | Power failure data storage method, single chip microcomputer and computer readable storage medium |
CN114153400A (en) * | 2021-12-08 | 2022-03-08 | 国仪石油技术(无锡)有限公司 | Data storage method for logging instrument |
CN114153400B (en) * | 2021-12-08 | 2024-01-30 | 国仪石油技术(无锡)有限公司 | Data storage method for logging instrument |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107479834A (en) | A kind of file memory method and device based on COS | |
US7003619B1 (en) | Memory device and method for storing and reading a file system structure in a write-once memory array | |
US7146455B2 (en) | System and method for optimized access to memory devices requiring block writing | |
CN106874348B (en) | File storage and index method and device and file reading method | |
US20030225960A1 (en) | Method for partitioning memory mass storage device | |
JP2008041108A (en) | Efficient storage of object in file system | |
CN109669622B (en) | File management method, file management device, electronic equipment and storage medium | |
US6505213B1 (en) | File management apparatus and method | |
CN102541969B (en) | File protection method and system based on file allocation table (FAT) file system, and memory | |
CN101344861B (en) | Smart card internal memory management method | |
CN108733309B (en) | Storage management method, apparatus and computer readable medium | |
US10445001B2 (en) | Memory control scheme for flash memory devices | |
US6967869B1 (en) | Method and device to improve USB flash write performance | |
CN106354718B (en) | File management method and device of user identification module | |
CN107148612A (en) | A kind of method and apparatus of extending user subregion | |
CN111435286A (en) | Data storage method, device and system | |
CN101777077B (en) | Method for implementing file system of embedded device | |
CN110795031A (en) | Data deduplication method, device and system based on full flash storage | |
CN112597102B (en) | High-efficiency mirror image file system implementation method | |
CN109669623A (en) | A kind of file management method, document management apparatus, electronic equipment and storage medium | |
KR101669762B1 (en) | Method and apparatus for recovering leakage of nonvolatile memory | |
CN107454953B (en) | EMV (empirical mode decomposition) implementation method and device | |
CN107526814A (en) | Mobile terminal document storage method and device | |
CN110008183B (en) | File searching method of intelligent card file system | |
CN112015672A (en) | Data processing method, device, equipment and storage medium in storage system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20171215 |