Optical disc file checking method, optical disc recording method and computing device

文档序号:152810 发布日期:2021-10-26 浏览:25次 中文

阅读说明:本技术 一种光盘文件校验方法、光盘刻录方法及计算设备 (Optical disc file checking method, optical disc recording method and computing device ) 是由 张升 徐诗筒 吕伍军 于 2021-07-27 设计创作,主要内容包括:本发明公开了一种光盘文件校验方法,包括步骤:创建光盘文件系统,将每个待刻录文件拷贝到所述光盘文件系统;在光盘文件系统中定位到元数据区域;修改所述元数据区域中的光盘文件系统元数据,以构建新的数据结构体,基于新的数据结构体存储每个待刻录文件的第一摘要值;将所述光盘文件系统中的每个待刻录文件刻录到光盘上,得到与每个待刻录文件相对应的已刻录文件;基于相应的待刻录文件的第一摘要值,来对每个已刻录文件的第二摘要值进行校验,以确定校验失败的一个或多个已刻录文件。本发明还一并公开了相应的光盘刻录方法及计算设备。本发明的光盘文件校验方法,能够在光盘所有已刻录文件中精准定位到出现异常的出现异常的一个或多个文件。(The invention discloses a method for checking an optical disc file, which comprises the following steps: creating an optical disc file system, and copying each file to be recorded to the optical disc file system; locating a metadata area in an optical disc file system; modifying the metadata of the optical disc file system in the metadata area to construct a new data structure body, and storing a first abstract value of each file to be recorded based on the new data structure body; recording each file to be recorded in the optical disc file system on an optical disc to obtain a recorded file corresponding to each file to be recorded; and verifying the second digest value of each recorded file based on the first digest value of the corresponding file to be recorded so as to determine one or more recorded files which fail to be verified. The invention also discloses a corresponding optical disc recording method and a corresponding computing device. The method for verifying the optical disc file can accurately position one or more abnormal files in all recorded files of the optical disc.)

1. An optical disc file verification method, executed in a computing device, includes the steps of:

creating an optical disc file system, and copying each file to be recorded to the optical disc file system;

locating a metadata area (PSPACE) in the optical disc file system;

modifying the metadata of the optical disc file system in the metadata area to construct a new data structure body, and storing a first abstract value of each file to be recorded based on the new data structure body;

recording each file to be recorded in the optical disc file system on an optical disc to obtain a recorded file corresponding to each file to be recorded; and

and verifying the second digest value of each recorded file based on the first digest value of the corresponding file to be recorded so as to determine one or more recorded files which fail to be verified.

2. The method of claim 1, wherein storing the first digest value of each file to be burned based on the new data structure comprises:

traversing each file to be recorded in a local file directory, calculating a first abstract value of each file to be recorded, and storing the first abstract value of each file to be recorded in an internal memory;

modifying an extensible field in a disc file system file entry of the metadata region to construct a new data structure, the new data structure including a variable;

and copying each first abstract value in the memory into the variable of the new data structure body.

3. The method according to claim 1 or 2, wherein the step of verifying the second digest value of each recorded file comprises:

traversing each recorded file, and calculating a second abstract value of each recorded file;

acquiring a first abstract value of a file to be recorded corresponding to the recorded file from a new data structure body;

and comparing the second abstract value of the recorded file with the first abstract value of the corresponding file to be recorded, if the second abstract value of the recorded file is the same as the first abstract value of the corresponding file to be recorded, the verification is successful, and if the second abstract value of the recorded file is different from the first abstract value of the file to be recorded, the verification fails.

4. The method of claim 3, wherein traversing each recorded file comprises:

locating a metadata area in the optical disc file system, locating a root file entry (RootFE) in the metadata area;

traversing each file identification descriptor (F ID) under the root file entry, and judging whether the type corresponding to the file entry pointed by the file identification descriptor is a file or a directory;

if the file entry is a directory, traversing each file identifier descriptor under the directory corresponding to the file entry, and judging whether the type corresponding to the file entry pointed by each file identifier descriptor is a file or a directory;

if the type corresponding to the file identification descriptor is a file, locating a file entry pointed by the file identification descriptor, and reading binary data of the recorded file corresponding to the file entry.

5. The method according to any of claims 1-4, wherein after verifying the second digest value of each recorded file, further comprising the steps of:

if the verification fails, recording the recorded file information which fails to verify;

and generating an abnormal file list based on the recorded information of the one or more recorded files.

6. The method of any of claims 1-5, wherein creating the optical disc file system comprises:

calculating the total capacity and the number of files to be recorded, and determining the reserved space of the optical disk file system according to the total capacity and the number of the files to be recorded;

and creating a corresponding blank file based on the reserved space, and formatting the blank file to obtain the optical disc file system.

7. The method according to any of claims 1-6, wherein the step of copying each file to be inscribed to the optical disc file system comprises:

mounting the optical disc file system to a predetermined directory of the operating system;

copying each file to be recorded under a local file directory to the preset directory;

and unloading the optical disk file system to obtain the optical disk file system containing each file to be recorded.

8. An optical disc recording method, executed in a computing device, comprising the steps of:

creating an optical disc file system, and copying each file to be recorded to the optical disc file system;

locating a metadata area (PSPACE) in the optical disc file system;

modifying the metadata of the optical disc file system in the metadata area to construct a new data structure body, and storing a first abstract value of each file to be recorded based on the new data structure body; and

and recording each file to be recorded in the optical disk file system on the optical disk to obtain a recorded file corresponding to each file to be recorded.

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-8.

10. A readable storage medium storing program instructions that, when read and executed by a computing device, cause the computing device to perform the method of any of claims 1-8.

Technical Field

