CN111078647B - Method and device for creating uncompressed file and testing magnetic disk and electronic equipment - Google Patents

Method and device for creating uncompressed file and testing magnetic disk and electronic equipment Download PDF

Info

Publication number
CN111078647B
CN111078647B CN201911158768.0A CN201911158768A CN111078647B CN 111078647 B CN111078647 B CN 111078647B CN 201911158768 A CN201911158768 A CN 201911158768A CN 111078647 B CN111078647 B CN 111078647B
Authority
CN
China
Prior art keywords
file
target
attribute
disk
compression
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
CN201911158768.0A
Other languages
Chinese (zh)
Other versions
CN111078647A (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.)
Beijing Antutu Technology Co ltd
Original Assignee
Beijing Antutu 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 Beijing Antutu Technology Co ltd filed Critical Beijing Antutu Technology Co ltd
Priority to CN201911158768.0A priority Critical patent/CN111078647B/en
Publication of CN111078647A publication Critical patent/CN111078647A/en
Application granted granted Critical
Publication of CN111078647B publication Critical patent/CN111078647B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/174Redundancy elimination performed by the file system
    • G06F16/1744Redundancy elimination performed by the file system using compression, e.g. sparse files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/22Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
    • G06F11/2273Test methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/172Caching, prefetching or hoarding of files

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention provides a method and a device for creating an uncompressed file, a disk test and electronic equipment, wherein the method for creating the uncompressed file comprises the following steps: creating a target file in a target disk, and storing a file handle of the target file; acquiring attribute information of the target file based on the file handle; and when the attribute information comprises the compression attribute, removing the compression attribute to obtain the non-compression file. By the method, the non-compressed file can be created in the disk under the condition that the compression attribute of the disk is not changed, and the disk test can be ensured to run normally.

Description

