Summary of the invention
The purpose of this invention is to provide a kind of long-distance distribution formula File mapping method and system; The restriction of the total volume of the long-distance distribution formula file that the actual capacity that can break away from disk can shine upon this disk utilizes limited disk size to shine upon long-distance distribution formula file as much as possible.
For realizing above-mentioned purpose, the invention provides following scheme:
A kind of long-distance distribution formula File mapping method is characterized in that, comprising:
Obtain listed files, said listed files comprises the document size information and the address information of said long-distance distribution formula file;
According to said document size information, this document is mapped to the relevant position in multiplex data bunch district; Said multiplex data bunch district is that all files institute is shared;
Write down the said address information of each file, and the position that maps to said multiplex data bunch district, the spanned file allocation table is so that conduct interviews to long-distance distribution formula file according to said file allocation table.
Preferably, said according to said document size information, this document is mapped to the relevant position in multiplex data bunch district, comprising:
Be starting cluster of each file allocation;
For each file, the aggregate of data of confirming according to file size to point in the said starting cluster of this document bunch number; The aggregate of data that points in the said starting cluster is that this document maps to first bunch of said multiplex data bunch district;
This document is mapped to first bunch of the said multiplex data bunch district zone between the cluster to the end.
Preferably, the aggregate of data of confirming to point in the said starting cluster of this document bunch number, be specially:
Through N=X-(M-2), calculate the multiplex data that points in the said starting cluster bunch bunch number;
Wherein, the N multiplex data representing to point in the said starting cluster bunch bunch number; X be multiplex data bunch zone last cluster bunch number; M for the storage said file take bunch number.
A kind of long-distance distribution formula file access method, spanned file allocation table in advance, said file allocation table comprises the address information of each file, and the position that maps to said multiplex data bunch district, comprising:
The request of the access remote distributed document that reception is sent by the terminal;
Parse the position in said File mapping to said multiplex data bunch district and the address information of said file according to said file allocation table; Said multiplex data bunch district is that all files institute is shared;
With the reading command of terminal, convert access instruction into to said long-distance distribution formula file to said multiplex data bunch district;
Through said address information, visit said long-distance distribution formula file.
Preferably, parse the position in said File mapping to said multiplex data bunch district and the address information of said file, comprising according to said file allocation table:
Resolve the said file starting cluster that comprises in the described request bunch number;
The multiplex data that the said starting cluster of inquiry points in said file allocation table bunch bunch number with the address information of said file; The multiplex data that points in the said starting cluster bunch bunch number do, this document map to first bunch of said multiplex data bunch district bunch number.
A kind of long-distance distribution formula File mapping system comprises:
The listed files acquisition module is used to obtain listed files; Said listed files comprises the document size information and the address information of said long-distance distribution formula file;
The File mapping module is used for this document being mapped to the relevant position in multiplex data bunch district according to said document size information; Said multiplex data bunch district is that all files institute is shared;
The file allocation table generation module is used to write down the said address information of each file, and the position that maps to said multiplex data bunch district, and the spanned file allocation table is so that conduct interviews to long-distance distribution formula file according to said file allocation table.
Preferably, said File mapping module comprises:
The starting cluster allocation units are used to starting cluster of each file allocation;
First multiplex data bunch definite unit is used for each file, the aggregate of data of confirming according to file size to point in the said starting cluster of this document bunch number; The aggregate of data that points in the said starting cluster is that this document maps to first bunch of said multiplex data bunch district;
The File mapping unit is used for this document is mapped to first bunch of the said multiplex data bunch district zone between the cluster to the end.
Preferably, said first a multiplex data bunch definite unit comprises:
Bunch number computation subunit is used for through N=X-(M-2), calculate the multiplex data that points in the said starting cluster bunch bunch number;
Wherein, the N multiplex data representing to point in the said starting cluster bunch bunch number; X be multiplex data bunch zone last cluster bunch number; M for the storage said file take bunch number.
A kind of long-distance distribution formula file access system comprises:
The request receiving element is used to receive the request of the access remote distributed document that is sent by the terminal;
The request analysis unit is used for parsing the position in said File mapping to said multiplex data bunch district and the address information of said file according to said file allocation table; Said multiplex data bunch district is that all files institute is shared;
Instruction converting unit is used for converting the reading command of terminal to said multiplex data bunch district into to said long-distance distribution formula file access instruction;
The file access unit is used for through said address information, visits said long-distance distribution formula file.
Preferably, the described request resolution unit comprises:
Starting cluster bunch number is resolved subelement, be used for resolving said file starting cluster that described request comprises bunch number;
File allocation table inquiry subelement, the multiplex data that is used for pointing to bunch at the said starting cluster of said file allocation table inquiry bunch number with the address information of said file; The multiplex data that points in the said starting cluster bunch bunch number do, this document map to first bunch of said multiplex data bunch district bunch number.
Long-distance distribution formula File mapping method and system disclosed by the invention, through each file all being mapped to multiplex data bunch district, said multiplex data bunch district is that all files institute is shared; Can carry out multiplexingly to the aggregate of data of disk, the restriction of the total volume of the long-distance distribution formula file that the actual capacity that can break away from disk can shine upon this disk utilizes limited disk size to shine upon long-distance distribution formula file as much as possible.And the total volume of long-distance distribution formula file of mapping no longer is subject to the physical capacity of disk.
Embodiment
To combine the accompanying drawing in the embodiment of the invention below, the 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, rather than whole embodiment.Based on the embodiment among the present invention, those of ordinary skills are not making the every other embodiment that is obtained under the creative work prerequisite, all belong to the scope of the present invention's protection.
Referring to Fig. 1, be the said long-distance distribution formula of embodiment of the invention File mapping method flow diagram.As shown in Figure 1, the method comprising the steps of:
S101: obtain listed files, said listed files comprises the document size information and the address information of said long-distance distribution formula file;
Concrete, said listed files can be that the video file resources such as (also being long-distance distribution formula file) that has on the server according to network side generates.For example: have 1000 video files on the said server, so, just generate a listed files according to these 1000 video files.This listed files comprises the document size information of each file.If variation has taken place in resources such as the video file of storing on the server, for example increased resource such as new video file or deleted old video file etc. resource, can correspondingly generate new listed files so.New listed files comprises the size information of the file after the renewal.
Said listed files is the address information of include file also, as URL (Uniform Resource Locator, URL) etc.Can visit the said long-distance distribution formula file corresponding through said address information with this address.
Said action of obtaining listed files can be when inserting terminal device such as motor machine when disks such as network flash disks, to be triggered by the network flash disk, also can be that the server by network side initiatively issues.
S102:, this document is mapped to the relevant position in multiplex data bunch district according to said document size information; Said multiplex data bunch district is that all files institute is shared;
Bunch, be the least unit that the FAT file system is distributed to a file.In the FAT file system, to the read operation of file, can be refined as to bunch operation.In the present invention, there is not real file data in local (like disks such as network flash disks), and all real data all are kept on the far-end distributed server.Only need with file data and bunch between shine upon, let terminal recognition such as televisor get final product.
The data capacity that each bunch can be stored is 4KB normally.The size of a file self, directly the number of needed bunch of this document is stored in decision.Multiplex data bunch is meant between this aggregate of data and a plurality of file to have mapping relations.Multiplex data bunch district bunch is made up of multiplex data.Said multiplex data bunch district is that all files institute is shared.That is to say that each long-distance distribution formula file can map in the multiplex data bunch district corresponding multiplex data bunch.The size of supposing multiplex data bunch district is 4GB (the FAT32 system is to the maximum constraints of file size), and this zone is that 1000 files institute is multiplexing, and then this multiplex data bunch is distinguished the file data of multipotency mapping 4000GB.
Referring to Fig. 2, be the said aggregate of data mapping relations of embodiment of the invention synoptic diagram.As shown in Figure 2, comprising:
Directory area 201 is used for bunch chained list of storing directory (if catalogue or classification are arranged), and it is multiplexing that this part does not have bunch, with the FAT32 of standard distribute bunch machine-processed identical.
Starting cluster district 202 is used for the starting cluster as file, and each file all can distribute a unique starting cluster, be used for sign and resolve fileinfo, and each starting cluster store this document following cluster bunch number; The following cluster of said this document is pointed to multiplex data bunch district 203.
Multiplex data bunch district 203, it is bunch multiplexing to be used for file data.Bunch maximum in this zone can be represented the file (FAT32 is to the maximum constraints of file size) of 4G size.When making up file system, bunch chain that can create a continuous 4G is as multiplex data bunch district, and its last cluster is a bunch end of chain (EOC) (0X0FFFFFFF).
With Fig. 2 is example: m+1 bunch is the starting cluster of first file (long-distance distribution formula file), and m+2 bunch is the starting cluster of second file, and the rest may be inferred, and m+n bunch is the starting cluster of n file.In each starting cluster, all store this document following cluster bunch number.When this document is conducted interviews, at first find the starting cluster (for example m+1 bunch) of this document, read bunch number (for example m+n+1 bunch) of the following cluster of storing in this starting cluster, jump to bunch (m+n+1 bunch) in the corresponding multiplex data bunch district 203 then.
Among Fig. 2, starting cluster is the data volume of each bunch size of m+1 bunch long-distance distribution formula file, corresponds respectively in the multiplex data bunch district 203 m+n+1 bunch to each multiplex data between the last cluster bunch.Starting cluster is the data volume of each bunch size of m+2 bunch long-distance distribution formula file, corresponds respectively in the multiplex data bunch district 203 m+n+x bunch to each multiplex data between the last cluster bunch.That is to say, these two file sharings in the multiplex data bunch district 203 m+n+x bunch to the zone between the last cluster.
S103: write down the said address information of each file, and the position that maps to said multiplex data bunch district, the spanned file allocation table is so that conduct interviews to long-distance distribution formula file according to said file allocation table.
Write down the said address information of each file, and the position that maps to said multiplex data bunch district, just write down the mapping relations of the aggregate of data in each file and the multiplex data bunch district.Concern the spanned file allocation table according to this, so that the terminal is converted into the visit to long-distance distribution formula file to the read operation of disk.
Concrete, the address information of each file and mapping relations are all corresponding to a list item in the file allocation table.And, the order of list item in file allocation table is identical with the order of the starting cluster of file in disk.Starting cluster is meant first aggregate of data that distributes into this document.Map to the information of first bunch the file in initial data bunch district, be stored in first list item in the file allocation table; Map to the information of second bunch the file in initial data bunch district, be stored in second list item in the file allocation table; The rest may be inferred.
It is thus clear that, the said long-distance distribution formula of embodiment of the invention File mapping method, through each file all being mapped to multiplex data bunch district, said multiplex data bunch district is that all files institute is shared; Can carry out multiplexingly to the aggregate of data of disk, the restriction of the total volume of the long-distance distribution formula file that the actual capacity that can break away from disk can shine upon this disk utilizes limited disk size to shine upon long-distance distribution formula file as much as possible.And the total volume of the long-distance distribution formula file of mapping no longer is subject within the 32G.
Concrete, according to said document size information, this document is mapped to the relevant position in multiplex data bunch district among the step S102, can comprise:
Be starting cluster of each file allocation;
For each file, the aggregate of data of confirming according to file size to point in the said starting cluster of this document bunch number; The aggregate of data that points in the said starting cluster is that this document maps to first bunch of said multiplex data bunch district;
This document is mapped to first bunch of the said multiplex data bunch district zone between the cluster to the end.
Wherein, starting cluster is first aggregate of data of each File mapping to disk.The corresponding file of each starting cluster is used to store the fileinfos such as sign and address information of this document.In each starting cluster, also store down cluster bunch number.When visit during this document, find the starting cluster of this document after, just can learn cluster under address and this document of this document bunch number.The address of this document is used for obtaining through network the real data of file, and cluster bunch number is used for the visit of support terminal to the aggregate of data of disk under this document.
The aggregate of data that points in the said starting cluster of each file, the following cluster of this document of just storing in the starting cluster bunch number.The following cluster of this document maps to first bunch of said multiplex data bunch district for this document.
First bunch of said multiplex data bunch district bunch number, confirm according to file size.For example, can adopt following mode to confirm:
Through N=X-(M-2), calculate the multiplex data that points in the said starting cluster bunch bunch number;
Wherein, the N multiplex data representing to point in the said starting cluster bunch bunch number; X be multiplex data bunch zone last cluster bunch number; M for the storage said file take bunch number.
Because the starting cluster of each file is positioned at the starting cluster district, so the aggregate of data number that said file takies in multiplex data bunch district is M-1.And in order to guarantee that EOF bunch is end mark 0X0FFFFFFF, the last cluster of file should be positioned at the last cluster in multiplex data bunch district, thus between the said file take in multiplex data bunch district first bunch to second from the bottom bunch bunch number be M-2.Bunch number X of the last cluster in multiplex data bunch zone deducts M-2, just can obtain first bunch position in said File mapping to the said multiplex data bunch district.
Concrete, store that said file takies bunch number M, can be through following method calculating:
Supposing that bunch size is 4KB, is the file of fsize (Byte) for size, the storage space that it takies (bunch to be unit) should for:
M=[(fsize+4095)/4096]。
This be because, 1KB=1024byte.Cluster 4KB, just 4096byte.If the data volume of a file is 1 bunch zero 1KB, then also need take 2 bunches space.Therefore, on the actual size basis of file, add 4095byte earlier among the present invention, divided by every bunch capacity 4KB (4096byte), at last the result is rounded again, can obtain the number of the actual aggregate of data that takies of file.
The invention also discloses a kind of long-distance distribution formula file access method.Referring to Fig. 3, be long-distance distribution formula file access method process flow diagram according to the invention.As shown in Figure 3, the method comprising the steps of:
S301: receive the request of the access remote distributed document that sends by the terminal;
Said terminal comprises that televisor, computer etc. are various and has the equipment that USB interface can be networked simultaneously.
S302: parse the position in said File mapping to said multiplex data bunch district and the address information of said file according to said file allocation table; Said multiplex data bunch district is that all files institute is shared;
Said file allocation table can be to adopt long-distance distribution formula File mapping method according to the invention to generate.In the said file allocation table, record the position in each File mapping to said multiplex data bunch district and the address information of said file.
When receiving the request of data at terminals such as televisor when disk,, can think that the terminal opened a new file if when the skew of this request is positioned at the second portion of file allocation table (starting cluster district).Because the starting cluster order of file allocation table and file is an one-to-one relationship; Like (m+1) bunch corresponding to No. 1 file, (m+2) bunch corresponding to No. 2 files, by that analogy; So; Only need do simple queries and just can obtain the next one bunch number of this document and the specifying information of file (like URL etc., the information of using through network access data), can go reading corresponding data on the network through this information.
S303:, convert access instruction into to said long-distance distribution formula file with the reading command of terminal to said multiplex data bunch district;
Because in the said file allocation table, establish in advance bunch and file between mapping relations, so the terminal can convert the access instruction to the data of long-distance distribution formula file counterpart into to the reading command of each bunch in the multiplex data bunch district of disk.Concrete, to first bunch the reading command in multiplex data bunch district, can convert visit into to the data of the 1-4KB of this long-distance distribution formula file; To second bunch the reading command in multiplex data bunch district, can convert visit into to the data of the 5-8KB of this long-distance distribution formula file, the rest may be inferred.
S304:, visit said long-distance distribution formula file through said address information.
Among the step S303; Disk is with the reading command of terminal to said multiplex data bunch district; After converting access instruction into to said long-distance distribution formula file; Just can obtain the data of said long-distance distribution formula file through network, and said data are returned to terminal device, realize visit said long-distance distribution formula file.
Concrete, among the step S302, parse the position in said File mapping to said multiplex data bunch district and the address information of said file according to said file allocation table, comprising:
Resolve the said file starting cluster that comprises in the described request bunch number;
The multiplex data that the said starting cluster of inquiry points in said file allocation table bunch bunch number with the address information of said file; The multiplex data that points in the said starting cluster bunch bunch number do, this document map to first bunch of said multiplex data bunch district bunch number.
Because have corresponding relation between this access method and the aforementioned mapping method, the technological means in this step has been done detailed explanation in aforementioned mapping method, so repeat no more here.
Corresponding with long-distance distribution formula File mapping method according to the invention, the invention also discloses a kind of long-distance distribution formula File mapping system.Referring to Fig. 4, be long-distance distribution formula File mapping system construction drawing according to the invention.As shown in Figure 4, this system comprises:
Listed files acquisition module 401 is used to obtain listed files; Said listed files comprises the document size information and the address information of said long-distance distribution formula file;
File mapping module 402 is used for this document being mapped to the relevant position in multiplex data bunch district according to said document size information; Said multiplex data bunch district is that all files institute is shared;
File allocation table generation module 403 is used to write down the said address information of each file, and the position that maps to said multiplex data bunch district, and the spanned file allocation table is so that conduct interviews to long-distance distribution formula file according to said file allocation table.
In the practical application, said File mapping module 402 can comprise:
The starting cluster allocation units are used to starting cluster of each file allocation;
First multiplex data bunch definite unit is used for each file, the aggregate of data of confirming according to file size to point in the said starting cluster of this document bunch number; The aggregate of data that points in the said starting cluster is that this document maps to first bunch of said multiplex data bunch district;
The File mapping unit is used for this document is mapped to first bunch of the said multiplex data bunch district zone between the cluster to the end.
Said first a multiplex data bunch definite unit can comprise:
Bunch number computation subunit is used for through N=X-(M-2), calculate the multiplex data that points in the said starting cluster bunch bunch number;
Wherein, the N multiplex data representing to point in the said starting cluster bunch bunch number; X be multiplex data bunch zone last cluster bunch number; M for the storage said file take bunch number.
Corresponding with long-distance distribution formula file access method according to the invention, the invention also discloses a kind of long-distance distribution formula file access system.Referring to Fig. 5, be long-distance distribution formula file access system construction drawing according to the invention.As shown in Figure 5, this system comprises:
Request receiving element 501 is used to receive the request of the access remote distributed document that is sent by the terminal;
Request analysis unit 502 is used for parsing the position in said File mapping to said multiplex data bunch district and the address information of said file according to said file allocation table; Said multiplex data bunch district is that all files institute is shared;
Instruction converting unit 503 is used for converting the reading command of terminal to said multiplex data bunch district into to said long-distance distribution formula file access instruction;
File access unit 504 is used for through said address information, visits said long-distance distribution formula file.
In the practical application, described request resolution unit 502 can comprise:
Starting cluster bunch number is resolved subelement, be used for resolving said file starting cluster that described request comprises bunch number;
File allocation table inquiry subelement, the multiplex data that is used for pointing to bunch at the said starting cluster of said file allocation table inquiry bunch number with the address information of said file; The multiplex data that points in the said starting cluster bunch bunch number do, this document map to first bunch of said multiplex data bunch district bunch number.
Each embodiment adopts the mode of going forward one by one to describe in this instructions, and what each embodiment stressed all is and the difference of other embodiment that identical similar part is mutually referring to getting final product between each embodiment.For the disclosed system of embodiment, because it is corresponding with the embodiment disclosed method, so description is fairly simple, relevant part is partly explained referring to method and is got final product.
Used concrete example among this paper principle of the present invention and embodiment are set forth, the explanation of above embodiment just is used for helping to understand method of the present invention and core concept thereof; Simultaneously, for one of ordinary skill in the art, according to thought of the present invention, part all can change on embodiment and range of application.In sum, this description should not be construed as limitation of the present invention.