File mounting method, medium, program product, and electronic device

By detecting and ignoring specific directory entry operand attributes of case-insensitive file systems in OverlayFS, mounting of case-insensitive file systems is achieved, expanding the application scope of OverlayFS.

CN117708055BActive Publication Date: 2026-06-09HUAWEI TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HUAWEI TECH CO LTD
Filing Date
2022-09-06
Publication Date
2026-06-09

AI Technical Summary

Technical Problem

OverlayFS cannot mount files in case-insensitive file systems, which limits its application.

Method used

When the file system of the folder to be mounted is detected to be a case-insensitive file system, the attributes of the directory entry operands DCACHE_OP_HASH and DCACHE_OP_COMPARE are ignored, and the file is directly mounted to the target folder.

Benefits of technology

The number of file system types supported by OverlayFS has been increased, allowing case-insensitive file systems to be mounted and accessed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117708055B_ABST
    Figure CN117708055B_ABST
Patent Text Reader

Abstract

The application relates to the field of data processing and discloses a file mounting method, a medium, a program product and an electronic device. In the method, when mounting a to-be-mounted folder, the electronic device can first determine whether the file systems of the to-be-mounted folder are all case-insensitive file systems. If it is determined that the file systems of the to-be-mounted folder are all case-insensitive file systems, the files in the to-be-mounted folder are mounted into a target folder through OverlayFS when the attributes of a directory entry operand DCACHE_NEED_AUTOMOUT and a directory entry operand DCACHE_MANAGE_TRANSIT of the to-be-mounted folder are both invalid, and it is not necessary to determine a directory entry operand DCACHE_OP_HASH and a directory entry operand DCACHE_OP_COMPARE. In this way, the electronic device can mount the folder with the case-insensitive file system through OverlayFS, and access the files through the target folder, which is beneficial to increasing the type of the file system supported by OverlayFS.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing, and in particular to a file mounting method, medium, program product, and electronic device. Background Technology

[0002] OverlayFS is a file system in Linux or Linux-based operating systems that relies on and builds upon other file systems. OverlayFS does not directly participate in the partitioning of the electronic device's disk space structure; instead, it mounts files from multiple directories (folders) in other file systems into a single working folder. This allows applications or services on the electronic device to access files in different file systems by accessing this working folder.

[0003] However, with the evolution of file systems, more and more case-insensitive file systems (CIFS) are emerging, and currently OverlayFS cannot mount files in case-insensitive file systems, which limits the application of OverlayFS. Summary of the Invention

[0004] In view of this, embodiments of this application provide a file mounting method, medium, program product, and electronic device. When the file system of the folder to be mounted is entirely case-insensitive, even if the attributes of the directory entry operands DCACHE_NEED_AUTOMOUT and DCACHE_MANAGE_TRANSIT of the folder to be mounted are invalid, the files in the folder to be mounted are mounted to the target folder via OverlayFS without needing to further determine the directory entry operands DCACHE_OP_HASH and DCACHE_OP_COMPARE. This facilitates increasing the types of file systems supported by OverlayFS.

[0005] In a first aspect, embodiments of this application provide a file mounting method applied to an electronic device, comprising: detecting an instruction to mount files in at least one folder to a target folder using a stacked file system; determining that the file systems of at least one folder are all case-insensitive file systems; mounting files in at least one folder to the target folder when the attributes of the first type operands corresponding to each folder in at least one folder are all invalid; and not mounting at least one folder when the attributes of at least one first type operand of at least one folder are valid.

[0006] In this embodiment, if the file systems of the folders in at least one of the aforementioned files are all case-insensitive file systems, and the attributes of the first type of operands for each folder are all invalid, the files in the at least one of the aforementioned folders are mounted to the target folder (e.g., the working folder hereinafter) using a stacked file system. In this way, the electronic device can mount folders with case-insensitive file systems, increasing the types of file systems supported by the stacked file system (e.g., OverlayFS).

[0007] In one possible implementation of the first aspect above, when the attribute of the first type of operand of the aforementioned folder is valid, it indicates that the folder is an automatically mounted folder or can be mounted through a stacked file system.

[0008] In one possible implementation of the first aspect above, it is determined that the file systems of at least one folder are case-insensitive file systems by: obtaining a reference index identifier for each file in at least one folder; obtaining a first index identifier for the filename of each file in at least one folder after all the filenames are uppercase, and a second index identifier for the filename of each file in at least one folder after all the filenames are lowercase; when the reference index identifier of each file in at least one folder is the same as the corresponding first index identifier and the corresponding second index identifier, it is determined that the file systems of at least one folder are case-insensitive file systems.

[0009] In this embodiment of the application, the electronic device determines whether the folder of the at least one folder is a case-insensitive file system by comparing the first index identifier (e.g., the first test index identifier below) of the file name with all uppercase (e.g., the test file name below), the second index identifier (e.g., the second test index identifier below) corresponding to the file name with all lowercase, and the reference index identifier (e.g., the inode) of each file.

[0010] In one possible implementation of the first aspect above, the method further includes: identifying at least one folder containing a folder with a case-sensitive file system; mounting the files in the at least one folder to the target folder if the attributes of the first type of operand and the second type of operand of each folder are both invalid; and not mounting the at least one folder if the attributes of at least one first type of operand or at least one second type of operand of the at least one folder are valid.

[0011] In this embodiment of the application, if there is a folder in the at least one folder that has a case-sensitive file system, the files in the at least one folder will be mounted to the target folder only if the attributes of the first type of operand and the second type of operand in each folder are both invalid.

[0012] In one possible implementation of the first aspect above, when the attribute of the second type of operand of the folder is valid, it indicates that the file system of the folder defines a function to add directory entries to a hash table or a function to compare whether the file systems of two directory entries are the same.

[0013] In one possible implementation of the first aspect described above, when the electronic device receives an access request for at least one folder, it detects an instruction to mount files in at least one folder to a target folder using a stacked file system.

[0014] In one possible implementation of the first aspect above, the method further includes: after mounting files in at least one folder to the target folder, responding to access requests through the target folder.

[0015] In one possible implementation of the first aspect above, responding to the access request via the target folder includes: deleting each first file in the target folder when the access request includes deleting at least one first file in each of at least one folder; or adding each second file to the target folder when the access request includes adding at least one second file in each of at least one folder; or replacing each third file in the target folder with the corresponding fourth file when the access request includes replacing at least one third file in each of at least one folder with the corresponding fourth file.

[0016] In this embodiment of the application, when the file systems of the folder to be accessed (at least one of the above folders) are all case-insensitive file systems, the electronic device can mount the files in the folder to be accessed to the target folder through OverlayFS, so that the electronic device can access the files through the target folder.

[0017] In one possible implementation of the first aspect above, the operating system of the aforementioned electronic device is a Linux operating system or a Linux-based operating system, wherein the Linux-based operating system includes any one of the following operating systems: Android™, HarmonyOS™, Ubuntu, Community Enterprise OS, Red Hat Linux, Color OS, and Kylin OS.

[0018] In one possible implementation of the first aspect above, the first type of operands includes at least one of the following operands: DCACHE_NEED_AUTOMOUT and DCACHE_MANAGE_TRANSIT.

[0019] In one possible implementation of the first aspect above, the second type of operands includes at least one of the following operands: DCACHE_OP_HASH and DCACHE_OP_COMPARE.

[0020] Secondly, embodiments of this application provide a readable storage medium storing instructions that, when executed on an electronic device, cause the electronic device to implement the first aspect described above and any possible implementation of any file mounting method provided by the first aspect.

[0021] Thirdly, embodiments of this application provide an electronic device, which includes: a memory for storing instructions executed by one or more processors of the electronic device; and a processor, one of the processors of the electronic device, for executing the instructions stored in the memory to implement the first aspect and any possible implementation of the first aspect provided by any file mounting method.

[0022] Fourthly, embodiments of this application provide a computer program product, which includes instructions that, when executed on an electronic device, cause the electronic device to implement the first aspect described above and any possible implementation of any file mounting method provided by the first aspect. Attached Figure Description

[0023] Figure 1A According to some embodiments of this application, a schematic diagram of a file mounting process via OverlayFS is shown;

[0024] Figure 1B According to some embodiments of this application, another schematic diagram of a file mounting process via OverlayFS is shown;

[0025] Figure 2 According to some embodiments of this application, a schematic diagram of a file mounting process via OverlayFS is shown;

[0026] Figure 3 According to some embodiments of this application, a schematic diagram of a prompt message displayed by an electronic device 10 when the folder to be mounted is a case-insensitive file system is shown.

[0027] Figure 4According to some embodiments of this application, a schematic diagram of the display interface is shown when mounting a file in a case-insensitive file system using the file mounting method provided in the embodiments of this application.

[0028] Figure 5 According to some embodiments of this application, a flowchart of a file mounting method is shown;

[0029] Figure 6 According to some embodiments of this application, a flowchart illustrating a method for determining a case-insensitive file system is shown.

[0030] Figure 7 According to some embodiments of this application, a schematic diagram is shown of a reference index identifier, a first test index identifier, and a second test index identifier of a file in a case-insensitive file system displayed by an electronic device 10;

[0031] Figure 8 According to some embodiments of this application, a schematic diagram of a reference index identifier and a first test index identifier of a file in a case-sensitive file system displayed by an electronic device 10 is shown;

