Directory processing method, electronic equipment, storage medium and chip system

By marking and intercepting operations when directory items are abnormal, combined with automatic scanning and repair in idle state, the performance problems caused by file system directory corruption are solved, and more efficient directory repair and resource utilization are achieved.

CN120277035AActive Publication Date: 2025-07-08HONOR DEVICE CO LTD
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202510246549.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-28
Publication Date
2025-07-08
Estimated Expiration
2045-02-28

AI Technical Summary

Technical Problem

The file system directory corruption causes the electronic device to fail to correctly identify or access files, affecting the performance of the device. In the prior art directory repair requires users to actively trigger, which lacks flexibility.

Method used

When an electronic device detects an abnormality of the directory item, it blocks it as an exception, intercepts related operations, and automatically scans and repairs the damaged area of the directory in the idle state, avoiding the creation of new directory items and using idle time to detect and repair.

Benefits of technology

It improves the performance stability and user experience of electronic devices, reduces user intervention through automated repairs, and improves resource utilization efficiency and storage space utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120277035A_ABST
    Figure CN120277035A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a directory processing method, electronic equipment, a storage medium and a chip system, and relates to the technical field of terminals. The method comprises the steps that the electronic equipment starts a first program, and after the electronic equipment starts the first program, if the electronic equipment fails to open a file of the first program based on a first directory entry, the electronic equipment can mark that the first directory entry is abnormal and terminate execution of an operation of creating a new directory entry corresponding to the first program. Wherein the first directory entry is a directory entry created when the first program is started for the first time, and the first directory entry is used for indicating a file path for opening the first program. Therefore, since the electronic equipment does not repeatedly create the new directory entry corresponding to the first program, more directory areas can be prevented from being infected subsequently, the influence on the performance of the electronic equipment can be reduced to a certain extent, and the user experience is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of terminals, and in particular, to a method for processing directories, an electronic device, a storage medium, and a chip system. Background Art

[0002] The file system is the core component for managing data in an electronic device and can be responsible for data storage, organization, and searching. Among them, the directory is a key structure of the file system and is used to locate and access files. Through the directory, the file system can achieve efficient searching and operation of files.

[0003] However, due to the hard power-off of the electronic device (such as shutdown due to low power or restart by long pressing the power button), program errors, or file system abnormalities (such as data that should not be written to the directory location being wrongly written), the file system directory may be damaged. Directory damage can cause the electronic device to fail to correctly identify or access the files in the directory, and may further infect more areas, affecting the performance of the electronic device. Therefore, there is an urgent need to improve the method for processing the file system directory. Summary of the Invention

[0004] Embodiments of this application provide a method for processing directories, an electronic device, a storage medium, and a chip system, which are applied to the technical field of terminals, can avoid infecting more directory areas due to file system directory damage, and can reduce the impact on the performance of the electronic device to a certain extent.

[0005] In a first aspect, embodiments of this application propose a method for processing directories. The entity executing this method can be an electronic device or a chip in the electronic device. Hereinafter, an electronic device is taken as an example for illustration. In this method, the electronic device can start a first program; and after the electronic device starts the first program, if the electronic device fails to open the file of the first program based on a first directory entry, the electronic device can mark the first directory entry as abnormal and terminate the operation of creating a new directory entry corresponding to the first program.

[0006] Among them, the first directory entry is the directory entry created when the first program is started for the first time, and the first directory entry can be used to indicate the file path for opening the first program. The first program can be any application program in the electronic device.

[0007] In some embodiments, when the electronic device fails to open the file of the first program based on the first directory entry, the electronic device can determine that the first directory entry corresponding to the first program is abnormal.

[0008] In some embodiments, the abnormality of the first directory entry may include: the first directory entry is lost, or the first directory entry points to the wrong location, etc.

[0009] In an embodiment of the present application, after the electronic device starts the first program and fails to open the file of the first program based on the first directory entry, the electronic device may mark the first directory entry as abnormal. In this way, when the electronic device opens the file of the first program based on the first directory entry again, the electronic device first determines whether the first directory entry is marked as abnormal. If the first directory entry is marked as abnormal, the electronic device does not open the file based on the first directory entry, and the electronic device terminates the execution of creating a new directory entry corresponding to the first program. In this way, since the electronic device does not create a new directory entry corresponding to the first program, it is possible to avoid infecting more directory areas, thereby affecting the execution of other programs (programs other than the first program) in the electronic device, and to a certain extent, reduce the impact on the performance of the electronic device.

[0010] In an alternative embodiment, if the electronic device meets a preset condition, the electronic device may perform data detection on at least one storage area of the electronic device to obtain a detection result, and the detection result may be at least used to indicate abnormal information of directories in at least one storage area. The electronic device may repair abnormal directory entries in at least one storage area based on the detection result. The preset condition may include: the electronic device is in an idle state for a preset duration and the electronic device maintains the idle state.

[0011] In some embodiments, the at least one storage area may be a system partition, a log partition, a data partition, or a domain partition. And since the file system is included in the electronic device, the storage space of the file system may be referred to as the storage area of the electronic device.

[0012] In some embodiments, the electronic device performing data detection on at least one storage area of the electronic device may be referred to as: the electronic device scans the data of at least one storage area to determine whether there is a directory damage.

[0013] In some embodiments, the detection result may include: whether the directory is damaged and whether the proportion of the damaged directory is greater than a preset value.

[0014] In this embodiment, when the preset condition is met, the electronic device may automatically perform data detection on at least one storage area to obtain a detection result, and repair abnormal directory entries in at least one storage area based on the detection result, without the user manually triggering the electronic device to perform detection and repair, which has good flexibility.

[0015] In an alternative embodiment, data detection is performed on at least one storage area of the electronic device to obtain a detection result, including: when the electronic device determines that the first directory entry is marked as abnormal, the electronic device can perform data detection on the first storage area to obtain a first detection result; wherein, the first storage area is the storage area where the first directory entry is located, and the first detection result is at least used to indicate the abnormal information of the directory in the first storage area. The electronic device can repair the abnormal directory entries in at least one storage area based on the first detection result, including: the electronic device repairs the abnormal directory entries in the first storage area based on the first detection result.

[0016] Among them, the abnormal directory entries in the first storage area include the first directory entry.

[0017] In some embodiments, the first detection result may be damage information recorded by the electronic device.

[0018] In some embodiments, when the electronic device determines that the first directory entry is marked as abnormal, the electronic device can determine whether there is a first detection result. If there is a first detection result in the electronic device, the electronic device can repair the first directory entry based on the first detection result. If there is no first detection result in the electronic device, the electronic device can perform data detection on the area corresponding to the first directory entry (the first storage area) based on the marked first directory entry to obtain a first detection result. The electronic device can repair the abnormal directory entries in the first storage area based on the detection result.

[0019] In this embodiment, the electronic device can detect at least one storage area related to the abnormal directory entry (such as the first storage area) to obtain a first detection result. The electronic device can repair the abnormal directory entries in the first area based on the first detection result, which can avoid the time consumption and resource consumption caused by the electronic device detecting multiple storage areas, and can specifically repair the abnormal directory entries in the first area.

[0020] In an alternative embodiment, the electronic device performs data detection on at least one storage area of the electronic device to obtain a detection result, including: the electronic device performs data detection on the second storage area to obtain a second detection result. Wherein, the second storage area is at least one storage area other than the first storage area in the electronic device. The electronic device repairs the abnormal directory entries in at least one storage area based on the detection result, and further includes: the electronic device repairs the abnormal directory entries in the second storage area based on the second detection result.

[0021] In some embodiments, the second storage area may be a system partition. The electronic device can perform data detection on the system partition to obtain a second detection result, and repair the abnormal directory entries in the system partition based on the second detection result.

[0022] In some embodiments, the second storage area may be a log partition. The electronic device may perform data detection on the log partition to obtain a second detection result, and based on the second detection result, repair the abnormal directory entries in the log partition.

[0023] In this embodiment, the electronic device detects the second storage area to obtain a second detection result, and based on the second detection result, repairs the abnormal directory entries in the second storage area, so that there are no abnormal directory entries in the second storage area, thereby facilitating the electronic device to access the file corresponding to the directory entry based on the directory entry in the second area.

[0024] In an alternative embodiment, the electronic device performs data detection on the second storage area to obtain a second detection result, including: after the electronic device repairs the abnormal directory entries in the first storage area, if the electronic device is still in an idle state, the electronic device may perform data detection on the second storage area.

[0025] In this embodiment, when the electronic device is in an idle state, the electronic device can continue to perform data detection on the second storage area, which can make full use of the time resources and computing resources in the idle state and improve the resource utilization efficiency. In addition, since the electronic device is in an idle state, the user is unaware of the process of the electronic device performing detection and repair, and the user experience is better.

[0026] In an alternative embodiment, the second detection result may include the proportion of the abnormal directory area in the second storage area to the total directory area. The electronic device repairs the abnormal directory entries in the second storage area based on the second detection result, including: if the proportion of the abnormal directory area to the total directory area is greater than a preset value, the electronic device may repair the abnormal directory entries in the second storage area based on the second detection result.

[0027] In some embodiments, the abnormal directory area may be a damaged directory area.

[0028] In this embodiment, the electronic device may determine whether to repair the abnormal directory entries in the second storage area based on the proportion of the abnormal directory area in the second storage area (such as an important partition) to the total directory area. When the proportion of the abnormal directory area to the total directory area is lower than the preset value, the electronic device may not repair the abnormal directory entries, which can save computing resources and time resources.

