CN111708732A - File reading and writing method, intelligent terminal and storage medium - Google Patents

File reading and writing method, intelligent terminal and storage medium Download PDF

Info

Publication number
CN111708732A
CN111708732A CN202010377359.6A CN202010377359A CN111708732A CN 111708732 A CN111708732 A CN 111708732A CN 202010377359 A CN202010377359 A CN 202010377359A CN 111708732 A CN111708732 A CN 111708732A
Authority
CN
China
Prior art keywords
file
layer
user
writing
reading
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010377359.6A
Other languages
Chinese (zh)
Inventor
向卫东
孟庆晓
吴闽华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Genew Technologies Co Ltd
Original Assignee
Shenzhen Genew Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Genew Technologies Co Ltd filed Critical Shenzhen Genew Technologies Co Ltd
Priority to CN202010377359.6A priority Critical patent/CN111708732A/en
Publication of CN111708732A publication Critical patent/CN111708732A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/13File access structures, e.g. distributed indices
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/14Details of searching files based on file metadata
    • G06F16/148File search processing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/172Caching, prefetching or hoarding of files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6218Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database

Abstract

The invention discloses a file reading and writing method, an intelligent terminal and a storage medium, wherein the method comprises the following steps: generating a mirror image layer for all files in the multi-user operating system; when a new user is added in the multi-user operating system, a write-in layer is newly built for the new user; when detecting that a user reads the first file, searching the first file in the writing layer, if the writing layer is found, reading the first file of the writing layer, otherwise, searching and reading the first file in the mirror image layer; and when the second file is not existed in the writing layer, the second file is created and written in the writing layer. In the invention, each user has an independent write-in layer, so that files of different users are isolated, the security of the files is ensured, the users share the same mirror image layer, the same files of each user are stored, and the same files are not required to be copied and stored by each user, so that the storage space is saved.

Description

