CN109885257A - A kind of disk file reading/writing method and device - Google Patents

A kind of disk file reading/writing method and device Download PDF

Info

Publication number
CN109885257A
CN109885257A CN201910100744.3A CN201910100744A CN109885257A CN 109885257 A CN109885257 A CN 109885257A CN 201910100744 A CN201910100744 A CN 201910100744A CN 109885257 A CN109885257 A CN 109885257A
Authority
CN
China
Prior art keywords
file
read
write
virtual
subregion
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
CN201910100744.3A
Other languages
Chinese (zh)
Other versions
CN109885257B (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.)
Vivo Mobile Communication Co Ltd
Original Assignee
Vivo Mobile Communication 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 Vivo Mobile Communication Co Ltd filed Critical Vivo Mobile Communication Co Ltd
Priority to CN201910100744.3A priority Critical patent/CN109885257B/en
Publication of CN109885257A publication Critical patent/CN109885257A/en
Application granted granted Critical
Publication of CN109885257B publication Critical patent/CN109885257B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The present invention provides a kind of disk file reading/writing method and devices.The described method includes: obtaining the file read/write request that terminal is sent;Wherein, file read/write request include continue/written document locating for target virtual disk subregion and the/virtual logical address of written document that continues;According to the mapping relations of virtual disk partition and physical disk subregion, target physical disk partition corresponding with the target virtual disk subregion is determined;It continues according to described in/virtual logical address of written document and file read/write request, executes corresponding file read/write operation in the target physical disk partition.The present invention can be by sharing the virtual disk partition of simulation to terminal, so as to realize that shared both ends can access the purpose of file simultaneously.

Description