The present invention relates to the field of computer technologies, and in particular, to a method for checking an optical disc file, a method for recording an optical disc, and a computing device.

Background

Recording files into an optical disc is a common data storage method, and common optical disc file systems include ISO9660 and UDF file systems. The Windows operating system provides a recording mode based on the UDF file system for a user by default, and the UOS operating system also supports the recording mode based on the UDF file system.

In the scheme of recording based on the UDF file system, various abnormal situations may occur, which may result in that the user cannot acquire the file data in the optical disc, or the acquired file data is incorrect, for example: in the recording process, the optical drive cannot correctly write binary data to be recorded prepared by an operating system into an optical disc due to some physical factors (vibration, temperature, power supply and the like), so that randomly written data is disordered; the recorded data area is lost due to the bad storage of the recorded optical disc (the optical disc is rubbed, illuminated, etc.); the driver and recording program between different operating systems may have factors such as BUG, non-uniform code implementation of UDF standard, etc., and users may cause the data of optical disc file to be covered and encroached when recording in different operating system platforms alternately, thereby destroying the file data.

In summary, the UDF data storage disc is characterized by two main anomalies: UDF file system metadata corruption, file data corruption stored in the UDF file system. The phenomenon of metadata damage in the UDF file system is very noticeable, and usually shows that the optical disc cannot be mounted on a directory tree of an operating system, so that a user cannot see any content of a file in the optical disc, and the operating system gives a corresponding prompt to the user. The present invention is directed to the second situation, after the file data stored in the UDF file system is damaged, the optical disc can still be correctly mounted on the directory tree of the operating system, so that the operating system and the user cannot directly identify that the file in the optical disc is abnormal, and only when the user uses the file recorded in the optical disc, the user may find that the file is damaged, and since the files stored in the optical disc are all very important data, the user is likely to bring serious consequences.

In the prior art, a file manager of the UOS operating system can perform data verification on a recorded optical disc, which is implemented based on open source software xorriso, and mainly checks the integrity of data in each block (2048 bytes) by traversing each block of the optical disc, and if the data of all the blocks are complete, the optical disc is normal, otherwise, the verification fails. However, existing verification techniques such as the one provided by xorriso suffer from the following problems: on one hand, only the data of the optical disk of the ISO9660 file system can be verified, and because the data verification is closely related to the file system, software for verifying the data of the optical disk of the UDF file system does not exist in the current Linux system; on the other hand, the verification is not accurate enough, the xorriso verification is performed on the whole optical disc, the verification on the metadata of the file system is included, which is unimportant to the user, the user only cares whether a specific certain file is correct, that is, the result of the xorriso verification on the data of the optical disc only can obtain the result whether the data of the whole optical disc is normal, which file on the optical disc is abnormal cannot be accurately obtained, and the user can only re-write all files when the abnormality occurs, so that not only is the time wasted, but also the waste of the optical disc resources is caused.

Based on this, a method for checking an optical disc file is needed to solve the problems in the above technical solutions.

Disclosure of Invention

To this end, the present invention provides an optical disc file verification method in an attempt to solve or at least alleviate the above-existing problems.

According to an aspect of the present invention, there is provided an optical disc file verification method, including the steps of: creating an optical disc file system, and copying each file to be recorded to the optical disc file system; locating a metadata area (PSPACE) in the optical disc file system; modifying the metadata of the optical disc file system in the metadata area to construct a new data structure body, and storing a first abstract value of each file to be recorded based on the new data structure body; recording each file to be recorded in the optical disc file system on an optical disc to obtain a recorded file corresponding to each file to be recorded; and verifying the second digest value of each recorded file based on the first digest value of the corresponding file to be recorded so as to determine one or more recorded files which fail to be verified.

Optionally, in the method for verifying an optical disc file according to the present invention, the step of storing the first digest value of each file to be recorded based on the new data structure includes: traversing each file to be recorded in a local file directory, calculating a first abstract value of each file to be recorded, and storing the first abstract value of each file to be recorded in an internal memory; modifying an extensible field in a disc file system file entry of the metadata region to construct a new data structure, the new data structure including a variable; and copying each first abstract value in the memory into the variable of the new data structure body.

Optionally, in the method for verifying an optical disc file according to the present invention, the step of verifying the second digest value of each recorded file includes: traversing each recorded file, and calculating a second abstract value of each recorded file; acquiring a first abstract value of a file to be recorded corresponding to the recorded file from a new data structure body; and comparing the second abstract value of the recorded file with the first abstract value of the corresponding file to be recorded, if the second abstract value of the recorded file is the same as the first abstract value of the corresponding file to be recorded, the verification is successful, and if the second abstract value of the recorded file is different from the first abstract value of the file to be recorded, the verification fails.

Optionally, in the method for verifying an optical disc file according to the present invention, the step of traversing each recorded file includes:

locating a metadata area in the optical disc file system, locating a root file entry (RootFE) in the metadata area; traversing each File Identifier Descriptor (FID) under the root file entry, and judging whether the type corresponding to the file entry pointed by the file identifier descriptor is a file or a directory; if the file entry is a directory, traversing each file identifier descriptor under the directory corresponding to the file entry, and judging whether the type corresponding to the file entry pointed by each file identifier descriptor is a file or a directory; if the type corresponding to the file identification descriptor is a file, locating a file entry pointed by the file identification descriptor, and reading binary data of the recorded file corresponding to the file entry.

Optionally, in the method for verifying an optical disc file according to the present invention, after verifying the second digest value of each recorded file, the method further includes the steps of: if the verification fails, recording the recorded file information which fails to verify; and generating an abnormal file list based on the recorded information of the one or more recorded files.