[0032] Figure 9 According to some embodiments of this application, a schematic diagram is shown of a reference index identifier, a first test index identifier, and a second test index identifier for a file with a filename in all uppercase in a case-sensitive file system displayed by an electronic device 10;

[0033] Figure 10 According to some embodiments of this application, a flowchart of a file access method is shown;

[0034] Figure 11 According to some embodiments of this application, a schematic diagram of the structure of a file mounting device 200 is shown;

[0035] Figure 12 According to some embodiments of this application, a hardware schematic diagram of a mobile phone 10 is shown;

[0036] Figure 13 According to some embodiments of this application, a schematic diagram of the software architecture of a mobile phone 10 is shown. Detailed Implementation

[0037] The illustrative embodiments of this application include, but are not limited to, file mounting methods, access methods, media, program products, and electronic devices.

[0038] To facilitate understanding of the technical solutions in the embodiments of this application, the terminology involved in the embodiments of this application will be introduced first.

[0039] (1) File system

[0040] A file system is a software module in an operating system used to manage and store file information; it is also called a file management system. Specifically, a file system can be used to create files, store, read, modify, and dump files, as well as control file access.

[0041] Common file systems include, but are not limited to: Virtual File Allocation Table (VFAT) file system, 32-bit allocation table (FAT32) file system, New Technology File System (NTFS), Extended File Allocation Table File System (exFAT), Second extended file system (Ext2), Third extended file system (Ext3), Fourth extended file system (Ext4), Hierarchical File System (HFS), Improved Hierarchical File System (HFS+), ReiserFS, UNIX File System (UFS), Resilient File System (ReFS), Flash Friendly File System (F2FS), etc.

[0042] (2) Case-insensitive file system (CIFS)

[0043] A case-insensitive file system is one that does not distinguish between uppercase and lowercase letters in filenames or folder names. It treats uppercase and lowercase letters as the same character, and files that differ only in the capitalization of their characters are considered identical. In other words, if a file already exists in a directory of a case-insensitive file system, another file cannot exist in that directory whose filename differs only in the capitalization of its characters. For example, if a directory in a case-insensitive file system already contains a file named "abA", then that directory cannot contain files named "AbA", "Aba", "ABA", "ABa", "aBA", "aBa", or "aba". Electronic devices accessing files with filenames "AbA", "Aba", "ABA", "ABa", "aBA", "aBa", or "aba" will only access the file named "abA".

[0044] It is understandable that among the file systems mentioned above, some file systems can only be case-insensitive, while others can be configured as case-insensitive or case-sensitive file systems (CSFS) through settings within the file system. However, once a file system is configured, it can only be either case-insensitive or case-sensitive.

[0045] (3) Stacked file systems (e.g., OverlayFS)

[0046] OverlayFS is a file system that relies on and builds upon other file systems in Linux or Linux-based operating systems. In operating systems that support OverlayFS, such as Linux, users can use OverlayFS commands to mount different folders to a working folder (e.g., workdir). During the mounting process, the device can determine the mounting hierarchy; if files or subfolders with the same name exist in both higher-level and lower-level folders, only files or subfolders from the higher-level folder will be retained.

[0047] For example, when mounting files in a folder in OverlayFS, the folder to be mounted can be specified as a read-write folder (e.g., upperdir) or a read-only folder (e.g., lowerdir). The upperdir has a higher hierarchy than the lowerdir, and within either upperdir or lowerdir, the folder specified first by the device has a higher hierarchy than the folder specified later by the device.

[0048] Specifically, Figure 1A According to some embodiments of this application, a schematic diagram of a file mounting process via OverlayFS is shown.

[0049] refer to Figure 1A The folders to be mounted include folder1, folder2, and folder3. Folder1 contains the file "Bbb.txt" and the subfolder "ccC", folder2 contains the file "Ddd.txt" and the subfolder "ccC", and folder3 contains the files "AaA.txt" and "Bbb.txt".

[0050] Electronic devices can mount based on user-inputted commands, such as:

[0051] "mount-t overlay overlay-o lowerdir= / Folder1:Folder2,upperdir= / Folder3,workdir= / tmp / Tar",

[0052] Create folders Folder1 and Folder2 as lowerdir and folder Folder3 as upperdir, and mount them to the working folder "Tar". Since the hierarchy of folders Folder1, Folder2, and Folder3 is Folder3 > Folder1 > Folder2, and both Folder1 and Folder3 contain a file named "Bbb.txt", only the file "Bbb.txt" from Folder3 will be mounted to "Tar". Similarly, since both Folder1 and Folder2 contain a subfolder named "ccC", only the subfolder "ccC" from Folder1 will be mounted to "Tar". Therefore, the mounted working folder "Tar" will contain: the file "Bbb.txt", the subfolder "ccC", the file "Ddd.txt", and the file "AaA.txt".

[0053] It is understood that in the above mount command, "workdir= / tmp" is used to specify the temporary directory for file mounting, that is, to specify the tmp folder as the temporary directory, which will be deleted after the mount is completed. In some embodiments, the mount command may not include the above field "workdir= / tmp".

[0054] It is understood that the above mount command is only an example. In other embodiments, the mount command may be other forms of command for different operating systems or different versions of operating systems.

[0055] It's understandable that in OverlayFS, you can omit specifying an upperdir and mount all folders as lowerdirs. For example, see [reference]. Figure 1B The folders to be mounted are the aforementioned folders Folder1 and Folder2. The electronic device can mount the folders based on the user's input, such as:

[0056] "mount-t overlay overlay-o lowerdir= / Folder1:Folder2,workdir= / tmp / Tar",

[0057] Mount folders Folder1 and Folder2 to the target folder "Tar" using the lowerdir directive. Since Folder1 is a higher-level folder than Folder2, and both Folder1 and Folder2 contain a subfolder named "ccC", only the subfolder "ccC" from Folder1 will be mounted to "Tar". Therefore, the mounted working folder "Tar" will contain the file "Bbb.txt", the subfolder "ccC", and the file "Ddd.txt".

[0058] The technical solutions provided in the embodiments of this application are described in detail below with reference to the accompanying drawings.

[0059] It is understood that the technical solution of this application is applicable to any operating system that supports OverlayFS, including but not limited to Linux and Android. TM HarmonyOS TM and others based on Linux, Android TM Operating systems include Ubuntu, CentOS, Red Hat Linux, ColorOS, and Kylin OS. For ease of description, the following embodiments will use Linux as an example to describe the operating system of electronic device 10.

[0060] In some embodiments, to avoid affecting the electronic device's access to files after mounting a folder via OverlayFS, the electronic device 10, upon detecting an instruction to mount a folder via OverlayFS, typically first determines whether there are any unmountable folders within the folder to be mounted. If there are no unmountable folders within the folder to be mounted, the electronic device mounts the folder to be mounted via OverlayFS; otherwise, if there are unmountable folders within the folder to be mounted, the folder to be mounted is not mounted.

[0061] Specifically, Figure 2 According to some embodiments of this application, a schematic diagram of a file mounting process via OverlayFS is shown. The process is executed by electronic device 10, and the operating system of electronic device 10 is Linux. Figure 2 As shown, the process includes the following steps:

[0062] S201: Obtain the path information of each folder to be mounted according to the mount command.

[0063] After receiving the mount command, the electronic device 10 obtains the path information of each folder to be mounted.

[0064] It is understandable that the folder to be mounted can be one or more, and there is no limit here.

[0065] For example, electronic device 10 can detect the aforementioned mount command, for example:

[0066] After executing "mount -t overlay overlay -o lowerdir= / Folder1:Folder2,upperdir= / Folder3,workdir= / tmp / Tar", the path information of the folders to be mounted (folders Folder1, Folder2, and Folder3) is obtained according to the mount command. For example, assuming that folder Folder1 is a folder under the folder driver stored in the C partition of the electronic device, the path information of Folder1 obtained can be "C: / driver / Folder1".

[0067] It is understood that the aforementioned instructions can be generated by the electronic device 10 after detecting user operations on the user interface (UI) corresponding to the application installed on the electronic device 10, or can be automatically generated by the application installed on the electronic device 10, or can be generated by system services in the operating system of the electronic device. This application embodiment does not limit the source of the mounting instructions.

[0068] S202: Based on the path information of each folder to be mounted, determine whether there are any folders that cannot be mounted.

[0069] The electronic device 10 obtains the directory entries of each folder to be mounted based on the path information of the folders to be mounted, and determines whether each folder to be mounted is an unmountable folder based on the directory entries of each folder to be mounted. If it is determined that there is an unmountable folder in the folder to be mounted, proceed to step S203; otherwise, if it is determined that there is no unmountable folder in the folder to be mounted, proceed to step S204.

[0070] As can be understood, directory entries are parameters in the file system used to record the attributes of folders. Each folder's directory entry includes, but is not limited to, the folder's directory entry identifier, folder name, subfolders (i.e., folders included in the folder), and parent folder (i.e., the folder one level above the folder). The directory entry identifier for each folder can include directory entry operands such as DCACHE_NEED_AUTOMOUT, DCACHE_MANAGE_TRANSIT, DCACHE_OP_HASH, DCACHE_OP_COMPARE, and DCACHE_OP_DELETE.