A kind of disk file reading/writing method and device
Technical field
The present invention relates to mobile communication technology fields, more particularly to a kind of disk file reading/writing method and device.
Background technique
It is very common usage scenario that file-sharing is carried out between equipment, as between mobile phone and PC or mobile phone File-sharing etc. is carried out between mobile phone.There are many kinds of approach again for file-sharing, are such as shared or are passed through by network USB is shared.By the shared realization being divided into based on massive store agreement of USB again and based on media transmission protocol (PTP/MTP) realization of agreement.
Currently, equipment room carries out the mode of file-sharing mainly by way of USB shared file, it is based on large capacity Agreement is stored to realize.And with the continuous iteration of software technology and the limitation of massive store agreement itself, file Sharing mode gradually to PTP/MTP agreement evolution, especially has sharing between sophisticated functions and the equipment of system, such as intelligence It can shared file etc. between mobile phone and computer.
And the massive store protocol realization needs based on USB delimit specific subregion on the disk of equipment end, subregion Being shared in the form of block device is made host side (such as computer) equipment end can not access the partition data simultaneously afterwards.
Summary of the invention
The embodiment of the present invention provides a kind of disk file reading/writing method and device, to solve file-sharing in the prior art The problem of mode can not access simultaneously.
In order to solve the above-mentioned technical problem, the embodiments of the present invention are implemented as follows:
In a first aspect, the embodiment of the invention provides a kind of disk file reading/writing methods, comprising: obtain the text that terminal is sent Part read/write requests;Wherein, file read/write request include continue/written document locating for target virtual disk subregion and described Continue/the virtual logical address of written document;According to virtual disk partition and physical disk subregion mapping relations, determine with it is described The corresponding target physical disk partition of target virtual disk subregion;It continues according to described in/virtual logical address of written document and institute File read/write request is stated, executes corresponding file read/write operation in the target physical disk partition.
Second aspect, the embodiment of the invention provides a kind of disk file read-write equipments, comprising: read-write requests obtain mould Block, for obtaining the file read/write request of terminal transmission;Wherein, file read/write request include continue/written document locating for Target virtual disk subregion and the/virtual logical address of written document that continues;Physical extent determining module, for according to empty The mapping relations of quasi- disk partition and physical disk subregion, determine target physical magnetic corresponding with the target virtual disk subregion Disk subregion;Read-write operation execution module, for/virtual logical address and the file read/write of written document of continuing according to described in Request executes corresponding file read/write operation in the target physical disk partition.
The third aspect the embodiment of the invention provides a kind of mobile terminal, including processor, memory and is stored in described It is real when the computer program is executed by the processor on memory and the computer program that can run on the processor The step of existing disk file reading/writing method described in any of the above embodiments.
Fourth aspect, it is described computer-readable to deposit the embodiment of the invention also provides a kind of computer readable storage medium Computer program is stored on storage media, the computer program realizes disk text described in any of the above embodiments when being executed by processor The step of part reading/writing method.
In embodiments of the present invention, it is requested by obtaining the file read/write that terminal is sent, wherein file read/write request packet Include continue/written document locating for target virtual disk subregion and continue the/virtual logical address of written document, according to virtual disk point The mapping relations in area and physical disk subregion determine target physical disk partition corresponding with target virtual disk subregion, foundation Continue/virtual logical address of written document and file read/write request, target physical disk partition execute corresponding file read/ Write operation.The embodiment of the present invention is by sharing the virtual disk partition of simulation to terminal, so as to realize that shared both ends can To access the purpose of file simultaneously.
Detailed description of the invention
Fig. 1 shows a kind of step flow chart of disk file reading/writing method provided in an embodiment of the present invention;
Fig. 2 shows a kind of step flow charts of disk file reading/writing method provided in an embodiment of the present invention;
Fig. 3 shows a kind of structural schematic diagram of disk file read-write equipment provided in an embodiment of the present invention;
Fig. 4 shows a kind of structural schematic diagram of disk file read-write equipment provided in an embodiment of the present invention;
Fig. 5 shows a kind of structural block diagram of mobile terminal provided in an embodiment of the present invention.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete Site preparation description, it is clear that described embodiments are some of the embodiments of the present invention, instead of all the embodiments.Based on this hair Embodiment in bright, every other implementation obtained by those of ordinary skill in the art without making creative efforts Example, shall fall within the protection scope of the present invention.
Embodiment one
Referring to Fig.1, a kind of step flow chart of disk file reading/writing method provided in an embodiment of the present invention, the magnetic are shown Disk file read/write method can be applied to mobile terminal, can specifically include following steps:
Step 101: obtaining the file read/write request that terminal is sent;Wherein, the file read/write request includes continuing/writing Target virtual disk subregion locating for file and the/virtual logical address of written document that continues.
In embodiments of the present invention, mobile terminal can for mobile phone, PDA (PersonalDigital Assistant, it is a Personal digital assistant), the mobile electronic devices such as tablet computer.
Terminal refers to other terminals being attached with mobile terminal, can be mobile terminal, such as mobile phone, or PC etc., the embodiments of the present invention are not limited thereto.
When mobile terminal and other terminals carry out file-sharing, file data can be carried out by network and shared, it can also To carry out the shared of file data by USB, specifically, can according to the actual situation depending on, this is not added in the embodiment of the present invention With limitation.
Virtual disk partition can be obtained with analog physical disk partition, i.e. simulation in mobile terminal side, and in mobile terminal After being connect with other terminals by network or USB, virtual disk partition is shared to other terminals, other terminals can basis The file in disk partition is checked in virtual disk partition, and execute read-write etc. operation, specifically, will in following embodiments two into Row detailed description.
When other terminals need to execute read or write to the file on virtual disk partition, can be sent out to mobile terminal Rise file read/write request, file read/write request in include continue/written document locating for target virtual disk subregion, namely Some subregion in virtual disk partition, for example, the virtual disk partition shown on terminal A includes subregion 1, subregion 2 and divides Area 3, when executing the read operation of some file on to subregion 3, then subregion 3 is target disk subregion.
It can also include continue/virtual logical address namely target virtual disk of written document in file read/write request Logical address on subregion, can clearly be continued by virtual logical address/initial position of written document and read/write length etc. Deng so as to corresponding with the physical disk subregion of mobile terminal, to execute corresponding read/write behaviour on physical disk subregion Make.
After obtaining the file read/write request that terminal is sent, step 102 is executed.
Step 102: according to the mapping relations of virtual disk partition and physical disk subregion, the determining and destination virtual magnetic The corresponding target physical disk partition of disk subregion.
The mapping relations of virtual disk partition Yu physical disk subregion, example are previously stored in the system of mobile terminal Such as, physical disk subregion includes subregion a, subregion b and subregion c, and virtual disk partition includes subregion 1, subregion 2 and subregion 3, subregion A is corresponding with subregion 2, and subregion b is corresponding with subregion 1, and the domain subregion c subregion 3 is corresponding.
Above-mentioned mapping relations can be saved in the form of list in mobile terminal system, as described in Table 1:
Table 1:
Physical disk subregion Virtual disk partition
a 2
b 1
c 3
As shown in Table 1 above, there are mapping relations, physical extent b is deposited with virtual partition 1 for physical extent a and virtual partition 2 In mapping relations, there are mapping relations with virtual partition 3 by physical extent c.
It is to be appreciated that above-mentioned example is merely to more fully understand the technical solution of the embodiment of the present invention and showing for enumerating Example, not as the sole limitation to the embodiment of the present invention.
Certainly, database can also be created for above-mentioned mapping relations in mobile terminal system, is protected in the form of database Deposit above-mentioned mapping relations, specifically, can according to the actual situation depending on, the embodiments of the present invention are not limited thereto.
Obtain continue/written document locating for after target virtual disk subregion, can be according to virtual disk partition and object The mapping relations for managing disk partition, determine target physical disk partition corresponding with target virtual disk subregion, and execute step Rapid 103.
Step 103: continue according to described in/virtual logical address of written document and file read/write request, in the mesh It marks physical disk subregion and executes corresponding file read/write operation.
The corresponding relationship that virtual logical address Yu physical logic address are also preserved in mobile terminal system, according to text Part read/write requests obtain/virtual logical address (/ written document institute on target virtual disk subregion of continuing of written document of continuing The address at place) after, it can be matched to obtain physical logic address according to virtual logical address, i.e., in target physical disk partition Physical logic address, and then can be determined and/corresponding target physical the disk partition of written document of continuing according to physical logic address On file destination locating for physical logic address namely the initial position of file destination.
File read/write request can also include reading or the write operation to file destination, such as read in file destination The data of designated length, or data of write-in designated length etc. operation since some byte of file destination, specifically, can Depending on according to the actual situation, the embodiments of the present invention are not limited thereto.
The embodiment of the present invention is by sharing the virtual disk partition of simulation to terminal, so as to realize that shared both ends can It to access the purpose of file simultaneously, avoids when carrying out file-sharing, the problem of both ends cannot access file simultaneously.
Disk file reading/writing method provided in an embodiment of the present invention is requested by obtaining the file read/write that terminal is sent, In, file read/write request include continue/written document locating for target virtual disk subregion and continue the/virtual logical of written document Address determines mesh corresponding with target virtual disk subregion according to the mapping relations of virtual disk partition and physical disk subregion Physical disk subregion is marked, according to/virtual logical address of written document and the file read/write request of continuing, in target physical disk point Area executes corresponding file read/write operation.The embodiment of the present invention by sharing the virtual disk partition of simulation to terminal, thus Shared both ends may be implemented can access the purpose of file simultaneously.
Embodiment two
Referring to Fig. 2, a kind of step flow chart of disk file reading/writing method provided in an embodiment of the present invention, the magnetic are shown Disk file read/write method can be applied to mobile terminal, can specifically include following steps:
Step 201: obtaining all files on physical disk subregion.
In embodiments of the present invention, mobile terminal can for mobile phone, PDA (PersonalDigital Assistant, it is a Personal digital assistant), the mobile electronic devices such as tablet computer.
The embodiment of the present invention can be first to each physical disk subregion of mobile terminal (i.e. all physical disks of mobile terminal point Area) it is simulated, virtual disk partition is obtained with simulation, the embodiments of the present invention are not limited thereto.
It is complete on available each physical disk subregion when all physics disk partition to mobile terminal are simulated Portion's file, and execute step 202.
Step 202: obtaining each corresponding file size of file and each file on the physical disk subregion Physical logic address.
After obtaining all files on physical disk subregion, the file size of available each file, as file is big Small is 8kb, 10kb etc..
Physical logic address of each file on physical disk subregion can also be obtained, i.e., each file is in corresponding physics magnetic Initial position and file data length on disk subregion etc..
Obtain physical logic address on physical disk subregion of each corresponding file size of file and each file it Afterwards, step 203 is executed.
Step 203: according to each file size, generating the identical virtual file of corresponding with each file size.
It, can be raw according to the file size of each file on obtaining physical disk subregion after the file size of All Files At the identical virtual file of size corresponding with each file, for example, the size of a file on a certain physical disk subregion is 10kb then generates the virtual file of a 10kb size.
It is to be appreciated that above-mentioned example is merely to more fully understand the technical solution of the embodiment of the present invention and showing for enumerating Example, not as the sole limitation to the embodiment of the present invention.
After according to each file size, generating the identical virtual file of corresponding with each file size, execution step 204。
Step 204: establishing and save between each virtual file, each file and each physical logic address Incidence relation.
After generating virtual file corresponding with each file, it can establish each virtual file, each file and each physics and patrol The incidence relation between address is collected, for example, virtual file includes a and b, file includes A and B, and physical logic address includes 1 and 2, Wherein, there are incidence relation, file B, virtual file a and physical logics between file A, virtual file b and physical logic address 1 There are incidence relations between address 2, i.e., when obtaining virtual file b, can be determined according to incidence relation corresponding file A and Physical logic address 1.
Above-mentioned incidence relation can be saved in the form of a list in mobile terminal system, as described in Table 2:
Table 2:
File Virtual file Physical logic address
A b 1
B a 2
It is closed according to content shown in above-mentioned table 2 it is found that there is association between file A, virtual file b and physical logic address 1 System, there are incidence relations between file B, virtual file a and physical logic address 2.
Certainly, corresponding incidence relation database can also be created in mobile terminal system, closed with saving above-mentioned association System, specifically, can according to the actual situation depending on, the embodiments of the present invention are not limited thereto.
It is to be appreciated that above-mentioned example is merely to more fully understand the technical solution of the embodiment of the present invention and showing for enumerating Example, not as the sole limitation to the embodiment of the present invention.
After establishing and saving the incidence relation between each virtual file, each file and each physical logic address, execute Step 205.
Step 205: according to each virtual file, establishing virtual disk partition corresponding with the physical disk subregion.
It, can be with after establishing and saving the incidence relation between each virtual file, each file and each physical logic address According to each virtual file, virtual disk partition corresponding with physical disk subregion is established, each virtual file is filled in virtually Disk partition, so that virtual disk partition corresponding with physical disk subregion is formed, to realize the simulation to physical disk subregion, And execute step 206.
Step 206: the virtual disk partition is shared by specified protocol to the terminal.
In embodiments of the present invention, terminal refers to other terminals being attached with mobile terminal, can be mobile terminal, Such as mobile phone, or PC etc., the embodiments of the present invention are not limited thereto.
Connection is established by network or USB in other terminals and mobile terminal, virtual disk partition can be passed through specified Agreement is shared to terminal, for example, can pass through USB massive store when other terminals are connected with mobile terminal by USB Agreement shares to other terminals etc..
When using different connection types, the shared of virtual disk partition can be carried out using different agreements, specifically Ground, can according to the actual situation depending on, the embodiments of the present invention are not limited thereto.
Virtual disk partition is being shared by specified protocol to terminal, step 207 is executed.
Step 207: obtaining the file read/write request that terminal is sent;Wherein, the file read/write request includes continuing/writing Target virtual disk subregion locating for file and the/virtual logical address of written document that continues.
In embodiments of the present invention, continue/written document refers to virtual file on target virtual disk subregion.
Terminal refers to other terminals being attached with mobile terminal, can be mobile terminal, such as mobile phone, or PC etc., the embodiments of the present invention are not limited thereto.
When mobile terminal and other terminals carry out file-sharing, file data can be carried out by network and shared, it can also To carry out the shared of file data by USB, specifically, can according to the actual situation depending on, this is not added in the embodiment of the present invention With limitation.
Virtual disk partition can be obtained with analog physical disk partition, i.e. simulation in mobile terminal side, and in mobile terminal After being connect with other terminals by network or USB, virtual disk partition is shared to other terminals, other terminals can basis The file in disk partition is checked in virtual disk partition, and execute read-write etc. operation.
When other terminals need to execute read or write to the file on virtual disk partition, can be sent out to mobile terminal Rise file read/write request, file read/write request in include continue/written document locating for target virtual disk subregion, namely Some subregion in virtual disk partition, for example, the virtual disk partition shown on terminal A includes subregion 1, subregion 2 and divides Area 3, when executing the read operation of some file on to subregion 3, then subregion 3 is target disk subregion.
It can also include continue/virtual logical address namely target virtual disk of written document in file read/write request Logical address on subregion, can clearly be continued by virtual logical address/initial position of written document and read/write length etc. Deng so as to corresponding with the physical disk subregion of mobile terminal, to execute corresponding read/write behaviour on physical disk subregion Make.
After obtaining the file read/write request that terminal is sent, step 208 is executed.
Step 208: according to the mapping relations of virtual disk partition and physical disk subregion, the determining and destination virtual magnetic The corresponding target physical disk partition of disk subregion.
The mapping relations of virtual disk partition Yu physical disk subregion, example are previously stored in the system of mobile terminal Such as, physical disk subregion includes subregion a, subregion b and subregion c, and virtual disk partition includes subregion 1, subregion 2 and subregion 3, subregion A is corresponding with subregion 2, and subregion b is corresponding with subregion 1, and the domain subregion c subregion 3 is corresponding.
Obtain continue/written document locating for after target virtual disk subregion, can be according to virtual disk partition and object The mapping relations for managing disk partition, determine target physical disk partition corresponding with target virtual disk subregion, and execute step Rapid 209.
Step 209: determining and described to read/write according to the target physical disk partition and the virtual logical address The corresponding second practical read/write file of file.
In embodiments of the present invention, the second practical read/write file refers to the file in target physical disk partition.
It, can according to virtual logical after determining target physical disk partition corresponding with target virtual disk subregion Location determine with/corresponding second practical read/write the file of written document that continues, specifically, can according to above-mentioned incidence relation, and to Virtual logical address of the read/write file on target virtual disk subregion, so that it is determined that the second practical read/write file, Yi Ji Physical logic address of the two practical read/write files in target physical disk partition, and then execute step 210.
Step 210: in the case where file read/write request meets default authentication condition, according to described to read/write text The virtual logical address of part and file read/write request execute corresponding file read/write in the target physical disk partition Operation.
Default authentication condition may include any of read-only condition, write condition and readable write condition, for example, in file When A only includes read-only condition, indicate that the operation read may only be executed to file A;When file B only includes write condition, indicate Write operation may only be executed to file B;When file C includes readable write operation, expression can execute read-write operation to file C Etc..
It is to be appreciated that above-mentioned example is merely to more fully understand the technical solution of the embodiment of the present invention and showing for enumerating Example, not as the sole limitation to the embodiment of the present invention.
The embodiment of the present invention is by adding default authentication condition in advance for each file, so as to carry out file-sharing When, it prevents the file in mobile terminal to be modified, ensure that the safety of the file in mobile terminal.
Default authentication condition corresponding with the file of physical disk subregion is pre-saved in the system of mobile terminal, It, can be with the default authentication condition of matched and searched and the second practical read/write file after obtaining the second practical read/write file.
It is read-only condition that the case where file read/write request meets default authentication condition, which includes: in default authentication condition, and literary Part read/write requests are when reading the request of file data, then it represents that file read/write request meets default authentication condition;Or pre- If authentication condition is a write condition, and when request of the file read/write request for data are written hereof, then it represents that file reading/ Write request meets default authentication condition;It or in default authentication condition is readable write condition, and file read/write request is hereof When the request of data is written or reading the request of file data, then it represents that file read/write request meets default authentication condition.
It is to be appreciated that above scheme description is the detailed of the technical solution progress of embodiment for a better understanding of the present invention Thin description, not as the sole limitation to the embodiment of the present invention.
In the case where file read/write request meets default authentication condition, then can according to continue/written document virtually patrols Address and file read/write request are collected, corresponding file read/write operation is executed in target physical disk partition, to realize movement File-sharing on the physical disk subregion of terminal.
In a preferred embodiment of an embodiment of the present invention, the file read/write request further includes data read/write length With data read/write offset amount, above-mentioned steps 210 may include:
Sub-step A1: according to the virtual logical address and the incidence relation, the target physical disk partition is determined On target physical logical address;
Sub-step A2: according to the target physical logical address, determine in the target physical disk partition with it is described to The corresponding first practical read/write file of read/write file;
Sub-step A3: according to the data read/write length and the data read/write offset, actually read described first/ Written document executes data read/write operation.
In embodiments of the present invention, file read/write request further includes data read/write length and data read/write offset amount, number Refer to according to read/write length and read data from file or the length of data is written, data read/write offset refers to be read from file The initial position of access evidence or write-in data.
First border read/write file refers to the file in target physical disk partition.
After obtaining virtual logical address and above-mentioned incidence relation, it can be closed according to virtual logical address and above-mentioned association System determines the target physical logical address in target physical disk partition, and then can be determined according to target physical logical address In the target physical disk partition with the/corresponding first practical read/write file of written document that continues.
And then according to data read/write length and data read/write offset amount, to the first practical read/write file execute data reading/ Write operation.
Disk file reading/writing method provided in an embodiment of the present invention, except with the read-write of disk file shown in embodiment one Outside beneficial effect possessed by method, file authentication can also be carried out, before executing read-write operation so as to prevent from moving File in terminal is modified, and ensure that the safety of the file in mobile terminal.
Embodiment three
Referring to Fig. 3, a kind of structural schematic diagram of disk file read-write equipment provided in an embodiment of the present invention, the magnetic are shown Disk file read-write device can be applied to mobile terminal, can specifically include:
Read-write requests obtain module 301, for obtaining the file read/write request of terminal transmission;Wherein, the file read/ Write request include continue/written document locating for target virtual disk subregion and the/virtual logical address of written document that continues;Object Subregion determining module 302 is managed, for the mapping relations according to virtual disk partition and physical disk subregion, the determining and target The corresponding target physical disk partition in virtual disk partition;Read-write operation execution module 303, for according to described literary to read/write The virtual logical address of part and file read/write request execute corresponding file read/write in the target physical disk partition Operation.
Disk file read-write equipment provided in an embodiment of the present invention is requested by obtaining the file read/write that terminal is sent, In, file read/write request include continue/written document locating for target virtual disk subregion and continue the/virtual logical of written document Address determines mesh corresponding with target virtual disk subregion according to the mapping relations of virtual disk partition and physical disk subregion Physical disk subregion is marked, according to/virtual logical address of written document and the file read/write request of continuing, in target physical disk point Area executes corresponding file read/write operation.The embodiment of the present invention by sharing the virtual disk partition of simulation to terminal, thus Shared both ends may be implemented can access the purpose of file simultaneously.
Example IV
Referring to Fig. 4, a kind of structural schematic diagram of disk file read-write equipment provided in an embodiment of the present invention, the magnetic are shown Disk file read-write device can be applied to mobile terminal, can specifically include:
File acquisition module 401, for obtaining all files on physical disk subregion;File size physical address obtains Module 402, for obtaining the object of the corresponding file size of each file and each file on the physical disk subregion Manage logical address;Virtual file generation module 403, for generating corresponding with each file according to each file size The identical virtual file of size;Incidence relation establishes module 404, for establishing and saving each virtual file, each text Incidence relation between part and each physical logic address;Module 405 is established in virtual disk partition, for according to each void Quasi- file, establishes virtual disk partition corresponding with the physical disk subregion;Virtual disk partition sharing module 406, is used for The virtual disk partition is shared by specified protocol to the terminal;Read-write requests obtain module 407, for obtaining terminal The file read/write of transmission is requested;Wherein, file read/write request include continue/written document locating for target virtual disk point Area and the/virtual logical address of written document that continues;Physical extent determining module 408, for according to virtual disk partition with The mapping relations of physical disk subregion determine target physical disk partition corresponding with the target virtual disk subregion;Second Reading and writing of files determining module 409, for according to the target physical disk partition and the virtual logical address, it is determining with it is described Continue/corresponding second practical read/write the file of written document;Successfully module 410 are authenticated, for full in file read/write request In the case where the default authentication condition of foot, the read-write operation execution module 411 is executed;Read-write operation execution module 411, for according to According to continue/virtual logical address of written document and the file read/write request, executed in the target physical disk partition Corresponding file read/write operation.
Preferably, the file read/write request further includes data read/write length and data read/write offset amount, the read-write Operation executing module 411 includes: that target physical address determines submodule, for according to the virtual logical address and the association Relationship determines the target physical logical address in the target physical disk partition;First reading and writing of files determines submodule, is used for According to the target physical logical address, determine in the target physical disk partition with the/written document corresponding that continues One practical read/write file;Read-write operation implementation sub-module, for inclined according to the data read/write length and the data read/write Shifting amount executes data read/write operation to the described first practical read/write file.
Preferably, the default authentication condition includes any one of read-only condition, write condition and readable write condition.
Disk file read-write equipment provided in an embodiment of the present invention, except with the read-write of disk file shown in embodiment three Outside beneficial effect possessed by device, file authentication can also be carried out, before executing read-write operation so as to prevent from moving File in terminal is modified, and ensure that the safety of file.
Embodiment five
Referring to Fig. 5, the hardware structural diagram of a kind of mobile terminal of each embodiment to realize the present invention.
The mobile terminal 500 includes but is not limited to: radio frequency unit 501, network module 502, audio output unit 503, defeated Enter unit 504, sensor 505, display unit 506, user input unit 507, interface unit 508, memory 509, processor The components such as 510 and power supply 511.It will be understood by those skilled in the art that mobile terminal structure shown in Fig. 5 is not constituted Restriction to mobile terminal, mobile terminal may include than illustrating more or fewer components, perhaps combine certain components or Different component layouts.In embodiments of the present invention, mobile terminal include but is not limited to mobile phone, tablet computer, laptop, Palm PC, car-mounted terminal, wearable device and pedometer etc..
Processor 510, for obtaining the file read/write request of terminal transmission;Wherein, file read/write request includes Continue/written document locating for target virtual disk subregion and the/virtual logical address of written document that continues;According to virtual disk The mapping relations of subregion and physical disk subregion determine target physical disk point corresponding with the target virtual disk subregion Area;It continues according to described in/virtual logical address of written document and file read/write request, in the target physical disk point Area executes corresponding file read/write operation.
In embodiments of the present invention, it is requested by obtaining the file read/write that terminal is sent, wherein file read/write request packet Include continue/written document locating for target virtual disk subregion and continue the/virtual logical address of written document, according to virtual disk point The mapping relations in area and physical disk subregion determine target physical disk partition corresponding with target virtual disk subregion, foundation Continue/virtual logical address of written document and file read/write request, target physical disk partition execute corresponding file read/ Write operation.The embodiment of the present invention is by sharing the virtual disk partition of simulation to terminal, so as to realize that shared both ends can To access the purpose of file simultaneously.
It should be understood that the embodiment of the present invention in, radio frequency unit 501 can be used for receiving and sending messages or communication process in, signal Send and receive, specifically, by from base station downlink data receive after, to processor 510 handle;In addition, by uplink Data are sent to base station.In general, radio frequency unit 501 includes but is not limited to antenna, at least one amplifier, transceiver, coupling Device, low-noise amplifier, duplexer etc..In addition, radio frequency unit 501 can also by wireless communication system and network and other set Standby communication.
Mobile terminal provides wireless broadband internet by network module 502 for user and accesses, and such as user is helped to receive It sends e-mails, browse webpage and access streaming video etc..
Audio output unit 503 can be received by radio frequency unit 501 or network module 502 or in memory 509 The audio data of storage is converted into audio signal and exports to be sound.Moreover, audio output unit 503 can also be provided and be moved The relevant audio output of specific function that dynamic terminal 500 executes is (for example, call signal receives sound, message sink sound etc. Deng).Audio output unit 503 includes loudspeaker, buzzer and receiver etc..
Input unit 504 is for receiving audio or video signal.Input unit 504 may include graphics processor (Graphics Processing Unit, GPU) 5041 and microphone 5042, graphics processor 5041 is in video acquisition mode Or the image data of the static images or video obtained in image capture mode by image capture apparatus (such as camera) carries out Reason.Treated, and picture frame may be displayed on display unit 506.Through graphics processor 5041, treated that picture frame can be deposited Storage is sent in memory 509 (or other storage mediums) or via radio frequency unit 501 or network module 502.Mike Wind 5042 can receive sound, and can be audio data by such acoustic processing.Treated audio data can be The format output that mobile communication base station can be sent to via radio frequency unit 501 is converted in the case where telephone calling model.
Mobile terminal 500 further includes at least one sensor 505, such as optical sensor, motion sensor and other biographies Sensor.Specifically, optical sensor includes ambient light sensor and proximity sensor, wherein ambient light sensor can be according to environment The light and shade of light adjusts the brightness of display panel 5061, and proximity sensor can close when mobile terminal 500 is moved in one's ear Display panel 5061 and/or backlight.As a kind of motion sensor, accelerometer sensor can detect in all directions (general For three axis) size of acceleration, it can detect that size and the direction of gravity when static, can be used to identify mobile terminal posture (ratio Such as horizontal/vertical screen switching, dependent game, magnetometer pose calibrating), Vibration identification correlation function (such as pedometer, tap);It passes Sensor 505 can also include fingerprint sensor, pressure sensor, iris sensor, molecule sensor, gyroscope, barometer, wet Meter, thermometer, infrared sensor etc. are spent, details are not described herein.
Display unit 506 is for showing information input by user or being supplied to the information of user.Display unit 506 can wrap Display panel 5061 is included, liquid crystal display (Liquid Crystal Display, LCD), Organic Light Emitting Diode can be used Forms such as (Organic Light-Emitting Diode, OLED) configure display panel 5061.
User input unit 507 can be used for receiving the number or character information of input, and generate the use with mobile terminal Family setting and the related key signals input of function control.Specifically, user input unit 507 include touch panel 5071 and Other input equipments 5072.Touch panel 5071, also referred to as touch screen collect the touch operation of user on it or nearby (for example user uses any suitable objects or attachment such as finger, stylus on touch panel 5071 or in touch panel 5071 Neighbouring operation).Touch panel 5071 may include both touch detecting apparatus and touch controller.Wherein, touch detection Device detects the touch orientation of user, and detects touch operation bring signal, transmits a signal to touch controller;Touch control Device processed receives touch information from touch detecting apparatus, and is converted into contact coordinate, then gives processor 510, receiving area It manages the order that device 510 is sent and is executed.Furthermore, it is possible to more using resistance-type, condenser type, infrared ray and surface acoustic wave etc. Seed type realizes touch panel 5071.In addition to touch panel 5071, user input unit 507 can also include other input equipments 5072.Specifically, other input equipments 5072 can include but is not limited to physical keyboard, function key (such as volume control button, Switch key etc.), trace ball, mouse, operating stick, details are not described herein.
Further, touch panel 5071 can be covered on display panel 5061, when touch panel 5071 is detected at it On or near touch operation after, send processor 510 to determine the type of touch event, be followed by subsequent processing device 510 according to touching The type for touching event provides corresponding visual output on display panel 5061.Although in Fig. 5, touch panel 5071 and display Panel 5061 is the function that outputs and inputs of realizing mobile terminal as two independent components, but in some embodiments In, can be integrated by touch panel 5071 and display panel 5061 and realize the function that outputs and inputs of mobile terminal, it is specific this Place is without limitation.
Interface unit 508 is the interface that external device (ED) is connect with mobile terminal 500.For example, external device (ED) may include having Line or wireless head-band earphone port, external power supply (or battery charger) port, wired or wireless data port, storage card end Mouth, port, the port audio input/output (I/O), video i/o port, earphone end for connecting the device with identification module Mouthful etc..Interface unit 508 can be used for receiving the input (for example, data information, electric power etc.) from external device (ED) and By one or more elements that the input received is transferred in mobile terminal 500 or can be used in 500 He of mobile terminal Data are transmitted between external device (ED).
Memory 509 can be used for storing software program and various data.Memory 509 can mainly include storing program area The storage data area and, wherein storing program area can (such as the sound of application program needed for storage program area, at least one function Sound playing function, image player function etc.) etc.;Storage data area can store according to mobile phone use created data (such as Audio data, phone directory etc.) etc..In addition, memory 509 may include high-speed random access memory, it can also include non-easy The property lost memory, a for example, at least disk memory, flush memory device or other volatile solid-state parts.
Processor 510 is the control centre of mobile terminal, utilizes each of various interfaces and the entire mobile terminal of connection A part by running or execute the software program and/or module that are stored in memory 509, and calls and is stored in storage Data in device 509 execute the various functions and processing data of mobile terminal, to carry out integral monitoring to mobile terminal.Place Managing device 510 may include one or more processing units;Preferably, processor 510 can integrate application processor and modulatedemodulate is mediated Manage device, wherein the main processing operation system of application processor, user interface and application program etc., modem processor is main Processing wireless communication.It is understood that above-mentioned modem processor can not also be integrated into processor 510.
Mobile terminal 500 can also include the power supply 511 (such as battery) powered to all parts, it is preferred that power supply 511 Can be logically contiguous by power-supply management system and processor 510, to realize management charging by power-supply management system, put The functions such as electricity and power managed.
In addition, mobile terminal 500 includes some unshowned functional modules, details are not described herein.
Preferably, the embodiment of the present invention also provides a kind of mobile terminal, including processor 510, and memory 509 is stored in On memory 509 and the computer program that can run on the processor 510, the computer program are executed by processor 510 Each process of the above-mentioned disk file reading/writing method embodiment of Shi Shixian, and identical technical effect can be reached, to avoid repeating, Which is not described herein again.
The embodiment of the present invention also provides a kind of computer readable storage medium, and meter is stored on computer readable storage medium Calculation machine program, the computer program realize each process of above-mentioned disk file reading/writing method embodiment when being executed by processor, And identical technical effect can be reached, to avoid repeating, which is not described herein again.Wherein, the computer readable storage medium, Such as read-only memory (Read-Only Memory, abbreviation ROM), random access memory (Random Access Memory, letter Claim RAM), magnetic or disk etc..
It should be noted that, in this document, the terms "include", "comprise" or its any other variant are intended to non-row His property includes, so that the process, method, article or the device that include a series of elements not only include those elements, and And further include other elements that are not explicitly listed, or further include for this process, method, article or device institute it is intrinsic Element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that including being somebody's turn to do There is also other identical elements in the process, method of element, article or device.
Through the above description of the embodiments, those skilled in the art can be understood that above-described embodiment side Method can be realized by means of software and necessary general hardware platform, naturally it is also possible to by hardware, but in many cases The former is more preferably embodiment.Based on this understanding, technical solution of the present invention substantially in other words does the prior art The part contributed out can be embodied in the form of software products, which is stored in a storage medium In (such as ROM/RAM, magnetic disk, CD), including some instructions are used so that a terminal (can be mobile phone, computer, service Device, air conditioner or network equipment etc.) execute method described in each embodiment of the present invention.
The embodiment of the present invention is described with above attached drawing, but the invention is not limited to above-mentioned specific Embodiment, the above mentioned embodiment is only schematical, rather than restrictive, those skilled in the art Under the inspiration of the present invention, without breaking away from the scope protected by the purposes and claims of the present invention, it can also make very much Form belongs within protection of the invention.