Method and device for creating uncompressed file and testing magnetic disk and electronic equipment
Technical Field
The present invention relates to the field of file processing technologies, and in particular, to a method and apparatus for creating an uncompressed file, and testing a disk, and an electronic device.
Background
When the user uses the electronic equipment, the system prompts the user to start the function of compressing the driver to save the disk space when the condition of insufficient disk space is met, or the user can actively start the function when worrying about the insufficient disk space of the electronic equipment. When this function is enabled, the folders with compression characteristics will be compressed, and the compression characteristics built into the system can effectively save disk space, but also have some negative effects.
For the compressed magnetic disk, when the read-write performance test is performed, the read-write performance of the magnetic disk is abnormal, so that the test is performed after the whole magnetic disk is decompressed, and the test efficiency is low. The modification of the volume compression attribute of the whole disk to the non-compression attribute can greatly affect the use of users and possibly lead to the loss of user data, so that proper technical means are adopted to ensure that the disk performance test program can normally run under the condition of not changing the disk compression attribute.
Disclosure of Invention
The embodiment of the invention aims to provide a method and a device for creating an uncompressed file, a disk test and electronic equipment, so that the uncompressed file is created in a disk under the condition that the compression attribute of the disk is not changed, and the disk test can be ensured to normally run. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present invention provides a method for creating an uncompressed file, where the method includes:
creating a target file in a target disk, and storing a file handle of the target file;
acquiring attribute information of the target file based on the file handle;
and when the attribute information comprises the compression attribute, removing the compression attribute to obtain the non-compression file.
Optionally, the step of creating the target file in the target disk and saving the file handle of the target file includes:
calling a file creation interface to create a target file at a preset storage position, wherein the preset storage position is a storage position in the target disk;
and acquiring a file handle of the target file returned by the system and storing the file handle in a memory.
Optionally, the step of acquiring attribute information of the target file based on the file handle includes:
and calling an attribute acquisition function to acquire the attribute information of the target file from the storage position indicated by the file handle.
Optionally, before the step of removing the compressed attribute when the attribute information includes the compressed attribute to obtain the uncompressed file, the method further includes:
judging whether the attribute information of the target file comprises a compression attribute or not;
and if so, executing the step of removing the compression attribute when the attribute information comprises the compression attribute to obtain the non-compression file.
Optionally, the step of determining whether the attribute information of the target file includes a compression attribute includes:
Judging whether the ATTRIBUTE information of the target FILE contains a file_attribute_complete_preset bit or not;
if so, determining that the attribute information of the target file comprises a compression attribute;
if not, determining that the attribute information of the target file does not include a compression attribute.
Optionally, the step of removing the compression attribute includes:
and calling a parameter transfer function, and transferring preset parameters to attribute information of the target file based on the storage position indicated by the file handle, wherein the preset parameters are used for indicating a system to prohibit enabling of a disk compression attribute on the target file.
In a second aspect, an embodiment of the present invention provides a disk testing method, where the method includes:
when a test instruction for a target disk is acquired, creating an uncompressed file in the target disk, wherein the uncompressed file is created by the method for creating the uncompressed file according to any one of the first aspect;
and testing the target disk based on the uncompressed file to obtain a test result.
In a third aspect, an embodiment of the present invention provides an apparatus for creating an uncompressed file, where the apparatus includes:
The file creating module is used for creating a target file in a target disk and storing a file handle of the target file;
the attribute information acquisition module is used for acquiring attribute information of the target file based on the file handle;
and the compressed attribute removing module is used for removing the compressed attribute when the attribute information comprises the compressed attribute to obtain the uncompressed file.
Optionally, the file creation module includes:
the file creating unit is used for calling a file creating interface to create a target file at a preset storage position, wherein the preset storage position is a storage position in the target disk;
and the file handle storage unit is used for acquiring the file handle of the target file returned by the system and storing the file handle in the memory.
Optionally, the attribute information acquisition module includes:
and the attribute information acquisition unit is used for calling an attribute acquisition function and acquiring the attribute information of the target file from the storage position indicated by the file handle.
Optionally, the apparatus further includes:
the compression attribute judging module is used for judging whether the attribute information of the target file comprises the compression attribute or not before the step of removing the compression attribute to obtain the non-compression file when the attribute information comprises the compression attribute;
And the triggering module is used for triggering the compressed attribute removing module if the attribute information of the target file comprises the compressed attribute.
Optionally, the compression attribute determining module includes:
the judging unit is used for judging whether the ATTRIBUTE information of the target FILE contains a file_attribute_compressed bit or not;
a first determining unit configured to determine that the ATTRIBUTE information of the target FILE includes a compression ATTRIBUTE if the file_attribute_compressed bit is included;
and a second determining unit, configured to determine that the ATTRIBUTE information of the target FILE does not include the compression ATTRIBUTE if the file_attribute_compressed bit is not included.
Optionally, the compression attribute removing module includes:
and the compression attribute removing unit is used for calling a parameter transferring function and transferring preset parameters to the attribute information of the target file based on the storage position indicated by the file handle, wherein the preset parameters are used for indicating a system to prohibit the enabling of the disk compression attribute on the target file.
In a fourth aspect, an embodiment of the present invention provides a disk testing apparatus, including:
the non-compressed file creating module is used for creating a non-compressed file in a target disk when a test instruction for the target disk is acquired, wherein the non-compressed file is created by the non-compressed file creating method according to any one of the first aspect;
And the disk test module is used for testing the target disk based on the uncompressed file to obtain a test result.
In a fifth aspect, an embodiment of the present invention provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete communication with each other through the communication bus;
a memory for storing a computer program;
a processor, configured to implement the method steps of creating an uncompressed file according to any one of the first aspect when executing a program stored in a memory.
In a sixth aspect, an embodiment of the present invention provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete communication with each other through the communication bus;
a memory for storing a computer program;
and the processor is used for realizing the steps of the disk testing method in the second aspect when executing the program stored in the memory.
In a seventh aspect, an embodiment of the present invention provides a computer readable storage medium having stored therein a computer program which, when executed by a processor, implements the method steps of creating an uncompressed file according to any one of the first aspects above.
In an eighth aspect, an embodiment of the present invention provides a computer readable storage medium, where a computer program is stored, where the computer program is executed by a processor to implement the steps of the disk testing method described in the second aspect.
In the scheme provided by the embodiment of the invention, the electronic equipment can create the target file in the target disk, store the file handle of the target file, acquire the attribute information of the target file based on the file handle, and remove the compression attribute when the attribute information comprises the compression attribute to obtain the non-compression file. By the method, the non-compressed file can be created in the disk under the condition that the compression attribute of the disk is not changed, and the disk test can be ensured to run normally.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flowchart of a method for creating an uncompressed file according to an embodiment of the present invention;
FIG. 2 is a specific flowchart of step S103 in the embodiment shown in FIG. 1;
FIG. 3 is a flow chart of a manner of determining compression properties based on the embodiment of FIG. 1;
FIG. 4 is a specific flowchart of step S301 in the embodiment shown in FIG. 3;
FIG. 5 is a flowchart of a method for testing a disk according to an embodiment of the present invention;
FIG. 6 is a schematic diagram of a device for creating an uncompressed file according to an embodiment of the present invention;
FIG. 7 is a schematic diagram of a disk testing apparatus according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present invention;
fig. 9 is a schematic structural diagram of another electronic 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 completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. 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.
In order to create an uncompressed file in a disk without changing the compression attribute of the disk and ensure that the disk test can run normally, embodiments of the present invention provide a method for creating an uncompressed file, a disk test method, a device, an electronic apparatus, and a computer readable storage medium.
The following describes a method for creating an uncompressed file according to an embodiment of the present invention.
The method for creating the uncompressed file provided by the embodiment of the invention can be applied to any electronic equipment, such as a computer, a processor, a tablet computer and the like, and is not particularly limited herein. For convenience of description, hereinafter, referred to as an electronic device. It should be noted that, the "file" herein may be a file or a folder.
As shown in fig. 1, a method for creating an uncompressed file, the method comprising:
s101, creating a target file in a target disk, and storing a file handle of the target file;
in this embodiment, a target file may be created in a target disk compressed volume, and a file handle of the target file may be saved;
s102, acquiring attribute information of the target file based on the file handle;
And S103, when the attribute information comprises the compression attribute, removing the compression attribute to obtain an uncompressed file.
Therefore, in the scheme provided by the embodiment of the invention, the electronic device can create the target file in the target disk, store the file handle of the target file, acquire the attribute information of the target file based on the file handle, and remove the compression attribute when the attribute information comprises the compression attribute to obtain the non-compression file. By the method, the non-compressed file can be created in the disk under the condition that the compression attribute of the disk is not changed, and the disk test can be ensured to run normally.
In the step S101, the electronic device may create the target file in the target disk, and in one embodiment, the electronic device may create the target file in the target disk compressed volume after the user compresses the target disk, for later use in performing the disk test. In another embodiment, it is reasonable that the electronic device may create a target file in the target disk for disk testing when a test instruction for the target disk is obtained.
The method for creating the target file in the target disk may be any file creation method in the file processing field, which is not specifically limited herein.
The electronic device may create the target file in the target disk, and then may save a file handle of the target file, where the file handle is used to indicate a creation location, that is, a storage location, of the target file, and is a pointer to the file storage location, and according to the storage location indicated by the file handle, the electronic device may find the target file.
Next, in order to determine whether the target file has a compression attribute, the electronic device may acquire attribute information of the target file based on the file handle, that is, perform step S102 described above. The attribute information is information capable of representing the attribute of the target file, and may include information such as a compression attribute, a file size, a creation time, a file type, and a security setting.
Furthermore, the electronic device can determine whether the attribute information of the target file includes a compression attribute, and when the attribute information includes the compression attribute, the attribute information indicates that the target file is a compression file, so that in order to ensure that the subsequent disk test can be performed smoothly, the electronic device can remove the compression attribute, and the non-compression file can be obtained. If the attribute information does not include the compression attribute, it is indicated as an uncompressed file, and the target file at this time is the uncompressed file to be created.
As shown in fig. 2, the step of creating the target file in the target disk and saving the file handle of the target file may include:
s201, a file creation interface is called to create a target file at a preset storage position;
when creating the target file, the electronic device may call a file creation interface to create the target file at a preset storage location. The preset storage position is any storage position in the target disk. In one embodiment, the electronic device may create the target file through a system underlying file IO interface, e.g., the target file may be created at a preset storage location in the target disk using a CreateFile interface.
S202, acquiring a file handle of the target file returned by the system, and storing the file handle in a memory.
After the target file is created, the system returns a file handle of the target file, and the file handle can be saved in the memory for later use.
It can be seen that, in this embodiment, the electronic device may call the file creation interface to create the target file at the preset storage location, obtain the file handle of the target file returned by the system, and store the file handle in the memory. Thus, the target file can be smoothly created in the target disk, and an accurate file handle can be obtained.
As an implementation manner of the embodiment of the present invention, the step of obtaining the attribute information of the target file based on the file handle may include:
and calling an attribute acquisition function to acquire the attribute information of the target file from the storage position indicated by the file handle.
When acquiring the attribute information of the target file, the electronic device may call an attribute acquisition function to acquire the attribute information of the target file from the storage location indicated by the file handle. In one embodiment, the electronic device may obtain the attribute information of the target file by calling the GetFileAttributes function through the system. The attribute information obtained through the GetFileAttributes function is shaped unsigned, so that the electronic equipment can conveniently operate.
After the electronic device obtains the attribute information of the target file, the attribute information can be stored in the program memory for subsequent use.
Therefore, in this embodiment, the electronic device may call the attribute obtaining function to obtain the attribute information of the target file from the storage location indicated by the file handle, where the obtained attribute information may facilitate subsequent operations, and ensure smooth creation of the uncompressed file.
As shown in fig. 3, before the step of removing the compressed attribute when the attribute information includes the compressed attribute to obtain the uncompressed file, the method further includes:
S301, judging whether attribute information of the target file comprises a compression attribute, and if so, executing step S302; if not, go to step S303;
after the electronic device obtains the attribute information of the target file, it may determine whether the target file includes a compression attribute, and if the target file includes the compression attribute, it indicates that the target file is a compressed file, and in order to obtain a non-compressed file, the electronic device may execute step S302. If the compression attribute is not included, indicating that the target file is a non-compressed file, step S303 may be performed.
S302, removing the compression attribute to obtain an uncompressed file.
Since the target file has the compression attribute at this time, the compression attribute of the target file can be removed, and thus the uncompressed file can be obtained.
S303, determining the target file as an uncompressed file.
Since the target file does not have the compression attribute at this time, it can be determined that the target file is an uncompressed file to be created.
It can be seen that, in this embodiment, before removing the compression attribute to obtain the non-compression file, the electronic device may determine whether the attribute information of the target file includes the compression attribute, and if so, execute the step of removing the compression attribute when the attribute information includes the compression attribute to obtain the non-compression file. In this way, it is possible to accurately and quickly determine whether the compression attribute of the target file needs to be removed.
As shown in fig. 4, the step of determining whether the attribute information of the target file includes the compression attribute may include:
s401, judging whether ATTRIBUTE information of the target FILE contains a file_ATTRIBUTE_COMPRESSIED bit; if so, step S402 is performed; if not, step S403 is performed.
If the ATTRIBUTE information of the FILE includes the file_attribute_compressed bit, it indicates that the FILE has a COMPRESSED ATTRIBUTE, so the electronic device may determine whether the ATTRIBUTE information of the target FILE includes the file_attribute_compressed bit, and if so, may execute step S402.
If the file_attribute_compressed bit is not included, it indicates that the target FILE does not have a compression ATTRIBUTE, and then step S403 may be performed.
S402, determining that the attribute information of the target file comprises compression attributes;
s403, determining that the attribute information of the target file does not comprise a compression attribute.
It can be seen that, in this embodiment, the electronic device may determine whether the ATTRIBUTE information of the target FILE includes a file_attribute_compressed bit, if so, determine that the ATTRIBUTE information of the target FILE includes a compression ATTRIBUTE, and if not, determine that the ATTRIBUTE information of the target FILE does not include a compression ATTRIBUTE. In this way, it can be accurately determined whether the attribute information of the target file includes the compression attribute.
As an implementation manner of the embodiment of the present invention, the step of removing the compression attribute may include:
and calling a parameter transfer function, and transferring preset parameters to the attribute information of the target file based on the storage position indicated by the file handle.
In the case that the target file has a compressed attribute, to remove the compressed attribute of the target file, the electronic device may call a parameter transfer function to transfer preset parameters to attribute information of the target file to instruct the system to disable enabling of the disk compressed attribute for the target file. The preset parameters are used for indicating that the system prohibits enabling the disk compression attribute to the target file.
Specifically, the electronic device may call the DeviceIoControl function through the disk bottom IO interface, and transfer the preset parameter communication_format_none to the attribute information of the target file based on the storage location indicated by the file handle of the target file, so that the target file will not be compressed in the target disk.
It can be seen that, in this embodiment, the electronic device may call the parameter transfer function, and transfer the preset parameter to the attribute information of the target file based on the storage location indicated by the file handle, so that the compressed attribute of the target file may be removed for use in the subsequent disk test.
Corresponding to the method for creating the uncompressed file, the embodiment of the invention also provides a disk testing method. The following describes a disk testing method provided by the embodiment of the invention.
As shown in fig. 5, a disk testing method, the method includes:
s501, when a test instruction for a target disk is acquired, creating an uncompressed file in the target disk;
the non-compressed file is created by the method for creating the non-compressed file according to any of the embodiments.
S502, testing the target disk based on the uncompressed file to obtain a test result.
Therefore, in the scheme provided by the embodiment of the invention, the electronic equipment can create the non-compressed file in the target disk when acquiring the test instruction aiming at the target disk, and then test the target disk based on the non-compressed file to obtain a test result. By the method, the non-compressed file can be created in the disk under the condition that the compression attribute of the disk is not changed, and the disk test can be ensured to run normally.
In the above step S501, when the electronic device acquires the test instruction for the target disk, an uncompressed file may be created in the target disk. The test instruction may be sent by the user through a preset user interface, for example, the electronic device may display a "start test" button in the interface, and when the user triggers the button, the test instruction sent by the user may be obtained.
In order to ensure smooth performance of the disk test, the electronic device may create an uncompressed file in the target disk, and the creation manner of the compressed file may be the method for creating an uncompressed file described in any of the foregoing embodiments, which is not described herein again.
Furthermore, the electronic equipment can test the target disk based on the uncompressed file to obtain a test result. The test on the target disk may be a read-write test, such as a sequential read-write, a random read-write speed test, a multithreaded file read-write test, and the like, which is not specifically limited herein. Because the electronic equipment tests the target disk based on the created non-compressed file, the problem of abnormal test does not occur, the disk test can be ensured to be smoothly carried out, and an accurate test result is obtained.
Corresponding to the above method for creating the uncompressed file, the embodiment of the invention also provides a device for creating the uncompressed file.
The following describes a device for creating an uncompressed file according to an embodiment of the present invention.
As shown in fig. 6, an apparatus for creating an uncompressed file, the apparatus comprising:
a file creation module 610, configured to create a target file in a target disk, and store a file handle of the target file;
An attribute information obtaining module 620, configured to obtain attribute information of the target file based on the file handle;
and the compressed attribute removing module 630 is configured to remove the compressed attribute when the attribute information includes the compressed attribute, so as to obtain an uncompressed file.
Therefore, in the scheme provided by the embodiment of the invention, the electronic device can create the target file in the target disk, store the file handle of the target file, acquire the attribute information of the target file based on the file handle, and remove the compression attribute when the attribute information comprises the compression attribute to obtain the non-compression file. By the method, the non-compressed file can be created in the disk under the condition that the compression attribute of the disk is not changed, and the disk test can be ensured to run normally.
As an implementation manner of the embodiment of the present invention, the file creation module 610 may include:
a file creation unit (not shown in fig. 6) for calling the file creation interface to create the target file at a preset storage location;
the preset storage position is a storage position in the target magnetic disk.
A file handle storage unit (not shown in fig. 6) for acquiring the file handle of the target file returned by the system, and storing the file handle in the memory.
As one implementation of the embodiment of the present invention, the attribute information obtaining module 620 may include:
an attribute information acquiring unit (not shown in fig. 6) for calling an attribute acquiring function to acquire attribute information of the target file from a storage location indicated by the file handle.
As an implementation manner of the embodiment of the present invention, the foregoing apparatus may further include:
a compression attribute judging module (not shown in fig. 6) for judging whether the attribute information of the target file includes a compression attribute before the step of removing the compression attribute when the compression attribute is included in the attribute information to obtain a non-compressed file;
a triggering module (not shown in fig. 6) for triggering the compressed attribute removal module if the attribute information of the target file includes a compressed attribute.
As an implementation manner of the embodiment of the present invention, the compression attribute determining module may include:
a judging unit (not shown in fig. 6) for judging whether the ATTRIBUTE information of the target FILE contains a file_attribute_predetermined bit;
a first determining unit (not shown in fig. 6) for determining that the ATTRIBUTE information of the target FILE includes a compression ATTRIBUTE if a file_attribute_compressed bit is included;
A second determining unit (not shown in fig. 6) for determining that the ATTRIBUTE information of the target FILE does not include a compression ATTRIBUTE if the file_attribute_compressed bit is not included.
As one implementation of the embodiment of the present invention, the compression attribute removing module 630 may include:
a compressed attribute removing unit (not shown in fig. 6) for calling a parameter transferring function, and transferring a preset parameter to the attribute information of the target file based on the storage location indicated by the file handle, wherein the preset parameter is used for indicating that the system prohibits enabling of the disk compressed attribute for the target file.
Corresponding to the disk testing method, the embodiment of the invention also provides a disk testing device. The following describes a disk testing apparatus provided in an embodiment of the present invention.
As shown in fig. 7, a disk testing apparatus, the apparatus comprising:
the uncompressed file creating module 710 is configured to create an uncompressed file in a target disk when a test instruction for the target disk is acquired;
the non-compressed file is created by the method for creating the non-compressed file according to any of the embodiments.
And a disk test module 720, configured to test the target disk based on the uncompressed file, to obtain a test result.
Therefore, in the scheme provided by the embodiment of the invention, the electronic equipment can create the non-compressed file in the target disk when acquiring the test instruction aiming at the target disk, and then test the target disk based on the non-compressed file to obtain a test result. By the method, the non-compressed file can be created in the disk under the condition that the compression attribute of the disk is not changed, and the disk test can be ensured to run normally.
The embodiment of the present invention further provides an electronic device, as shown in fig. 8, where the electronic device may include a processor 801, a communication interface 802, a memory 803, and a communication bus 804, where the processor 801, the communication interface 802, and the memory 803 complete communication with each other through the communication bus 804,
a memory 803 for storing a computer program;
the processor 801, when executing the program stored in the memory 803, implements the following steps:
creating a target file in a target disk, and storing a file handle of the target file;
acquiring attribute information of the target file based on the file handle;
and when the attribute information comprises the compression attribute, removing the compression attribute to obtain the non-compression file.
Therefore, in the scheme provided by the embodiment of the invention, the electronic device can create the target file in the target disk, store the file handle of the target file, acquire the attribute information of the target file based on the file handle, and remove the compression attribute when the attribute information comprises the compression attribute to obtain the non-compression file. By the method, the non-compressed file can be created in the disk under the condition that the compression attribute of the disk is not changed, and the disk test can be ensured to run normally.
The communication bus mentioned above for the electronic devices may be a peripheral component interconnect standard (Peripheral Component Interconnect, PCI) bus or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, etc. The communication bus may be classified as an address bus, a data bus, a control bus, or the like. For ease of illustration, the figures are shown with only one bold line, but not with only one bus or one type of bus.
The communication interface is used for communication between the electronic device and other devices.
The Memory may include random access Memory (Random Access Memory, RAM) or may include Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the aforementioned processor.
The processor may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc.; but also digital signal processors (Digital Signal Processing, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), field programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
As an implementation manner of the embodiment of the present invention, the step of creating the target file in the target disk and saving the file handle of the target file may include:
calling a file creation interface to create a target file at a preset storage position;
the preset storage position is a storage position in the target magnetic disk.
And acquiring a file handle of the target file returned by the system and storing the file handle in a memory.
As an implementation manner of the embodiment of the present invention, the step of obtaining the attribute information of the target file based on the file handle may include:
and calling an attribute acquisition function to acquire the attribute information of the target file from the storage position indicated by the file handle.
As an implementation manner of the embodiment of the present invention, before the step of removing the compressed attribute when the compressed attribute is included in the attribute information to obtain the uncompressed file, the method may further include:
judging whether the attribute information of the target file comprises a compression attribute or not;
and if so, executing the step of removing the compression attribute when the attribute information comprises the compression attribute to obtain the non-compression file.
As an implementation manner of the embodiment of the present invention, the step of determining whether the attribute information of the target file includes a compression attribute may include:
judging whether the ATTRIBUTE information of the target FILE contains a file_attribute_comppres SED bit or not;
if so, determining that the attribute information of the target file comprises a compression attribute;
if not, determining that the attribute information of the target file does not include a compression attribute.
As an implementation manner of the embodiment of the present invention, the step of removing the compression attribute may include:
transferring a parameter transferring function, and transferring preset parameters to attribute information of the target file based on a storage position indicated by the file handle;
The preset parameters are used for indicating a system to prohibit enabling of the disk compression attribute to the target file.
The embodiment of the present invention also provides another electronic device, as shown in fig. 9, the electronic device may include a processor 901, a communication interface 902, a memory 903, and a communication bus 904, where the processor 901, the communication interface 902, the memory 903 complete communication with each other through the communication bus 904,
a memory 903 for storing a computer program;
the processor 901 is configured to execute a program stored in the memory 903, and implement the following steps:
when a test instruction aiming at a target disk is acquired, creating an uncompressed file in the target disk;
the non-compressed file is created by the method for creating the non-compressed file according to any of the embodiments.
And testing the target disk based on the uncompressed file to obtain a test result.
Therefore, in the scheme provided by the embodiment of the invention, the electronic equipment can create the non-compressed file in the target disk when acquiring the test instruction aiming at the target disk, and then test the target disk based on the non-compressed file to obtain a test result. By the method, the non-compressed file can be created in the disk under the condition that the compression attribute of the disk is not changed, and the disk test can be ensured to run normally.
The communication bus mentioned above for the electronic devices may be a peripheral component interconnect standard (Peripheral Component Interconnect, PCI) bus or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, etc. The communication bus may be classified as an address bus, a data bus, a control bus, or the like. For ease of illustration, the figures are shown with only one bold line, but not with only one bus or one type of bus.
The communication interface is used for communication between the electronic device and other devices.
The Memory may include random access Memory (Random Access Memory, RAM) or may include Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the aforementioned processor.
The processor may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc.; but also digital signal processors (Digital Signal Processing, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), field programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
The embodiment of the invention also provides a computer readable storage medium, wherein the computer readable storage medium stores a computer program, and the computer program realizes the following steps when being executed by a processor:
creating a target file in a target disk, and storing a file handle of the target file;
acquiring attribute information of the target file based on the file handle;
and when the attribute information comprises the compression attribute, removing the compression attribute to obtain the non-compression file.
Therefore, in the scheme provided by the embodiment of the invention, when the computer program is executed by the processor, the target file can be created in the target disk, the file handle of the target file is stored, the attribute information of the target file is obtained based on the file handle, and then when the attribute information comprises the compression attribute, the compression attribute is removed, so that the non-compression file is obtained. By the method, the non-compressed file can be created in the disk under the condition that the compression attribute of the disk is not changed, and the disk test can be ensured to run normally.
As an implementation manner of the embodiment of the present invention, the step of creating the target file in the target disk and saving the file handle of the target file may include:
Calling a file creation interface to create a target file at a preset storage position;
the preset storage position is a storage position in the target magnetic disk.
And acquiring a file handle of the target file returned by the system and storing the file handle in a memory.
As an implementation manner of the embodiment of the present invention, the step of obtaining the attribute information of the target file based on the file handle may include:
and calling an attribute acquisition function to acquire the attribute information of the target file from the storage position indicated by the file handle.
As an implementation manner of the embodiment of the present invention, before the step of removing the compressed attribute when the compressed attribute is included in the attribute information to obtain the uncompressed file, the method may further include:
judging whether the attribute information of the target file comprises a compression attribute or not;
and if so, executing the step of removing the compression attribute when the attribute information comprises the compression attribute to obtain the non-compression file.
As an implementation manner of the embodiment of the present invention, the step of determining whether the attribute information of the target file includes a compression attribute may include:
Judging whether the ATTRIBUTE information of the target FILE contains a file_attribute_complete_preset bit or not;
if so, determining that the attribute information of the target file comprises a compression attribute;
if not, determining that the attribute information of the target file does not include a compression attribute.
As an implementation manner of the embodiment of the present invention, the step of removing the compression attribute may include:
transferring a parameter transferring function, and transferring preset parameters to attribute information of the target file based on a storage position indicated by the file handle;
the preset parameters are used for indicating a system to prohibit enabling of the disk compression attribute to the target file.
The embodiment of the invention also provides another computer readable storage medium, wherein the computer readable storage medium stores a computer program, and the computer program realizes the following steps when being executed by a processor:
when a test instruction aiming at a target disk is acquired, creating an uncompressed file in the target disk;
the non-compressed file is created by the method for creating the non-compressed file according to any of the embodiments.
And testing the target disk based on the uncompressed file to obtain a test result.
Therefore, in the scheme provided by the embodiment of the invention, when the computer program is executed by the processor, the non-compressed file can be created in the target disk when the test instruction for the target disk is acquired, and then the target disk is tested based on the non-compressed file, so that a test result is obtained. By the method, the non-compressed file can be created in the disk under the condition that the compression attribute of the disk is not changed, and the disk test can be ensured to run normally.
It should be noted that, for the apparatus, electronic device and computer readable storage medium embodiments described above, the description is relatively simple, and the relevant points are referred to in the description of the method embodiments, since they are basically similar to the corresponding method embodiments.
It is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
In this specification, each embodiment is described in a related manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments.
The foregoing description is only of the preferred embodiments of the present invention and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.

