Summary of the invention
In view of above-mentioned the deficiencies in the prior art, it is an object of the invention to provide the method and system of a kind of mobile terminal storage card memory element read-write number of times record, it is intended to solve current mobile terminal storage card and damage the unforeseen problem of risk.
Technical scheme is as follows:
The method of a kind of mobile terminal storage card memory element read-write number of times record, wherein, said method comprising the steps of:
A, storage card pre-set the log file for record storage unit read-write number of times, when detecting that described storage card is inserted into mobile terminal, described log file is copied in mobile terminal;
B, described storage card read or write detected, update the log file preserved in mobile terminal according to testing result;
C, detect that the log file of latest update, when mobile terminal is extracted, is preserved to storage card by described storage card.
The method of described mobile terminal storage card memory element read-write number of times record, wherein, described storage card is microSD card or TF card.
The method of described mobile terminal storage card memory element read-write number of times record, wherein, each memory element one byte content of storage of described storage card.
The method of described mobile terminal storage card memory element read-write number of times record, wherein, reads and writes the object of number of times every 32000 memory cell selecting one memory element as described log file record in the memory element of described storage card.
The method of described mobile terminal storage card memory element read-write number of times record, wherein, reads and writes the object of number of times every 1000 memory cell selecting one memory element as described log file record in the memory element of described storage card.
The method of described mobile terminal storage card memory element read-write number of times record, wherein, in described log file, the information of each memory element of record includes: the number of times that memory unit address, this memory element have been read, the number of times that this memory element has been write.
The method of described mobile terminal storage card memory element read-write number of times record, wherein, described step B also includes:
The log file that detection updates exceedes the memory element reading or writing number of times higher limit, and adds up the quantity of such memory element, it is judged that whether this quantity exceedes default threshold value, if exceeding threshold value, then sends prompting message.
The method of described mobile terminal storage card memory element read-write number of times record, wherein, described default threshold value is the 80% of total number of memory cells.
A kind of system realizing mobile terminal storage card memory element as above read-write number of times recording method, it is characterised in that described system includes:
Storage card detection module, inserts or pull out the action of mobile terminal, and and then trigger recording file replication module for detecting storage card;
Log file replication module, in the mobile terminal copied to by log file, or copied to log file storage card from mobile terminal when storage card is extracted when storage card inserts;
Log file more new module, for updating the log file preserved in mobile terminal according to detected storage card read or write.
Memory module, is used for when detecting that described storage card is inserted into mobile terminal, the log file in storage replication to mobile terminal.
Described mobile terminal storage card memory element read-write number of times record system, wherein, described system also includes:
Judge module, for judging that exceeding of statistics reads or writes the number of memory cells of number of times higher limit and whether exceed default threshold value;
Prompting module, for reading or writing the number of memory cells of number of times higher limit and exceed the judged result of threshold value according to exceeding of described judge module and send prompting message.
Beneficial effect: the present invention provides the method and system of a kind of mobile terminal storage card memory element read-write number of times record, by detecting and recording the read-write number of times in storage card, realize the real-time monitoring to storage card service condition, the storage card that will damage can be given warning in advance, it is to avoid because the damage of storage card causes the risk that subscriber data loses.
Detailed description of the invention
The present invention provides the method and system of a kind of mobile terminal storage card memory element read-write number of times record, and for making the purpose of the present invention, technical scheme and effect clearer, clear and definite, the present invention is described in more detail below.Should be appreciated that specific embodiment described herein, only in order to explain the present invention, is not intended to limit the present invention.
The method of a kind of mobile terminal storage card memory element read-write number of times record, wherein, said method comprising the steps of:
S100, storage card pre-set the log file for record storage unit read-write number of times, when detecting that described storage card is inserted into mobile terminal, described log file is copied in mobile terminal.
Wherein, described storage card is microSD card or TF card, and microSD card, the conventional FAT file system form of TF card at present, and bunch size of acquiescence is 32kB in FAT file system form, bunch be storage cell minimum in file system, i.e. minimum memory unit is 32kB.And each memory element one byte content of storage.It is therefore advantageous in embodiment, the memory element of described storage card reads and writes the object of number of times every 32000 memory cell selecting one memory element as described log file record.So can realize the detection of storage cell all to storage card.
In a further preferred embodiment, least unit bunch in view of storage cards such as file system operation microSD cards is typically all more than 1kB's, therefore, the memory element of described storage card reads and writes the object of number of times every 1000 memory cell selecting one memory element as described log file record.
In described log file, the information of each memory element of record generally comprises: the number of times that memory unit address, this memory element have been read, the number of times that this memory element has been write.Then this information format is (number of times that memory unit address, this memory element have been read, the number of times that this memory element has been write), using every 1000 memory cell selecting one memory element as read-write number of times object as a example by, in log file preserve content as follows:
(0, address is the number of times read of memory element of 0, and address is the number of times write of memory element of 0)
(1000, address is the number of times read of memory element of 1000, and address is the number of times write of memory element of 1000)
(2000, address is the number of times read of memory element of 2000, and address is the number of times write of memory element of 2000)
(3000, address is the number of times read of memory element of 3000, and address is the number of times write of memory element of 3000).
S200, described storage card read or write detected, update the log file preserved in mobile terminal according to testing result.
Described storage card read or write detected, the most concrete detected rule by: judge that this reads or writes the memory unit address of the operation of the storage card number of memory cells whether aliquot is spaced, if it is update the number of times that this address storaging unit has been read or the number of times write;If this read or write storage card operation have multiple memory unit address to meet the number of memory cells that can be spaced to divide exactly, update the number of times that the memory element of these addresses has been read or the number of times write the most successively.Such as, if reading and writing the object of number of times every 1000 memory cell selecting one memory element as described log file record according in the memory element of storage card, then during detection read-write number of times, each memory unit address the most completely tripe during detection once reads or writes can be divided exactly by 1000, if can, then update the number of times read or write of this memory element in log file.
Described step S200 also includes: exceed, in the log file that detection updates, the memory element reading or writing number of times higher limit, and add up the quantity of such memory element, judge whether this quantity exceedes default threshold value, if exceeding threshold value, then send prompting message, remind user to change storage card in time to prevent data from losing.In preferred embodiment, described default threshold value is set by mobile terminal production firm, is usually set to the 80% of total number of memory cells.
S300, detect that the log file of latest update, when mobile terminal is extracted, is preserved to storage card by described storage card.
A kind of system realizing mobile terminal storage card memory element as above read-write number of times recording method as shown in Figure 2, it is characterised in that described system includes:
Storage card detection module 110, inserts or pull out the action of mobile terminal, and and then trigger recording file replication module for detecting storage card;
Log file replication module 120, in the mobile terminal copied to by log file, or copied to log file storage card from mobile terminal when storage card is extracted when storage card inserts;
Log file more new module 130, for updating the log file preserved in mobile terminal according to detected storage card read or write;
Memory module 140, is used for when detecting that described storage card is inserted into mobile terminal, the log file in storage replication to mobile terminal.
Judge module 150, for judging that exceeding of statistics reads or writes the number of memory cells of number of times higher limit and whether exceed default threshold value;
Prompting module 160, for reading or writing the number of memory cells of number of times higher limit and exceed the judged result of threshold value according to exceeding of described judge module and send prompting message.
As shown in Figure 3 be in presently preferred embodiments of the present invention mobile terminal to the storage card memory element read-write system pie graph that records of number of times.
The central processing unit 100 of described mobile terminal is attached with micro SD card 300 by the micro SD card interface 200 arranged.
Storage card detection module 110 that described mobile terminal includes being sequentially connected with, log file replication module 120, memory module 140, log file more new module 130, judge module 150, prompting module 160.Described storage card detection module 110 is connected with micro SD card interface 200, for detect storage card into and out action.When card detection module detect microSD card insert microSD card interface time, trigger recording file replication module from microSD card duplicated record file 310 to memory module;When card detection module detects that microSD card is extracted from microSD card interface, trigger recording file replication module from memory module duplicated record file in microSD card.
Log file replication module: this module from microSD card duplicated record file to the memory module of mobile terminal, or from memory module duplicated record file in microSD card.
Log file more new module: when card detection module detects that central processing unit reads or writes microSD card, updates the number of times that in memory module, corresponding memory element reads or writes.
Judge module: after log file more new module updates, check that the number of times read or write in all memory element of record in memory module exceedes the value of the memory element number reading or writing the number of times upper limit, send alerting signal when this value exceedes default threshold values to prompting module.
Prompting module: the alerting signal that reception judge module sends issues the user with prompting, informs that user changes microSD card 100 in time to prevent data from losing.
Memory module: this module is for when card detection module detects microSD card insertion microSD card interface, being copied to the log file in microSD card in memory module by log file replication module;Afterwards, if card detection module is not detected by microSD card and extracts from microSD card interface, the number of times that the respective memory unit updating memory module record is read to or written by all central processing units by the read or write of microSD card;If card detection module detects that microSD card is extracted from microSD card interface, then during the content in memory module is copied to the log file of microSD card by log file replication module.
The preferred embodiment to the read-write number of times recording method of storage card memory element of the mobile terminal of the present invention is illustrated in conjunction with above-mentioned module and element.
Step 1, card detection module detect that microSD card inserts in microSD card interface;
Step 2, log file replication module from microSD card duplicated record file in memory module;
Step 3, card detection module detect that central processing unit reads or writes microSD card, perform step 4;
Step 4, judge that this reads or writes the memory unit address of the operation of microSD card whether aliquot 1000, if it is update the number of times that the storage unit that in memory module, this address is deposited has been read or the number of times write;If this read or write microSD card operation have multiple memory unit address to meet to be divided exactly by 1000, update the number of times that the memory element of these addresses has been read in memory module or the number of times write the most successively;
The number of times read or write in the memory element of record in step 5, inspection memory module exceedes the value of the memory element number reading or writing the number of times upper limit, sent prompting when this value exceedes default threshold values by prompting module, remind user to change microSD card in time to prevent data from losing.
If mobile terminal action is extracted in microSD card execution, perform following steps:
Step 6, card detection module detect that microSD card is extracted from microSD card interface;
Step 7, log file replication module replicate memory element read-write number of times recorded content in the duplicated record file of microSD card from memory module.
The present invention provides the method and system of a kind of mobile terminal storage card memory element read-write number of times record, by detecting and recording the read-write number of times in storage card, realize the real-time monitoring to storage card service condition, the storage card that will damage can be given warning in advance, it is to avoid because the damage of storage card causes the risk that subscriber data loses.
It should be appreciated that the application of the present invention is not limited to above-mentioned citing, for those of ordinary skills, can be improved according to the above description or convert, all these modifications and variations all should belong to the protection domain of claims of the present invention.