[0071] Furthermore, in some embodiments, the electronic device 10 can determine whether each folder to be mounted is an unmountable folder based on whether the attributes of the directory entry operands of the folder to be mounted are valid. For example, the electronic device can determine that the folder to be mounted is an unmountable folder if the attribute of any one of the directory entry operands DCACHE_NEED_AUTOMOUT, DCACHE_MANAGE_TRANSIT, DCACHE_MANAGE_TRANSIT, DCACHE_OP_HASH, and DCACHE_OP_COMPARE of a certain folder to be mounted is valid. For ease of description, the above-mentioned directory entry operands DCACHE_NEED_AUTOMOUT, DCACHE_MANAGE_TRANSIT, DCACHE_MANAGE_TRANSIT, DCACHE_OP_HASH, and DCACHE_OP_COMPARE are referred to as preset directory entry operands.

[0072] It is understood that, in some embodiments, the operands of the aforementioned preset directory items include:

[0073] When the DCACHE_NEED_AUTOMOUT attribute of the directory entry operand is valid, for example, when DCACHE_NEED_AUTOMOUT=1, it indicates that the current folder is an automatically mounted folder and cannot be mounted via OverlayFS at this time;

[0074] When the DCACHE_MANAGE_TRANSIT attribute of the directory entry operand is valid, for example, when DCACHE_MANAGE_TRANSIT=1, it indicates that the current folder cannot be mounted via OverlayFS;

[0075] When the DCACHE_OP_HASH attribute of the directory entry operand is valid, for example, when DCACHE_OP_HASH=1, it indicates that the file system of the current folder has defined a function for adding directory entries to the hash table (dentry_hashtable). Mounting the folder through OverlayFS may affect access to files by electronic devices 10.

[0076] When the DCACHE_OP_COMPARE attribute of the directory entry operand is valid, for example, when DCACHE_OP_COMPARE=1, it indicates that the file system of the current folder defines a function to compare whether the file systems of two directory entries are the same. Mounting a folder through OverlayFS may affect access to files by electronic devices 10.

[0077] In other embodiments, the preset directory entry operands may include more or fewer directory entry operands. For example, it may include more directory entry operands defined by the operating system of the electronic device 10. After mounting a folder with a valid attribute for the directory entry operand, it may affect the directory entry operands for the electronic device 10 to access files. This is not limited here.

[0078] More specifically, in some embodiments, after obtaining the path information of the folder to be mounted, the electronic device 10 can obtain the directory entries (e.g., dentry) of each folder to be mounted based on the obtained path information, and then obtain the directory entry identifier (e.g., d_flag) of each folder to be mounted from the directory entries of each folder to be mounted. Then it determines whether any of the preset operation directory entry operands in the directory entry identifiers of each folder to be mounted has a valid attribute. If the electronic device 10 determines that any preset directory entry operand of any folder to be mounted has a valid attribute, it determines that there is a folder that cannot be mounted, and proceeds to step S203; otherwise, it indicates that the folder to be mounted can be mounted through OverlayFS, and proceeds to step S204.

[0079] In some embodiments, the electronic device 10 can determine whether the attributes of the operands of each preset directory item of the folder to be mounted are valid based on a preset function, such as the ovl_dentry_weird function. The execution logic of the ovl_dentry_weird function is as follows:

[0080]

[0081]

[0082] As can be seen from the above execution logic, if any of the preset directory entry operand attributes in the directory entry identifier of a certain folder to be mounted is valid, the ovl_dentry_weird function will get the result 1, which also indicates that the folder to be mounted is a folder that cannot be mounted, and proceed to step S203.

[0083] S203: The user is prompted that the mounting failed.

[0084] When electronic device 10 contains a folder that cannot be mounted in the folder to be mounted, it prompts the user that the mounting has failed.

[0085] For example, if the attributes of the directory entry operands DCACHE_OP_HASH and DCACHE_OP_COMPARE in the preset directory entry operands of the aforementioned folder 1 are valid, the electronic device 10 will determine that folder 1 is an unmountable folder. Therefore, the electronic device 10 will not mount the folder to be mounted and will display the following... Figure 3 The displayed message 31, "filesystem on ' / Folder1' not supported," indicates to the user that the file system for folder Folder1 is not supported.

[0086] S204: Mount the files in the folder to be mounted to the working folder.

[0087] When electronic device 10 determines that there are no unmountable folders in the folder to be mounted, it mounts the files in the folder to be mounted to the working folder.

[0088] For example, refer to Figure 1A In the mounting process shown, if the attributes of the aforementioned preset directory entry operands for folders Folder1, Folder2, and Folder3 are all invalid, then the validity judgment result of the aforementioned ovl_dentry_weird function for the attributes of the preset directory entry operands of all folders to be mounted will be 0. Electronic device 10 mounts folders Folder1, Folder2, and Folder3 into folder Tar. The files included in the Tar folder are: file "Bbb.txt", subfolder "ccC", file "Ddd.txt", and file "AaA.txt".

[0089] It is understandable that after the electronic device 10 mounts the folder to be mounted to the working folder, the electronic device 10 can access the files through the working folder.

[0090] As can be seen from the aforementioned steps S201 to S204, when mounting a folder, the electronic device 10 determines whether the folder cannot be mounted by checking the validity of the attributes of the preset directory entry operands of each folder to be mounted. If any preset directory entry operand attribute of any folder to be mounted is valid, the electronic device 10 will not mount the folder. However, when the folder's file system is a case-insensitive file system, according to the Linux system's definition of folder directory entry operands, the attributes of the directory entry operands DCACHE_OP_HASH and DCACHE_OP_COMPARE are always valid. Therefore, when the electronic device 10 mounts a file using the above method, it will determine that folders with a case-insensitive file system are unmountable folders. Consequently, the electronic device 10 cannot mount and access files in folders within a case-insensitive file system using OverlayFS, thus limiting the application of OverlayFS.

[0091] It should be noted that mounting folders via OverlayFS using the above method in Linux systems is based on the premise that the folder's file system is case-sensitive. That is, for folders with case-sensitive file systems, as long as any of the aforementioned preset directory entry operand attributes are valid, mounting the folder via OverlayFS will affect file access on electronic device 10. However, in scenarios where the file systems of the folders to be mounted are all case-insensitive, according to the Linux operating system or its mounting rules, even if the directory entry operands DCACHE_OP_HASH and DCACHE_OP_COMPARE of the folder to be mounted are valid, mounting the folder will not affect electronic device 10.

[0092] To enable Linux operating systems, or Linux-based operating systems, to mount folders to be mounted via OverlayFS in scenarios where the file systems of the folders to be mounted are all case-insensitive file systems, this application provides another file mounting method. In this method, when mounting folders to be mounted, the electronic device 10 can first determine whether all the file systems of the folders to be mounted are case-insensitive file systems. If it is determined that all the file systems of the folders to be mounted are case-insensitive, then the folders to be mounted are determined to be unmountable only if the attributes of the directory entry operands DCACHE_NEED_AUTOMOUT and / or DCACHE_MANAGE_TRANSIT of the folders to be mounted are valid. In other words, if it is determined that all the file systems of the folders to be mounted are case-insensitive file systems, as long as the attributes of the directory entry operands DCACHE_NEED_AUTOMOUT and DCACHE_MANAGE_TRANSIT of all the folders to be mounted are invalid, the electronic device 10 will mount each folder to be mounted via OverlayFS.

[0093] Thus, when the file systems of the folders to be mounted are all case-insensitive file systems, if the attributes of the directory entry operands DCACHE_NEED_AUTOMOUT and DCACHE_MANAGE_TRANSIT of all the folders to be mounted are invalid, the electronic device 10 can use OverlayFS to mount the folders of the case-insensitive file systems and access the mounted folders (working folders) through OverlayFS, which is beneficial to improving the types of file systems supported by OverlayFS.

[0094] It is understandable that, in some embodiments, if a folder to be mounted has a case-sensitive file system, the electronic device 10 determines that the folder is unmountable if the attribute of any preset directory entry operand of the folder to be mounted is valid, and therefore does not mount the folder. In other words, if it is determined that a folder to be mounted has a case-sensitive file system, the electronic device 10 will only mount each folder to be mounted via OverlayFS if the attributes of all preset directory entry operands of the folders to be mounted are invalid.

[0095] For ease of description, in the following embodiments, the file system of the folder to be mounted is entirely case-insensitive. The directory entry operand used to determine whether a folder is unmountable is referred to as the first type of operand. For example, the first type of operand may include: directory entry operands DCACHE_NEED_AUTOMOUT and DCACHE_MANAGE_TRANSIT.

[0096] It is understood that, for ease of description, in the following embodiments, when all file systems containing folders in the folder to be mounted are case-sensitive file systems, the directory entry operands used to determine whether a folder is an unmountable folder, excluding the first type of operands, are referred to as the second type of operands. For example, in some embodiments, the second type of operands can be the directory entry operands other than the first type of operands among the aforementioned preset directory entry operands. Specifically, in some embodiments, the second type of operands may include: the directory entry operand DCACHE_OP_HASH and the directory entry operand DCACHE_OP_COMPARE.

[0097] It is understood that in other embodiments, the second type of operands may also include more or fewer directory entry operands. For example, when the attribute of a certain directory entry operand of the folder to be mounted is valid, regardless of whether the file system of the folder to be mounted is a case-sensitive file system or a case-insensitive file system, mounting the folder to be mounted will affect the directory entry operands of the electronic device 10 accessing files. Therefore, the second type of operands may include such directory entry operands without limitation.

