CN102567522B - Method and device for managing file system of intelligent card - Google Patents

Method and device for managing file system of intelligent card Download PDF

Info

Publication number
CN102567522B
CN102567522B CN201110448251.2A CN201110448251A CN102567522B CN 102567522 B CN102567522 B CN 102567522B CN 201110448251 A CN201110448251 A CN 201110448251A CN 102567522 B CN102567522 B CN 102567522B
Authority
CN
China
Prior art keywords
fragment
piece
record
different sizes
file
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.)
Expired - Fee Related
Application number
CN201110448251.2A
Other languages
Chinese (zh)
Other versions
CN102567522A (en
Inventor
解宁浦
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Watchdata Co ltd
Original Assignee
Beijing WatchData System Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Beijing WatchData System Co Ltd filed Critical Beijing WatchData System Co Ltd
Priority to CN201110448251.2A priority Critical patent/CN102567522B/en
Publication of CN102567522A publication Critical patent/CN102567522A/en
Application granted granted Critical
Publication of CN102567522B publication Critical patent/CN102567522B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention discloses a method and a device for managing a file system of an intelligent card, which are used for improving the efficiency of managing the file system of the intelligent card. The method comprises the steps of: receiving an application protocol data unit (APDU) instruction for operating the file system of the intelligent card; taking preset storage spaces with different sizes as blocks with different sizes, according to the size of a file to be processed in the APDU instruction, determining if a block matched with the file to be processed in size is existent, if yes, according to the matched block, processing the file to be processed; and if not, determining a combination of blocks with different sizes matched with the file to be processed in size, and according to the combination of blocks with different sizes, processing the files to be processed. The invention discloses the intelligent card at the same time.

Description

A kind of management method of smart card document system and equipment
Technical field
The present invention relates to technical field of intelligent card, relate in particular to a kind of management method and equipment of smart card document system.
Background technology
Smart card is a kind of integrated circuit card, and comprising smart card operating system, one of function of this operating system is exactly data and the file of managing in smart card, the namely function of file system.
At present, file system in smart card mainly adopts sequence management mode, according to the data in physical space sequential access file, this is when making the file in smart card manage, need to waste a large amount of time, for example, after certain file of deleting in smart card, require a great deal of time the All Files data reach after this file.
Visible, the current smart card document system efficiency of management is lower, lacks dirigibility.
Summary of the invention
The invention provides a kind of management method and equipment of smart card document system, in order to improve the efficiency of management of smart card document system, and improve smart cards for storage space availability ratio.
The concrete technical scheme that the embodiment of the present invention provides is as follows:
A management method for smart card document system, comprising:
Receive the Application Protocol Data Unit APDU instruction that the file system of smart card is operated;
Pieces using the storage space of the difference size preset as different sizes, determine whether to exist according to the size of the pending file carrying in described APDU instruction the piece mating with the size of described pending file, if exist, process described pending file according to the piece of described coupling; If do not exist, determine the combination of the piece of the different sizes that match from the size of described pending file, according to pending file described in the combined treatment of the piece of described different sizes.
A kind of smart card, comprising:
Receiving element, for receiving the Application Protocol Data Unit APDU instruction that the file system of smart card is operated;
Processing unit, be used for the storage space of the difference size to preset as the pieces of different sizes, determine whether to exist according to the size of the pending file carrying in described APDU instruction the piece mating with the size of described pending file, if exist, process described pending file according to the piece of described coupling; If do not exist, determine the combination of the piece of the different sizes that match from the size of described pending file, according to pending file described in the combined treatment of the piece of described different sizes.
Based on technique scheme, in the embodiment of the present invention, receiving after the Application Protocol Data Unit instruction that the file system of smart card is operated, pieces using the storage space of the difference size preset as different sizes, determine whether to exist according to the size of the pending file carrying in APDU instruction the piece mating with the size of pending file, if exist, process pending file according to the piece of this coupling, if do not exist, determine the combination of the piece of the different sizes that match from the size of pending file, according to the pending file of the combined treatment of the piece of this difference size, thereby in the time that file system is managed, can carry out corresponding operating taking the piece of different sizes as unit, in allocation space, while producing the operations such as fragment or defragmentation, all taking different big or small pieces as unit, improve the efficiency of dirigibility and the file system management of file system management, and improve the utilization factor to smart cards for storage space.
Brief description of the drawings
Fig. 1 is the method flow diagram of smart card document system management in the embodiment of the present invention;
Fig. 2 is the schematic flow sheet that creates file in the embodiment of the present invention;
Fig. 3 is the schematic flow sheet of deleted file in the embodiment of the present invention;
Fig. 4 is the schematic flow sheet of defragmentation in the embodiment of the present invention;
Fig. 5 A is the structural representation of current file system in the embodiment of the present invention;
Fig. 5 B is the file system structure schematic diagram after fragment merging for the first time in the embodiment of the present invention;
Fig. 5 C is the file system structure schematic diagram after fragment merging for the second time in the embodiment of the present invention;
Fig. 5 D is the file system structure schematic diagram after fragment merging for the third time in the embodiment of the present invention;
Fig. 6 is smart card architecture schematic diagram in the embodiment of the present invention.
Embodiment
In order to improve the efficiency of management of smart card document system and the utilization factor to smart cards for storage space, the embodiment of the present invention provides a kind of management method of smart card document system.
Below in conjunction with accompanying drawing, the preferred embodiment of the present invention is elaborated.
As shown in Figure 1, in the embodiment of the present invention, as follows to the method detailed flow process of smart card document system management:
Step 101: receive Application Protocol Data Unit (APDU) instruction that the file system of smart card is operated.
In the present embodiment, the operation that file system is carried out can be at least to create file or delete file operation.
Step 102: the pieces using the storage space of the difference size preset as different sizes, determine whether to exist according to the size of the pending file carrying in APDU instruction the piece mating with the size of pending file, if exist, process pending file according to the piece of this coupling; If do not exist, determine the combination of the piece of the different sizes that match from the size of pending file, according to the pending file of the combined treatment of the piece of this difference size.
Preferably, in the piece of different sizes, the size of each is a doubly byte of index of 2.In practical application, can determine according to the size of file minimum in file system the size of smallest blocks in different big or small pieces, and make it to meet a doubly byte of index of 2.For example, the piece of default difference size is divided into 6 grades, and is respectively 32 bytes, 64 bytes, 128 bytes, 256 bytes, 512 bytes and 1024 bytes.
In the present embodiment, default fragment recording areas in file system, with start address and the chip size information of each fragment in log file system.
Wherein, while creating pending file according to the piece mating with pending file, judge whether the fragment that exists the piece that mates with this to match, if existence, the fragment of selecting the piece mating with this to match is preserved pending file, and fragment can be divided into the piece of different sizes; If do not exist, further judge whether unappropriated continuous space in file system can hold the piece of this coupling, if energy is pending file allocation storage space according to the piece of this coupling and preserves pending file, if can not, file system is carried out to defragmentation.
Or, while creating pending file according to the combination of the piece of the different sizes of mating from pending file, according to the each fragment record in fragment recording areas, judge whether the fragment that existence matches from the combination of the piece of different sizes, if exist, selection is preserved pending file from the fragment that the combination of the piece of different sizes matches, and fragment can be divided into the pieces of different sizes; If do not exist, further judge whether unappropriated continuous space in file system can hold the combination of the pieces of different sizes, if can, being combined as pending file allocation storage space and preserving pending file according to different big or small pieces, if can not, file system is carried out to defragmentation.
For example, as shown in Figure 2, the detailed process that creates file is as follows:
Step 201: create file instruction and import into by the establishment document entry of file system;
Step 202: check the legitimacy of instruction, arrange and determine the structure (as file header) of file to be created;
Step 203: determine the combination of the piece of the piece mating or the difference size matching according to the size of file to be created, judge whether the total surplus space of file system can hold the combination of the piece of this coupling or the piece of this difference size, this total surplus space comprises unappropriated continuous space and fragment space, if can not, execution step 204, otherwise, execution step 205;
Step 204: carry out error handling processing;
Step 205: search fragment recording areas, judge whether to exist the fragment that can match from the combination of the piece of the piece of above-mentioned coupling or different sizes, if exist, perform step 206, otherwise, execution step 207;
Step 206: determine the fragment that can match from the combination of the piece of the piece of above-mentioned coupling or above-mentioned different sizes, and file to be created is deposited to this fragment, revise fragment recording areas simultaneously, go to step 210;
Step 207: judge whether unappropriated continuous space in file system can hold the combination of the piece of above-mentioned coupling or the pieces of different sizes, if so, goes to step 209, otherwise, go to step 208;
Step 208: the fragment in file system is arranged, fragment is incorporated into unappropriated continuous space;
Step 209: the combination according to the piece of the piece of above-mentioned coupling or different sizes is saved to file to be created in the unappropriated continuous space of file system;
Step 210: complete the file process that creates.
Wherein, in the time creating pending file, preserve pending file if select the fragment matching from the combination of the piece of above-mentioned coupling or the piece of different sizes, behind the Coutinuous store space taking in fragment from the corresponding size of combination of the piece of above-mentioned coupling or the piece of different sizes, if the size of the remaining space of this fragment is the one in different big or small pieces, or, the size of the remaining space of this fragment is greater than maximum one in different big or small pieces,, for the remaining space of fragment, in fragment recording areas, add corresponding fragment record; Otherwise, the remaining space of fragment is split into the pieces of each different sizes, and each of obtaining for fractionation adds corresponding fragment record in fragment recording areas.
Preferably, while determining the combination of the piece of the required above-mentioned coupling taking of file to be created or the piece of different sizes, to waste minimum space as standard, and in the combination of the piece of different sizes, the storage space at each piece place is continuous.For example, the size of file to be created is 76 bytes, needs to take the piece of 64 bytes and 32 bytes.
Again for example, in current fragment, there is the fragment of 32 bytes and the fragment of 256 bytes, as the file of 63 byte-sized of need establishment, need the fragment of 256 bytes to be split as the piece of 128 bytes and the piece of two 64 bytes, the piece preservation that takies one of them 64 byte needs to create file, and the piece of the piece of another 64 byte and 128 bytes is saved to fragment recording areas as two fragments records.
Wherein, during according to the pending file of block delete of above-mentioned coupling, the pointer of revised file system context association, by the address pointed pointer of the previous file being associated with pending file, be revised as the address of the pointer of pending file file pointed, the shared storage space of piece of above-mentioned coupling becomes fragment, and in fragment recording areas, adds corresponding fragment record.Or, while deleting pending file according to the combination of the piece of above-mentioned different sizes, the pointer of revised file system context association, by the address pointed pointer of the previous file being associated with pending file, be revised as the address of the pointer of pending file file pointed, the shared storage space of combination of the piece of above-mentioned different sizes becomes fragment, and in fragment recording areas, adds corresponding fragment record.
Wherein, deleting pending file, and the shared storage space of the combination of the piece of the piece matching from pending file or the different sizes that match becomes after fragment, for each in the combination of the piece of above-mentioned coupling or the piece of different sizes, add corresponding fragment record in fragment recording areas.
In the present embodiment, add corresponding fragment record for each in fragment recording areas, be specially: all fragment records of traversal fragment recording areas, record start address and the size information of corresponding the first fragment according to fragment to be added, when determining while there is storage space and adjacent the second fragment of the first fragment, judge that whether space size after the first fragment and the second fragment merge is any one in Bu Tong big or small piece, if, revise start address and the size information of the second fragment fragment record, so that fragment record to be added and the fragment record of the second fragment are merged, otherwise, further judge whether the space size after the first fragment and the second fragment merge is greater than one maximum in Bu Tong big or small piece, if, the fragment record of corresponding the first fragment fragment record to be added and the second fragment is merged into and is absorbed piece fragment record, and by with the fragment record merging that absorbs piece fragment and record corresponding fragment and can form all fragments in Coutinuous store space, if determine and do not have the fragment adjacent with the first fragment, or the space size after the first fragment merges from adjacent the second fragment is not any in the piece of different sizes, and be not more than in the pieces of different sizes maximum when a kind of, whether the remaining space that judges fragment recording areas can add new fragment record, if can, add the fragment record of the first fragment, if can not, file system is carried out to defragmentation.Wherein, size is greater than to the default maximum piece of a kind of and is defined as absorption piece.For example, piece maximum in the piece of default difference size is 256 bytes, if there is the fragment record of the piece of 256 bytes, and the fragment record of the piece of 64 bytes, to record corresponding piece continuous at storage space for these two fragments, can merge into absorption piece, be about to two fragment records and merge.
Again for example, the file that needs deleted file to be combined into by the piece of 32 bytes and the piece of 64 bytes, after file is deleted, in the time that fragment recording areas interpolation fragment records, judge whether on storage space continuous with deleted file, and the fragment record that can merge with the piece of the piece of 32 bytes or 64 bytes, if be present in the piece of 32 bytes at the fragment record of continuous 32 block of bytes of storage space, these two fragment records are merged into the fragment record corresponding to piece of 64 bytes, simultaneously, the piece that merges 64 bytes that the fragment record that obtains 64 block of bytes forms with deleted file is again continuous at storage space, and can merge the piece that obtains 128 bytes, merge into the fragment record of the piece of 128 bytes, if do not add respectively and two corresponding fragment records of piece in fragment recording areas.
In practical application, can be also, while reaching predetermined threshold in the occupied space of fragment recording areas, file system to be carried out to defragmentation operation.Wherein, in fragment recording areas, occupied space reaches setting threshold, can be that the occupied space of fragment recording areas reaches setting threshold with respect to the ratio in whole fragment recording areas space.
In practical application, add after fragment record in fragment recording areas at every turn, can calculate the shared space of all fragments in file system according to the fragment record of fragment recording areas, and judge that whether the shared space of these all fragments reaches setting threshold with respect to the ratio of whole file system space, triggers defragmentation if reach setting threshold.For the trigger condition of other forms of triggering defragmentation, can be applied to the embodiment of the present invention, the present invention is also included.
For example, as shown in Figure 3, the detailed process of deleted file is as follows:
Step 301: deleted file instruction is imported into by the deleted file entrance of file system;
Step 302: the pointer of revised file system context association, by the address pointed pointer of the previous file being associated with file to be deleted, is revised as the address of the pointer of file to be deleted file pointed;
Step 303: the shared storage space of combination of the piece of the piece matching from file to be deleted or the different sizes that match becomes fragment, and in fragment recording areas, add and each corresponding fragment record in the combination of the piece of above-mentioned coupling or the piece of different sizes, and in the time that interpolation fragment records, the all fragment records of traversal fragment recording areas, merge rule judgment according to predetermined fragment record and whether have the fragment record that can merge with the corresponding each fragment record of file to be deleted, if exist and perform step 304, otherwise, execution step 305;
Step 304: merge according to predetermined fragment record the fragment record merging that rule can merge, go to step 307;
Step 305: in the time that the remaining space of fragment recording areas can hold new fragment and records, add new fragment record;
Step 306: inquiry defragmentation condition, while reaching setting threshold in the occupied space of definite fragment recording areas, carry out defragmentation;
Step 307: finish deleted file process.
In the present embodiment, file system is carried out to defragmentation, be specially: determine whether to arrange completely, if, according to each fragment record in fragment recording areas, successively by the first fragment corresponding to multiple fragment record continuous storage space, recording with storage space and the first fragment the second fragment that multiple fragment records adjacent and that storage space is continuous are corresponding merges, and while merging, corresponding fragment record is merged at every turn, until judge while having merged into a fragment, this fragment is incorporated into unappropriated continuous space; If not, according to each fragment record in fragment recording areas, successively by the first fragment corresponding to multiple fragment record continuous storage space, second fragment corresponding to multiple fragment records adjacent with the first fragment with storage space merges, and in the time of each merging, corresponding fragment record is merged, until judge when remaining space in shared storage space or the fragment recording areas of fragment merging reaches setting threshold, finish defragmentation process.
Wherein, when file system is carried out to defragmentation operation, can start to merge successively each fragment from file system top, until judge while having merged into a fragment, this fragment is incorporated into unappropriated continuous space.In practical application, also can be that the maximum fragment that takes up room from file system starts to arrange, for example, by taking up room, maximum fragment merges with the fragment being positioned at thereafter successively, until merge with unappropriated continuous space, also can be to start to carry out defragmentation from the bottom of file system, can select according to actual needs different Collator Modes.
For example, as shown in Figure 4, the detailed process of defragmentation is as follows:
Step 401: defragmentation instruction is imported into by the defragmentation entrance of file system;
Step 402: judge that whether predetermined defragmentation mode is for arranging completely, if execution step 404, otherwise execution step 403;
Step 403: judge whether the shared storage space of fragment arranging reaches predetermined threshold, if execution step 408, otherwise, execution step 404;
Step 404: judge whether fragment recording areas only has a fragment record, if execution step 407, otherwise, execution step 405;
Step 405: the start address according to the each fragment record of fragment recording areas sorts, and determines the first two fragment that is positioned at file system top;
Step 406: the first two fragment that is positioned at file system top is merged, and revise after related fragment record execution step 402;
Step 407: unappropriated continuous space in fragment and file system is merged, and empty fragment recording areas;
Step 408: complete defragmentation process.
Again for example, as accompanying drawing 5A is depicted as the allocation of space situation of current file system, in this file system, preserve 4 files, be followed successively by file a, file b, file c and file d, between every two files, there is a fragment, have 3 fragments, be respectively fragment A, fragment B, fragment C, after the each fragment record in fragment recording areas being sorted according to start address, determine by multiple fragment records that storage space is continuous the fragment A that is positioned at file system top, and be positioned at immediate another fragment of fragment B on top with this, and merge two fragments, revise the relative recording of fragment recording areas simultaneously, merging rule according to fragment record merges each fragment record relevant to fragment A each fragment record relevant fragment B, as accompanying drawing 5B is depicted as the schematic diagram after fragment merging for the first time, carrying out in an identical manner fragment for the second time merges, by the fragment after fragment A and fragment B merging, merge with fragment C, each fragment record that each fragment record after simultaneously each fragment record relevant to fragment A fragment B being merged according to fragment record merging rule is correlated with fragment C again merges, as accompanying drawing 5C is depicted as the schematic diagram after merging for the second time, finally, by fragment A, B, fragment and unappropriated continuous space after C merges merge, as shown in accompanying drawing 5D, empty by fragment recording areas.
Based on above-mentioned principle, as shown in Figure 6, in the embodiment of the present invention, smart card mainly comprises following processing unit:
Receiving element 601, for receiving the APDU instruction that the file system of smart card is operated;
Processing unit 602, be used for the storage space of the difference size to preset as the pieces of different sizes, determine whether to exist according to the size of the pending file carrying in APDU instruction the piece mating with the size of pending file, if exist, process pending file according to the piece of this coupling; If do not exist, determine the combination of the piece of the different sizes that match from the size of pending file, according to the pending file of the combined treatment of the piece of this difference size.
Wherein, also comprise pretreatment unit 603, for presetting fragment recording areas in file system, with start address and the chip size information of each fragment in log file system.
Based on technique scheme, in the embodiment of the present invention, receiving after the Application Protocol Data Unit instruction that the file system of smart card is operated, pieces using the storage space of the difference size preset as different sizes, determine whether to exist according to the size of the pending file carrying in APDU instruction the piece mating with the size of pending file, if exist, process pending file according to the piece of this coupling, if do not exist, determine the combination of the piece of the different sizes that match from the size of pending file, according to the pending file of the combined treatment of the piece of this difference size, thereby in the time that file system is managed, can carry out corresponding operating taking the piece of different sizes as unit, in allocation space, while producing the operations such as fragment or defragmentation, all taking different big or small pieces as unit, improve the efficiency of dirigibility and the file system management of file system management, and improve the utilization factor to smart cards for storage space.
Simultaneously, in the embodiment of the present invention, by default fragment recording areas in file system, to record start address and the chip size information of fragment, make fragment information clear, thus can be in the time creating file, deleted file, utilize already present fragment to carry out corresponding operating according to fragment record, the efficiency and the dirigibility that have further improved smart card document system management, meanwhile, improved efficiency and the dirigibility of defragmentation to a great extent.Especially in the time of deleted file, do not do the integrated moving of file system, greatly reduced the execution time.And, due to the one in the piece of difference size corresponding to each fragment record, can directly fragment be recorded to corresponding fragment for preserving file to be created, save time, and improve the utilization factor in smart cards for storage space.
Obviously, those skilled in the art can carry out various changes and modification and not depart from the spirit and scope of the present invention the present invention.Like this, if these amendments of the present invention and within modification belongs to the scope of the claims in the present invention and equivalent technologies thereof, the present invention is also intended to comprise these changes and modification interior.

Claims (9)

1. a management method for smart card document system, is characterized in that, comprising:
Receive the Application Protocol Data Unit APDU instruction that the file system of smart card is operated;
Pieces using the storage space of the difference size preset as different sizes, determine whether to exist according to the size of the pending file carrying in described APDU instruction the piece mating with the size of described pending file, if exist, process described pending file according to the piece of described coupling; If do not exist, determine the combination of the piece of the different sizes that match from the size of described pending file, according to pending file described in the combined treatment of the piece of described different sizes, wherein, process described pending file and at least comprise the described pending file of establishment and delete described pending file;
Wherein, default fragment recording areas in described file system, to record start address and the chip size information of each fragment in described file system;
Create described pending file according to the piece of described coupling, or while creating described pending file according to the combination of the pieces of described different sizes, comprising:
According to the each fragment record in described fragment recording areas, judge whether to exist the fragment matching from the combination of the piece of described coupling or the piece of described different sizes, if exist, select the fragment matching from the combination of the piece of described coupling or the piece of described different sizes to preserve described pending file, described fragment can be divided into the piece of different sizes; If do not exist, further judge whether unappropriated continuous space in described file system can hold the combination of piece or the described different big or small pieces of described coupling, if can, being combined as described pending file allocation storage space and preserving described pending file according to the piece of the piece of described coupling or described different sizes, if can not, described file system is carried out to defragmentation;
Described file system is carried out to defragmentation, comprising:
Determine whether to arrange completely, if, according to each fragment record in described fragment recording areas, successively by the first fragment corresponding to multiple fragment record continuous storage space, recording with storage space and the first fragment the second fragment that multiple fragment records adjacent and that storage space is continuous are corresponding merges, and while merging, corresponding fragment record is merged at every turn, until judge while having merged into a fragment, this fragment is incorporated into unappropriated continuous space; If not, according to each fragment record in described fragment recording areas, successively by the first fragment corresponding to multiple fragment record continuous storage space, second fragment corresponding to multiple fragment records adjacent with the first fragment with storage space merges, and in the time of each merging, corresponding fragment record is merged, until judge when remaining space in shared storage space or the fragment recording areas of fragment merging reaches setting threshold, finish defragmentation process.
2. the method for claim 1, is characterized in that, according to pending file described in the block delete of described coupling, or while deleting described pending file according to the combination of the pieces of described different sizes, comprising:
Revise described file system context-sensitive pointer, by the address pointed pointer of the previous file being associated with described pending file, be revised as the address of the pointer of described pending file file pointed, the shared storage space of combination of the piece of the piece of described coupling or described different sizes becomes fragment, and adds corresponding fragment record in described fragment recording areas.
3. method as claimed in claim 1 or 2, is characterized in that, in the time creating described pending file, the fragment matching from the combination of the piece of described coupling or the piece of described different sizes if select is preserved described pending file, comprising:
Behind the Coutinuous store space taking in described fragment from the corresponding size of combination of the piece of described coupling or the piece of described different sizes, if the size of the remaining space of this fragment is the one in different big or small pieces, or, the size of the remaining space of this fragment is greater than maximum one in described different big or small piece,, for the remaining space of described fragment, in described fragment recording areas, add corresponding fragment record; Otherwise, the remaining space of described fragment is split into the pieces of each different sizes, and each of obtaining for fractionation adds corresponding fragment record in described fragment recording areas;
Deleting described pending file, the shared storage space of combination of the piece of the piece of described coupling or described different sizes becomes after fragment, also comprise: for each in the combination of the piece of described coupling or the piece of described different sizes, add corresponding fragment record in described fragment recording areas.
4. method as claimed in claim 3, is characterized in that, for each in the combination of the piece of described coupling or the piece of described different sizes, adds corresponding fragment record in described fragment recording areas, is specially:
Travel through all fragment records of described fragment recording areas, record start address and the size information of corresponding the first fragment according to fragment to be added, when determining while there is storage space and adjacent the second fragment of described the first fragment, judge that whether space size after described the first fragment and described the second fragment merge is any one in Bu Tong big or small piece, if, revise start address and the size information of described the second fragment fragment record, so that fragment record to be added and the fragment record of described the second fragment are merged;
Otherwise, further judge whether space size after described the first fragment and described the second fragment merge is greater than the one of maximum in described Bu Tong big or small piece, if, the fragment record of corresponding described the first fragment fragment record to be added and described the second fragment is merged into and absorbed piece fragment record, and by the fragment record merging of recording corresponding fragment and can form all fragments in Coutinuous store space with described absorption piece fragment;
If determine and do not have the fragment adjacent with described the first fragment, or the space size after described the first fragment merges from adjacent the second fragment is not any in the piece of described different sizes, and be not more than in the piece of described different sizes maximum when a kind of, whether the remaining space that judges described fragment recording areas can add new fragment record, if can, add the fragment record of described the first fragment, if can not, described file system is carried out to defragmentation.
5. the method for claim 1, is characterized in that, in the piece of described different sizes, the size of each is a doubly byte of index of 2.
6. a management equipment for smart card document system, is characterized in that, comprising:
Receiving element, for receiving the Application Protocol Data Unit APDU instruction that the file system of smart card is operated;
Processing unit, be used for the storage space of the difference size to preset as the pieces of different sizes, determine whether to exist according to the size of the pending file carrying in described APDU instruction the piece mating with the size of described pending file, if exist, process described pending file according to the piece of described coupling; If do not exist, determine the combination of the piece of the different sizes that match from the size of described pending file, according to pending file described in the combined treatment of the piece of described different sizes, wherein, process described pending file and at least comprise the described pending file of establishment and delete described pending file;
Wherein, also comprise pretreatment unit, for presetting fragment recording areas in described file system, to record start address and the chip size information of each fragment in described file system;
Described processing unit also creates described pending file for the piece according to described coupling, or while creating described pending file according to the combination of the piece of described different sizes, according to the each fragment record in described fragment recording areas, judge whether to exist the fragment matching from the combination of the piece of described coupling or the piece of described different sizes, if exist, select the fragment matching from the combination of the piece of described coupling or the piece of described different sizes to preserve described pending file, described fragment can be divided into the piece of different sizes; If do not exist, further judge whether unappropriated continuous space in described file system can hold the combination of piece or the described different big or small pieces of described coupling, if can, being combined as described pending file allocation storage space and preserving described pending file according to the piece of the piece of described coupling or described different sizes, if can not, described file system is carried out to defragmentation;
Described processing unit, for file system is carried out to defragmentation, is specially:
Determine whether to arrange completely, if, according to each fragment record in described fragment recording areas, successively by the first fragment corresponding to multiple fragment record continuous storage space, recording with storage space and the first fragment the second fragment that multiple fragment records adjacent and that storage space is continuous are corresponding merges, and while merging, corresponding fragment record is merged at every turn, until judge while having merged into a fragment, this fragment is incorporated into unappropriated continuous space; If not, according to each fragment record in described fragment recording areas, successively by the first fragment corresponding to multiple fragment record continuous storage space, second fragment corresponding to multiple fragment records adjacent with the first fragment with storage space merges, and in the time of each merging, corresponding fragment record is merged, until judge when remaining space in shared storage space or the fragment recording areas of fragment merging reaches setting threshold, finish defragmentation process.
7. equipment as claimed in claim 6, is characterized in that, described processing unit is also for according to pending file described in the block delete of described coupling, or while deleting described pending file according to the combination of the pieces of described different sizes,
Revise described file system context-sensitive pointer, by the address pointed pointer of the previous file being associated with described pending file, be revised as the address of the pointer of described pending file file pointed, the shared storage space of combination of the piece of the piece of described coupling or described different sizes becomes fragment, and adds corresponding fragment record in described fragment recording areas.
8. the equipment as described in claim 6 or 7, is characterized in that, described processing unit is creating when described pending file, the described pending file of fragment preservation matching from the combination of the piece of described coupling or the piece of described different sizes if select, also for:
Behind the Coutinuous store space taking in described fragment from the corresponding size of combination of the piece of described coupling or the piece of described different sizes, if the size of the remaining space of this fragment is the one in different big or small pieces, or, the size of the remaining space of this fragment is greater than maximum one in described different big or small piece,, for the remaining space of described fragment, in described fragment recording areas, add corresponding fragment record; Otherwise, the remaining space of described fragment is split into the pieces of each different sizes, and each of obtaining for fractionation adds corresponding fragment record in described fragment recording areas;
Deleting described pending file, the shared storage space of combination of the piece of the piece of described coupling or described different sizes becomes after fragment, also comprise: for each in the combination of the piece of described coupling or the piece of described different sizes, add corresponding fragment record in described fragment recording areas.
9. equipment as claimed in claim 8, is characterized in that, described processing unit, for each of the combination of the pieces for the piece of described coupling or described different sizes, adds corresponding fragment record in described fragment recording areas, is specially:
Travel through all fragment records of described fragment recording areas, record start address and the size information of corresponding the first fragment according to fragment to be added, when determining while there is storage space and adjacent the second fragment of described the first fragment, judge that whether space size after described the first fragment and described the second fragment merge is any one in Bu Tong big or small piece, if, revise start address and the size information of described the second fragment fragment record, so that fragment record to be added and the fragment record of described the second fragment are merged;
Otherwise, further judge whether space size after described the first fragment and described the second fragment merge is greater than the one of maximum in described Bu Tong big or small piece, if, the fragment record of corresponding described the first fragment fragment record to be added and described the second fragment is merged into and absorbed piece fragment record, and by the fragment record merging of recording corresponding fragment and can form all fragments in Coutinuous store space with described absorption piece fragment;
If determine and do not have the fragment adjacent with described the first fragment, or the space size after described the first fragment merges from adjacent the second fragment is not any in the piece of described different sizes, and be not more than in the piece of described different sizes maximum when a kind of, whether the remaining space that judges described fragment recording areas can add new fragment record, if can, add the fragment record of described the first fragment, if can not, described file system is carried out to defragmentation.
CN201110448251.2A 2011-12-28 2011-12-28 Method and device for managing file system of intelligent card Expired - Fee Related CN102567522B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201110448251.2A CN102567522B (en) 2011-12-28 2011-12-28 Method and device for managing file system of intelligent card

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201110448251.2A CN102567522B (en) 2011-12-28 2011-12-28 Method and device for managing file system of intelligent card

Publications (2)

Publication Number Publication Date
CN102567522A CN102567522A (en) 2012-07-11
CN102567522B true CN102567522B (en) 2014-07-30

Family

ID=46412921

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201110448251.2A Expired - Fee Related CN102567522B (en) 2011-12-28 2011-12-28 Method and device for managing file system of intelligent card

Country Status (1)

Country Link
CN (1) CN102567522B (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103914388A (en) * 2012-12-28 2014-07-09 北京中电华大电子设计有限责任公司 Method for JAVA card system heap fragment disposal
CN103067536A (en) * 2013-01-11 2013-04-24 清华大学 Port distribution method and port distribution system based on Buddy way
CN103218560B (en) * 2013-04-25 2015-07-22 飞天诚信科技股份有限公司 Method of realizing card data management
CN104144405B (en) * 2013-05-10 2018-01-09 中国电信股份有限公司 User's card file method for remote management and system
CN104375949A (en) * 2014-12-01 2015-02-25 恒宝股份有限公司 Smart card storage space arrangement method and system
CN106649860B (en) * 2016-12-30 2020-09-18 苏州浪潮智能科技有限公司 Defragmentation method applied to aggregated files
US11755759B2 (en) * 2017-08-10 2023-09-12 Shardsecure, Inc. Method for securing data utilizing microshard™ fragmentation
CN111459848B (en) * 2020-03-31 2023-10-31 Oppo广东移动通信有限公司 File fragment sorting method and device, storage medium and electronic equipment
CN117539796A (en) * 2024-01-09 2024-02-09 深圳宏芯宇电子股份有限公司 Electronic device and buffer memory management method

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1950802A (en) * 2004-02-13 2007-04-18 扎鲁纳股份有限公司 Memory allocation
CN101593193A (en) * 2008-05-28 2009-12-02 北京中电华大电子设计有限责任公司 A kind of management method of smart card document system
CN101751427A (en) * 2008-12-12 2010-06-23 北京中电华大电子设计有限责任公司 Method for reasonably using file space of smart card

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1950802A (en) * 2004-02-13 2007-04-18 扎鲁纳股份有限公司 Memory allocation
CN101593193A (en) * 2008-05-28 2009-12-02 北京中电华大电子设计有限责任公司 A kind of management method of smart card document system
CN101751427A (en) * 2008-12-12 2010-06-23 北京中电华大电子设计有限责任公司 Method for reasonably using file space of smart card

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
张鲁国等.智能卡操作系统中存储管理设计.《微计算机信息》.2005,第21卷(第8-3期),9,18-19.
智能卡操作系统中存储管理设计;张鲁国等;《微计算机信息》;20051229;第21卷(第8-3期);9,18-19 *

Also Published As

Publication number Publication date
CN102567522A (en) 2012-07-11

Similar Documents

Publication Publication Date Title
CN102567522B (en) Method and device for managing file system of intelligent card
CN102332029B (en) Hadoop-based mass classifiable small file association storage method
CN103488709B (en) A kind of index establishing method and system, search method and system
CN102521145B (en) Java card system and space distribution processing method thereof
CN102567427B (en) Method and device for processing object data
CN103995855B (en) The method and apparatus of data storage
CN110268394A (en) KVS tree
CN103870514B (en) Data de-duplication method and device
CN103164490B (en) A kind of efficient storage implementation method of not fixed-length data and device
CN103984641B (en) A kind of memory space recovery method and its device based on simplify configuration technology
CN105159915A (en) Dynamically adaptive LSM (Log-structured merge) tree combination method and system
CN101606133A (en) Use with immediate data file system of continuous logical address space interface
CN111061752B (en) Data processing method and device and electronic equipment
CN107678981A (en) Data processing method and device
CN106383666B (en) Data storage method and device
CN110347651A (en) Method of data synchronization, device, equipment and storage medium based on cloud storage
CN103353892A (en) Method and system for data cleaning suitable for mass storage
CN109240607B (en) File reading method and device
CN103605552A (en) MCU upgrading method and device
CN101751475B (en) Method for compressing section records and device therefor
CN104298736A (en) Method and device for aggregating and connecting data as well as database system
CN102253985B (en) File system data management method and system
CN103425435A (en) Disk storage method and disk storage system
CN110888837A (en) Object storage small file merging method and device
CN107807886A (en) Index management in flash memories

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CB03 Change of inventor or designer information
CB03 Change of inventor or designer information

Inventor after: Xie Ningpu

Inventor after: Wang Youjun

Inventor before: Xie Ningpu

CP01 Change in the name or title of a patent holder
CP01 Change in the name or title of a patent holder

Address after: 100015 Beijing city Chaoyang District Dongzhimen West eight Street No. 2 room Wanhong Yan Dong Business Garden

Patentee after: BEIJING WATCHDATA Co.,Ltd.

Address before: 100015 Beijing city Chaoyang District Dongzhimen West eight Street No. 2 room Wanhong Yan Dong Business Garden

Patentee before: BEIJING WATCH DATA SYSTEM Co.,Ltd.

CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20140730

Termination date: 20211228