File reading and writing method, intelligent terminal and storage medium
Technical Field
The invention relates to the technical field of computer application, in particular to a file reading and writing method, an intelligent terminal and a storage medium.
Background
Operating systems can be divided into single-user operating systems and multi-user operating systems, depending on how many users of the computer are used at the same time. A single-user operating system is a computer that can be used by only one user at a time, and one user can enjoy all hardware and software resources of the system independently, while if multiple users are allowed to use the computer at the same time, the system is called a multi-user operating system, that is, the same machine can establish respective accounts for multiple users, and also allow users who have the accounts to log in the computer at the same time.
In a multi-user operating system, files of all users are stored in the same file system, the confidentiality and the read-write security of the files of all users are very difficult to control, appropriate authority needs to be set for each file, and appropriate user reading and rewriting are allowed or prohibited, for example, a file which is exclusively shared by one user needs to be set to only allow the user to access, and other users are prohibited to access; a file common to all users needs to be set accessible to all users.
In the prior art, a method for solving complex file authority control is that each user independently occupies a file system, and one user cannot access the file systems of other users, so that the problem of complex authority control of files is avoided.
Accordingly, the prior art is yet to be improved and developed.
Disclosure of Invention
The invention mainly aims to provide a file reading and writing method, an intelligent terminal and a storage medium, and aims to solve the problems that in the prior art, users monopolize a file system, and each user needs to copy the same files, so that a large amount of storage space is wasted.
In order to achieve the above object, the present invention provides a file reading and writing method, including the following steps:
after the multi-user operating system is installed, generating a mirror image layer for all files in the multi-user operating system;
when a new user is added in the multi-user operating system, a write-in layer is newly built for the new user;
when detecting that a user reads the first file, searching the first file in the writing layer, if the writing layer is found, reading the first file of the writing layer, otherwise, searching and reading the first file in the mirror image layer;
and when the second file is not existed in the writing layer, the second file is created and written in the writing layer.
Optionally, in the method for reading and writing a file, when a new user is not added to the multi-user operating system, files existing in the multi-user operating system are the same file for the new user.
Optionally, in the file reading and writing method, the mirror layer is used to store files that are the same as the user.
Optionally, in the file reading and writing method, all users in the multi-user operating system share and read the same mirror image layer, and the mirror image layer can only read files but cannot rewrite files.
Optionally, in the file reading and writing method, there is no file in the newly created write layer.
Optionally, in the file reading and writing method, a corresponding write layer is newly created for each user in the multi-user operating system, and each user corresponds to an independent write layer.
Optionally, in the file reading and writing method, the write layer is used to store a file rewritten by a user, and the user cannot access the write layer of another user.
Optionally, the method for reading and writing a file, wherein the creating and writing a second file in a write layer further includes:
and after the created writing layer writes the second file, the second file of the writing layer replaces the second file of the mirror image layer.
In addition, to achieve the above object, the present invention further provides an intelligent terminal, wherein the intelligent terminal includes: the file reading and writing method comprises a memory, a processor and a file reading and writing program which is stored on the memory and can run on the processor, wherein the file reading and writing program realizes the steps of the file reading and writing method when being executed by the processor.
In addition, in order to achieve the above object, the present invention further provides a storage medium, wherein the storage medium stores a file reading and writing program, and the file reading and writing program implements the steps of the file reading and writing method when executed by a processor.
In the invention, after the multi-user operating system is installed, all files in the multi-user operating system are generated into a mirror image layer; when a new user is added in the multi-user operating system, a write-in layer is newly built for the new user; when detecting that a user reads the first file, searching the first file in the writing layer, if the writing layer is found, reading the first file of the writing layer, otherwise, searching and reading the first file in the mirror image layer; and when the second file is not existed in the writing layer, the second file is created and written in the writing layer. In the invention, each user has an independent write-in layer, so that files of different users are isolated, the security of the files is ensured, the users share the same mirror image layer, the same files of each user are stored, and the same files are not required to be copied and stored by each user, so that the storage space is saved.
Drawings
FIG. 1 is a flow chart of a preferred embodiment of a method for reading and writing a document according to the present invention;
FIG. 2 is a schematic diagram of an operating environment of an intelligent terminal according to a preferred embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer and clearer, the present invention is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
As shown in fig. 1, the file reading and writing method according to the preferred embodiment of the present invention includes the following steps:
and step S10, after the multi-user operating system is installed, generating a mirror image layer for all files in the multi-user operating system.
Specifically, when a new user is not added to the multi-user operating system, files existing in the multi-user operating system are the same file for the new user. Therefore, after the multi-user operating system is installed, all files in the multi-user operating system are generated into a mirror layer, that is, the mirror layer is used for storing the same files of the user. All users in the multi-user operating system share and read the same mirror image layer, and the mirror image layer can only read files but cannot rewrite the files.
And step S20, when a new user is added in the multi-user operating system, a new write-in layer is created for the new user.
Specifically, there is no file in the write layer that has just started to be newly created. When a new user is added (a plurality of new users can be added) in the multi-user operating system, a new writing layer is created for the new user. Each user in the multi-user operating system is newly built with a corresponding write-in layer, and each user corresponds to an independent write-in layer. The writing layer is used for storing the files rewritten by the user, and the user cannot access the writing layers of other users.
The files of a plurality of users can be divided into two types, one type is the same file, and the other type is different files of each user. The invention is divided into a mirror image layer and a write-in layer, and the write-in layer exclusive to each user and the shared mirror image layer jointly form a file system of one user.
Step S30, when it is detected that the user reads the first file, searching the first file in the write-in layer, if the write-in layer is found, reading the first file in the write-in layer, otherwise, searching and reading the first file in the mirror image layer.
Specifically, when it is detected that a user needs to read the first file, the first file is searched in the write-in layer corresponding to the user, if the write-in layer corresponding to the user is found, the first file of the write-in layer is read, otherwise, the first file is searched and read in the mirror image layer.
For example, when a user reads a file a, the user first goes to the write layer (the write layer may have the file a or may not have the file a at this time) to search for the file a, and if the write layer has the file a, the file a of the write layer is read; otherwise, the image layer is removed to search and read the file A.
Further, for example, if the user U wants to rewrite the file a of the mirror layer, the file a is rewritten on the write layer of the user U (the file a is created and rewritten when the file a does not exist), so that it means that the file a of the user U is found as long as the write layer of the user U has the file a, and it is not necessary to find the mirror layer any more, and only when the write layer of the user U does not find the file a, the mirror layer is found.
And step S40, when the second file is detected to be rewritten by the user, directly rewriting the second file in the writing layer, and when the second file does not exist in the writing layer, creating and writing the second file in the writing layer.
Specifically, when it is detected that the user rewrites the second file, the second file is directly rewritten on a writing layer corresponding to the user, and when the second file does not exist on the writing layer, the second file is created and written on the writing layer; and after the created write layer writes the second file, the second file of the write layer replaces the second file of the mirror layer.
For example, when a user rewrites a file B, the file B is directly rewritten in the write layer, and even if the write layer does not have the file B and the mirror layer has the file B, the file B is created and written in the write layer, and the file B written in the write layer is replaced with the file B in the mirror layer.
Because the mirror layer is shared and read, if a certain user A can rewrite the file F of the mirror layer, the file F seen by other users B is changed (the user B does not want to rewrite the file F), and if the user A rewrites the file F of the mirror layer, the file F is rewritten in the writing layer of the user A (the file F is created and rewritten when the file F does not exist).
The following illustrates the meaning of the same document and different documents:
write layers for user U1, user U2, and shared mirror layers:
write layer for user U1: a file 5;
write layer for user U2: file 3(1.1), file 4;
mirror image layer: file 1, file 2, file 3 (1.0);
the writing layers of the user U1 and the user U2 are empty at the beginning, the mirror layer comprises files 1, 2 and 3(1.0), then the user U2 rewrites the file 3, the rewritten file 3 is called as the file 3(1.1), the user U2 adds the file 4, and the user U1 adds the file 5.
Then, the file seen by user U1 is the write layer + mirror layer of user U1 (File 1, File 2, File 3(1.0), File 5), and the file seen by user U2 is the write layer + mirror layer of user U2 (File 1, File 2, File 3(1.1), File 4).
In the invention, each user has an independent write-in layer, so that files of different users are isolated, the security of the files is ensured, the users share the same mirror image layer, the same files of each user are stored, and the users do not need to copy and store the same files, thereby saving the storage space.
Further, as shown in fig. 2, based on the above file reading and writing method, the present invention also provides an intelligent terminal, which includes a processor 10, a memory 20, and a display 30. Fig. 2 illustrates some of the components of the intelligent terminal, but it is to be understood that not all of the illustrated components are required to be implemented, and that more or fewer components may be implemented instead.
The memory 20 may be an internal storage unit of the intelligent terminal in some embodiments, such as a hard disk or a memory of the intelligent terminal. The memory 20 may also be an external storage device of the Smart terminal in other embodiments, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the Smart terminal. Further, the memory 20 may also include both an internal storage unit and an external storage device of the smart terminal. The memory 20 is used for storing application software installed in the intelligent terminal and various data, such as program codes of the installed intelligent terminal. The memory 20 may also be used to temporarily store data that has been output or is to be output. In an embodiment, the memory 20 stores a file reading/writing program 40, and the file reading/writing program 40 can be executed by the processor 10, so as to implement the file reading/writing method of the present application.
The processor 10 may be a Central Processing Unit (CPU), a microprocessor or other file read/write chip in some embodiments, and is used for running the program codes stored in the memory 20 or Processing data, such as executing the file read/write method.
The display 30 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch panel, or the like in some embodiments. The display 30 is used for displaying information at the intelligent terminal and for displaying a visual user interface. The components 10-30 of the intelligent terminal communicate with each other via a system bus.
In one embodiment, the following steps are implemented when the processor 10 executes the file reading and writing program 40 in the memory 20:
after the multi-user operating system is installed, generating a mirror image layer for all files in the multi-user operating system;
when a new user is added in the multi-user operating system, a write-in layer is newly built for the new user;
when detecting that a user reads the first file, searching the first file in the writing layer, if the writing layer is found, reading the first file of the writing layer, otherwise, searching and reading the first file in the mirror image layer;
and when the second file is not existed in the writing layer, the second file is created and written in the writing layer.
When a new user is not added to the multi-user operating system, files existing in the multi-user operating system are the same file for the new user.
And the mirror image layer is used for storing the same files of the user.
All users in the multi-user operating system share and read the same mirror image layer, and the mirror image layer can only read files but cannot rewrite the files.
Wherein, no file exists in the newly created writing layer.
Each user in the multi-user operating system is newly built with a corresponding write-in layer, and each user corresponds to an independent write-in layer.
The writing layer is used for storing the files rewritten by the user, and the user cannot access the writing layers of other users.
Wherein the creating and writing a second file at the write layer further comprises:
and after the created writing layer writes the second file, the second file of the writing layer replaces the second file of the mirror image layer.
The invention also provides a storage medium, wherein the storage medium stores a file reading and writing program, and the file reading and writing program realizes the steps of the file reading and writing method when being executed by a processor.
In summary, the present invention provides a file reading and writing method, an intelligent terminal and a storage medium, where the method includes: after the multi-user operating system is installed, generating a mirror image layer for all files in the multi-user operating system; when a new user is added in the multi-user operating system, a write-in layer is newly built for the new user; when detecting that a user reads the first file, searching the first file in the writing layer, if the writing layer is found, reading the first file of the writing layer, otherwise, searching and reading the first file in the mirror image layer; and when the second file is not existed in the writing layer, the second file is created and written in the writing layer. In the invention, each user has an independent write-in layer, so that files of different users are isolated, the security of the files is ensured, the users share the same mirror image layer, the same files of each user are stored, and the same files are not required to be copied and stored by each user, so that the storage space is saved.
Of course, it will be understood by those skilled in the art that all or part of the processes of the methods of the above embodiments may be implemented by a computer program instructing relevant hardware (such as a processor, a controller, etc.), and the program may be stored in a computer readable storage medium, and when executed, the program may include the processes of the above method embodiments. The storage medium may be a memory, a magnetic disk, an optical disk, etc.
It is to be understood that the invention is not limited to the examples described above, but that modifications and variations may be effected thereto by those of ordinary skill in the art in light of the foregoing description, and that all such modifications and variations are intended to be within the scope of the invention as defined by the appended claims.