[0098] It is understood that in other embodiments, the second type of operands may also include more or fewer directory entry operands. For example, assuming that when the attribute of a certain directory entry operand of the folder to be mounted is valid, if the file system of the folder to be mounted is a case-insensitive file system, mounting the folder to be mounted will not affect the electronic device 10's access to files. However, if the file system of the folder to be mounted is a case-sensitive file system, mounting the folder to be mounted will affect the electronic device 10's access to files. In this case, the second type of operands may include the directory entry operand, without limitation.

[0099] For example, in some embodiments, the ovl_dentry_weird′ function can be obtained by modifying the ovl_dentry_weird function to determine whether OverlayFS can be used to mount the folder to be mounted. The ovl_dentry_weird′ function operates as follows: First, it uses a function to determine whether the file system of the folder to be mounted is entirely case-insensitive. If the file system of the folder to be mounted is entirely case-insensitive, it returns 1 only if the attributes of the first type of operands of the folder to be mounted are valid; otherwise, it returns 0. If the folder to be mounted is a case-sensitive file system, the original ovl_dentry_weird function's operating logic is executed.

[0100] Specifically, in some embodiments, the execution logic of the ovl_dentry_weird′ function is as follows:

[0101] Bool ovl_dentry_weird′(struct dentry*dentry) / / Preset instruction

[0102] {

[0103] #if IS_Case_insensitive() / / Determine if all folders have a case-insensitive file system.

[0104] Component System

[0105] return dentry->d_flags&

[0106] (DCACHE_NEED_AUTOMOUT|DCACHE_MANAGE_TRANSIT);

[0107] / / Returns 1 if all folders are case-insensitive file systems and the directory entry identifier of the folder has the directory entry operand DCACHE_NEED_AUTOMOUT or DCACHE_MANAGE_TRANSIT attribute valid; otherwise, returns 0.

[0108] else return dentry->d_flags&

[0109] (DCACHE_NEED_AUTOMOUT|DCACHE_MANAGE_TRANSIT|DCACHE_OP_HAS

[0110] H|DCACHE_OP_COMPARE);

[0111] / / If the file system of the folder is case-sensitive, return 1 if any of the following directory entry operand attributes are valid in any of the folder's directory entry identifiers; otherwise, return 0:

[0112] DCACHE_NEED_AUTOMOUT, DCACHE_MANAGE_TRANSIT,

[0113] DCACHE_OP_HASH, DCACHE_OP_COMPARE

[0114] }

[0115] Based on the above operational logic, the `ovl_dentry_weird` function uses the predefined `IS_Case_insensitive()` function to determine whether the file systems of the folder to be mounted are all case-insensitive. If it is determined that the file systems of the folder to be mounted are all case-insensitive, it returns 1 only if the first type of operand of the folder to be mounted is valid (i.e., there is a folder that cannot be mounted); otherwise, it returns 0 (i.e., there is no folder that cannot be mounted). When the folder to be mounted is a case-sensitive file system, the original `ovl_dentry_weird` function's operational logic is executed. The specific operational logic of the `IS_Case_insensitive()` function will be introduced below and will not be elaborated upon here.

[0116] For example, refer to Figure 4 In display area 41, the "mount|grep" command shows that the file system type of folders Folder1, Folder2, and Folder3 is VFAT. VFAT is a case-insensitive file system, meaning that the file systems of folders Folder1, Folder2, and Folder3 are all case-insensitive. (Reference) Figure 4 In display area 42, the "ls" command can be used to view the file information contained in folders Folder1, Folder2, Folder3, and Tar. It can be seen that folders Folder1, Folder2, and Folder3 each contain 2 files / subfolders, while folder Tar does not contain any files.

[0117] Assume that the attributes of the first type of operands in the directory entry identifiers of folders Folder1, Folder2, and Folder3 are all invalid, while the attributes of the second type of operands are all valid. Continue to refer to... Figure 4 Electronic device 10 can execute the aforementioned mount command, for example:

[0118] The command `mount -t overlay overlay -o lowerdir= / Folder1:Folder2,upperdir= / Folder3,workdir= / tmp / Tar` mounts Folder1, Folder2, and Folder3 to the working folder Tar. When electronic device 10 executes the above mount command, the return value obtained using the aforementioned `ovl_dentry_weird` function is 0, meaning that OverlayFS can be used to mount Folder1, Folder2, and Folder3.

[0119] After executing the above mount command, as shown in display area 43, electronic device 10 can view the file information of folder Tar using the "mount|grep" command: "overlay on / Tar type overlay(ro,relatime,lowerdir=Folder1:Folder2,upperdir=Folder3)", which means that folder Tar is mounted with folders Folder1 and Folder2 as lowerdir and folder Folder3 as upperdir. Further, refer to... Figure 4 In display area 44, after executing the above mount command, the "ls" command shows that the Tar folder contains the following files: "Bbb.txt", subfolder "ccC", "Ddd.txt", and "AaA.txt". This means that electronic device 10 successfully mounted folders Folder1, Folder2, and Folder3 into the working folder Tar using OverlayFS. Applications and services on electronic device 10 can access files in the case-insensitive file system through OverlayFS.

[0120] The following describes the file mounting method provided in the embodiments of this application, with specific steps.

[0121] Specifically, Figure 5 According to some embodiments of this application, a schematic flowchart of a file mounting method is shown. The main body executing this process is an electronic device 10, such as... Figure 5 As shown, the process includes the following steps.

[0122] S501: Obtain the path information of the folder to be mounted according to the mount command.

[0123] After receiving the mount command, the electronic device 10 obtains the path information of the folder to be mounted. For details, please refer to the description of step S201 above; it will not be repeated here.

[0124] It is understood that the aforementioned instructions can be generated by the user interface (UI) corresponding to the application installed by the user on the electronic device 10, or automatically generated by the application installed on the electronic device 10, or generated by the system service in the operating system of the electronic device. The source of the mount instructions is not limited here.

[0125] S502: Based on the path information of the folder to be mounted, determine whether the file system of the folder to be mounted is entirely a case-insensitive file system.

[0126] For example, the electronic device 10 can determine whether the file system of each folder to be mounted is a case-insensitive file system based on the path information of each folder to be mounted. If it is determined that the file system of all folders to be mounted is a case-insensitive file system, then proceed to step S503; otherwise, if it is determined that the file system of a folder to be mounted is not a case-sensitive file system, then proceed to step S504.

[0127] In some embodiments, the operating system of the electronic device 10 assigns a unique index identifier (e.g., an inode) to each file / folder stored in the electronic device. The electronic device 10 can use the current index identifier of each file / subfolder in the folder to be mounted as a reference index identifier, and obtain a test file name by changing the case of at least some characters of the file name in each file / subfolder in the folder to be mounted, and obtain a test index identifier based on the test file name. If the test index identifier of all files in a folder to be mounted is the same as the reference index identifier, it indicates that the file system of the folder to be mounted is a case-insensitive file system. Therefore, if the file system of each folder to be mounted is a case-insensitive file system, the process proceeds to step S503 for further judgment.

[0128] Specifically, Figure 6 According to some embodiments of this application, a flowchart illustrating a method for determining a case-insensitive file system is shown. Figure 6 As shown, this step includes the following steps:

[0129] S502a: Get the reference index identifiers of each file or folder in the current folder.

[0130] Electronic device 10 obtains the reference index identifiers assigned by the operating system of electronic device 10 to each file or folder in the current folder.

[0131] It's understandable that the current folder can be a folder to be mounted.

[0132] In some embodiments, the electronic device 10 may obtain the index identifiers of each file or folder in the current folder based on preset instructions of the operating system of the electronic device 10.

[0133] For example, Figure 7 This diagram illustrates how the stat command retrieves a file's index identifier. (Reference) Figure 7 In the display area 71, the electronic device 10 can obtain the reference index identifier of the file "Bbb.txt" in the folder Folder1k as 4 based on the command "stat / Folder1 / Bbb.txt".

[0134] For example, refer to Figure 8 Assuming that the file system of folder Folder4 is a case-sensitive file system, and that folder Folder4 contains the file Test.txt, as shown in display area 81, the electronic device can use the command "stat / Folder4 / Text.txt" to obtain the attribute information of the file Test.txt. It can be seen that the reference index of the file Test.txt is 20.

[0135] It is understood that in other embodiments, the electronic device 10 may also obtain the index identifiers of each file or folder based on other instructions, which is not limited here.

[0136] It is understandable that the stat command is a predefined function of the operating system of electronic device 10, used to obtain file attribute information.

[0137] S502b: Obtain the first test index identifier corresponding to the test file name after all file names are in uppercase.

[0138] Electronic device 10 uppercases all filenames and uses the uppercase filenames as test filenames, then obtains the first test index identifier corresponding to the test filename.

[0139] It's understandable that if the file system is case-insensitive, using the "stat" command to view the file corresponding to the test filename actually views the attributes of the file with the filename in all uppercase, hence the first test index identifier and the reference index identifier are the same. If the file system is case-sensitive, when using the "stat" command to view the attributes of the file corresponding to the test filename, if the file with the filename in all uppercase exists in the current folder, a first test index identifier different from the reference index identifier will be obtained; if the file with the filename in all uppercase does not exist in the current folder, a fixed value or an error message will be returned.

[0140] For example, refer to Figure 7 The electronic device 10, displaying area 72, can uppercase all the filenames of the aforementioned file "Bbb.txt" to obtain the test filename "BBB.TXT", and then use the "stat" command to obtain the first test index identifier corresponding to the test filename "BBB.txt". For example... Figure 7 As shown, the first test index identifier corresponding to the test file name "BBB.TXT" is 4.

