CN102360361A - File searching method and related device applied in embedded equipment - Google Patents

File searching method and related device applied in embedded equipment Download PDF

Info

Publication number
CN102360361A
CN102360361A CN2011102979130A CN201110297913A CN102360361A CN 102360361 A CN102360361 A CN 102360361A CN 2011102979130 A CN2011102979130 A CN 2011102979130A CN 201110297913 A CN201110297913 A CN 201110297913A CN 102360361 A CN102360361 A CN 102360361A
Authority
CN
China
Prior art keywords
file
acceleration point
catalogue
directory entry
parameter value
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
CN2011102979130A
Other languages
Chinese (zh)
Other versions
CN102360361B (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.)
SHENZHEN CHIPSBANK TECHNOLOGY Co Ltd
Original Assignee
SHENZHEN CHIPSBANK TECHNOLOGY 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 SHENZHEN CHIPSBANK TECHNOLOGY Co Ltd filed Critical SHENZHEN CHIPSBANK TECHNOLOGY Co Ltd
Priority to CN 201110297913 priority Critical patent/CN102360361B/en
Publication of CN102360361A publication Critical patent/CN102360361A/en
Application granted granted Critical
Publication of CN102360361B publication Critical patent/CN102360361B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The embodiment of the invention discloses a file searching method and related device applied in embedded equipment, wherein the file searching method applied in the embedded equipment comprises the following steps of: dividing a file system into a plurality of acceleration-point area points; storing a first parameter value and a second parameter value of each acceleration point; utilizing the second parameter values of the acceleration points to find a target acceleration point; after finding the target acceleration point, utilizing the first parameter value of the target acceleration point to determine files and directories unrelated to the target file; and directly skipping the files and the directories unrelated to the target file. According to the technical scheme provided by the embodiment of the invention, the process of analyzing and matching all catalog entries in the search process is effectively avoided and the search speed of files is greatly improved.

Description