Optionally, in the optical disc file verification method according to the present invention, the step of creating the optical disc file system includes: calculating the total capacity and the number of files to be recorded, and determining the reserved space of the optical disk file system according to the total capacity and the number of the files to be recorded; and creating a corresponding blank file based on the reserved space, and formatting the blank file to obtain the optical disc file system.

Optionally, in the method for verifying an optical disc file according to the present invention, the step of copying each file to be recorded to the optical disc file system includes: mounting the optical disc file system to a predetermined directory of the operating system; copying each file to be recorded under a local file directory to the preset directory; and unloading the optical disk file system to obtain the optical disk file system containing each file to be recorded.

Optionally, in the method for checking an optical disc file according to the present invention, the step of locating the metadata area in the optical disc file system includes: locating a to-Aim Volume Description Pointer (AVDP) in the optical disc file system; reading an MVDS value from the aiming point volume description pointer, wherein the MVDS value comprises the position and the length of an MVDS area; positioning to an MVDS area based on the MVDS value, wherein the MVDS area comprises key metadata; locating to the metadata region based on the key metadata.

Optionally, in the method for checking an optical disc file according to the present invention, the number of metadata in the MVDS area is determined based on the length of the MVDS area; traversing each block of the MVDS area, converting the block into a first structure object (tag) for each block, and acquiring a value of the first structure object; if the value of the first structure object is a preset value, converting the block into a second structure object, and acquiring the value of the second structure object as the key metadata; locating to the metadata region based on the value of the second structure object.

Optionally, in the method for checking an optical disc file according to the present invention, the digest value is an MD5 value, and the variable is an MD5 variable.

Optionally, in the method for checking an optical disc file according to the present invention, the optical disc file system is a UDF file system.

According to an aspect of the present invention, there is provided an optical disc recording method, executed in a computing device, comprising the steps of: creating an optical disc file system, and copying each file to be recorded to the optical disc file system; locating a metadata area (PSPACE) in the optical disc file system; modifying the metadata of the optical disc file system in the metadata area to construct a new data structure body, and storing a first abstract value of each file to be recorded based on the new data structure body; and recording each file to be recorded in the optical disc file system on the optical disc to obtain a recorded file corresponding to each file to be recorded.

Alternatively, in the optical disc recording method according to the present invention, the step of creating the optical disc file system includes: calculating the total capacity and the number of files to be recorded, and determining the reserved space of the optical disk file system according to the total capacity and the number of the files to be recorded; and creating a corresponding blank file based on the reserved space, and formatting the blank file to obtain the optical disc file system.

Optionally, in an optical disc recording method according to the present invention, the step of copying each file to be recorded to the optical disc file system includes: mounting the optical disc file system to a predetermined directory of the operating system; copying each file to be recorded under a local file directory to the preset directory; and unloading the optical disk file system to obtain the optical disk file system containing each file to be recorded.

According to an aspect of the present invention, there is provided a computing device comprising: at least one processor; and a memory storing program instructions, wherein the program instructions are configured to be executed by the at least one processor, the program instructions comprising instructions for performing the optical disc file verification method as described above.

According to an aspect of the present invention, there is provided a readable storage medium storing program instructions which, when read and executed by a computing device, cause the computing device to perform the method as described above.

According to the technical scheme of the invention, the invention provides an optical disc file verification method and a corresponding optical disc recording method, wherein a new data structure body is constructed by modifying the data structure of metadata of an optical disc file system when an optical disc is recorded, and the first MD5 value of each file to be recorded can be stored based on the new data structure body. Therefore, after recording is finished, the second MD5 value of each recorded file can be verified based on the first MD5 value stored by the new data structure, and one or more abnormal files can be accurately positioned in all recorded files of the optical disc, so that the reliability of the recorded files is enhanced. And moreover, the file of the UDF file system is verified in the Linux operating system.

Furthermore, the recorded file is subjected to MD5 verification by directly positioning the binary data of the recorded file of the optical disc, so that the interference of other data is not received, and the verification accuracy is ensured.

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 are indicative of various ways in which the principles disclosed herein may be practiced, and all aspects and equivalents thereof are intended to be within the scope of the claimed subject matter. The above and other objects, features and advantages of the present disclosure will become more apparent from the following detailed description read in conjunction with the accompanying drawings. Throughout this disclosure, like reference numerals generally refer to like parts or elements.

FIG. 1 shows a schematic diagram of a computing device 100, according to one embodiment of the invention;

FIG. 2 shows a flow chart of a method 200 for verifying an optical disc file according to an embodiment of the invention;

FIG. 3 illustrates a schematic diagram of a sequential media disc metadata space structure according to one embodiment of the present invention;

FIG. 4 shows a flow diagram for locating to a metadata area PSPACE according to one embodiment of the invention;

FIG. 5 shows a schematic spatial structure of a metadata area PSPACE according to an embodiment of the invention;

FIG. 6 shows a flowchart for verifying a recorded file according to an embodiment of the present invention; and

fig. 7 shows a flowchart of an optical disc recording method 700 according to an embodiment of the present 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 is a schematic block diagram of an example computing device 100.

As shown in FIG. 1, in a basic configuration 102, a computing device 100 typically includes a system memory 106 and one or more processors 104. A memory bus 108 may be used for communication between the processor 104 and the system memory 106.

Depending on the desired configuration, the processor 104 may be any type of processing, including but not limited to: a microprocessor (UP), a microcontroller (UC), a digital information processor (DSP), or any combination thereof. The processor 104 may include one or more levels of cache, such as a level one cache 110 and a level two cache 112, a processor core 114, and registers 116. The example processor core 114 may include an Arithmetic Logic Unit (ALU), a Floating Point Unit (FPU), a digital signal processing core (DSP core), or any combination thereof. The example memory controller 118 may be used with the processor 104, or in some implementations the memory controller 118 may be an internal part of the processor 104.