[0141] For example, refer to Figure 8 In the display area 82, the electronic device 10 can uppercase all the filenames of the aforementioned file "Test.txt" to obtain the test filename "TEST.TXT", and then use the "stat" command to obtain the first test index identifier corresponding to the test filename "TEST.TXT". For example... Figure 8 As shown, the first test index identifier corresponding to the test file name "TEST.TXT" is 28.

[0142] It is understood that in other embodiments, the first test index identifier corresponding to the test file name after all the file names are uppercase can also be obtained in other ways, and this is not limited here.

[0143] It is understood that in some other embodiments, the first test index identifier may also be the first test index identifier corresponding to the test file name after the partial characters of the file name of each file in the current folder are uppercase, and this is not limited here.

[0144] S502c: Determine whether each first test index identifier is the same as the corresponding reference index identifier.

[0145] Electronic device 10 determines whether the first test index identifier of each file or subfolder in the current file is the same as the corresponding reference index identifier. If the first test index identifier of all files is the same as the corresponding reference index identifier, it indicates that the file system of the current folder may be a case-insensitive file system, and proceeds to step S502d for further judgment; otherwise, it indicates that the file system of the current folder is a case-sensitive file system, and proceeds to step S502g.

[0146] For example, for the aforementioned folder Folder1, the first test index identifier of each file is the same as the corresponding reference index identifier, so proceed to step S502d; while for the aforementioned folder Folder4, since the first test index identifier corresponding to the test file name "TEST.TXT" is 28, which is different from the corresponding reference index identifier 20, proceed to step S502d.

[0147] It is understandable that if the filenames of all files in the current folder are already in uppercase, then the judgment in steps S502b and S502c cannot determine that the file system of the current folder is a case-insensitive file system. Therefore, further judgment is required through steps S502d to S502e.

[0148] For example, refer to Figure 9 The folder Folder5 uses a case-sensitive file system, and it contains the file TEST.TXT. Since the file TEST.TXT is entirely uppercase, [reference needed]. Figure 9 The reference index identifier obtained in step S502a for display areas 91 and 92 is 56, while the second test index identifier obtained in step S502c is still 56. Therefore, it is necessary to proceed to steps S502d and S502e for further judgment.

[0149] S502d: Get the second test index identifier corresponding to the test file name after all file names are lowercase.

[0150] The electronic device 10 lowercases all file names, uses the lowercase file names as test file names, and obtains the second test index identifier corresponding to the test file name.

[0151] For example, refer to Figure 7 The electronic device 10, displaying area 73, can lowercase the filename of the aforementioned file "Bbb.txt" to obtain the test filename "bbb.txt", and then use the "stat" command to obtain the second test index identifier corresponding to the test filename "bbb.txt". For example... Figure 7As shown, the second test index identifier corresponding to the test file name "bbb.txt" is 4.

[0152] For example, refer to Figure 9 The electronic device 10, displaying area 93, can lowercase the filename of the aforementioned file "TEST.TXT." to obtain the test filename "test.txt", and then use the "stat" command to obtain the second test index identifier corresponding to the test filename "test.txt". For example... Figure 9 As shown, the second test index identifier corresponding to the test file name "test.txt" is 59.

[0153] It is understood that in other embodiments, the second test index identifier may also be the second test index identifier corresponding to the test file name after lowercase parts of the file names of each file in the current folder, and this is not limited here.

[0154] S502e: Determine whether each second test index identifier is the same as the corresponding reference index identifier.

[0155] Electronic device 10 determines whether the second test index identifier of each file or subfolder in the current file is the same as the corresponding reference index identifier. If the second test index identifier of all files is the same as the corresponding reference index identifier, it means that the file system of the current folder is a case-insensitive file system, and proceeds to step S502f; otherwise, it means that the file system of the current folder is a case-sensitive file system, and proceeds to step S502g.

[0156] For example, for the aforementioned folder Folder1, the second test index identifier of each file is the same as the corresponding reference index identifier, so proceed to step S502f; while for the aforementioned folder Folder5, since the second test index identifier corresponding to the test file name "test.txt" is 59, which is different from the corresponding reference index identifier 56, proceed to step S502g.

[0157] S502f: Determines whether all folders to be mounted have been checked.

[0158] When the first test index identifier and the second test index identifier of each file in the current folder are the same as the corresponding reference index identifier, the electronic device 10 determines whether all folders to be mounted have been checked. If it is determined that all folders to be mounted have been checked, proceed to step S502h; otherwise, proceed to step S502a to check the next folder to be mounted.

[0159] For example, in some embodiments, the electronic device 10 can record the number N of folders to be mounted corresponding to the aforementioned mounting instruction, and increment the count value n by 1 each time a folder is judged (such as each execution of step S502f). When n>N, it is determined that all folders to be mounted have been judged.

[0160] S502g: The file system of the folder to be mounted is a case-sensitive file system.

[0161] When the first test index identifier or the second test index identifier of each file in the current folder is different from the corresponding reference index identifier, the electronic device 10 determines that the file system of the folder to be mounted is a case-sensitive file system. Then it proceeds to step S504.

[0162] S502h: Determines that the file systems of the folders to be mounted are case-insensitive file systems.

[0163] When the first test index identifier and the second test index identifier of each file in all the folders to be mounted are the same as the corresponding reference index identifier, the electronic device 10 determines that the file system of the folders to be mounted is a case-insensitive file system, and then proceeds to step S503.

[0164] It is understood that in some embodiments, the execution process of the aforementioned steps S502a to S502h can be implemented by a predefined function, such as the aforementioned IS_Case_insensitive() function.

[0165] It is understood that the execution order of steps S502a to S502h described above is only an example. In other embodiments, the execution order of some steps may be changed, steps may be merged or split, and more or fewer steps may be included, which is not limited here. For example, in some embodiments, steps S502d and S502e may be executed before steps S502b and S502c, that is, the relationship between the second test index identifier and the reference index identifier is determined first, and then the relationship between the first test index identifier and the reference index identifier is determined.

[0166] It is understood that in other embodiments, the electronic device 10 may also determine in other ways that the file system of the folder to be mounted is a case-insensitive file system, which is not limited here.

[0167] S503: Based on the first type of operand of the folder to be mounted, determine whether there is a folder that cannot be mounted.

[0168] For example, when the electronic device 10 determines that the file systems of the folders to be mounted are all case-insensitive file systems, it obtains the directory entry identifiers of each folder to be mounted and determines whether the attributes of the first type of operands of each folder to be mounted are valid. If it is determined that any attribute of any first type of operand of any folder to be mounted is valid, it means that there are folders that cannot be mounted, and proceeds to step S506. Otherwise, if the attributes of the first type of operands of all folders to be mounted are invalid, it means that the folders to be mounted can be mounted, and proceeds to step S505.

[0169] For example, if the directory entry identifier of a folder to be mounted has DCACHE_NEED_AUTOMOUT=1 and / or DCACHE_MANAGE_TRANSIT=1, it means that the attributes of the first type of operand of the folder to be mounted are valid, and proceed to step S506.

[0170] It is understood that in some embodiments, the electronic device 10 can obtain the directory entry operands in the directory entry identifier of each folder to be mounted by using the dentry structure corresponding to each folder to be mounted, and by using the operating system of the electronic device 10 or the instructions defined by OverlayFS.

[0171] S504: Based on the first and second type operands of the folder to be mounted, determine whether there is a folder that cannot be mounted.

[0172] For example, when the electronic device 10 determines that the file system of the folder to be mounted is a case-sensitive file system, it obtains the directory entry operands in the directory entry identifiers of each folder to be mounted, and determines whether the attributes of the first type of operands and the second type of operands of each folder to be mounted are valid. If it is determined that the attribute of any first type of operand or any second type of operand of any folder to be mounted is valid, it indicates that there is a folder that cannot be mounted, and proceeds to step S506. Otherwise, if the attributes of both the first type of operands and the second type of operands of each folder to be mounted are invalid, it indicates that the folder to be mounted can be mounted, and proceeds to step S505.

[0173] For example, assuming that in the directory entry identifier of a folder to be mounted, DCACHE_NEED_AUTOMOUT=1, and / or DCACHE_MANAGE_TRANSIT=1, and / or DCACHE_OP_HASH=1, and / or DCACHE_OP_COMPARE=1, then the first type of operands and / or the second type of operands of the folder to be mounted are valid, and proceed to step S506.

[0174] It is understood that in some embodiments, the electronic device 10 can obtain the directory entry operands in the directory entry identifier of each folder to be mounted by using the dentry structure corresponding to each folder to be mounted, and by using the operating system of the electronic device 10 or the instructions defined by OverlayFS.

[0175] S505: Mounts files from the folder to be mounted to the working folder.

[0176] When the electronic device 10 finds that there is no unmountable folder in the folder to be mounted, it mounts the files in the folder to be mounted to the working folder.

[0177] In some embodiments, the electronic device 10 may mount the files in the folder to be mounted to the working folder when it is determined that the file system of the folder to be mounted is a case-sensitive file system and the attributes of the first and second type operands of all the folders to be mounted are invalid.

[0178] In other embodiments, the electronic device 10 can mount the files in the folders to be mounted to the working folder when it is determined that the file systems of all the folders to be mounted are case-insensitive file systems and the attributes of the first type operands of all the folders to be mounted are invalid.