A kind of file search method relevant apparatus that is applied to embedded device
Technical field
The present invention relates to the search technique field, relate in particular to a kind of file search method file and relevant apparatus that is applied to embedded device.
Background technology
Current embedded device is ubiquitous in life, and range of application is more and more wider, develops also more and more intelligently, and is also increasingly high for the management expectancy of data.And file allocation table (FAT, File Allocation Table) system is supported by embedded device owing to its advantage of simple structure day by day.
The flow process of in the FAT of embedded device system, carrying out file search at present is following:
At first, obtain the fileinfo (comprising filename, file type) of file destination, the first directory entry from the FAT system begins then; File to searching is analyzed one by one; Obtain the details (like filename, file type etc.) of each file and mate,, show that then the file that searches is not file destination if inconsistent with file destination; Jump to next file and analyze, until searching the file that matees with this file destination.
Above-mentioned search routine need be analyzed and matees each file, therefore, needs the long time of cost just can search file destination, and this must not meet the growth requirement of current embedded device.
Summary of the invention
The embodiment of the invention provides a kind of file search method and relevant apparatus that is applied to embedded device, is used to improve the search speed of file.
For solving the problems of the technologies described above, the embodiment of the invention provides following technical scheme:
A kind of file search method that is applied to embedded device comprises:
The acceleration point of dividing file system is interval, and wherein, interval, above-mentioned acceleration point is the border with the catalogue;
Store first parameter value and second parameter value of each acceleration point; Wherein, Above-mentioned acceleration point is corresponding one by one with interval, above-mentioned acceleration point and point to last directory entry in the interval, above-mentioned acceleration point; The X number of files of accumulative total scanning when the catalogue number of accumulative total scanning when the indication of above-mentioned first parameter value searches above-mentioned acceleration point, above-mentioned second parameter value indication search above-mentioned acceleration point, above-mentioned X indicates a kind of predetermined file type;
Obtain the file sequence number of file destination, the file type of above-mentioned file destination is above-mentioned X;
Judge whether to find the target acceleration point; Wherein, Following condition is satisfied in above-mentioned target acceleration point: second parameter value of above-mentioned target acceleration point is less than the file sequence number of above-mentioned file destination, and above-mentioned second parameter value of the next acceleration point of above-mentioned target acceleration point is greater than the file sequence number of above-mentioned file destination;
When finding above-mentioned target acceleration point, begin from the first directory entry of above-mentioned file system, adopt aero mode to search for above-mentioned file destination, wherein, above-mentioned employing aero mode is searched for above-mentioned file destination and is comprised:
Scanning current directory item judges that the current directory item is file or catalogue,
If file then reads next directory entry as the current directory item, carry out above-mentioned scanning current directory item and judge that the current directory item still is the step of catalogue for file,
If catalogue; Then the catalogue counter adds 1; Read next directory entry as the current directory item, carry out scanning current directory item and judge that the current directory item still is the step of catalogue for file, until the value of above-mentioned catalogue counter above-mentioned first parameter value more than or equal to above-mentioned target acceleration point; Wherein, the initial value of above-mentioned catalogue counter is zero;
When searching less than above-mentioned target acceleration point, the value of perhaps above-mentioned catalogue counter adopts general mode to search for above-mentioned file destination during more than or equal to above-mentioned first parameter value of above-mentioned target acceleration point.
A kind of file search device comprises:
Initialization unit is used to divide the interval, acceleration point of file system, and wherein, interval, above-mentioned acceleration point is the border with the catalogue;
Storage unit; Be used to store first parameter value and second parameter value of each acceleration point; Wherein, above-mentioned acceleration point is corresponding one by one with interval, above-mentioned acceleration point and point to last directory entry in the interval, above-mentioned acceleration point, the catalogue number of accumulative total scanning when above-mentioned first parameter value indication searches above-mentioned acceleration point; The X number of files of accumulative total scanning when the indication of above-mentioned second parameter value searches above-mentioned acceleration point, above-mentioned X indicates a kind of predetermined file type;
Acquiring unit is used to obtain the file sequence number of file destination, and the file type of above-mentioned file destination is above-mentioned X;
Search judging unit; Be used to judge whether to find the target acceleration point; Wherein, Following condition is satisfied in above-mentioned target acceleration point: second parameter value of above-mentioned target acceleration point is less than the file sequence number of above-mentioned file destination, and above-mentioned second parameter value of the next acceleration point of above-mentioned target acceleration point is greater than the file sequence number of above-mentioned file destination;
The aero mode search unit, be used for when above-mentioned judged result of searching judging unit when being, begin from the first directory entry of above-mentioned file system, adopt aero mode to search for above-mentioned file destination;
The general mode search unit, be used for when above-mentioned judged result of searching judging unit for not the time, perhaps,, adopt general mode to search for above-mentioned file destination when the value of above-mentioned catalogue counter during more than or equal to above-mentioned first parameter value of above-mentioned target acceleration point;
Wherein, above-mentioned acceleration search unit comprises:
First scanning element is used to scan the current directory item;
Judging unit is used to judge that the current directory item is file or catalogue;
Reading unit is used for when above-mentioned judgment unit judges goes out the current directory item and is file, reading next directory entry as the current directory item;
Counting unit is used for when above-mentioned judgment unit judges goes out the current directory item and is catalogue, and the currency of catalogue counter is added 1, and wherein, the above-mentioned initial value of stating the catalogue counter is zero;
Above-mentioned reading unit also is used for reading next directory entry as the current directory item when the value of above-mentioned catalogue counter during less than above-mentioned first parameter value of above-mentioned target acceleration point.
Therefore; During the present invention implements through file system is carried out initialization; Promptly divide acceleration point district's point of file system and store first parameter value and second parameter value of each acceleration point, make in the process of ferret out file, after second parameter value of this acceleration point capable of using finds the target acceleration point; Utilize first parameter value of this target acceleration point to determine and irrelevant file and the catalogue of this file destination; Directly skip and irrelevant file and the catalogue of this file destination, avoided the process of in the search procedure each directory entry all being analyzed and being mated, greatly improved the search speed of file.
Description of drawings
In order to be illustrated more clearly in the embodiment of the invention or technical scheme of the prior art; To do to introduce simply to the accompanying drawing of required use in embodiment or the description of the Prior Art below; Obviously, the accompanying drawing in describing below only is some embodiments of the present invention, for those of ordinary skills; Under the prerequisite of not paying creative work property, can also obtain other accompanying drawing according to these accompanying drawings.
An embodiment schematic flow sheet of the file search method that is applied to embedded device that Fig. 1 provides for the embodiment of the invention;
The example structure synoptic diagram of the annular FIFO that Fig. 2 provides for the embodiment of the invention;
An example structure synoptic diagram of the file partition that Fig. 3 provides for the embodiment of the invention;
Another embodiment schematic flow sheet of the file search method that is applied to embedded device that Fig. 4 provides for the embodiment of the invention;
An example structure synoptic diagram of the file search device that Fig. 5 provides for the embodiment of the invention.
Embodiment
The embodiment of the invention provides a kind of file search method that is applied to embedded device.
For make goal of the invention of the present invention, characteristic, advantage can be more obvious and understandable; To combine the accompanying drawing in the embodiment of the invention below; Technical scheme in the embodiment of the invention is carried out clear, intactly description; Obviously, described embodiment only is the present invention's part embodiment, but not whole embodiment.
Describe in the face of a kind of file search method that is applied to embedded device in the embodiment of the invention down, see also Fig. 1, comprising:
101, divide the interval, acceleration point of file system;
In embodiments of the present invention; File search device carries out initialization to the file system on the embedded device at its place when electrifying startup; Promptly be the border, above-mentioned file system is divided into several intervals, acceleration points, and be acceleration point of interval setting, each acceleration point with the catalogue; Wherein, last directory entry in the interval, acceleration point is pointed in above-mentioned acceleration point.
In embodiments of the present invention; File search device is divided above-mentioned file system according to the acceleration point step-length; Above-mentioned acceleration point step-length can be used for the minimum number of files that definite interval, an acceleration point comprises; Perhaps, also can be used for the directory number that definite interval, an acceleration point comprises, not limit here.Above-mentioned acceleration point step-length can be before carrying out above-mentioned initialization procedure, sets length according to actual needs by the user, perhaps, also can be to be stored in this document searcher with the mode that presets, and does not limit here.Certainly, file search device can catalogue be the border also, at random above-mentioned file system is divided into several intervals, acceleration points, and the catalogue number that each interval, acceleration point of being divided comprises can be all inequality.
102, store first parameter value and second parameter value of each acceleration point;
Wherein, the catalogue number of accumulative total scanning when above-mentioned first parameter value indication searches this acceleration point, the X number of files of accumulative total scanning when above-mentioned second parameter value indication searches this acceleration point; Wherein, X indicates a kind of predetermined file type, can be audio file; Video file; Perhaps, can be other file type also, do not limit here.
103, obtain the file sequence number of file destination;
The file sequence number of above-mentioned file destination can be when calling certain file destination; The local storage of embedded device obtains from the place; Play to jump to next song and play the time like current song at audio player; Or play to jump to next video file and play the time at the current video file of video player; Audio player or video player must find out above-mentioned next song or above-mentioned next video file through file search device earlier; At this moment, file search device can be according to the file sequence number of from local storage, obtaining next song or next video file of the song or the video file of current broadcast, i.e. the file sequence number of file destination.Certainly, the file sequence number of above-mentioned file destination also can be by external unit or user's input, does not limit here.
The file type of above-mentioned file destination is above-mentioned X; Even the indication of second parameter value in the step 102 is the audio file number of accumulative total scanning when searching this acceleration point; Then the file type of file destination is an audio frequency; If the indication of second parameter value in the step 102 is the video file number of accumulative total scanning when searching this acceleration point, then the file type of file destination is a video.
104, judge whether to find the target acceleration point;
File search device is according to following conditional search target acceleration point: second parameter value of above-mentioned target acceleration point is less than the file sequence number of the file destination that gets access to; And; Second parameter value of the next acceleration point of target acceleration point is greater than the file sequence number of this file destination, if find the target acceleration point, then execution in step 105; If search the fall short acceleration point, then execution in step 106.
105, the first directory entry from above-mentioned file system begins, and adopts aero mode to search for above-mentioned file destination;
Wherein, the step that comprises of above-mentioned aero mode is following:
A1, scanning current directory item.
A2, judgement current directory item are file or catalogue;
Through scanning current directory item, the directory entry that can judge current search is file or catalogue, if file, if execution in step A3 then is catalogue, then execution in step A4.
A3, read next directory entry as the current directory item;
If the directory entry of current search is a file, then file is not carried out any analysis, promptly need not read the filename of this document; Need not read the file type of this document yet; Directly read next directory entry, with next directory entry as current directory item, execution in step A1.
A4, above-mentioned catalogue counter is added 1;
If the directory entry of current search is a catalogue, then the catalogue counter adds 1, and wherein, the initial value of this catalogue counter is zero.
A5, judge the catalogue counter value whether less than first parameter value of target acceleration point;
The value of catalogue counter and first parameter value of target acceleration point are compared; Whether the value of judging the catalogue counter is less than first parameter value of target acceleration point; If the value of catalogue counter representes then that less than first parameter value of target acceleration point there is not in the catalogue of current search execution in step A3 in file destination; If the value of catalogue counter is more than or equal to first parameter value of target acceleration point, then execution in step 106.Wherein, the initial value of above-mentioned catalogue counter is zero.
106,, when perhaps the value of catalogue counter is more than or equal to first parameter value of target acceleration point, adopt general mode ferret out file when searching the fall short acceleration point;
In embodiments of the present invention, if step 104 is searched the fall short acceleration point, show that then this file destination is arranged in interval, first acceleration point; Need not adopt aero mode ferret out file, can be according to common flow process ferret out file, promptly the first directory entry from file system begins; The scanning analysis directory entry is until the file of the sequence number coupling that finds file destination one by one, as when searching the fall short acceleration point, begins directory entry is scanned one by one from the first directory entry of file system; When the directory entry that scans is the X file, the value of file counter is added 1, equal the file sequence number of file destination until the value of this document counter; Stop to scan flow process; The directory entry of confirming last scanning is a file destination, and wherein, the initial value of this document counter is zero.
In embodiments of the present invention; When the value of catalogue counter during more than or equal to first parameter value of target acceleration point; The directory entry that shows subsequent searches possibly be file destination or comprise file destination; File search device begins from the next directory entry of current directory item, adopts general mode ferret out file.In embodiments of the present invention, when the value of catalogue counter during more than or equal to first parameter value of target acceleration point, file search device begins directory entry is scanned one by one from the next directory entry of current directory item; When the directory entry that scans is file; Analyze the file type of this document,, read next directory entry after then the value of file counter being added 1 and analyze if this document is the X file; Equal the flow process that stops search after the sequence number of file destination until the value of file counter; The directory entry of determining final search is a file destination, and wherein, the initial value of this document counter equals second parameter value of target acceleration point.
Further, the embodiment of the invention annular First Input First Output also capable of using (FIFO, First Input First Output) structure is come the first bunch of address and the catalogue number of plies of the directory entry to be scanned in the cache search file destination process; Because what adopt is annular fifo structure, when total FIFO item size of annular fifo structure reaches the degree of depth of FIFO, can come the new content of buffer memory through the FIFO item content before the replacement; Annular fifo structure synoptic diagram as shown in Figure 2; This annular fifo structure in a clockwise direction, the first bunch of address and the catalogue number of plies of storing directory entry to be scanned through newly-increased FIFO item, wherein; N FIFO item is the maximum FIFO item of this annular fifo structure; After n FIFO item is utilized, come the new content of buffer memory through the content of replacing the 0th FIFO item, realize the recycle of FIFO item with this; Save RAS (RAM, the RAM-random access memory) space of embedded device to greatest extent.
Therefore; During the present invention implements through file system is carried out initialization; Promptly divide acceleration point district's point of file system and store first parameter value and second parameter value of each acceleration point, make in the process of ferret out file, after second parameter value of this acceleration point capable of using finds the target acceleration point; Utilize first parameter value of this target acceleration point to determine and irrelevant file and the catalogue of this file destination; Directly skip and irrelevant file and the catalogue of this file destination, avoided the process of in the search procedure each directory entry all being analyzed and being mated, greatly improved the search speed of file.
Be example with the search audio file below, the file search method in the embodiment of the invention described with a concrete application scenarios.
As shown in Figure 3; With file system as a single-row linear list; Each provisional capital is a directory entry DirEntry; The process of scanning document system makes pointer Scanner Pointer begin to move down mobile from gauge outfit exactly, analyzes the directory entry of every row, writes down the total directories and the audio file sum of scanning.
Suppose that the acceleration point step-length of setting is 200, promptly confirm to comprise 200 files at least in the interval, an acceleration point.
File search device is according to the acceleration point step-length of setting; File system is carried out initialization; When scanning total audio file, be the border promptly with the catalogue; Every separated at least 200 file places are defined as an acceleration point (like the Accelerator among Fig. 3 [1], Accelerator [2] and Accelerator [3]); It is interval that file system has been divided a plurality of acceleration points, is catalogue like directory entry DirEntry N1, DirEntry N2 and DirEntry N3 among Fig. 3, and 0 interval of acceleration point, 1 interval and 2 intervals all comprise at least 200 files.Interval following two parameters in each acceleration point:
W0ScanDirNum: current scanned catalogue number.
W2FsScanTotalCnt: current scanned audio file number.
The file search flow process is as shown in Figure 4:
S1, obtain file destination sequence number w2FindFileIdx.
S2, judge whether to find target acceleration point Accelerator [i];
The method of searching Accelerator [i] is following:
Figure BDA0000096140660000081
Wherein, n is the sequence number of maximum acceleration point.
If find Accelerator [i], then execution in step S3 if can't find Accelerator [i], shows that then file destination is stored in 0 interval of acceleration point, execution in step S4.
S3, obtain the w0ScanDirNum [i] of Accelerator [i], establish aero mode and be masked as true.
S4, establish aero mode and be masked as false.
S5, scanning current directory item;
When beginning to search file destination, with the first directory entry of file system as the current directory item.
S6, judgement current directory item are file or catalogue;
If file, then execution in step S7.If catalogue, then execution in step S13.
S7, judge whether the aero mode sign is true;
If, execution in step S8 then, if not, execution in step S9 then.
S8, read the current directory item next directory entry as current directory item, execution in step S5.
S9, judge whether the file of current scanning is audio file;
If, execution in step S10 then, if not, execution in step S8 then.
S10, execution fcnt+=1;
Wherein, fcnt is the value of current file counter, and the acquiescence initial value of fcnt is zero.
S11, judge whether w2FindFileIdx equals fcnt, if, execution in step S12 then, if not, execution in step S8 then.
S12, stop to scan flow process, confirm that the directory entry of last scanning is a file destination.
S13, execution DirNum+=1;
Wherein, DirNum is the value of catalogue counter, and the acquiescence initial value of DirNum is zero.
S14, judge whether the aero mode sign is true;
If, execution in step S15 then, if not, execution in step S8 then.
S15, judge that whether DirNum is more than or equal to w0ScanDirNum [i];
If, execution in step S16 then, if not, execution in step S8 then.
The value of S16, above-mentioned file counter is set to w2FsScanTotalCnt [i], even fcnt equals w2FsScanTotalCnt [i], and establishes aero mode and is masked as false, execution in step S8.
Therefore; During the present invention implements through file system is carried out initialization; Promptly divide acceleration point district's point of file system and store first parameter value and second parameter value of each acceleration point, make in the process of ferret out file, after second parameter value of this acceleration point capable of using finds the target acceleration point; Utilize first parameter value of this target acceleration point to determine and irrelevant file and the catalogue of this file destination; Directly skip and irrelevant file and the catalogue of this file destination, avoided the process of in the search procedure each directory entry all being analyzed and being mated, greatly improved the search speed of file.
Describe in the face of a kind of file search device in the embodiment of the invention down, see also Fig. 5, the file search device 500 in the embodiment of the invention comprises:
Initialization unit 501 is used to divide the interval, acceleration point of file system;
In embodiments of the present invention; Initialization unit 501 is carried out initialization to the file system on the embedded device at its place when electrifying startup; Promptly be the border, above-mentioned file system is divided into several intervals, acceleration points, and be acceleration point of interval setting, each acceleration point with the catalogue; Wherein, last directory entry in the interval, acceleration point is pointed in above-mentioned acceleration point.
In embodiments of the present invention; Initialization unit 501 is divided above-mentioned file system according to the acceleration point step-length; Above-mentioned acceleration point step-length can be used for the minimum number of files that definite interval, an acceleration point comprises; Perhaps, also can be used for the directory number that definite interval, an acceleration point comprises, not limit here.Above-mentioned acceleration point step-length can be before carrying out above-mentioned initialization procedure, sets length according to actual needs by the user, perhaps, also can be to be stored in this document searcher with the mode that presets, and does not limit here.Certainly, initialization unit 501 can catalogue be the border also, at random above-mentioned file system is divided into several intervals, acceleration points, and the catalogue number that each interval, acceleration point of being divided comprises can be all inequality.
Storage unit 502 is used to store first parameter value and second parameter value of each acceleration point;
In embodiments of the present invention, above-mentioned acceleration point is corresponding one by one with the interval, acceleration point and point to last directory entry in the interval, above-mentioned acceleration point, wherein; The catalogue number of accumulative total scanning when above-mentioned first parameter value indication searches this acceleration point, the X number of files of accumulative total scanning when above-mentioned second parameter value indication searches this acceleration point, wherein; X indicates a kind of predetermined file type, can be audio file, video file; Perhaps, can be other file type also, do not limit here.
Acquiring unit 503 is used to obtain the file sequence number of file destination;
The file type of above-mentioned file destination is above-mentioned X.
Search judging unit 504, be used to judge whether to find the target acceleration point;
Search judging unit 504 according to following conditional search target acceleration point: second parameter value of above-mentioned target acceleration point is less than the file sequence number of the file destination that gets access to; And second parameter value of the next acceleration point of target acceleration point is greater than the file sequence number of this file destination.
Aero mode search unit 505, be used for when the judged result of searching judging unit 504 when being, begin from the first directory entry of file system, adopt aero mode ferret out file;
Wherein, acceleration search unit 505 comprises:
First scanning element is used to scan the current directory item;
Judging unit is used to judge that the current directory item is file or catalogue;
Reading unit is used for when above-mentioned judgment unit judges goes out the current directory item and is file, reading next directory entry as the current directory item;
Counting unit is used for when above-mentioned judgment unit judges goes out the current directory item and is catalogue, and the currency of catalogue counter is added 1, and wherein, the initial value of this catalogue counter is zero;
Above-mentioned reading unit also is used for reading next directory entry as the current directory item when the value of above-mentioned catalogue counter during less than first parameter value of this target acceleration point;
General mode search unit 506, be used for when the judged result of searching judging unit 504 for not the time, perhaps,, adopt general mode to search for above-mentioned file destination when the value of above-mentioned catalogue counter during more than or equal to first parameter value of this target acceleration point;
In a kind of application scenarios, general mode search unit 506 comprises:
Second scanning element is used for when the value of catalogue counter during more than or equal to first parameter value of this target acceleration point, begins directory entry is scanned one by one from the next directory entry of current directory item;
Put counting unit, be used for when the directory entry that scans is the X file, the value of file counter is added 1, wherein, the initial value of file counter equals above-mentioned second parameter value of this target acceleration point;
Stop confirming the unit, be used for when the value of above-mentioned file counter equals the file sequence number of file destination, stopping to scan flow process, confirm that the directory entry of the last scanning of above-mentioned scanning element is a file destination.
Under a kind of application scenarios, general mode search unit 506 comprises:
Second scanning element is used for when searching less than above-mentioned target acceleration point, begins directory entry is scanned one by one from the first directory entry of file system;
Put counting unit, be used for when the directory entry that scans is the X file, the value of file counter is added 1, wherein, the initial value of above-mentioned file counter is zero;
Stop confirming the unit, be used for when the value of file counter equals the file sequence number of file destination, stopping to scan flow process, confirm that the directory entry of the last scanning of above-mentioned scanning element is a file destination.
Further, the file search device 500 in the embodiment of the invention also can comprise: annular cell fifo is used for utilizing the first bunch of address and the catalogue number of plies of fifo structure cache search file destination process directory entry to be scanned.
Need to prove; The file search device 500 of present embodiment can be like the file search device among the above-mentioned method embodiment; Can be used for realizing whole technical schemes of said method embodiment; The function of its each functional module can specifically realize that its concrete implementation procedure can repeat no more with reference to the associated description in the foregoing description according to the method among the said method embodiment here.
Therefore; The present invention implements the file searcher through file system is carried out initialization; Promptly divide acceleration point district's point of file system and store first parameter value and second parameter value of each acceleration point, make in the process of ferret out file, after second parameter value of this acceleration point capable of using finds the target acceleration point; Utilize first parameter value of this target acceleration point to determine and irrelevant file and the catalogue of this file destination; Directly skip and irrelevant file and the catalogue of this file destination, avoided the process of in the search procedure each directory entry all being analyzed and being mated, greatly improved the search speed of file.
One of ordinary skill in the art will appreciate that all or part of step that realizes in the foregoing description method is to instruct relevant hardware to accomplish through program; Described program can be stored in a kind of computer-readable recording medium; The above-mentioned storage medium of mentioning can be a ROM (read-only memory), random access memory, disk or CD etc.
More than a kind of file search method relevant apparatus that is applied to embedded device provided by the present invention has been carried out detailed introduction; For one of ordinary skill in the art; Thought according to the embodiment of the invention; The part that on embodiment and range of application, all can change, to sum up, this description should not be construed as limitation of the present invention.

