CN117370273A - Read-only file system and creation method thereof - Google Patents

Read-only file system and creation method thereof Download PDF

Info

Publication number
CN117370273A
CN117370273A CN202311424866.0A CN202311424866A CN117370273A CN 117370273 A CN117370273 A CN 117370273A CN 202311424866 A CN202311424866 A CN 202311424866A CN 117370273 A CN117370273 A CN 117370273A
Authority
CN
China
Prior art keywords
file system
read
directory
layer
interval
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
CN202311424866.0A
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.)
Guangzhou Chuangrui Automobile Electric Appliance Co ltd
Original Assignee
Guangzhou Chuangrui Automobile Electric Appliance 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 Guangzhou Chuangrui Automobile Electric Appliance Co ltd filed Critical Guangzhou Chuangrui Automobile Electric Appliance Co ltd
Priority to CN202311424866.0A priority Critical patent/CN117370273A/en
Publication of CN117370273A publication Critical patent/CN117370273A/en
Pending legal-status Critical Current

Links

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/11File system administration, e.g. details of archiving or snapshots
    • G06F16/119Details of migration of file systems
    • 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

Abstract

The invention discloses a read-only file system and a creation method thereof, wherein the system comprises: a file system header layer, a directory surface layer and a data area layer; the file system header layer is used for storing basic information of a target file system, judging whether the file system belongs to the target file system according to the identification code, and judging whether data in the directory surface layer is tampered according to the check code; the directory surface layer is used for storing basic information of all files in the target file system, searching whether the target file exists according to the number of the directory surface layers and the file names in the file system header layer, and reading actual contents of the target file from the data area layer according to the basic information of the target file; the data area layer is used for storing the actual contents of all files in the target file system. By constructing a read-only file system composed of a file system header layer, a directory surface layer and a data area layer, the method can be efficiently and safely applied to a single chip microcomputer type TFT instrument.

Description