[0029] In an alternative embodiment, the second storage area includes at least one of the following: a storage area for storing firmware and system resources; or a storage area with a read-write operation count greater than a preset count; or all storage areas other than the first storage area.

[0030] In some embodiments, the storage area for storing firmware and system resources may be referred to as the system partition, and the storage area with the number of read / write operations greater than a preset number may be the log partition.

[0031] In an alternative embodiment, during the process of the electronic device repairing abnormal directory entries in at least one storage area, if the electronic device receives a user operation, the electronic device may terminate the repair process and restore the directory of the electronic device to the directory before the repair.

[0032] In this embodiment, in response to the electronic device receiving a user operation, the electronic device is no longer in the idle state. Since the electronic device repairing the directory will occupy the computing resources of the electronic device, when a user operation is received, in order to improve the user experience, the electronic device needs to terminate the repair process and restore the directory of the electronic device to the directory before the repair.

[0033] In an alternative embodiment, the preset condition further includes at least one of the following: the electronic device is powered on or restarted; or the electronic device enters the shutdown process; or the electronic device enters the factory reset process.

[0034] In some embodiments, the electronic device being powered on or restarted may be referred to as: the electronic device is in the powered-on or restarted state; the electronic device entering the shutdown process or the factory reset process may be referred to as: the electronic device is in the shutdown (or factory reset) state.

[0035] In an alternative embodiment, after the electronic device starts the first program, if the electronic device queries the first directory entry and the first directory entry is marked as abnormal, the electronic device may output a notification message and terminate the operation of opening the file of the first program based on the first directory entry; wherein, the notification message is used to indicate a program or system error.

[0036] Exemplarily, the notification message may be an error message, such as the file cannot be found (e.g., "FR_NO_FILE").

[0037] In some embodiments, the electronic device terminating the operation of opening the file of the first program based on the first directory entry may be referred to as the electronic device intercepting the operation of opening the file.

[0038] In this embodiment, the electronic device terminating the operation of opening the file of the first program based on the first directory entry can prevent the electronic device from creating a new directory entry corresponding to the file of the first program, thereby avoiding infecting more directory areas subsequently.

[0039] Second aspect, an embodiment of the present application provides a directory processing device. The directory processing device may be an electronic device, or a chip or a chip system within the electronic device. The directory processing device may include a display unit and a processing unit. When the directory processing device is an electronic device, the display unit may be a display screen. The display unit is configured to perform the display step, so that the electronic device implements a directory processing method described in the first aspect or any possible implementation manner of the first aspect. When the directory processing device is an electronic device, the processing unit may be a processor. The directory processing device may further include a storage unit, and the storage unit may be a memory. The storage unit is used to store instructions, and the processing unit executes the instructions stored in the storage unit, so that the electronic device implements a directory processing method described in the first aspect or any possible implementation manner of the first aspect. When the directory processing device is a chip or a chip system within the electronic device, the processing unit may be a processor. The processing unit executes the instructions stored in the storage unit, so that the electronic device implements a directory processing method described in the first aspect or any possible implementation manner of the first aspect. The storage unit may be a storage unit within the chip (such as a register, a cache, etc.), or a storage unit outside the chip within the electronic device (such as a read-only memory, a random access memory, etc.).

[0040] Third aspect, an embodiment of the present application provides an electronic device, including a processor and a memory. The memory is used to store code instructions, and the processor is used to run the code instructions to execute the method described in the first aspect or any possible implementation manner of the first aspect.

[0041] Fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which a computer program or instructions are stored. When the computer program or instructions are run on a computer, the computer is caused to execute the method described in the first aspect or any possible implementation manner of the first aspect.

[0042] Fifth aspect, an embodiment of the present application provides a computer program product including a computer program. When the computer program is run on a computer, the computer is caused to execute the method described in the first aspect or any possible implementation manner of the first aspect.

[0043] Sixth aspect, the present application provides a chip or a chip system. The chip or the chip system includes at least one processor and a communication interface. The communication interface and the at least one processor are interconnected by a line. The at least one processor is used to run a computer program or instructions to execute the method described in the first aspect or any possible implementation manner of the first aspect. Among them, the communication interface in the chip may be an input / output interface, a pin, a circuit, etc.

[0044] In a possible implementation, the chip or chip system described above in this application further includes at least one memory, and instructions are stored in the at least one memory. The memory may be a storage unit inside the chip, for example, a register, a cache, etc., or it may be a storage unit of the chip (for example, a read-only memory, a random access memory, etc.).

[0045] It should be understood that the technical solutions of the second to sixth aspects of this application correspond to those of the first aspect of this application, and the beneficial effects obtained by each aspect and the corresponding feasible implementation manners are similar and will not be elaborated herein. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] Figure 1 It is a software structure block diagram of an electronic device provided by an embodiment of this application;

[0047] Figure 2 It is a schematic diagram of the division of the storage space of a file system provided by an embodiment of this application;

[0048] Figure 3 It is a schematic flow diagram of a method for processing a directory provided by an embodiment of this application;

[0049] Figure 4 It is a schematic flow diagram of another method for processing a directory provided by an embodiment of this application;

[0050] Figure 5 It is a schematic flow diagram of another method for processing a directory provided by an embodiment of this application;

[0051] Figure 6 It is a schematic flow diagram of another method for processing a directory provided by an embodiment of this application;

[0052] Figure 7 It is a schematic flow diagram of another method for processing a directory provided by an embodiment of this application;

[0053] Figure 8 It is a hardware structure block diagram of an electronic device provided by an embodiment of this application;

[0054] Figure 9A It is a schematic diagram of a normal directory of a file system provided by an embodiment of this application;

[0055] Figure 9B It is a schematic diagram of an abnormal directory of a file system provided by an embodiment of this application;

[0056] Figure 9C It is a schematic diagram of another abnormal directory of a file system provided by an embodiment of this application. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0057] To facilitate a clear description of the technical solutions of the embodiments of the present application, the following briefly introduces some terms and technologies involved in the embodiments of the present application:

[0058] 1. File: A collection of a set of data stored in an electronic device. This set of data can exist in various forms, such as but not limited to any one of the following: text, image, audio, and video, etc. A file is the basic unit of data storage in an operating system, and the operating system can access and operate on the corresponding file through the file name.

[0059] Files can be divided into two types: ordinary files and directory files (also known as folders or directories).

[0060] An ordinary file refers to a file that stores actual data. The actual data can include but not limited to at least one of the following: user data and system data. Among them, user data can be text, image, audio, and video, etc., and system data can be program code or configuration files, etc.

[0061] A directory is a special type of file. Different from ordinary files, a directory is not used to store actual data, but is used to record the metadata of the ordinary files and subdirectories (sub-directory files) it contains.

[0062] In some embodiments, the metadata recorded in a directory for ordinary files and subdirectories can be referred to as directory entries. A directory entry can include: file name (such as the name of an ordinary file or the name of a subdirectory), file type, file location (or offset), file size, permission information, and timestamp, etc.

[0063] Among them, the file type is used to indicate whether the file is an ordinary file or a directory (sub-directory), the file location (or offset) is used to indicate the location where the file is stored in the electronic device, the file size is used to indicate the size of the storage space occupied by the file in the electronic device, the permission information is used to indicate the access permissions of the file (such as read, write, and execute permissions), and the timestamp is used to indicate the creation time, modification time, and access time of the file, etc.

[0064] In some embodiments, the file location can be represented by the starting cluster number. The starting cluster number refers to the number of the first cluster (cluster) allocated for the storage of an ordinary file or a subdirectory in the electronic device.

[0065] It should be understood that a directory can contain multiple directory entries, and each directory entry in the multiple directory entries points to an ordinary file or a subdirectory.

[0066] 2. File System: A mechanism used by an operating system to manage and store files. The file system has multiple functions, which can include: file management function, directory management function, storage space management function, and security management function.

[0067] Among them, the file management function means that the file system can be responsible for operations such as file creation, deletion, reading, and writing; the directory management function means that the file system can provide operations such as directory creation, deletion, and traversal; the storage space management function means that the file system can allocate the storage space of an electronic device to ensure that file storage does not conflict and optimize storage efficiency; the security management function means that the file system can provide permission control to ensure that only authorized users and programs can access specific files.

[0068] A file system usually consists of an interface, a software collection for object manipulation and management, and objects, etc. Among them, the interface is used to provide a way for users to interact with the file system, such as a command-line interface or a graphical user interface, etc. The software collection for object manipulation and management includes file opening, closing, reading, and writing, etc. Objects include ordinary files and directories.

[0069] There are various types of file systems. For example, it can include file systems of the extended (EXT) series, XFS file system, B-tree file system (BTRFS), and file allocation table (FAT) series of file systems, etc.

[0070] File systems of the EXT series can include: EXT2 file system, EXT3 file system, and EXT4 file system, etc.

[0071] File systems of the FAT series can include: FAT12 file system, FAT16 file system, FAT32 file system, and extended file allocation table (exFAT) file system, etc.

[0072] Among them, FAT12 is suitable for storage devices with small capacities, such as floppy disks. FAT16 is suitable for storage devices with medium capacities, such as early hard disks and universal serial bus (USB) flash drives. FAT32 is suitable for storage devices with large capacities, such as modern hard disks and USB flash drives. exFAT is suitable for storage devices with extremely large capacities, such as solid state drives (SSD) and secure digital cards (SD).

