CN112035071B - Disk data reading method, device, computer equipment and storage medium - Google Patents

Disk data reading method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN112035071B
CN112035071B CN202011033803.9A CN202011033803A CN112035071B CN 112035071 B CN112035071 B CN 112035071B CN 202011033803 A CN202011033803 A CN 202011033803A CN 112035071 B CN112035071 B CN 112035071B
Authority
CN
China
Prior art keywords
disk
kernel
user space
space
successful
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.)
Active
Application number
CN202011033803.9A
Other languages
Chinese (zh)
Other versions
CN112035071A (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.)
Wanxing Technology Hunan Co ltd
Original Assignee
Wanxing Technology Hunan 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 Wanxing Technology Hunan Co ltd filed Critical Wanxing Technology Hunan Co ltd
Priority to CN202011033803.9A priority Critical patent/CN112035071B/en
Publication of CN112035071A publication Critical patent/CN112035071A/en
Application granted granted Critical
Publication of CN112035071B publication Critical patent/CN112035071B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/062Securing storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0629Configuration or reconfiguration of storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0629Configuration or reconfiguration of storage systems
    • G06F3/0637Permissions
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0646Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
    • G06F3/0652Erasing, e.g. deleting, data cleaning, moving of data to a wastebasket
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0674Disk device
    • G06F3/0676Magnetic disk device
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Storage Device Security (AREA)

Abstract

The invention relates to a disk data reading method, a device, a computer device and a storage medium, wherein the method comprises the steps of constructing memory mapping with a user space; acquiring disk information transmitted by a user space through matched kernel service; and returning the disk data to the user space by utilizing the super permission of the kernel space so that the user space can read the disk data according to the address of which the memory mapping is successful. According to the invention, by means of communication between the user space and the kernel space, after disk information is acquired from the user space, disk matching is performed, under the condition that the disk matching is successful, disk data are read to the memory descriptor, the disk data are returned through the memory mapping, and the problem that under the condition that the SIP protection is started by the system, the disk data cannot be read due to insufficient authority so as to perform data recovery is solved by utilizing the super authority of the kernel space.

Description