[0179] For example, refer to Figure 4 When the electronic device 10 determines that the file systems of folders Folder1, Folder2, and Folder3 are all case-insensitive file systems, and the attributes of the first type operands of folders Folder1, Folder2, and Folder3 are all invalid, such as all being 0, it mounts folders Folder1, Folder2, and Folder3 to folder Tar. Folder Tar then includes the file "Bbb.txt", the subfolder "ccC", the file "Ddd.txt", and the file "AaA.txt".

[0180] S506: The user is prompted that the mounting failed.

[0181] If the electronic device 10 contains a folder that cannot be mounted within the folder to be mounted, it will prompt the user that the mounting has failed.

[0182] For example, in some embodiments, the electronic device 10 may prompt the user that the mounting has failed when it determines that the file system of the folder to be mounted is a case-sensitive file system and that the attributes of any first type operand or any second type operand of the folder to be mounted are valid.

[0183] For example, in other embodiments, the electronic device 10 may prompt the user that the mounting has failed when it is determined that the file systems of all folders to be mounted are case-insensitive file systems and that the attribute of any first type operand stored in any folder to be mounted is valid.

[0184] It is understood that in some embodiments, the aforementioned steps S501 to S504 can be implemented using a predefined function, such as the aforementioned ovl_dentry_weird'() function.

[0185] pass Figures 5 to 9 The file mounting method provided in the illustrated embodiment allows electronic device 10 to mount folders in a case-insensitive file system using OverlayFS, increasing the adaptability of OverlayFS. Thus, applications and services in electronic device 10 can access files in electronic device 10 through the mounted working folder.

[0186] Furthermore, based on the file mounting methods provided in the foregoing embodiments, this application also provides a file access method. In this method, the electronic device 10 can use the aforementioned file mounting method to mount the folder to be accessed to a working folder through OverlayFS, and then access the files in the electronic device through the working folder. In this way, the electronic device 10 uses OverlayFS to access folders in a case-insensitive file system, thereby improving the user experience.

[0187] Specifically, Figure 10 According to some embodiments of this application, a schematic flowchart of a file access method is shown. The execution entity of this process is an electronic device 10, such as... Figure 10 As shown, the process includes the following steps.

[0188] S1001: Get the target folder to be accessed.

[0189] Electronic device 10 obtains the target folder to be accessed.

[0190] In some embodiments, the target folder to be accessed may be at least one folder in the electronic device 10 where an application wants to perform data storage, data deletion, or data modification.

[0191] For example, when updating files in multiple folders corresponding to an application in electronic device 10, the folder to be updated can be used as the target folder.

[0192] For example, when updating the driver for a hardware module in electronic device 10, the folder corresponding to the driver for that hardware module can be used as the target folder.

[0193] For example, when updating an image file in electronic device 10, the folder corresponding to the image file can be used as the target folder.

[0194] S1002: Mount the target folder to the working folder via OverlayFS.

[0195] For example, electronic device 10 can mount the target folder to be accessed to the working folder via OverlayFS using the file mounting methods provided in the foregoing embodiments. For instance, assuming the target folders are folder1, folder2, and folder3, electronic device 10 can mount the target folders to the working folder based on the following instructions:

[0196] "mount-t overlay overlay-o lowerdir= / Folder1:Folder2,upperdir= / Folder3,workdir= / tmp / Tar",

[0197] Or "mount-t overlay overlay-o lowerdir= / Folder1:Folder3,workdir= / tmp / Tar".

[0198] For example, electronic device 10 can first determine whether the file systems of each target folder are case-insensitive file systems. Based on the determination result, it can use different methods to determine whether there are any unmountable folders in the target folder. If there are no unmountable folders in the target folder, it can mount the target folder to the working folder through OverlayFS. The specific mounting process can be referred to the above. Figures 4 to 9 The embodiments shown are not described in detail here.

[0199] S1003: Access the contents of the target folder through the working folder.

[0200] After mounting the target folder to the working folder, the electronic device 10 can access the contents of the target folder through the working folder, such as updating files, deleting files, creating files, etc.

[0201] For example, when the target folder is the folder where the application in the electronic device 10 updates files, the electronic device 10 can update the files to be updated to the working folder.

[0202] For example, when the target folder is the folder corresponding to the driver of the hardware module in the electronic device 10, the electronic device 10 can update the file to be updated to the working folder.

[0203] For example, when the target folder is the folder corresponding to the image file in the electronic device 10, the electronic device 10 can update the image file to be updated to the working folder.

[0204] Through the access method provided in this application embodiment, the electronic device 10 can access files in a case-insensitive file system through OverlayFS, such as updating files, deleting files, creating files, etc., which increases the application scenarios of OverlayFS and improves the user experience.

[0205] Furthermore, embodiments of this application also provide a file mounting device 200, such as... Figure 11 As shown, the file mounting device 200 includes:

[0206] Input unit 201 is used to receive mount instructions, obtain path information of folders to be mounted (folder1, folder2, ..., foldern), and obtain directory entry identifiers, directory entry operands, etc. of each folder to be mounted based on the path information of the folders to be mounted.

[0207] The judgment unit 202 is used to determine whether the folder to be mounted can be mounted. For example, the judgment unit 202 can determine whether the folder to be mounted can be mounted based on the aforementioned ovl_dentry_weird'() function and IS_Case_insensitive() function. The specific judgment logic can be referred to steps S501 to S504 above, and will not be elaborated here.

[0208] Mounting unit 203 is used to mount the files in the folder to be mounted (folder 1, folder 2, ..., folder n) to the working folder according to the OverlayFS file mounting logic when the judgment unit 202 determines that the folder to be mounted can be mounted.

[0209] With the file mounting device 200 provided in this application embodiment, the electronic device 10 can mount folders in a case-insensitive file system through OverlayFS, and then access them through OverlayFS, such as updating files, deleting files, creating files, etc., which increases the application scenarios of OverlayFS and improves the user experience.

[0210] It is understood that the technical solutions provided in the embodiments of this application are applicable to any electronic device 10 that supports OverlayFS, including but not limited to mobile phones, laptops, tablets, wearable devices, head-mounted displays, mobile email devices, portable game consoles, portable music players, e-readers, smart home appliances, and IoT devices. The following description uses a mobile phone 10 as an example to illustrate the hardware of the electronic device to which the technical solutions of the embodiments of this application are applicable.

[0211] Specifically, Figure 12 According to some embodiments of this application, a schematic diagram of the hardware structure of a mobile phone 10 is shown.

[0212] like Figure 12 As shown, the mobile phone 10 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone jack 170D, a sensor module 180, buttons 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an accelerometer sensor 180E, a distance sensor 180F, a proximity sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, and so on.

[0213] Processor 110 may include one or more processing units, such as application processors (APs), modem processors, graphics processing units (GPUs), image signal processors (ISPs), controllers, video codecs, digital signal processors (DSPs), baseband processors, and / or neural network processing units (NPUs). These different processing units may be independent devices or integrated into one or more processors.

[0214] The controller can generate operation control signals based on the instruction opcode and timing signals to complete the control of instruction fetching and execution.

[0215] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can directly retrieve it from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system. In some embodiments, the processor 110 can be used to execute instructions for the file mounting method and file access method provided in the embodiments of this application, such as executing instructions corresponding to the aforementioned ovl_dentry_weird() function and IS_Case_insensitive() function.

[0216] In some embodiments, the processor 110 may include one or more interfaces. Interfaces may include an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a serial peripheral interface (SPI), a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.

[0217] The I2S interface can be used for audio communication. In some embodiments, the processor 110 may include multiple I2S buses. The processor 110 can be coupled to the audio module 170 via the I2S bus to enable communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 can transmit audio signals to the wireless communication module 160 via the I2S interface to enable the function of answering phone calls through a Bluetooth headset.

[0218] The PCM interface can also be used for audio communication, sampling, quantizing, and encoding analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 can be coupled via the PCM bus interface. In some embodiments, the audio module 170 can also transmit audio signals to the wireless communication module 160 via the PCM interface, enabling the function of answering phone calls through a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.

[0219] The UART interface is a universal serial data bus used for asynchronous communication. This bus can be a bidirectional communication bus. It converts the data to be transmitted between serial and parallel communication. In some embodiments, the UART interface is typically used to connect the processor 110 and the wireless communication module 160. For example, the processor 110 communicates with the Bluetooth module in the wireless communication module 160 via the UART interface to implement Bluetooth functionality. In some embodiments, the audio module 170 can transmit audio signals to the wireless communication module 160 via the UART interface to enable music playback through Bluetooth headphones.

[0220] The MIPI interface can be used to connect the processor 110 to peripheral devices such as the display 194 and camera 193. The MIPI interface includes a camera serial interface (CSI) and a display serial interface (DSI). In some embodiments, the processor 110 and camera 193 communicate via the CSI interface to enable the mobile phone 10 to take pictures. The processor 110 and display 194 communicate via the DSI interface to enable the mobile phone 10 to display.

[0221] The GPIO interface can be configured via software. It can be configured as a control signal or a data signal. In some embodiments, the GPIO interface can be used to connect the processor 110 to a camera 193, a display screen 194, a wireless communication module 160, an audio module 170, a sensor module 180, etc. The GPIO interface can also be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, etc.