[0073] It should be understood that both early hard disks and modern hard disks belong to mechanical hard disks. An early hard disk refers to a mechanical hard disk with a capacity between megabytes (MB) and thousands of gigabytes (GB) and a rotation speed lower than 7200 revolutions per minute (RPM). A modern hard disk refers to a mechanical hard disk with a capacity between hundreds of GB and several terabytes (TB) and a rotation speed greater than or equal to 7200 RPM.

[0074] In some embodiments, the capacity can be understood as the storage space size of a storage device.

[0075] 3. File System Check (FSCK): It is a tool used to check and repair file systems on Unix-like operating systems (such as Linux operating systems, macOS operating systems, and Android operating systems, etc.).

[0076] Among them, the check includes checking directory entries, cluster usage, and storage space allocation in the file system, etc.

[0077] FSCK supports multiple file systems, such as EXT series file systems, XFS file systems, and BTRFS file systems, etc.

[0078] FSCK contains a variety of tool sets for file system check and repair. For different file systems, FSCK will call the corresponding tools in the tool set to perform the check and repair of the file system.

[0079] Exemplarily, the tool set may include: tools such as fsck.ext4, xfs_repair, and btrfsck. Among them, fsck.ext4 is used for the check and repair of the EXT4 file system, xfs_repair is used for the check and repair of the XFS file system, and btrfsck is used for the check and repair of the BTRFS file system.

[0080] Currently, FAT series file systems are widely used in various electronic devices (such as mobile phones, watches, bracelets, and headphones, etc.) due to their advantages of simplicity, easy implementation, and convenient maintenance. Among them, FAT series file systems support multiple operating systems, and multiple operating systems may include, but are not limited to, any one of the following: Windows operating system, Linux operating system, macOS operating system, Android operating system, and real-time operating system (RTOS), etc.

[0081] In some embodiments, FSCK can be used to check and repair file systems of the FAT family. Exemplarily, FSCK can call the fsck.vfat tool to check and repair file systems of the FAT family.

[0082] 4. Other Terms

[0083] In the embodiments of the present application, terms such as "first" and "second" are used to distinguish identical or similar items with basically the same functions and roles. For example, the first chip and the second chip are merely used to distinguish different chips and do not limit their sequence. Those skilled in the art can understand that terms such as "first" and "second" do not limit the quantity and execution order, and "first", "second", etc. do not necessarily mean different.

[0084] It should be noted that in the embodiments of the present application, words such as "exemplarily" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design solution described as "exemplarily" or "for example" in the present application should not be construed as being more preferred or having more advantages than other embodiments or design solutions. Rather, the use of words such as "exemplarily" or "for example" is intended to present relevant concepts in a specific manner.

[0085] In the embodiments of the present application, "at least one" means one or more, and "a plurality" means two or more. "And / or" describes the association relationship of associated objects and indicates that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the associated objects before and after are in an "or" relationship. "At least one (item)" or similar expressions thereof refer to any combination of these items, including any combination of single item (s) or plural item (s). For example, at least one (item) of a, b, or c can represent: a, b, c, a - b, a - c, b - c, or a - b - c, where a, b, c can be single or multiple.

[0086] 5. Electronic Devices

[0087] The electronic device according to the embodiments of the present application may include a handheld device, a vehicle-mounted device, etc. having a directory processing function. For example, some electronic devices are: mobile phone, tablet computer, handheld computer, notebook computer, mobile internet device (MID), wearable device, virtual reality (VR) device, augmented reality (AR) device, wireless terminal in industrial control, wireless terminal in self-driving, wireless terminal in remote medical surgery, wireless terminal in smart grid, wireless terminal in transportation safety, wireless terminal in smart city, wireless terminal in smart home, cellular phone, cordless phone, session initiation protocol (SIP) phone, wireless local loop (WLL) station, personal digital assistant (PDA), handheld device with wireless communication function, computing device or other processing device connected to a wireless modem, vehicle-mounted device, wearable device, terminal device in a 5G network or terminal device in a future evolved public land mobile network (PLMN), etc. The embodiments of the present application are not limited thereto.

[0088] By way of example and not limitation, in the embodiments of the present application, the electronic device may also be a wearable device. A wearable device may also be referred to as a wearable intelligent device, which is a general term for devices developed by applying wearable technology to the intelligent design of daily wear. Such devices include glasses, gloves, watches, bracelets, earphones, clothing, shoes, etc. A wearable device is a portable device that is either directly worn on the body or integrated into the user's clothes or accessories. A wearable device is not just a hardware device, but also realizes powerful functions through software support, data interaction, and cloud interaction. Broadly speaking, wearable intelligent devices include those with complete functions and large sizes that can realize complete or partial functions without relying on a smart phone, such as smart watches or smart glasses, etc., and those that only focus on a certain type of application function and need to cooperate with other devices such as smart phones, such as various smart bracelets and smart jewelry for monitoring physical signs.

[0089] In addition, in the embodiments of the present application, the electronic device may also be a terminal device in an Internet of Things (IoT) system. The IoT is an important part of the future development of information technology. Its main technical feature is to connect objects to the network through communication technology, so as to realize an intelligent network of human-machine interconnection and object-object interconnection.

[0090] The electronic device in the embodiments of the present application may also be referred to as: terminal device, user equipment (UE), mobile station (MS), mobile terminal (MT), access terminal, user unit, user station, mobile station, mobile terminal, remote station, remote terminal, mobile device, user terminal, terminal, wireless communication device, user agent or user device, etc.

[0091] In the embodiments of the present application, the electronic device or each network device includes a hardware layer, an operating system layer running on the hardware layer, and an application layer running on the operating system layer. The hardware layer includes hardware such as a central processing unit (CPU), a memory management unit (MMU), and a memory (also called main memory). The operating system may be any one or more computer operating systems that implement service processing through processes. For example, Linux operating system, Unix operating system, Android operating system, iOS operating system, or Windows operating system, etc. The application layer includes applications such as a browser, an address book, a word processing software, and an instant messaging software.

[0092] In a possible scenario, in response to the user's operation of using the Word software on the laptop to edit a file (such as report.docx), the laptop performs file reading and writing operations, and at the same time, the laptop updates the directory entry of the file system. Among them, the file has not been saved or part of the content has been saved to the laptop's disk. At this time, the battery power of the laptop suddenly runs out (hard power-off), causing the laptop to shut down, or the user long presses the power button to force a restart of the laptop, or the program corresponding to a certain function of the Word software crashes (such as the program corresponding to the insert table function crashes), causing the laptop to freeze (blue screen), or the operating system is abnormal, or the memory of the laptop is abnormally overwritten, resulting in damage to the directory of the file system.

[0093] In some embodiments, directory damage may also be described as directory disorder or directory abnormality.

[0094] Among them, memory abnormal overwrite means that a program (such as Program A) does not comply with the memory access specification and overwrites the memory used by other programs (such as the file system). The memory access specification means that each program is allocated its own memory, and each program can only access its corresponding memory to perform operations such as reading or writing.

[0095] Exemplarily, the corresponding memory of the file system is Memory 1, and the corresponding memory of Program A is Memory 2. When the file system runs, it loads Memory 1 to read or write files. During this process, there are other programs running on the laptop (such as Program A), and this Program A loads Memory 2 when it runs. However, since Program A does not comply with the memory access specification and performs read and write operations on Memory 1, the Memory 1 used by the file system is abnormally overwritten.

[0096] In this scenario, hard power-off and forced restart can be called hardware exceptions, and program crashes, operating system exceptions, and memory abnormal overwrites can be called program exceptions.

[0097] In this scenario, before the hardware exception or software exception of the laptop, the laptop is performing file read and write operations, such as the laptop is saving a file (report.docx). Among them, the laptop saving a file can be understood as writing the content of the file from memory to disk, and the content of the file can include at least one of the following: text, pictures, charts, and formats (such as font, font size, color, paragraph alignment, and line spacing, etc.).

[0098] In this scenario, before the hardware exception or program exception of the laptop, the file system of the laptop is performing the operation of creating or updating the directory entry corresponding to the file. Among them, when the file saved by the laptop is a new file, the laptop needs to create the directory entry corresponding to the file, and the directory entry corresponding to the file can be used to record the file name and file location, etc. When the file saved by the laptop is an existing file, the laptop needs to update the directory entry of the file to reflect the latest status of the file (such as modification time, file size, etc.).

[0099] However, when there are hardware abnormalities or program abnormalities in a laptop, the operations of the laptop for file reading and writing are interrupted, and the operations of the laptop for creating or updating the directory entry corresponding to the file are interrupted, resulting in incomplete file content (such as only part of the content is saved and the remaining content is lost), or damaged directory entries (such as the directory entry is not created or the directory entry contains incorrect or incomplete information, such as incorrect file size, incorrect file location, or the directory entry does not contain a file name, etc.). After forcibly restarting the laptop, in response to the user's operation of opening the file (such as report.docx), the laptop can prompt "This file is damaged and cannot be opened."

[0100] Combined with the above scenarios, hardware abnormalities or program abnormalities can cause damage to the directory of the file system, thereby affecting file access. In the related art, developers can use some directory editing tools to open and view the directory to determine whether the directory is normal.

[0101] Exemplarily, Figure 9A shows a schematic diagram of a normal directory of a file system, Figure 9B and Figure 9C shows a schematic diagram of an abnormal directory of a file system. Figure 9A 、 Figure 9B ,and Figure 9C all take the FAT32 file system as an example of the file system. In the FAT32 file system, each directory entry is represented by 32 bytes. As Figure 9A or Figure 9B or Figure 9C shown, the 901 area is the original code data of the file system directory (including multiple directory entries), where every two rows in the 901 area represent a directory entry, such as directory entry 1 and directory entry 2. Developers open the directory editing tool, and through the directory editing tool, the original code data of multiple directory entries in the file system can be converted into encoded data corresponding to the preset encoding rules.