Read-only file system and creation method thereof
Technical Field
The present invention relates to the field of file system storage structures, and in particular, to a read-only file system and a method for creating the same.
Background
With the development of computer technology, the storage and transmission of data is increasingly dependent on various storage media, such as hard disks, optical disks, flash memory disks, and the like. Different storage media typically employ different file systems to organize and manage data, such as file systems in the format of FAT (File Allocation Table, chinese name File configuration Table), NTFS (New Technology File System, chinese name New File System), EXT (Extended file system, chinese name extended File System), and the like. The file system refers to a method for logically dividing and organizing data on a storage medium, and determines a storage format, an access mode and a management policy of the data on the storage medium. Different file systems have respective advantages and disadvantages and are suitable for different application scenes. However, if the above-mentioned file system is introduced into a TFT meter (disk) of the single-chip microcomputer type, which is a short term for Thin Film Transistor (thin film transistor) display meter (disk), it is an improved LCD technology, more graphic information can be provided on a smaller screen, and the above-mentioned file system is often too complex and has write and delete characteristics, so that the read-only characteristics of TFT resources (such as UI (user interface) and font files for TFT meter display) are not guaranteed.
There is thus a need for improvements and improvements in the art.
Disclosure of Invention
The invention mainly aims to provide a read-only file system and a creation method thereof, and aims to solve the problems that the safety of the file system used in a single chip microcomputer type TFT instrument is insufficient and high-efficiency transplanting cannot be realized in the prior art.
In order to achieve the above purpose, the invention adopts the following technical scheme:
a read-only type file system comprising:
a file system header layer, a directory surface layer and a data area layer;
the file system header layer is used for storing basic information of a target file system, judging whether the file system belongs to the target file system according to the identification code, and judging whether data in the directory surface layer is tampered according to the check code;
the directory surface layer is used for storing basic information of all files in the target file system, searching whether the target file exists according to the number of the directory surface layers and the file names in the file system header layer, and reading actual contents of the target file from the data area layer according to the basic information of the target file;
the data area layer is used for storing the actual contents of all files in the target file system.
In the read-only file system, only a read interface is provided, and a delete interface and a modify interface are not provided.
In the read-only file system, the file system header layer includes: a first byte interval, a second byte interval, and a third byte interval;
the first byte interval is a storage interval of the identification code and is used for representing the type of the target file system; the second byte interval is a counting interval of the packet number of the directory table and is used for representing the number of files in the target file system; and the third byte interval is a storage interval of a packet check code of the directory surface layer and is used for checking all the directory surface layers in the target file system.
In the read-only file system, the directory surface layer includes a plurality of consecutive directory table units, and each directory table unit includes: a fourth byte interval, a fifth byte interval, and a sixth byte interval;
the fourth byte interval is a storage interval of names of all directories and files in the target file system and is used for storing the names of the directories and files; the fifth byte interval is a counting interval of the offset of the file and is used for storing the offset of the file relative to the starting position of the storage area; the sixth byte interval is a counting interval of the size of the file, and is used for storing the total byte number of the file.
In the read-only file system, the data area layer includes: and the plurality of continuous storage units are used for storing the actual contents of all files and distributing and sequencing according to the initial positions recorded in the directory surface layer.
In the read-only file system, the actual content exists in the form of pages, and the page size is adjusted according to the page size of the storage area.
In the read-only file system, the basic information of the file includes: file name, size, attributes, and location.
In the read-only file system, the basic information of the target file system includes: the version, the identification, the check code and the directory surface layer number of the target file system.
In the read-only file system, the number of the directory surface layers and the number of the data area layers are the same as the number of all files; and the file system header layer, the directory surface layer and the data area layer are sequentially overlapped from top to bottom.
A method of creating a read-only type file system based on the read-only type file system as described above, comprising:
and removing the deleting interface and the writing interface on an interface layer of the file system, and storing the reading interface to generate the read-only file system.
Compared with the prior art, the invention provides a read-only file system and a creation method thereof, wherein the system comprises: a file system header layer, a directory surface layer and a data area layer; the file system header layer is used for storing basic information of a target file system, judging whether the file system belongs to the target file system according to the identification code, and judging whether data in the directory surface layer is tampered according to the check code; the directory surface layer is used for storing basic information of all files in the target file system, searching whether the target file exists according to the number of the directory surface layers and the file names in the file system header layer, and reading actual contents of the target file from the data area layer according to the basic information of the target file; the data area layer is used for storing the actual contents of all files in the target file system. The read-only file system is composed of a file system head layer, a directory surface layer and a data area layer, is only provided with a read interface, is not provided with a deletion interface and a modification interface, can be efficiently and safely applied to a single chip microcomputer type TFT instrument, and realizes efficient transplanting.
Drawings
FIG. 1 is a block diagram of a read-only file system according to a preferred embodiment of the present invention;
FIG. 2 is a diagram illustrating the organization of a storage structure of a read-only file system according to the present invention;
FIG. 3 is a schematic diagram of attributes of a file system header layer, a directory surface layer, and a read data area according to the present invention.
Reference numerals: 10: a file system header layer; 20: a catalog surface layer; 30: a data area layer.
Detailed Description
In order to make the objects, technical solutions and effects of the present invention clearer and more specific, the present invention will be described in further detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
As used herein, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless expressly stated otherwise, as understood by those skilled in the art. It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof. It will be understood that when an element is referred to as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element or intervening elements may also be present. Further, "connected" or "coupled" as used herein may include wirelessly connected or wirelessly coupled. The term "and/or" as used herein includes all or any element and all combination of one or more of the associated listed items.
It will be understood by those skilled in the art that all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs unless defined otherwise. It will be further understood that terms, such as those defined in commonly used dictionaries, should be interpreted as having a meaning that is consistent with their meaning in the context of the prior art and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein.
The invention provides a read-only file system and a creation method thereof. The invention constructs a read-only file system, which consists of three parts, namely a file system head layer (FSH), a directory surface layer (DT) and a data area layer (DA); the read-only file system has a read function, can be suitable for a single chip microcomputer, is implemented in the single chip microcomputer, can realize compatibility and portability of data between different storage media and operating systems, and has the characteristics of simplicity, high efficiency, safety and the like.
The following description of the read-only file system design scheme is given by way of specific exemplary embodiments, and it should be noted that the following embodiments are only for explaining the technical solution of the present invention, and are not limited to the specific embodiments:
referring to fig. 1, the read-only file system provided by the present invention includes:
a file system header layer 10, a directory layer 20, and a data area layer 30.
The file system header layer 10 is configured to store basic information of a target file system, determine whether the target file system is included according to an identification code, and determine whether data in the directory surface layer 20 is tampered according to a check code.
The directory layer 20 is used for storing basic information of all files in the target file system, searching whether the target file exists according to the directory layer and the file name in the file system header layer 10, and reading actual content of the target file from the data area layer 30 according to the basic information of the target file.
The data area layer 30 is used for storing the actual content of all files in the target file system.
Wherein, the basic information of the target file system comprises: version, identification, check code and directory surface layer of the target file system; the basic information of the file includes: file name, size, attribute, and location; the actual content exists in the form of pages, and the page size is adjusted according to the page size of the storage area.
Specifically, the read-only file system is applicable to read-only resource file systems such as UI and word stock of a single chip microcomputer type TFT (Thin Film Transistor ) instrument, namely, applicable to and implemented in a single chip microcomputer. The structure of the read-only file system is then presented as follows:
referring to fig. 2, the storage structure organization chart of the read-only type file system is composed of three parts, namely a file system header layer (FSH) 10, a directory surface layer (DT) 20 and a data area layer (DA) 30.
The file system header layer 10 is configured to store basic information of a target file system, that is, basic information of the read-only file system, and includes: version, identification, check code and directory surface of the read-only type file system. It is determined whether or not it is the target file system by the "identification code", and whether or not the data in the directory surface layer 20 is tampered with by the "check code".
And the directory surface layer 20 is used for storing basic information of all files in the target file system, including: file name, size, attribute and location of the file; the file system header layer 10 stores the number of files (DT packages (DTNs), i.e., the number of packages of the directory table) to the directory surface layer 20, traverses the DT packages (DT packages, i.e., directory surface layer packages, each of which is a fixed size) by the number of files, and then, by comparing whether the middle FN (file name) of the DT packages is the retrieved file name, if there is the same, indicates that the target file exists, and if there is not the same after all traverses, indicates that the target file does not exist, thereby realizing the process of retrieving whether the target file exists or not by the number of directory surface layers and the file name in the file system header layer 10.
The directory surface layer 20 is also capable of reading the actual content of the target file from the data area layer 30 by the size and location in the basic information of the target file.
And the data area layer 30 is used for storing the actual content of all files in the target file system. Wherein the actual content exists in the form of pages, and the page size is adjusted according to the page size of the storage area: the page size of the memory region is related to the memory device implementation, and if the memory device reads a page that is 64 bytes, the data is organized in 64 bytes, but if it is 128 bytes, the data is organized in 128 bytes for saving, the deficient portion fills hexadecimal 0xFF. While organization in page form enables efficient reading.
Further, the read-only file system only has a read interface, and does not have a delete interface and a modify interface.
Specifically, compared with the file systems in the formats of FAT, NTFS, EXT, etc., the read-only file system has a read interface, a write interface, and a delete interface, and the read-only file system has only a read interface, and cannot tamper with and delete content. When the read-only file system is created, codes capable of realizing a deleting function and a writing function are not written, and codes with a reading function are written, so that the read-only file system only has the reading function, the safety of file resources in the read-only file system is greatly improved, and the file resources are prevented from being rewritten or deleted due to the fact that an interface is called by mistake.
Meanwhile, because the read-only file system does not have a writing interface and a deleting interface, the code to be written is simpler when the read-only file system is constructed; and the read function of the file system can be realized on the singlechip without excessive interface judgment and complex driving program, and the read-only file system is more efficient in execution and convenient in transplanting.
Further, the file system header layer 10 includes: a first byte interval, a second byte interval, and a third byte interval;
the first byte interval is a storage interval of the identification code and is used for representing the type of the target file system; the second byte interval is a counting interval of the packet number of the directory table and is used for representing the number of files in the target file system; the third byte section is a storage section of a packet check code of the directory surface layer 20, and is used for checking all the directory surface layers 20 in the target file system. The number of the directory layers 20 and the number of the data area layers 30 are the same as the number of all files, so that one file has one DT and one DA. Ten documents have ten DTs and ten DAs. In fig. 2, the file system header layer 10, the directory layer 20, and the data area layer 30 are stacked one on top of the other.
Specifically, referring to fig. 3, which is a schematic diagram of the attributes of the file system header layer 10, the directory surface layer 20 and the read data area 30, the file system header layer 10 includes the following:
the first 4 bytes (the first byte interval): for File System Identification (FSID), i.e. the first byte section is a storage section of the identification code, for indicating the type of the target file system, a determination is made as to whether it is the target file system by reading these 4 byte ASCII code comparisons. For example: the "ROFS" (Read Only File System, chinese name read-only file system) is used in this application as a file system identification for the read-only type of file system.
5 th-8 th byte (the second byte interval): the number of DT packets is represented by a 32-bit binary number, namely the second byte interval is a counting interval of the packet number of the directory table and is used for representing the number of files contained in the target file system, one directory surface layer 20 represents one file information, and the number of the directory surface layers 20 and the number of the data area layers 30 are the same as the number of all files;
bytes 9-12 (the third byte interval): the check code of all DT packets (ADTC, i.e. the check code of the directory table packet), i.e. the third byte interval is the storage interval of the packet check code of the directory layer 20, is used for checking all DTs of the file system.
Wherein, the verification process is: taking all bytes in the directory skin 20 as input, i.e. dtn×dt as input, wherein DTN is the number of DT packets and DT is the size of one DT packet; the input is then followed by a CRC32 operation (CRC 32 is a cyclic redundancy check algorithm) to obtain a 32-bit output as an ADTC result, which is compared to a check code: if the data are consistent, the data can be judged to be non-damaged or tampered, and the damage or tampering of the data can be prevented by the verification result according to the verification code.
Then, the identification code is firstly used for detecting the identification when the file system is executed, and after the identification is legal, the packet inspection code is used for verifying whether the DT data is tampered.
Further, the table of contents surface layer 20 includes a plurality of consecutive table of contents units, each table of contents unit including: a fourth byte interval, a fifth byte interval, and a sixth byte interval;
the fourth byte interval is a storage interval of names of all directories and files in the target file system and is used for storing the names of the directories and files; the fifth byte interval is a counting interval of the offset of the file and is used for storing the offset of the file relative to the starting position of the storage area; the sixth byte interval is a counting interval of the size of the file, and is used for storing the total byte number of the file.
In particular, the directory skin 20 comprises a number of consecutive DT units, i.e. directory units, denoted directory unit 1-directory unit n in fig. 3, each DT unit comprising: file Name (FN), file Offset (FO) and File Size (FS), then file name 1 (FN 1), file offset 1 (FO 1) and file size 1 (FS 1) are contained in directory table unit 1 (DT 1); the directory skin 20 includes the following:
the first 64 bytes (the fourth byte interval): names (FN) formed by the catalogs and the files, namely, the fourth byte interval is a storage interval of the names of all the catalogs and the files in the target file system and is used for storing the names of the catalogs and the files; such as the file "READM.TXT", in which parts of less than 64 bytes are filled with "\0".
65 th-68 th byte (the fifth byte interval): the fifth byte interval is a count interval of the offset of the file, and is used for storing the offset of the file at the starting position of the relative storage area, and the offset is represented by 32-bit binary numbers.
69-72 bytes (the sixth byte interval): the sixth byte section is a count section of the size of the file, and is used for storing the total byte number of the file, and is represented by 32-bit binary numbers.
Further, the data area layer 30 includes: and a plurality of continuous storage units for storing the actual contents of all files and distributing and sorting the files according to the initial positions recorded in the directory surface layer 20.
Specifically, referring to the attribute schematic diagram of the data area in fig. 3, the DA stores the actual contents of all files, allocates and sorts the files recorded in the DT at the start position of the relative storage area, from Page number 1 to Page number N, that is, page1 to Page N, where page=the size of the file/Page size, and if the size of the file/Page size cannot be divided, page=page+1. For example, if a file records in the DT that is 1024 bytes in size, with a starting offset of page number of 100, and each page defines 64 bytes, the contents of the file will be stored in pages 100-115 in the DA.
In another embodiment, the present invention further provides a method for creating a read-only file system based on the read-only file system, including:
and S100, removing the deleting interface and the writing interface on an interface layer of the file system, and storing the reading interface to generate the read-only file system.
Specifically, the deleting interface and the writing interface are removed on the interface layer of the file system, the reading interface is saved, that is, when the read-only file system is created, codes capable of realizing the deleting function and the writing function are not written, and codes with the reading function are written only, so that the read-only file system is generated, the safety of file resources in the read-only file system is greatly improved, and the problem that the file resources are rewritten or deleted due to the fact that the interface is misused is avoided.
In summary, the present invention provides a read-only file system and a method for creating the same, where the system includes: a file system header layer, a directory surface layer and a data area layer; the file system header layer is used for storing basic information of a target file system, judging whether the file system belongs to the target file system according to the identification code, and judging whether data in the directory surface layer is tampered according to the check code; the directory surface layer is used for storing basic information of all files in the target file system, searching whether the target file exists according to the number of the directory surface layers and the file names in the file system header layer, and reading actual contents of the target file from the data area layer according to the basic information of the target file; the data area layer is used for storing the actual contents of all files in the target file system. By constructing a read-only file system composed of a file system header layer, a directory surface layer and a data area layer, the method can be efficiently and safely applied to a single chip microcomputer type TFT instrument.
It will be understood that equivalents and modifications will occur to those skilled in the art in light of the present invention and their spirit, and all such modifications and substitutions are intended to be included within the scope of the present invention as defined in the following claims.