Claims (10)

1. A file reading and writing method is characterized by comprising the following steps:
after the multi-user operating system is installed, generating a mirror image layer for all files in the multi-user operating system;
when a new user is added in the multi-user operating system, a write-in layer is newly built for the new user;
when detecting that a user reads the first file, searching the first file in the writing layer, if the writing layer is found, reading the first file of the writing layer, otherwise, searching and reading the first file in the mirror image layer;
and when the second file is not existed in the writing layer, the second file is created and written in the writing layer.
2. The method according to claim 1, wherein when no new user is added to the multi-user operating system, the files existing in the multi-user operating system are the same file for the new user.
3. The method according to claim 2, wherein the mirror layer is configured to store files that are identical to each other.
4. The method according to claim 3, wherein all users in the multi-user operating system share and read the same mirror layer, and the mirror layer can only read and cannot rewrite the file.
5. A method for reading from and writing to files according to claim 1, wherein there are no files in the newly created write layer.
6. The method according to claim 5, wherein each user in the multi-user operating system has a new write layer, and each user has an independent write layer.
7. The method according to claim 6, wherein said write layer is used to store the file written by the user, and the user cannot access the write layer of other users.
8. The method for reading from and writing to a file according to claim 1, wherein the creating and writing to the second file at the write layer further comprises:
and after the created writing layer writes the second file, the second file of the writing layer replaces the second file of the mirror image layer.
9. An intelligent terminal, characterized in that, intelligent terminal includes: memory, processor and file reading and writing program stored on said memory and executable on said processor, said file reading and writing program when executed by said processor implementing the steps of the file reading and writing method according to any of claims 1 to 8.
10. A storage medium, characterized in that the storage medium stores a file reading and writing program, which when executed by a processor implements the steps of the file reading and writing method according to any one of claims 1 to 8.
CN202010377359.6A 2020-05-07 2020-05-07 File reading and writing method, intelligent terminal and storage medium Pending CN111708732A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010377359.6A CN111708732A (en) 2020-05-07 2020-05-07 File reading and writing method, intelligent terminal and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010377359.6A CN111708732A (en) 2020-05-07 2020-05-07 File reading and writing method, intelligent terminal and storage medium