[0222] USB port 130 is a USB standard compliant interface, which can be a Mini USB port, Micro USB port, USB Type-C port, etc. USB port 130 can be used to connect a charger to charge the phone 10, and can also be used for data transfer between the phone 10 and peripheral devices. It can also be used to connect headphones for audio playback. This interface can also be used to connect other electronic devices, such as AR devices.

[0223] The charging management module 140 receives charging input from the charger. While charging the battery 142, the charging management module 140 can also supply power to the electronic device through the power management module 141.

[0224] The power management module 141 is used to connect the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140 to power the processor 110, internal memory 121, display 194, camera 193, and wireless communication module 160, etc.

[0225] The wireless communication function of mobile phone 10 can be realized through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor.

[0226] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals.

[0227] The mobile communication module 150 can provide solutions for wireless communication applications including 2G / 3G / 4G / 5G on the mobile phone 10. The mobile communication module 150 may include at least one filter, switch, power amplifier, low-noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves via the antenna 1, and perform filtering, amplification, and other processing on the received electromagnetic waves before transmitting them to the modem processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation via the antenna 1. In some embodiments, at least some functional modules of the mobile communication module 150 may be housed in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 150 and at least some modules of the processor 110 may be housed in the same device.

[0228] The wireless communication module 160 can provide solutions for wireless communication applications on the mobile phone 10, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), and infrared (IR) technologies. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via antenna 2, performs frequency modulation and filtering of the electromagnetic wave signals, and sends the processed signal to processor 110. The wireless communication module 160 can also receive signals to be transmitted from processor 110, perform frequency modulation and amplification, and convert them into electromagnetic waves for radiation via antenna 2.

[0229] In some embodiments, the drivers or configuration files corresponding to the mobile communication module 150, the wireless communication module 160, the modem processor, and the baseband processor can be stored in the mobile phone 10 in a case-insensitive file system. Then, when the mobile phone 10 updates the above-mentioned drivers or configuration files, it can use the file mounting method provided in the embodiments of this application to mount the folder corresponding to the driver or configuration file to be updated in the working folder, so that the mobile phone 10 can update the above-mentioned drivers or configuration files based on OverlayFS.

[0230] Display screen 194 is used to display images, videos, etc. Display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a Mini-LED, a Micro-LED, a Micro-OLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, mobile phone 10 may include one or N displays 194, where N is a positive integer greater than 1.

[0231] Camera 193 is used to capture still images or videos. An object is projected onto a photosensitive element by generating an optical image through the lens. The photosensitive element can be a charge-coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, which is then passed to an ISP for conversion into a digital image signal. The ISP outputs the digital image signal to a DSP for processing. The DSP converts the digital image signal into image signals in standard RGB, YUV, or other formats. In some embodiments, the mobile phone 10 may include one or N cameras 193, where N is a positive integer greater than 1.

[0232] The external storage interface 120 can be used to connect an external storage card, such as a Micro SD card, to expand the storage capacity of the mobile phone 10. The external storage card communicates with the processor 110 through the external storage interface 120 to perform data storage functions. For example, music, video, and other files can be saved on the external storage card.

[0233] Internal memory 121 can be used to store computer executable program code, including instructions, such as the aforementioned memory 103. Internal memory 121 may include a program storage area and a data storage area. The data storage area may store data created during the use of mobile phone 10, etc. In addition, internal memory 121 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc. Processor 110 executes various functional applications of mobile phone 10 by running instructions stored in internal memory 121 and / or instructions stored in memory disposed in processor 110.

[0234] The phone 10 can perform audio functions, such as music playback and recording, through an audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, and application processor.

[0235] Audio module 170 is used to convert digital audio information into analog audio signal output, and also to convert analog audio input into digital audio signal. Audio module 170 can also be used for encoding and decoding audio signals.

[0236] The speaker 170A, also known as a "loudspeaker," is used to convert audio electrical signals into sound signals. For example, in some embodiments, the speaker 170A can be used to play a notification tone indicating whether the card swipe was successful or not.

[0237] The receiver 170B, also known as the "earpiece", is used to convert audio electrical signals into sound signals.

[0238] The microphone 170C, also known as a "microphone" or "voice transducer," is used to convert sound signals into electrical signals.

[0239] The 170D headphone jack is used to connect wired headphones.

[0240] Pressure sensor 180A is used to sense pressure signals and convert them into electrical signals. In some embodiments, pressure sensor 180A can be disposed on display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, and capacitive pressure sensors. A capacitive pressure sensor may include at least two parallel plates with conductive material. When force is applied to pressure sensor 180A, the capacitance between the electrodes changes. Mobile phone 10 determines the pressure intensity based on the change in capacitance. When a touch operation is applied to display screen 194, mobile phone 10 detects the intensity of the touch operation based on pressure sensor 180A. Mobile phone 10 can also calculate the touch position based on the detection signal from pressure sensor 180A. In some embodiments, touch operations applied to the same touch position but with different touch operation intensities can correspond to different operation commands.

[0241] The 180E accelerometer can detect the magnitude of acceleration in various directions (typically three axes) of the mobile phone 10. When the mobile phone 10 is stationary, it can detect the magnitude and direction of gravity. It can also be used to identify the posture of electronic devices and applied to applications such as screen orientation switching and pedometers.

[0242] The ambient light sensor 180L is used to detect ambient light levels. The phone 10 can adaptively adjust the display brightness 194 based on the detected ambient light level. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking photos. The ambient light sensor 180L can also work in conjunction with the proximity sensor 180G to detect whether the phone 10 is in a pocket, preventing accidental touches.

[0243] The fingerprint sensor 180H is used to collect fingerprints. The mobile phone 10 can utilize the collected fingerprint characteristics to achieve fingerprint unlocking, app access lock, fingerprint photography, fingerprint call answering, etc. In this embodiment, the main space and the privacy space can use different unlock fingerprints for authentication and login to ensure the security of private data within the privacy space. Users can verify different fingerprints on the mobile phone 10 to enter the main space and privacy space respectively.

[0244] Touch sensor 180K, also known as a "touch device," can be located on display screen 194. The touch sensor 180K and display screen 194 together form a touchscreen, also known as a "touchscreen." Touch sensor 180K detects touch operations applied to or near it. The touch sensor can transmit the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through display screen 194. In other embodiments, touch sensor 180K may also be located on the surface of mobile phone 10, in a different position than display screen 194.

[0245] The bone conduction sensor 180M can acquire vibration signals. In some embodiments, the bone conduction sensor 180M can acquire vibration signals from vibrating bone fragments in the human vocal cords. The bone conduction sensor 180M can also contact the human pulse to receive blood pressure signals.

[0246] Button 190 includes a power button, volume buttons, etc. Button 190 can be a mechanical button or a touch button. Mobile phone 10 can receive button input and generate key signal inputs related to user settings and function control of mobile phone 10. For example, in some embodiments, when mobile phone 10 is in a screen-off state and the power button is pressed twice consecutively, the NFC-based card-swiping method provided in this application embodiment is triggered.

[0247] Motor 191 can generate vibration alerts. For example, in some embodiments, mobile phone 10 can alert the user by vibration when the user successfully or unsuccessfully swipes their card.

[0248] Indicator 192 can be an indicator light, used to indicate charging status, battery level changes, or to indicate messages, missed calls, notifications, etc. For example, in some embodiments, mobile phone 10 can alert the user by setting different colors to the indicator light when the user's card swipe is successful or unsuccessful.

[0249] The SIM card interface 195 is used to connect the SIM card.

[0250] It is understood that in some embodiments, the drivers or configuration files corresponding to each hardware module of the mobile phone 10 can be stored in the mobile phone 10 in a case-insensitive file system. Therefore, when the mobile phone 10 updates the above-mentioned drivers or configuration files, it can use the file mounting method provided in the embodiments of this application to mount the folder corresponding to the driver or configuration file to be updated in the working folder, so that the mobile phone 10 can update the above-mentioned drivers or configuration files based on OverlayFS.

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

[0252] It is understood that the technical solutions of this application are applicable to any operating system that supports OverlayFS, including but not limited to Android. TM HarmonyOS TM and others based on Linux, Android TM Operating systems such as Ubuntu, Community Enterprise Operating System (Cent OS), Red Hat Linux, Color OS, and Kylin OS.

[0253] The following uses the HarmonyOS operating system as an example to introduce the software system to which the technical solutions of the embodiments of this application are applicable.

[0254] Specifically, Figure 13 According to some embodiments of this application, a schematic diagram of the software architecture of a mobile phone 10 is shown. For example... Figure 13 As shown, the software architecture of the phone 10 mainly includes:

[0255] Application layer 401: may include system applications 4011 and extended applications 4012 (or third-party applications). Among them, system applications 4011 may include desktop, settings, camera, file management, system updates, etc.; extended applications 4012 may include software applications such as smart home control applications and music players.

[0256] The framework layer 402 provides a multi-language framework for the application layer, including a User Interface (UI) framework 4021, a user program framework 4022, and a capability framework 4023. The UI framework 4021 includes a window manager, content provider, view system, phone manager, resource manager, and notification manager, which will not be elaborated upon here. The user program framework 4022 and capability framework 4023 provide the application with the capabilities of various components required by the application, such as computing power (including CPU computing power, Graphics Processing Unit (GPU) computing power, Image Signal Processor (ISP) computing power, etc.), sound pickup capabilities (including microphone pickup capabilities, speech recognition capabilities, etc.), device security capabilities (including trusted operating environment security levels, etc.), display capabilities (including screen resolution, screen size, etc.), playback capabilities (including amplification capabilities, stereo sound capabilities, etc.), and storage capabilities (including device memory capabilities, random access memory (RAM) capabilities, etc.), etc., which are not limited here.