[0102] In some embodiments, the directory editing tool can convert the original code data of the file system directory into ASCII codes (as shown in the 902 area) according to the American Standard Code for Information Interchange (ASCII) encoding rules.

[0103] In some embodiments, the directory encoding tool can convert the original code data of the file system directory into UTF-8 codes (as shown in the 903 area) according to the Unicode Transformation Format - 8 bits (UTF-8) encoding rules.

[0104] By comparing Figure 9A , Figure 9B , and Figure 9C it can be seen that: Figure 9A the encoded data in the 902 area and the 903 area in is clean and orderly, indicating that Figure 9A the file system directory shown in is normal; Figure 9B the encoded data in the 902 area and the 903 area in includes some duplicate characters (such as, "PRESSU~1BIN", or "SAMPLE~1BIN"), indicating that there are multiple files with the same file name (subdirectories or ordinary files) in the file system directory, Figure 9B the file system directory shown in is abnormal; Figure 9C the encoded data in the 902 area and the 903 area in includes some abnormal characters (such as, "17.", ".0.3", "07", etc.), indicating that the file system directory is overwritten or modified by some file contents, Figure 9C the file system directory shown in is abnormal.

[0105] To solve the problem of directory corruption in the above example, in some embodiments, FSCK can be used to check and repair the directory of the file system.

[0106] Exemplarily, taking an electronic device as a laptop as an example, in response to the user entering a command (such as fsck.vfat) in the command line window of the laptop and pressing the Enter key, the laptop starts the detection and repair program of FSCK (such as the laptop calls the fsck.vfat tool).

[0107] In this example, after the laptop starts the detection and repair program of FSCK, the laptop can display a prompt window, and the prompt window can include: problem level, repair button, and do not repair button. Among them, the problem level is used to indicate the user the degree of damage to the directory, and the problem level can include: crash, very serious, generally serious, and not serious.

[0108] In response to different actions taken by the user for different problem levels, for example, when the problem level is not serious, in response to the user clicking the do not repair button, FSCK does not continue to execute the detection and repair program. For example, when the problem level is crash or very serious, in response to the user clicking the repair button, FSCK continues to execute the detection and repair program to complete the repair of the directory.

[0109] However, in this example, since the detection and repair program of FSCK on the laptop needs to be actively triggered by the user, there is no fixed timing to trigger the start of FSCK, which is not flexible enough. Exemplarily, the laptop cannot perform the detection and repair of the directory at a specific timing (or scenario).

[0110] It should be understood that since the directory is included in the file system, detecting and repairing the directory can be understood as detecting and repairing the file system.

[0111] Accordingly, an embodiment of the present application provides a method for processing a directory. In this method, the electronic device can determine whether the directory is damaged based on the file system specification at different times (or scenarios). If the electronic device determines that the directory is damaged, different levels of operations are performed on the problem that the damaged directory causes abnormal functions of the electronic device (such as abnormal marking, abnormal information recording, and directory repair in the following embodiments). In this way, the electronic device can implement detection and repair of the file system with different intensities based on different times (or scenarios). The above processing solution does not require user triggering, has high flexibility, and provides a better user experience.

[0112] Before introducing the method for processing a directory provided by an embodiment of the present application, first introduce the structure of the electronic device provided by an embodiment of the present application:

[0113] The software system of the electronic device can adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservices architecture, or a cloud architecture. In an embodiment of the present application, the layered architecture is taken as an example to exemplarily illustrate the software structure of the electronic device. Figure 1 This is a block diagram of the software structure of an electronic device provided by an embodiment of the present application. The layered architecture divides the software system of the electronic device into several layers, and each layer has a clear role and division of labor. Communication between layers is through software interfaces. In some embodiments, referring to Figure 1 , the electronic device may include: an application layer (applications), an application framework layer (application framework), and a system layer.

[0114] It can be understood that the division of the software structure of the electronic device in an embodiment of the present application is an example. The embodiment of the present application does not limit the hierarchical division method in the software system of the electronic device. The modules in each layer in the following embodiments are the modules involved in the embodiment of the present application. Each layer may also include more or fewer modules than shown in the figure, or combine some modules, or split some modules.

[0115] Among them, the application layer may include a series of application packages, and the application layer runs the applications by calling the application programming interfaces (APIs) provided by the application framework layer. Referring to Figure 1 , the application layer may include system applications and third-party applications.

[0116] Exemplarily, system applications may include: settings applications, messaging applications, sports and health applications, etc. In some embodiments, the user may download third-party applications from the application store of the electronic device according to their own needs and preferences. Exemplarily, third-party applications may include: navigation applications, music applications, and e-book applications, etc.

[0117] It should be understood that each application (such as a system application or a third-party application) contains multiple functions, and the implementation of each function among the multiple functions depends on the corresponding program running.

[0118] In some embodiments, each program running needs to interact with the file system in the following embodiments.

[0119] The application framework layer provides application programming interfaces (APIs) and programming frameworks for the applications in the application layer. The application framework layer may include some predefined functions. Referring to Figure 1 , the predefined functions may be standard library functions. Exemplarily, the standard library functions may be fopen, creat, open, etc.

[0120] The system layer may include: a kernel, a file system, and a system call interface.

[0121] Among them, the kernel is the core part of the system layer, responsible for managing and allocating various resources of the system (operating system), including the CPU, memory, file system, and device drivers, etc.

[0122] In some embodiments, the kernel may interact with the standard library functions in the above embodiments through the system call interface.

[0123] The file system is used to implement the storage and access of files.

[0124] The system call interface is used to implement the communication between the kernel and the application framework layer.

[0125] As described in the above example, the software structure of the electronic device provided in the embodiments of the present application is described. Next, in combination with Figure 1 , the process of a program calling the file system to open or create a file (including a directory or a regular file) is described. The process of a program calling the file system to open or create a file may include the following steps:

[0126] Step 1: The program sends a request to create or open a file to the standard library function (such as fopen, or creat, or open, etc.).

[0127] The request to create or open a file includes: file path, operation type, and permission information.

[0128] Among them, the file path is used to indicate that the file system searches for subdirectories or ordinary files level by level starting from the root directory or the current directory. Exemplarily, the file path can be: " / home / user / report.docx".

[0129] The operation type is used to indicate the way the file system processes the request. The operation type can include creating a file and opening a file.

[0130] The permission information is used to indicate whether the program has the right to execute creating a file or opening a file. The permission information can include: read, write, and execute.

[0131] Step 2: The standard library function sends a request to create or open a file to the kernel through the system call interface.

[0132] Step 3, in response to the request, the kernel forwards the request to the file system.

[0133] Step 4, the file system executes the corresponding operation based on the request.

[0134] Exemplarily, the file system can search for the directory entry corresponding to the file based on the file path in the request and determine the location of the file.

[0135] Exemplarily, the file system can determine whether the program has the permission to access the file based on the permission situation in the request.

[0136] Exemplarily, the file system can, based on the operation type, for example, when the operation type is creating a file, the file system can create a new directory entry and allocate clusters (starting cluster number), and when the operation type is opening a file, the file system can locate the storage location of the file data based on the starting cluster number in the directory entry. Among them, the file data refers to the actual data in the file.

[0137] Step 5, the file system sends the result of the corresponding operation to the kernel.

[0138] Among them, the result of the operation can include: the starting cluster number, or an error message (such as unable to open the file).

[0139] Step 6, the kernel sends the result to the standard library function through the system call interface.

[0140] Step 7, the standard library function sends the result to the program.

[0141] Correspondingly, the program can receive the result from the standard library function and perform subsequent file operations or error message processing.

[0142] It should be understood that the process of the program performing subsequent file operations or error message processing in the embodiments of the present application will not be elaborated and can be referred to the descriptions in the current existing technologies.

[0143] Before introducing the method for processing a directory provided in an embodiment of the present application, first introduce the preparations made to implement this method:

[0144] In some embodiments, an electronic device may determine the validity of each parameter of a directory based on a file system specification. Each parameter of the directory may include: file name (such as the name of an ordinary file or the name of a sub-directory), file type, file location (starting cluster number or offset), file size, permission information, and time stamp, etc.

[0145] In this example, the electronic device may determine whether a directory entry is damaged based on the validity of each parameter of the directory.

[0146] In some embodiments, a record table is preset in the electronic device, and this record table is used to record the correspondence between the detection content, detection criteria, and repair strategies to be taken when the detection criteria are not met.

[0147] Among them, taking the FAT32 file system as an example, the detection content refers to each parameter of the directory, the detection criteria refer to whether it conforms to the FAT32 file system specification, and the repair strategy is the corresponding repair strategy based on the FAT32 file system specification when the detection criteria are not met.

[0148] The embodiments of the present application will not elaborate on other file system specifications other than the FAT32 file system, and reference can be made to the descriptions in the current existing technologies.

[0149] Exemplarily, Table 1 is a record table provided in an embodiment of the present application, and in this record table, the repair strategy is used to represent the repair strategy to be taken when the above detection criteria are not met.

[0150] Table 1

[0151]

[0152] Exemplarily, the FAT32 file system specification stipulates that the directory size is 0. Referring to Table 1, in the case where the detection content is the directory size, the detection criteria are: whether the size of the directory is 0. If the electronic device determines that the size of the directory is not 0, the repair strategy is: set the size of this directory to 0.