Claims (14)

1. A method of creating an uncompressed file, the method comprising:
creating a target file in a target disk, and storing a file handle of the target file; wherein creating the target file in the target disk comprises: after a user compresses a target disk, creating a target file in the target disk compression volume; when a test instruction for a target disk is acquired, creating a target file in the target disk;
acquiring attribute information of the target file based on the file handle;
when the attribute information comprises a compression attribute, removing the compression attribute to obtain an uncompressed file;
before the step of removing the compressed attribute when the compressed attribute is included in the attribute information to obtain the uncompressed file, the method further includes:
Judging whether the attribute information of the target file comprises a compression attribute or not;
if yes, executing the step of removing the compression attribute when the attribute information comprises the compression attribute to obtain an uncompressed file;
the judging whether the attribute information of the target file includes a compression attribute includes:
judging whether the ATTRIBUTE information of the target FILE contains a file_attribute_complete_complete bit or not;
if so, determining that the attribute information of the target file comprises a compression attribute;
if not, determining that the attribute information of the target file does not include a compression attribute.
2. The method of claim 1, wherein the creating a target file in a target disk and saving a file handle for the target file comprises:
calling a file creation interface to create a target file at a preset storage position, wherein the preset storage position is a storage position in the target disk;
and acquiring a file handle of the target file returned by the system and storing the file handle in a memory.
3. The method of claim 1, wherein the step of acquiring attribute information of the target file based on the file handle comprises:
And calling an attribute acquisition function to acquire the attribute information of the target file from the storage position indicated by the file handle.
4. A method according to any one of claims 1-3, wherein the step of removing the compression attribute comprises:
and calling a parameter transfer function, and transferring preset parameters to attribute information of the target file based on the storage position indicated by the file handle, wherein the preset parameters are used for indicating a system to prohibit enabling of a disk compression attribute on the target file.
5. A method of disk testing, the method comprising:
creating an uncompressed file in a target disk when a test instruction for the target disk is acquired, the uncompressed file being created by the method for creating an uncompressed file according to any one of claims 1 to 4;
and testing the target disk based on the uncompressed file to obtain a test result.
6. An apparatus for creating an uncompressed file, the apparatus comprising:
the file creating module is used for creating a target file in a target disk and storing a file handle of the target file; wherein creating the target file in the target disk comprises: after a user compresses a target disk, creating a target file in the target disk compression volume; when a test instruction for a target disk is acquired, creating a target file in the target disk;
The attribute information acquisition module is used for acquiring attribute information of the target file based on the file handle;
the compression attribute removing module is used for removing the compression attribute when the attribute information comprises the compression attribute to obtain an uncompressed file;
the apparatus further comprises:
the compression attribute judging module is used for judging whether the attribute information of the target file comprises the compression attribute or not before the step of removing the compression attribute to obtain the non-compression file when the attribute information comprises the compression attribute;
the triggering module is used for triggering the compressed attribute removing module if the attribute information of the target file comprises a compressed attribute;
the compression attribute judging module includes:
the judging unit is used for judging whether the attribute information of the target FILE contains a file_ATTRIBU TE_COMPRESSED bit or not;
a first determining unit configured to determine that the ATTRIBUTE information of the target FILE includes a compression ATTRIBUTE if the file_attribute_compressed bit is included;
and a second determining unit, configured to determine that the ATTRIBUTE information of the target FILE does not include the compression ATTRIBUTE if the file_attribute_compressed bit is not included.
7. The apparatus of claim 6, wherein the file creation module comprises:
The file creating unit is used for calling a file creating interface to create a target file at a preset storage position, wherein the preset storage position is a storage position in the target disk;
and the file handle storage unit is used for acquiring the file handle of the target file returned by the system and storing the file handle in the memory.
8. The apparatus of claim 6, wherein the attribute information acquisition module comprises:
and the attribute information acquisition unit is used for calling an attribute acquisition function and acquiring the attribute information of the target file from the storage position indicated by the file handle.
9. The apparatus of any of claims 6-8, wherein the compression attribute removal module comprises:
and the compression attribute removing unit is used for calling a parameter transferring function and transferring preset parameters to the attribute information of the target file based on the storage position indicated by the file handle, wherein the preset parameters are used for indicating a system to prohibit the enabling of the disk compression attribute on the target file.
10. A disk testing apparatus, the apparatus comprising:
a non-compressed file creating module for creating a non-compressed file in a target disk when a test instruction for the target disk is acquired, the non-compressed file being created by the non-compressed file creating apparatus according to any one of claims 6 to 9;
And the disk test module is used for testing the target disk based on the uncompressed file to obtain a test result.
11. The electronic equipment is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus;
a memory for storing a computer program;
a processor for carrying out the method steps of any one of claims 1-4 when executing a program stored on a memory.
12. The electronic equipment is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of claim 5 when executing a program stored on a memory.
13. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored therein a computer program which, when executed by a processor, implements the method steps of any of claims 1-4.
14. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored therein a computer program which, when executed by a processor, implements the method steps of claim 5.
CN201911158768.0A 2019-11-22 2019-11-22 Method and device for creating uncompressed file and testing magnetic disk and electronic equipment Active CN111078647B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911158768.0A CN111078647B (en) 2019-11-22 2019-11-22 Method and device for creating uncompressed file and testing magnetic disk and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911158768.0A CN111078647B (en) 2019-11-22 2019-11-22 Method and device for creating uncompressed file and testing magnetic disk and electronic equipment