Claims (11)

1. a file search method that is applied to embedded device is characterized in that, comprising:
The acceleration point of dividing file system is interval, and wherein, interval, said acceleration point is the border with the catalogue;
Store first parameter value and second parameter value of each acceleration point; Wherein, Said acceleration point is corresponding one by one with interval, said acceleration point and point to last directory entry in the interval, said acceleration point; The X number of files of accumulative total scanning when the catalogue number of accumulative total scanning when the indication of said first parameter value searches said acceleration point, said second parameter value indication search said acceleration point, said X indicates a kind of predetermined file type;
Obtain the file sequence number of file destination, the file type of said file destination is said X;
Judge whether to find the target acceleration point; Wherein, Following condition is satisfied in said target acceleration point: second parameter value of said target acceleration point is less than the file sequence number of said file destination, and said second parameter value of the next acceleration point of said target acceleration point is greater than the file sequence number of said file destination;
When finding said target acceleration point, begin from the first directory entry of said file system, adopt aero mode to search for said file destination, wherein, said employing aero mode is searched for said file destination and is comprised:
Scanning current directory item judges that the current directory item is file or catalogue,
If file then reads next directory entry as the current directory item, carry out said scanning current directory item and judge that the current directory item still is the step of catalogue for file,
If catalogue; Then the catalogue counter adds 1; Read next directory entry as the current directory item, carry out scanning current directory item and judge that the current directory item still is the step of catalogue for file, until the value of said catalogue counter said first parameter value more than or equal to said target acceleration point; Wherein, the initial value of said catalogue counter is zero;
When searching less than said target acceleration point, the value of perhaps said catalogue counter adopts general mode to search for said file destination during more than or equal to said first parameter value of said target acceleration point.
2. method according to claim 1 is characterized in that,
When the value of said catalogue counter during more than or equal to said first parameter value of said target acceleration point, said employing general mode is searched for said file destination and is comprised:
Begin directory entry is scanned one by one from the next directory entry of current directory item;
When the directory entry that scans is the X file, the value of said file counter is added 1, wherein, the initial value of said file counter equals said second parameter value of said target acceleration point;
When the value of said file counter equals the file sequence number of said file destination, then stop to scan flow process, confirm that the directory entry of last scanning is a file destination.
3. method according to claim 1 is characterized in that, when searching less than said target acceleration point, said employing general mode is searched for said file destination and comprised:
Begin directory entry is scanned one by one from the first directory entry of said file system;
When the directory entry that scans is the X file, the value of said file counter is added 1, wherein, the initial value of said file counter is zero;
When the value of said file counter equals the file sequence number of said file destination, then stop to scan flow process, confirm that the directory entry of last scanning is a file destination.
4. according to each described method of claim 1 to 3, it is characterized in that,
The interval, acceleration point of said division file system comprises:
The acceleration point of dividing file system according to the acceleration point step-length of setting is interval, and wherein, said acceleration point step-length is used for the minimum number of files that definite interval, an acceleration point comprises.
5. according to each described method of claim 1 to 3, it is characterized in that,
Said X is an audio types.
6. according to each described method of claim 1 to 3, it is characterized in that,
Utilize the first bunch of address and the catalogue number of plies of directory entry to be scanned in the said file destination process of annular First Input First Output fifo structure cache search.
7. a file search device is characterized in that, comprising:
Initialization unit is used to divide the interval, acceleration point of file system, and wherein, interval, said acceleration point is the border with the catalogue;
Storage unit; Be used to store first parameter value and second parameter value of each acceleration point; Wherein, said acceleration point is corresponding one by one with interval, said acceleration point and point to last directory entry in the interval, said acceleration point, the catalogue number of accumulative total scanning when said first parameter value indication searches said acceleration point; The X number of files of accumulative total scanning when the indication of said second parameter value searches said acceleration point, said X indicates a kind of predetermined file type;
Acquiring unit is used to obtain the file sequence number of file destination, and the file type of said file destination is said X;
Search judging unit; Be used to judge whether to find the target acceleration point; Wherein, Following condition is satisfied in said target acceleration point: second parameter value of said target acceleration point is less than the file sequence number of said file destination, and said second parameter value of the next acceleration point of said target acceleration point is greater than the file sequence number of said file destination;
The aero mode search unit, be used for when said judged result of searching judging unit when being, begin from the first directory entry of said file system, adopt aero mode to search for said file destination;
The general mode search unit, be used for when said judged result of searching judging unit for not the time, perhaps,, adopt general mode to search for said file destination when the value of said catalogue counter during more than or equal to said first parameter value of said target acceleration point;
Wherein, said acceleration search unit comprises:
First scanning element is used to scan the current directory item;
Judging unit is used to judge that the current directory item is file or catalogue;
Reading unit is used for when said judgment unit judges goes out the current directory item and is file, reading next directory entry as the current directory item;
Counting unit is used for when said judgment unit judges goes out the current directory item and is catalogue, and the currency of catalogue counter is added 1, and wherein, the said initial value of stating the catalogue counter is zero;
Said reading unit also is used for reading next directory entry as the current directory item when the value of said catalogue counter during less than said first parameter value of said target acceleration point.
8. device according to claim 7 is characterized in that,
Said general mode search unit comprises:
Second scanning element is used for when the value of said catalogue counter during more than or equal to said first parameter value of said target acceleration point, begins directory entry is scanned one by one from the next directory entry of current directory item;
Put counting unit, be used for when the directory entry that scans is the X file, the value of said file counter is added 1, wherein, the initial value of said file counter equals said second parameter value of said target acceleration point;
Stop confirming the unit, be used for when the value of said file counter equals the file sequence number of said file destination, stopping to scan flow process, confirm that the directory entry of the last scanning of said scanning element is a file destination.
9. device according to claim 7 is characterized in that,
Said general mode search unit comprises:
Second scanning element is used for when searching less than said target acceleration point, begins directory entry is scanned one by one from the first directory entry of said file system;
Put counting unit, be used for when the directory entry that scans is the X file, the value of said file counter is added 1, wherein, the initial value of said file counter is zero;
Stop confirming the unit, be used for when the value of said file counter equals the file sequence number of said file destination, stopping to scan flow process, confirm that the directory entry of the last scanning of said scanning element is a file destination.
10. according to each described device of claim 7 to 9, it is characterized in that,
Said initialization unit specifically is used for dividing according to the acceleration point step-length of setting the interval, acceleration point of file system, and wherein, said acceleration point step-length is used for the minimum number of files that definite interval, an acceleration point comprises.
11. according to each described device of claim 7 to 9, it is characterized in that,
Said device also comprises:
The annular cell fifo is used for utilizing the first bunch of address and the catalogue number of plies of the said file destination process of annular First Input First Output fifo structure cache search directory entry to be scanned.
CN 201110297913 2011-09-29 2011-09-29 File searching method and related device applied in embedded equipment Active CN102360361B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 201110297913 CN102360361B (en) 2011-09-29 2011-09-29 File searching method and related device applied in embedded equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 201110297913 CN102360361B (en) 2011-09-29 2011-09-29 File searching method and related device applied in embedded equipment

