CN1776648A - Method and device for getting residual space for FAT file system - Google Patents

Method and device for getting residual space for FAT file system Download PDF

Info

Publication number
CN1776648A
CN1776648A CN 200510130646 CN200510130646A CN1776648A CN 1776648 A CN1776648 A CN 1776648A CN 200510130646 CN200510130646 CN 200510130646 CN 200510130646 A CN200510130646 A CN 200510130646A CN 1776648 A CN1776648 A CN 1776648A
Authority
CN
China
Prior art keywords
space
information
disk
file system
disk space
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.)
Granted
Application number
CN 200510130646
Other languages
Chinese (zh)
Other versions
CN100405330C (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.)
Vimicro Corp
Original Assignee
Vimicro Corp
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 Vimicro Corp filed Critical Vimicro Corp
Priority to CNB2005101306462A priority Critical patent/CN100405330C/en
Publication of CN1776648A publication Critical patent/CN1776648A/en
Application granted granted Critical
Publication of CN100405330C publication Critical patent/CN100405330C/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention defines a structure in use for recording information of disk space. Reading data in the structure directly can obtain information of disk space. The invention obtains information of disk space effectively and rapidly, shortens time-consuming operation. The information of disk space needed will not be a burden of disk space.

Description

A kind of method and device thereof that obtains FAT file system remaining space
Technical field
The present invention relates to the Computer Organization Principles field, be specifically related in the FAT file system, to obtain the method for remaining space and make in this way device.
Background technology
The FAT file system has defined the data on the hard disk and has been divided into 5 parts according to its different characteristics and effect: MBR district, DBR district, FAT district, DIR district and DATA district.
(1) MBR (Main Boot Record district) is usually located at 0 magnetic track, 0 cylinder, 1 sector of DISK to Image, and it has comprised series of parameters and one section boot of hard disk, and it is produced by partition programs (as Fdisk.com), does not rely on any operating system.
(2) DBR (booting operating system recording areas), it is usually located at 0 magnetic track, 1 cylinder, 1 sector of hard disk, is first sector that operating system can directly be visited.Its main task is when MBR gives it with system's control, judges this subregion with preceding two boot files that file is an operating system of catalogue, if determine to exist, just it is read in internal memory, and gives this document control.
(3) FAT (file allocation table) is positioned at after the DBR, since 0 magnetic track, 1 cylinder, 33 sectors, occupies how much being decided by disk type and size of sector.File allocation table is the assignment information that is used for representing disk space.It does not represent the information of boot section, file directory, yet inreal storage file content.
In order to realize the chain type storage of file, must write down which bunch exactly on the hard disk is taken by file, the next one that bunch indicates the follow-up content of storage that is necessary for also that each has taken bunch bunch number, to the last cluster of a file, then to indicate no follow-up bunch of this bunch.These are all preserved by FAT (file allocation table), and a lot of list items (entry) are arranged in the table, every information that writes down one bunch.
(4) DIR root directory area (Directory), and then the 2nd FAT table (i.e. the FAT of backup table) afterwards, is writing down the start element of each file (catalogue) under the root directory, the attribute of file etc.During the locating file position, operating system just can have been known the particular location of file in hard disk and size according to the start element among the DIR in conjunction with the FAT table.
(5) data field is the place of data storage truly, is positioned at after the DIR district, occupies the most data spaces on the hard disk
In the FAT file system, obtaining the disk remaining space is a very important function, and conventional essential method travels through whole FAT table exactly, adds up the data division of whole non-zeros, obtains the disk remaining space with this.Obvious this method of operating is consuming time very big, and is apparent in view for its inferior position of large capacity disc.
Rule according to the FAT file system, have the reserved area of some before the FAT table, first block (piece) stores whole FAT system related information in the reserved area usually, and form is fixed, residue block reaches with regard to of no use, and FAT16 and FAT32 handle different to these residue reserved areas certainly.
Summary of the invention
(1) technical matters that will solve
The objective of the invention is to overcome the defective of present prior art, propose a kind of method of obtaining FAT file system remaining space.
(2) technical scheme
The present invention proposes a kind of method of the FAT of obtaining file system remaining space, in the FAT file system, add a piece as the disk space information recording areas, be used to deposit disk space information, when taking or during the release disk space, revising the information in this recording areas; When needs obtain disk space information, read the information in this recording areas.
The above-mentioned method of obtaining FAT file system remaining space, a kind of preferred scheme are that the recording areas that is used for the recording disc spatial information is positioned at the reserved area.
The above-mentioned method of obtaining FAT file system remaining space, a kind of preferred scheme are that the recording areas that has write down disk space information is orientated a structure as, and this structure comprises following information: total disk space, remaining space, with the space, damage the space.
The above-mentioned method of obtaining FAT file system remaining space, a kind of preferred scheme is when data in magnetic disk has read-write operation, and disk space information is updated simultaneously, and updated information comprises the disk remaining space, uses the space.
The present invention also proposes a kind of device, the method of obtaining FAT file system remaining space that this device has used the present invention to propose, this device comprises CPU and storer, comprise a FAT file system in the storer, a data space is arranged as the disk space information recording areas in this file system, be used to deposit disk space information, when taking or during the release disk space, the data in this recording areas can be updated; When needs obtain disk space information, read the information in this recording areas.
Above-mentioned device, a kind of preferred scheme is also to comprise the USB module, is used for this device is linked to each other with computing machine.
Above-mentioned device, a kind of preferred scheme are that CPU, the communication between the storer of device adopts dma mode to carry out data transmission.
(3) beneficial effect
Adopt method and the device thereof that obtains the disk remaining space of the present invention, can obtain the spatial information of disk effectively and rapidly, it is consuming time to have shortened operation.And can not bring burden on the space hold to disk, be particularly suitable for being applied to the exploitation of large capacity disc or embedded system.
Description of drawings
Fig. 1 is for adopting FAT file system structure synoptic diagram of the present invention;
Fig. 2 is the module map of embodiments of the invention.
Wherein, 1, loudspeaker; 2, MCU system.
Embodiment
The method of obtaining FAT file system remaining space that the present invention proposes is described as follows in conjunction with the accompanying drawings and embodiments.Following embodiment only is used to illustrate the present invention; and be not limitation of the present invention; the those of ordinary skill in relevant technologies field; under the situation that does not break away from the spirit and scope of the present invention; can also make various variations and modification; therefore all technical schemes that are equal to also belong to category of the present invention, and scope of patent protection of the present invention should be limited by every claim.
With reference to Fig. 2, in the present embodiment, whole FAT file system is placed in a slice Audio Processing chip, and this Audio Processing chip comprises CPU and memory portion, and wherein the data transmission between CPU and the storer adopts DMA (direct memory access (DMA)) transmission mode commonly used in the prior art.Specifically saying, in the storer of this sheet audio chip, be provided with a FAT file system.Because this FAT file system, therefore can finish management to exterior storage medium by it, for example read outside SD, MMC, the data in the NandFlash memory card by it.Thisly undertaken the management of exterior storage medium is belonged to prior art, be similar to and on multi-purpose computer, finish the management of USB storage equally, do not give unnecessary details at this by operating system by a file system.
In this MCU system, adopt 51C type CPU as central processing unit, communicate by letter by between dma mode and the storer.This device adopts audio processing modules commonly used in the prior art, supports the music playback function of midi, mp3, many kinds of forms of wave, also supports the broadcast of midi+wave, midi+mp3.These music datas can pass through the audio mixing module, output to EQ (intelligence) module, 3D module then, output to loudspeaker then.
Also comprise the USB module in this MCU system, this Audio Processing chip can be by carrying out data transmission between this module and the multi-purpose computer (PC).
For the file system in being stored in storer, the structural representation of this file system as shown in Figure 1.When making conventional FAT file system, added a block (piece) as the remaining space recording areas in the reserved area, be used to deposit disk space information.For present embodiment, it is positioned at the afterbody of reserved area.This Block is defined by a structure: typdef struct{
Long total; // total disk space
Long used; // used the space
Long free; // remaining space
Long bad; // damage space
}disk_space;
Like this, system just defines a structure disk_space, is used for depositing disk space information, and these spatial informations comprise that total disk space, disk used space, remaining space, damage space.When creating file interpolation content, disk_space.used and disk_space.free can revise in system, that is to say that disk_space.used can increase, and disk_space.free can reduce; When deleted file, disk_space.used and disk_space.free also can revise simultaneously in system.Like this, this structure can synchronous recording the spatial information in the disk, the change that the content of this structure can take along with disk and upgrading.
When system need obtain disk remaining space information, adopt the FAT file system of the technology of the present invention's proposition not need to travel through whole magnetic disk calculating remaining space as prior art, only need the interior related data of this block of inquiry to get final product.The function interface that is used to inquire about this block is described as:
int?get_space(disk_space&space);
Therefore this function is specifically designed to the data that read among the structure disk_space, no longer needs to travel through whole magnetic disk when needs acquisition disc information, can be directly from this structure reading of data get final product.Need travel through whole magnetic disk owing to obtain the disk remaining space in the FAT file system of prior art, this technology is a kind of burden for big disk space or the low processor of processing speed.
And adopt the method for obtaining the disk remaining space of the present invention, can obtain the spatial information of disk effectively and rapidly, not need to adopt the operation of prior art traversal whole magnetic disk, it is consuming time not only to have shortened operation, and, therefore can prolong the disk life-span owing to reduced the operation of traversal disk.On the other hand, because these disk space informations are stored in the end of reserved area, and the FAT file system is to the strict regulation of depositing of file, and the end part of reserved area is not occupied data usually, therefore, increase this part data area and can not bring burden on the space hold to disk.Such way is particularly suitable for the particularly exploitation of embedded system of mini-system.
This FAT file system of obtaining FAT file system remaining space method that has adopted the present invention to propose, those skilled in the art can apply it in other occasions, for example is applied in multi-purpose computer or other embedded developments.Present embodiment only is used to support the present invention, and protection scope of the present invention should be defined by the claims.