Claims (12)

1. a kind of disk file reading/writing method is applied to mobile terminal characterized by comprising
Obtain the file read/write request that terminal is sent;Wherein, file read/write request include continue/written document locating for mesh Mark virtual disk partition and the/virtual logical address of written document that continues;
According to the mapping relations of virtual disk partition and physical disk subregion, determination is corresponding with the target virtual disk subregion Target physical disk partition;
It continues according to described in/virtual logical address of written document and file read/write request, in the target physical disk point Area executes corresponding file read/write operation.
2. the method according to claim 1, wherein obtaining what the file read/write that terminal is sent was requested described Before step, further includes:
Obtain all files on physical disk subregion;
With obtaining the physical logic of the corresponding file size of each file and each file on the physical disk subregion Location;
According to each file size, the identical virtual file of corresponding with each file size is generated;
Establish and save the incidence relation between each virtual file, each file and each physical logic address;
According to each virtual file, virtual disk partition corresponding with the physical disk subregion is established;
The virtual disk partition is shared by specified protocol to the terminal.
3. according to the method described in claim 2, it is characterized in that, file read/write request further includes data read/write length With data read/write offset amount, continue described in the foundation/virtual logical address of written document and file read/write request, The target physical disk partition executes the step of corresponding file read/write operation, comprising:
According to the virtual logical address and the incidence relation, determine that the target physical in the target physical disk partition is patrolled Collect address;
According to the target physical logical address, determine in the target physical disk partition with it is described continue/written document is corresponding The first practical read/write file;
According to the data read/write length and the data read/write offset, number is executed to the described first practical read/write file According to read/write operation.
4. the method according to claim 1, wherein continue described in the foundation/virtual logical of written document Address and the file read/write request, the target physical disk partition execute corresponding file read/write operation the step of it Before, further includes:
It is determining with the/written document corresponding that continues according to the target physical disk partition and the virtual logical address Two practical read/write files;
In the case where file read/write request meets default authentication condition ,/the written document that continues described in the foundation is executed Virtual logical address and file read/write request execute corresponding file read/write operation in the target physical disk partition The step of.
5. according to the method described in claim 4, it is characterized in that, the default authentication condition includes read-only condition, only writes item Any one of part and readable write condition.
6. a kind of disk file read-write equipment is applied to mobile terminal characterized by comprising
Read-write requests obtain module, for obtaining the file read/write request of terminal transmission;Wherein, the file read/write request packet Include continue/written document locating for target virtual disk subregion and the/virtual logical address of written document that continues;
Physical extent determining module, for according to virtual disk partition and physical disk subregion mapping relations, determine with it is described The corresponding target physical disk partition of target virtual disk subregion;
Read-write operation execution module, for continue according to described in/virtual logical address of written document and the file read/write ask It asks, executes corresponding file read/write operation in the target physical disk partition.
7. device according to claim 6, which is characterized in that further include:
File acquisition module, for obtaining all files on physical disk subregion;
File size physical address obtains module, exists for obtaining the corresponding file size of each file and each file Physical logic address on the physical disk subregion;
Virtual file generation module, it is identical for according to each file size, generating size corresponding with each file Virtual file;
Incidence relation establishes module, for establishing and saving each virtual file, each file and each physical logic Incidence relation between address;
Module is established in virtual disk partition, for establishing corresponding with the physical disk subregion according to each virtual file Virtual disk partition;
Virtual disk partition sharing module, for being shared the virtual disk partition by specified protocol to the terminal.
8. device according to claim 6, which is characterized in that the file read/write request further includes data read/write length With data read/write offset amount, the read-write operation execution module includes:
Target physical address determines submodule, for determining the mesh according to the virtual logical address and the incidence relation Mark the target physical logical address on physical disk subregion;
First reading and writing of files determines submodule, for determining the target physical disk according to the target physical logical address On subregion with the/corresponding first practical read/write file of written document that continues;
Read-write operation implementation sub-module is used for according to the data read/write length and the data read/write offset, to described First practical read/write file executes data read/write operation.
9. device according to claim 6, which is characterized in that further include:
Second reading and writing of files determining module, for determining according to the target physical disk partition and the virtual logical address With/corresponding second practical read/write the file of written document that continues;
Successfully module is authenticated, for executing the read-write in the case where file read/write request meets default authentication condition Operation executing module.
10. device according to claim 9, which is characterized in that the default authentication condition includes read-only condition, only writes item Any one of part and readable write condition.
11. a kind of mobile terminal, which is characterized in that including processor, memory and be stored on the memory and can be in institute The computer program run on processor is stated, such as claim 1 to 5 is realized when the computer program is executed by the processor Any one of described in disk file reading/writing method the step of.
12. a kind of computer readable storage medium, which is characterized in that store computer journey on the computer readable storage medium Sequence realizes the disk file read-write side as described in any one of claims 1 to 5 when the computer program is executed by processor The step of method.
CN201910100744.3A 2019-01-31 2019-01-31 Disk file reading and writing method and device Active CN109885257B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910100744.3A CN109885257B (en) 2019-01-31 2019-01-31 Disk file reading and writing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910100744.3A CN109885257B (en) 2019-01-31 2019-01-31 Disk file reading and writing method and device