Claims (10)

1. A read-only type file system, the read-only type file system comprising:
a file system header layer, a directory surface layer and a data area layer;
the file system header layer is used for storing basic information of a target file system, judging whether the file system belongs to the target file system according to the identification code, and judging whether data in the directory surface layer is tampered according to the check code;
the directory surface layer is used for storing basic information of all files in the target file system, searching whether the target file exists according to the number of the directory surface layers and the file names in the file system header layer, and reading actual contents of the target file from the data area layer according to the basic information of the target file;
the data area layer is used for storing the actual contents of all files in the target file system.
2. The read-only file system of claim 1, wherein the read-only file system has only a read interface and no delete interface and no modify interface.
3. A read-only type file system according to claim 1, wherein the file system header layer comprises: a first byte interval, a second byte interval, and a third byte interval;
the first byte interval is a storage interval of the identification code and is used for representing the type of the target file system; the second byte interval is a counting interval of the packet number of the directory table and is used for representing the number of files in the target file system; and the third byte interval is a storage interval of a packet check code of the directory surface layer and is used for checking all the directory surface layers in the target file system.
4. The read-only type file system of claim 1, wherein the directory skin comprises a number of consecutive directory table elements, each directory table element comprising: a fourth byte interval, a fifth byte interval, and a sixth byte interval;
the fourth byte interval is a storage interval of names of all directories and files in the target file system and is used for storing the names of the directories and files; the fifth byte interval is a counting interval of the offset of the file and is used for storing the offset of the file relative to the starting position of the storage area; the sixth byte interval is a counting interval of the size of the file, and is used for storing the total byte number of the file.
5. The read-only type file system of claim 4, wherein the data zone layer comprises: and the plurality of continuous storage units are used for storing the actual contents of all files and distributing and sequencing according to the initial positions recorded in the directory surface layer.
6. The read-only type file system according to claim 5, wherein the actual content exists in the form of pages, and the page size is adjusted according to the page size of the storage area.
7. The read-only type file system according to claim 4, wherein the basic information of the file includes: file name, size, attributes, and location.
8. A read-only type file system according to claim 1, wherein the basic information of the target file system includes: the version, the identification, the check code and the directory surface layer number of the target file system.
9. The read-only type file system according to claim 1, wherein the number of directory layers and the number of data area layers are the same as the number of all files; and the file system header layer, the directory surface layer and the data area layer are sequentially overlapped from top to bottom.
10. A method of creating a read-only type file system based on a read-only type file system according to any of claims 1-9, comprising:
and removing the deleting interface and the writing interface on an interface layer of the file system, and storing the reading interface to generate the read-only file system.
CN202311424866.0A 2023-10-30 2023-10-30 Read-only file system and creation method thereof Pending CN117370273A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311424866.0A CN117370273A (en) 2023-10-30 2023-10-30 Read-only file system and creation method thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311424866.0A CN117370273A (en) 2023-10-30 2023-10-30 Read-only file system and creation method thereof