Depending on the desired configuration, system memory 106 may be any type of memory, including but not limited to: volatile memory (such as RAM), non-volatile memory (such as ROM, flash memory, etc.), or any combination thereof. System memory 106 may include an operating system 120, one or more applications 122, and program data 124. In some implementations, the application 122 can be arranged to execute instructions on an operating system with program data 124 by one or more processors 104.

Computing device 100 also includes a storage device 132, storage device 132 including removable storage 136 and non-removable storage 138.

Computing device 100 may also include a storage interface bus 134. The storage interface bus 134 enables communication from the storage devices 132 (e.g., removable storage 136 and non-removable storage 138) to the basic configuration 102 via the bus/interface controller 130. At least a portion of the operating system 120, applications 122, and data 124 may be stored on removable storage 136 and/or non-removable storage 138, and loaded into system memory 106 via storage interface bus 134 and executed by the one or more processors 104 when the computing device 100 is powered on or the applications 122 are to be executed.

Computing device 100 may also include an interface bus 140 that facilitates communication from various interface devices (e.g., output devices 142, peripheral interfaces 144, and communication devices 146) to the basic configuration 102 via the bus/interface controller 130. The example output device 142 includes a graphics processing unit 148 and an audio processing unit 150. They may be configured to facilitate communication with various external devices, such as a display or speakers, via one or more a/V ports 152. Example peripheral interfaces 144 may include a serial interface controller 154 and a parallel interface controller 156, which may be configured to facilitate communication with external devices such as input devices (e.g., keyboard, mouse, pen, voice input device, touch input device) or other peripherals (e.g., printer, scanner, etc.) via one or more I/O ports 158. An example communication device 146 may include a network controller 160, which may be arranged to facilitate communications with one or more other computing devices 162 over a network communication link via one or more communication ports 164.

A network communication link may be one example of a communication medium. Communication media may typically be embodied by computer readable instructions, data structures, program modules, and may include any information delivery media, such as carrier waves or other transport mechanisms, in a modulated data signal. A "modulated data signal" may be a signal that has one or more of its data set or its changes made in a manner that encodes information in the signal. By way of non-limiting example, communication media may include wired media such as a wired network or private-wired network, and various wireless media such as acoustic, Radio Frequency (RF), microwave, Infrared (IR), or other wireless media. The term computer readable media as used herein may include both storage media and communication media.

Computing device 100 may be implemented as a personal computer including both desktop and notebook computer configurations. Of course, computing device 100 may also be implemented as part of a small-form factor portable (or mobile) electronic device such as a cellular telephone, a digital camera, a Personal Digital Assistant (PDA), a personal media player device, a wireless web-watch device, a personal headset, an application specific device, or a hybrid device that include any of the above functions. And may even be implemented as a server, such as a file server, a database server, an application server, a WEB server, and so forth. The embodiments of the present invention are not limited thereto.

In an embodiment according to the invention, the computing device 100 is configured to perform an optical disc file verification method 200 according to the invention. The operating system of the computing device 100 contains a plurality of program instructions for executing the optical disc file verification method 200 of the present invention, so that the optical disc file verification method 200 of the present invention can be executed in the operating system of the computing device 100.

Fig. 2 shows a flowchart of a method 200 for verifying an optical disc file according to an embodiment of the present invention. The optical disc file verification method 200 may be executed in an operating system of a computing device (e.g., the computing device 100 described above).

According to one embodiment of the invention, the operating system of the computing device may be a Linux operating system. The optical disc file verification method 200 of the present invention is described in detail below by taking a Linux operating system as an example, but the operating system of the method 200 of the present invention is not limited to be executed in the Linux operating system.

As shown in fig. 2, the method 200 begins at step S210.

In step S210, an optical disc file system is created, and each file to be recorded in the local file directory is copied to the created optical disc file system. It should be noted that, when the file is first recorded, the optical disc of the sequential medium is a blank optical disc without any data, and therefore, an optical disc file system for carrying each file to be recorded needs to be created first.

According to one embodiment, the optical Disc file system may be a UDF (Universal Disc Format) file system.

According to one embodiment, the optical disc file system may be created by:

first, the total capacity (files _ capacity) and the number (files _ count) of the files to be recorded are calculated, and the reserved space of the optical disc file system is determined according to the total capacity (files _ capacity) and the number (files _ count) of the files to be recorded.

In one implementation, the block size block _ size of the known UDF file system is 2048 bytes; each file is known to occupy at least 2 blocks in the UDF file system, and the new SIZE of each file is defined as increment _ SIZE ═ 2 × block _ SIZE bytes; the total SIZE of the file system must be aligned in blocks, and for the sake of calculation, 2M alignment is used here, and the SIZE is defined as MIN _ UDF _ IMG _ SIZE — 2 × 1024 bytes; from this information the total size of the UDF file system reserved space (total file system size) can be calculated. Here, the total size of the reserved space (fsize) of the UDF file system may be calculated according to the following formula: FsSize ═ bytes (files _ capacity + files _ count · increment _ SIZE) + ((MIN _ UDF _ IMG _ SIZE-1) & — (MIN _ UDF _ IMG _ SIZE-1)).

Further, based on the aforementioned calculated total size fsize of the reserved space, a blank file of a corresponding size is created. In one implementation, the Linux command trunk-s [ FsSize ] burn _ data. udf may be called to create a blank file with a file name burn _ data. udf and a size of FsSize bytes.