[0153] Exemplarily, the FAT32 file system specification stipulates that: except for the root directory, other directory entries (directory entries other than the root directory) cannot contain illegal characters, such as the asterisk (*), question mark (?), less than sign (<), greater than sign (>), vertical bar (|), backslash (\), forward slash ( / ), colon (:), dot (.), and the character with ASCII code 0x7F. Additionally, the file names of two files (subdirectories and subdirectories, or ordinary files and ordinary files) in the same directory cannot be repeated.

[0154] Among them, illegal characters refer to characters that have special meanings in the file system or are used to separate paths. The file system is a tree structure, and the root directory refers to the directory entry located at the topmost level of the tree structure, which is the starting point for all files (directories and ordinary files).

[0155] In this example, referring to Table 1, when the content to be detected is the names of each file in the directory, the detection criteria are divided into two types: one is whether other directory entries (except the root directory) contain illegal characters, and the other is whether there are at least two duplicate file names in the same directory. For the first detection criterion, if so, the repair strategy is: the electronic device deletes the directory entry containing illegal characters. For the second detection criterion, if so, the repair strategy is: the electronic device traverses and deletes the second duplicate file.

[0156] In some embodiments, since the first file is the one created first, the first file can be regarded as the file that truly corresponds to the file name, and the second file with the duplicate file name is deleted.

[0157] Exemplarily, the FAT32 file system specification stipulates that: the starting cluster numbers of the directory, the upper-level directory, and the upper-upper-level directory cannot conflict. Among them, starting cluster number conflicts include: starting cluster number repetition and starting cluster number intersection.

[0158] In this example, referring to Table 1, when the content to be detected is the starting cluster numbers of the directory, the upper-level directory, and the upper-upper-level directory, the detection criterion is whether the starting cluster numbers are repeated or intersect. If so, the repair strategy is: delete the directory, or set the starting cluster number of the directory to 0.

[0159] In some embodiments, deleting the directory, or setting the starting cluster number of the directory to 0 includes two implementation methods: one is to set the character at the head position of the directory entry corresponding to the second file (the head is the first byte in the above-mentioned 32 bytes) to 0, and set the starting cluster number of the directory entry to 0; the other is to set the entire directory entry (such as the above-mentioned 32 bytes) to 0.

[0160] Among them, starting cluster number repetition can be understood as: the starting cluster numbers are the same, and conflict can be understood as: the cluster chains corresponding to the starting cluster numbers have intersections.

[0161] It should be understood that the upper-level directory is the parent directory of the directory, and the upper-upper-level directory is the parent directory of the upper-level directory. In other words, the upper-upper-level directory contains the upper-level directory, and the upper-level directory contains the directory.

[0162] Since the upper-upper-level directory exists first in the electronic device, followed by the upper-level directory and the directory, when the starting cluster numbers of the upper-upper-level directory, the upper-level directory, and the directory conflict, the starting cluster number of the directory should be reset, which can reduce the risk of data loss.

[0163] Exemplarily, the FAT32 file system specification stipulates that the flag bits of the directory entries "." and ".." are ATT_DIR; in addition, the directory entries "." and ".." cannot be in the free or deleted state; in addition, whether the positions of the first two directory entries are the directory entry "." or the directory entry "..". Among them, the directory entry "." represents the current directory, and the directory entry ".." represents the parent directory of the current directory. Among them, when the directory entry flag bit is ATT_DIR, it indicates that the file pointed to by the directory entry is a directory.

[0164] In this example, referring to Table 1, when the detected content is the directory entries "." and "..", the detection criteria can be divided into three types: one is whether the flag bits of the directory entries "." and ".." are ATT_DIR, the second is whether the directory entries "." and ".." are in the free or deleted state, and the third is whether the positions of the first two directory entries are the directory entry "." or the directory entry "..". For the first detection criterion: if not, the repair strategy is to reset the flag bit of the directory entry to ATT_DIR; for the second detection criterion: if so, create the directory entry (directory entry "." or directory entry ".."); for the third detection criterion: if not, find a space downward to move the directory entry that is not "." or "..", and if there is no space, directly return.

[0165] As introduced in the above example, the preparations for implementing the directory processing method provided in the embodiments of the present application are described. Next, in combination with Figure 2 the division of the storage space of the file system will be described.

[0166] Figure 2 It is a schematic diagram of the division of the storage space of a file system provided in the embodiments of the present application. Referring to Figure 2 , the storage space of the file system can be divided into: system partition, log partition, data partition, and domain partition.

[0167] Among them, the system partition can be used to store configuration files and boot program files of the operating system, and the storage space occupied by the system partition is greater than the preset storage space.

[0168] In some embodiments, the system partition may be referred to as an important partition, and files in the partition are readable but not writable when the program is running. Readable but not writable means that files in the partition can be read by the program but cannot be modified by the program.

[0169] The log partition can be used to store log files generated when the program is running. The storage space occupied by this partition is smaller than the preset storage space, but the number of read and write times of the files in this partition is greater than the preset number.

[0170] The data partition can be used to store user usage data, such as third-party applications downloaded by users. The storage space occupied by this partition is larger than the preset storage space.

[0171] Domain partitions can be used to store configuration files for system applications and related functions. System applications include settings applications, SMS applications, and sports and health applications. Configuration files for related functions include configuration files for detection functions or Bluetooth functions.

[0172] The above example introduces the division of the file system's storage space. Figure 3 , Figure 4 , Figure 5 ,as well as Figure 6 , the directory processing method provided in the embodiment of the present application is described from the following four scenarios of the electronic device (when the program is running, in idle state, powered on or restarted, and powered off or restored to factory settings).

[0173] Figure 3 A flowchart of a directory processing method provided in an embodiment of the present application is shown in FIG. Figure 3 The directory processing method provided in the embodiment of the present application may include:

[0174] S301, the electronic device starts a first program.

[0175] The first program may be any application program in the electronic device.

[0176] In some embodiments, the electronic device launching the first program can be described as the electronic device being in the process of running the program.

[0177] S302, the electronic device creates a first directory entry of a first program.

[0178] The first directory item is a directory item created when the electronic device starts the first program for the first time, and the first directory item can be used to indicate a file path for opening the first program.

[0179] In some embodiments, the electronic device creating the first directory entry of the first program may include allocating storage space for the first directory entry, updating the starting cluster number of the first directory entry, etc.

[0180] In some embodiments, the creation of the first directory entry of the first program by the electronic device may refer to the description in the prior art.

[0181] S303. If the electronic device detects that the first directory entry is abnormal, the electronic device marks the first directory entry and the file corresponding to the first directory entry.

[0182] Among them, the abnormality of the first directory entry may include: the directory entry is missing, or the directory entry points to the wrong location, etc.

[0183] Exemplarily, the missing of the directory entry may be that report.docx is missing in the / home / user directory. The directory entry pointing to the wrong location may be that report.docx in the / home / user directory points to an invalid storage location.

[0184] In some embodiments, when the electronic device detects that the first directory entry is abnormal, the electronic device cannot open (or find) the file corresponding to the first directory entry based on the first directory entry.

[0185] In some embodiments, the electronic device marking the first directory entry and the file corresponding to the first directory entry can be understood as: the electronic device writes the damaged first directory entry and the file path of the file corresponding to the first directory entry in the log file.

[0186] In some embodiments, the electronic device marking the first directory entry and the file corresponding to the first directory entry can be described as: the electronic device marks the damaged first directory entry, and this mark can be called a directory damage mark.

[0187] S304. When the electronic device receives a read / write operation on the first program, the electronic device intercepts the read / write operation on the first program based on the mark.

[0188] In some embodiments, when the electronic device receives a read / write operation on the first program, the electronic device needs to open the file corresponding to the first program based on the first directory entry and perform the read / write operation. In this process, if the electronic device detects that the first directory entry has been marked, the electronic device can intercept the read / write operation on the first program based on the mark.

[0189] After S304, the electronic device may further execute S305a and S305b.

[0190] S305a. The electronic device displays an error message.

[0191] The error message is used to indicate that the file corresponding to the first directory entry is missing, that is, the read / write operation of the first program by the electronic device fails. Exemplarily, the error message may be: The file cannot be found (such as "FR_NO_FILE").

[0192] In S305b, the electronic device terminates the operation of creating a new directory entry for the first program.

[0193] The new directory entry can be used to indicate the file path for opening the first program.

[0194] In the embodiments of the present application, when the electronic device starts the first program for the first time, the electronic device can create a first directory entry for the first program. During the process of the electronic device running the first program, if the electronic device detects that the first directory entry is abnormal, the electronic device can mark the first directory entry and the file corresponding to the first directory entry. When the electronic device receives a read / write operation for the first program again, since the first directory entry and the file corresponding to the first directory entry have been marked as abnormal, the electronic device can intercept the read / write operation for the first program based on this mark, the electronic device can display an error message, and the electronic device can terminate the operation of creating a new directory entry for the first program. In this way, since the electronic device can mark the damaged first directory entry and the file corresponding to the first directory entry, when the electronic device performs a read / write operation for the first program again, the electronic device can intercept the read / write operation for the first program, which can save the processing resources of the electronic device.

[0195] In addition, since the electronic device can terminate the operation of creating a new directory entry for the first program, it can avoid infecting more directory areas subsequently and does not affect the execution results of other programs (programs other than this program) in the electronic device.