Claims (7)

1, a kind of method of obtaining FAT file system remaining space, it is characterized in that in the FAT file system, adding a piece as the disk space information recording areas, be used to deposit disk space information, when taking or during the release disk space, revising the information in this recording areas; When needs obtain disk space information, read the information in this recording areas.
2, the method for obtaining FAT file system remaining space as claimed in claim 1 is characterized in that the described recording areas that is used for the recording disc spatial information is positioned at the reserved area.
3, the method for obtaining FAT file system remaining space as claimed in claim 1, it is characterized in that the described recording areas that has write down disk space information orientates a structure as, this structure comprises following information: total disk space, remaining space, with the space, damage the space.
4, the method for obtaining FAT file system remaining space as claimed in claim 1 is characterized in that when data in magnetic disk had read-write operation, disk space information was updated simultaneously, and updated information comprises the disk remaining space, uses the space.
5, a kind of device that uses the method for claim 1, comprise CPU and storer, it is characterized in that comprising in the storer FAT file system, a data space is arranged as the disk space information recording areas in this file system, be used to deposit disk space information, when taking or during the release disk space, the data in this recording areas can be updated; When needs obtain disk space information, read the information in this recording areas.
6, device as claimed in claim 5 is characterized in that also comprising the USB module, is used for this device is linked to each other with computing machine.
7, device as claimed in claim 5 is characterized in that CPU, the communication between the storer of device adopts dma mode to carry out data transmission.
CNB2005101306462A 2005-12-16 2005-12-16 Method and device for getting residual space for FAT file system Expired - Fee Related CN100405330C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB2005101306462A CN100405330C (en) 2005-12-16 2005-12-16 Method and device for getting residual space for FAT file system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB2005101306462A CN100405330C (en) 2005-12-16 2005-12-16 Method and device for getting residual space for FAT file system

