Method and device for accessing external storage equipment, storage medium and electronic equipment
By acquiring and correcting the mounting attribute information and storage space occupancy information of the external storage device of the embedded device, the problem that the embedded device cannot access the external storage device normally is solved, and the stability and reliability of data interaction are improved.
Patent Information
- Application Number
- CN202410957589.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-17
- Publication Date
- 2024-12-03
AI Technical Summary
The data interaction between embedded devices and external storage devices is low stability and reliability, resulting in embedded devices being unable to access external storage devices normally.
By obtaining the mount attribute information of the external storage device of the embedded device, correcting the permission settings, obtaining the occupancy information of the storage space, and accessing the external storage device based on the occupancy information to ensure the normal progress of data reading and writing.
Improve the stability and reliability of data interaction between embedded devices and external storage devices, and avoid data loss and operation failure caused by permission errors and insufficient storage space.
Smart Images

Figure CN119065598A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of computer technology, and more specifically, to a method, apparatus, storage medium and electronic device for accessing an external storage device. Background Art
[0002] In today's era of rapid technological development, the functions of embedded devices are becoming increasingly rich and powerful, and the requirements for data storage are also greatly increased. These devices are widely used in various fields. However, in order to control costs and adapt to specific application scenarios, embedded devices are often equipped with small-capacity built-in storage devices. In the initial stage, such storage solutions can still meet the needs, but as the device is used more deeply and the amount of data continues to increase, its storage capacity is soon stretched.
[0003] To solve this problem, many embedded devices use external storage devices (such as USB flash drives) to expand storage space. This method alleviates the space shortage to a certain extent, but there are still problems such as low stability and reliability of data exchange between embedded devices and external storage devices, and the embedded devices cannot normally access external storage devices. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide a method, apparatus, storage medium and electronic device for accessing an external storage device, aiming to solve the technical problems in the prior art that the stability and reliability of data interaction between an embedded device and an external storage device are low, and the embedded device cannot normally access the external storage device.
[0005] To achieve the above object, according to a first aspect of the present application, a method for accessing an external storage device is provided, the method comprising:
[0006] Get the mount property information of the external storage device of the embedded device;
[0007] If it is determined based on the mount attribute information that the permission setting of the external storage device is incorrect, correcting the mount attribute information;
[0008] After the mount attribute information is modified, obtaining the storage space occupancy information of the external storage device;
[0009] The external storage device is accessed according to the occupancy information of the storage space.
[0010] Optionally, in a possible implementation manner of the first aspect, the acquiring mounting attribute information of an external storage device of the embedded device includes:
[0011] Before the embedded device accesses the external storage device each time, the mount attribute information of the external storage device is detected through a system detection command of the embedded device.
[0012] Optionally, in a possible implementation manner of the first aspect, when the mount attribute information includes: read and write permission information and a device identifier, if it is determined based on the mount attribute information that the permission setting of the external storage device is incorrect, correcting the mount attribute information includes:
[0013] If it is determined based on the read / write permission information that the read / write permission setting of the external storage device is incorrect, the read / write permission information is corrected through a system correction command of the embedded device, wherein the system correction command carries a device identifier of the external storage device.
[0014] Optionally, in a possible implementation manner of the first aspect, the method further includes:
[0015] If the read / write permission information indicates that the read / write permission of the external storage device is read-only and not writable, it is determined that the read / write permission of the external storage device is incorrectly set.
[0016] Optionally, in a possible implementation manner of the first aspect, the modifying the read-write permission information by using a system modification command of the embedded device includes:
[0017] The read and write permissions of the external storage device are remounted as readable and writable through the system correction command of the embedded device, so as to obtain the corrected read and write permission information.
[0018] Optionally, in a possible implementation manner of the first aspect, the acquiring the occupancy information of the storage space of the external storage device includes:
[0019] Regularly checking the occupied space and remaining available space of the storage space of the external storage device;
[0020] Occupancy information of the storage space is determined according to the occupied space and the remaining available space.
[0021] Optionally, in a possible implementation manner of the first aspect, accessing the external storage device according to the occupancy information of the storage space includes:
[0022] If the occupancy information of the storage space indicates that the remaining available space does not meet the reserved space limit, updating the storage space of the external storage device;
[0023] After the storage space of the external storage device is updated, a read and write operation is performed on the external storage device to access the external storage device.
[0024] Optionally, in a possible implementation manner of the first aspect, if the occupancy information of the storage space indicates that the remaining available space does not meet the reserved space limit, updating the storage space of the external storage device includes:
[0025] If the occupancy information of the storage space indicates that the remaining available space does not meet the reserved space limit, obtaining the write time of the storage data in the occupied space;
[0026] According to the writing time of the stored data in the occupied space, a predetermined proportion of the stored data in the occupied space is deleted to update the storage space of the external storage device.
[0027] According to a second aspect of the present application, there is provided an apparatus for accessing an external storage device, comprising:
[0028] A first acquisition unit, used to acquire mounting attribute information of an external storage device of the embedded device;
[0029] a correction unit, configured to correct the mount attribute information if it is determined based on the mount attribute information that the permission setting of the external storage device is incorrect;
[0030] A second acquisition unit, configured to acquire the occupancy information of the storage space of the external storage device after the modification of the mount attribute information is completed;
[0031] The access unit is used to access the external storage device according to the occupancy information of the storage space.
[0032] The second aspect and any implementation of the second aspect correspond to the first aspect and any implementation of the first aspect, respectively. The technical effects corresponding to the second aspect and any implementation of the second aspect can refer to the technical effects corresponding to the first aspect and any implementation of the first aspect, which will not be repeated here.
[0033] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements any of the methods described above when executing the computer program.
[0034] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements any of the methods described above.
[0035] In a fifth aspect, an embodiment of the present application provides a computer program product. When the computer program product is run on an electronic device, the electronic device executes any one of the methods described in the first aspect.
[0036] It can be understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here.
[0037] The embodiment of the present application provides a method, device, storage medium and electronic device for accessing an external storage device. The method can fully understand the initial state of the external storage device, including key information such as its permission settings, by obtaining the mount attribute information of the external storage device of the embedded device. If it is found that the permission setting of the external storage device is incorrect, the mount attribute information can be corrected in time, thereby avoiding the problem of data being unable to be written and possible data loss due to permission errors, and ensuring the normal reading and writing of data.
[0038] After the mount attribute information is modified, the storage space usage information of the external storage device is obtained, so that the system can clearly understand the remaining space of the storage device. Finally, the external storage device is accessed according to the storage space usage information. This ensures that when performing data read and write operations, the operation will not fail due to insufficient storage space, and realizes the reasonable use and effective management of storage space.
[0039] The method for accessing an external storage device provided by the example of this application effectively solves access anomalies such as data inability to write and loss caused by changes in the permissions of the external storage device and improper storage space management, and improves the stability and reliability of data interaction between the embedded device and the external storage device. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0041] Figure 1 It is a flowchart of a method for accessing an external storage device provided by an embodiment of the present application;
[0042] Figure 2 It is a flowchart of an optional method for accessing an external storage device provided in an embodiment of the present application;
[0043] Figure 3It is a flowchart of an optional method for accessing an external storage device provided in an embodiment of the present application;
[0044] Figure 4 It is a flowchart of an optional method for accessing an external storage device provided in an embodiment of the present application;
[0045] Figure 5 It is a flowchart of an optional method for accessing an external storage device provided in an embodiment of the present application;
[0046] Figure 6 It is a structural diagram of a device for accessing an external storage device provided by an embodiment of the present application;
[0047] Figure 7 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0048] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0049] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0050] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0051] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.
[0052] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0053] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0054] First, some terms in the embodiments of the present application are explained to facilitate understanding by those skilled in the art.
[0055] The full name of U disk is “USB flash drive” (USB F l ash Dis sk), where “USB” is the abbreviation of Universal Serial Bus (Universa l Ser ia l Bus).
[0056] The full name of SD card is “Secure Digital Memory Card”, which is a secure digital memory card.
[0057] The full name of SATA is “Serial Advanced Technology Attachment”, which means serial advanced technology attachment.
[0058] The above is a brief introduction to the nouns involved in the embodiments of the present application, which will not be repeated below.
[0059] In today's era of rapid technological development, embedded devices are becoming increasingly powerful and functional, and the requirements for data storage have also increased significantly. These devices are widely used in various fields. The preservation of key data such as user personalized settings and operation logs is of great significance for improving user experience and solving subsequent problems. At the same time, historical data such as environmental data collected by sensors, usage statistics, and records required for long-term analysis and reporting also need to be stored reliably. In specific areas such as security monitoring and industrial automation, timely recording and secure storage of alarm data are extremely critical for subsequent analysis and measures.
[0060] However, in order to control costs and adapt to specific application scenarios, embedded devices are often equipped with small-capacity built-in storage devices. In the initial stage, such storage solutions can still meet the needs, but as the device is used more deeply and the amount of data continues to increase, its storage capacity will soon be stretched.
[0061] To solve this problem, many embedded devices use external storage devices (such as USB flash drives) to expand storage space. This approach alleviates the space shortage to a certain extent and achieves a balance between cost and performance. However, since the external storage device has an independent file system, when the embedded device and the external storage device perform cross-file system read and write operations, during frequent data exchange, the external storage device may enter a locked state, causing the read and write permissions to change, resulting in data being unable to be written, and ultimately causing data loss, causing great trouble and loss to users.
[0062] In summary, how to ensure stable reading and writing and secure storage of data while using external storage devices to expand storage space has become an important issue that needs to be urgently solved in the field of embedded devices.
[0063] To solve the above problems, this application example provides a method for accessing an external storage device. Figure 1 As shown, Figure 1 A schematic flow chart of a method for accessing an external storage device provided by the present application is shown. As an example but not a limitation, the method can be applied to an embedded device. The method includes:
[0064] S101, obtaining mounting attribute information of an external storage device of an embedded device;
[0065] S102, if it is determined based on the mount attribute information that the permission setting of the external storage device is incorrect, then correct the mount attribute information;
[0066] S103, after the modification of the mount attribute information is completed, obtaining the storage space occupancy information of the external storage device;
[0067] S104: Access the external storage device according to the occupancy information of the storage space.
[0068] Optionally, in the examples of this application, the above-mentioned embedded devices usually refer to computer systems designed for specific functions, with special features and miniaturization, such as control modules in smart home appliances, electronic control units in cars, controllers in industrial automation equipment, etc. External storage devices refer to those devices that are not built into the embedded device itself, but are connected to the embedded device through an interface (such as a USB interface, SD card slot, SATA interface, etc.) to expand its storage capacity or provide data exchange functions.
[0069] Optionally, in the example of the present application, the above-mentioned external storage device can be understood as an external expansion storage device, such as a USB flash drive, a mobile hard disk (mechanical mobile hard disk and solid-state mobile hard disk), a memory card, a CD, an external optical drive, etc.
[0070] As an optional implementation method, first, the mount attribute information of the external storage device of the embedded device can be obtained. By detecting the mount attribute information of the external storage device, some current status and permission settings of the external storage device can be understood. Afterwards, if the permission settings of the external storage device are found to be incorrect according to the mount attribute information, such as the read and write permissions are accidentally changed, the system will correct these mount attribute information and adjust them to the correct permission settings to ensure that subsequent data read and write operations can be performed normally.
[0071] After the mount attribute information is modified, the system will further obtain the storage space occupancy information of the external storage device. Finally, according to the obtained storage space occupancy information, the system will access the external storage device.
[0072] As an optional implementation method, taking the above-mentioned external storage device as an external U disk as an example, when the embedded device needs to write data to the external U disk, the system will first obtain the mount attribute information of the U disk, and if it finds that its permission setting is incorrect (for example, from "readable and writable" to "read-only"), it will immediately correct it to readable and writable. Then, the storage space occupancy of the U disk is obtained. If the remaining space is insufficient, the system will automatically delete some old data according to the set strategy to free up enough available storage space. After completing these steps, the system starts to write data to the U disk, thereby ensuring the smooth writing of data, while also ensuring the integrity and availability of the data in the U disk.
[0073] Through the above method example, the embedded device can better manage the writing and storage of data when accessing the external storage device, avoiding writing failure or data loss due to permission issues, and can also effectively prevent the situation where data cannot be written due to exhaustion of storage space.
[0074] Please refer to Figure 2 As shown, Figure 2 A schematic flow chart of an optional method for accessing an external storage device provided by the present application is shown. In a possible implementation, the above-mentioned obtaining the mount attribute information of the external storage device of the embedded device includes:
[0075] S201, before the embedded device accesses the external storage device each time, detecting the mount attribute information of the external storage device through a system detection command of the embedded device.
[0076] Specifically, before the embedded device performs a read or write operation on the external storage device each time, the embedded device will use the system detection command of the embedded device itself to check the mount attribute information of the external storage device.
[0077] For example, suppose the embedded device is an intelligent monitoring device. Before the intelligent monitoring device is ready to write new monitoring data to an external USB flash drive, it will first run a specific system detection command to check the mount attribute information of the USB flash drive, such as whether it is readable and writable, the file system type, etc., to ensure that the subsequent data writing operation can proceed smoothly. For another example, in an industrial control embedded system, before reading key configuration information from an external mobile hard drive, such a detection operation will also be performed to confirm that the mount attribute of the mobile hard drive is normal and that the required data can be successfully read, so as to prevent problems in the production process due to data loss.
[0078] Through the example of this application, before the embedded device accesses the above-mentioned external storage device each time, the mount attribute information is detected in advance, so that possible permission errors or other anomalies can be discovered and corrected in time, ensuring that read and write operations will not fail due to permission issues, thereby increasing the probability of successful data reading and writing.
[0079] Please refer to Figure 3 As shown, Figure 3 A schematic flow chart of an optional method for accessing an external storage device provided by the present application is shown. In another possible implementation, when the mount attribute information includes: read and write permission information and a device identifier, if it is determined based on the mount attribute information that the permission setting of the external storage device is incorrect, then correcting the mount attribute information includes:
[0080] S301, if it is determined based on the read and write permission information that the read and write permission settings of the external storage device are incorrect, the read and write permission information is corrected through a system correction command of the embedded device, wherein the system correction command carries a device identifier of the external storage device.
[0081] First, in the example of this application, when judging and correcting the permissions of the external storage device, the specific mount attribute information used includes read and write permission information and a device identifier.
[0082] Then, if it is determined based on the read and write permission information that the read and write permission settings of the external storage device are incorrect, the system correction command of the embedded device can be used to correct it. It should be understood that in the example of this application, the correction of permissions is achieved through a specific system command. Since the system correction command also carries the device identifier of the external storage device, this means that the system can accurately identify and perform correction operations on the specific external storage device with permission errors.
[0083] There is also a possible implementation method that provides a specific situation for determining that the read and write permissions of the external storage device are set incorrectly, making the entire process clearer and more operational:
[0084] If the read / write permission information indicates that the read / write permission of the external storage device is read-only and not writable, it is determined that the read / write permission setting of the external storage device is incorrect. It should be understood that if the read / write permission information indicates that the read / write permission of the external storage device is "read-only and not writable" (ro), then it is determined that the read / write permission setting of the external storage device is incorrect (incorrect).
[0085] For example, when it is detected that the read and write permissions of a USB flash drive (with a specific device identifier) are incorrectly set to read-only (ro), it can be determined that the read and write permissions are set incorrectly and need to be corrected to "rw" (read and write). The system will use the correction command containing the device identifier of the USB flash drive to change the read and write permissions of the USB flash drive from read-only (ro) to read and write (ro) to restore normal read and write functions.
[0086] Through the above example, the read and write permission errors of the external storage device are corrected in time to ensure that data can be written or read as expected, avoiding the interruption or failure of data operations caused by permission issues.
[0087] In a possible implementation, the read and write permission information is corrected through the system correction command of the embedded device, including: remounting the read and write permissions of the external storage device as readable and writable through the system correction command of the embedded device to obtain the corrected read and write permission information.
[0088] In this application example, the specific method and goal of modifying the read and write permissions are clearly defined, making the entire method more standardized and operational in practical applications.
[0089] Taking the above-mentioned external storage device as a USB flash drive as an example, when modifying the read and write permission information of the USB flash drive, the system modification command of the embedded device is used. For example, the command can be specifically: mount-o remount,rw "U disk device" command, which remounts the read and write permissions of the USB flash drive to the "readable and writable" (rw) state, completes the permission modification operation, and thereby obtains the modified read and write permission information.
[0090] Please refer to Figure 4 As shown, Figure 4 A schematic flow chart of an optional method for accessing an external storage device provided by the present application is shown. In a possible implementation, the above-mentioned obtaining the occupancy information of the storage space of the above-mentioned external storage device includes:
[0091] S401, regularly detecting the occupied space and remaining available space of the storage space of the external storage device;
[0092] S402: Determine occupancy information of the storage space according to the occupied space and the remaining available space.
[0093] First of all, it should be understood that the above-mentioned periodic detection of the occupied space and the remaining available space of the storage space of the external storage device refers to the embedded device obtaining the storage space information of the external storage device through periodic detection, for example, continuously detecting the occupied space and the remaining available space (free space) of the storage space of the external storage device, or periodically checking the storage space status of the external storage device through polling to determine the occupied space and the remaining available space (free space) in the storage space.
[0094] Secondly, the storage space occupancy information is determined based on the occupied space and the remaining available space. It can be understood that the complete information about the storage space occupancy is obtained by synthesizing these two specific parameters, which helps the embedded device monitor or fully understand the storage space status of the external storage device.
[0095] For example, still taking the above-mentioned external storage device as a USB flash drive as an example, in actual applications, the embedded device can detect once every period of time (for example, every 2 minutes) that the occupied space of the external USB flash drive is 5GB and the remaining available space is 3GB, and then determine the current storage space occupancy information of the USB flash drive based on these two data as approximately 62.5% of the occupied space and approximately 37.5% of the remaining available space.
[0096] Please refer to Figure 5 As shown, Figure 5 A schematic flow chart of an optional method for accessing an external storage device provided by the present application is shown. In a possible implementation, accessing the external storage device according to the occupancy information of the storage space includes:
[0097] S501, if the occupancy information of the storage space indicates that the remaining available space does not meet the reserved space limit, updating the storage space of the external storage device;
[0098] S502: After updating the storage space of the external storage device, performing a read and write operation on the external storage device to access the external storage device.
[0099] Optionally, in the present application example, the user can set the upper limit of the storage space usage of the external storage device and the reserved space limit through the interface of the host computer software, which is specifically expressed as a percentage of the total storage space of the external storage device.
[0100] First, if the remaining available space does not meet the reserved space limit, the storage space of the external storage device is updated. Second, after the storage space is updated, read and write operations are performed to access the external storage device, ensuring that data interaction is performed under the premise of sufficient available space, avoiding read and write failures or data loss due to insufficient external storage space.
[0101] For example, if the preset reserved space limit is 20% of available space remaining, and it is detected that the current available space remaining is only 10%, which does not meet the reserved space limit, then the storage space of the external device will be updated according to the set rules (such as deleting some old data) before the data is written or read.
[0102] Through the above example, by regularly organizing the stored data in the external storage device, the storage space in the external storage device is avoided from being filled up due to continuous writing, so that when the embedded device uses the external storage device for expanded storage, it can more reliably protect the integrity and availability of the data and prevent the risk of storage data loss.
[0103] In a possible implementation, if the occupancy information of the storage space indicates that the remaining available space does not meet the reserved space limit, updating the storage space of the external storage device includes:
[0104] If the occupancy information of the storage space indicates that the remaining available space does not meet the reserved space limit, obtaining the write time of the storage data in the occupied space;
[0105] According to the writing time of the above-mentioned storage data in the above-mentioned occupied space, a predetermined proportion of the storage data in the above-mentioned occupied space is deleted to update the storage space of the above-mentioned external storage device.
[0106] Optionally, the predetermined ratio may be 30%, 20%, 25% and so on.
[0107] Specifically, if the remaining available space of the external storage device does not meet the reserved space limit, the write time of the data stored in the occupied space is obtained. This means that in the example of this application, the stored data in the external storage device is not deleted randomly, but the data is selected according to the order in which the data is written. In this way, it can be ensured that the latest and continuous data is always stored in the external storage device. Then, according to the write time of these stored data, a predetermined proportion (for example, 30%) of the old stored data in the occupied space is deleted, thereby realizing the update of the storage space of the external storage device.
[0108] For example, if the reserved space limit is 10GB of available space remaining, and currently 5GB of available space is detected, the reserved space limit is not met. At this time, the write time of the data in the occupied space is obtained, and a part (such as the earliest written 30% of the data) is deleted according to a certain rule to increase the available space of the external storage device.
[0109] From the above, it can be seen that the example of the present application can automatically detect the read and write permissions of the external storage device before each embedded device performs a read and write operation on the external storage device by dynamically detecting and adjusting the read and write permissions of the external storage device. If the read and write permissions are set incorrectly, the read and write permissions are modified before continuing to perform read and write access operations, thereby effectively avoiding the problem of data loss due to changes in the permissions of the external storage device. In addition, the intelligent space management and data polling strategy provided by the example of the present application ensures that the latest and continuous data is always stored in the external storage device by reserving space limits and deleting the oldest data written in the external storage device based on a ratio, thereby avoiding the risk of data loss caused by the storage space of the external storage device being full.
[0110] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0111] Corresponding to the method for accessing the external storage device in the above embodiment, Figure 6 is a schematic diagram of a structure of a device for accessing an external storage device provided by an embodiment of the present application. The device can be implemented by software, hardware, or a combination of both to become part or all of a computer device. The computer device can be Figure 7 Electronic equipment shown.
[0112] Reference Figure 6 , the device for accessing the external storage device comprises:
[0113] The first acquisition unit 601 is used to acquire the mount attribute information of the external storage device of the embedded device;
[0114] The correction unit 602 is used to correct the mount attribute information if it is determined based on the mount attribute information that the permission setting of the external storage device is incorrect;
[0115] The second acquisition unit 603 is used to acquire the storage space occupancy information of the external storage device after the modification of the mount attribute information is completed;
[0116] The access unit 604 is used to access the external storage device according to the occupancy information of the storage space.
[0117] Further, based on any of the above embodiments, as an example of the present application, the first acquisition unit 601 includes:
[0118] The first detection subunit is used to detect the mounting attribute information of the external storage device through the system detection command of the embedded device before the embedded device accesses the external storage device each time.
[0119] Further, based on any of the above embodiments, as an example of the present application, when the mount attribute information includes: read and write permission information and a device identifier, the correction unit includes:
[0120] The correction subunit is used to correct the read and write permission information through the system correction command of the embedded device if it is determined based on the read and write permission information that the read and write permission setting of the external storage device is incorrect, wherein the system correction command carries the device identifier of the external storage device.
[0121] Further, based on any of the above embodiments, as an example of the present application, the above device also includes:
[0122] The determination unit is configured to determine that the read / write permission of the external storage device is incorrectly set if the read / write permission information indicates that the read / write permission of the external storage device is read-only and not writable.
[0123] Further, based on any of the above embodiments, as an example of the present application, the above correction subunit is specifically used for:
[0124] Through the system correction command of the embedded device, the read and write permissions of the external storage device are remounted as readable and writable to obtain the corrected read and write permission information.
[0125] Further, based on any of the above embodiments, as an example of the present application, the second acquisition unit includes:
[0126] A second detection subunit is used to regularly detect the occupied space and remaining available space of the storage space of the external storage device;
[0127] The determination subunit is used to determine the occupancy information of the storage space according to the occupied space and the remaining available space.
[0128] Further, based on any of the above embodiments, as an example of the present application, the access unit includes:
[0129] an updating subunit, configured to update the storage space of the external storage device if the occupancy information of the storage space indicates that the remaining available space does not satisfy the reserved space limit;
[0130] The access subunit is used to perform read and write operations on the external storage device after updating the storage space of the external storage device, so as to access the external storage device.
[0131] Further, based on any of the above embodiments, as an example of the present application, the updating subunit is specifically used for:
[0132] If the occupancy information of the above-mentioned storage space indicates that the above-mentioned remaining available space does not meet the reserved space limit, obtain the writing time of the storage data in the above-mentioned occupied space; according to the writing time of the above-mentioned storage data in the above-mentioned occupied space, delete a predetermined proportion of the storage data in the above-mentioned occupied space to update the storage space of the above-mentioned external storage device.
[0133] It should be noted that the device for accessing an external storage device provided in the above embodiment is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0134] The functional units and modules in the above embodiments may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit, and the above integrated units may be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the protection scope of the embodiments of the present application.
[0135] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.
[0136] An embodiment of the present application further provides an electronic device, the electronic device comprising one or more processors and a memory;
[0137] The memory is coupled to one or more processors, and the memory is used to store computer program codes, the computer program codes include computer instructions, and the one or more processors call the computer instructions to enable the electronic device to execute the aforementioned method for accessing the external storage device.
[0138] The electronic device may be a mobile phone, a smart screen, a tablet computer, a wearable electronic device, an in-vehicle electronic device, an augmented reality (AR) device, a virtual reality (VR) device, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), a projector, or a communication device such as a server, a storage device, a base station, or a smart car, etc. The embodiments of the present application do not impose any restrictions on the specific types of electronic devices.
[0139] An embodiment of the present application also provides a computer-readable storage medium, in which computer instructions are stored; when the computer-readable storage medium is executed on an electronic device, the electronic device executes the method for accessing an external storage device shown above.
[0140] The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that includes one or more available media integrated therein. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium, or a semiconductor medium (e.g., a solid state drive (SSD)), etc.
[0141] An embodiment of the present application also provides a computer program product including computer instructions, which, when executed on an electronic device, enables the electronic device to execute the aforementioned method for accessing an external storage device.
[0142] The computer storage medium and computer program product provided in the above-mentioned embodiments of the present application are used to execute the method provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects corresponding to the method provided above, and will not be repeated here.
[0143] In the above embodiments, it can also be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions can be transmitted from a website site, computer, server or data center by wired (such as: coaxial cable, optical fiber, data subscriber line (Digital Subscriber Line, DSL)) or wireless (such as: infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access, or a data storage device such as a server or data center that contains one or more available media integrations. The available medium may be a magnetic medium (such as a floppy disk, a hard disk, a magnetic tape), an optical medium (such as a digital versatile disc (DVD)), or a semiconductor medium (such as a solid state drive (SSD)), etc.
[0144] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application, which device may be a mobile phone, a computer, a digital broadcast terminal, a message transceiver, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0145] Device 700 may include one or more of the following components: a processing component 702 , a memory 704 , a power component 706 , a multimedia component 708 , an audio component 710 , an input / output (I / O) interface 712 , a sensor component 714 , and a communication component 716 .
[0146] The processing component 702 generally controls the overall operation of the device 700, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 702 may include one or more processors 720 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 702 may include one or more modules to facilitate the interaction between the processing component 702 and other components. For example, the processing component 702 may include a multimedia module to facilitate the interaction between the multimedia component 708 and the processing component 702.
[0147] The memory 704 is configured to store various types of data to support operations on the device 700. Examples of such data include instructions for any application or method operating on the device 700, contact data, phone book data, messages, pictures, videos, etc. The memory 704 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0148] The power supply component 706 provides power to the various components of the device 700. The power supply component 706 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device 700.
[0149] The multimedia component 708 includes a screen that provides an output interface between the device 700 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 708 includes a front camera and / or a rear camera. When the device 700 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0150] The audio component 710 is configured to output and / or input audio signals. For example, the audio component 710 includes a microphone (MIC), and when the device 700 is in an operating mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 704 or sent via the communication component 716. In some embodiments, the audio component 710 also includes a speaker for outputting audio signals.
[0151] I / O interface 712 provides an interface between processing component 702 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.
[0152] The sensor assembly 714 includes one or more sensors for providing various aspects of status assessment for the device 700. For example, the sensor assembly 714 can detect the open / closed state of the device 700, the relative positioning of components, such as the display and keypad of the device 700, the sensor assembly 714 can also detect the position change of the device 700 or a component of the device 700, the presence or absence of user contact with the device 700, the orientation or acceleration / deceleration of the device 700, and the temperature change of the device 700. The sensor assembly 714 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 714 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 714 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0153] The communication component 716 is configured to facilitate wired or wireless communication between the device 700 and other devices. The device 700 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 716 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 716 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (I rDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0154] In an exemplary embodiment, the apparatus 700 may be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to perform the above method.
[0155] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 704 including instructions, and the instructions can be executed by the processor 720 of the device 700 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0156] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0157] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments applied for herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0158] In the embodiments provided in the present application, it should be understood that the disclosed devices / network equipment and methods can be implemented in other ways. For example, the device / network equipment embodiments described above are merely schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0159] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0160] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A method for accessing an external storage device, characterized in that: include: Get the mount property information of the external storage device of the embedded device; If it is determined based on the mount attribute information that the permission setting of the external storage device is incorrect, correcting the mount attribute information; After the mount attribute information is modified, obtaining the storage space occupancy information of the external storage device; The external storage device is accessed according to the occupancy information of the storage space.
2. The method according to claim 1, characterized in that The step of obtaining the mount attribute information of the external storage device of the embedded device includes: Before the embedded device accesses the external storage device each time, the mount attribute information of the external storage device is detected through a system detection command of the embedded device.
3. The method according to claim 1, characterized in that In the case where the mount attribute information includes: read / write permission information and a device identifier, if it is determined based on the mount attribute information that the permission setting of the external storage device is incorrect, then correcting the mount attribute information includes: If it is determined based on the read / write permission information that the read / write permission setting of the external storage device is incorrect, the read / write permission information is corrected through a system correction command of the embedded device, wherein the system correction command carries a device identifier of the external storage device.
4. The method according to claim 3, characterized in that The method further comprises: If the read / write permission information indicates that the read / write permission of the external storage device is read-only and not writable, it is determined that the read / write permission of the external storage device is incorrectly set.
5. The method according to claim 3, characterized in that: The step of modifying the read and write permission information by using a system modification command of the embedded device includes: The read and write permissions of the external storage device are remounted as readable and writable through the system correction command of the embedded device, so as to obtain the corrected read and write permission information.
6. The method according to claim 1, characterized in that The obtaining of the storage space occupation information of the external storage device includes: Regularly checking the occupied space and remaining available space of the storage space of the external storage device; Occupancy information of the storage space is determined according to the occupied space and the remaining available space.
7. The method according to claim 6, characterized in that The accessing the external storage device according to the occupation information of the storage space includes: If the occupancy information of the storage space indicates that the remaining available space does not meet the reserved space limit, updating the storage space of the external storage device; After the storage space of the external storage device is updated, a read and write operation is performed on the external storage device to access the external storage device.
8. The method according to claim 6, characterized in that If the occupancy information of the storage space indicates that the remaining available space does not meet the reserved space limit, updating the storage space of the external storage device includes: If the occupancy information of the storage space indicates that the remaining available space does not meet the reserved space limit, obtaining the write time of the storage data in the occupied space; According to the writing time of the stored data in the occupied space, a predetermined proportion of the stored data in the occupied space is deleted to update the storage space of the external storage device.
9. A device for accessing an external storage device, characterized in that: include: A first acquisition unit, used to acquire mounting attribute information of an external storage device of the embedded device; a correction unit, configured to correct the mount attribute information if it is determined based on the mount attribute information that the permission setting of the external storage device is incorrect; A second acquisition unit, configured to acquire the occupancy information of the storage space of the external storage device after the modification of the mount attribute information is completed; The access unit is used to access the external storage device according to the occupancy information of the storage space.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 8 is implemented.
11. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.