Publications (2)

Publication Number Publication Date
CN109885257A true CN109885257A (en) 2019-06-14
CN109885257B CN109885257B (en) 2023-01-03

Family

ID=66927560

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910100744.3A Active CN109885257B (en) 2019-01-31 2019-01-31 Disk file reading and writing method and device

Country Status (1)

Country Link
CN (1) CN109885257B (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112000589A (en) * 2020-07-13 2020-11-27 北京奇艺世纪科技有限公司 Data writing method, data reading device and electronic equipment
CN112241394A (en) * 2020-10-15 2021-01-19 浪潮商用机器有限公司 Index node IO statistical method, tool, equipment and storage medium
CN113434470A (en) * 2021-06-24 2021-09-24 华云数据控股集团有限公司 Data distribution method and device and electronic equipment
CN114238232A (en) * 2021-12-15 2022-03-25 南方电网电力科技股份有限公司 Intelligent ammeter file reading and writing system, method, equipment and medium
CN115858407A (en) * 2023-02-16 2023-03-28 浪潮电子信息产业股份有限公司 Data storage method, device, equipment, readable storage medium and server
CN117076337A (en) * 2023-10-17 2023-11-17 北京开源芯片研究院 Data transmission method and device, electronic equipment and readable storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6948044B1 (en) * 2002-07-30 2005-09-20 Cisco Systems, Inc. Methods and apparatus for storage virtualization
CN102622352A (en) * 2011-01-26 2012-08-01 深圳市闪联信息技术有限公司 Method, server and system for achieving shared file
CN106598496A (en) * 2016-12-08 2017-04-26 蓝信工场(北京)科技有限公司 Method and device for constructing virtual magnetic disk and processing data

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6948044B1 (en) * 2002-07-30 2005-09-20 Cisco Systems, Inc. Methods and apparatus for storage virtualization
CN102622352A (en) * 2011-01-26 2012-08-01 深圳市闪联信息技术有限公司 Method, server and system for achieving shared file
CN106598496A (en) * 2016-12-08 2017-04-26 蓝信工场(北京)科技有限公司 Method and device for constructing virtual magnetic disk and processing data

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112000589A (en) * 2020-07-13 2020-11-27 北京奇艺世纪科技有限公司 Data writing method, data reading device and electronic equipment
CN112241394A (en) * 2020-10-15 2021-01-19 浪潮商用机器有限公司 Index node IO statistical method, tool, equipment and storage medium
CN112241394B (en) * 2020-10-15 2022-08-02 浪潮商用机器有限公司 Index node IO statistical method, tool, equipment and storage medium
CN113434470A (en) * 2021-06-24 2021-09-24 华云数据控股集团有限公司 Data distribution method and device and electronic equipment
CN113434470B (en) * 2021-06-24 2024-03-19 华云数据控股集团有限公司 Data distribution method and device and electronic equipment
CN114238232A (en) * 2021-12-15 2022-03-25 南方电网电力科技股份有限公司 Intelligent ammeter file reading and writing system, method, equipment and medium
CN114238232B (en) * 2021-12-15 2024-04-02 南方电网电力科技股份有限公司 Intelligent ammeter file reading and writing system, method, equipment and medium
CN115858407A (en) * 2023-02-16 2023-03-28 浪潮电子信息产业股份有限公司 Data storage method, device, equipment, readable storage medium and server
CN117076337A (en) * 2023-10-17 2023-11-17 北京开源芯片研究院 Data transmission method and device, electronic equipment and readable storage medium
CN117076337B (en) * 2023-10-17 2024-02-02 北京开源芯片研究院 Data transmission method and device, electronic equipment and readable storage medium

Also Published As

Publication number Publication date
CN109885257B (en) 2023-01-03

Similar Documents

Publication Publication Date Title
CN109885257A (en) A kind of disk file reading/writing method and device
CN108491123A (en) A kind of adjusting application program image target method and mobile terminal
CN108628521A (en) A kind of screen operating method and mobile terminal
CN109257336A (en) It is a kind of based on the encrypted message processing method of block chain, terminal device
CN109116965A (en) A kind of electricity saving method and mobile terminal
CN108391123A (en) A kind of method and terminal generating video
CN108196815A (en) A kind of adjusting method and mobile terminal of sound of conversing
CN110162254A (en) A kind of display methods and terminal device
CN106445340A (en) Method and device for displaying stereoscopic image by double-screen terminal
CN110046013A (en) A kind of interface display method and terminal device
CN109639887A (en) A kind of control method and terminal device
CN109144723A (en) A kind of method and terminal for distributing memory space
CN109491670A (en) A kind of page display method and terminal device
CN108536349A (en) A kind of icon management method and mobile terminal
CN108170559A (en) A kind of data back up method and terminal
CN110096203A (en) A kind of screenshot method and mobile terminal
CN110213438A (en) A kind of processing method and terminal device of application program
CN107992378B (en) A kind of document handling method and mobile terminal
CN110191426A (en) A kind of method and terminal of information sharing
CN110162234A (en) A kind of application control method and terminal device
CN109745699A (en) A kind of method and terminal device responding touch control operation
CN109783722A (en) A kind of content outputting method and terminal device
CN109521937A (en) A kind of control method for screen display and mobile terminal
CN109032699A (en) A kind of method and terminal for modifying application environment variable
CN109117037A (en) A kind of method and terminal device of image procossing

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant