Data processing method and device, electronic equipment and computer readable storage medium
By reading device data from the eMMC to the reserved memory area in electronic devices for operation, the problem of multiple read and write operations affecting the service life of the eMMC is solved, efficient and accurate data processing is achieved, and the service life of the data memory is extended.
Patent Information
- Application Number
- CN202311803242.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-25
- Publication Date
- 2025-06-27
AI Technical Summary
When multiple read and write data in electronic devices, it will affect the service life of the eMMC.
By determining whether device data is stored in the data memory of the target device, obtaining the permission to use the reserved memory area, reading the device data from the data memory to the reserved memory area, and obtaining area information according to the operation instructions for reading and updating, avoiding repeated operations on the data memory.
Accurate and efficient processing of device data is realized, multiple operations on data memory are avoided, the service life of data memory is extended, and the efficiency of data processing is improved.
Smart Images

Figure CN120215802A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technologies, and in particular, to a data processing method, apparatus, electronic device, and computer-readable storage medium. Background Art
[0002] With the popularization of electronic devices, electronic devices are widely used in people's work and life. Currently, terminal devices often implement embedded data storage through eMMC. Among them, eMMC (Embedded Multi Media Card) is a standard specification established by the MMC Association, mainly for the embedded data memory of products such as mobile phones or tablet computers.
[0003] By reading or writing relevant data in an electronic device, the relevant functions of the electronic device can be realized. If data cannot be read and written in the electronic device, the use of the electronic device may be affected. Currently, when reading and writing data of an electronic device, it is mainly achieved by directly writing to the eMMC of the electronic device through a function interface (such as the mmc start rep function interface). However, when data needs to be read and written multiple times, the eMMC needs to be read and written multiple times, and multiple read and write operations of the eMMC will affect the service life of the eMMC. Summary of the Invention
[0004] Embodiments of this application provide a data processing method, apparatus, electronic device, and computer-readable storage medium, which can solve the technical problem that the service life of the device data memory is affected when the data of an application program is operated multiple times currently.
[0005] Embodiments of this application provide a data processing method, including:
[0006] Determine whether device data is stored in the data memory of the target device. When the device data is stored in the data memory, obtain the usage permission of the reserved memory area in the target device;
[0007] Read the device data from the data memory to the reserved memory area through the usage permission;
[0008] When an operation instruction of the device data is detected, obtain region information corresponding to the device data according to the operation instruction, and read the device data based on the region information, where the region information is used to indicate the storage position of the device data in the reserved memory area;
[0009] If it is detected that the target device shuts down, determine whether there is updated data associated with the device data in the reserved memory area;
[0010] When it is determined that the update data exists, write the update data from the reserved memory area to the data storage.
[0011] Further, the above-mentioned reading of the device data from the data storage to the reserved memory area through the usage permission includes:
[0012] Detect whether the operating system on the target device is started. When it is detected that the operating system is started, obtain the system interface of the operating system;
[0013] Through the usage permission and the system interface, read the device data from the data storage to the reserved memory area.
[0014] Thus, accurate reading of device data from the data storage is achieved, and further, when operating on the device data, repeated operations on the data storage, which may lead to a shorter service life of the data storage, are avoided.
[0015] Further, the above-mentioned obtaining of the area information corresponding to the device data according to the operation instruction includes:
[0016] Obtain the device tree corresponding to the target device according to the operation instruction;
[0017] Obtain the area information of the device data in the reserved memory area according to the device tree.
[0018] Thus, efficient and accurate obtaining of the area information corresponding to the device data is achieved, and further, the efficiency and accuracy of performing related operations on the data are improved.
[0019] Further, the above-mentioned obtaining of the area information of the device data in the reserved memory area from the device tree according to the operation instruction includes:
[0020] According to the operation instruction, obtain the address information and memory space information of the device data in the reserved memory area from the device tree;
[0021] Map the address information and the memory space information based on a preset mapping interface to obtain the area information of the device data in the reserved memory area.
[0022] Further, the above-mentioned reading of the device data based on the area information includes:
[0023] Judge whether the operation instruction is a read operation instruction. If the operation instruction is the read operation instruction, read the device data from the reserved memory area according to the area information.
[0024] Thus, precise and efficient reading of device data in the reserved memory area is achieved, avoiding repeated reading operations on the data memory.
[0025] Further, after determining whether the operation instruction is a read operation instruction, the following steps are also included:
[0026] If the operation instruction is a write operation instruction, extract the updated data from the write operation instruction, and update the device data in the reserved memory area according to the updated data and the area information.
[0027] Thus, updating of device data in the reserved memory area is achieved, further avoiding repeated writing to the data memory and increasing the service life of the data memory.
[0028] Further, writing the updated data from the reserved memory area to the data memory includes:
[0029] Obtain the preset data storage interface of the target device;
[0030] According to the data storage interface, write the updated data from the reserved memory area to the data memory.
[0031] Thus, precise and efficient unified writing of updated data in the data memory is achieved, avoiding data loss.
[0032] Correspondingly, an embodiment of the present application provides a data processing device, including:
[0033] A confirmation module, configured to determine whether device data is stored in the data memory of the target device, and when the device data is stored in the data memory, obtain the usage right of the reserved memory area in the target device;
[0034] An acquisition module, configured to read the device data from the data memory to the reserved memory area through the usage right;
[0035] A first execution module, configured to, when detecting an operation instruction for the device data, obtain the area information of the device data according to the operation instruction, and read the device data based on the area information, where the area information is used to indicate the storage location of the device data in the reserved memory area;
[0036] A detection module, configured to, if it is detected that the target device shuts down, determine whether there is updated data associated with the device data in the reserved memory area;
[0037] A second execution module, configured to write the updated data from the reserved memory area to the data memory when it is determined that the updated data exists.
[0038] In addition, an embodiment of the present application further provides an electronic device, including a processor and a data memory. The data memory stores a computer program, and the processor is configured to run the computer program in the data memory to implement the data processing method provided by the embodiment of the present application.
[0039] In addition, an embodiment of the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and the computer program is suitable for being loaded by a processor to execute any data processing method provided by the embodiment of the present application.
[0040] In addition, an embodiment of the present application further provides a computer program product, including a computer program, and the computer program implements any data processing method provided by the embodiment of the present application when executed by a processor.
[0041] In the embodiment of the present application, by determining whether device data is stored in the data memory of the target device, when the device data is stored in the data memory, the usage right of the reserved memory area in the target device is obtained; the device data is read from the data memory to the reserved memory area through the usage right, so that the reserved memory area can be used to operate the device data instead of the data memory; then, when an operation instruction for the device data is detected, the area information corresponding to the device data is obtained according to the operation instruction, and the device data is read based on the area information. The area information is used to indicate the storage location of the device data in the reserved memory area, so that the corresponding device data can be accurately read through the area information; if it is detected that the target device shuts down, it is determined whether there is updated data associated with the device data in the reserved memory area; when it is determined that there is updated data, the updated data is written from the reserved memory area to the data memory, thereby avoiding the loss of the updated data corresponding to the device data when the target device loses power. Thus, accurate and efficient processing of data is achieved, and multiple operations on the data in the device data memory are avoided, which may cause damage to the data memory, improving the service life of the data memory and the data processing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present application. For those skilled in the art, without creative efforts, other drawings can be obtained based on these drawings.
[0043] Figure 1It is a schematic flowchart of the data processing method provided by this application;
[0044] Figure 2 It is a schematic flowchart of another embodiment of the data processing method provided by this application;
[0045] Figure 3 It is a schematic flowchart of another embodiment of the data processing method provided by this application;
[0046] Figure 4 It is a schematic structural diagram of the data processing device provided by the embodiment of this application;
[0047] Figure 5 It is a schematic structural diagram of the electronic device provided by the embodiment of this application. Detailed implementation manners
[0048] Next, the technical solutions in the embodiments of this application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of this application. Obviously, the described embodiments are only a part of the embodiments of this application, rather than all the embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative efforts belong to the scope of protection of this application.
[0049] The embodiment of this application provides a data processing method, device, electronic device, and computer-readable storage medium. This data processing device can be integrated in an electronic device, and this electronic device can be a server or a terminal device, etc.
[0050] Among them, the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, network acceleration services (Content Delivery Network, CDN), and big data and artificial intelligence platforms.
[0051] The terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, etc., but is not limited thereto. The terminal and the server can be directly or indirectly connected through wired or wireless communication methods, and this application does not make any restrictions here.
[0052] In addition, "multiple" in the embodiment of this application means two or more. "First" and "second" in the embodiment of this application are used for differential description and cannot be understood as implying relative importance.
[0053] Currently, when reading and writing data of an electronic device, it is mainly achieved by directly writing to the eMMC (Embedded Multi Media Card) of the electronic device through a function interface (such as the mmc start rep function interface). When it is necessary to read and write data multiple times, multiple read and write operations on the eMMC are required. However, multiple read and write operations on the eMMC will affect the service life of the eMMC.
[0054] To solve the above problems, this application determines whether the target data device data is stored in the data memory of the target device. When the target data device data is stored in the data memory, the usage permission of the reserved memory area in the target device is obtained; the target data device data is read from the data memory to the reserved memory area through the usage permission, so that the reserved memory area can be used to replace the data memory to operate on the target data device data. Then, when an operation instruction for the device data is detected, the area information corresponding to the device data is obtained according to the operation instruction, and the device data is read based on the area information, so that the corresponding device data can be accurately read through the area information. Finally, if it is detected that the target device shuts down, it is determined whether there is updated data associated with the device data in the reserved memory area; when it is determined that there is updated data, the updated data is written from the reserved memory area to the data memory, which can avoid the loss of the updated data corresponding to the device data when the target device loses power. Thus, the accurate and efficient processing of data is finally realized, the multiple operations on the data in the device data memory are avoided, which may cause damage to the data memory, and the service life of the data memory and the efficiency of data processing are improved.
[0055] The following will be described in detail respectively. It should be noted that the description order of the following embodiments does not limit the preferred order of the embodiments.
[0056] Please refer to Figure 1 , Figure 1 which is a schematic flowchart of a data processing method provided by an embodiment of this application. The data processing method may include:
[0057] S101. Determine whether device data is stored in the data memory of the target device. When the device data is stored in the data memory, obtain the usage permission of the reserved memory area in the target device.
[0058] In this embodiment, a data memory is provided on the target device, such as an eMMC (Embedded Multi Media Card). The operating system and application data are stored on the data memory. The application can run on the target device through the operating system. Determine whether device data is stored in the data memory of the target device. The device data is data related to the keyword information (key) of the target device. The device data includes static device data and dynamic device data. The static device data includes the serial number and identification information of the device, such as the device code, etc.; the dynamic device data includes the data generated during the operation of the device or program, or the data used to run the device or program. The relevant functions of the device or program can be realized through the device data. Traverse and query all the data in the data memory of the target device, then it can be determined whether the device data is stored in the data memory of the target device. Specifically, if the identification information corresponding to the device data can be found from all the data stored in the target device data memory, it is determined that the device data is stored on the data memory; if the identification information corresponding to the device data cannot be found from all the data stored in the target device data memory, it is determined that the device data is not stored on the data memory. When the device data is stored in the data memory of the target device, obtain the usage permission of the reserved memory area in the target device. Specifically, the reserved memory area is a section of memory pre-reserved in the target device. Through the reserved memory area, the operating system or driver can be specified to use the corresponding memory, thus avoiding memory conflicts during operation. The reserved memory area is pre-set to a locked state in the target device. Therefore, when it is necessary to use the reserved memory area, the usage permission of the reserved memory area needs to be obtained in advance.
[0059] S102. When the device data is stored in the data memory, obtain the usage permission of the reserved memory area in the target device, and read the device data from the data memory to the reserved memory area through the usage permission.
[0060] In this embodiment, when the usage permission of the reserved memory area is obtained, the device data can be read from the data memory to the reserved memory area through the usage permission. The usage permission is the permission to use the reserved memory area. Through the usage permission, operations within the scope of the usage permission can be performed on the reserved memory area. For example, when the usage permission includes the write permission, the device data can be read from the data memory to the reserved memory area through the usage permission and a preset system interface; when the usage permission is the highest level permission, all operations within the scope of the highest level permission can be performed on the reserved memory area, such as data writing and data reading.
[0061] S103. When the operation instruction of the device data is detected, obtain the area information corresponding to the device data according to the operation instruction, and read the device data based on the area information, where the area information is used to indicate the storage location of the device data in the reserved memory area.
[0062] In this embodiment, the operation instruction is an instruction for performing related operations on the device data, such as a read operation instruction and a write operation instruction, etc. When the operation instruction of the device data is detected, obtain the area information of the device data in the reserved memory area. The area information includes the address information and the memory space information of the device data in the reserved memory area, and this area information is used to indicate the storage location of the device data in the reserved memory area. Among them, the address information is the start address information where the device data is stored in the reserved memory area, and the memory space information is the memory size occupied by the device data in the reserved memory area. Read the device data from the storage location corresponding to this area information according to this area information.
[0063] S104. If it is detected that the target device is shut down, determine whether there is updated data associated with the device data in the reserved memory area;
[0064] In this embodiment, after performing the operation corresponding to the operation instruction on the device data, determine whether there is updated data associated with the device data in the reserved memory area. Among them, the updated data can specifically be data obtained by updating and overwriting the device data, or data obtained by combining the updated data for updating the device data and the device data. When it is detected that the target device is shut down, scan the reserved memory area, and obtain candidate data that is inconsistent with the historical stored data from the reserved memory area; then, select the data associated with the device data from the candidate data to obtain the updated data.
[0065] S105. When it is determined that there is the updated data, write the updated data from the reserved memory area to the data storage.
[0066] When it is determined that there is updated data, read the updated data from the reserved memory area, and then write the updated data to the data storage for storage. Thus, when the device loses power, the updated data can be uniformly written from the reserved memory area to the data storage, and then the updated data can be stored by the data storage to avoid data loss.
[0067] The data processing method proposed in this embodiment determines whether device data is stored in the data memory of the target device. When the device data is stored in the data memory, the usage permission of the reserved memory area in the target device is obtained; the device data is read from the data memory to the reserved memory area through the usage permission, so that the reserved memory area can be used to operate on the device data instead of the data memory; then, when an operation instruction for the device data is detected, the area information corresponding to the device data is obtained according to the operation instruction, and the device data is read based on the area information. The area information is used to indicate the storage location of the device data in the reserved memory area, so that the corresponding device data can be accurately read through the area information; if it is detected that the target device shuts down, it is determined whether there is updated data associated with the device data in the reserved memory area; when it is determined that there is updated data, the updated data is written from the reserved memory area to the data memory. Thus, it is possible to avoid the loss of the updated data corresponding to the device data when the target device loses power. Therefore, accurate and efficient data processing is achieved, the multiple operations on the data in the device data memory are avoided, which may cause damage to the data memory, and the service life of the data memory and the data processing efficiency are improved.
[0068] As Figure 2 shown, Figure 2 is a schematic flowchart of another embodiment of the data processing method provided in this application. In some embodiments of this application, the above-mentioned reading of the device data from the data memory to the reserved memory area through the usage permission includes:
[0069] S201. Detect whether the operating system on the target device is started. When it is detected that the operating system is started, obtain the system interface of the operating system;
[0070] S202. Read the device data from the data memory to the reserved memory area through the usage permission and the system interface.
[0071] In this embodiment, the operating system is stored on the data memory of the target device. Through the operating system, application programs can be run and relevant operations can be performed on the data memory of the target device. Therefore, when reading device data from the data memory to the reserved memory area, it is necessary to detect whether the operating system on the target device is started, that is, whether the operating system is in the startup phase (uboot phase). When it is detected that the operating system of the target device is started, that is, when it is determined that the operating system is in the startup phase, the system interface of the operating system is obtained. Through the system interface of the operating system, device data can be read from the data memory to the reserved memory area. Specifically, the system interface of the operating system includes a data memory data reading interface and a memory area writing interface. Among them, the data memory data reading interface is used to read data in the data memory of the target device, such as the part_get_info_by_name() interface; the memory area writing interface is used to write device data from the data memory to the reserved memory area, such as the blk_dread() interface. When the data memory data reading interface and the memory area writing interface of the operating system are obtained, the device data is read from the data memory through the data memory data reading interface, and then, according to the obtained usage permission for operating on the reserved memory area and the memory area writing interface, the device data is written from the data memory to the reserved memory area.
[0072] In this embodiment, by detecting whether the operating system on the target device is started, when it is detected that the operating system is started, the system interface of the operating system is obtained; then, through the usage permission and the system interface, the device data is read from the data memory to the reserved memory area, realizing the accurate reading of the device data from the data memory, further avoiding the shortening of the service life of the data memory caused by repeated operations on the data memory when operating on the device data, thereby improving the service life of the data memory and the data processing efficiency.
[0073] In some embodiments of the present application, the obtaining of the area information corresponding to the device data according to the operation instruction includes:
[0074] Obtaining the device tree corresponding to the target device;
[0075] According to the operation instruction, the area information of the device data in the reserved memory area is obtained from the device tree.
[0076] In this embodiment, the device tree is a logical tree generated for all device information stored on the target device. The main trunk of the device tree is the system bus of the target device, and the branches connected to the system bus are various types of controllers. Therefore, pre-configuration is performed on the device information of various devices and the reserved memory area in the target device. When an operation instruction for device data is detected, the device tree corresponding to the target device is obtained, and the operation instruction is parsed to obtain the processing identifier of the operation instruction; according to the processing identifier, the area information of the device data in the reserved memory area is obtained from the device tree.
[0077] In this embodiment, by obtaining the device tree corresponding to the target device; then, according to the operation instruction, the area information of the device data in the reserved memory area is obtained from the device tree, which realizes the efficient and accurate acquisition of the area information corresponding to the device data, and further improves the efficiency and accuracy of performing related operations on the data.
[0078] As Figure 3 shown, Figure 3 FIG. is a schematic flowchart of another embodiment of the data processing method provided by the present application. In some embodiments of the present application, the above-mentioned obtaining the area information of the device data in the reserved memory area from the device tree according to the operation instruction includes:
[0079] S301, obtaining the address information and memory space information of the device data in the reserved memory area from the device tree according to the operation instruction;
[0080] S302, mapping the address information and the memory space information based on a preset mapping interface to obtain the area information of the device data in the reserved memory area.
[0081] In this embodiment, the address information and memory space information of the reserved memory area can be obtained from the device tree according to the operation instruction. Specifically, the address information is the start address information of the device data in the reserved memory area, and the memory space information is the memory size occupied by the device data in the reserved memory area. The device tree is obtained through the driver layer of the target device, and then the address information and memory space information of the device data in the reserved memory area can be found from the device tree based on the operation instruction. When the address information and memory space information are obtained, a preset mapping interface is obtained. Among them, the mapping interface is a preset area mapping interface, such as the ioremap interface. Through this mapping interface, the address information and memory space information of the device data in the reserved memory area can be mapped to obtain the area information of the device data in the reserved memory area.
[0082] In this embodiment, the address information and memory space information of the device data in the reserved memory area are obtained from the device tree according to the operation instruction; then, the address information and memory space information are mapped based on a preset mapping interface to obtain the area information of the device data in the reserved memory area, achieving accurate acquisition of the area information of the device data in the reserved memory area, and further enabling the accurate acquisition of the device data through this area information.
[0083] In some embodiments of the present application, the above-mentioned reading of the device data based on the area information includes:
[0084] Determine whether the operation instruction is a read operation instruction. If the operation instruction is the read operation instruction, then read the device data from the reserved memory area according to the area information.
[0085] In this embodiment, the operation instruction includes a write operation instruction and a read operation instruction. Among them, the write operation instruction is to write device data into the reserved memory area, and the read operation instruction is to read device data from the reserved memory area. Therefore, when reading device data based on the area information, it is determined whether the operation instruction is a read operation instruction. When the operation instruction is a read operation instruction, execute this read operation instruction, and read the device data from the storage location corresponding to the area information in the reserved memory area according to a preset data reading interface and the area information. Specifically, the preset data reading interface includes a position pointing parameter, a data source parameter, and a number of bytes. The position pointing parameter in this data reading interface is used to point to the target storage location corresponding to the device data, the data source parameter is used to point to the current storage location corresponding to the device data, and the number of bytes is the number of bytes for reading this device data. Combine the area information with this data reading interface to generate a data reading statement, and the device data can be read from the reserved memory area through this data reading statement.
[0086] In this embodiment, by determining whether the operation instruction is a read operation instruction, if the operation instruction is a read operation instruction, then read the device data from the reserved memory area according to the area information, achieving accurate and efficient reading of the device data in the reserved memory area, and avoiding repeated reading operations on the data memory.
[0087] In some embodiments of the present application, after the above-mentioned determination of whether the operation instruction is a read operation instruction, it further includes:
[0088] If the operation instruction is a write operation instruction, extract the updated data from the write operation instruction, and update the device data in the reserved memory area according to the updated data and the area information.
[0089] In this embodiment, when the operation instruction is a write operation instruction, update data is obtained from the write operation instruction, and according to the update data, area information, and a preset data write interface, the update data is written into the reserved memory area. Specifically, the update data is the data extracted from the write operation instruction, and this update data is associated with the device data. Through this update data, the device data can be overwritten or combined with the device data. For example, after the device data is read out from the reserved memory area, the device data is modified to obtain the update data, and this update data is associated with the device data. The preset data write interface includes a position pointing parameter, a data source parameter, and a number of bytes. Among them, the position pointing parameter is a pointer to the target I / O address space, such as to, which is used to point to the address where the update data is written, that is, the address of the reserved memory area; the data source parameter is a pointer to the source area, such as from, which is used to point to the update data to be copied; the number of bytes is the number of bytes written to the device data, such as count. The area information is combined with the data write interface to generate a data write statement, and through this data write statement, the update data can be written into the reserved memory area. Further, when the update data associated with the device data is read out from the reserved memory area, the update data can also be read out from the reserved memory area through the above-mentioned read operation instruction.
[0090] In this embodiment, if the operation instruction is a write operation instruction, update data is extracted from the write operation instruction, and according to the update data and area information, the device data in the reserved memory area is updated, realizing the update of the device data in the reserved memory area, further avoiding repeated writing to the data memory, and improving the service life of the data memory.
[0091] In some embodiments of the present application, the above-mentioned writing the update data from the reserved memory area to the data memory includes:
[0092] Obtain the preset data storage interface of the target device;
[0093] According to the data storage interface, write the update data from the reserved memory area to the data memory.
[0094] In this embodiment, the data storage interface is an interface preset for the target device to store data. Through this data storage interface, the updated data can be stored in the data memory of the target device. Among them, the data storage interface includes a memory opening interface and a writing interface. The memory opening interface is used to open the memory block where the updated data is stored in the reserved memory area, and the writing interface is used to write the updated data into the data memory. Specifically, when obtaining the memory opening interface and the writing interface in the data storage interface, through the memory opening interface, such as flip_open(), the memory block where the updated data is stored in the reserved memory area is opened; then, through this writing interface, such as Vfs_write(), the updated data is written from the reserved memory area of the target device into the data memory.
[0095] In this embodiment, by obtaining the preset data storage interface of the target device; then, according to the data storage interface, writing the updated data from the reserved memory area into the data memory, the accurate and efficient unified writing of the updated data in the data memory is realized, and data loss is avoided.
[0096] To facilitate better implementation of the data processing method provided in the embodiments of the present application, the embodiments of the present application also provide a device based on the above data processing method. The meanings of the nouns are the same as those in the above data processing method, and the specific implementation details can refer to the descriptions in the method embodiments.
[0097] For example, as Figure 4 shown, the data processing device may include: a confirmation module 401, an acquisition module 402, a first execution module 403, a detection module 404, and a second execution module 405. Among them,
[0098] The confirmation module 401 is used to determine whether device data is stored in the data memory of the target device. When the device data is stored in the data memory, obtain the usage permission of the reserved memory area in the target device;
[0099] The acquisition module 402 is used to read the device data from the data memory to the reserved memory area through the usage permission;
[0100] The first execution module 403 is used to, when detecting an operation instruction of the device data, obtain area information of the device data according to the operation instruction, and read the device data based on the area information, where the area information is used to indicate the storage location of the device data in the reserved memory area;
[0101] The detection module 404 is used to, if it detects that the target device shuts down, determine whether there is updated data associated with the device data in the reserved memory area;
[0102] A second execution module 405, configured to write the update data from the reserved memory area to the data memory when it is determined that the update data exists.
[0103] In an embodiment of the present application, the above-mentioned acquisition module 402 includes:
[0104] A detection unit, configured to detect whether the operating system on the target device is started, and when it is detected that the operating system is started, obtain the system interface of the operating system;
[0105] A first reading unit, configured to read the device data from the data memory to the reserved memory area through the usage permission and the system interface.
[0106] In an embodiment of the present application, the above-mentioned detection module 403 includes:
[0107] A first acquisition unit, configured to acquire the device tree corresponding to the target device;
[0108] A second acquisition unit, configured to acquire the area information of the device data in the reserved memory area from the device tree according to the operation instruction.
[0109] In an embodiment of the present application, the above-mentioned second acquisition unit includes:
[0110] A first acquisition subunit, configured to acquire the address information and memory space information of the device data in the reserved memory area from the device tree according to the operation instruction;
[0111] A mapping unit, configured to map the address information and the memory space information based on a preset mapping interface to obtain the area information of the device data in the reserved memory area.
[0112] In an embodiment of the present application, the above-mentioned first execution module 403 includes:
[0113] A second reading unit, configured to determine whether the operation instruction is a read operation instruction, and if the operation instruction is the read operation instruction, read the device data from the reserved memory area according to the area information.
[0114] A writing unit, configured to, if the operation instruction is a write operation instruction, extract update data from the write operation instruction, and update the device data in the reserved memory area according to the update data and the area information.
[0115] In an embodiment of the present application, the above-mentioned second execution module 405 includes:
[0116] A second acquisition subunit, configured to acquire a preset data storage interface of the target device;
[0117] A third writing unit, configured to write the updated data from the reserved memory area to the data memory according to the data storage interface.
[0118] The data processing device provided in this application realizes precise and efficient processing of data, avoids multiple operations on the data in the device data memory, which may cause damage to the data memory, and improves the service life of the data memory and the data processing efficiency.
[0119] In specific implementation, each of the above modules can be implemented as an independent entity, or can be combined arbitrarily to be implemented as the same or several entities. For the specific implementation manners of each of the above modules and the corresponding beneficial effects, reference can be made to the foregoing method embodiments, which will not be elaborated herein.
[0120] An embodiment of this application further provides an electronic device, which can be a server or a terminal, etc. As Figure 5 shown, it shows a schematic structural diagram of the electronic device involved in the embodiment of this application. Specifically:
[0121] The electronic device may include a processor 601 with one or more processing cores, a memory 602 with one or more computer-readable storage media, a power supply 603, an input unit 604, and other components. Those skilled in the art can understand that Figure 5 the structural diagram of the electronic device shown in
[0122] does not constitute a limitation on the electronic device, and may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements. Among them:
[0123] The memory 602 can be used to store computer programs and modules. The processor 601 executes various functional applications and data processing by running the computer programs and modules stored in the memory 602. The memory 602 mainly includes a program storage area and a data storage area. Among them, the program storage area can store an operating system, computer programs required for at least one function (such as a sound playback function, an image playback function, etc.); the data storage area can store data created according to the use of the electronic device. In addition, the memory 602 can include high-speed random access memory and can also include non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other volatile solid-state storage devices. Correspondingly, the memory 602 can also include a memory controller to provide the processor 601 with access to the memory 602.
[0124] The electronic device further includes a power supply 603 for powering each component. Preferably, the power supply 603 can be logically connected to the processor 601 through a power management system, so as to implement functions such as management of charging, discharging, and power consumption management through the power management system. The power supply 603 can also include any components such as one or more DC or AC power supplies, a recharge system, a power failure detection circuit, a power converter or inverter, and a power status indicator.
[0125] The electronic device may further include an input unit 604, which can be used to receive input digital or character information, and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function controls.
[0126] Although not shown, the electronic device may further include a display unit, etc., which will not be elaborated here. Specifically, in this embodiment, the processor 601 in the electronic device will load the executable files corresponding to the processes of one or more computer programs into the memory 602 according to the following instructions, and the processor 601 will run the computer programs stored in the memory 602 to implement various functions, such as:
[0127] Determine whether device data is stored in the data memory of the target device. When the device data is stored in the data memory, obtain the usage permission of the reserved memory area in the target device;
[0128] Read the device data from the data memory to the reserved memory area through the usage permission;
[0129] When an operation instruction of the device data is detected, obtain the area information corresponding to the device data according to the operation instruction, and read the device data based on the area information. The area information is used to indicate the storage location of the device data in the reserved memory area;
[0130] If it is detected that the target device is powered off, determine whether there is updated data associated with the device data in the reserved memory area;
[0131] When it is determined that there is the updated data, write the updated data from the reserved memory area to the data storage.
[0132] The electronic device proposed in this embodiment realizes precise and efficient processing of data, avoids multiple operations on the data in the device data storage, which may cause damage to the data storage, and improves the service life of the data storage and the data processing efficiency.
[0133] For the specific implementation manners of the above operations and the corresponding beneficial effects, reference can be made to the detailed description of the data processing method above, which will not be elaborated here.
[0134] Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by a computer program, or controlled by a computer program for related hardware. The computer program can be stored in a computer-readable storage medium and loaded and executed by a processor.
[0135] Therefore, an embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. The computer program can be loaded by a processor to execute the steps in any data processing method provided by the embodiment of the present application. For example, the computer program can execute the following steps:
[0136] Determine whether device data is stored in the data storage of the target device. When the device data is stored in the data storage, obtain the usage permission of the reserved memory area in the target device;
[0137] Read the device data from the data storage to the reserved memory area through the usage permission;
[0138] When an operation instruction of the device data is detected, obtain area information corresponding to the device data according to the operation instruction, and read the device data based on the area information. The area information is used to indicate the storage position of the device data in the reserved memory area;
[0139] If it is detected that the target device is powered off, determine whether there is updated data associated with the device data in the reserved memory area;
[0140] When it is determined that there is the updated data, write the updated data from the reserved memory area to the data storage.
[0141] The computer-readable storage medium proposed in this embodiment realizes the precise and efficient processing of data, avoids multiple operations on the data in the device data memory, which may cause damage to the data memory, and improves the service life of the data memory and the data processing efficiency.
[0142] For the specific implementation manners of the above respective operations and the corresponding beneficial effects, reference may be made to the previous embodiments, which will not be elaborated herein.
[0143] Among them, the computer-readable storage medium may include: read-only memory (ROM, Read Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disc, etc.
[0144] Since the computer program stored in the computer-readable storage medium can execute the steps in any of the data processing methods provided in the embodiments of the present application, the beneficial effects achievable by any of the data processing methods provided in the embodiments of the present application can be realized. For details, reference may be made to the previous embodiments, which will not be elaborated herein.
[0145] Among them, according to one aspect of the present application, a computer program product or a computer program is provided. The computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the above data processing method.
[0146] The above has introduced in detail a data processing method, device, electronic device and computer-readable storage medium provided by the embodiments of the present application. Specific examples are used in this article to elaborate on the principle and implementation manner of the present application. The description of the above embodiments is only used to help understand the method and its core idea of the present application; at the same time, for those skilled in the art, according to the idea of the present application, there will be changes in the specific implementation manner and application scope. In summary, the content of this specification should not be construed as a limitation to the present application.
Claims
1. A data processing method, characterized in that, Including: Determine whether device data is stored in the data memory of the target device. When the device data is stored in the data memory, obtain the usage permission of the reserved memory area in the target device; Read the device data from the data memory to the reserved memory area through the usage permission; When an operation instruction for the device data is detected, obtain the area information corresponding to the device data according to the operation instruction, and read the device data based on the area information. The area information is used to indicate the storage location of the device data in the reserved memory area; If it is detected that the target device shuts down, determine whether there is updated data associated with the device data in the reserved memory area; When it is determined that there is updated data, write the updated data from the reserved memory area to the data memory.
2. The data processing method according to claim 1, characterized in that The step of reading the device data from the data memory to the reserved memory area through the usage permission includes: Detect whether the operating system on the target device is started. When it is detected that the operating system is started, obtain the system interface of the operating system; Read the device data from the data memory to the reserved memory area through the usage permission and the system interface.
3. The data processing method according to claim 1, wherein The step of obtaining the area information corresponding to the device data according to the operation instruction includes: Obtain the device tree corresponding to the target device; According to the operation instruction, obtain the area information of the device data in the reserved memory area from the device tree.
4. The data processing method according to claim 3, wherein The step of obtaining the area information of the device data in the reserved memory area from the device tree according to the operation instruction includes: According to the operation instruction, obtain the address information and memory space information of the device data in the reserved memory area from the device tree; Map the address information and the memory space information based on a preset mapping interface to obtain the area information of the device data in the reserved memory area.
5. The data processing method according to claim 1, wherein The step of reading the device data based on the area information includes: Judge whether the operation instruction is a read operation instruction. If the operation instruction is the read operation instruction, read the device data from the reserved memory area according to the area information.
6. The data processing method according to claim 5, wherein After judging whether the operation instruction is a read operation instruction, it further includes: If the operation instruction is a write operation instruction, extract the updated data from the write operation instruction, and update the device data in the reserved memory area according to the updated data and the area information.
7. The data processing method according to claim 1, wherein The step of writing the updated data from the reserved memory area to the data memory includes: Obtain the preset data storage interface of the target device; According to the data storage interface, write the updated data from the reserved memory area to the data memory.
8. A data processing device, characterized in that, Including: A confirmation module, configured to determine whether device data is stored in the data memory of the target device. When the device data is stored in the data memory, obtain the usage permission of the reserved memory area in the target device; An acquisition module, configured to read the device data from the data memory to the reserved memory area through the usage permission; A first execution module, configured to, when detecting an operation instruction for the device data, obtain area information of the device data according to the operation instruction, and read the device data based on the area information, where the area information is used to indicate a storage location of the device data in the reserved memory area; A detection module, configured to, if detecting that the target device is powered off, determine whether there is updated data associated with the device data in the reserved memory area; A second execution module, configured to, when determining that there is the updated data, write the updated data from the reserved memory area to the data memory.
9. An electronic device, characterized in that, It includes a processor and a data memory, where the data memory stores a computer program, and the processor is configured to run the computer program in the data memory to execute the data processing method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, and the computer program is suitable for being loaded by a processor to execute the data processing method according to any one of claims 1 to 7.