Disk data reading method, device, computer equipment and storage medium
Technical Field
The present invention relates to a data reading method, and more particularly, to a disk data reading method, apparatus, computer device, and storage medium.
Background
After the macOS 10.13 and above system starts SIP (system integrity protection ), the user space can not recover data because of the failure of disk data reading due to insufficient authority, and the data recovery can only be performed by restarting the computer after the computer enters a system recovery mode to close the SIP, so that the operation flow is complicated and complicated for common users, the security level of the computer is reduced, and the use risk is increased; and the terminal command line operation for entering the recovery mode can cause the fear and fear of computer damage to the user.
The existing disk data reading method for data recovery uses file I/O API (application program interface, application Programming Interface) functions provided by the operating system to perform reading operation under the permission of the user space, and the main API functions include open, seek, read, wirte and close. Under Unix-like operating systems, all content belongs to files, and a disk is also a file, and a disk object can be opened through an open to obtain a file descriptor, and data of the disk can be read through the file descriptor by utilizing a read function. But this way of reading reduces the security level of the system and increases the risk of use.
Therefore, it is necessary to design a new method to solve the problem that the disk data cannot be read for data recovery due to insufficient authority when the system starts SIP protection.
Disclosure of Invention
The invention aims to overcome the defects of the prior art and provides a method, a device, computer equipment and a storage medium for reading magnetic disk data.
In order to achieve the above purpose, the present invention adopts the following technical scheme: the disk data reading method comprises the following steps:
constructing a memory map with a user space;
acquiring disk information transmitted by a user space through matched kernel service;
and returning the disk data to the user space by utilizing the super permission of the kernel space so that the user space can read the disk data according to the address of which the memory mapping is successful.
The further technical scheme is as follows: the method for returning the disk data to the user space by utilizing the super permission of the kernel space to enable the user space to read the disk data according to the address of successful memory mapping comprises the following steps:
judging whether the disk information is an unloading driving message or not;
if the disk information is not the unloading driving information, performing disk matching according to the disk information to obtain a disk matching result;
judging whether the disk matching result is successful;
if the disk matching result is that the matching is successful, the disk data is read into the memory descriptor by utilizing the kernel space super authority;
and returning the disk data in the memory descriptor to the user space through memory mapping, so that the user space can read the disk data according to the address of which the memory mapping is successful.
The further technical scheme is as follows: after the determining whether the disk information is the unload driving message, the method further includes:
if the disk information is the unloading driving message, the ending step is entered.
The further technical scheme is as follows: after the judging whether the disk matching result is successful, the method further comprises the following steps:
if the disk matching result is not successful, judging whether the user space transmits disk information or not;
and if the user space transmits the disk information, executing the acquisition of the disk information transmitted by the user space through the matched kernel service.
The further technical scheme is as follows: after the judging whether the user space transmits the disk information, the method further comprises the following steps:
and if the user space does not transmit the disk information, executing the judgment on whether the user space transmits the disk information.
The further technical scheme is as follows: after the disk data is read into the memory descriptor by using the kernel space super authority, the method further comprises the following steps:
judging whether the disk data is successfully read into the memory descriptor;
if the disk data is read successfully into the memory descriptor, executing the disk data returned to the memory descriptor through the memory mapping, so that a user space can read the disk data according to the address of which the memory mapping is successful;
and if the disk data is read into the memory descriptor without successful reading, executing the judgment on whether the user space transmits the disk information.
The invention also provides a disk data reading device, comprising:
the mapping unit is used for constructing memory mapping with the user space;
the disk information acquisition unit is used for acquiring disk information transmitted by the user space through the matched kernel service;
the data return unit is used for returning the disk data to the user space by utilizing the super permission of the kernel space so that the user space can read the disk data according to the address of successful memory mapping.
The further technical scheme is as follows: the data return unit includes:
an information judging subunit, configured to judge whether the disk information is an unloading driving message;
the disk matching subunit is used for performing disk matching according to the disk information if the disk information is not the unloading driving message so as to obtain a disk matching result;
the matching judging subunit is used for judging whether the disk matching result is successful;
the reading subunit is used for reading the disk data into the memory descriptor by utilizing the kernel space super permission if the disk matching result is that the matching is successful;
and the return subunit is used for returning the disk data in the memory descriptor to the user space through the memory mapping so that the user space can read the disk data according to the address of which the memory mapping is successful.
The invention also provides a computer device which comprises a memory and a processor, wherein the memory stores a computer program, and the processor realizes the method when executing the computer program.
The present invention also provides a storage medium storing a computer program which, when executed by a processor, performs the above-described method.
Compared with the prior art, the embodiment of the invention has the beneficial effects that: according to the invention, by means of communication between the user space and the kernel space, after disk information is acquired from the user space, disk matching is performed, under the condition that the disk matching is successful, disk data are read to the memory descriptor, the disk data are returned through the memory mapping, and the problem that under the condition that the SIP protection is started by the system, the disk data cannot be read due to insufficient authority so as to perform data recovery is solved by utilizing the super authority of the kernel space.
The invention is further described below with reference to the drawings and specific embodiments.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic diagram of an application scenario of a disk data reading method according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart of a method for reading magnetic disk data according to an embodiment of the present invention;
FIG. 3 is a schematic sub-flowchart of a method for reading magnetic disk data according to an embodiment of the present invention;
FIG. 4 is a schematic block diagram of a disk data reading apparatus according to an embodiment of the present invention;
FIG. 5 is a schematic block diagram of a data return unit of a disk data reading apparatus according to an embodiment of the present invention;
fig. 6 is a schematic block diagram of a computer device according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
It should be understood that the terms "comprises" and "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It is also to be understood that the terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in this specification and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be further understood that the term "and/or" as used in the present specification and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes such combinations.
Referring to fig. 1 and fig. 2, fig. 1 is a schematic view of an application scenario of a disc data reading method according to an embodiment of the present invention. FIG. 2 is a schematic flow chart of a method for reading magnetic disk data according to an embodiment of the present invention. The disk data reading method is applied to the server. Specifically, data interaction is performed between a user space and a kernel space in a server, memory mapping is performed after kernel service matching is performed on the user space, disk information is transmitted to the kernel space through the kernel service under the condition that mapping is successful, disk data reading and feedback are performed by means of super permission of the kernel space, and the problem that data reading fails due to the fact that permission is insufficient under the condition that SIP is started in the user space is solved.
Fig. 2 is a flowchart of a method for reading magnetic disk data according to an embodiment of the present invention. As shown in fig. 2, the method includes the following steps S110 to S130.
S110, constructing memory mapping with the user space.
In this embodiment, the memory mapping refers to mapping between a user space and a kernel space, and the user space can read the disk data returned by the kernel space through an address of which the memory mapping is successful.
S120, obtaining disk information transmitted by the user space through the matched kernel service.
In this embodiment, the disk information includes information about which disk is determined, such as position information of the disk, and a message type that requires disk operations in the user space, and the message type includes an unload-drive message type or a non-unload-drive message type, and the non-unload-drive message type includes a read disk data type.
Specifically, the user space judges whether the kernel service is successfully matched according to the IOService subclass name, and if the kernel service is successfully matched, the memory mapping between the user space and the kernel space is carried out, when the memory mapping between the user space and the kernel space is successful, the user space can start to send a message to the kernel space to wait for the kernel space to process the message, and when the kernel space processes the message and returns, the user space can start to read the disk data processed by the kernel space according to the address of the previous memory mapping, so that the problem that the data reading fails due to the problem of insufficient authority when the user space starts the SIP can be solved.
In this embodiment, the above-mentioned determination of whether the kernel service is successfully matched, specifically, whether the kernel service can be matched with the designated kernel driver is determined according to the IOService class name, if the kernel service can be matched with the designated kernel driver, the kernel service is successfully matched, and at this time, the kernel driver corresponds to the kernel service.
S130, returning the disk data to the user space by utilizing the super permission of the kernel space so that the user space can read the disk data according to the address of which the memory mapping is successful.
In this embodiment, the disk data refers to related data that the user space needs to access to be stored in the kernel space.
In one embodiment, referring to fig. 3, the step S130 may include steps S131 to S136.
S131, judging whether the disk information is an unloading driving message or not.
In this embodiment, the offload driver message refers to a message type for offloading kernel drivers.
And (3) under the condition that the message processed by the kernel space requested by the user space is determined to be a non-unloading driving message, reading the disk data, otherwise, entering an ending step.
And S132, if the disk information is not the unloading driving message, performing disk matching according to the disk information to obtain a disk matching result.
In this embodiment, the disk matching result refers to a result obtained by determining which disk of the related information is matched according to the position information of the disk in the disk information, and the like, and includes two results, namely, the matching is successful, and which disk is determined; and secondly, the matching fails.
Only if the disk on which the disk data to be read is present is determined, the disk data can be accurately read.
S133, judging whether the disk matching result is successful;
and S134, if the disk matching result is that the matching is successful, reading the disk data into the memory descriptor by utilizing the kernel space super authority.
When the disk data needed by the user space is determined to be in which disk, the disk data in the disk are read into the memory descriptor by utilizing the super authority carried by the kernel space, so as to carry out subsequent data feedback. The memory descriptor contains all the information about the process address space, that is, the data needed in user space needs to be read from the memory descriptor in kernel space.
The kernel space super right includes reading disk data of any disk.
S135, judging whether the disk data is read successfully into the memory descriptor;
if the disk data is successfully read into the memory descriptor, step S136 is executed;
if the reading of the disk data into the memory descriptor is unsuccessful, step S137 is performed.
S136, returning the disk data in the memory descriptor to the user space through memory mapping, so that the user space can read the disk data according to the address of which the memory mapping is successful.
If the disk information is the unloading driving message, the ending step is entered.
In an embodiment, the step S130 further includes a step S137.
S137, if the disk matching result is not successful, judging whether the user space transmits disk information or not;
if the user space delivers the disk information, step S120 is executed.
If the user space does not transfer the disk information, step S137 is performed.
The acquisition of the disk information and the reading operation of the disk data are only performed when the disk information is transferred in the user space.
After the kernel driver is loaded, the disk information of the user space is always waited for, different treatments are carried out according to the disk information transmitted to the kernel space by the user space, after the disk information read by the disk data is received, the matching of IO media is carried out in the kernel space according to the disk information transmitted by the user space, the disk which needs to be read by the kernel space is found, the follow-up flow is carried out according to the matching state, the kernel space is supposed to be successfully matched, the disk data is read into the memory descriptor by utilizing the super authority, and after the read is successfully carried out, the disk data is transmitted to the user space in a memory mapping mode, so that the problem that the data read fails due to the insufficient authority of the user space under the condition of starting the SIP can be solved.
The user space is communicated with the kernel space, the SIP authority protection is directly bypassed to read the disk, and the problem that the user needs to perform complex operation to close the SIP under the condition that the system of macOS 10.13 and above is started to close the SIP, so that the security level of the system is reduced to recover the data is solved.
According to the disk data reading method, the disk matching is carried out after the disk information is acquired from the user space by means of communication between the user space and the kernel space, the disk data is read to the memory descriptor under the condition that the disk matching is successful, the disk data is returned through the memory mapping, and the problem that the disk data cannot be read to restore the data due to insufficient authority under the condition that the SIP protection is started by the system is solved by utilizing the super authority of the kernel space.
Fig. 4 is a schematic block diagram of a disk data reading apparatus 300 according to an embodiment of the present invention. As shown in fig. 4, the present invention also provides a disk data reading apparatus 300 corresponding to the above disk data reading method. The disk data reading apparatus 300 includes a unit for performing the above-described disk data reading method, and may be configured in a server. Specifically, referring to fig. 4, the disk data reading apparatus 300 includes a mapping unit 301, a disk information obtaining unit 302, and a data returning unit 303.
A mapping unit 301, configured to construct a memory map with a user space; the disk information obtaining unit 302 is configured to obtain disk information transmitted by the user space through the matched kernel service; and the data returning unit 303 is configured to return the disk data to the user space by using the super permission of the kernel space, so that the user space can read the disk data according to the address of successful memory mapping.
In one embodiment, as shown in fig. 5, the data returning unit 303 includes an information judging subunit 3031, a disk matching subunit 3032, a matching judging subunit 3033, a reading subunit 3034 and a returning subunit 3035.
An information judging subunit 3031, configured to judge whether the disc information is an unload drive message; if the disk information is the unloading driving information, entering an ending step; a disk matching subunit 3032, configured to perform disk matching according to the disk information if the disk information is not the unloading drive message, so as to obtain a disk matching result; a matching judging subunit 3033, configured to judge whether the disk matching result is successful; a reading subunit 3034, configured to read the disk data into the memory descriptor by using the kernel space super permission if the disk matching result is that the matching is successful; and the returning subunit 3035 is configured to return the disk data in the memory descriptor to the user space through memory mapping, so that the user space reads the disk data according to the address of which the memory mapping is successful.
In an embodiment, the data return unit 303 further includes a transfer determination subunit 3036.
A transmission judging subunit 3036, configured to judge whether the user space transmits disk information if the disk matching result is not successful; if the user space transmits the disk information, executing the acquisition of the disk information transmitted by the user space through the matched kernel service; and if the user space does not transmit the disk information, executing the judgment on whether the user space transmits the disk information.
In an embodiment, the data return unit 303 further includes a read determination subunit 3037.
A read determination subunit 3037, configured to determine whether the reading of the disk data into the memory descriptor is successful; if the disk data is read successfully into the memory descriptor, executing the disk data returned to the memory descriptor through the memory mapping, so that a user space can read the disk data according to the address of which the memory mapping is successful; and if the disk data is read into the memory descriptor without successful reading, executing the judgment on whether the user space transmits the disk information.
It should be noted that, as will be clearly understood by those skilled in the art, the specific implementation process of the above-mentioned disk data reading apparatus 300 and each unit may refer to the corresponding description in the foregoing method embodiments, and for convenience and brevity of description, the description is omitted here.
The disk data reading apparatus 300 described above may be implemented in the form of a computer program that can be run on a computer device as shown in fig. 6.
Referring to fig. 6, fig. 6 is a schematic block diagram of a computer device according to an embodiment of the present application. The computer device 500 may be a server, where the server may be a stand-alone server or may be a server cluster formed by a plurality of servers.
With reference to FIG. 6, the computer device 500 includes a processor 502, memory, and a network interface 505 connected by a system bus 501, where the memory may include a non-volatile storage medium 503 and an internal memory 504.
The non-volatile storage medium 503 may store an operating system 5031 and a computer program 5032. The computer program 5032 includes program instructions that, when executed, cause the processor 502 to perform a method of reading disk data.
The processor 502 is used to provide computing and control capabilities to support the operation of the overall computer device 500.
The internal memory 504 provides an environment for the execution of a computer program 5032 in the non-volatile storage medium 503, which computer program 5032, when executed by the processor 502, causes the processor 502 to perform a method of disk data reading.
The network interface 505 is used for network communication with other devices. Those skilled in the art will appreciate that the architecture shown in fig. 6 is merely a block diagram of a portion of the architecture in connection with the present application and is not intended to limit the computer device 500 to which the present application is applied, and that a particular computer device 500 may include more or fewer components than shown, or may combine certain components, or have a different arrangement of components.
Wherein the processor 502 is configured to execute a computer program 5032 stored in a memory to implement the steps of:
constructing a memory map with a user space; acquiring disk information transmitted by a user space through matched kernel service; and returning the disk data to the user space by utilizing the super permission of the kernel space so that the user space can read the disk data according to the address of which the memory mapping is successful.
In one embodiment, when the processor 502 returns the disk data to the user space by using the super permission of the kernel space, the user space reads the disk data according to the address of the successful memory mapping, which specifically includes the following steps:
judging whether the disk information is an unloading driving message or not; if the disk information is not the unloading driving information, performing disk matching according to the disk information to obtain a disk matching result; judging whether the disk matching result is successful; if the disk matching result is that the matching is successful, the disk data is read into the memory descriptor by utilizing the kernel space super authority; and returning the disk data in the memory descriptor to the user space through memory mapping, so that the user space can read the disk data according to the address of which the memory mapping is successful.
In one embodiment, after implementing the step of determining whether the disk information is an unload drive message, the processor 502 further implements the steps of:
if the disk information is the unloading driving message, the ending step is entered.
In one embodiment, after implementing the step of determining whether the disk matching result is a matching success, the processor 502 further implements the following steps:
if the disk matching result is not successful, judging whether the user space transmits disk information or not; and if the user space transmits the disk information, executing the acquisition of the disk information transmitted by the user space through the matched kernel service.
In one embodiment, after implementing the step of determining whether the user space is transferring disk information, the processor 502 further implements the following steps:
and if the user space does not transmit the disk information, executing the judgment on whether the user space transmits the disk information.
In one embodiment, after implementing the step of reading the disk data into the memory descriptor using kernel space super permission, the processor 502 further implements the following steps:
judging whether the disk data is successfully read into the memory descriptor; if the disk data is read successfully into the memory descriptor, executing the disk data returned to the memory descriptor through the memory mapping, so that a user space can read the disk data according to the address of which the memory mapping is successful; and if the disk data is read into the memory descriptor without successful reading, executing the judgment on whether the user space transmits the disk information.
It should be appreciated that in embodiments of the present application, the processor 502 may be a central processing unit (Central Processing Unit, CPU), the processor 502 may also be other general purpose processors, digital signal processors (Digital Signal Processor, DSPs), application specific integrated circuits (Application Specific Integrated Circuit, ASICs), off-the-shelf programmable gate arrays (Field-Programmable Gate Array, FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. Wherein the general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
Those skilled in the art will appreciate that all or part of the flow in a method embodying the above described embodiments may be accomplished by computer programs instructing the relevant hardware. The computer program comprises program instructions, and the computer program can be stored in a storage medium, which is a computer readable storage medium. The program instructions are executed by at least one processor in the computer system to implement the flow steps of the embodiments of the method described above.
Accordingly, the present invention also provides a storage medium. The storage medium may be a computer readable storage medium. The storage medium stores a computer program which, when executed by a processor, causes the processor to perform the steps of:
constructing a memory map with a user space; acquiring disk information transmitted by a user space through matched kernel service; and returning the disk data to the user space by utilizing the super permission of the kernel space so that the user space can read the disk data according to the address of which the memory mapping is successful.
In one embodiment, when the processor executes the computer program to implement the step of returning the disk data to the user space by using the super permission of the kernel space, so that the user space reads the disk data according to the address of which the memory mapping is successful, the following steps are specifically implemented:
judging whether the disk information is an unloading driving message or not; if the disk information is not the unloading driving information, performing disk matching according to the disk information to obtain a disk matching result; judging whether the disk matching result is successful; if the disk matching result is that the matching is successful, the disk data is read into the memory descriptor by utilizing the kernel space super authority; and returning the disk data in the memory descriptor to the user space through memory mapping, so that the user space can read the disk data according to the address of which the memory mapping is successful.
In one embodiment, after executing the computer program to perform the step of determining whether the disk information is an unload drive message, the processor further performs the steps of:
if the disk information is the unloading driving message, the ending step is entered.
In one embodiment, after executing the computer program to implement the step of determining whether the disk matching result is a matching success, the processor further implements the steps of:
if the disk matching result is not successful, judging whether the user space transmits disk information or not; and if the user space transmits the disk information, executing the acquisition of the disk information transmitted by the user space through the matched kernel service.
In one embodiment, after executing the computer program to implement the step of determining whether the user space conveys disk information, the processor further implements the steps of:
and if the user space does not transmit the disk information, executing the judgment on whether the user space transmits the disk information.
In one embodiment, after the step of reading the disk data into the memory descriptor using kernel space super permission is implemented by the processor executing the computer program, the following steps are further implemented:
judging whether the disk data is successfully read into the memory descriptor; if the disk data is read successfully into the memory descriptor, executing the disk data returned to the memory descriptor through the memory mapping, so that a user space can read the disk data according to the address of which the memory mapping is successful; and if the disk data is read into the memory descriptor without successful reading, executing the judgment on whether the user space transmits the disk information.
The storage medium may be a U-disk, a removable hard disk, a Read-Only Memory (ROM), a magnetic disk, or an optical disk, or other various computer-readable storage media that can store program codes.
Those of ordinary skill in the art will appreciate that the elements and algorithm steps described in connection with the embodiments disclosed herein may be embodied in electronic hardware, in computer software, or in a combination of the two, and that the elements and steps of the examples have been generally described in terms of function in the foregoing description to clearly illustrate the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
In the several embodiments provided by the present invention, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the device embodiments described above are merely illustrative. For example, the division of each unit is only one logic function division, and there may be another division manner in actual implementation. For example, multiple units or components may be combined or may be integrated into another system, or some features may be omitted, or not performed.
The steps in the method of the embodiment of the invention can be sequentially adjusted, combined and deleted according to actual needs. The units in the device of the embodiment of the invention can be combined, divided and deleted according to actual needs. In addition, each functional unit in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit.
The integrated unit may be stored in a storage medium if implemented in the form of a software functional unit and sold or used as a stand-alone product. Based on such understanding, the technical solution of the present invention is essentially or a part contributing to the prior art, or all or part of the technical solution may be embodied in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a terminal, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention.
While the invention has been described with reference to certain preferred embodiments, it will be understood by those skilled in the art that various changes and substitutions of equivalents may be made and equivalents will be apparent to those skilled in the art without departing from the scope of the invention. Therefore, the protection scope of the invention is subject to the protection scope of the claims.

Claims (7)

1. A method of reading disk data, comprising:
constructing a memory map with a user space;
acquiring disk information transmitted by a user space through matched kernel service; firstly, judging whether kernel services are successfully matched according to IOService subclasses names, and under the condition that the kernel services are successfully matched, performing memory mapping between the user space and the kernel space, after the memory mapping between the user space and the kernel space is successful, starting to send a message to the kernel space by the user space, waiting for the kernel space to process the message, and after the kernel space processes the message and returns, starting to read disk data processed by the kernel space by the user space according to the address of the previous memory mapping; judging whether the kernel service is successfully matched, specifically judging whether the kernel service can be matched with a designated kernel driver according to the IOService subclass name, if the kernel service can be matched with the designated kernel driver, indicating that the kernel service is successfully matched, and if the kernel service can be matched with the designated kernel driver, the kernel driver corresponds to the kernel service;
returning disk data to a user space by utilizing the super permission of the kernel space so that the user space can read the disk data according to the address of successful memory mapping;
the method for returning the disk data to the user space by utilizing the super permission of the kernel space to enable the user space to read the disk data according to the address of successful memory mapping comprises the following steps:
judging whether the disk information is an unloading driving message or not;
if the disk information is not the unloading driving information, performing disk matching according to the disk information to obtain a disk matching result;
judging whether the disk matching result is successful;
if the disk matching result is that the matching is successful, the disk data is read into the memory descriptor by utilizing the kernel space super authority;
returning the disk data in the memory descriptor to a user space through memory mapping, so that the user space can read the disk data according to the address of which the memory mapping is successful;
after the judging whether the disk matching result is successful, the method further comprises the following steps:
if the disk matching result is not successful, judging whether the user space transmits disk information or not;
and if the user space transmits the disk information, executing the acquisition of the disk information transmitted by the user space through the matched kernel service.
2. The method of claim 1, wherein after determining whether the disk information is an unload drive message, further comprising:
if the disk information is the unloading driving message, the ending step is entered.
3. The method for reading disc data according to claim 1, wherein after determining whether the user space delivers disc information, further comprising:
and if the user space does not transmit the disk information, executing the judgment on whether the user space transmits the disk information.
4. The method for reading disc data according to claim 3, further comprising, after the disc data is read into the memory descriptor by using the kernel space super right:
judging whether the disk data is successfully read into the memory descriptor;
if the disk data is read successfully into the memory descriptor, executing the disk data returned to the memory descriptor through the memory mapping, so that a user space can read the disk data according to the address of which the memory mapping is successful;
and if the disk data is read into the memory descriptor without successful reading, executing the judgment on whether the user space transmits the disk information.
5. A disk data reading apparatus comprising:
the mapping unit is used for constructing memory mapping with the user space;
the disk information acquisition unit is used for acquiring disk information transmitted by the user space through the matched kernel service; firstly, judging whether kernel services are successfully matched according to IOService subclasses names, and under the condition that the kernel services are successfully matched, performing memory mapping between the user space and the kernel space, after the memory mapping between the user space and the kernel space is successful, starting to send a message to the kernel space by the user space, waiting for the kernel space to process the message, and after the kernel space processes the message and returns, starting to read disk data processed by the kernel space by the user space according to the address of the previous memory mapping; judging whether the kernel service is successfully matched, specifically judging whether the kernel service can be matched with a designated kernel driver according to the IOService subclass name, if the kernel service can be matched with the designated kernel driver, indicating that the kernel service is successfully matched, and if the kernel service can be matched with the designated kernel driver, the kernel driver corresponds to the kernel service;
the data return unit is used for returning the disk data to the user space by utilizing the super permission of the kernel space so that the user space can read the disk data according to the address of successful memory mapping;
the data return unit includes:
an information judging subunit, configured to judge whether the disk information is an unloading driving message;
the disk matching subunit is used for performing disk matching according to the disk information if the disk information is not the unloading driving message so as to obtain a disk matching result;
the matching judging subunit is used for judging whether the disk matching result is successful;
the reading subunit is used for reading the disk data into the memory descriptor by utilizing the kernel space super permission if the disk matching result is that the matching is successful;
a return subunit, configured to return the disk data in the memory descriptor to the user space through memory mapping, so that the user space reads the disk data according to an address where the memory mapping is successful;
the system also comprises a transmission judgment subunit;
the transmission judging subunit is used for judging whether the user space transmits disk information or not if the disk matching result is not successful; if the user space transmits the disk information, executing the acquisition of the disk information transmitted by the user space through the matched kernel service; and if the user space does not transmit the disk information, executing the judgment on whether the user space transmits the disk information.
6. A computer device, characterized in that it comprises a memory on which a computer program is stored and a processor which, when executing the computer program, implements the method according to any of claims 1-4.
7. A storage medium storing a computer program which, when executed by a processor, performs the method of any one of claims 1 to 4.
CN202011033803.9A 2020-09-27 2020-09-27 Disk data reading method, device, computer equipment and storage medium Active CN112035071B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011033803.9A CN112035071B (en) 2020-09-27 2020-09-27 Disk data reading method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011033803.9A CN112035071B (en) 2020-09-27 2020-09-27 Disk data reading method, device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112035071A CN112035071A (en) 2020-12-04
CN112035071B true CN112035071B (en) 2023-06-06

Family

ID=73574492

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011033803.9A Active CN112035071B (en) 2020-09-27 2020-09-27 Disk data reading method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112035071B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114791832B (en) * 2022-04-24 2024-02-27 深圳软牛科技集团股份有限公司 IOS system repairing method and device when equipment space is insufficient and related components

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108628550A (en) * 2018-04-28 2018-10-09 深信服科技股份有限公司 A kind of method, apparatus and system of reading disk mapped file
CN110196681A (en) * 2018-04-11 2019-09-03 腾讯科技(深圳)有限公司 Data in magnetic disk write-in control method and device, the electronic equipment of business write operation

Family Cites Families (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101267361B (en) * 2008-05-09 2011-05-18 武汉飞思科技有限公司 A high-speed network data packet capturing method based on zero duplication technology
US8667504B2 (en) * 2008-06-20 2014-03-04 Netapp, Inc. System and method for achieving high performance data flow among user space processes in storage system
US8806511B2 (en) * 2010-11-18 2014-08-12 International Business Machines Corporation Executing a kernel device driver as a user space process
US8862930B2 (en) * 2010-11-24 2014-10-14 Red Hat, Inc. Crash recovery memory reservation based on device drivers for an operational kernel
CN102571925B (en) * 2011-12-19 2014-08-27 华中科技大学 RDMA (Remote Direct Memory Access)-based data access method in fiber channel environment
US10379745B2 (en) * 2016-04-22 2019-08-13 Samsung Electronics Co., Ltd. Simultaneous kernel mode and user mode access to a device using the NVMe interface
CN107450856A (en) * 2017-08-10 2017-12-08 北京元心科技有限公司 Writing method and reading method of stored data, corresponding devices and terminals
US10430110B2 (en) * 2017-12-19 2019-10-01 Robin Systems, Inc. Implementing a hybrid storage node in a distributed storage system
CN108920934B (en) * 2018-06-12 2021-06-18 北京华大智宝电子系统有限公司 Method, device and equipment for driving mass storage equipment in Mac system
US10747594B1 (en) * 2019-01-24 2020-08-18 Vmware, Inc. System and methods of zero-copy data path among user level processes

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110196681A (en) * 2018-04-11 2019-09-03 腾讯科技(深圳)有限公司 Data in magnetic disk write-in control method and device, the electronic equipment of business write operation
CN108628550A (en) * 2018-04-28 2018-10-09 深信服科技股份有限公司 A kind of method, apparatus and system of reading disk mapped file

Also Published As

Publication number Publication date
CN112035071A (en) 2020-12-04

Similar Documents

Publication Publication Date Title
US10437680B2 (en) Relay apparatus, relay method, and computer program product
US20110283274A1 (en) Firmware image update and management
US8082543B2 (en) Methods and systems for arbitrating error handling and firmware updates
US7197634B2 (en) System and method for updating device firmware
US20060224723A1 (en) Data updating system and method
CN110753084B (en) Uplink data reading method, cache server and computer readable storage medium
CN111736909B (en) Method and device for starting operating system, computer equipment and storage medium
CN108874427B (en) Updating progress obtaining method and device and readable storage medium
CN112035071B (en) Disk data reading method, device, computer equipment and storage medium
CN110990116B (en) Method, device and system for transmitting data between intelligent network card and virtual machine
AU2005226035A1 (en) Optimizing database access for record linkage by tiling the space of record pairs
JP2024113165A (en) Data structure, memory means, and device
CN113313594B (en) Order processing method, order processing device, electronic equipment, storage medium and program product
US20070157014A1 (en) Apparatus for remote flashing of a bios memory in a data processing system
CN112199272B (en) Intelligent terminal testing method and device, terminal equipment and medium
US6973511B2 (en) System and method for dual stage persistent reservation preemption protocol
WO2024103583A1 (en) Method and apparatus for changed bios options to take effect, nonvolatile readable storage medium, and electronic apparatus
CN105278993A (en) Linux system based drive module upgrading method and apparatus
CN112559349B (en) Program running method and running device
CN111913666A (en) Method and device compatible with Nand particles with different protocols, computer equipment and storage medium
US20200210606A1 (en) Quarantining storage objects using a quarantine list
CN117331593A (en) Dual-backup upgrading method, computer equipment and storage medium
CN117421291A (en) Method, device and medium for modifying storage level parameters of pre-written log
CN116736821A (en) Method for determining the reliability of information and electronic control device
JP2977518B2 (en) Mobile data processing system and mobile terminal data consistency control method

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