Publications (1)

Publication Number Publication Date
CN111708732A true CN111708732A (en) 2020-09-25

Family

ID=72536806

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010377359.6A Pending CN111708732A (en) 2020-05-07 2020-05-07 File reading and writing method, intelligent terminal and storage medium

Country Status (1)

Country Link
CN (1) CN111708732A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102609448A (en) * 2012-01-10 2012-07-25 西北工业大学 Multi-user-version hierarchical document mapping method
US20160156631A1 (en) * 2013-01-29 2016-06-02 Kapaleeswaran VISWANATHAN Methods and systems for shared file storage
CN105808240A (en) * 2016-03-01 2016-07-27 北京量邦信息科技股份有限公司 Method for realizing user isolation under online programming environment
CN109684822A (en) * 2018-12-30 2019-04-26 深圳开立生物医疗科技股份有限公司 Multi-user access environment configurations method, apparatus, equipment and multi-line system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102609448A (en) * 2012-01-10 2012-07-25 西北工业大学 Multi-user-version hierarchical document mapping method
US20160156631A1 (en) * 2013-01-29 2016-06-02 Kapaleeswaran VISWANATHAN Methods and systems for shared file storage
CN105808240A (en) * 2016-03-01 2016-07-27 北京量邦信息科技股份有限公司 Method for realizing user isolation under online programming environment
CN109684822A (en) * 2018-12-30 2019-04-26 深圳开立生物医疗科技股份有限公司 Multi-user access environment configurations method, apparatus, equipment and multi-line system

