Summary of the invention
In order to solve above-mentioned technical problem, the embodiment of the present application provides and realizes cloud by cloud file system and deposit
The method and apparatus that storage accesses, to be grouped as each application offer cloud storage clothes by a cloud file system
Business, application developers is without oneself realizing cloud storage function again, thus has saved the exploitation of application developers
Difficulty and development cost.
The embodiment of the present application discloses following technical scheme:
A kind of method realizing cloud storage access by cloud file system, including:
In response to the application operation requests to the file in cloud file system, obtain the process name of described application;
Judge described operation requests for file place path title in whether comprise described application
Process name;
If it is, allow described operation requests, cloud storage server is performed the instruction of described operation requests
Operation;
If it does not, refuse described operation requests.
Preferably, when described operation requests is write request, described permission said write is asked, to cloud
Storage server performs the write operation of said write request instruction and includes:
By said write request for file be saved in this locality memory space in;
Return write response to described application, and by said write request for file from local storage
Space propagation gives described cloud storage server.
Preferably, also include:
By said write request for file be transferred to described cloud storage service from local memory space
After device, by said write request for file delete from local memory space.
Preferably, also include:
By said write operation for the information of file be stored in the data base of this locality.
Preferably, also include:
In response to the startup operation to cloud file system, the fileinfo in described cloud storage server is same
Walk in local data base.
Preferably, also include:
In response to the application read requests to the file directory in described file system, from the number of described this locality
Read fileinfo according to storehouse, and the fileinfo of reading is returned to described application.
Preferably, also include:
Before cloud storage server is performed the operation of described operation requests instruction, according to described cloud file
Unique mark of the electronic equipment at system place, obtains from cloud storage agent platform and is pre-assigned to described cloud
The use account of the cloud storage server of the electronic equipment at file system place, wherein, described cloud storage generation
Platform is previously stored with the mapping between unique mark of electronic equipment and the use account of cloud storage service
Relation;
The most described operation to cloud storage server execution described operation requests instruction is:
Use account according to described cloud storage server performs described operation to corresponding cloud storage server
The operation of request instruction.
Preferably, the use account of described cloud storage server is to encrypt through described cloud storage agent platform
Process.
Preferably, described cloud file system realizes at user's space.
Preferably, described user's space being provided with libfuse interface, described libfuse interface is empty with kernel
Between FUSE module communication;When the VFS module in kernel spacing is in response to the file manipulation command of application,
And when described file manipulation command is passed to FUSE module, described FUSE module is by described file operation
Order passes to described libfuse interface, and described file manipulation command is passed to institute by described libfuse interface
State cloud file system.
Preferably, described cloud file system is transmitted based on http protocol realization.
A kind of device being realized cloud storage access by cloud file system, including:
Process name acquiring unit, is used in response to the operation requests applied the file in cloud file system,
Obtain the process name of described application;
Judging unit, for judge described operation requests for file place path title in whether
Comprise the process name of described application;
Operation execution unit, for if it is, allow described operation requests, performs cloud storage server
The operation of described operation requests instruction;
Operation refusal unit, for if it does not, refuse described operation requests.
Preferably, when described operation requests is write request, described operation execution unit includes:
First storing sub-units, for by said write request for file to be saved in the storage of this locality empty
In between;
Response subelement, for described application return write response, and by said write request for
File is transferred to described cloud storage server from local memory space.
Preferably, described operation execution unit also includes:
Delete subelement, for described response subelement by said write request for file from this locality
Memory space be transferred to described cloud storage server after, by said write request for file from this
The memory space on ground is deleted.
Preferably, described operation execution unit also includes:
Second storing sub-units, for by said write operation for the information of file be stored in this locality
In data base.
Preferably, described device also includes:
Data synchronisation unit, in response to the startup operation to cloud file system, taking described cloud storage
Fileinfo in business device is synchronized in the data base of this locality.
Preferably, described device also includes:
Catalogue reads unit, for asking the reading of the file directory in described file system in response to application
Ask, read fileinfo from the data base of described this locality, and the fileinfo of reading is returned to described answering
With.
Preferably, described device also includes:
Account acquiring unit, for performing described operation in described operation execution unit to cloud storage server
Before the operation of request instruction, identify according to the unique of electronic equipment at described cloud file system place, from
Cloud storage agent platform obtains the cloud storage clothes of the electronic equipment being pre-assigned to described cloud file system place
The use account of business device, wherein, described cloud storage agent platform is previously stored with unique mark of electronic equipment
Know the mapping relations between the use account of cloud storage service;
The most described operation execution unit is used for, according to the use account of described cloud storage server to accordingly
Cloud storage server performs the operation of described operation requests instruction.
Preferably, the use account of described cloud storage server is to encrypt through described cloud storage agent platform
Process.
Preferably, described cloud file system realizes at user's space.
Preferably, described user's space being provided with libfuse interface, described libfuse interface is empty with kernel
Between FUSE module communication;When the VFS module in kernel spacing is in response to the file manipulation command of application,
And when described file manipulation command is passed to FUSE module, described FUSE module is by described file operation
Order passes to described libfuse interface, and described file manipulation command is passed to institute by described libfuse interface
State cloud file system.
Preferably, described cloud file system is transmitted based on http protocol realization.
As can be seen from the above-described embodiment, compared with prior art, the advantage of the application is:
It is grouped as all application by a cloud file system and system-level cloud storage service is provided, and, right
For each is applied, one's own file in this cloud file system can only be operated by it, and
The file belonging to other application can not be operated.The developer of each application is without the most each going to realize
Cloud storage services, thus has saved development difficulty and the development cost of application developers.
Detailed description of the invention
Understandable, below in conjunction with the accompanying drawings for enabling the above-mentioned purpose of the application, feature and advantage to become apparent from
The embodiment of the present application is described in detail.
Embodiment of the method
Schematically showing presently filed embodiment with reference first to Fig. 1, Fig. 1 can be real wherein
The exemplary application scene executed.Wherein, as a example by intelligent television equipment, in intelligent television equipment
One cloud file system 10 of upper layout, creates one/Cloud under the root of cloud file system 10
File 11, any one client application in intelligent television equipment can be as operation local file one
File in sample operation/Cloud file 11./ Cloud file 11 is a virtual folder,
And it is mapped on some file 21 of cloud storage server 20, therefore, any one client
End application in cloud file system 10 /cloud storage actually takes by the operation of Cloud file 11
The operation of some file 21 on business device 20.
Concrete, client application 30 sends in right/Cloud file 11 to cloud file system 10
The write request of some file, the write authority of client application 30 is carried out by cloud file system 10
Controlling, if allowing this write request, cloud file system 10 performs this to cloud storage server 20 and writes
Enter the write operation indicated by request.That is, cloud file system 10 is on cloud storage server 20 sends
Transmitting file is asked, and cloud storage server 20 returns upper transmitting file to cloud file system 10 and responds (upper
Transmitting file response indicates files passe success or uploads failure).If refusing this write request, Yun Wen
Part system 10 returns the response of refusal write to client application 30.Those skilled in the art can manage
Solving, the schematic diagram shown in Fig. 1 is only that presently filed embodiment can be achieved wherein
Example.The range of application of the application embodiment is not limited by any aspect of this framework.Such as,
Client application 30 except can to cloud file system 10 send in right/Cloud file 11 a certain
Outside the write request of individual file, it is also possible to send right/Cloud file 11 to cloud file system 10
In the read requests of some file.As response, cloud file system 10 is to cloud storage server
20 send file read request, and cloud storage server 20 returns corresponding file to cloud file system 10.
It should be noted that in this application, " cloud file system " is that one can provide cloud to application
The file system of storage access service.
In conjunction with above-mentioned application scenarios, refer to Fig. 2, it is schematically shown that according to an enforcement of the application
The flow chart of the method being realized cloud storage by cloud file system of mode, such as, the method can be by cloud
File system 10 performs, and the method such as comprises the following steps:
Step 201: in response to the operation requests applied the file in cloud file system, obtain described application
Process name.
Step 202: judge described operation requests for file place path title in whether comprise institute
State the process name of application, if it is, enter step 203, otherwise, enter step 204.
Step 203: allow described operation requests, performs the instruction of described operation requests to cloud storage server
Operation, terminates flow process.
Step 204: refuse described operation requests, terminates flow process.
In Linux file system, the rights management of file is based on user, i.e. a file can only
Belonging to a user, other user can not arbitrarily operate this document.But, at intelligent television equipment or machine
In set top box device, the concept of application becomes more important.When cloud file system 10 responds some application to certain
During the operation requests of one file, need first to judge whether this application has the authority operating this document.
Specifying in this application, an application can only access with under the file of the process name name of oneself
Content.Based on this, cloud file system 10 may determine that this operation requests for the path at file place
Whether title comprises the process name of described application, if it is, i.e. can determine that this application has to enter this document
The authority of row operation, as response, cloud file system 10 allows this operation requests, to cloud storage server
Perform the operation of this operation requests instruction;If it does not, i.e. can determine that this document is not grasped by this application
The authority made, as response, cloud file system 10 refuses this operation requests.
Wherein, when an application sends operation requests to cloud file system 10, the process number of this application is made
Giving cloud file system 10 for a parameter transmission in this operation requests, cloud file system 10 was by answering
Process number can obtain the process name of this application further.
A file system depending on network in view of the cloud file system 10 in the application, its for
The response speed of operation requests can be lower than the response speed of local file system.
In a preferred implementation of the application, in order to improve cloud file system 10 as much as possible to writing
Enter the response speed of request, when cloud file system 10 allows write request, cloud storage server 20 is held
Row this write request instruction write operation time, cloud file system 10 can first by write request for file
It is saved in the memory space of this locality, returns write response to application the most at once, in order to user can continue
Continuous carry out following operation, subsequently cloud file system 10 again by this write request for file from local
Memory space is transferred to cloud storage server 20.Certainly, cloud file system 10 can also return to application
While write response, by this write request for file be transferred to cloud storage from local memory space
Server 20.
Further, by write request for file be transferred to cloud storage clothes from local memory space
After business device, also by write request for the local memory space of file in delete, in order to release this locality
Memory space.
In a preferred implementation of the application, in order to improve cloud file system 10 as much as possible to reading
Take the response speed of request, cloud file system 10 by write operation for the file information storage of file exist
In local data base.Wherein, fileinfo can include but not limited to: the type of file, file
Size and the store path etc. of file.Fileinfo is to be stored as metadata in data base.Work as cloud
When file system 10 is in response to the read requests applied file directory, file system 10 is from local number
According to storehouse is read fileinfo, and the fileinfo of reading is returned to this application.
It should be understood that owing to cloud file system 10 is to read fileinfo from local data base,
Without the cloud storage server 20 by network access high in the clouds, therefore, it can be quickly carried out response.
In order to ensure the fileinfo in cloud storage server 20 and the fileinfo one in local data base
Cause, in another preferred implementation of the application, when starting cloud file system 10, in response to this
Starting operation, cloud file system 10 starts synchronous service, i.e. by the file in cloud storage server 20
Synchronizing information is in local data base.
Certainly, whether the fileinfo that cloud file system 10 can first compare in local data base is deposited with cloud
Fileinfo in storage server is consistent, if inconsistent, restarts synchronous service, if unanimously, no
Start synchronous service.
Before synchronously completing, first use the data base before synchronizing, after the synchronization completes, re-use
Data base after synchronization.
In addition, it is necessary to explanation, in this application, it is possible to use existing cloud storage server provides
Cloud storage services.
But, there is oneself account system the commercial city that provides of cloud storage server, needs what each applied to open
Cloud storage function is registered and opened to originator on website, and then obtains a cloud storage server for application
Use account.Also need to perform loaded down with trivial details operations such as registering and open in view of each developer applied
Cheng Caineng enjoys cloud storage service, therefore, in this application, the developer applied in order to avoid each
Perform above-mentioned loaded down with trivial details operating process, a cloud storage agent platform (Cloudstorage can be built beyond the clouds
Agent Platform, CAP), by the manufacturer of intelligent television equipment or set-top box device from cloud storage service
It is the use account of each equipment one cloud storage server of acquisition at the provider of device, meanwhile, at CAP
On store the mapping pass between unique mark and the uses account of cloud storage server of each equipment
System.
Schematically showing presently filed embodiment with reference first to Fig. 3, Fig. 3 can be real wherein
Another exemplary application scene executed.Client application 30 sends right/Cloud to cloud file system 10
The write request of the file in file 11, the write of client application 30 is weighed by cloud file system 10
Limit is controlled, if allowing this write request, cloud file system 10 will send acquisition to CAP40
Account request, includes the unique of cloud file system 10 place electronic equipment in this acquisition account request
Mark, e.g., device identification Device ID and product type Product Name, CAP40 are according to pre-
The mapping relationship searching first stored is to the use account of cloud storage server 20, and to cloud file system 10
Return and obtain account response, in this acquisition account responds, include the use account of cloud storage server 20.
Cloud storage server 20 is performed by cloud file system 10 according to the use account of cloud storage server 20 should
The write operation of write request instruction.That is, cloud file system 10 is on cloud storage server 20 sends
Transmitting file ask, cloud storage server 20 to cloud file system 10 return instruction files passe success or
Upload the upper transmitting file response of failure.If refusing this write request, cloud file system 10 is to client
The write response of application 30 return instruction refusal write.It will be understood by those skilled in the art that Fig. 3
Shown schematic diagram is only the example that presently filed embodiment can be achieved wherein.This
The range of application of application embodiment is not limited by any aspect of this framework.Such as, client should
With 30 except can send the write of file in right/Cloud file 11 to cloud file system 10 please
Outside asking, it is also possible to send the reading of file in right/Cloud file 11 to cloud file system 10
Request.As response, cloud file system 10 sends file read request to cloud storage server 20,
Cloud storage server 20 returns corresponding file to cloud file system 10.
In addition, it is necessary to explanation, in order to ensure that the use account of cloud storage server 20 is when transmission
Safety, the use account of cloud storage server 20 can be carried out by CAP first with AES
Encryption, the most again by the use account of the cloud storage server 20 after encryption by letter
Message is made to be sent to cloud file system 10.
It should be understood that during whole, each application is one to the account of cloud storage server 20
Ignorant, this has also ensured the safety of account of cloud storage server 20.
In the prior art, such as these common file system of ext4 it is all in the kernel of operating system
Realize, i.e. file system is as a module of kernel.But, this implementation is for being
The requirement of system developer is the highest, needs the kernel of very familiar operating system, thus adds exploitation
Difficulty.In order to reduce development difficulty, in a preferred implementation of the application, cloud file system
10 realize at user's space, thus application has only to use general Linux file operation interface,
Just can access cloud file system.
As shown in Figure 4, the libfuse interface of user's space and the FUSE (Filesystem of kernel spacing
In Userspace) module passes through/and dev/fuse equipment realizes communication, thus reaches by user's space
Libfuse interface takes over the purpose of all user operations.Wherein, ordered by certain when client application
When initiating the operation of file in right/Cloud file 11, this order is delivered to kernel from user's space
VFS (Virtual File Systeml, the Virtual File System) module in space, VFS module is by this life
Order passes to FUSE module further, and this order is passed back to use by FUSE module again from kernel spacing
The libfuse interface in space, family, libfuse interface passes that command to ./yunfs/Cloud treatment progress
(that is, for realizing the treatment progress of various file operation, also it is the cloud file system in application
System) ./yunfs/Cloud treatment progress performs corresponding operation according to this order.It is finished
After, execution result is returned to libfuse interface by ./yunfs/Cloud, and libfuse interface will perform result
Pass to the FUSE module of kernel spacing from user's space, FUSE module will perform result transmission again
To VFS module, execution result is passed to client application by VFS module.
In order to make the cloud file system 10 of the application can be preferable to carry out of the application across LAN
In mode, cloud file system 10 is transmitted based on http protocol realization.
It should be noted that the cloud file system in the application can be arranged in intelligent television, Set Top Box,
In the terminal units such as PC, panel computer or mobile phone.Wherein, intelligent television and Set Top Box it are preferably placed in
In.
It addition, in this application, when the operation requests of cloud file system response application, it is to deposit for cloud
Storage server performs the operation of this operation requests instruction, i.e. be to provide, to application, the clothes that cloud storage accesses
Business.Additionally, cloud file system realizes at user's space rather than in linux kernel, and,
In transport layer, cloud file system is based on the transmission of http protocol realization rather than based on agreement freely
Realize transmission.
As can be seen from the above-described embodiment, compared with prior art, the advantage of the application is:
It is grouped as all of application by a cloud file system and system-level cloud storage access service is provided, and
And, for each is applied, one's own file in this cloud file system can only be grasped by it
Make, and the file belonging to other application can not be operated.The developer of each application is without the most respective
Go to realize cloud storage service, thus save development difficulty and the development cost of application developers.
Device embodiment
With above-mentioned a kind of by cloud file system realize cloud storage access method corresponding, the application implement
Example additionally provides a kind of device being realized cloud storage by cloud file system.Refer to Fig. 5, schematically show
Gone out according to the application embodiment realizes, by cloud file system, the device that cloud storage accesses
Structured flowchart, this device includes: process name acquiring unit 501, judging unit 502, operation execution unit
503 refuse unit 504 with operation.Operation principle below in conjunction with this device is further described its internal structure
And annexation.
Process name acquiring unit 501, for asking the operation of the file in cloud file system in response to application
Ask, obtain the process name of described application;
Judging unit 502, for judge described operation requests for file place path title in be
The no process name comprising described application;
Operation execution unit 503, for if it is, allow described operation requests, holds cloud storage server
The operation of row described operation requests instruction;
Operation refusal unit 504, for if it does not, refuse described operation requests.
In a preferred implementation of the application, as shown in Figure 6, when described operation requests is for writing
During request, operation execution unit 503 includes:
First storing sub-units 5031, for by said write request for file be saved in this locality deposit
In storage space;
Response subelement 5032, for returning write response to described application, and asks pin by said write
To file be transferred to described cloud storage server from local memory space.
In another preferred implementation of the application, as it is shown in fig. 7, operation execution unit 503 is also
Including:
Delete subelement 5033, for response subelement 5032 by said write request for file from
After local memory space is transferred to described cloud storage server, by said write request for file
Delete from local memory space.
In another preferred implementation of the application, operation execution unit 503 also includes:
Second storing sub-units, for by said write operation for file file information storage this
In the data base on ground.
In another preferred implementation of the application, described device also includes:
Data synchronisation unit, in response to the startup operation to cloud file system, taking described cloud storage
Fileinfo in business device is synchronized in the data base of this locality.
In a preferred implementation of the application, described device also includes:
Catalogue reads unit, for asking the reading of the file directory in described file system in response to application
Ask, read fileinfo from the data base of described this locality, and the fileinfo of reading is returned to described answering
With.
In a preferred implementation of the application, as shown in Figure 8, described device also includes:
Account acquiring unit 505, for performing described behaviour in operation execution unit 503 to cloud storage server
Before making the operation of request instruction, according to unique mark of the electronic equipment at described cloud file system place,
The cloud storage of the electronic equipment being pre-assigned to described cloud file system place is obtained from cloud storage agent platform
The use account of server, wherein, described cloud storage agent platform is previously stored with the unique of electronic equipment
Mapping relations between the use account of mark and cloud storage service;
Then operation execution unit 503 is used for, according to the use account of described cloud storage server to accordingly
Cloud storage server performs the operation of described operation requests instruction.
In another preferred implementation of the application, the use account of described cloud storage server be through
Cross described cloud storage agent platform encryption.
In another preferred implementation of the application, described cloud file system is to realize at user's space
's.
In another preferred implementation of application, cloud can be realized at user's space in the following way
File system: described user's space is provided with libfuse interface, described libfuse interface and kernel spacing
FUSE module communication;When the VFS module in kernel spacing is in response to the file manipulation command of application,
And when described file manipulation command is passed to FUSE module, described FUSE module is by described file operation
Order passes to described libfuse interface, and described file manipulation command is passed to institute by described libfuse interface
State cloud file system.
In another preferred implementation of the application, described cloud file system is based on http protocol realization
Transmission.
As can be seen from the above-described embodiment, compared with prior art, the advantage of the application is:
It is grouped as all application by a cloud file system and system-level cloud storage service is provided, and, right
For each is applied, one's own file in this cloud file system can only be operated by it, and
The file belonging to other application can not be operated.The developer of each application is without the most each going to realize
Cloud storage services, thus has saved development difficulty and the development cost of application developers.
It should be noted that the cloud file system of the application is applicable not only to intelligent television equipment or Set Top Box
In equipment, it is apply equally as well to use other electronic equipment of linux kernel, including mobile device and PC
Machine etc..
The technical staff in described field is it can be understood that arrive, for convenience of description and succinctly, above-mentioned
The specific works process of the system, device and the unit that describe, be referred in preceding method embodiment is right
Answer process, do not repeat them here.
In several embodiments provided herein, it should be understood that disclosed system, device and
Method, can realize by another way.Such as, the device embodiment arrived described above is only
Schematically, such as, the division of described unit, it is only a kind of logic function and divides, actual when realizing
Can have other dividing mode, the most multiple unit or assembly can in conjunction with or be desirably integrated into another
System, or some features can ignore, or do not perform.Another point, shown or discussed each other
Coupling direct-coupling or communication connection can be the INDIRECT COUPLING by some interfaces, device or unit
Or communication connection, can be being electrical, mechanical or other form.
The described unit that illustrates as separating component can be or can also be physically separate, as
The parts that unit shows can be or may not be physical location, i.e. may be located at a place, or
Person can also be distributed on multiple NE.Can select according to the actual needs part therein or
All unit realizes the purpose of the present embodiment scheme.
It addition, each functional unit in each embodiment of the application can be integrated in a processing unit,
Can also be that unit is individually physically present, it is also possible to two or more unit are integrated in a list
In unit.Above-mentioned integrated unit both can realize to use the form of hardware, can use SFU software functional unit
Form realize.
It should be noted that one of ordinary skill in the art will appreciate that and realize in above-described embodiment method
All or part of flow process, can be by computer program and completes to instruct relevant hardware, described
Program can be stored in a computer read/write memory medium, and this program is upon execution, it may include as above-mentioned
The flow process of the embodiment of each method.Wherein, described storage medium can be magnetic disc, CD, read-only storage
Memory body (Read-Only Memory, ROM) or random store-memory body (Random Access
Memory, RAM) etc..
Above a kind of method and apparatus realizing cloud storage access provided herein is carried out detailed Jie
Continuing, principle and the embodiment of the application are set forth by specific embodiment used herein, above
The explanation of embodiment is only intended to help and understands the present processes and core concept thereof;Simultaneously for this
The those skilled in the art in field, according to the thought of the application, the most all
Will change, in sum, this specification content should not be construed as the restriction to the application.