Publications (2)

Publication Number Publication Date
CN111078647A CN111078647A (en) 2020-04-28
CN111078647B true CN111078647B (en) 2023-09-22

Family

ID=70311365

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911158768.0A Active CN111078647B (en) 2019-11-22 2019-11-22 Method and device for creating uncompressed file and testing magnetic disk and electronic equipment

Country Status (1)

Country Link
CN (1) CN111078647B (en)

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH07319743A (en) * 1994-05-30 1995-12-08 Toshiba Corp File compression management system
CN101373436A (en) * 2008-09-05 2009-02-25 四川登巅微电子有限公司 Method for automatically compressing and de-compressing data on U disk
CN102855435A (en) * 2011-06-27 2013-01-02 奇智软件(北京)有限公司 File unlocking and shredding method and device
CN102855436A (en) * 2011-06-27 2013-01-02 奇智软件(北京)有限公司 File unlocking method and file unlocking device
CN104394228A (en) * 2014-12-08 2015-03-04 浪潮(北京)电子信息产业有限公司 Storage method and device for file system
CN104732142A (en) * 2011-06-27 2015-06-24 北京奇虎科技有限公司 Method and device for unlocking file
CN106909398A (en) * 2017-03-10 2017-06-30 深圳创维-Rgb电子有限公司 The compression method and device of a kind of executable file
CN108108394A (en) * 2017-11-28 2018-06-01 厦门市美亚柏科信息股份有限公司 The compressed file restoration methods and storage medium of APFS file system
CN108874611A (en) * 2017-05-12 2018-11-23 北京金山云网络技术有限公司 A kind of construction method and device of test data
CN109918346A (en) * 2019-02-27 2019-06-21 苏州浪潮智能科技有限公司 A kind of creation method and device of file
CN110347643A (en) * 2019-07-22 2019-10-18 成都易我科技开发有限责任公司 NTFS volume cloning process and device between a kind of disk

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7761432B2 (en) * 2005-11-04 2010-07-20 Oracle America, Inc. Inheritable file system properties
JP5037952B2 (en) * 2007-01-15 2012-10-03 株式会社日立製作所 Storage system and storage system control method

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH07319743A (en) * 1994-05-30 1995-12-08 Toshiba Corp File compression management system
CN101373436A (en) * 2008-09-05 2009-02-25 四川登巅微电子有限公司 Method for automatically compressing and de-compressing data on U disk
CN102855435A (en) * 2011-06-27 2013-01-02 奇智软件(北京)有限公司 File unlocking and shredding method and device
CN102855436A (en) * 2011-06-27 2013-01-02 奇智软件(北京)有限公司 File unlocking method and file unlocking device
CN104732142A (en) * 2011-06-27 2015-06-24 北京奇虎科技有限公司 Method and device for unlocking file
CN104394228A (en) * 2014-12-08 2015-03-04 浪潮(北京)电子信息产业有限公司 Storage method and device for file system
CN106909398A (en) * 2017-03-10 2017-06-30 深圳创维-Rgb电子有限公司 The compression method and device of a kind of executable file
CN108874611A (en) * 2017-05-12 2018-11-23 北京金山云网络技术有限公司 A kind of construction method and device of test data
CN108108394A (en) * 2017-11-28 2018-06-01 厦门市美亚柏科信息股份有限公司 The compressed file restoration methods and storage medium of APFS file system
CN109918346A (en) * 2019-02-27 2019-06-21 苏州浪潮智能科技有限公司 A kind of creation method and device of file
CN110347643A (en) * 2019-07-22 2019-10-18 成都易我科技开发有限责任公司 NTFS volume cloning process and device between a kind of disk

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
快速实用的磁盘文件压缩软件包;蔡卫东, 陈道灼;福建电脑(第02期);31-32 *

