CN116167103A - Storage device write control method and device, computing device and storage medium - Google Patents

Storage device write control method and device, computing device and storage medium Download PDF

Info

Publication number
CN116167103A
CN116167103A CN202310195476.4A CN202310195476A CN116167103A CN 116167103 A CN116167103 A CN 116167103A CN 202310195476 A CN202310195476 A CN 202310195476A CN 116167103 A CN116167103 A CN 116167103A
Authority
CN
China
Prior art keywords
write
storage device
input operation
code
input
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.)
Pending
Application number
CN202310195476.4A
Other languages
Chinese (zh)
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.)
Uniontech Software Technology Co Ltd
Original Assignee
Uniontech Software Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Uniontech Software Technology Co Ltd filed Critical Uniontech Software Technology Co Ltd
Priority to CN202310195476.4A priority Critical patent/CN116167103A/en
Publication of CN116167103A publication Critical patent/CN116167103A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/70Protecting specific internal or peripheral components, in which the protection of a component leads to protection of the entire computer
    • G06F21/78Protecting specific internal or peripheral components, in which the protection of a component leads to protection of the entire computer to assure secure storage of data
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • G06F8/427Parsing
    • 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)
  • General Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Hardware Design (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a storage device writing control method, a storage device writing control device, a computing device and a storage medium, wherein the method is executed in an operating system of the computing device and comprises the following steps: mounting a target file system of the storage device; receiving an input operation at the target file system; judging whether the input operation is a writing operation; if the input operation is a write operation, execution of the input operation is prevented. According to the technical scheme of the invention, the writing of data to the external storage device by a user can be prevented, so that the writing control of the storage device is realized.

Description

Storage device write control method and device, computing device and storage medium
Technical Field
The present invention relates to the field of computers and operating systems, and in particular, to a storage device write control method, a write control device, a computing device, and a storage medium.
Background
At present, in enterprises with higher confidentiality requirements, users hope that an external USB storage device can only read and cannot write, so that confidentiality data in a computer is prevented from being copied to the USB storage device.
USB storage devices fall into two categories, defined in USB-IF as follows:
mass Storage (Mass Storage device), base class is 0x08, and the specific corresponding device is a USB removable Storage device, such as a USB disk, a USB removable hard disk, a USB removable optical drive, a USB tape, etc. Such devices are typically block devices, containing a file system, for which a read-only control scheme may be mounted as read-only, or write-protection may be turned on.
Vendor Specific (Vendor custom device), base Class is 0xFF, and the Specific corresponding device is a mobile digital device using USB interface, such as a mobile phone, tablet, camera, etc. Such devices generally use the MTP or PTP protocol for data transmission, and since the protocol does not provide a read-only control method, the prior art does not provide a read-only control method suitable for such mobile digital devices based on a USB interface.
For this reason, a storage device write control method is required to solve the problems in the migration scheme described above.
Disclosure of Invention
Accordingly, the present invention provides a method and apparatus for controlling writing of a memory device, which solve or at least alleviate the above problems.
According to one aspect of the present invention, there is provided a storage device write control method, executed in an operating system of a computing device, the method comprising: mounting a target file system of the storage device; receiving an input operation at the target file system; judging whether the input operation is a writing operation; if the input operation is a write operation, execution of the input operation is prevented.
Optionally, in the storage device write control method according to the present invention, determining whether the input operation is a write operation includes: analyzing the data packet corresponding to the input operation to obtain an operation code of the input operation; and determining whether the input operation is a writing operation according to the operation code.
Optionally, in the storage device write control method according to the present invention, the storage device is adapted to perform data transmission based on the first transmission protocol or the second transmission protocol; determining whether the input operation is a write operation according to the operation code includes: judging whether the operation code is a preset operation code or not; if the opcode is a predetermined opcode, then the input operation is determined to be a write operation.
Optionally, in the storage device write control method according to the present invention, determining whether the input operation is a write operation according to the operation code includes: determining an operation command corresponding to the operation code, and judging whether the operation command is a writing command or not; if the operation command is a write command, it is determined that the input operation is a write operation.
Optionally, in the storage device write control method according to the present invention, determining an operation command corresponding to the operation code includes: acquiring an operation mapping table, and determining an operation command corresponding to the operation code according to the operation mapping table; the operation mapping table comprises a first operation code mapping table corresponding to a first transmission protocol and a second operation code mapping table corresponding to a second transmission protocol.
Optionally, in the storage device write control method according to the present invention, the storage device is a USB storage device; the first transmission protocol is an MTP protocol, and the second transmission protocol is a PTP protocol.
Optionally, in the storage device write control method according to the present invention, the predetermined operation code includes 0x100d, 0x100c.
According to one aspect of the present invention, there is provided a write control apparatus deployed in an operating system of a computing device, the apparatus comprising: the mounting module is suitable for mounting a target file system of the storage device; a receiving module adapted to receive an input operation at the target file system; a judging module adapted to judge whether the input operation is a write operation; a blocking module adapted to block execution of the input operation if the input operation is a write operation.
According to one aspect of the invention, there is provided a computing device comprising: at least one processor; a memory storing program instructions, wherein the program instructions are configured to be adapted to be executed by the at least one processor, the program instructions comprising instructions for performing a storage device write control method as described above.
According to an aspect of the present invention, there is provided a readable storage medium storing program instructions that, when read and executed by a computing device, cause the computing device to perform a storage device write control method as described above.
According to the technical scheme of the invention, the writing control method of the storage device is provided, wherein when the input operation of the target file system of the mounted storage device is received, whether the input operation is a writing operation is judged, and specifically whether the operation code is a preset operation code can be judged by analyzing a data packet, so that whether the input operation is a writing operation can be determined. If it is determined that the input operation is a write operation, execution of the input operation is prevented. Thus, the writing control of the external storage device by preventing the user from writing data into the storage device can be realized.
The foregoing description is only an overview of the present invention, and is intended to be implemented in accordance with the teachings of the present invention in order that the same may be more clearly understood and to make the same and other objects, features and advantages of the present invention more readily apparent.
Drawings
To the accomplishment of the foregoing and related ends, certain illustrative aspects are described herein in connection with the following description and the annexed drawings, which set forth the various ways in which the principles disclosed herein may be practiced, and all aspects and equivalents thereof are intended to fall within the scope of the claimed subject matter. The above, as well as additional objects, features, and advantages of the present disclosure will become more apparent from the following detailed description when read in conjunction with the accompanying drawings. Like reference numerals generally refer to like parts or elements throughout the present disclosure.
FIG. 1 shows a schematic diagram of a computing device 100 according to one embodiment of the invention;
FIG. 2 illustrates a flow chart of a storage device write control method 200 according to one embodiment of the invention;
FIG. 3 illustrates an interface effect diagram in which a create file operation is blocked, according to one embodiment of the invention;
FIG. 4 illustrates an interface effect diagram in which copy file operations are prevented, according to one embodiment of the invention;
FIG. 5 illustrates a schematic diagram of a first opcode mapping table corresponding to a first transfer protocol (MTP protocol) according to one embodiment of the present invention;
FIG. 6 illustrates a schematic diagram of a second opcode mapping table corresponding to a second transport protocol (PTP protocol) according to one embodiment of the present invention;
fig. 7 shows a schematic diagram of a write control device 700 according to an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
FIG. 1 shows a schematic diagram of a computing device 100 according to one embodiment of the invention. As shown in FIG. 1, in a basic configuration, computing device 100 includes at least one processing unit 102 and a system memory 104. According to one aspect, the processing unit 102 may be implemented as a processor, depending on the configuration and type of computing device. The system memory 104 includes, but is not limited to, volatile storage (e.g., random access memory), non-volatile storage (e.g., read only memory), flash memory, or any combination of such memories. According to one aspect, the system memory 104 includes an operating system 105, and the operating system 105 includes a plurality of program instructions adapted to perform the storage device write control method 200 of the present invention.
According to one aspect, operating system 105 is suitable, for example, for controlling the operation of computing device 100. Further, examples are practiced in connection with a graphics library, other operating systems, or any other application program and are not limited to any particular application or system. This basic configuration is illustrated in fig. 1 by those components within the dashed line. According to one aspect, computing device 100 has additional features or functionality. For example, according to one aspect, computing device 100 includes additional data storage devices (removable and/or non-removable) such as, for example, magnetic disks, optical disks, or tape. Such additional storage is illustrated in fig. 1 by removable storage device 109 and non-removable storage device 110.
As set forth hereinabove, according to one aspect, the program module 103 is stored in the system memory 104. According to one aspect, program modules 103 may include one or more applications, the invention is not limited in the type of application, for example, the application may include: email and contacts applications, word processing applications, spreadsheet applications, database applications, slide show applications, drawing or computer-aided application, web browser applications, etc.
According to one aspect, the examples may be practiced in a circuit comprising discrete electronic components, a packaged or integrated electronic chip containing logic gates, a circuit utilizing a microprocessor, or on a single chip containing electronic components or a microprocessor. For example, examples may be practiced via a system on a chip (SOC) in which each or many of the components shown in fig. 1 may be integrated on a single integrated circuit. According to one aspect, such SOC devices may include one or more processing units, graphics units, communication units, system virtualization units, and various application functions, all of which are integrated (or "burned") onto a chip substrate as a single integrated circuit. When operating via an SOC, the functionality described herein may be operated via dedicated logic integrated with other components of computing device 100 on a single integrated circuit (chip). Embodiments of the invention may also be practiced using other techniques capable of performing logical operations (e.g., AND, OR, AND NOT), including but NOT limited to mechanical, optical, fluidic, AND quantum techniques. In addition, embodiments of the invention may be practiced within a general purpose computer or in any other circuit or system.
According to one aspect, the computing device 100 may also have one or more input devices 112, such as a keyboard, mouse, pen, voice input device, touch input device, and the like. Output device(s) 114 such as a display, speakers, printer, etc. may also be included. The foregoing devices are examples and other devices may also be used. Computing device 100 may include one or more communication connections 116 that allow communication with other computing devices 118. Examples of suitable communication connections 116 include, but are not limited to: RF transmitter, receiver and/or transceiver circuitry; universal Serial Bus (USB), parallel and/or serial ports.
The term computer readable media as used herein includes computer storage media. Computer storage media may include volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information (e.g., computer readable instructions, data structures, or program modules 103). System memory 104, removable storage 109, and non-removable storage 110 are all examples of computer storage media (i.e., memory storage). Computer storage media may include Random Access Memory (RAM), read Only Memory (ROM), electrically erasable read only memory (EEPROM), flash memory or other memory technology, CD-ROM, digital Versatile Disks (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other article of manufacture that can be used to store information and that can be accessed by computer device 100. According to one aspect, any such computer storage media may be part of computing device 100. Computer storage media does not include a carrier wave or other propagated data signal.
According to one aspect, communication media is embodied by computer readable instructions, data structures, program modules 103, or other data in a modulated data signal (e.g., carrier wave or other transport mechanism) and includes any information delivery media. According to one aspect, the term "modulated data signal" describes a signal that has one or more of its characteristics set or changed in such a manner as to encode information in the signal. By way of example, and not limitation, communication media includes wired media such as a wired network or direct-wired connection, and wireless media such as acoustic, radio Frequency (RF), infrared, and other wireless media.
In an embodiment in accordance with the invention, the operating system of computing device 100 is configured to perform a storage device write control method 200 in accordance with the invention. The computing device 100 includes one or more processors and one or more readable storage media storing program instructions that, when configured to be executed by the one or more processors, cause an operating system of the computing device to perform the storage device write control method 200 in embodiments of the invention.
According to one embodiment of the invention, a write control apparatus 700 is disposed in an operating system of a computing device 100, the write control apparatus 700 being configured to perform a storage device write control method 200 according to the invention. The write control apparatus 700 includes a plurality of program instructions for executing the storage device write control method 200 of the present invention, where the program instructions may instruct a processor to execute the storage device write control method 200 according to the present invention.
FIG. 2 illustrates a flow chart of a storage device write control method 200 according to one embodiment of the invention. The method 200 is suitable for execution in an operating system of a computing device (the aforementioned computing device 100).
In an embodiment according to the invention, the storage device is a removable storage device, which may be a USB storage device, for example. And, the storage device may perform data transmission based on the first transmission protocol or the second transmission protocol.
As shown in fig. 2, method 200 includes steps 210-230.
First, in step 210, a target file system of a storage device is mounted. In particular, a target file system of a storage device may be mounted into a file system of an operating system of a computing device.
Subsequently, in step 220, an input operation of the target file system of the user on the mounted storage device is received.
Here, the user may perform an input operation on the target operating system after mounting, so as to request to input data to the storage device, where the data requested to be input may specifically be data local to the computing device.
Subsequently, in step 230, it is determined whether the input operation is a write operation.
Finally, in step 240, if it is determined that the input operation is a write operation, execution of the input operation is prevented. I.e. the submission of the data packet corresponding to the input operation is prevented from being performed. Thus, the method can prevent the user from writing data into the target file system of the storage device, thereby realizing the writing control of the storage device.
If it is determined that the input operation is not a write operation (is a read operation), the input operation may be performed so that only data in the storage device is allowed to be read, but data cannot be written to the storage device.
In one embodiment, the storage device write control method 200 of the present invention may be performed in the kernel of an operating system. The kernel of the operating system may provide a kernel interface to the application layer, to which one or more application programs (user mode programs) of the application layer call, by which control of writing data to the storage device may be implemented.
In one embodiment, the write operation may specifically include a create file operation, a copy file operation. Wherein fig. 3 illustrates an interface effect diagram in which a create file operation is blocked according to one embodiment of the present invention, and fig. 4 illustrates an interface effect diagram in which a copy file operation is blocked according to one embodiment of the present invention.
According to one embodiment of the present invention, it may be determined whether an input operation is a write operation according to the following method:
first, a data packet corresponding to an input operation is parsed to obtain an operation code of the input operation from the data packet. Here, when the storage device is a USB storage device, the data packet corresponding to the input operation is a USB data packet, and specifically may be a data packet of the first transmission protocol or a data packet of the second transmission protocol.
Further, it is determined whether the input operation is a write operation based on the operation code.
Specifically, in one embodiment of the present invention, one or more predetermined operation codes corresponding to the write operation may be predetermined.
Thus, in determining whether the input operation is a write operation based on the operation code, by judging whether the operation code is a predetermined operation code, if the operation code is a predetermined operation code, it can be determined that the input operation is a write operation. If the input operation is determined to be a write operation, the corresponding data packet is not submitted to prevent the write operation from being performed, thereby enabling the user to be prevented from writing data to the target file system of the storage device. Otherwise, if it is determined that the opcode is not the predetermined opcode, then it may be determined that the input operation is not a write operation, at which time the data packet may be committed to perform the input operation.
In one embodiment, the storage device may perform data transfer based on the first transfer protocol or the second transfer protocol. And one or more predetermined operation codes corresponding to the first transmission protocol and the second transmission protocol are consistent. In other words, the operation code of the write operation corresponding to the first transmission protocol is the same as the operation code of the write operation corresponding to the second transmission protocol.
In one embodiment, the one or more predetermined opcodes include, for example, a first predetermined opcode, a second predetermined opcode. Here, the present invention does not specifically limit the first predetermined operation code and the second predetermined operation code. .
Thus, whether the storage device is data transfer based on the first transfer protocol or the second transfer protocol, it is possible to determine whether the input operation is a write operation by: whether the operation code is a predetermined operation code (first predetermined operation code or second predetermined operation code) is judged, and if the operation code is determined to be the predetermined operation code (first predetermined operation code or second predetermined operation code), it may be determined that the input operation is a write operation. If the input operation is determined to be a write operation, the corresponding data packet is not submitted to prevent the write operation from being performed, thereby enabling the user to be prevented from writing data to the target file system of the storage device. Otherwise, if it is determined that the opcode is not the first predetermined opcode nor the second predetermined opcode, then it may be determined that the input operation is not a write operation, at which time the data packet may be committed to perform the input operation.
For example, in one implementation, the storage device is a USB storage device, and the first transmission protocol may be an MTP protocol and the second transmission protocol may be a PTP protocol. That is, the storage device of the present invention may be a USB storage device based on the MTP protocol or the PTP protocol, and for example, may be various mobile communication devices.
Fig. 5 shows a schematic diagram of a first opcode mapping table corresponding to a first transfer protocol (MTP protocol) according to one embodiment of the present invention. Fig. 6 shows a schematic diagram of a second opcode mapping table corresponding to a second transport protocol (PTP protocol) according to an embodiment of the invention.
As shown in fig. 5 and fig. 6, the first operation mapping table and the second operation code mapping table respectively store mapping relations between a plurality of operation commands and operation codes, and each item in the operation mapping table respectively comprises an operation command and an operation code corresponding to the operation command. Specifically, the first operation mapping table includes a plurality of operation commands based on a first transmission protocol, and the second operation mapping table includes a plurality of operation commands based on a second transmission protocol. Wherein, the plurality of operation commands based on the first transmission protocol comprise one or more write commands (first write commands), and the plurality of operation commands based on the second transmission protocol also comprise one or more write commands (second write commands). The operation codes corresponding to the first write command and the second write command may be determined as predetermined operation codes.
As shown in fig. 5, the plurality of operation commands based on the first transfer protocol (MTP protocol) include a first write command SendObject and SendObjectInfo, where the operation code corresponding to the first write command SendObject is 0x100d and the operation code corresponding to the SendObjectInfo is 0x100c. As shown in fig. 6, the plurality of operation commands based on the second transmission protocol (PTP protocol) include a second write command SendObject and SendObjectInfo, wherein the operation code corresponding to the second write command SendObject is 0x100d, and the operation code corresponding to the SendObjectInfo is 0x100c.
It can be seen that the operation codes of the write commands corresponding to the first transmission protocol and the second transmission protocol each include 0x100d and 0x100c, so that 0x100d and 0x100c can be determined as predetermined operation codes. In other words, the one or more predetermined operation codes corresponding to the first transmission protocol and the second transmission protocol include 0x100d and 0x100c. That is, the first predetermined operation code may be 0x100d and the second predetermined operation code may be 0x100c.
Note that SendObjectInfo indicates to the storage device that the file information to be written by the computing device, and the storage device returns whether the file can be written; sendObject means writing specific file content to a storage device.
It should be noted that, the first transmission protocol (MTP protocol) and the second transmission protocol (PTP protocol) have the same packet format, and the operation code is stored in the memory area with an offset of 6 bytes and a length of 2 bytes. Therefore, it is only necessary to determine whether the opcode in the data packet is the predetermined opcode 0x100d or 0x100c, so as to determine whether the input operation is a write operation.
According to one implementation of the present invention, a data structure may be defined under the kernel source code tree of the operating system, specifically in driver/usb/core/devio.c, according to the data packet format, where the data structure is as follows:
struct mtp_dataset{
u32 container_length;
u16 container_type;
u16 operation_code;
u32 transaction_id;
void*payload;
};
in order to reduce the amount of judgment and the amount of code, the analysis code may be stored under proc_do_sub () of devio.c.
According to yet another embodiment of the present invention, determining whether the input operation is a write operation based on the operation code may be performed as follows: first, an operation command corresponding to an operation code is determined, and whether the operation command is a write command is determined. If the operation command is a write command, it may be determined that the input operation is a write operation.
In one embodiment, by obtaining an operation mapping table, the operation mapping table stores mapping relations between a plurality of operation commands and operation codes, so that the operation command corresponding to the operation code can be determined according to the operation mapping table. Further, it is determined whether or not the operation command corresponding to the operation code is a write command, and if the operation command is a write command, it may be determined that the input operation is a write operation.
Here, the obtained operation map may include a first operation code map corresponding to the first transmission protocol, and a second operation code map corresponding to the second transmission protocol.
Specifically, as shown in fig. 5 and fig. 6, the first operation mapping table and the second operation code mapping table respectively store mapping relations between a plurality of operation commands and operation codes, and each item in the operation mapping table respectively includes an operation command and an operation code corresponding to the operation command. Specifically, the first operation mapping table includes a plurality of operation commands based on a first transmission protocol, and the second operation mapping table includes a plurality of operation commands based on a second transmission protocol. Wherein, the plurality of operation commands based on the first transmission protocol comprise one or more write commands (first write commands), and the plurality of operation commands based on the second transmission protocol also comprise one or more write commands (second write commands). Thus, when determining the first write command or the second write command of the operation command corresponding to the operation code according to the first operation mapping table and the second operation code mapping table, it can be determined that the input operation is a write operation.
For example, as shown in fig. 5, the first write command SendObject and SendObjectInfo are included in the plurality of operation commands based on the first transfer protocol (MTP protocol). As shown in fig. 6, the second write command SendObject and SendObjectInfo are included in the plurality of operation commands based on the second transfer protocol (PTP protocol). Thus, when it is determined that the operation command corresponding to the operation code is the first write command SendObject or the second write command SendObjectInfo according to the first operation map table and the second operation code map table, it is determined that the input operation is a write operation.
It should also be noted that the storage device write control method 200 according to the present invention is not limited to USB storage devices, but may be used for storage devices based on the MTP or PTP protocols of TCP/IP, bluetooth.
Fig. 7 shows a schematic diagram of a write control device 700 according to an embodiment of the invention. The write control apparatus 700 is disposed in a kernel of an operating system of a computing device (e.g., the aforementioned computing device 100). The write control means 700 is adapted to perform the storage device write control method 200 of the present invention.
As shown in fig. 7, the write control device 700 includes a mounting module 710, a receiving module 720, a judging module 730, and a blocking module 740 that are sequentially connected. Wherein the mount module 710 is adapted to mount a target file system of the storage device. The receiving module 720 is adapted to receive input operations of the target file system of the storage device after mounting. The determination module 730 is adapted to determine whether the input operation is a write operation. If the input operation is a write operation, the blocking module 740 may block the input operation from being performed.
It should be noted that the mounting module 710 is configured to perform the foregoing step 210, the receiving module 720 is configured to perform the foregoing step 220, the judging module 730 is configured to perform the foregoing step 230, and the blocking module 740 is configured to perform the foregoing step 240. Specific execution logic of the mounting module 710, the receiving module 720, the judging module 730, and the blocking module 740 is referred to in the foregoing description of steps 210 to 240 in the method 200, and will not be repeated here.
According to the storage device write control method, when the input operation of the target file system of the mounted storage device is received, whether the input operation is a write operation is judged, and specifically whether the operation code is a preset operation code can be judged by analyzing the data packet, so that whether the input operation is a write operation can be determined. If it is determined that the input operation is a write operation, execution of the input operation is prevented. Thus, the writing control of the external storage device by preventing the user from writing data into the storage device can be realized.
The various techniques described herein may be implemented in connection with hardware or software or, alternatively, with a combination of both. Thus, the methods and apparatus of the present invention, or certain aspects or portions of the methods and apparatus of the present invention, may take the form of program code (i.e., instructions) embodied in tangible media, such as removable hard drives, U-drives, floppy diskettes, CD-ROMs, or any other machine-readable storage medium, wherein, when the program is loaded into and executed by a machine, such as a computer, the machine becomes an apparatus for practicing the invention.
In the case of program code execution on programmable computers, the mobile terminal will generally include a processor, a storage medium readable by the processor (including volatile and non-volatile memory and/or storage elements), at least one input device, and at least one output device. Wherein the memory is configured to store program code; the processor is configured to execute the storage device write control method of the present invention in accordance with instructions in said program code stored in the memory.
By way of example, and not limitation, readable media comprise readable storage media and communication media. The readable storage medium stores information such as computer readable instructions, data structures, program modules, or other data. Communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media. Combinations of any of the above are also included within the scope of readable media.
In the description provided herein, algorithms and displays are not inherently related to any particular computer, virtual system, or other apparatus. Various general-purpose systems may also be used with examples of the invention. The required structure for a construction of such a system is apparent from the description above. In addition, the present invention is not directed to any particular programming language. It will be appreciated that the teachings of the present invention described herein may be implemented in a variety of programming languages, and the above description of specific languages is provided for disclosure of enablement and best mode of the present invention.
In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be construed as reflecting the intention that: i.e., the claimed invention requires more features than are expressly recited in each claim. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules or units or components of the devices in the examples disclosed herein may be arranged in a device as described in this embodiment, or alternatively may be located in one or more devices different from the devices in this example. The modules in the foregoing examples may be combined into one module or may be further divided into a plurality of sub-modules.
Those skilled in the art will appreciate that the modules in the apparatus of the embodiments may be adaptively changed and disposed in one or more apparatuses different from the embodiments. The modules or units or components of the embodiments may be combined into one module or unit or component and, furthermore, they may be divided into a plurality of sub-modules or sub-units or sub-components. Any combination of all features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or units of any method or apparatus so disclosed, may be used in combination, except insofar as at least some of such features and/or processes or units are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings), may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features but not others included in other embodiments, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the following claims, any of the claimed embodiments can be used in any combination.
Furthermore, some of the embodiments are described herein as methods or combinations of method elements that may be implemented by a processor of a computer system or by other means of performing the functions. Thus, a processor with the necessary instructions for implementing the described method or method element forms a means for implementing the method or method element. Furthermore, the elements of the apparatus embodiments described herein are examples of the following apparatus: the apparatus is for carrying out the functions performed by the elements for carrying out the objects of the invention.
As used herein, unless otherwise specified the use of the ordinal terms "first," "second," "third," etc., to describe a general object merely denote different instances of like objects, and are not intended to imply that the objects so described must have a given order, either temporally, spatially, in ranking, or in any other manner.
While the invention has been described with respect to a limited number of embodiments, those skilled in the art, having benefit of the above description, will appreciate that other embodiments are contemplated within the scope of the invention as described herein. Furthermore, it should be noted that the language used in the specification has been principally selected for readability and instructional purposes, and may not have been selected to delineate or circumscribe the inventive subject matter. Accordingly, many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the appended claims. The disclosure of the present invention is intended to be illustrative, but not limiting, of the scope of the invention, which is defined by the appended claims.

Claims (10)

1. A storage device write control method, performed in an operating system of a computing device, the method comprising:
mounting a target file system of the storage device;
receiving an input operation at the target file system;
judging whether the input operation is a writing operation;
if the input operation is a write operation, execution of the input operation is prevented.
2. The method of claim 1, wherein determining whether the input operation is a write operation comprises:
analyzing the data packet corresponding to the input operation to obtain an operation code of the input operation;
and determining whether the input operation is a writing operation according to the operation code.
3. The method of claim 2, wherein the storage device is adapted for data transmission based on a first transmission protocol or a second transmission protocol; determining whether the input operation is a write operation according to the operation code includes:
judging whether the operation code is a preset operation code or not;
if the opcode is a predetermined opcode, then the input operation is determined to be a write operation.
4. The method of claim 2, wherein determining whether the input operation is a write operation based on the opcode comprises:
determining an operation command corresponding to the operation code, and judging whether the operation command is a writing command or not;
if the operation command is a write command, it is determined that the input operation is a write operation.
5. The method of claim 4, wherein determining the operation command to which the operation code corresponds comprises:
acquiring an operation mapping table, and determining an operation command corresponding to the operation code according to the operation mapping table;
the operation mapping table comprises a first operation code mapping table corresponding to a first transmission protocol and a second operation code mapping table corresponding to a second transmission protocol.
6. The method of claim 3 or 5, wherein,
the storage device is a USB storage device;
the first transmission protocol is an MTP protocol, and the second transmission protocol is a PTP protocol.
7. The method of claim 3, wherein,
the predetermined operation code includes 0x100d, 0x100c.
8. A write control apparatus for deployment in an operating system of a computing device, the apparatus comprising:
the mounting module is suitable for mounting a target file system of the storage device;
a receiving module adapted to receive an input operation at the target file system;
a judging module adapted to judge whether the input operation is a write operation;
a blocking module adapted to block execution of the input operation if the input operation is a write operation.
9. A computing device, comprising:
at least one processor; and
a memory storing program instructions, wherein the program instructions are configured to be adapted to be executed by the at least one processor, the program instructions comprising instructions for performing the method of any of claims 1-7.
10. A readable storage medium storing program instructions which, when read and executed by a computing device, cause the computing device to perform the method of any of claims 1-7.
CN202310195476.4A 2023-02-24 2023-02-24 Storage device write control method and device, computing device and storage medium Pending CN116167103A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310195476.4A CN116167103A (en) 2023-02-24 2023-02-24 Storage device write control method and device, computing device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310195476.4A CN116167103A (en) 2023-02-24 2023-02-24 Storage device write control method and device, computing device and storage medium

Publications (1)

Publication Number Publication Date
CN116167103A true CN116167103A (en) 2023-05-26

Family

ID=86418222

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310195476.4A Pending CN116167103A (en) 2023-02-24 2023-02-24 Storage device write control method and device, computing device and storage medium

Country Status (1)

Country Link
CN (1) CN116167103A (en)

Similar Documents

Publication Publication Date Title
US20230024083A1 (en) Method and System for Executing Applications Using Native Code Modules
US20060064576A1 (en) Boot systems and methods
US8271995B1 (en) System services for native code modules
CN107832099A (en) A kind of client release compatible method, apparatus and storage medium
US11281454B2 (en) Microcode update system
CN111079125A (en) Method and device for calling third-party library dynamic lifting authority by application program
CN113885936A (en) Solution method for software package dependence in customized mirror image
US9912454B2 (en) Systems and methods for efficient file transfer in a boot mode of a basic input/output system
CN114816772B (en) Debugging method, debugging system and computing device for application running based on compatible layer
CN111782474A (en) Log processing method and device, electronic equipment and medium
CN116167103A (en) Storage device write control method and device, computing device and storage medium
CN113254888B (en) Method for acquiring hardware information, authorization control system and computing equipment
CN114895969A (en) Operating system sleeping method and device, computing equipment and storage medium
US11966609B1 (en) Zoned namespace storage device system
CN113568879B (en) File attribute adding method, computing device and storage medium
CN114756291B (en) Hardware self-adaption method and device
CN118055064A (en) Route information synchronization method, device, computing equipment and storage medium
US20240231650A9 (en) Microservice storage device system
CN115185634A (en) Subsystem implementation method and computing device
US20240231677A9 (en) Reconfigurable microservice storage device system
CN117193791A (en) Method for checking compatibility between driving module and kernel, computing device and storage medium
CN118295905A (en) Debugging method and device of closed source software package, computing equipment and storage medium
CN115904953A (en) Test method, test device, computing equipment and storage medium
CN114879987A (en) Kernel upgrading and using method, computing device and storage medium
CN115185820A (en) Test method and test device for system installer and computing equipment

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