[0257] The system service layer 403 is the core of the mobile phone 10 software system, providing services to the applications in the application layer 401 through the framework layer 402. The system service layer 403 includes a distributed soft bus 4031, a distributed data management module 4032, a distributed task scheduling module 4033, and subsystem sets 4034, etc. Among them:

[0258] The distributed soft bus 4031 serves as the foundation for connecting the mobile phone 10 to other electronic devices, providing a unified distributed communication capability for seamless interconnection between devices. It enables rapid device discovery and connection, and efficient transmission of tasks and data. For example, in some embodiments, the mobile phone 10 can obtain data to be updated from other devices via the distributed soft bus 4031.

[0259] The distributed data management module 4032 is based on a distributed soft bus to realize distributed management of application data and user data, so that user data in the mobile phone 10 is no longer bound to a single physical device, business logic and data storage are separated, and data is seamlessly connected when the application runs across devices.

[0260] The distributed task scheduling module 4033 is used to build a unified distributed service management (discovery, synchronization, registration, and invocation) mechanism based on the distributed soft bus 4031, distributed data management 4032, etc. It supports remote startup, remote invocation, binding / unbinding, and migration of applications across devices. It can select the most suitable device to run distributed tasks based on the capabilities, location, business operation status, resource usage of different devices, and user habits and intentions.

[0261] Subsystem set 4034 can provide corresponding services to the application layer through the framework layer, including but not limited to basic system capability services, basic software services, enhanced software services, hardware services, etc.

[0262] Kernel layer 404 includes kernel subsystem 4041 and driver subsystem 4042.

[0263] The kernel subsystem 4041 provides basic kernel capabilities to the upper layers by shielding the differences between multiple kernels, including process / thread management, memory management, file system, network management, and peripheral device management. The file mounting method and file access method provided in this application embodiment can be integrated into the kernel subsystem 4041, for example, into the Linux Kernel, to provide the mobile phone 10 with access to files or folders in a case-insensitive file system via OverlayFS.

[0264] The driver subsystem 4042 includes a hardware driver framework, which can provide the mobile phone 10 with unified peripheral access capabilities and a management framework.

[0265] Understandable. Figure 13 The architecture of the operating system of the mobile phone 10 shown is only an example. In other embodiments, the operating system of the mobile phone 10 may include more or fewer modules, or some modules may be split or merged, or other architectures may be adopted, which are not limited here.

[0266] The various embodiments of the mechanisms disclosed in this application can be implemented in hardware, software, firmware, or a combination of these implementation methods. Embodiments of this application can be implemented as computer programs or program code executable on a programmable system, the programmable system including at least one processor, a storage system (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device.

[0267] Program code can be applied to input instructions to execute the functions described in this application and generate output information. The output information can be applied to one or more output devices in a known manner. For the purposes of this application, the processing system includes any system having a processor such as, for example, a digital signal processor (DSP), a microcontroller, an application-specific integrated circuit (ASIC), or a microprocessor.

[0268] The program code can be implemented using a high-level procedural language or an object-oriented programming language to communicate with the processing system. Assembly language or machine language can also be used when needed. In fact, the mechanisms described in this application are not limited to any particular programming language. In either case, the language can be a compiled language or an interpreted language.

[0269] In some cases, the disclosed embodiments may be implemented in hardware, firmware, software, or any combination thereof. The disclosed embodiments may also be implemented as instructions carried or stored thereon on one or more temporary or non-temporary machine-readable (e.g., computer-readable) storage media, which may be read and executed by one or more processors. For example, the instructions may be distributed via a network or through other computer-readable media. Therefore, machine-readable media may include any mechanism for storing or transmitting information in a machine-readable (e.g., computer-readable) form, including but not limited to floppy disks, optical disks, CD-ROMs, magneto-optical disks, read-only memory (ROM), random access memory (RAM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), magnetic cards or optical cards, flash memory, or tangible machine-readable storage for transmitting information (e.g., carrier waves, infrared signals, digital signals, etc.) using the Internet in the form of electrical, optical, acoustic, or other propagation signals. Therefore, machine-readable media include any type of machine-readable medium suitable for storing or transmitting electronic instructions or information in a machine-readable (e.g., computer-readable) form.

[0270] In the accompanying drawings, some structural or methodological features may be shown in a specific arrangement and / or order. However, it should be understood that such a specific arrangement and / or order may not be necessary. Rather, in some embodiments, these features may be arranged in a manner and / or order different from that shown in the illustrative drawings. Furthermore, the inclusion of structural or methodological features in a particular figure does not imply that such features are required in all embodiments, and in some embodiments, these features may be omitted or may be combined with other features.

[0271] It should be noted that all units / modules mentioned in the device embodiments of this application are logical units / modules. Physically, a logical unit / module can be a physical unit / module, a part of a physical unit / module, or a combination of multiple physical units / modules. The physical implementation of these logical units / modules themselves is not the most important factor; the combination of functions implemented by these logical units / modules is the key to solving the technical problems proposed in this application. Furthermore, to highlight the innovative aspects of this application, the above-described device embodiments of this application have not introduced units / modules that are not closely related to solving the technical problems proposed in this application. This does not mean that the above-described device embodiments do not contain other units / modules.

[0272] It should be noted that in the examples and description of this patent, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one" does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0273] Although this application has been illustrated and described with reference to certain preferred embodiments thereof, those skilled in the art should understand that various changes in form and detail may be made thereto without departing from the spirit and scope of this application.

Claims

1. A file mounting method, applied to electronic devices, characterized in that, include: An instruction was detected to mount files from at least one folder to the target folder using a stacked file system; It was determined that the file systems of at least one of the folders were case-insensitive file systems; If the attributes of the first type of operands corresponding to each folder in the at least one folder are all invalid, the files in the at least one folder are mounted to the target folder. If the attributes of the first type of operands of the folder are valid, it indicates that the folder is an automatically mounted folder or can be mounted through the stacked file system. If at least one of the first type of operands in the at least one folder is valid, the at least one folder will not be mounted.

2. The method according to claim 1, characterized in that, The file systems of at least one folder are determined to be case-insensitive file systems by the following method: Obtain the reference index identifier for each file in the at least one folder; Obtain the first index identifier corresponding to the filename of each file in the at least one folder after all the filenames are uppercase, and the second index identifier corresponding to the filename of each file in the at least one folder after all the filenames are lowercase; When the reference index identifier of each file in the at least one folder is the same as the corresponding first index identifier and the corresponding second index identifier, it is determined that the file system of the at least one folder is a case-insensitive file system.

3. The method according to claim 1, characterized in that, The method further includes: It is determined that at least one folder contains a folder with a case-sensitive file system. For each of the at least one folders, the attributes of the first type of operand and the second type of operand are both invalid. The files in the at least one folder are mounted to the target folder. When the attribute of the second type of operand of the folder is valid, the file system of the folder is instructed to define a function to add directory entries to a hash table or a function to compare whether the file systems of two directory entries are the same. If the attribute of at least one first-type operand or at least one second-type operand of the at least one folder is valid, the at least one folder will not be mounted.

4. The method according to any one of claims 1 to 3, characterized in that, When the electronic device receives an access request for the at least one folder, it detects an instruction to mount the files in the at least one folder to the target folder using the stacked file system.

5. The method according to claim 4, characterized in that, The method further includes: After mounting the files in the at least one folder to the target folder, the access request is responded to through the target folder.

6. The method according to claim 5, characterized in that, The step of responding to the access request through the target folder includes: When the access request includes deleting at least one first file in each of the at least one folders, each of the first files in the target folder is deleted; Alternatively, if the access request includes adding at least one second file to the at least one folder, each of the second files will be added to the target folder; Alternatively, when the access request includes replacing at least one third file in the at least one folder with the corresponding fourth file, each of the third files in the target folder shall be replaced with the corresponding fourth file.

7. The method according to any one of claims 1 to 3, characterized in that, The operating system of the electronic device is a Linux operating system or a Linux-based operating system, wherein the Linux-based operating system includes any one of the following operating systems: Android. TM HarmonyOS TM Ubuntu, Community Enterprise Operating System, Red Hat Linux, Color OS, and Kylin OS.

8. The method according to claim 7, characterized in that, The first type of operands includes at least one of the following operands: DCACHE_NEED_AUTOMOUT and DCACHE_MANAGE_TRANSIT.

9. The method according to claim 3, characterized in that, The second type of operands includes at least one of the following operands: DCACHE_OP_HASH and DCACHE_OP_COMPARE.

10. A readable storage medium, characterized in that, The readable storage medium stores instructions that, when executed on an electronic device, cause the electronic device to implement the file mounting method of any one of claims 1 to 9.

11. An electronic device, characterized in that, include: Memory is used to store instructions executed by one or more processors of an electronic device; And a processor, one of the processors of the electronic device, for executing the instructions stored in the memory to implement the file mounting method of any one of claims 1 to 9.

12. A computer program product, characterized in that, The computer program product includes instructions that, when executed on an electronic device, cause the electronic device to implement the file mounting method of any one of claims 1 to 9.