And then, the blank file is formatted to obtain the optical disc file system. In one implementation, the blank file burn _ data _ UDF may be formatted by executing a system command mkfs, UDF-b 2048-r equal to 1.02burn _ data, and a UDF file system with a formatted UDF version of 1.02 and a block size of 2048 bytes, that is, an optical disc file system, is obtained.

According to one embodiment, each file to be recorded can be copied to the optical disc file system by:

first, the disc file system (i.e. the formatted UDF file system) is mounted to a predetermined directory of the operating system. For example, the predetermined directory may be a local directory/media/udfimage of a Linux operating system. And mounting the file burn _ data. UDF of the well-formatted UDF file system onto a preset directory/media/udfimage local to the current Linux operating system by executing a command mount-tudfurn _ data.

And then copying each file to be recorded in the local file directory to a preset directory (/ media/udp).

Further, the optical disc file system is unloaded. After the optical disc file system is unloaded, the optical disc file system containing all the files to be recorded can be obtained. In one implementation, the command umount/media/udfimage may be executed to offload the UDF file system mounted on a predetermined directory/media/udfimage. After the disc file system is successfully unloaded, all files to be recorded are already contained in the burn _ data.

Subsequently, in step S220, a metadata area is located in the disc file system. As can be seen from the foregoing, the disc file system (burn _ data. UDF) at this time is a mirror package having the UDF 1.02 file system and containing each file to be recorded.

In one embodiment, the structure of the metadata space of the sequential media disc after recording is shown in fig. 3, which includes: RESERVED area, MVDS area, LVID area, AVDP area, PSPACE area, RVDS area.

It should be noted that the metadata area is a PSPACE, metadata of each file to be recorded is stored in the metadata area, and the verification of the recorded file is also implemented in the metadata area PSPACE.

According to one embodiment, the MVDS area comprises the key metadata PD recorded with the position of the metadata area PSPACE, and the key metadata PD in the MVDS area can be analyzed to directly locate the metadata area PSPACE.

Fig. 4 shows a flow diagram for locating to a metadata area PSPACE according to an embodiment of the invention. As shown in fig. 4, locating the metadata area PSPACE in the optical disc file system may be performed according to the following method:

first, the location of the anchor volume description pointer avdp (anchor voldescptr) is located in the disc file system. Here, by opening the disc file system, i.e. opening the file burn _ data. udf, the position offset by 256 blocks (i.e. 2048 × 256 bytes) from the beginning of the file is the position of AVDP.

And reading an MVDS value (mainVolDescSeqExt) from the AVDP, wherein the MVDS value records the starting position and the length of the MVDS area, so that the position and the length of the MVDS area can be determined according to the MVDS value, and the MVDS area is positioned based on the position in the MVDS value. Note that the key metadata PD is located in the MVDS area.

By retrieving the key metadata PD from the MVDS area, the location of the metadata area PSPACE can be located based on the key metadata PD.

According to one embodiment, the positioning to the metadata area PSPACE based on the critical metadata PD may be performed according to the following method:

the length of the MVDS area is determined based on the MVDS value, and the amount of metadata in the MVDS area is determined based on the length (length/2048) of the MVDS area.

By traversing each block (sector) in the MVDS area, for each block, the block is converted into a first structure object (tag), and a value (tagIdent) of the first structure object is acquired, so as to find a block whose value of the first structure object is a predetermined value. In one implementation, the predetermined value is TAG _ idle _ PD (0x 0005).

If the value of the first struct object is a predetermined value, the corresponding block is converted into a second struct object (partitionDesc) and the value of the second struct object (partitionstartlinglocation) which is the key metadata PD of the location where the metadata area PSPACE is recorded is acquired. Thus, it is possible to locate the metadata region PSPACE based on the value of the second structure object (as the key metadata PD). At this time, the spatial structure of the metadata region PSPACE is shown in fig. 5, which includes an SBD region, an FSD region, a root file entry RootFE, a root file identifier descriptor RootFID, DirFE, DirFID, a reserved region, a file entry FE that reserves other files to be recorded, a file identifier descriptor FID, and a data extension region.

In one implementation, the second struct object partitionDesc may be defined as:

subsequently, in step S230, the data structure of the disc file system metadata in the metadata area PSPACE is modified to construct a new data structure. And storing the first abstract value of each file to be recorded based on the new data structure body by calculating the first abstract value of each file to be recorded.

According to one embodiment, a pre-processing is performed on a file to be recorded first. Traversing each file to be recorded in a local file directory, respectively calculating a first abstract value of each file to be recorded, and then storing the first abstract value of each file to be recorded in a memory of the computing device. In an implementation manner, the first digest value of each file to be recorded may be calculated by executing a command md5sum in the Linux operating system, and the first digest value of each file to be recorded may be stored in the memory for use.

In one implementation, the Digest value may be an MD5 value calculated by using an MD5(Message-Digest 5, information-Digest 5) Algorithm, and the first Digest value may be a first MD5 value.

Furthermore, a new data structure is constructed by locating an optical disc file system file entry FE in the metadata area PSPACE and modifying an extensible field extendedDattrand AllocDescs in the optical disc file system file entry FE. Specifically, by modifying the data structure in the extensible field, the MD5 variable is added to the original data structure to obtain a new structure including the MD5 variable, so as to construct a new data structure in the extensible field of the file entry FE of the optical disc file system. In this way, the new data structure constructed includes MD5 variable, which can be used to store the first digest value (i.e. the first MD5 value) of the file to be recorded. Subsequently, each first MD5 value in the memory is circularly copied to the MD5 variable of the new data structure, so that the first MD5 value of each file to be recorded is stored based on the MD5 variable of the new data structure.

