System-based multi-directory construction method, device and electronic equipment
Patent Information
- Application Number
- CN202211733060.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-30
- Publication Date
- 2026-10-16
- Estimated Expiration
- 2042-12-30
AI Technical Summary
[0002]随着科技的发展,linux操作系统应用于各计算机中,在linux操作系统中常用的核心文件及用户自定义安装的应用文件都是交织的组合存放在一起,此时,常用的核心文件及用户自定义安装的应用文件混杂在一起,并处于同一目录中,在系统进行升级时,该目录的文件容易同步对常用的核心文件及用户自定义安装的应用文件进行升级,导致同一目录的文件均受到破坏
[0050] The present invention provides a system-based multi-directory construction method, apparatus, and electronic device that can separate different files by the independence between the first directory and the second directory, and set permissions for the second directory after the files are loaded in the second directory to protect the files in the second directory. This helps to avoid damage to files in the same directory caused by human operation or system updates.
Smart Images

Figure CN116431227B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer system technology, and in particular to a method, apparatus and electronic device for constructing a system-based multi-directory system. Background Technology
[0002] With the development of technology, the Linux operating system has been applied to various computers. In the Linux operating system, commonly used core files and user-defined application files are intertwined and stored together. At this time, the commonly used core files and user-defined application files are mixed together and located in the same directory. When the system is upgraded, the files in this directory are prone to be upgraded simultaneously with the commonly used core files and user-defined application files, resulting in the corruption of files in the same directory. Summary of the Invention
[0003] In view of this, embodiments of the present invention provide a method, apparatus and electronic device for constructing multiple directories based on a system, which facilitates the prevention of damage to files in the same directory during human operation or system upgrade.
[0004] In a first aspect, embodiments of the present invention provide a system-based multi-directory construction method, comprising:
[0005] Obtain the first directory, which is a regular system directory;
[0006] A second directory is constructed based on the system, wherein the second directory is independent of the first directory;
[0007] Load the corresponding file in the second directory;
[0008] After the files in the second directory are loaded, permissions are set for the second directory to protect the files located there.
[0009] The system containing the first and second directories is imaged, and the imaged system is loaded onto the target machine.
[0010] According to a specific implementation of an embodiment of the present invention, obtaining the first directory, wherein the first directory is a system regular directory, includes:
[0011] Load system regular files into the first directory, where the first directory is a system regular directory;
[0012] After loading the system's regular files into the first directory, maintain the open permissions of the first directory;
[0013] Based on the open permissions of the first directory, process the system's regular files located in the first directory.
[0014] According to a specific implementation of an embodiment of the present invention, the step of constructing a second directory based on the system, wherein the second directory is independent of the first directory, includes:
[0015] The system builds a second directory, at which point the second directory is separated from the first directory;
[0016] The second directory is independent of the first directory, wherein the second directory is at least one of the system core directory and the user data directory.
[0017] According to a specific implementation of an embodiment of the present invention, after the files in the second directory are loaded, setting permissions for the second directory to protect the files in the second directory includes:
[0018] When the second directory is the system core directory, the system's core files are loaded into the second directory;
[0019] After the system's core files are loaded into the second directory, permissions are set for the second directory to protect the system's core files located there.
[0020] The core files and regular system files of the system are separated based on the second directory and the first directory.
[0021] According to a specific implementation of an embodiment of the present invention, after the files are loaded into the second directory, setting permissions for the second directory to protect the files in the second directory further includes:
[0022] The second directory is partitioned into a core system area and a user area;
[0023] The core system area and the user area are independent of each other, and are associated based on the core system area and the user area;
[0024] User regions are mapped to the corresponding core system regions.
[0025] According to a specific implementation of an embodiment of the present invention, after the files in the second directory are loaded, setting permissions for the second directory to protect the files in the second directory includes:
[0026] When the second directory is the user data directory, the user's data files are loaded into the second directory;
[0027] After loading the user's data files into the second directory, permissions are set for the second directory to protect the user's data files located there.
[0028] Based on the second directory and the first directory, user data files and system regular files are separated.
[0029] Secondly, embodiments of the present invention provide a system-based multi-directory construction apparatus, comprising:
[0030] The acquisition module is used to acquire the first directory, which is a regular system directory;
[0031] A building module is used to build a second directory based on the system, wherein the second directory is independent of the first directory;
[0032] The loading module is used to load the corresponding files in the second directory;
[0033] The permissions module is used to set permissions 5 for the second directory after the files in the second directory have been loaded, so as to protect the files in the second directory;
[0034] The image module is used to image a system containing a first directory and a second directory, and then load the imaged system onto the target machine.
[0035] According to a specific implementation of an embodiment of the present invention, the acquisition module is further configured to load system regular files into the first directory, wherein the first directory is a system regular directory; after the system regular files are loaded into the first directory, the open permissions of the first directory are maintained;
[0036] Based on the open permissions of the first directory, process the system's regular files located in the first directory.
[0037] According to a specific implementation of an embodiment of the present invention, the construction module is further configured to load system regular files into the first directory, wherein the first directory is a system regular directory;
[0038] After loading all the system's regular files in the first directory, maintain the open permissions of the first directory; 5. Process the system's regular files in the first directory based on the open permissions of the first directory.
[0039] According to a specific implementation of an embodiment of the present invention, the permission module is further configured to load the system's core files into the second directory when the second directory is the system's core directory;
[0040] After the system's core files are loaded into the second directory, permissions are set for the second directory to protect the system's core files located there.
[0041] 0. Based on the separation of the system's core files and regular system files in the second directory and the first directory;
[0042] The second directory is partitioned into a core system area and a user area;
[0043] The core system area and the user area are independent of each other, and are associated based on the core system area and the user area;
[0044] User regions are mapped to the corresponding core system regions.
[0045] 5. According to a specific implementation of an embodiment of the present invention, the permission module is further configured to load user data files into the second directory when the second directory is a user data directory;
[0046] After loading the user's data files into the second directory, permissions are set for the second directory to protect the user's data files located there.
[0047] Based on the second directory and the first directory, user data files and system regular files are separated.
[0048] Thirdly, embodiments of the present invention provide an electronic device, the electronic device comprising: a housing, a processor, a memory, a circuit board, and a power supply circuit, wherein the circuit board is disposed within the space enclosed by the housing, and the processor and the memory are disposed on the circuit board; the power supply circuit is used to supply power to various circuits or devices of the above-mentioned electronic device; the memory is used to store executable program code; the processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, for executing the method described in any of the foregoing implementations.
[0049] Fourthly, embodiments of the present invention also provide an application program that is executed to implement the method described in any embodiment of the present invention.
[0050] The present invention provides a system-based multi-directory construction method, apparatus, and electronic device that can separate different files by the independence between the first directory and the second directory, and set permissions for the second directory after the files are loaded in the second directory to protect the files in the second directory. This helps to avoid damage to files in the same directory caused by human operation or system updates. Attached Figure Description
[0051] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0052] Figure 1 This is a flowchart illustrating the system-based multi-directory construction method in an embodiment of the present invention;
[0053] Figure 2 This is a schematic diagram of the first directory file loading process in the system-based multi-directory construction method of this invention embodiment;
[0054] Figure 3 This is a schematic diagram of the process of constructing the second directory in the system-based multi-directory construction method of this invention embodiment;
[0055] Figure 4 This is a schematic diagram of the first and second directories in the system-based multi-directory construction method of this invention embodiment;
[0056] Figure 5 This is a schematic diagram of the device composition of the system-based multi-directory construction device in an embodiment of the present invention;
[0057] Figure 6 This is a hardware diagram of an electronic device according to an exemplary embodiment. Detailed Implementation
[0058] The embodiments of the present invention will now be described in detail with reference to the accompanying drawings. It should be understood that the described embodiments are merely some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.
[0059] This embodiment provides a system-based method for constructing multiple directories, which solves the problem that existing manual operations or system updates can easily cause files in the same directory to be corrupted.
[0060] Figure 1 This is a flowchart illustrating the system-based multi-directory construction method according to Embodiment 1 of the present invention, as shown below. Figure 1 As shown, this embodiment of the invention provides a method for constructing multiple directories based on a system, the method comprising:
[0061] S11. Obtain the first directory, which is a regular system directory;
[0062] S12. Construct a second directory based on the system, wherein the second directory is independent of the first directory;
[0063] S13. Load the corresponding file in the second directory;
[0064] S14. After loading the files in the second directory, set permissions for the second directory to protect the files in the second directory;
[0065] S15. Mirror the system containing the first directory and the second directory, and load the mirrored system onto the target machine.
[0066] This embodiment is applied to a Linux operating system, separating different directories to store different types of files. By establishing independence between the first and second directories, different files are separated. After files are loaded into the second directory, permissions are set to protect those files. This helps prevent data corruption caused by human error or system updates. Furthermore, it facilitates the separation and categorization of different files, improving their identification.
[0067] The following is combined Figure 2 and Figure 3 This invention provides a detailed description of a system-based multi-directory construction method according to an embodiment of the present invention, the method comprising:
[0068] S11. Obtain the first directory, which is a regular system directory;
[0069] The first directory is the system's default directory, which is a system regular directory for storing corresponding system regular files. In this case, the first directory corresponds to the system regular files.
[0070] S111. Load system regular files into the first directory, wherein the first directory is a system regular directory;
[0071] S112. After loading the system's regular files into the first directory, maintain the open permissions of the first directory;
[0072] S113. Process the system's regular files located in the first directory based on the open permissions of the first directory.
[0073] Specifically, the system's regular files are loaded into the first directory and stored there. Since the first directory is an operable directory and stores the system's regular files, it is necessary to maintain the open permissions of the first directory. Furthermore, it is necessary to enable human and system operations on the system's regular files under the open permissions of the first directory. Therefore, the system's regular files in the first directory are processed based on the open permissions of the first directory.
[0074] S12. Construct a second directory based on the system, wherein the second directory is independent of the first directory;
[0075] The system constructs a second directory, which is a newly added directory and is also a separate directory from the first directory. The second directory is independent of the first directory. Since the storage files in the first directory and the storage files in the second directory are different, it is convenient to classify different files based on the design of the first and second directories, and to separate different files through the independence between the first and second directories.
[0076] S121. Based on the system, a second directory is constructed. At this point, the second directory is separated from the first directory.
[0077] Specifically, a second directory is constructed based on the system. The second directory is obtained by separating the first directory, and the second directory and the first directory maintain independence so that the files stored in the second directory are independent of each other, ensuring that different files are independent of each other under the same category.
[0078] S122. The second directory is independent of the first directory, wherein the second directory is at least one of the system core directory and the user data directory.
[0079] S13. Load the corresponding file in the second directory;
[0080] At this time, the second directory is independent of the first directory. There are many types of second directories, including at least one of the system core directory and user data directory.
[0081] When the second directory is the system core directory, the second directory stores the system core files; when the second directory is the user data directory, the second directory stores the user data files.
[0082] S14. After loading the files in the second directory, set permissions for the second directory to protect the files in the second directory;
[0083] Specifically, when the second directory is the system core directory, the system's core files are loaded into the second directory; after the system's core files are loaded into the second directory, permissions are set for the second directory to protect the system's core files located in the second directory; and the system's core files and regular system files are separated based on the second directory and the first directory.
[0084] At this point, this solution adds a second directory under the first directory structure, places the core files of the Linux operating system in the second directory, sets the second directory to read-only permissions, and sets the relevant environment variables, adding the second directory to the environment variables. This decouples and separates the core files of the system from the regular system files. For upper-level users, this is completely imperceptible, thus solving the problem of the core files of the system being potentially corrupted.
[0085] In addition, when a user uninstalls data, files in the second directory will not be uninstalled. This method solves the instability problem of the Linux system caused by user misoperation, thereby increasing the stability of the operating system.
[0086] When the system is upgraded, simply updating the second directory will easily complete the system upgrade process.
[0087] Specifically, the steps for creating the new directory structure are as follows:
[0088] When you begin creating a new system, first create a secondary directory;
[0089] Compare and select the core system packages, and then install these core packages into the second directory;
[0090] Create standard legacy directories and install non-core packages into these legacy directories;
[0091] Add the files in the second directory to the environment variables;
[0092] Add read-only permissions to the second directory;
[0093] Package and build a new system image from the system with the second directory structure that was created.
[0094] Install the new system on the target machine.
[0095] In addition, the second directory is partitioned to form a core system area and a user area; the core system area and the user area are independent of each other and are associated based on the core system area and the user area; the user area is mapped to the corresponding core system area.
[0096] At this point, the second directory is divided into regions, forming a core system region and a user region. The core system region corresponds to the storage system's core files, and the user region corresponds to the storage of user data files. Different categories are also made within the second directory to facilitate the identification of different files within the same directory. In addition, the core system region and the user region are associated; the user region is mapped to the corresponding core system region.
[0097] In another embodiment, when the second directory is a user data directory, the user's data file is loaded into the second directory; after the user's data file is loaded into the second directory, permissions are set for the second directory to protect the user's data file in the second directory; the user's data file and the system's regular files are separated based on the second directory and the first directory.
[0098] At this point, this solution adds a second directory under the first directory structure, places the core system files of the Linux operating system in the second directory, sets the second directory to read-only permissions, and sets the relevant environment variables, adding the second directory to the environment variables. This decouples and separates user data files from regular system files, allowing upper-level users to flexibly copy user data.
[0099] S15. Mirror the system containing the first directory and the second directory, and load the mirrored system onto the target machine;
[0100] At this point, the system containing the first directory and the second directory is mirrored to facilitate the backup of the system containing the first directory and the second directory. The mirrored system is then loaded onto the target machine, thereby transferring the mirrored system to the target machine and ensuring the transfer of the system.
[0101] like Figure 4 As shown, this embodiment of the invention also provides a system-based multi-directory building apparatus, the apparatus comprising:
[0102] Module 21 is used to obtain the first directory, which is a regular system directory;
[0103] Module 22 is used to build a second directory based on the system, wherein the second directory is independent of the first directory;
[0104] Loading module 23 is used to load the corresponding file in the second directory;
[0105] The permission module 24 is used to set permissions for the second directory after the files in the second directory have been loaded, so as to protect the files in the second directory;
[0106] The image module 25 is used to image a system containing a first directory and a second directory, and load the imaged system onto the target machine.
[0107] The system-based multi-directory construction device provided in this embodiment of the invention has a functional structure that corresponds to the system-based multi-directory construction method provided in this embodiment of the invention, and will not be described again here.
[0108] Optionally, the acquisition module is further configured to load system regular files into the first directory, wherein the first directory is a system regular directory;
[0109] After loading the system's regular files into the first directory, maintain the open permissions of the first directory;
[0110] Based on the open permissions of the first directory, process the system's regular files located in the first directory.
[0111] Optionally, the building module is further configured to load system regular files into the first directory, wherein the first directory is a system regular directory;
[0112] After loading the system's regular files into the first directory, maintain the open permissions of the first directory;
[0113] Based on the open permissions of the first directory, process the system's regular files located in the first directory.
[0114] Optionally, the permission module is further configured to load the system's core files into the second directory when the second directory is the system's core directory;
[0115] After the system's core files are loaded into the second directory, permissions are set for the second directory to protect the system's core files located there.
[0116] Based on the separation of the second directory and the first directory, the core files and regular system files of the system are separated;
[0117] The second directory is partitioned into a core system area and a user area;
[0118] The core system area and the user area are independent of each other, and are associated based on the core system area and the user area;
[0119] User regions are mapped to the corresponding core system regions.
[0120] Optionally, the permission module is further configured to load user data files into the second directory when the second directory is a user data directory;
[0121] After loading the user's data files into the second directory, permissions are set for the second directory to protect the user's data files located there.
[0122] Based on the second directory and the first directory, user data files and system regular files are separated.
[0123] Figure 5This is a schematic diagram of the structure of an embodiment of the electronic device of the present invention, which implements the present invention. Figure 1-3 The process of the illustrated embodiment is as follows: Figure 4 As shown, the aforementioned electronic device includes: a housing 41, a processor 42, a memory 43, a circuit board 44, and a power supply circuit 45. The circuit board 44 is disposed inside the space enclosed by the housing 41, and the processor 42 and the memory 43 are disposed on the circuit board 44. The power supply circuit 45 is used to supply power to various circuits or devices of the aforementioned electronic device. The memory 43 is used to store executable program code. The processor 42 runs a program corresponding to the executable program code by reading the executable program code stored in the memory 43, for executing the system-based multi-directory construction method described in any of the foregoing embodiments.
[0124] For details on the specific execution process of the above steps by processor 42, and the steps further executed by processor 42 through running executable program code, please refer to the present invention. Figure 1-3 The description of the illustrated embodiments will not be repeated here.
[0125] This electronic device exists in various forms, including but not limited to:
[0126] (1) Mobile communication devices: These devices are characterized by their mobile communication capabilities and primarily aim to provide voice and data communication. These terminals include: smartphones (e.g., iPhones), multimedia phones, feature phones, and low-end phones, etc.
[0127] (2) Ultra-mobile personal computer devices: These devices fall under the category of personal computers, possessing computing and processing capabilities, and generally also have mobile internet access features. These terminals include PDAs, MIDs, and UMPCs, such as the iPad.
[0128] (3) Portable entertainment devices: These devices display and play multimedia content. This category includes audio and video players (such as iPods), handheld game consoles, e-books, as well as smart toys and portable car navigation devices.
[0129] (4) Server: A device that provides computing services. The components of a server include a processor, hard disk, memory, system bus, etc. Servers are similar to general computer architectures, but because they need to provide highly reliable services, they have higher requirements in terms of processing power, stability, reliability, security, scalability, and manageability.
[0130] (5) Other electronic devices with data interaction functions.
[0131] In an exemplary embodiment, a computer-readable storage medium is also provided, which stores one or more programs that can be executed by one or more processors to implement the aforementioned system-based multi-directory construction method. For example, the computer-readable storage medium is a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.
[0132] In addition, embodiments of the present invention also provide an application program that is executed to implement the methods provided in any embodiment of the present invention.
[0133] It should be noted that, in this document, relational terms such as "first" and "second" are used only 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.
[0134] The various embodiments in this specification are described in a related manner. The same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on describing the differences from other embodiments.
[0135] In particular, the device embodiment is basically similar to the method embodiment, so the description is relatively simple. For relevant details, please refer to the description of the method embodiment.
[0136] For ease of description, the above apparatus is described by dividing it into various functional units / modules. Of course, in implementing this invention, the functions of each unit / module are implemented in one or more software and / or hardware.
[0137] Those skilled in the art will understand that implementing all or part of the processes in the above embodiments is accomplished by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.
[0138] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A system-based multi-directory construction method, characterized in that, include: Obtain the first directory, which is a regular system directory; A second directory is constructed based on the system, wherein the second directory is independent of the first directory; Load the corresponding file in the second directory; After the files in the second directory are loaded, permissions are set for the second directory to protect the files located there. The system containing the first directory and the second directory is imaged, and the imaged system is loaded onto the target machine; The step of obtaining the first directory, which is a regular system directory, includes: Load system regular files into the first directory, where the first directory is a system regular directory; after loading the system regular files into the first directory, maintain the open permissions of the first directory; process the system regular files in the first directory based on the open permissions of the first directory; The second directory is constructed based on the system, wherein the second directory is independent of the first directory, including: Based on the system, a second directory is constructed. At this point, the second directory is separated from the first directory. The second directory is independent of the first directory. The second directory is at least one of the system core directory and the user data directory. After loading the files into the second directory, setting permissions for the second directory to protect the files there includes: When the second directory is the system core directory, the system's core files are loaded into the second directory; After loading the system's core files into the second directory, the files in the second directory are added to the environment variables, and read-only permissions are set for the second directory to protect the system's core files located in the second directory; the system's core files and regular system files are separated based on the second directory and the first directory.
2. The system-based multi-directory construction method according to claim 1, characterized in that, The step of setting permissions for the second directory after loading the files in the second directory to protect the files in the second directory also includes: The second directory is partitioned into a core system area and a user area; The core system area and the user area are independent of each other, and are associated based on the core system area and the user area; User regions are mapped to the corresponding core system regions.
3. The system-based multi-directory construction method according to claim 1, characterized in that, After loading the files into the second directory, setting permissions for the second directory to protect the files there includes: When the second directory is the user data directory, the user's data files are loaded into the second directory; After loading the user's data files into the second directory, permissions are set for the second directory to protect the user's data files located there. Based on the second directory and the first directory, user data files and system regular files are separated.
4. A system-based multi-directory construction device, characterized in that, include: The acquisition module is used to acquire the first directory, which is a regular system directory; A building module is used to build a second directory based on the system, wherein the second directory is independent of the first directory; The loading module is used to load the corresponding files in the second directory; The permissions module is used to set permissions for the second directory after the files in the second directory have been loaded, so as to protect the files in the second directory; The image module is used to image a system containing a first directory and a second directory, and then load the imaged system onto the target machine. The acquisition module is further configured to load system regular files into the first directory, wherein the first directory is a system regular directory; after loading the system regular files into the first directory, maintain the open permissions of the first directory; and process the system regular files in the first directory based on the open permissions of the first directory. The building module is further used to build a second directory based on the system. At this time, the second directory is separated from the first directory. The second directory is independent of the first directory. The second directory is at least one of the system core directory and the user data directory. The permission module is further configured to load the system's core files into the second directory when the second directory is the system's core directory; after loading the system's core files into the second directory, add the files in the second directory to the environment variables and set read-only permissions for the second directory to protect the system's core files located in the second directory; and separate the system's core files and regular system files based on the second directory and the first directory.
5. The system-based multi-directory construction apparatus according to claim 4, characterized in that, The permission module is also used for: The second directory is partitioned into a core system area and a user area; The core system area and the user area are independent of each other, and are associated based on the core system area and the user area; User regions are mapped to the corresponding core system regions.
6. The system-based multi-directory construction apparatus according to claim 4, characterized in that, The permission module is further configured to load user data files into the second directory when the second directory is a user data directory; After loading the user's data files into the second directory, permissions are set for the second directory to protect the user's data files located there. Based on the second directory and the first directory, user data files and system regular files are separated.
7. An electronic device, characterized in that, The electronic device includes: a housing, a processor, a memory, a circuit board, and a power supply circuit, wherein the circuit board is disposed inside the space enclosed by the housing, and the processor and memory are disposed on the circuit board; the power supply circuit is used to supply power to various circuits or devices of the electronic device; the memory is used to store executable program code; the processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, for executing the system-based multi-directory construction method according to any one of claims 1 to 3.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores one or more programs, which can be executed by one or more processors to implement the system-based multi-directory construction method according to any one of claims 1 to 3.
Citation Information
Patent Citations
Data update system and computer program
CN101632066A
Method and device for isolating private data
CN106778348A