Publications (1)

Publication Number Publication Date
CN117370273A true CN117370273A (en) 2024-01-09

Family

ID=89394410

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311424866.0A Pending CN117370273A (en) 2023-10-30 2023-10-30 Read-only file system and creation method thereof

Country Status (1)

Country Link
CN (1) CN117370273A (en)

Similar Documents

Publication Publication Date Title
US7809779B2 (en) Method of creating symbolic link capable of being compatible with file system, and method and apparatus for accessing file or directory by using symbolic link
KR100380955B1 (en) Extended card file system
US6353837B1 (en) Method and apparatus providing mass storage access from systems using different meta-data formats
US6823417B2 (en) Memory controller for memory card manages file allocation table
US7634613B2 (en) Memory device and recording and/or reproducing apparatus employing this memory device
US5774715A (en) File system level compression using holes
US7836105B2 (en) Converting file-systems that organize and store data for computing systems
US7822931B2 (en) File storage device, host apparatus, method for formatting nonvolatile semiconductor memory, and method of writing data in nonvolatile semiconductor memory
US6697795B2 (en) Virtual file system for dynamically-generated web pages
US7350049B1 (en) Method and apparatus for managing access to a file allocation table
US20050144501A1 (en) Method for recovering data in EXT2 file system, and computer-readable storage medium recorded with data-recovery program
CN106980665B (en) Data dictionary implementation method and device and data dictionary management system
JP2002055995A (en) Method and device for information processing
US6981116B2 (en) System and method for information control block tracking streams for universal disk format file systems
JP2007080240A (en) Technique for accessing file allocation table
US9613207B2 (en) Method and apparatus for preventing autorun of portable USB storage
US6393524B1 (en) Method and driver for sequential operation caching
CN117370273A (en) Read-only file system and creation method thereof
US7437528B1 (en) Gang blocks
CN115269511A (en) Generic electronic file packaging method and device
CN111831224B (en) Method, system and equipment for erasing residual space of exFAT partition file
JPH11120044A (en) Data processor, data processing method, data processing system and recording medium
CN112181918B (en) Quick pre-allocation method for video file of camera for embedded system
KR100296082B1 (en) How to exchange all electronic switch system file system with Unix file system
KR100261177B1 (en) Message handling routine

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