It should be noted that by modifying the data structure of the metadata of the optical disc file system in the metadata area and constructing a new data structure, the first MD5 value of each file to be recorded can be stored based on the new structure, so that verification of the optical disc recording file based on the first MD5 value stored by the new data structure can be subsequently achieved, and at the same time, compatibility of the optical disc file system can be ensured.

In one implementation, the file entry FE may define the following data structure according to the standard-making criteria (4/14.9) of ECMA-167v 3:

it should be noted that the extendedattrandallocdesces field is an extensible field, the length of which is recorded in bytes by the length of the extendedattrandallocdesces field, the significance of the extendedattrandallocdesces field is recorded by the FLAGs in the icbTag (see ECMA-1674/14.6), the value of which is optional (see ECMA-1674/14.6.8), different FLAGs represent that the extendedattrandallocdesces will store different data structure objects, and the FLAG used for storing the file data is icbTag _ FLAG _ AD _ SHORT, which represents the following data structure:

to be able to store the first MD5 value, in the embodiment of the present invention, a new data structure short _ ad _ ex is defined, and a variable MD5 is added to the data structure short _ ad, where the new data structure may be implemented as:

note that the values of the variables in the new data structure are derived from the first MD5 values stored in the memory, and the first MD5 value of the file to be recorded is stored by building the new data structure by circularly copying the first MD5 value in the memory into the MD5 variable in the short _ ad _ ex of the new data structure. Finally, the length hextndedttr is updated to sizoef (short _ ad _ ex). Therefore, in the original UDF file system reading logic, the new data structure short _ ad _ ex is cut off, extLength (length information of the new structure) and extPosition (position information of the new structure) are acquired, and the variable MD5 newly added in the new data structure does not affect the identification of the original UDF file system, so that the compatibility of the UDF file system is ensured.

Subsequently, in step S240, each file to be recorded in the optical disc file system is recorded onto the optical disc of the sequential medium. Here, the recording of each file to be recorded in the optical disc file system to the optical disc of the sequential medium is realized by recording the mirror image of the optical disc file system to the optical disc of the sequential medium, so as to obtain the recorded file recorded to the optical disc corresponding to each file to be recorded. At this point, the optical disc recording process is completed.

In one implementation, the image of the UDF file system is recorded onto the optical disc of the sequential media by executing the command cdrecord-dev/sr 0-multi-data-v-project-speed 4.

Finally, in step S250, after each recorded file is recorded on the optical disc of the sequential medium to obtain the corresponding recorded file, the second digest value of each recorded file is verified based on the first digest value of the corresponding recorded file by calculating the second digest value corresponding to each recorded file, and it is determined whether each recorded file fails to be verified. If the recorded file fails to be verified, which indicates that the recorded file is abnormal and damaged, the recorded file information which fails to be verified can be recorded. Therefore, one or more recorded files which fail to be verified can be determined from all recorded files recorded on the optical disc, and accurate positioning of abnormal files on the optical disc is realized.

Here, corresponding to the above, the second digest value may be a second MD5 value calculated by the MD5 algorithm on the recorded file data.

According to one embodiment, the second digest value (i.e., the second MD5 value) of each recorded file can be verified by the following method:

and traversing each recorded file. For each recorded file, calculating a second MD5 value of the recorded file, and obtaining a first MD5 value of the file to be recorded corresponding to the recorded file from the new data structure body. It should be understood that the first MD5 value of the file to be recorded can be used as a basis for verifying the second MD5 value of the corresponding recorded file.

And comparing the second MD5 value of the recorded file with the acquired first MD5 value of the corresponding file to be recorded, if the second MD5 value is the same as the acquired first MD5 value of the file to be recorded, the verification is successful, and the recorded file recorded on the optical disc is not damaged. If the difference is not the same, the verification fails, which indicates that the recorded file recorded on the optical disc is damaged, and the information of the recorded file can be recorded.

FIG. 6 shows a flowchart for verifying a recorded file according to an embodiment of the present invention. As shown in fig. 6, traversing each recorded file can be achieved by:

the metadata area PSPACE is first located in the disc file system. Here, the foregoing method of locating to the metadata area from the disc file system may be employed. Then, a root file entry RootFE is located in the metadata area PSPACE, each file identifier descriptor FID under the root file entry RootFE is traversed, and whether the type corresponding to the file entry FE pointed to by each file identifier descriptor FID is a file or a directory is determined. If the file entry is a directory, traversing each file identifier descriptor FID under the directory corresponding to the file entry, and judging whether the type corresponding to the file entry pointed by each file identifier descriptor FID is a file or a directory. If the type corresponding to the file entry pointed by the file identifier descriptor FID is a file, which indicates that the recorded file is traversed, the file entry pointed by the file identifier descriptor FID is located, and the binary data of the recorded file corresponding to the file entry is read. And then, by calculating the second MD5 value of the binary data of the recorded file, and acquiring the first MD5 value of the file to be recorded corresponding to the recorded file from the new data structure body as a check basis, and by comparing whether the second MD5 value of the recorded file is the same as the first MD5 value of the corresponding file to be recorded, whether the recorded file is damaged can be determined.

In one implementation, the binary data of the recorded file corresponding to each located file entry can be read, and the second MD5 value of each recorded file can be calculated according to the following method: the position information of the new data structure in the metadata area PSPACE and the length information (block) of the new data structure are acquired. Here, refer to the new structure in the foregoing, that is, the extLength (length information of the new structure) and extPosition (position information of the new structure in the metadata area PSPACE) are acquired from the new data structure short _ ad _ ex. Based on the position information and the length information of the new data structure in the metadata area PSPACE, the binary data of the recorded file corresponding to each file entry can be read circularly. Further, the binary data of each recorded file can be called by block through an interface int MD5_ Update (MD5_ CTX _ c, constvoid _ data, size _ tlen) provided by openssl to calculate the second MD5 value of the recorded file.

