A method for reducing the failure rate of RTOS platform file system and storage medium thereof
By restoring file information when the payment terminal is turned on and reducing the operating frequency of file information logic blocks, the problem of abnormalities causing file loss when updating file information logic blocks after the payment terminal is operated, and the effect of improving file system stability and security is achieved.
Patent Information
- Application Number
- CN202111623487.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-28
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2041-12-28
AI Technical Summary
When a payment terminal based on the rtos platform updates the logical block where the file information is located after file operation, if an abnormality occurs in the payment terminal, it is likely to cause file loss and increase the risk of customer property losses.
When the payment terminal is turned on, the file information is restored by polling each logical block, and only the logical block and global variables where the file content is located are updated during file operation, reducing the operating frequency of the logical block where the file information is located.
It greatly reduces the file system failure rate, improves the stability and security of the file system, and reduces the probability of customer property losses caused by file loss.
Smart Images

Figure CN114253934B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of payment terminals based on an RTOS platform, and in particular to a method for reducing the failure rate of an RTOS platform file system and a storage medium thereof. Background Art
[0002] In order to store various information required for the transaction process, the payment terminal based on the RTOS platform has added a file system function, so that this information is saved in the form of files in the payment terminal flash, so that the information can be effectively managed.
[0003] Currently, payment terminals based on the RTOS platform divide the file system into various logical blocks, and file information (including the logical block number mapping table occupied by the file and the file Fat table information) is uniformly stored in one logical block. Other logical blocks are used to store file content and their own block status information. Each time a file is operated, the file-related information stored in the logical block is read, and the specific logical block is located through the information, and then the file operation is completed. After each file operation, the logical block storing the file information is updated. This increases the risk of file loss if an abnormality occurs in the payment terminal when updating the logical block where the file information is located after the file operation, thereby causing the risk of customer property loss. Summary of the Invention
[0004] In response to the above problems, the present invention proposes a method for reducing the failure rate of the RTOS platform file system and its storage medium. Without changing the current file system operation logic, the method greatly reduces the operation frequency of the logical block where the file information is located, thereby greatly reducing the probability of file system failure.
[0005] The present invention is achieved through the following technical solutions:
[0006] A method for reducing the failure rate of an RTOS platform file system, comprising:
[0007] The file system file information is uniformly stored in a logical block. The information stored in the logical block where the file information is located includes a 4-byte value, each file Fat table, and 13 bytes of the logical block status information. Each logical block contains 13 bytes of the logical block status information.
[0008] The Fat table information only contains the file name and file id;
[0009] The 13-byte logic block status information is composed of 7 bytes of logic block status information and 6 bytes of file related information;
[0010] When the payment terminal boots up and the file system is initialized, each logical block is polled and the corresponding file information is restored based on the 6-byte file-related information in each logical block number and the file ID value in the Fat table information of each file in the logical block where the file information is located;
[0011] When the payment terminal operates on a file, the file system locates the specific logical block based on the corresponding file information restored during startup, and then completes the file operation;
[0012] Finally, update the logical block where the file content is located and the global variables related to saving file information.
[0013] Furthermore, the 6-byte file-related information includes a 2-byte file ID, a 2-byte file content size stored in the logical block, and a 2-byte sequence number of the logical block in the logical blocks owned by the file.
[0014] Furthermore, the restored corresponding file information includes each file's logical block number mapping table, initial logical block number, total number of logical block numbers owned, and file size.
[0015] Furthermore, the global variables related to the file information are the restored corresponding file information, namely, the logical block number mapping table of each file, the initial logical block number, the total number of logical block numbers owned, and the file size.
[0016] Under the same hardware foundation, the method of the present invention has a certain versatility. Therefore, the present invention also provides a computer-readable storage medium, which stores at least one instruction, at least one program, code set or instruction set. The at least one instruction, at least one program, code set or instruction set is loaded and executed by a processor to implement the above-mentioned method of reducing the failure rate of the RTOS platform file system.
[0017] Compared with the prior art, the present invention has the following beneficial effects:
[0018] The present invention changes the file information structure stored in the logic blocks and the block status information structure stored in each logic block of the existing file system of the payment terminal based on the RTOS platform, and stores the existing frequently changing file information stored in the logic blocks in a dispersed manner in other forms in the logic blocks storing the file contents. When the payment terminal device is started, the file system polls the file-related information dispersedly stored in each logic block and restores the information required for the file system to operate the file in combination with the file ID values stored in the logic block where the file information is located. When the payment terminal modifies a file, it only changes the logic block storing the file content. This ensures the stability of the file system and improves the security of the file system without changing the file system operation logic. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 It is a schematic diagram of the file system structure in the prior art;
[0020] Figure 2 This is a schematic diagram of the logical block structure of file contents stored in the current file system in the prior art;
[0021] Figure 3 This is a schematic diagram of the information structure stored in the logical block where the file information of the current file system is located in the prior art;
[0022] Figure 4 This is a schematic diagram of the Fat table structure in the current file system in the prior art;
[0023] Figure 5 This is a schematic diagram of the file operation process of the current file system in the prior art;
[0024] Figure 6 It is a schematic diagram of the information structure stored in the logical block where the file information of the file system is located in the present invention;
[0025] Figure 7 This is a schematic diagram of the Fat table structure in the file system of the present invention;
[0026] Figure 8 This is a schematic diagram of the logical block structure of the file system storing file content in the present invention;
[0027] Figure 9 It is a schematic diagram of the file operation flow of the file system in the present invention. DETAILED DESCRIPTION
[0028] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the invention for which protection is sought, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0029] This embodiment provides a method for reducing the failure rate of an RTOS platform file system. The payment terminal file system based on the RTOS platform is composed of multiple logic blocks. The method includes:
[0030] The file system file information is uniformly stored in a logical block. The information stored in the logical block where the file information is located includes a 4-byte value, each file Fat table, and 13 bytes of the logical block status information. Each logical block contains 13 bytes of the logical block status information.
[0031] The Fat table information only contains the file name and file id;
[0032] The 13-byte logic block status information is composed of 7 bytes of logic block status information and 6 bytes of file related information;
[0033] When the payment terminal boots up and the file system is initialized, each logical block is polled and the corresponding file information is restored based on the 6-byte file-related information in each logical block number and the file ID value in the Fat table information of each file in the logical block where the file information is located;
[0034] When the payment terminal operates on a file, the file system locates the specific logical block based on the corresponding file information restored during startup, and then completes the file operation;
[0035] Finally, update the logical block where the file content is located and the global variables related to saving file information.
[0036] Furthermore, the 6-byte file-related information includes a 2-byte file ID, a 2-byte file content size stored in the logical block, and a 2-byte sequence number of the logical block in the logical blocks owned by the file.
[0037] Furthermore, the restored corresponding file information includes each file's logical block number mapping table, initial logical block number, total number of logical block numbers owned, and file size.
[0038] Furthermore, the global variables related to the file information are the restored corresponding file information, namely, the logical block number mapping table of each file, the initial logical block number, the total number of logical block numbers owned, and the file size.
[0039] Comparative Example
[0040] Among them, the comparative example is a technical solution of the organization of the data structure of the payment terminal file system and the file storage method based on the existing RTOS platform, which specifically includes the following steps:
[0041] 1) The payment terminal file system based on the RTOS platform consists of multiple logical blocks (such as Figure 1 As shown), the current file system file information is uniformly stored in a logical block, and other logical blocks are used to store file content. Each logical block contains 7 bytes of logical block status information (such as Figure 2 shown).
[0042] 2) The information stored in the logical block where the file information of the current file system is located includes a 4-byte value, a mapping table of logical block numbers of each file, a Fat table of each file, and a 7-byte status information of the logical block (such as Figure 3 The file Fat table contains the file name, file size, file initial logical block number and the total number of logical block numbers owned by the file (as shown in Figure 4 shown).
[0043] 3) When the payment terminal operates on a file, the file system reads the logical block number mapping table and Fat table related information of the corresponding file in the logical block where the file information is located, locates the specific logical block based on the read file related information, and then completes the file operation. Finally, it updates the status information of the relevant logical block and the logical block number mapping table and Fat table information of the file in the logical block where the file information is located (such as Figure 5 shown).
[0044] Example
[0045] This embodiment provides a method for reducing the failure rate of the RTOS platform file system. In order to reduce the frequent operation of the logic block where the file information is located in the current solution, the present invention changes the file information content stored in the logic block, and changes the file information stored in the logic block into a 4-byte value, each file Fat table and 13 bytes of the logic block status information (such as Figure 6 shown);
[0046] Among them, the file Fat table information only contains the file name and file id (such as Figure 7 shown).
[0047] This technical solution removes the file information stored in the logical blocks from the logical block number mapping table of each file, which may change frequently in the existing solution, as well as the file's initial logical block number, the total number of logical block numbers owned by the file, and the file size in the file Fat table. In addition, a file ID that identifies each file is added to the Fat table.
[0048] Because the present invention removes the frequently changing information originally stored in the logical blocks, in order to obtain the logical block number mapping table for each file, the initial logical block number of the file, the total number of logical block numbers owned by the file, and the file size required for file system operations without changing the current file operation logic, the present invention adds 6 bytes of file-related information to the existing 7-byte logical block status flag information for each logical block.
[0049] Among them, the 6-byte file related information is 2-byte file id, 2-byte file content size stored in the logical block, 2-byte sequence number of the logical block in the logical blocks owned by the file, and the new logical block structure (such as Figure 8 shown).
[0050] When the payment terminal boots up and the file system is initialized, each logical block is polled. Based on the 6-byte file-related information added in each logical block number and the file ID value in the Fat table information of each file stored in the logical block where the file information is located, the logical block number mapping table of each file, the initial logical block number, the total number of logical block numbers owned, and the file size are restored.
[0051] When the payment terminal operates on a file, the file system locates the specific logical block according to the corresponding file logical block number mapping table and other information restored at startup, and then completes the file operation. Finally, it updates the status information of the relevant logical block and the global variables (such as the file information) that store the logical block number mapping table and other file information. Figure 9 shown);
[0052] After the payment terminal operates on the file, only the logical block where the file content is located and the global variables related to saving the file information will be updated, and the logical block where the file information is located will not be operated.
[0053] The global variables related to the file information are the restored corresponding file information, namely, the logical block number mapping table of each file, the initial logical block number, the total number of logical block numbers and the file size.
[0054] This invention removes the frequently accessed file information stored in logical blocks in existing file systems. When a payment terminal operates on a file, it only updates the logical blocks containing the file content, without affecting the logical blocks containing the file information. Therefore, even if an anomaly occurs during a file operation, only the last written content of the current file is affected, leaving other files unaffected and preventing file loss. Furthermore, this solution restores the file-related information required for file operations in the existing file system through alternative means, eliminating the need to change the existing file system's logic. This significantly improves file system security while maintaining stability, thereby significantly reducing the probability of financial loss to customers.
[0055] In addition, the functional units in the embodiments of the present invention may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0056] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) or a processor to execute all or part of the steps of the various embodiments of the present invention. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0057] The foregoing description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Those skilled in the art will readily appreciate that various modifications and variations are possible. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present invention are intended to be within the scope of protection of the present invention.
Claims
1. A method for reducing the failure rate of an rtos platform file system, characterized in that: include: The file information of the file system is uniformly stored in a logical block. The information stored in the logical block where the file information is located includes a 4-byte value, each file Fat table, and 13 bytes of the logical block status information, and each logical block includes 13 bytes of the logical block status information; The Fat table information only contains the file name and file id; The 13-byte logic block status information is composed of 7 bytes of logic block status information and 6 bytes of file related information; When the payment terminal boots up and the file system is initialized, each logical block is polled, and the corresponding file information is restored based on the 6-byte file-related information in each logical block number and the file id value in the Fat table information of each file stored in the logical block where the file information is located; When the payment terminal operates on a file, the file system locates the specific logical block according to the corresponding file information restored at startup, and then completes the operation on the file; Finally, update the logical block where the file content is located and the global variables related to saving file information; The 6-byte file-related information includes a 2-byte file ID, a 2-byte file content size stored in the logical block, and a 2-byte sequence number of the logical block in the logical blocks owned by the file; the restored corresponding file information includes a mapping table of logical block numbers for each file, an initial logical block number, a total number of logical block numbers owned, and a file size.
2. A method for reducing the failure rate of an RTOS platform file system according to claim 1, characterized in that: The global variables related to the file information are the corresponding restored file information.
3. A computer-readable storage medium, characterized in that: The storage medium stores at least one instruction, at least one program, code set or instruction set, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by a processor to implement the method for reducing the failure rate of the RTOS platform file system as described in one of claims 1 to 2.
Citation Information
Patent Citations
FAT file data reading / writing method, system and mobile communication terminal
CN101382877A
Method for storing file and mobile terminal
CN106775488A