[0196] Figure 4 It is a schematic flowchart of another method for processing a directory provided by the embodiments of the present application. Refer to Figure 4 , the method for processing a directory provided by the embodiments of the present application may include:

[0197] In S401, when the electronic device is in an idle state, the electronic device detects whether there is a directory damage mark.

[0198] If the electronic device detects a directory damage mark, it executes S402; if the electronic device does not detect a directory damage mark, it executes S406.

[0199] The idle state means that the electronic device remains in a dormant state, or the idle duration is greater than or equal to a preset duration. Exemplarily, the dormant state can be understood as the electronic device being in a locked screen or low-power mode (standby), and the idle state can be understood as the time when the user does not operate the electronic device exceeds the preset duration (such as 30 minutes).

[0200] In S402, the electronic device scans the corresponding partition with the directory damage mark and records the damage information.

[0201] Since the time in the idle state is short, when the electronic device detects a directory damage mark, the electronic device can scan the area with the directory damage mark. Among them, the area with the directory damage mark can be any one of the following: the system partition, the log partition, the data partition, or the domain partition.

[0202] In some embodiments, after the electronic device scans the corresponding partition with the directory damage mark, the electronic device can record the damage information. Exemplarily, the damage information can include but is not limited to at least one of the following: the damaged directory entry, the damaged location, and the type of damage (such as directory entry loss, wrong pointer), etc.

[0203] S403, the electronic device repairs the damaged directory.

[0204] In some embodiments, the electronic device can repair the directory with the corresponding damage based on the damage information and the repair strategy in Table 1.

[0205] In some embodiments, after S403, the electronic device can execute S404a.

[0206] S404a, the electronic device reclaims the increased storage space after the directory repair.

[0207] In some embodiments, when the electronic device completes the repair of the damaged directory, the electronic device can reclaim the increased storage space after the directory repair. Exemplarily, the electronic device deletes the directory entry, and can release the storage space occupied by the directory entry.

[0208] In some embodiments, after S403, the electronic device can execute:

[0209] S404b, during the process of the electronic device repairing the damaged directory, if the electronic device receives a user operation, restore the directory to the directory before the repair.

[0210] Exemplarily, taking the electronic device as a watch, the user operation can be the operation of the user raising the wrist, or the operation of the user clicking on the screen of the watch. Exemplarily, taking the electronic device as a mobile phone, the user operation can be: the operation of the user clicking on the screen of the mobile phone. Exemplarily, taking the electronic device as a computer, the user operation can be: the operation of the user clicking the mouse.

[0211] In some embodiments, the user operation can be referred to as a wake-up source. In response to the user operation, the electronic device is no longer in the idle state. When the electronic device is no longer in the idle state, since the electronic device cannot determine the duration of the user operation, the electronic device can restore the directory to the directory before the repair.

[0212] S405, the electronic device exits the repair process.

[0213] S406, the electronic device loads the parameter information of the file system.

[0214] The parameter information of the file system may include: partition table information, file system information, and directory structure.

[0215] Among them, the partition table information includes, for example, partition type (such as system partition, log partition, data partition, and domain partition), partition size (the size of the storage space of the partition), and partition start and end positions.

[0216] The file system information includes, for example: file system type (such as FAT32 file system, FAT12 file system, or FAT16 file system, etc.), block size, and starting cluster number, etc.

[0217] The directory structure is used to indicate the way the file system organizes files and directories. The directory structure includes, for example: directory entries and file allocation tables. Among them, the file allocation table is used to record the allocation status of each cluster.

[0218] In some embodiments, the electronic device loading the parameter information of the file system can provide a basis for subsequent scanning and repair. And since the parameter information of the file system is stored in the storage space of the file system, in order to improve the access speed of the electronic device, the electronic device can load the parameter information into the memory.

[0219] S407, the electronic device scans the data of the system partition based on the parameter information of the file system.

[0220] The data of the system partition includes: directory entries and file allocation tables of the system partition, etc.

[0221] S408, the electronic device determines whether there is a damaged directory based on the data of the system partition.

[0222] If the electronic device determines that there is a damaged directory, execute S409; if the electronic device determines that there is no damaged directory, execute S405.

[0223] S409, the electronic device determines whether the proportion of damaged directories is greater than a preset value.

[0224] If the electronic device determines that the proportion of damaged directories is greater than the preset value, execute S403; if the electronic device determines that the proportion of damaged directories is less than or equal to the preset value, execute S405.

[0225] In some embodiments, when the proportion of damaged directories is greater than the preset value, the electronic device can determine to repair the damaged directories and execute S403. When the proportion of damaged directories is less than the preset value, the electronic device can determine not to repair the damaged directories and execute S405.

[0226] In some embodiments, the electronic device may determine whether there is a directory corruption in the data of the system partition based on the detection criteria in Table 1.

[0227] In some embodiments, the electronic device may determine the total directory area and the damaged directory area of the system partition. Herein, the total directory area refers to the size of the storage space occupied by the total directory in the system partition, and the damaged directory area refers to the size of the storage space occupied by the damaged directory in the system partition.

[0228] In this example, when the ratio of the damaged directory area to the total directory area is greater than or equal to a preset value, the electronic device may determine to repair the damaged directory. When the ratio of the damaged directory area to the total directory area is less than the preset value, the electronic device may determine not to repair the damaged directory.

[0229] In this embodiment, when the electronic device is in an idle state, the electronic device may scan the area with a directory corruption mark, record the corruption information in this area, and the electronic device may repair the damaged directory based on the corruption information. When there is no directory corruption mark in the electronic device, due to the short idle state time, the electronic device may scan the system partition. When there is a directory corruption in the system partition and the ratio of the damaged directory is greater than the preset value, the electronic device may repair the damaged directory in the system partition. During the process of the electronic device repairing the directory, if a user operation is received, the electronic device may restore the directory to the directory before repair and exit the repair process.

[0230] In this way, since the electronic device scans or repairs the damaged directory in the idle state, it will not affect the normal use of the user and can improve the user experience. In addition, in response to the user's operation, the electronic device may terminate the repair process, and the timing of the electronic device performing scanning and repair is more flexible. In addition, since the electronic device can reclaim the storage space occupied after the directory repair, it can improve the utilization rate of the storage space and avoid waste of the storage space.

[0231] Figure 5 For the flowchart of another method for processing directories provided in the embodiments of the present application, refer to Figure 5 , the method for processing directories provided in the embodiments of the present application may include:

[0232] S501, when the electronic device is powered on or restarted, the electronic device detects whether there is a directory corruption mark.

[0233] If the electronic device detects a directory corruption mark, execute S502; if the electronic device does not detect a directory corruption mark, execute S509.

[0234] In some embodiments, if the electronic device detects a directory damage flag, the electronic device can confirm that there is directory damage, and the electronic device can execute S502.

[0235] S502, the electronic device determines whether there is recorded damage information.

[0236] If the electronic device determines that there is recorded damage information, it executes S503; if the electronic device determines that there is no recorded damage information, it executes S505.

[0237] Among them, the damage information can refer to the description in S402.

[0238] S503, the electronic device repairs the damaged directory based on the damage information.

[0239] In some embodiments, the electronic device can repair the damaged directory based on the damage information and the repair strategy in Table 1.

[0240] S504, the electronic device reclaims the increased storage space after the directory repair.

[0241] In some embodiments, S504 can refer to the description in S404a.

[0242] S505, the electronic device scans the data in the area with the corresponding directory damage flag based on the directory damage flag.

[0243] Among them, the area with the corresponding directory damage flag can refer to the description in S402.

[0244] S506, the electronic device determines whether there is directory damage.

[0245] If the electronic device determines that there is directory damage, it executes S507; if the electronic device determines that there is no directory damage, it executes S508.

[0246] In some embodiments, referring to Table 1, the electronic device can determine whether there is directory damage based on the detection criteria in the record table.

[0247] S507, the electronic device repairs the damaged directory.

[0248] After S507, the electronic device can execute S504.

[0249] S508, the electronic device exits the repair process.

[0250] S509, the electronic device loads the parameter information of the file system.

[0251] In some embodiments, S509 can refer to the description in S406.

[0252] S510, the electronic device scans the data in the frequently operated area based on the parameter information of the file system.

[0253] The frequently operated area can be: the log partition. Exemplarily, the data in the frequently operated area can include: log files.

[0254] In some embodiments, frequently operated can be understood as the number of read / write operations being greater than a preset number.

[0255] After S510, the electronic device can execute S506.

[0256] In this embodiment, when the electronic device is in the power-on (or restart) state, in the case where there is a directory damage mark in the electronic device and there is recorded damage information in the electronic device, the electronic device can determine a corresponding repair strategy based on the damage information to repair the damaged directory. In the case where there is no directory damage mark in the electronic device, the electronic device can scan and repair the data in the frequently operated area, and after completing the repair of the damaged directory, the electronic device can reclaim the increased storage space after the directory repair, which can improve the utilization rate of the storage space.

[0257] Figure 6 It is a schematic flowchart of another method for processing directories provided by an embodiment of the present application. Refer to Figure 6 , the directory processing method provided by the embodiment of the present application can include:

[0258] S601, when the electronic device is in the power-off (or factory reset) state, the electronic device loads the parameter information of the file system.

[0259] Among them, factory reset means that: the electronic device is restored to the initial state at the time of factory, and when the electronic device is in the factory reset state, the user data (such as third-party applications, files, and user setting data, etc.) and configurations in the electronic device are all deleted.

[0260] In some embodiments, the electronic device loading the parameter information of the file system can refer to the description in S504.

