A single-chip shared file management method and system
By managing the access and unlocking mechanism of shared files in the security chip, the problem of confusing order of shared files operation on multiple applications is solved, and the independence of file operations and data integrity is achieved.
Patent Information
- Application Number
- CN202010416852.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-05-15
- Publication Date
- 2025-08-26
- Estimated Expiration
- 2040-05-15
AI Technical Summary
When multiple applications need to operate shared files, existing security chips are prone to data confusion, and cannot effectively manage the order of operation of shared files by multiple applications, resulting in incomplete data.
When receiving the access command of the application, an interactive request is initiated based on the application's registration information and command type, lock the file identification access interface, and unlock it after the operation is completed, and a timer mechanism is used to manage file access to ensure the independence and integrity of the operation sequence.
It realizes independent operation of shared files by multiple applications, ensures the controllability of updates of file content and the reliability of data, and avoids operational interference between applications.
Smart Images

Figure CN113676439B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of security chip design, and in particular relates to a single-chip shared file management method and system. Background Art
[0002] Under the distribution IoT perception layer, communication layer, platform layer, and application layer architecture, the security functions of the perception layer edge IoT agent and IoT terminals are all implemented based on security chips.
[0003] A security chip is a device that can independently generate keys and perform encryption and decryption. It has an independent processor and storage unit inside that can store keys and feature data, providing encryption and decryption and security authentication services for security applications.
[0004] Security chips can be customized to provide encryption protection for business data, enabling secure storage and transmission of application data. In the power distribution IoT scenario, where multiple business applications, such as distribution automation, marketing, and electric vehicles, are integrated and deployed, the security chips of edge IoT agents must support security services for multiple business applications to meet the secure access requirements of different business scenarios.
[0005] Files stored in the chip are read or written during application processes. Some transaction operations are completed by multiple commands. Within a single application, the application process ensures the correct order of file operations. However, when multiple applications need to operate on a shared file, there is a possibility that application 1, while already operating on a shared file, could be interrupted by application 2. Application 2's operation on the shared file could affect application 1's results, causing data corruption. Current power system security chips, such as those dedicated to power distribution and power consumption information collection, only support single-application functionality and lack the ability to serve multiple applications. Summary of the Invention
[0006] In view of the problem that when multiple existing applications need to operate a shared file, it is possible that the process of an application 1 operating a shared file may be interrupted by another application 2. The operation of application 2 on the shared file may affect the operation result of application 1, causing data confusion. The present invention provides a single-chip shared file management method, which specifically includes:
[0007] When receiving an access command from an application to a shared file in the power distribution Internet of Things, initiating an interactive request for the shared file from the application according to the registration information and command type of the application;
[0008] The file identification access interface is locked based on the interactive request, and an end command is issued to unlock the file identification access interface after the application execution operation is completed.
[0009] Preferably, when receiving an access command from an application to a shared file in the power distribution Internet of Things, initiating an interactive request for the application to the shared file according to the registration information and command type of the application includes:
[0010] When receiving an application's access command to a shared file in the power distribution Internet of Things, query the application's registration information and determine the type of the command based on the query result;
[0011] When the command type is a single command, the file direct access interface is called to access the shared file;
[0012] When the command type is command stream, an occupation application is initiated and the order in which each application occupies the file is determined. When the occupation permission is obtained to operate the shared file, an interaction request is initiated for the application to perform the operation. After the operation is completed, the occupation permission is released, and then the next application is allowed to occupy the file.
[0013] Preferably, the locking of the file identification access interface based on the interactive request includes:
[0014] If the shared file is not occupied during the operation process, a timer is used to set a timing for the file identification access interface, the file identification access interface is locked, and the shared file is accessed within the set time based on the application index and the interaction request to perform read and write operations;
[0015] If the shared file is occupied during the operation process, the shared file is locked.
[0016] Preferably, the locking of the file identification access interface based on the interactive request further includes:
[0017] If the shared file is not in the operation process, the application returns an error status.
[0018] Preferably, the step of issuing an end command to unlock the file identification access interface after the application completes the execution of the operation includes:
[0019] When the application completes accessing the shared file or the timing time is up, an end command is issued to close the application process identifier, the file occupation permission and the timer switch.
[0020] Based on the same concept, the present invention provides a single-chip shared file management system, including: an application call control module and a file operation management module;
[0021] The application call control module is configured to, upon receiving an access command from an application to a shared file in the power distribution Internet of Things, initiate an interactive request for the application to the shared file based on the registration information and command type of the application;
[0022] The file operation management module is configured to lock the file identification access interface based on the interaction request, and to issue an end command to unlock the file identification access interface after the application completes the operation.
[0023] Preferably, the application call control module includes: a command judgment submodule, a single command call submodule and a command stream call submodule;
[0024] The command judgment submodule is used to query the application registration information when receiving a command for accessing a shared file in the power distribution Internet of Things, and to judge the type of the command based on the query result;
[0025] The single command calling submodule is used to call the file direct access interface to access the shared file when the command type is a single command;
[0026] The command stream calling submodule is used to initiate an occupation application and determine the order in which each application occupies the file when the command type is command stream. When obtaining the occupation permission to operate the shared file, it initiates an interactive request for the application to perform the operation. After the operation is completed, the occupation permission is released, and the next application is allowed to occupy the file.
[0027] Preferably, the file operation management module includes: a locking submodule;
[0028] The locking submodule is configured to lock the file identification access interface based on the interactive request.
[0029] Preferably, the locking submodule includes: an error state unit, an unoccupied unit and an occupied unit;
[0030] The error status unit is configured to return an error status if the shared file is not in the operation process;
[0031] The unoccupied unit is configured to, if the shared file is not occupied in the operation process, set a timer for the file identification access interface, lock the file identification access interface, and access the shared file within a set time based on the application index and the interaction request to perform read and write operations;
[0032] The occupied unit is configured to lock the shared file if the shared file is occupied during the operation process.
[0033] Preferably, the file operation management module further includes: an unlocking submodule;
[0034] The unlocking submodule is used to issue an end command to close the application process identifier, the file occupation permission and the timer switch when the application completes accessing the shared file or the timing time expires.
[0035] Compared with the prior art, the present invention has the following beneficial effects:
[0036] 1. The present invention provides a single-chip shared file management method, comprising: when receiving an application's access command to a shared file in a power distribution Internet of Things, initiating an interactive request for the shared file for the application based on the registration information and command type of the application; locking the file identification access interface based on the interactive request, and issuing an end command to unlock the file identification access interface after the application completes the operation; implementing application call configuration and feedback by initiating an application's interactive request, and implementing controlled shared file call by controlling the operation locking and unlocking of shared files, thereby ensuring the integrity of application interaction data and the reliability of shared file data.
[0037] 2. The present invention provides a single-chip shared file management method and system, which solves the problem of independent calling of application functions and the operation of the same file on the chip by different application transaction commands without affecting each other, ensuring that the file content update is controllable. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 A flow chart of the method provided by the present invention;
[0039] Figure 2 A schematic diagram of the power distribution Internet of Things architecture provided by an embodiment of the present invention;
[0040] Figure 3 A schematic diagram of a file operation management module provided in an embodiment of the present invention;
[0041] Figure 4 A schematic diagram of an application access control module provided in an embodiment of the present invention;
[0042] Figure 5 An example diagram of use provided by an embodiment of the present invention;
[0043] Figure 6 This is a system structure diagram provided by the present invention. DETAILED DESCRIPTION
[0044] The embodiments of the present invention will be further described below with reference to the accompanying drawings.
[0045] Example 1:
[0046] The present invention provides a single chip shared file management method and system, which realizes that when multiple applications operate on shared files, each application's operation on the file exists independently and does not affect each other, ensuring that the file content update is controllable. The invention content can be extended to other fields to solve the conflict of multiple application files in the security chip, combined with Figure 1 The method flow chart is introduced, which specifically includes:
[0047] Step 1: When receiving an access command from an application to a shared file in the power distribution Internet of Things, an interactive request for the shared file is initiated for the application according to the registration information and command type of the application;
[0048] Step 2: Locking the file identification access interface based on the interactive request, and issuing an end command to unlock the file identification access interface after the application completes the operation;
[0049] Step 1: upon receiving an access command from an application to a shared file in the power distribution Internet of Things, initiating an interactive request for the application to the shared file based on the registration information and command type of the application, specifically including:
[0050] (1) File operation management module
[0051] The file operation management module includes three parts: timer submodule, file access control submodule and application interaction submodule. Figure 3 shown.
[0052] The file access control submodule provides file operation control and status query, and checks whether the identified file is occupied by an application process, including accessible file application management, occupation identification registration management, and timer setting management;
[0053] The timer submodule contains a timer and its switch;
[0054] The application interaction submodule is responsible for interacting with the application control module and provides a direct file access interface and a file identification access interface.
[0055] When an application needs to access a shared file, if it is a read or write operation of one command, the file direct access interface is called to complete it; if it is a read or write operation that requires multiple commands to complete, the file identification access interface is called, and the application index, interaction request and interaction time data are first submitted to the application interaction submodule. The interaction submodule then applies to the file access control submodule to find out whether the application has permission to access the file. If it has, it continues to determine whether it is occupied by other application processes. If it is occupied, the shared file is locked and the module returns to the "busy" state; if it is not occupied, it applies for occupation, starts the timer and sets the timer value, and records the application index. The timer starts working. If the timer time expires and the registration identifier has not been cleared, the registration is modified to the unoccupied state and the timer is turned off. If the end command of the application process arrives, it is checked whether the application occupies the file control right. If so, the business process is normally closed by the application end command, and the application process identifier, file occupation identifier and timer switch are turned off.
[0056] Step 2: Locking the file identification access interface based on the interactive request, and issuing an end command to unlock the file identification access interface after the application completes the operation, specifically including:
[0057] (2) Application calls the control module for file system access
[0058] The application calls the control module for file system access, such as Figure 4 This module is primarily responsible for controlling the operations of various applications and includes an application registry and a file operation call submodule. Upon receiving an application instruction, the application registry is searched (information) to determine whether the instruction is a single command file operation (one application needs to access a shared file) or a command stream file operation (multiple applications need to access a shared file). If it is a single command operation, the file operation management module is directly called to access the file. If it is a command stream operation, the subsequent determination is continued.
[0059] Upon receiving an application's start operation command, the module submits a request for file occupation to the file operation management module. If the request is approved, the application is recorded as entering the operation process. If not, the application returns a status indicating that the system is busy and the application start operation is denied. If this module receives an application operation progress command, it checks whether the application is in the operation process. If so, it continues; otherwise, it returns an error. If this module receives an application operation end command, it checks whether the application is in the operation process. If not, it reports an error. If so, it requests the file operation management module to update the file and end the occupation.
[0060] (3) Entity equipped with file system module and application call control
[0061] The shared file management entity includes an application access control module and a file operation management module. This entity can ensure that when multiple applications access shared files, the file access control module independently applies file operations locks, implements controlled calls to shared files, ensures the integrity of application interaction data, and the reliability of shared file data.
[0062] In order to meet the demand of multiple business applications calling a security chip at the same time in the power distribution Internet of Things scenario, it is necessary to design and develop a chip that supports multi-application operations. During the design process, it is necessary to solve the independent calling of application functions and the complementary influence of different application transaction commands on the operation of the same chip file. Based on the above needs, it is urgent to develop a management method for shared files in a security chip to schedule the use of chip resources by different applications, to ensure low investment and high efficiency of security functions of different business applications in the power distribution Internet of Things scenario, combined with Figure 2 The power distribution IoT architecture diagram is introduced in the following figure. The application call control module and file operation management module are located in the edge IoT agent and IoT terminal.
[0063] Without this invention, there is no problem when each application interacts with the chip independently. However, when multiple applications access the chip simultaneously, confusion will occur when the processes are interspersed with applications. The specific problems are as follows:
[0064] Application 1's first command accesses the shared file and reads file data A
[0065] Application 2's first command accesses the shared file and reads file data A
[0066] Application 1's second command completes the operation A+B and updates the shared file data to (A+B).
[0067] Application 2 completes the second command operation A+C and updates the shared file data to (A+C).
[0068] Both applications perform addition operations on a shared file. Application 1 expects the file's data value to be added to B, while application 2 expects the file's data value to be added to C. After the two application processes are executed, the expected data value of the shared file should be A+B+C, but the actual result is A+C, which is incorrect.
[0069] Combine Figure 5 The following example illustrates the command flow operation of this application. Application 1 requests A but has not yet completed the next command. When application 2 requests it, the chip returns "busy," locking access to the file. Application 2 is not allowed to operate until the next command completes and the file value becomes A+B. At this point, application 2 reads the file value A+B and executes its own operation + C, resulting in the calculation of A+B+C.
[0070] The present invention can solve the aforementioned problem of multiple applications operating on a shared file. It employs a shared file interlocking mechanism between applications. Before application 1's operation process begins but before it completes, the shared file is locked and cannot be operated by other applications. After the operation process completes, the lock is released, allowing other applications to operate. The same applies to application 2. Furthermore, to address the risk of a file lock being unable to be released if application 1's instruction flow is interrupted, a mechanism is added to periodically release the shared file occupied by application traffic.
[0071] The present invention includes a file operating system module, a control module for application-based file system access, and an entity equipped with the file system module and application-based access control. The file operating system module controls the locking and unlocking of shared files. Based on the application registry, the application call control module implements application call configuration and feedback. While application 1 is still in the process of calling, the file is locked, preventing access from application 2. Upon completion, the file is unlocked, achieving controlled shared file calls and ensuring the integrity of application interaction data and the reliability of shared file data.
[0072] Example 2:
[0073] Based on the same concept, the present invention provides a single chip shared file management system, combined with Figure 6 The system structure diagram is introduced, which specifically includes: application call control module and file operation management module;
[0074] The application call control module is configured to, upon receiving an access command from an application to a shared file in the power distribution Internet of Things, initiate an interactive request for the application to the shared file based on the registration information and command type of the application;
[0075] The file operation management module is configured to lock the file identification access interface based on the interactive request, and to issue an end command to unlock the file identification access interface after the application completes the operation.
[0076] The application call control module includes: a command judgment submodule, a single command call submodule and a command stream call submodule;
[0077] The command judgment submodule is used to query the application registration information when receiving a command for accessing a shared file in the power distribution Internet of Things, and to judge the type of the command based on the query result;
[0078] The single command calling submodule is used to call the file direct access interface to access the shared file when the command type is a single command;
[0079] The command stream calling submodule is used to initiate an occupation application and determine the order in which each application occupies the file when the command type is command stream. When obtaining the occupation permission to operate the shared file, it initiates an interactive request for the application to perform the operation. After the operation is completed, the occupation permission is released, and the next application is allowed to occupy the file.
[0080] The file operation management module includes: a locking submodule;
[0081] The locking submodule is configured to lock the file identification access interface based on the interactive request.
[0082] The locking submodule includes: an error state unit, an unoccupied unit and an occupied unit;
[0083] The error status unit is configured to return an error status if the shared file is not in the operation process;
[0084] The unoccupied unit is configured to, if the shared file is not occupied in the operation process, set a timer for the file identification access interface, lock the file identification access interface, and access the shared file within a set time based on the application index and the interaction request to perform read and write operations;
[0085] The occupied unit is configured to lock the shared file if the shared file is occupied during the operation process.
[0086] The file operation management module further includes: an unlocking submodule;
[0087] The unlocking submodule is used to issue an end command to close the application process identifier, the file occupation permission and the timer switch when the application completes accessing the shared file or the timing time expires.
[0088] The application call control module and the file operation management module are located in the edge IoT agent and the IoT terminal.
[0089] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0090] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the steps in the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0091] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0092] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0093] The above are merely embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention are included in the scope of the claims of the present invention to be approved.
Claims
1. A single-chip shared file management method, characterized in that: include: When receiving an access command from an application to a shared file in the power distribution Internet of Things, initiating an interactive request for the shared file from the application according to the registration information and command type of the application; Locking the file identification access interface based on the interactive request, and issuing an end command to unlock the file identification access interface after the application completes the execution operation; When receiving an access command from an application to a shared file in the power distribution Internet of Things, initiating an interactive request for the application to the shared file according to the registration information and command type of the application, including: When receiving an application's access command to a shared file in the power distribution Internet of Things, query the application's registration information and determine the type of the command based on the query result; When the command type is a single command, the file direct access interface is called to access the shared file; When the command type is command stream, initiate an occupation request and determine the order in which each application occupies the file. When obtaining occupation permission to operate a shared file, initiate an interactive request for the application to perform the operation. After the operation is completed, the occupation permission is released, and the next application is allowed to occupy the file. The locking of the file identification access interface based on the interactive request includes: If the shared file is not occupied during the operation process, a timer is used to set a timing for the file identification access interface, the file identification access interface is locked, and the shared file is accessed within the set time based on the application index and the interaction request to perform read and write operations; If the shared file is occupied during the operation process, the shared file is locked.
2. The method according to claim 1, wherein The file identification access interface locked based on the interactive request further includes: If the shared file is not in the operation process, the application returns an error status.
3. The method according to claim 2, wherein The step of issuing an end command to unlock the file identification access interface after the application completes the execution of the operation includes: When the application completes accessing the shared file or the timing time is up, an end command is issued to close the application process identifier, the file occupation permission and the timer switch.
4. A single-chip shared file management system, characterized in that: include: Application call control module and file operation management module; The application call control module is configured to, upon receiving an access command from an application to a shared file in the power distribution Internet of Things, initiate an interactive request for the application to the shared file based on the registration information and command type of the application; The file operation management module is configured to lock the file identification access interface based on the interaction request and issue an end command to unlock the file identification access interface after the application completes the operation; The application call control module includes: a command judgment submodule, a single command call submodule and a command stream call submodule; The command judgment submodule is used to query the application registration information when receiving a command for accessing a shared file in the power distribution Internet of Things, and to judge the type of the command based on the query result; The single command calling submodule is used to call the file direct access interface to access the shared file when the command type is a single command; The command stream calling submodule is used to initiate an occupation request and determine the order in which each application occupies the file when the command type is command stream. When obtaining occupation permission to operate a shared file, it initiates an interactive request for the application to perform the operation. After the operation is completed, the occupation permission is released, and the next application is allowed to occupy the file. The file operation management module includes: a locking submodule; The locking submodule is configured to lock the file identification access interface based on the interactive request; The locking submodule includes: an error state unit, an unoccupied unit and an occupied unit; The error status unit is configured to return an error status if the shared file is not in the operation process; The unoccupied unit is configured to, if the shared file is not occupied in the operation process, set a timer for the file identification access interface, lock the file identification access interface, and access the shared file within a set time based on the application index and the interaction request to perform read and write operations; The occupied unit is configured to lock the shared file if the shared file is occupied during the operation process.
5. The system according to claim 4, wherein: The file operation management module further includes: an unlocking submodule; The unlocking submodule is used to issue an end command to close the application process identifier, the file occupation permission and the timer switch when the application completes accessing the shared file or the timing time expires.
Citation Information
Patent Citations
Data access method and device and storage medium
CN110399227A
File-based access control method and device for shared hardware devices
CN1987791A