CN100507919C - FAT file system and its processing method - Google Patents
FAT file system and its processing method Download PDFInfo
- Publication number
- CN100507919C CN100507919C CNB2007100990980A CN200710099098A CN100507919C CN 100507919 C CN100507919 C CN 100507919C CN B2007100990980 A CNB2007100990980 A CN B2007100990980A CN 200710099098 A CN200710099098 A CN 200710099098A CN 100507919 C CN100507919 C CN 100507919C
- Authority
- CN
- China
- Prior art keywords
- file
- subclauses
- clauses
- delete
- entries
- 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
Links
- 238000003672 processing method Methods 0.000 title 1
- 238000000034 method Methods 0.000 abstract description 3
- 238000002372 labelling Methods 0.000 abstract 1
- 239000002699 waste material Substances 0.000 description 4
- 230000000052 comparative effect Effects 0.000 description 2
- 238000012217 deletion Methods 0.000 description 2
- 230000037430 deletion Effects 0.000 description 2
- 238000007726 management method Methods 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 210000000352 storage cell Anatomy 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
Images
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
A method for processing FAT file includes making a deleting mark on deleted file and simultaneously clearing off FAT table item of deleted file, recording deleted file position and relevant item number, recording position and item number of tail file, judging whether item number of tail file is equal to that of deleted file or not an using item of tail file to cover item of deleted file if it is, setting item contents of original tail files all to be zero and labeling usable mark on said item contents.
Description
Technical field
The present invention relates to field of computer technology, particularly a kind of FAT file system and disposal route thereof.
Background technology
File allocation table (File Allocation Table, FAT) file system is the file system of a kind of hyperdisk data space of Microsoft's definition, be created in the beginning of the eighties at the end of the seventies, originally be used for MS-DOS operation system, only be located and be a kind of simple file system, only be suitable for floppy disk management, and the memory range of 1M only of floppy disk at that time.Continuous development along with new technology, it is big that disk storage space constantly becomes, initial FAT design can not be satisfied the demand, therefore Microsoft expands FAT on the original basis, be present FAT12, FAT16 and FAT32 file system, these three kinds of file system have satisfied the space management of different memory space ranges substantially.
For the data in magnetic disk district of a blank, can think a continuous blank data area, the user can directly read and write data on this blank data area.And the FAT file system has been done some definition planning exactly on this blank disc space, with the convenient disk space that uses.After having defined the FAT file system, all are forbidden the user the direct read of disk space, only open to the FAT file system, the user realizes by the interface of FAT file system definition the operation of disk, for example opens file, operations such as reading and writing of files, close file.
Existing FAT file system comprises 4 parts: parameter region, FAT table, directory area and data field.Stipulated in the FAT file system that the base unit to the disk read-write operation is 512 bytes, be commonly referred to a piece (block), defined the notion of bunch (Cluster) on the basis of block again, one bunch can comprise one or more block, the number that explanation specifically comprises in parameter region.Wherein, block is the least unit of read-write disk.
Wherein, parameter region is mainly used in relevant parameter setting in the whole FAT file system of record.For example: one bunch comprises several block, and a FAT table what block is made of, and a file system comprises what FAT table etc.In addition, in parameter region, may keep several block as other purposes.
The FAT table is used for the disk space of FAT file system is managed.Basic list item can be 12 bit, 16 bit or 32 bit, promptly so-called FAT12, FAT16, FAT32 in the FAT table.Basic list item briefly, is divided into disk data field and mark zone exactly corresponding to one bunch of the data field in the FAT table, and the FAT table is exactly the place that makes marks.In fact the FAT table is constructed a single-track link table structure, and for each FAT list item, it can comprise two category informations, and the one, which list item it is, can learn by the index value of FAT list item, for example starts from scratch; The 2nd, the corresponding data of storing in this list item, the FAT file system is the index value of next FAT list item with the value defined of these data.So just formed an individual event chained list, the value of the FAT of chained list end list item is zero.
The directory area is used to store the filename under the root directory, and the FAT file system has defined root directory 512 short filenames of storage at most.Basic storage cell in the directory area is clauses and subclauses (Entry).The corresponding clauses and subclauses of short filename, clauses and subclauses account for 32 bytes (Byte), have 512 clauses and subclauses under the root directory, totally 32 pieces (Block).The starting cluster and the file size that all comprise the data field of sensing in each clauses and subclauses just can be passed through FAT table index data field again by starting cluster, read the content of whole file with this.
Wherein: name is the name of file or catalogue; Ext is extension name; Attr is attribute field; Time_ms is the time field; Create time is creation-time; Create date is date created; Access date is visit date the last time; Start cluster HI is the high position of the starting cluster in file or catalogue corresponding data district; Modify time is the last modification time; Modify date is for the last time is revised the date; Start cluster LO is the low level of the starting cluster in file or catalogue corresponding data district; Filcsize is file size etc.
If arrived the end clauses and subclauses of directory area, promptly there has not been next available catalogue, can be by represent the end of clauses and subclauses from whole byte zero setting of the next clauses and subclauses of end clauses and subclauses.
The data field, it is organized by the chained list of file bunch to be storage cell.Data write wherein all is passive, and the FAT table points to which where is attended school.
In the FAT file system, during deleted file, adopt the mode of tagging.With a short filename is example, a short filename is stored by 32 bytes in the root directory of FAT16, when deletion during a file the common way of Windows be that first byte of the filename that will delete changes 0xE5 into, file system will be skipped if run into the file item that such mark crosses when browsing like this, do not show, but in fact these 32 bytes also are placed on the there, have so just lacked a document storage.
Therefore, there is following problem in existing FAT file system: just filename has been done delete flag during deleted file in existing FAT file system, but do not remove this document name, though file is deleted like this, but filename is still taking storage space, because to frequently the writing of disk root directory, deleted file, the number of files that can cause can creating under the root directory reduces greatly, disk will occur and remain big quantity space, but root directory can't continue to create new file.
Summary of the invention
The objective of the invention is to, a kind of FAT file system is provided, can utilize the shared space of deleted file name again, avoid because of file deleted after, the clauses and subclauses of expression this document name still exist, and the waste that causes.
Another object of the present invention is to, a kind of disposal route of FAT file system is provided, can utilize the shared space of deleted file name again, avoid because of file deleted after, the clauses and subclauses of expression this document name still exist, and the waste that causes.
The disposal route of FAT file system of the present invention comprises the following steps:
Steps A: the file that delete is done delete flag, remove the FAT list item corresponding simultaneously with the file that will delete;
Step B: write down the position of the described file that will delete and the number of entries of this document correspondence, and progressively search the end of root directory, the position and the number of entries thereof of record end file from this document;
Step C: judge whether the number of entries of described end file correspondence equals the number of entries of the described file correspondence that will delete, when the number of entries of described end file correspondence equals the number of entries of the described file correspondence that will delete, cover the clauses and subclauses of the described file that will delete with the clauses and subclauses of described end file, and with the whole zero setting of entry contents at file place, former end, and put serviceable indicia; Otherwise, return step C.
Wherein, before described steps A, further comprise the following steps:
A pre-defined memory module, storage and the corresponding mark of each clauses and subclauses, the FAT file system can learn whether corresponding clauses and subclauses are available according to each mark when the scanning root directory.
Wherein, the number of the mark of storing in the described memory module is consistent with the number of entries under the root directory.
In step C,, can carry out the following step if when the number of entries of described end file correspondence is not equal to the number of entries of the described file correspondence that will delete:
Scanning is also located behind the described file that will delete first and is the entry positions of unavailable mark, will be from the clauses and subclauses of this unavailable mark until file corresponding clauses and subclauses in end move forward the shared space of clauses and subclauses of this file correspondence that will delete one by one, to cover the clauses and subclauses of front.
FAT file system of the present invention, comprise query unit, analytic unit, performance element, wherein: described query unit, the number of entries of the file correspondence that is used to inquire about and write down the position of the file that will delete and will deletes, and the position and the number of entries thereof of inquiry and record end file, and Query Result is sent to analytic unit; Analytic unit, being used for the number of entries of the file correspondence that will delete that query unit is sent and the number of entries of end file correspondence compares, when the number of entries of described end file correspondence equaled the number of entries of the described file correspondence that will delete, the notice performance element covered the clauses and subclauses of the described file that will delete with the clauses and subclauses of described end file; Performance element is used for the notice of sending according to analytic unit and covers the clauses and subclauses of the described file that will delete with the clauses and subclauses of described end file, and with the whole zero setting of entry contents at file place, former end, and put serviceable indicia.
Wherein, in the described query unit, may further include memory module, be used to store under the root directory the whether available mark of each clauses and subclauses of expression.
The number of the mark of storing in the described memory module is consistent with the number of entries under the root directory.
Described analytic unit, can be further used for when the number of entries of described end file correspondence is not equal to the number of entries of the described file correspondence that will delete, after notifying performance element with the described file that will delete first is that the clauses and subclauses of unavailable mark are until file corresponding clauses and subclauses in end move forward the shared space of clauses and subclauses of the described file correspondence that will delete one by one, to cover the clauses and subclauses of front.
The invention has the beneficial effects as follows: according to FAT file system of the present invention and disposal route thereof, by utilizing the shared space of deleted file name again, avoid because of file deleted after, the clauses and subclauses of expression this document name still exist, and the waste that causes.
Description of drawings
Fig. 1 is the process flow figure of FAT file system of the present invention;
Fig. 2 is the structural representation of FAT file system of the present invention.
Embodiment
Below, describe FAT file system of the present invention and disposal route thereof in detail with reference to figure 1~2.
As shown in Figure 1, the process flow figure for FAT file system of the present invention comprises the following steps:
Step 100: the file that delete is done delete flag, remove the FAT list item corresponding simultaneously with the file that will delete.
Wherein, in step 100, the file that delete is done delete flag, comprise the following steps:
Step 11: when deleted file, at first search for the clauses and subclauses of this document correspondence, for example can find this document by the filename that compares in the corresponding clauses and subclauses of this document (Entry);
Step 12: first byte (Byte) in these clauses and subclauses is put specific markers, i.e. delete flag, for example 0xE5.
In addition, before step 100, further comprise the following steps: a pre-defined memory module, storage and the corresponding mark of each clauses and subclauses, the FAT file system can learn whether corresponding clauses and subclauses are available according to each mark when the scanning root directory.
When specific implementation, this memory module can be the corresponding to array of number of entries under a size and the root directory.For example, for the FAT16 file system of having only 512 item entries, can set up an array bool bEntry[512], be used for storage and the corresponding mark of each clauses and subclauses.
Step 200: the record position of this document and the number of entries of this document correspondence, and progressively search the end of root directory, the position and the number of entries thereof of record end file from this document;
Wherein: the later content of the clauses and subclauses of end file is zero entirely.
Wherein, can represent the position of deleted file, represent the number of entries of this document correspondence with y1 with x1; Represent the position of end file with x2, represent the number of entries of end file correspondence with y2.Stipulate that in existing FAT file system the number of entries of a short filename correspondence is that the number of entries of 1, one long filenames correspondence is at least 2.
Step 300: judge whether y2 equals y1, when y2 equals y1, cover the clauses and subclauses at x1 place, and, it is put serviceable indicia with the whole zero setting of entry contents at former x2 place with the clauses and subclauses at x2 place.
Here, judge that the purpose whether y1 equals y2 is: judge whether end file and deleted file all are short filenames, whether are the long filenames with same item number perhaps.If two corresponding number of entries of file are inconsistent, then can occur to replace or wasting problem.For example: if the long filenames of the file of end file 3 clauses and subclauses by name, and the short filename of the file of deleted file 1 clauses and subclauses by name at this moment, irreplaceable problem can occur, on the contrary can wasting problem.
Therefore, in order to address the above problem,, in step 300,, can carry out the following step if when y2 is not equal to y1 based on as mentioned above:
Scanning is also located behind this deleted file first and is the entry positions of unavailable mark, will be from the clauses and subclauses of this unavailable mark until file corresponding clauses and subclauses in end move forward the shared space of clauses and subclauses of this deleted file correspondence one by one, to cover the clauses and subclauses of front.
For example, the number of entries of this deleted file correspondence is 2, and then the clauses and subclauses from this unavailable mark move forward 2 clauses and subclauses one by one up to the corresponding clauses and subclauses of end file, to cover the clauses and subclauses of front.
Below, FAT file system of the present invention is described, as shown in Figure 2, in this FAT file system, comprise: performance element, query unit, analytic unit.Wherein:
Query unit is used to inquire about and the position x1 of record deletion file and the number of entries y1 of deleted file correspondence, and the position and the number of entries thereof of inquiry and record end file, and Query Result is sent to analytic unit;
Wherein, in query unit, comprise memory module, be used to store under the root directory the whether available mark of each clauses and subclauses of expression.
For example, for the FAT16 file system of having only 512 clauses and subclauses, this memory module can be stored and 512 corresponding 512 marks of clauses and subclauses.
Analytic unit is used for the number of entries y1 of deleted file correspondence that query unit is sent and the number of entries y2 of end file correspondence and compares, and is y1 when equaling y2 at comparative result, and the notice performance element is with the clauses and subclauses at the clauses and subclauses covering x1 place at x2 place;
Performance element is used for the notice of sending according to analytic unit and covers the clauses and subclauses at x1 place with the clauses and subclauses at x2 place, and with the whole zero setting of entry contents at former x2 place, the mark that it is corresponding is put serviceable indicia.
In addition, analytic unit, can be further used at comparative result is that y1 is when being not equal to y2, after notifying performance element with this deleted file first is that the clauses and subclauses of unavailable mark are until file corresponding clauses and subclauses in end move forward the shared space of clauses and subclauses of this deleted file correspondence one by one, to cover the clauses and subclauses of front.
In sum,, can utilize the shared space of deleted file name again according to the disposal route of FAT file system of the present invention, avoid because of file deleted after, the clauses and subclauses of expression this document name still exist, and the waste that causes.
More than be in order to make those of ordinary skills understand the present invention; and to detailed description that the present invention carried out; but can expect; in the scope that does not break away from claim of the present invention and contained, can also make other variation and modification, these variations and revising all in protection scope of the present invention.
Claims (8)
1. the disposal route of a FAT file system is characterized in that, comprises the following steps:
Steps A: the file that delete is done delete flag, remove the FAT list item corresponding simultaneously with the file that will delete;
Step B: write down the position of the described file that will delete and the number of entries of this document correspondence, and progressively search the end of root directory, the position and the number of entries thereof of record end file from this document;
Step C: judge whether the number of entries of described end file correspondence equals the number of entries of the described file correspondence that will delete, when the number of entries of described end file correspondence equals the number of entries of the described file correspondence that will delete, cover the clauses and subclauses of the described file that will delete with the clauses and subclauses of described end file, and with the whole zero setting of entry contents at file place, former end, and put serviceable indicia.
2. the disposal route of FAT file system as claimed in claim 1 is characterized in that, before described steps A, further comprises the following steps:
Set in advance a memory module, storage and the corresponding mark of each clauses and subclauses, the FAT file system can learn whether corresponding clauses and subclauses are available according to each mark when the scanning root directory.
3. the disposal route of FAT file system as claimed in claim 2 is characterized in that, the number of the mark of storing in the described memory module is consistent with the number of entries under the root directory.
4. the disposal route of FAT file system as claimed in claim 2 is characterized in that, in step C, if when the number of entries of described end file correspondence is not equal to the number of entries of the described file correspondence that will delete, carries out the following step:
Scanning is also located behind the described file that will delete first and is the entry positions of unavailable mark, will be from the clauses and subclauses of this unavailable mark until file corresponding clauses and subclauses in end move forward the shared space of clauses and subclauses of this file correspondence that will delete one by one, to cover the clauses and subclauses of front.
5. a FAT file system is characterized in that, comprises query unit, analytic unit, performance element, wherein:
Described query unit is used to inquire about and write down the position of the file that will delete and the number of entries of the file correspondence that will delete, and the position and the number of entries thereof of inquiry and record end file, and Query Result is sent to analytic unit;
Analytic unit, being used for the number of entries of the file correspondence that will delete that query unit is sent and the number of entries of end file correspondence compares, when the number of entries of described end file correspondence equaled the number of entries of the described file correspondence that will delete, the notice performance element covered the clauses and subclauses of the described file that will delete with the clauses and subclauses of described end file;
Performance element is used for the notice of sending according to analytic unit and covers the clauses and subclauses of the described file that will delete with the clauses and subclauses of described end file, and with the whole zero setting of entry contents at file place, former end, and put serviceable indicia.
6. whether available FAT file system as claimed in claim 5 is characterized in that, in the described query unit, further comprises memory module, be used to store under the root directory each clauses and subclauses of expression mark.
7. FAT file system as claimed in claim 6 is characterized in that the number of the mark of storing in the described memory module is consistent with the number of entries under the root directory.
8. FAT file system as claimed in claim 6, it is characterized in that, described analytic unit, be further used for when the number of entries of described end file correspondence is not equal to the number of entries of the described file correspondence that will delete, after notifying performance element with the described file that will delete first is that the clauses and subclauses of unavailable mark are until file corresponding clauses and subclauses in end move forward the shared space of clauses and subclauses of the described file correspondence that will delete one by one, to cover the clauses and subclauses of front.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CNB2007100990980A CN100507919C (en) | 2007-05-11 | 2007-05-11 | FAT file system and its processing method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CNB2007100990980A CN100507919C (en) | 2007-05-11 | 2007-05-11 | FAT file system and its processing method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN101051317A CN101051317A (en) | 2007-10-10 |
CN100507919C true CN100507919C (en) | 2009-07-01 |
Family
ID=38782729
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CNB2007100990980A Expired - Fee Related CN100507919C (en) | 2007-05-11 | 2007-05-11 | FAT file system and its processing method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN100507919C (en) |
Families Citing this family (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN100557611C (en) * | 2007-11-15 | 2009-11-04 | 深圳华为通信技术有限公司 | A kind of disposal route of file and device |
CN101782921B (en) * | 2009-12-28 | 2013-01-16 | 北京握奇数据系统有限公司 | Directory creating, inquiring and deleting method and device |
CN102024060B (en) * | 2010-12-31 | 2012-10-24 | 山西奥克斯电子系统工程中心 | Method for memorizing files and restoring error deleted files |
CN102331973A (en) * | 2011-03-18 | 2012-01-25 | 北京神州数码思特奇信息技术股份有限公司 | Internal memory data storage system and internal memory data insertion and deletion method |
CN102841894A (en) * | 2011-06-22 | 2012-12-26 | 比亚迪股份有限公司 | Data storage method of file allocation table |
CN102314490B (en) * | 2011-08-16 | 2013-07-10 | 晨星软件研发(深圳)有限公司 | Method and device for recovering Linux FAT (File Allocation Table) file system |
CN104268184B (en) * | 2014-09-16 | 2017-11-21 | 青岛海信移动通信技术股份有限公司 | File delet method and terminal in a kind of mobile terminal |
CN106326384A (en) * | 2016-08-16 | 2017-01-11 | 中国科学院长春光学精密机械与物理研究所 | File storage method suitable for high-speed mass storage based on FPGA (Field Programmable Gate Array) |
CN108170372B (en) * | 2017-12-08 | 2021-02-19 | 厦门集微科技有限公司 | Data processing method and device based on cloud hard disk |
CN110286859B (en) * | 2019-06-28 | 2020-04-14 | 中国海洋大学 | Data storage method and device based on FAT file system |
-
2007
- 2007-05-11 CN CNB2007100990980A patent/CN100507919C/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
CN101051317A (en) | 2007-10-10 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN100507919C (en) | FAT file system and its processing method | |
CN1307580C (en) | Efficient management of large files | |
US8024507B2 (en) | Transaction-safe FAT file system improvements | |
US7689574B2 (en) | Index and method for extending and querying index | |
JP7507142B2 (en) | System and method for bulk deleting records in a database - Patents.com | |
US8694497B2 (en) | Method, system, and computer program product for enabling file system tagging by applications | |
US7624275B2 (en) | Disk drive, control method thereof and disk-falsification detection method | |
US20120296944A1 (en) | Providing virtual files to store metadata | |
CN103186622B (en) | The update method of index information and device in a kind of text retrieval system | |
CN100498781C (en) | Method for storing metadata of logic document system by adhesion property | |
GB2439577A (en) | Storing data in streams of varying size | |
CN101303667B (en) | Method and device for establishing magnetic disk null cluster table and seeking magnetic disk null cluster | |
CN100543748C (en) | A kind of method and system of utilizing file allocation table to carry out the file tracking | |
CN103257928B (en) | Flash memory device data managing method and system | |
CN103246718B (en) | File access method, device and equipment | |
CN104699688A (en) | File searching method and electronic device | |
CN100407204C (en) | Method for labeling computer resource and system therefor | |
CN106126555A (en) | A kind of file management method and file system | |
CN103116652A (en) | Index store management method based on zipper information | |
JP2539347B2 (en) | File management method | |
US20060129588A1 (en) | System and method for organizing data with a write-once index | |
JPH11120044A (en) | Data processor, data processing method, data processing system and recording medium | |
KR100912129B1 (en) | Method and apparatus for management unstructured data using object-based file system | |
CN105630692A (en) | File storage system storing file directory by using MRAM | |
CN100444166C (en) | Position-based interface access method and device for FAT file system |
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 | ||
C17 | Cessation of patent right | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20090701 Termination date: 20120511 |