[0261] S602, the electronic device scans the data of each partition based on the parameter information of the file system.

[0262] Since the power-off (or factory reset) takes a long time, the electronic device has enough time to scan the data of each partition.

[0263] S603, the electronic device determines whether there is directory damage based on the data of each partition.

[0264] If the electronic device determines that a directory is damaged, it executes S604; if the electronic device determines that there is no damaged directory, it executes S606.

[0265] In S604, the electronic device repairs the damaged directory.

[0266] In some embodiments, the electronic device may determine a corresponding repair strategy for the damaged directory based on Table 1, and complete the repair of the directory based on this repair strategy.

[0267] In S605, the electronic device reclaims the storage space increased after the directory repair.

[0268] In some embodiments, S605 may refer to the description in S504.

[0269] In S606, the electronic device exits the repair process.

[0270] In this embodiment, when the electronic device is in the shutdown (or factory reset) state, the electronic device can scan all partitions, and when there is a damaged directory in the electronic device, the electronic device can repair the directory based on the repair strategy in the record table. After the repair is completed, the electronic device can release (reclaim) the storage space increased after the repair, which can improve the utilization rate of the storage space of the electronic device.

[0271] Based on the foregoing several embodiments, the embodiments of the present application provide a method for processing a directory, referring to Figure 7 , the method may include the following steps:

[0272] In S701, the electronic device starts the first program.

[0273] Among them, the first program may refer to the description in S301.

[0274] In S702, after the electronic device starts the first program, if the electronic device fails to open the file of the first program based on the first directory entry, the electronic device marks the first directory entry as abnormal and terminates the operation of creating a new directory entry corresponding to the first program.

[0275] Among them, the first directory entry may refer to the description of the first directory entry in S302.

[0276] In some embodiments, when the electronic device fails to open the file of the first program based on the first directory entry, the electronic device may determine that the first directory entry corresponding to the first program is abnormal.

[0277] In some embodiments, the abnormality of the first directory entry may include: the first directory entry is missing, or the first directory entry points to the wrong location, etc.

[0278] In some embodiments, the electronic device marks the first directory entry as abnormal, which may refer to the description of the electronic device marking the first directory entry and the file corresponding to the first directory entry in S304.

[0279] In some embodiments, the electronic device terminates the operation of creating a new directory entry corresponding to the first program, which may refer to the description in S305b.

[0280] In this embodiment, when the electronic device starts the first program and fails to open the file of the first program based on the first directory entry, the electronic device may mark the first directory entry as abnormal. In this way, when the electronic device opens the file of the first program based on the first directory entry again, the electronic device first determines whether the first directory entry is marked as abnormal. If the first directory entry is marked as abnormal, the electronic device does not open the file based on the first directory entry, and the electronic device terminates the operation of creating a new directory entry corresponding to the first program. In this way, since the electronic device does not create a new directory entry corresponding to the first program, it is possible to avoid infection in other areas except the area of the first directory entry and does not affect the execution of other programs (programs other than the first program) in the electronic device.

[0281] In an alternative embodiment, if the electronic device meets a preset condition, the electronic device may perform data detection on at least one storage area of the electronic device to obtain a detection result, and the detection result may be at least used to indicate abnormal information of directories in at least one storage area. The electronic device may repair abnormal directory entries in at least one storage area based on the detection result. The preset condition may include: the electronic device is in an idle state for a preset duration and the electronic device remains in an idle state.

[0282] In some embodiments, at least one storage area may be a system partition, a log partition, a data partition, or a domain partition. And since the file system is included in the electronic device, the storage space of the file system may be referred to as the storage area of the electronic device.

[0283] In some embodiments, the electronic device performing data detection on at least one storage area of the electronic device may be referred to as: the electronic device scans the data of at least one storage area to determine whether there is a damaged directory.

[0284] In some embodiments, referring to Figure 4 , the detection result is used to indicate whether the directory is damaged and the proportion of damaged directories (optional).

[0285] In this embodiment, when the preset condition is met, the electronic device may automatically perform data detection on at least one storage area to obtain a detection result, and repair abnormal directory entries in at least one storage area based on the detection result, without the user manually triggering the electronic device to perform detection and repair, which has good flexibility.

[0286] In an alternative embodiment, data detection is performed on at least one storage area of the electronic device to obtain a detection result, including: when the electronic device determines that the first directory entry is marked as abnormal, the electronic device can perform data detection on the first storage area to obtain a first detection result; wherein, the first storage area is the storage area where the first directory entry is located, and the first detection result is at least used to indicate the abnormal information of the directory in the first storage area. The electronic device can repair the abnormal directory entries in at least one storage area based on the first detection result, including: the electronic device repairs the abnormal directory entries in the first storage area based on the first detection result. Among them, the abnormal directory entries in the first storage area include the first directory entry.

[0287] In some embodiments, the first detection result may be damage information recorded by the electronic device.

[0288] In some embodiments, when the electronic device determines that the first directory entry is marked as abnormal, the electronic device can determine whether there is a first detection result. If there is a first detection result in the electronic device, the electronic device can repair the first directory entry based on the first detection result. If there is no first detection result in the electronic device, the electronic device can perform data detection on the area corresponding to the first directory entry (the first storage area) based on the marked first directory entry to obtain a first detection result. The electronic device can repair the abnormal directory entries in the first storage area based on the detection result.

[0289] In this embodiment, the electronic device can detect at least one storage area related to the abnormal directory entry (such as the first storage area) to obtain a first detection result. The electronic device can repair the abnormal directory entries in the first area based on the first detection result, which can avoid the time consumption and resource consumption caused by the electronic device detecting multiple storage areas, and can specifically repair the abnormal directory entries in the first area.

[0290] In an alternative embodiment, the electronic device performs data detection on at least one storage area of the electronic device to obtain a detection result, including: the electronic device performs data detection on the second storage area to obtain a second detection result. Wherein, the second storage area is at least one storage area other than the first storage area in the electronic device. The electronic device repairs the abnormal directory entries in at least one storage area based on the detection result, and further includes: the electronic device repairs the abnormal directory entries in the second storage area based on the second detection result.

[0291] In some embodiments, referring to Figure 4 , the second storage area may be a system partition. The electronic device can perform data detection on the system partition to obtain a second detection result, and repair the abnormal directory entries in the system partition based on the second detection result.

[0292] In some embodiments, referring to Figure 5 , the second storage area may be a log partition. The electronic device may perform data detection on the log partition to obtain a second detection result, and based on the second detection result, repair the abnormal directory entries in the log partition.

[0293] In this embodiment, the electronic device detects the second storage area to obtain a second detection result, and based on the second detection result, repairs the abnormal directory entries in the second storage area, which can make there be no abnormal directory entries in the second storage area, thereby facilitating the electronic device to access the file corresponding to the directory entry based on the directory entry in the second area.

[0294] In an alternative embodiment, the electronic device performs data detection on the second storage area to obtain a second detection result, including: after the electronic device repairs the abnormal directory entries in the first storage area, if the electronic device is still in an idle state, the electronic device may perform data detection on the second storage area.

[0295] In this embodiment, when the electronic device is in an idle state, the electronic device can continue to perform data detection on the second storage area, which can make full use of the time resources and computing resources in the idle state and improve the resource utilization efficiency. In addition, since the electronic device is in an idle state, the user is unaware of the process of the electronic device performing detection and repair, and the user experience is better.

[0296] In an alternative embodiment, the second detection result may include the proportion of the abnormal directory area in the second storage area to the total directory area. The electronic device repairs the abnormal directory entries in the second storage area based on the second detection result, including: if the proportion of the abnormal directory area to the total directory area is greater than a preset value, the electronic device may repair the abnormal directory entries in the second storage area based on the second detection result.

[0297] In some embodiments, referring to Figure 4 , the abnormal directory area may be a damaged directory area.

[0298] In this embodiment, the electronic device may determine whether to repair the abnormal directory entries in the second storage area based on the proportion of the abnormal directory area in the second storage area (such as an important partition) to the total directory area. When the proportion of the abnormal directory area to the total directory area is lower than the preset value, the electronic device may not repair the abnormal directory entries, which can save computing resources and time resources.

[0299] In an alternative embodiment, the second storage area includes at least one of the following: a storage area for storing firmware and system resources; or a storage area with a read-write operation count greater than a preset count; or all storage areas other than the first storage area.

[0300] In some embodiments, the storage area for storing firmware and system resources may be referred to as the system partition, and the storage area with the number of read / write operations greater than a preset number may be the log partition.

[0301] In some embodiments, the storage area with the number of read / write operations greater than a preset number may be described as an area with frequent operations.

[0302] In an alternative embodiment, during the process of the electronic device repairing abnormal directory entries in at least one storage area, if the electronic device receives a user operation, the electronic device may terminate the repair process and restore the directory of the electronic device to the directory before the repair.

[0303] In some embodiments, the user operation may refer to the description in S404b.

[0304] In this embodiment, in response to the electronic device receiving a user operation, the electronic device is no longer in an idle state. Since the electronic device repairing the directory will occupy the computing resources of the electronic device, when a user operation is received, in order to improve the user experience, the electronic device needs to terminate the repair process and restore the directory of the electronic device to the directory before the repair.

[0305] In an alternative embodiment, the preset condition further includes at least one of the following: the electronic device is powered on or restarted; or the electronic device enters the shutdown process; or the electronic device enters the factory reset process.

[0306] In some embodiments, the electronic device being powered on or restarted may be referred to as: the electronic device is in the powered-on or restarted state; the electronic device entering the shutdown process, or entering the factory reset process may be referred to as: the electronic device is in the shutdown (or factory reset) state.