Publications (2)

Publication Number Publication Date
CN1776648A true CN1776648A (en) 2006-05-24
CN100405330C CN100405330C (en) 2008-07-23

Family

ID=36766164

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB2005101306462A Expired - Fee Related CN100405330C (en) 2005-12-16 2005-12-16 Method and device for getting residual space for FAT file system

Country Status (1)

Country Link
CN (1) CN100405330C (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106202350A (en) * 2016-07-05 2016-12-07 浪潮(北京)电子信息产业有限公司 A kind of distributed file system simplifies the method and system of configuration automatically
CN111081284A (en) * 2018-10-19 2020-04-28 合肥沛睿微电子股份有限公司 Memory device and control method

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5668970A (en) * 1994-06-20 1997-09-16 Cd Rom, U.S.A., Inc. Method and apparatus for generating a file allocation table for a storage medium with no file allocation table using file storage information
US5832525A (en) * 1996-06-24 1998-11-03 Sun Microsystems, Inc. Disk fragmentation reduction using file allocation tables
CN1516026A (en) * 2003-01-02 2004-07-28 太和科技股份有限公司 Storage device capable of promptly detecting residual memory capacity and its method

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106202350A (en) * 2016-07-05 2016-12-07 浪潮(北京)电子信息产业有限公司 A kind of distributed file system simplifies the method and system of configuration automatically
CN111081284A (en) * 2018-10-19 2020-04-28 合肥沛睿微电子股份有限公司 Memory device and control method

Also Published As

Publication number Publication date
CN100405330C (en) 2008-07-23

Similar Documents

Publication Publication Date Title
US8180956B2 (en) Method for controlling memory card and method for controlling nonvolatile semiconductor memory
US6732222B1 (en) Method for performing flash memory file management
US7610434B2 (en) File recording apparatus
US11249664B2 (en) File system metadata decoding for optimizing flash translation layer operations
US8650379B2 (en) Data processing method for nonvolatile memory system
US8402202B2 (en) Input/output control method and apparatus optimized for flash memory
US7702845B2 (en) Method and apparatus for managing blocks according to update type of data in block-type memory
US20140095556A1 (en) Computing system, host system and method for managing data
US8959301B2 (en) Accessing data in a storage system
CN102289451A (en) Method and device for searching files or folders
CN108628542B (en) File merging method and controller
CN102375695A (en) Disc accessing method and computer system
CN101582084A (en) Method and device for data storage
CN1711606A (en) Record carrier having a main file system area and a virtual file system area
CN106709014A (en) File system conversion method and apparatus
CN1776648A (en) Method and device for getting residual space for FAT file system
CN101404034A (en) File saving and searching method and apparatus
US20100169555A1 (en) Method of writing data into flash memory based on file system
CN1776687A (en) File segmenting method and device for FAT file system
US8200936B2 (en) Systems and methods for recording information to a memory card
CN100444166C (en) Position-based interface access method and device for FAT file system
CN115480692A (en) Data compression method and device
CN114610228A (en) File management system and file management method and device thereof
CN1304959C (en) Method of reading -writing data using disk file virtual flash
CN102541957A (en) Method and device for operating data files on basis of data flow magnetic tapes

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: 20080723

Termination date: 20111216