Publications (2)

Publication Number Publication Date
CN102360361A true CN102360361A (en) 2012-02-22
CN102360361B CN102360361B (en) 2013-07-24

Family

ID=45585690

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 201110297913 Active CN102360361B (en) 2011-09-29 2011-09-29 File searching method and related device applied in embedded equipment

Country Status (1)

Country Link
CN (1) CN102360361B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103473350A (en) * 2013-09-24 2013-12-25 北京奇虎科技有限公司 File processing method and equipment
CN111414335A (en) * 2020-03-20 2020-07-14 深圳市凯沃尔电子有限公司 Data file searching method and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0410210A2 (en) * 1989-07-24 1991-01-30 International Business Machines Corporation Method for dynamically expanding and rapidly accessing file directories
US5437029A (en) * 1993-03-31 1995-07-25 Matsushita Electric Industrial Co., Ltd. Path name resolution method providing fixed speed of file accessing in computer network
CN101833559A (en) * 2009-11-05 2010-09-15 北京炬力北方微电子有限公司 Method and device for reading FAT ( disk files

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0410210A2 (en) * 1989-07-24 1991-01-30 International Business Machines Corporation Method for dynamically expanding and rapidly accessing file directories
US5437029A (en) * 1993-03-31 1995-07-25 Matsushita Electric Industrial Co., Ltd. Path name resolution method providing fixed speed of file accessing in computer network
CN101833559A (en) * 2009-11-05 2010-09-15 北京炬力北方微电子有限公司 Method and device for reading FAT ( disk files

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103473350A (en) * 2013-09-24 2013-12-25 北京奇虎科技有限公司 File processing method and equipment
CN111414335A (en) * 2020-03-20 2020-07-14 深圳市凯沃尔电子有限公司 Data file searching method and device
CN111414335B (en) * 2020-03-20 2023-07-14 深圳市凯沃尔电子有限公司 Data file searching method and device

Also Published As

Publication number Publication date
CN102360361B (en) 2013-07-24

Similar Documents

Publication Publication Date Title
US8625033B1 (en) Large-scale matching of audio and video
US9141667B2 (en) Efficient join with one or more large dimension tables
CN105630686A (en) Traversal testing method and device for applications and mobile terminal
CN104750839B (en) A kind of data recommendation method, terminal and server
CN105242829A (en) Method and device for integrating application icons in desktop
CN102970272A (en) Method, device and cloud server for detesting viruses
CN103995879A (en) Data query method, device and system based on OLAP system
EP2755119A1 (en) Method for moving interface object and apparatus for supporting movement of interface object
CN102508892B (en) System and method for quickly previewing pictures
CN103186622A (en) Updating method of index information in full text retrieval system and device thereof
CN102360361B (en) File searching method and related device applied in embedded equipment
CN105653697A (en) Recommended word retrieval method and system
CN103365928A (en) Information recommendation method and information recommendation device
CN115825312B (en) Chromatographic detection data interaction method, chromatographic detection data interaction device, chromatographic detection data interaction equipment and computer readable medium
CN103324576A (en) Memory space changing method and electronic equipment
Sakai Ntcireval: A generic toolkit for information access evaluation
US20110145242A1 (en) Intelligent Redistribution of Data in a Database
CN102646120A (en) File viewing method and device for mobile terminal
CN105847320A (en) Resource obtaining method and device
CN114661666B (en) Data searching method, device, equipment and storage medium
CN104244092A (en) Method, system and device for starting application through set top box
CN102521397A (en) Data transmission method
WO2016088237A1 (en) Distribution method, device, and program
CN103034730B (en) A kind of data processing method based on Android platform and system
CN107451229B (en) Database query method and device

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