And comparing the second MD5 value of the recorded file with the acquired first MD5 value of the corresponding file to be recorded so as to verify the second MD5 value of the recorded file. Specifically, the second MD5 value of the recorded file is compared with the acquired first MD5 value of the corresponding file to be recorded, and if the values are the same, the verification is successful, which indicates that the recorded file recorded on the optical disc is not damaged. If the difference is not the same, the verification fails, which indicates that the recorded file recorded on the optical disc is damaged, and the information of the recorded file can be recorded. And then, continuously traversing the next recorded file, namely the recorded file corresponding to the file entry pointed by the next file identifier descriptor FID, until the traversal is completed for each recorded file.

Finally, after traversing the recorded files corresponding to the file entries pointed by each file identifier descriptor FID in the root file entry RootFE, generating an abnormal file list based on the recorded information of the damaged one or more recorded files.

In one implementation, locating a root file entry (RootFE) in the metadata area PSPACE, traversing each file identification descriptor FID under the root file entry RootFE may be performed as follows:

reading the first block from the starting position of the metadata area PSPACE, and converting the first block into a fileEntry structure object, wherein the object is RootFE. Subsequently, it is determined whether or not the length hallocdescs in ICBTAG. FLAGs in RootFE is ICBTAG _ FLAG _ AD _ ICB. If the object is ICBTAG _ FLAG _ AD _ ICB, a structural body object of the RootFID is generated, the size of the structural body object is length hAllocDescs in the RootFE, and the value of the RootFID is written, and the content of the value is extendedAttrAndAllocDescs in the RootFE. If not ICBTAG _ FLAG _ AD _ ICB, generating a structural body object of the RootFID, wherein the size of the structural body object is informationLength in the RootFE, converting the extendedAttrAnAllocDescs in the RootFE into an object of a structural body short _ AD, acquiring the position information and the length information of the RootFID by analyzing the object of the short _ AD, further reading the content of corresponding length bytes, namely the data of the RootFID from the corresponding position, and storing the data in the structural body object of the RootFID.

Fig. 7 shows a flowchart of an optical disc recording method 700 according to an embodiment of the present invention. Method 700 is suitable for execution in a computing device, such as computing device 100 described above. As shown in FIG. 7, method 700 includes steps S710-S740.

In step S710, an optical disc file system is created, and each file to be recorded in the local file directory is copied to the created optical disc file system. It should be noted that, when the file is first recorded, the optical disc of the sequential medium is a blank optical disc without any data, and therefore, an optical disc file system for carrying each file to be recorded needs to be created first.

According to one embodiment, the optical disc file system may be a UDF (universal disc format) file system.

According to one embodiment, the optical disc file system may be created by:

first, the total capacity (files _ capacity) and the number (files _ count) of the files to be recorded are calculated, and the reserved space of the optical disc file system is determined according to the total capacity (files _ capacity) and the number (files _ count) of the files to be recorded.

In one implementation, the block size block _ size of the known UDF file system is 2048 bytes; each file is known to occupy at least 2 blocks in the UDF file system, and the new SIZE of each file is defined as increment _ SIZE ═ 2 × block _ SIZE bytes; the total SIZE of the file system must be aligned in blocks, and for the sake of calculation, 2M alignment is used here, and the SIZE is defined as MIN _ UDF _ IMG _ SIZE — 2 × 1024 bytes; from this information the total size of the UDF file system reserved space (total file system size) can be calculated. Here, the total size of the reserved space (fsize) of the UDF file system may be calculated according to the following formula: FsSize ═ bytes (files _ capacity + files _ count · increment _ SIZE) + ((MIN _ UDF _ IMG _ SIZE-1) & — (MIN _ UDF _ IMG _ SIZE-1)).

Further, based on the aforementioned calculated total size fsize of the reserved space, a blank file of a corresponding size is created. In one implementation, the Linux command trunk-s [ FsSize ] burn _ data. udf may be called to create a blank file with a file name burn _ data. udf and a size of FsSize bytes.

And then, the blank file is formatted to obtain the optical disc file system. In one implementation, the blank file burn _ data _ UDF may be formatted by executing a system command mkfs, UDF-b 2048-r equal to 1.02burn _ data, and a UDF file system with a formatted UDF version of 1.02 and a block size of 2048 bytes, that is, an optical disc file system, is obtained.

According to one embodiment, each file to be recorded can be copied to the optical disc file system by:

first, the disc file system (i.e. the formatted UDF file system) is mounted to a predetermined directory of the operating system. For example, the predetermined directory may be a local directory/media/udfimage of a Linux operating system. And mounting the file burn _ data. UDF of the well-formatted UDF file system onto a preset directory/media/udfimage local to the current Linux operating system by executing a command mount-tudfurn _ data.

And then copying each file to be recorded in the local file directory to a preset directory (/ media/udp).

Further, the optical disc file system is unloaded. After the optical disc file system is unloaded, the optical disc file system containing all the files to be recorded can be obtained. In one implementation, the command umount/media/udfimage may be executed to offload the UDF file system mounted on a predetermined directory/media/udfimage. After the disc file system is successfully unloaded, all files to be recorded are already contained in the burn _ data.

Subsequently, in step S720, a metadata area is located in the disc file system. As can be seen from the foregoing, the disc file system (burn _ data. UDF) at this time is a mirror package having the UDF 1.02 file system and containing each file to be recorded.

Subsequently, in step S730, the data structure of the disc file system metadata in the metadata area PSPACE is modified to construct a new data structure. And storing the first abstract value of each file to be recorded based on the new data structure body by calculating the first abstract value of each file to be recorded.