Also Published As

Publication number Publication date
CN111078647A (en) 2020-04-28

Similar Documents

Publication Publication Date Title
US9128615B2 (en) Storage systems that create snapshot queues
WO2017083207A1 (en) Digital assistant setting up device
CN106528791B (en) A kind of method and device of sending out notice message
CN108063818B (en) Data downloading method, device, terminal and computer readable storage medium
CN110069739B (en) Page preloading method and device
CN112729868A (en) Vehicle diagnosis method, device, equipment and medium
CN111104157A (en) Mass production method and device of storage equipment, storage medium and electronic equipment
CN105323748B (en) Test error uploading method and device
CN103164492A (en) File copying method between electronic devices and electronic devices
CN111078647B (en) Method and device for creating uncompressed file and testing magnetic disk and electronic equipment
CN113031871A (en) Data adding and aggregating method and device, electronic equipment and readable storage medium
CN114968753A (en) Equipment upgrading test method, medium, electronic equipment and test system
CN110019040B (en) Folder processing method, mobile terminal and storage medium
CN103902445A (en) Regression test object determination method and device
CN111666020B (en) Method and device for switching document pages, electronic equipment and storage medium
CN114564210A (en) Copy deployment method, device, system, electronic equipment and storage medium
CN108845845B (en) Shortcut key creation method and device, electronic equipment and storage medium
CN113051105A (en) Data processing method, device, equipment and storage medium
CN107948936B (en) Smart city roadside parking method and related product
CN105631318A (en) Method and device for acquiring registry key values
CN111767699B (en) Cell processing method and device
CN112579805A (en) Image searching method and device, electronic equipment and storage medium
CN110874246A (en) Module loading method, system and equipment
CN111832262B (en) Document processing method and device, electronic equipment and storage medium
CN110543623B (en) PDF document display method and device

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