Similar Documents

Publication Publication Date Title
CN100514280C (en) Attachable/detachable device and programs start method
CN101650660B (en) Booting a computer system from central storage
US8806514B2 (en) Data control device, data control method, and computer-readable medium
CN100570601C (en) Switch the method and the computer system of the file that will visit based on confidential mode
US9524122B2 (en) Metadata storage in unused portions of a virtual disk file
CN104238963A (en) Data storage method, device and system
CN101430700B (en) File management device and storage device
CN104021145A (en) Mixed service concurrent access method and device
CN111989656A (en) Configurable recovery state
CN100447765C (en) Mapping method for mobile memory device
CN102804137B (en) Controlling access to software component state
CN111078279B (en) Method, device, equipment and storage medium for processing byte code file
CN105787392A (en) Data reading and writing control method and control device
CN112905962B (en) Method for protecting program codes in MCU, intelligent terminal and storage medium
US20120179885A1 (en) Write control system
KR20120082176A (en) Data processing method of database management system and system thereof
US8990526B2 (en) Merging data volumes and derivative versions of the data volumes
CN111708732A (en) File reading and writing method, intelligent terminal and storage medium
US20150039615A1 (en) Pos device
CN110489060A (en) A kind of mixed file construction method and its system based on FUSE technology
US9235349B2 (en) Data duplication system, data duplication method, and program thereof
CN113885948B (en) Management method and device for windows mirror image layering
CN111868698A (en) Free space direct connection
US10331381B2 (en) Method and device for recording memory access operation information
CN111563006B (en) Data processing method, intelligent terminal and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20200925

RJ01 Rejection of invention patent application after publication