According to one embodiment, a pre-processing is performed on a file to be recorded first. Traversing each file to be recorded in a local file directory, respectively calculating a first abstract value of each file to be recorded, and then storing the first abstract value of each file to be recorded in a memory of the computing device. In an implementation manner, the first digest value of each file to be recorded may be calculated by executing a command md5sum in the Linux operating system, and the first digest value of each file to be recorded may be stored in the memory for use.

In one implementation, the digest value may be an MD5 value calculated by using an MD5 algorithm to record the file data, and the first digest value may be a first MD5 value.

Subsequently, in step S740, each file to be recorded in the optical disc file system is recorded onto the optical disc of the sequential medium. Here, the recording of each file to be recorded in the optical disc file system to the optical disc of the sequential medium is realized by recording the mirror image of the optical disc file system to the optical disc of the sequential medium, so as to obtain the recorded file recorded to the optical disc corresponding to each file to be recorded.

In one implementation, the image of the UDF file system is recorded onto the optical disc of the sequential media by executing the command cdrecord-dev/sr 0-multi-data-v-project-speed 4.

It should be noted that steps S710 to S740 correspond to steps S210 to S240 in the method 200, and specific execution logic of steps S710 to S740 can refer to the specific description of steps S210 to S240 in the foregoing, and is not described herein again. By executing the optical disc recording method 700 of the present invention to record the optical disc, when the recorded files on the optical disc are verified, one or more abnormal files in all the recorded files on the optical disc can be accurately located, thereby enhancing the reliability of the recorded files.

According to the optical disc recording method 700 and the corresponding optical disc file verification method 200 of the present invention, a new data structure is constructed by modifying the data structure of the metadata of the optical disc file system, and the first MD5 value of each file to be recorded can be stored based on the new data structure. Therefore, after recording is finished, the second MD5 value of each recorded file can be verified based on the first MD5 value stored by the new data structure, and one or more abnormal files in all recorded files of the optical disc can be accurately positioned, so that the reliability of the recorded files is enhanced. And moreover, the file of the UDF file system is verified in the Linux operating system.

Furthermore, the recorded file is subjected to MD5 verification by directly positioning the binary data of the recorded file of the optical disc, so that the interference of other data is not received, and the verification accuracy is ensured.

A8, the method according to any one of A1-A7, wherein the step of locating the metadata area in the optical disc file system comprises: locating a to-Aim Volume Description Pointer (AVDP) in the optical disc file system; reading an MVDS value from the aiming point volume description pointer, wherein the MVDS value comprises the position and the length of an MVDS area; positioning to an MVDS area based on the MVDS value, wherein the MVDS area comprises key metadata; locating to the metadata region based on the key metadata.

A9, the method of A8, wherein the step of locating to the metadata region based on the key metadata comprises: determining a length of an MVDS area based on an MVDS value, and determining the amount of metadata in the MVDS area based on the length of the MVDS area; traversing each block of the MVDS area, converting the block into a first structure object (tag) for each block, and acquiring a value of the first structure object; if the value of the first structure object is a preset value, converting the block into a second structure object, and acquiring the value of the second structure object as the key metadata; locating to the metadata region based on the value of the second structure object.

A10, the method of claim 3, wherein the digest value is an MD5 value and the variable is an MD5 variable.

A11, the method according to any of a1-a10, wherein the optical disc file system is a UDF file system.

B13, the method as defined in B12, wherein the step of creating the optical disc file system comprises: calculating the total capacity and the number of files to be recorded, and determining the reserved space of the optical disk file system according to the total capacity and the number of the files to be recorded; and creating a corresponding blank file based on the reserved space, and formatting the blank file to obtain the optical disc file system.

B14, the method according to B12 or B13, wherein the step of copying each file to be recorded to the optical disc file system comprises: mounting the optical disc file system to a predetermined directory of the operating system; copying each file to be recorded under a local file directory to the preset directory; and unloading the optical disk file system to obtain the optical disk file system containing each file to be recorded.

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 thereof, may take the form of program code (i.e., instructions) embodied in tangible media, such as removable hard drives, U.S. disks, floppy disks, 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 computing device 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 multilingual spam-text recognition method of the present invention according to instructions in said program code stored in the memory.

By way of example, and not limitation, readable media may comprise readable storage media and communication media. Readable storage media store 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 this invention. The required structure for constructing such a system will be apparent from the description above. Moreover, the present invention is not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the present invention as described herein, and any descriptions of specific languages are provided above to disclose the best mode of the invention.

In the description provided herein, numerous specific details are set forth. It is understood, however, 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 interpreted as reflecting an intention that: that the invention as claimed requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. 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 multiple sub-modules.

Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. 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. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements 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 included in other embodiments, rather than other features, 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 may be used in any combination.

Furthermore, some of the described embodiments are described herein as a method or combination of method elements that can be performed by a processor of a computer system or by other means of performing the described functions. A processor having the necessary instructions for carrying out the method or method elements thus forms a means for carrying out the method or method elements. Further, the elements of the apparatus embodiments described herein are examples of the following apparatus: the apparatus is used to implement the functions performed by the elements for the purpose of carrying out the invention.

As used herein, unless otherwise specified the use of the ordinal adjectives "first", "second", "third", etc., to describe a common object, merely indicate that different instances of like objects are being referred to, and are not intended to imply that the objects so described must be in a given sequence, 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 this description, will appreciate that other embodiments can be devised which do not depart from 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 present invention has been disclosed in an illustrative rather than a restrictive sense, and the scope of the present invention is defined by the appended claims.

22页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:印刷控制装置、印刷控制方法以及记录介质

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类