[0307] In an alternative embodiment, after the electronic device starts the first program, if the electronic device queries the first directory entry and the first directory entry is marked as abnormal, the electronic device may output a notification message and terminate the operation of opening the file of the first program based on the first directory entry; wherein, the notification message is used to indicate a program or system error.

[0308] In some embodiments, referring to S305a, the notification message may be an error message, such as the file cannot be found (e.g., "FR_NO_FILE").

[0309] In some embodiments, the electronic device terminating the operation of opening the file of the first program based on the first directory entry may be referred to as the electronic device intercepting the operation of opening the file.

[0310] In this embodiment, when the electronic device terminates the execution of opening the first program based on the first directory entry, it can prevent the electronic device from creating a new directory entry corresponding to the file of the first program, thereby avoiding infecting more directory areas subsequently.

[0311] It should be noted that the module names involved in the embodiments of this application can all be defined as other names, as long as the functions of each module can be realized, and no specific restrictions are imposed on the module names.

[0312] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the embodiments of this application are all information and data that have been authorized by the user or fully authorized by all parties. Moreover, the collection, use, and processing of relevant data need to comply with the relevant laws, regulations, and standards of relevant countries and regions, and corresponding operation entrances are provided for users to choose to authorize or reject.

[0313] In some embodiments, the embodiments of this application also provide an electronic device. Referring to Figure 8 , this electronic device may include: a processor 801 (such as a CPU) and a memory 802. The memory 802 may include a high-speed random access memory (RAM), and may also include a non-volatile memory (NVM), such as at least one disk memory. Various instructions can be stored in the memory 802 to complete various processing functions and implement the method steps of this application.

[0314] Optionally, the electronic device involved in this application may further include: a power supply 803, a communication bus 804, and a communication port 805. The above communication port 805 is used to enable the electronic device to connect and communicate with other peripherals. In the embodiments of this application, the memory 802 is used to store computer-executable program code, and the program code includes instructions; when the processor 801 executes the instructions, the instructions cause the processor 801 of the electronic device to perform the actions in the above method embodiments, and its implementation principle and technical effects are similar and will not be elaborated here.

[0315] Optionally, the electronic device involved in this application may further include: a display screen 806. The display screen 806 is used to display the interface of the electronic device.

[0316] It can be understood that Figure 8The structure shown does not constitute a specific limitation on the electronic device. In some other embodiments of the present application, the electronic device may include more or fewer components than those shown, or combine certain components, or split certain components, or have different component arrangements. The components shown may be implemented in hardware, software, or a combination of software and hardware.

[0317] The method for processing a directory provided by the embodiments of the present application can be applied to an electronic device having the function of processing a directory. The electronic device includes a terminal device, and for the specific device form of the terminal device, reference may be made to the above relevant description, which will not be elaborated here.

[0318] The embodiments of the present application provide a terminal device, which includes: a processor and a memory; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory, so that the terminal device executes the above method.

[0319] The embodiments of the present application provide a chip. The chip includes a processor, and the processor is used to call a computer program in the memory to execute the technical solutions in the above embodiments. The implementation principle and technical effects are similar to those of the above relevant embodiments, which will not be elaborated here.

[0320] The embodiments of the present application also provide a computer-readable storage medium. The computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the above method is implemented. The methods described in the above embodiments can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. If implemented in software, the functions can be stored as one or more instructions or codes on a computer-readable medium or transmitted on a computer-readable medium. The computer-readable medium may include a computer storage medium and a communication medium, and may also include any medium that can transfer a computer program from one place to another. The storage medium may be any target medium accessible by a computer.

[0321] In one possible implementation, the computer-readable medium may include RAM, ROM, compact disc read-only memory (CD-ROM), or other optical disc storage, magnetic disk storage, or any other medium targeted to carry or store the required program code in the form of instructions or data structures and accessible by a computer. Moreover, any connection is properly termed a computer-readable medium. For example, if software is transmitted from a website, server, or other remote source using coaxial cable, fiber optic cable, twisted pair, Digital Subscriber Line (DSL), or wireless technologies such as infrared, radio, and microwave, then the coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave are included in the definition of the medium. As used herein, disk and optical disc include optical disc, laser disc, optical disc, Digital Versatile Disc (DVD), floppy disk, and Blu-ray disc, where disks typically reproduce data magnetically, while optical discs utilize lasers to optically reproduce data. Combinations of the above should also be included within the scope of computer-readable media.

[0322] An embodiment of the present application provides a computer program product. The computer program product includes a computer program that, when run on a computer, causes the computer to execute the above method.

[0323] Embodiments of the present application are described with reference to the flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and combinations of flows and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to the processing unit of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable devices to generate a machine, such that the instructions executed by the processing unit of the computer or other programmable data processing device generate means for implementing the functions specified in Figure 1 one or more of the flows or Figure 1 blocks or combinations of blocks.

[0324] The above specific implementation manners further elaborate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above are only specific implementation manners of the present invention and are not used to limit the protection scope of the present invention. Any modifications, equivalent replacements, improvements, etc. made on the basis of the technical solution of the present invention should be included within the protection scope of the present invention.

Claims

1. A method for processing a directory, characterized in that, Including: The electronic device starts the first program. After the electronic device starts the first program, if the electronic device fails to open the file of the first program based on the first directory entry, the electronic device marks the first directory entry as abnormal and terminates the operation of creating a new directory entry corresponding to the first program. The first directory entry is the directory entry created when the first program is started for the first time, and the first directory entry is used to indicate the file path for opening the first program.

2. The method according to claim 1, characterized in that The method further includes: If a preset condition is satisfied, the following steps are executed: The electronic device performs data detection on at least one storage area of the electronic device to obtain a detection result, and the detection result is at least used to indicate the abnormal information of the directories in the at least one storage area. The electronic device repairs the abnormal directory entries in the at least one storage area based on the detection result. Wherein, the preset condition includes: the electronic device is in an idle state for a preset duration and the electronic device maintains the idle state.

3. The method according to claim 2, characterized in that, Performing data detection on at least one storage area of the electronic device to obtain a detection result includes: When the electronic device determines that the first directory entry is marked as abnormal, the electronic device performs data detection on the first storage area to obtain a first detection result; the first storage area is the storage area where the first directory entry is located, and the first detection result is at least used to indicate the abnormal information of the directories in the first storage area. The electronic device repairs the abnormal directory entries in the at least one storage area based on the first detection result, including: The electronic device repairs the abnormal directory entries in the first storage area based on the first detection result, and the abnormal directory entries in the first storage area include the first directory entry.

4. The method according to claim 2 or 3, characterized in that, Performing data detection on at least one storage area of the electronic device to obtain a detection result includes: The electronic device performs data detection on a second storage area to obtain a second detection result, and the second storage area is at least one storage area other than the first storage area in the electronic device. The electronic device repairs the abnormal directory entries in the at least one storage area based on the detection result, and further includes: The electronic device repairs the abnormal directory entries in the second storage area based on the second detection result.

5. The method according to claim 4, wherein The electronic device performs data detection on the second storage area to obtain a second detection result, including: After the electronic device repairs the abnormal directory entries in the first storage area, if the electronic device is still in an idle state, the electronic device performs data detection on the second storage area.

6. The method according to claim 4 or 5, characterized in that The second detection result includes the proportion of the abnormal directory area in the second storage area to the total directory area; the electronic device repairs the abnormal directory entries in the second storage area based on the second detection result, including: If the proportion is greater than a preset value, the electronic device repairs the abnormal directory entries in the second storage area based on the second detection result.

7. The method according to any one of claims 4 to 6, characterized in that The second storage area includes at least one of the following: A storage area for storing firmware and system resources; or A storage area where the number of read / write operations is greater than a preset number; or All storage areas except the first storage area.

8. The method according to any one of claims 2 to 6, characterized in that The method further includes: During the process of the electronic device repairing abnormal directory entries in the at least one storage area, if the electronic device receives a user operation, the electronic device terminates the repair process and restores the directory of the electronic device to the directory before the repair.

9. The method according to claim 2, wherein The preset condition further includes at least one of the following: The electronic device is powered on or restarted; or The electronic device enters the shutdown process; or The electronic device enters the factory reset process.

10. The method according to any one of claims 1 to 9, characterized in that, The method further includes: After the electronic device starts the first program, if the electronic device queries the first directory entry and the first directory entry is marked as abnormal, the electronic device outputs a notification message and terminates the operation of opening the file of the first program based on the first directory entry. The notification message is used to indicate a program or system error.

11. An electronic device, characterized in that, Includes: A processor and a memory; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the electronic device executes the method according to any one of claims 1-10.

12. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, the method according to any one of claims 1-10 is implemented.

13. A chip system, characterized in that, Includes at least one processor and a communication interface, the communication interface and the at least one processor are interconnected by a line, and the at least one processor is used to run a computer program or instruction to execute the method according to any one of claims 1-10.

14. A computer program product, characterized in that, Includes a computer program, and when the computer program is run, the computer is caused to execute the method according to any one of claims 1-10.

Citation Information

Patent Citations

  • File storage method and terminal

    CN107590144A

  • System starting method and device, electronic equipment and storage medium

    CN109710317A

  • Memory card processing method and device, equipment and storage medium

    CN113806119A

  • Whole vehicle upgrading method and vehicle

    CN118605903A

  • A log file of file system and method for recovering file system

    KR1020090119481A