CN114860661A - List data structure establishing method and device and storage medium - Google Patents

List data structure establishing method and device and storage medium Download PDF

Info

Publication number
CN114860661A
CN114860661A CN202110166718.8A CN202110166718A CN114860661A CN 114860661 A CN114860661 A CN 114860661A CN 202110166718 A CN202110166718 A CN 202110166718A CN 114860661 A CN114860661 A CN 114860661A
Authority
CN
China
Prior art keywords
folder
directory
target
attribute information
root directory
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
CN202110166718.8A
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.)
Actions Technology Co Ltd
Original Assignee
Actions Technology 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 Actions Technology Co Ltd filed Critical Actions Technology Co Ltd
Priority to CN202110166718.8A priority Critical patent/CN114860661A/en
Publication of CN114860661A publication Critical patent/CN114860661A/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/14Details of searching files based on file metadata
    • G06F16/156Query results presentation
    • 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

Abstract

The disclosure relates to a method, a device and a storage medium for establishing a list data structure, wherein the method comprises the following steps: responding to the starting operation of the system, counting the number of multimedia files included in a root directory of a preset disk, and recording the attribute information of the root directory; traversing directory entries of the root directory, counting the number of multimedia files included in the directory entries of the folder under the condition that the directory entries of the folder in the root directory are determined to be traversed, and recording attribute information of the directory entries of the folder until all directory entries of the folder in the preset disk are traversed; and establishing a folder list data structure according to the attribute information of the root directory and the attribute information of the folder directory entries, wherein the folder list data structure occupies a small memory, so that the folder list data structure can be stored in a small-sized memory to avoid the problem of data damage caused by disk pulling, and the recorded attribute information of a plurality of folders can be used for determining the full path of each multimedia file.

Description

List data structure establishing method and device and storage medium
Technical Field
The present disclosure relates to the field of file storage technologies, and in particular, to a method and an apparatus for establishing a list data structure, and a storage medium.
Background
In the related art, a magnetic disk is a main storage medium of a computer, can store a large amount of binary data, and can keep the data from being lost even after power is cut off.
When data is written into a disk, if the disk is pulled out at the moment, the risk of damaging a disk file system exists, and the data cannot be read normally.
Disclosure of Invention
To overcome the problems in the related art, the present disclosure provides a method and an apparatus for establishing a list data structure, and a storage medium.
According to a first aspect of the embodiments of the present disclosure, a method for establishing a list data structure is provided, including:
responding to the starting operation of a system, counting the number of multimedia files included in a root directory of a preset disk, and recording the attribute information of the root directory;
traversing directory entries of the root directory, counting the number of multimedia files included in the folder directory entries under the condition that the folder directory entries in the root directory are determined to be traversed, and recording attribute information of the folder directory entries until all folder directory entries included in the preset disk are traversed;
establishing a folder list data structure according to the attribute information of the root directory and the attribute information of the folder directory items;
the folder list data structure comprises attribute information of a plurality of folders, the folders comprise the root directory and folders included in the root directory, and the attribute information is used for determining a full path of a target multimedia file in a search request.
Optionally, the traversing the directory entries of the root directory comprises:
traversing the directory entries of the root directory according to a depth-first principle;
the folder list data structure comprises the attribute information of the root directory and the attribute information of the folders which are positioned behind the attribute information of the root directory and are obtained by traversing according to the depth-first principle in sequence.
Optionally, the method further comprises:
acquiring the search request, wherein the search request comprises the number of the searched target multimedia file;
determining the position of the target multimedia file in the folder list data structure according to the number of the target multimedia file and the number of the multimedia files of the plurality of folders, wherein the position comprises the target folder where the target multimedia file is located and the arrangement serial numbers of the target multimedia file in all the multimedia files displayed in the directory entry of the target folder;
and generating a full path of the target multimedia file in the preset disk according to the attribute information and the positions of the plurality of folders, wherein the full path is used for responding to the search request.
Optionally, the determining, according to the number of the target multimedia file and the number of the multimedia files of the plurality of folders, the position of the target multimedia file in the folder list data structure includes:
determining a target folder where the target multimedia file is located according to the number of the target multimedia file and the number of the multimedia files of the plurality of folders;
determining the arrangement serial numbers of all multimedia files displayed by the target multimedia file in the directory entry of the target folder according to the serial number of the target multimedia file, the number of the multimedia files of the folder positioned before the target folder in the folder list data structure and the number of the multimedia files in the target folder;
and determining the position of the target multimedia file in the folder list data structure according to the target folder and the arrangement serial numbers of the target multimedia file in all multimedia files displayed in the directory entry of the target folder.
Optionally, the generating the full path of the target multimedia file in the preset disk according to the attribute information and the positions of the plurality of folders includes:
determining the file name of the target multimedia file according to the arrangement serial numbers of the target multimedia file in all multimedia files displayed in the directory entry of the target folder and the directory entry of the target folder;
taking the target folder as a current folder, and determining whether the current folder is a root directory of the preset disk;
under the condition that the current folder is determined not to be a root directory, searching a previous folder of the current folder according to the parent cluster number of the current folder and the initial cluster number in the folder list data structure, determining the folder name of the current folder according to the directory entry offset of the current folder and the directory entry of the previous folder, and determining the previous folder as a new current folder until the new current folder is determined to be the root directory;
and generating a full path of the target multimedia file in a preset disk according to the file name of the target multimedia file, all the determined folder names and the disk name of the preset disk.
Optionally, the determining whether the current folder is a root directory includes:
determining whether the parent cluster number of the current folder is a preset identifier;
and under the condition that the parent cluster number of the current folder is a preset identifier, determining that the current folder is a root directory.
Optionally, the folder directory entry carries a folder identifier, and the method further includes:
and determining the folder directory entry traversed into the root directory under the condition that the directory entry of the root directory is traversed to the target entry carrying the folder identifier.
According to a second aspect of the embodiments of the present disclosure, there is provided an apparatus for establishing a list data structure, including:
the response module is configured to respond to the system startup operation, count the number of multimedia files included in a root directory of a preset disk, and record attribute information of the root directory;
the traversal module is configured to traverse directory entries of the root directory, count the number of multimedia files included in the folder directory entries under the condition that the folder directory entries of the root directory are determined to be traversed, and record attribute information of the folder directory entries until all the folder directory entries included in the preset disk are traversed;
the generating module is configured to establish a folder list data structure according to the attribute information of the root directory and the attribute information of the folder directory item;
the folder list data structure comprises attribute information of a plurality of folders, the folders comprise the root directory and folders included in the root directory, and the attribute information is used for determining a full path of a target multimedia file in a search request.
According to a third aspect of the embodiments of the present disclosure, there is provided an apparatus for establishing a list data structure, including:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to perform the steps of the method of establishing a list data structure as described in the first aspect above.
According to a fourth aspect of embodiments of the present disclosure, there is provided a computer-readable storage medium having stored thereon computer program instructions, which when executed by a processor, implement the steps of the method for building a list data structure provided by the first aspect of the present disclosure.
The technical scheme provided by the embodiment of the disclosure can have the following beneficial effects: the established folder list data structure does not record the full path of the file, so that the occupied memory is small, the folder list data structure can be stored in a small-sized memory, the problem of data damage caused by pulling out of a magnetic disk is avoided, and the recorded attribute information of a plurality of folders can be used for determining the full path of each multimedia file.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure.
FIG. 1 is a flow chart illustrating a method of building a list data structure in accordance with an exemplary embodiment.
FIG. 2 is a diagram illustrating a directory structure in accordance with an exemplary embodiment.
FIG. 3 is a diagram illustrating a folder list data structure in accordance with an exemplary embodiment.
FIG. 4 is another flow diagram illustrating a method of building a list data structure in accordance with an exemplary embodiment.
Fig. 5 is a block diagram illustrating an apparatus for building a list data structure in accordance with an example embodiment.
Fig. 6 is a block diagram illustrating an apparatus for building a list data structure in accordance with an example embodiment.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
As the background art, when data is written into a disk, if the disk is pulled out at the moment, there is a risk of damaging a disk file system, which results in that data cannot be read normally; in addition, due to the problem of read-write compatibility of a part of magnetic disks, the speed of reading data is affected by the write operation when reading data, and the phenomena of unsmooth playing, blockage and the like of the electronic equipment are caused by the slow reading speed.
To solve the foregoing technical problem, the present embodiment provides a method, an apparatus, and a storage medium for establishing a list data structure.
Fig. 1 is a flowchart illustrating a method for creating a list data structure according to an exemplary embodiment, which may be used in an electronic device such as a computer, for example, as shown in fig. 1, and includes the following steps.
S101, responding to the starting operation of the system, counting the number of multimedia files included in a root directory of a preset disk, and recording attribute information of the root directory.
In the disclosure, when a system is started, a preset disk is scanned, a folder list data structure is established, and the process is to traverse all folders and multimedia files in the folders under the preset disk, and record a parent cluster number, a directory entry offset, a starting cluster number and the number of the multimedia files of each folder.
The attribute information is used to determine the full path of the target multimedia file in the search request, and the attribute information may include, for example, a parent cluster number, a directory entry offset, a starting cluster number, and the number of multimedia files, and the full path of each multimedia file may be determined according to the attribute information.
In the present disclosure, the multimedia file may be an audio file, a video file, a Word file, or the like, which is not limited in this embodiment. It should be noted that the present embodiment will be described below with the multimedia file being an audio file.
S102, traversing the directory entries of the root directory, counting the number of multimedia files included in the directory entries of the folder under the condition that the directory entries of the folder in the root directory are determined to be traversed, and recording the attribute information of the directory entries of the folder until all the directory entries of the folder in the preset disk are traversed.
Fig. 2 is a schematic diagram illustrating a directory structure according to an exemplary embodiment, as shown in fig. 2, taking a directory structure composed of Folder0, Folder1, Folder2, and Folder3 as an example, where Folder0 is the name of a preset disk, that is, Folder0 is a root directory of the preset disk, and multimedia files under the root directory include 3 files, which sequentially include a.mp3, b.mp3, and c.mp 3; folder1 is a Folder0 subfolder, and the multimedia files under the subfolder include 3, including d.mp3, e.mp3, f.mp 3; folder2 is a subfolder of Folder1, and the multimedia files under the subfolder include 3, including g.mp3, h.mp3, i.mp 3; folder3 is a Folder0 subfolder, and the multimedia files under this subfolder include 3, which in turn include j.mp3, k.mp3, l.mp 3. Taking the directory structure shown in fig. 2 as an example, the electronic device may first traverse the root directory Folder0, record attribute information of the root directory Folder0, and then sequentially record attribute information of the Folder1, the Folder2, and the Folder3 when determining to traverse Folder directory entries (e.g., Folder1, Folder2, and Folder3) in the root directory.
S103, establishing a folder list data structure according to the attribute information of the root directory and the attribute information of the folder directory item.
In the present disclosure, the folder list data structure includes attribute information of a plurality of folders, and the plurality of folders includes a root directory and folders included under the root directory. Still taking the above-described directory structure as an example, the Folder list data structure includes folders 0, Folder1, Folder2, and Folder 3.
By adopting the technical scheme, the established folder list data structure does not record the full path of the file, so that the occupied memory is small, the folder list data structure can be stored in a small-sized memory so as to avoid the problem of data damage caused by pulling out a disk, and the recorded attribute information of a plurality of folders can be used for determining the full path of each multimedia file. In addition, the folder list data structure established by the method reduces the time of occupying a Central Processing Unit (CPU) of the electronic equipment, thereby improving the performance of the system.
In some embodiments, the folder directory entry carries a folder identifier, and when a target entry carrying the folder identifier is traversed in the directory entry of the root directory, the folder directory entry traversed in the root directory is determined, and the target entry is the folder directory entry.
In some embodiments, the directory entries of the root directory may be traversed using a depth-first principle. The depth-first principle is to constantly traverse along the depth direction of a vertex, which is the direction of its neighbors. Explaining the traversal process mentioned in this embodiment with reference to the directory structure and the depth-first principle, after the attribute information of the root directory (Folder0) is recorded, according to the depth-first principle, the root directory will preferentially traverse to the Folder1 Folder, then after the multimedia files of the Folder1 Folder are counted, the root directory will preferentially traverse to the Folder2 Folder below the Folder1 Folder, and after the multimedia files of the Folder2 Folder are counted, the directory of the same level as the Folder1 Folder will be returned, the root directory will traverse to the Folder3 Folder of the same level as the Folder1 Folder, and meanwhile, the multimedia files of the Folder3 Folder will be counted.
Taking the above directory structure as an example, the folder list data structure obtained by using the depth-first principle may be, for example, as shown in fig. 3, where the folder list data structure includes the attribute information of the root directory and the attribute information of the folders located after the attribute information of the root directory and obtained by traversing according to the depth-first principle in sequence.
FIG. 4 is another flow diagram illustrating a method of building a list data structure in accordance with an exemplary embodiment. As shown in fig. 4, the method comprises the following steps:
s401, a search request is obtained, and the search request comprises the number of the searched target multimedia file.
In the present disclosure, for example, the 8 th song in the directory structure, then 8 corresponds to the number of the target multimedia file.
S402, determining the position of the target multimedia file in the folder list data structure according to the number of the target multimedia file and the number of the multimedia files of the plurality of folders.
In the present disclosure, the position of the target multimedia file in the folder list data structure includes the target folder where the target multimedia file is located and the arrangement number of the target multimedia file in all multimedia files displayed in the directory entry of the target folder.
Taking the above directory structure and number as 8 as an example, the target Folder where the target multimedia file is located is Folder2, and the arrangement sequence number of all multimedia files displayed in the directory entry of the target Folder is the second, i.e. the corresponding h.mp 3.
And S403, generating a full path of the target multimedia file in the preset disk according to the attribute information and the positions of the plurality of folders.
In the present disclosure, the full path is used to respond to the search request, i.e. the corresponding multimedia file can be automatically opened according to the full path.
By adopting the technical scheme, the full path name of the target multimedia file can be determined based on the established folder list data structure and the searching request carrying the target multimedia file information, the speed of the full path determining mode is high, the file searching and responding efficiency is ensured, the waiting time of a user is reduced, and the phenomena that the electronic equipment is not smoothly played and is blocked due to the low reading speed are avoided.
In some embodiments, after the full path of the target multimedia file in the preset disk is generated, the generated full path may be displayed on a display screen of the electronic device, so as to improve user experience.
In some embodiments, step S402 shown in fig. 4 may include, for example, the following steps:
firstly, determining a target folder where the target multimedia file is located according to the number of the target multimedia file and the number of the multimedia files of the plurality of folders. Still taking the Folder list data structure and the search request corresponding to the above directory structure as an example, since 3 songs are included in Folder0, Folder1 and Folder2, it can be found that the 8 th song is in the Folder2, and Folder2 is the target Folder.
Then, the arrangement serial numbers of the target multimedia files in all the multimedia files displayed in the directory entry of the target folder are determined according to the number of the target multimedia file, the number of the multimedia files of the folder positioned before the target folder in the folder list data structure and the number of the multimedia files in the target folder. Still taking the Folder list data structure and the search request corresponding to the directory structure as an example, the number of multimedia files of the Folder located before the target Folder in the Folder list data structure, that is, the number of multimedia files including Folder0 and Folder1, specifically determines the arrangement number of the target multimedia file in all multimedia files displayed in the directory entry of the target Folder by using the following calculation formula:
N=N1-(N2-N3);
n is the ranking number, N1 is the number of the target multimedia file, N2 is the sum of the number of multimedia files in Folder0, Folder1 and Folder2, and N3 is the number of multimedia files in Folder 2.
Then, according to the arrangement sequence numbers of the target folder and all multimedia files displayed in the directory entry of the target folder, the position of the target multimedia file in the folder list data structure is determined.
In some embodiments, step S403 shown in fig. 4 may include, for example, the following steps:
firstly, determining the file name of the target multimedia file according to the arrangement sequence number of the target multimedia file in all multimedia files displayed in the directory entry of the target folder and the directory entry of the target folder.
And then, taking the target folder as a current folder, and determining whether the current folder is a root directory of a preset disk.
Then, under the condition that the current folder is determined not to be the root directory, searching the previous folder of the current folder according to the parent cluster number of the current folder and the initial cluster number in the folder list data structure, determining the folder name of the current folder according to the directory entry offset of the current folder and the directory entry of the previous folder, and determining the previous folder as the new current folder until determining the new current folder as the root directory.
And finally, generating a full path of the target multimedia file in the preset disk according to the file name of the target multimedia file, all the determined folder names and the disk name of the preset disk.
For example, the process of generating the full path of the target multimedia file on the preset disk is further explained by taking the directory structure and the number of 8 as an example, specifically:
firstly, the arrangement serial number of the target multimedia file in all multimedia files displayed in the directory entry of the target folder is 2, and the file name of the directory entry of the second multimedia file can be read out to be h.mp3 according to the arrangement serial number;
second, it is determined that Folder2 is not the root directory of the default disk, and then the third step is entered to determine the Folder name including h.mp 3.
Third, a Folder at a previous level of the current Folder is determined, and a Folder name of Folder2 is determined according to a directory entry of the previous level Folder and a directory entry offset of Folder 2. Specifically, the starting cluster number of each Folder (Folder) in the Folder list data structure is queried, the parent cluster number of Folder2 is matched with the starting cluster number of Folder1, Folder1 is determined to be the previous-level Folder of Folder2, a directory entry of Folder1 is opened, and according to the directory entry offset of the current Folder (Folder2), at the offset of which is the offset of the directory entry of Folder2, a Folder2 directory entry is obtained, and the Folder name of Folder2 is further determined, so that the local path of the target multimedia file searched by the search request is Folder2/h.mp 3; finally, taking Folder1 as the new current Folder, determining whether Folder1 is the root directory of the preset disk, if so, determining the name of the preset disk: mp3 is the full path of the target multimedia Folder, and if not, the file name of the new current Folder needs to be further determined. Obviously, in this example, Folder1 is not the root directory of the preset disk, and then, the file name of Folder1 is further determined in a manner of determining the file name of Folder2, and the Folder at the upper level of Folder1 is the root directory.
Fourthly, according to the file name of the target multimedia file, all the determined Folder names and the disk name of the preset disk, according to the above process, the determined file name of the target multimedia file is h.mp3, all the determined Folder names include Folder1 and Folder2, and the disk name of the preset disk is Folder 0. The determined full path of the target multimedia folder is as follows: presetting a disk name: folder1/Folder2/h.mp 3. It is understood that the disk name is preset in this embodiment, namely Folder 0.
In some embodiments, determining whether the current folder is the root directory may determine whether a parent cluster number of the current folder is a preset identifier, and in a case that the parent cluster number of the current folder is the preset identifier, determine that the current folder is the root directory.
The preset identifier may be identified by numeric characters or alphabetical characters, which is not limited in this embodiment.
FIG. 5 is a block diagram illustrating an apparatus for building a list data structure, according to an example embodiment. Referring to fig. 5, the apparatus 500 includes:
a response module 501, configured to respond to a system startup operation, count the number of multimedia files included in a root directory of a preset disk, and record attribute information of the root directory;
a traversal module 502 configured to traverse directory entries of the root directory, count the number of multimedia files included in a folder directory entry under the condition that the folder directory entry of the root directory is determined to be traversed, and record attribute information of the folder directory entry until all folder directory entries included in the preset disk are traversed;
a generating module 503 configured to establish a folder list data structure according to the attribute information of the root directory and the attribute information of the folder directory entry;
the folder list data structure comprises attribute information of a plurality of folders, the folders comprise the root directory and folders included in the root directory, and the attribute information is used for determining a full path of a target multimedia file in a search request.
Optionally, the traversal module 502 includes:
and the traversal submodule is configured to traverse the directory entries of the root directory according to a depth-first principle, and the folder list data structure comprises the attribute information of the root directory and the attribute information of folders which are located behind the attribute information of the root directory and are sequentially obtained by traversal according to the depth-first principle.
Optionally, the apparatus 500 further comprises:
the acquisition module is configured to acquire a search request, wherein the search request comprises the number of a searched target multimedia file;
a position determining module, configured to determine, according to the number of the target multimedia file and the number of the multimedia files in the plurality of folders, a position of the target multimedia file in the folder list data structure, where the position includes a target folder where the target multimedia file is located and an arrangement serial number of the target multimedia file in all multimedia files displayed in a directory entry of the target folder;
and the full path generation module is configured to generate a full path of the target multimedia file in the preset disk according to the attribute information and the positions of the plurality of folders, wherein the full path is used for responding to the search request.
Optionally, the position determination module comprises:
the target folder determining submodule is configured to determine a target folder where the target multimedia file is located according to the number of the target multimedia file and the number of the multimedia files of the plurality of folders;
a ranking number determination submodule configured to determine ranking numbers of the target multimedia files in all multimedia files displayed in the directory entry of the target folder according to the number of the target multimedia file, the number of multimedia files of a folder located before the target folder in the folder list data structure, and the number of multimedia files in the target folder;
and the position determining submodule is configured to determine the position of the target multimedia file in the folder list data structure according to the target folder and the arrangement serial numbers of the target multimedia file in all multimedia files displayed in the directory entry of the target folder.
Optionally, the attribute information includes a parent cluster number, a directory entry offset, a starting cluster number, and a number of multimedia files, and the full path generating module includes:
the first file name determining submodule is configured to determine the file name of the target multimedia file according to the arrangement sequence number of the target multimedia file in all multimedia files displayed in the directory entry of the target folder and the directory entry of the target folder;
a root directory determining submodule configured to take the target folder as a current folder and determine whether the current folder is a root directory of the preset disk;
a second file name determining sub-module, configured to, in a case that it is determined that the current folder is not a root directory, find a previous-level folder of the current folder according to a parent cluster number of the current folder and a starting cluster number in the folder list data structure, determine a folder name of the current folder according to a directory entry offset of the current folder and a directory entry of the previous-level folder, and determine the previous-level folder as a new current folder until it is determined that the new current folder is a root directory;
and the full path generation sub-module is configured to generate a full path of the target multimedia file in a preset disk according to the file name of the target multimedia file, all the determined folder names and the disk name of the preset disk.
Optionally, the root directory determining sub-module includes:
a first root directory determining submodule configured to determine whether a parent cluster number of the current folder is a preset identifier;
and the second root directory determining submodule is configured to determine that the current folder is the root directory under the condition that the parent cluster number of the current folder is a preset identifier.
Optionally, the folder directory entry carries a folder identifier, and the apparatus 500 further includes:
and the folder directory entry determining module is configured to determine the folder directory entry traversed into the root directory when the directory entry of the root directory is traversed to the target entry carrying the folder identifier.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
The present disclosure also provides a computer readable storage medium having stored thereon computer program instructions which, when executed by a processor, implement the steps of the method of building a list data structure provided by the present disclosure.
Fig. 6 is a block diagram illustrating an apparatus 600 for the creation of a list data structure in accordance with an example embodiment. For example, the apparatus 600 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, an exercise device, a personal digital assistant, and the like.
Referring to fig. 6, apparatus 600 may include one or more of the following components: a processing component 602, a memory 604, a power component 606, a multimedia component 608, an audio component 610, an interface to input/output (I/O) 612, a sensor component 614, and a communication component 616.
The processing component 602 generally controls overall operation of the device 600, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing component 602 may include one or more processors 620 to execute instructions to perform all or a portion of the steps of the above-described method of building a list data structure. Further, the processing component 602 can include one or more modules that facilitate interaction between the processing component 602 and other components. For example, the processing component 602 can include a multimedia module to facilitate interaction between the multimedia component 608 and the processing component 602.
The memory 604 is configured to store various types of data to support operations at the apparatus 600. Examples of such data include instructions for any application or method operating on device 600, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 604 may be implemented by any type or combination of volatile or non-volatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
Power component 606 provides power to the various components of device 600. Power components 606 may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power for device 600.
The multimedia component 608 includes a screen that provides an output interface between the device 600 and a user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 608 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the device 600 is in an operating mode, such as a shooting mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 610 is configured to output and/or input audio signals. For example, audio component 610 includes a Microphone (MIC) configured to receive external audio signals when apparatus 600 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal may further be stored in the memory 604 or transmitted via the communication component 616. In some embodiments, audio component 610 further includes a speaker for outputting audio signals.
The I/O interface 612 provides an interface between the processing component 602 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor component 614 includes one or more sensors for providing status assessment of various aspects of the apparatus 600. For example, the sensor component 614 may detect an open/closed state of the device 600, the relative positioning of components, such as a display and keypad of the device 600, the sensor component 614 may also detect a change in position of the device 600 or a component of the device 600, the presence or absence of user contact with the device 600, orientation or acceleration/deceleration of the device 600, and a change in temperature of the device 600. The sensor assembly 614 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 614 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 614 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 616 is configured to facilitate communications between the apparatus 600 and other devices in a wired or wireless manner. The apparatus 600 may access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 616 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 616 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the apparatus 600 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components for performing the above-described method of establishing the list data structure.
In an exemplary embodiment, a non-transitory computer readable storage medium comprising instructions, such as the memory 604 comprising instructions, executable by the processor 620 of the apparatus 600 to perform the above-described method of establishing a list data structure is also provided. For example, the non-transitory computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
In another exemplary embodiment, a computer program product is also provided, which comprises a computer program executable by a programmable apparatus, the computer program having code portions for performing the above-mentioned method of establishing a list data structure when executed by the programmable apparatus.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (10)

1. A method for building a list data structure, comprising:
responding to the starting operation of a system, counting the number of multimedia files included in a root directory of a preset disk, and recording the attribute information of the root directory;
traversing directory entries of the root directory, counting the number of multimedia files included in the folder directory entries under the condition that the folder directory entries in the root directory are determined to be traversed, and recording attribute information of the folder directory entries until all folder directory entries included in the preset disk are traversed;
establishing a folder list data structure according to the attribute information of the root directory and the attribute information of the folder directory items;
the folder list data structure comprises attribute information of a plurality of folders, the folders comprise the root directory and folders included in the root directory, and the attribute information is used for determining a full path of a target multimedia file in a search request.
2. The method of claim 1, wherein traversing the directory entries of the root directory comprises:
traversing the directory entries of the root directory according to a depth-first principle;
and the folder list data structure comprises the attribute information of the root directory and the attribute information of the folders which are positioned behind the attribute information of the root directory and are obtained by traversing according to the depth priority principle in sequence.
3. The method of claim 2, further comprising:
acquiring the search request, wherein the search request comprises the number of the searched target multimedia file;
determining the position of the target multimedia file in the folder list data structure according to the number of the target multimedia file and the number of the multimedia files of the plurality of folders, wherein the position comprises the target folder where the target multimedia file is located and the arrangement serial numbers of the target multimedia file in all the multimedia files displayed in the directory entry of the target folder;
and generating a full path of the target multimedia file in the preset disk according to the attribute information and the positions of the plurality of folders, wherein the full path is used for responding to the search request.
4. The method of claim 3, wherein determining the location of the target multimedia file in the folder list data structure based on the number of the target multimedia file and the number of multimedia files in the plurality of folders comprises:
determining a target folder where the target multimedia file is located according to the number of the target multimedia file and the number of the multimedia files of the plurality of folders;
determining the arrangement serial numbers of all multimedia files displayed by the target multimedia file in the directory entry of the target folder according to the serial number of the target multimedia file, the number of the multimedia files of the folder positioned before the target folder in the folder list data structure and the number of the multimedia files in the target folder;
and determining the position of the target multimedia file in the folder list data structure according to the target folder and the arrangement serial numbers of the target multimedia file in all multimedia files displayed in the directory entry of the target folder.
5. The method of claim 3, wherein the attribute information includes a parent cluster number, a directory entry offset, a starting cluster number, and a number of multimedia files, and wherein generating a full path of the target multimedia file on the predetermined disk according to the attribute information and the location of the plurality of folders comprises:
determining the file name of the target multimedia file according to the arrangement serial numbers of the target multimedia file in all multimedia files displayed in the directory entry of the target folder and the directory entry of the target folder;
taking the target folder as a current folder, and determining whether the current folder is a root directory of the preset disk;
under the condition that the current folder is determined not to be a root directory, searching a previous folder of the current folder according to the parent cluster number of the current folder and the initial cluster number in the folder list data structure, determining the folder name of the current folder according to the directory entry offset of the current folder and the directory entry of the previous folder, and determining the previous folder as a new current folder until the new current folder is determined to be the root directory;
and generating a full path of the target multimedia file in a preset disk according to the file name of the target multimedia file, all the determined folder names and the disk name of the preset disk.
6. The method of claim 5, wherein the determining whether the current folder is a root directory comprises:
determining whether the parent cluster number of the current folder is a preset identifier;
and under the condition that the parent cluster number of the current folder is a preset identifier, determining that the current folder is a root directory.
7. The method of claim 1, wherein the folder directory entry carries a folder identification, the method further comprising:
and determining the folder directory entry traversed into the root directory under the condition that the directory entry of the root directory is traversed to the target entry carrying the folder identifier.
8. An apparatus for creating a list data structure, comprising:
the response module is configured to respond to the system startup operation, count the number of multimedia files included in a root directory of a preset disk, and record attribute information of the root directory;
the traversal module is configured to traverse directory entries of the root directory, count the number of multimedia files included in the folder directory entries under the condition that the folder directory entries of the root directory are determined to be traversed, and record attribute information of the folder directory entries until all the folder directory entries included in the preset disk are traversed;
the generating module is configured to establish a folder list data structure according to the attribute information of the root directory and the attribute information of the folder directory item;
the folder list data structure comprises attribute information of a plurality of folders, the folders comprise the root directory and folders included in the root directory, and the attribute information is used for determining a full path of a target multimedia file in a search request.
9. An apparatus for creating a list data structure, comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to perform the method of any one of claims 1-7.
10. A computer-readable storage medium, on which computer program instructions are stored, which program instructions, when executed by a processor, carry out the steps of the method according to any one of claims 1 to 7.
CN202110166718.8A 2021-02-04 2021-02-04 List data structure establishing method and device and storage medium Pending CN114860661A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110166718.8A CN114860661A (en) 2021-02-04 2021-02-04 List data structure establishing method and device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110166718.8A CN114860661A (en) 2021-02-04 2021-02-04 List data structure establishing method and device and storage medium

Publications (1)

Publication Number Publication Date
CN114860661A true CN114860661A (en) 2022-08-05

Family

ID=82627941

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110166718.8A Pending CN114860661A (en) 2021-02-04 2021-02-04 List data structure establishing method and device and storage medium

Country Status (1)

Country Link
CN (1) CN114860661A (en)

Similar Documents

Publication Publication Date Title
US9942690B2 (en) Method and device for information push
KR101789783B1 (en) Method, apparatus, program, and recording medium for prompting call
CN106598392B (en) Notification message display method and device
US10810172B2 (en) Data clearing method, apparatus and storage medium
EP3128411B1 (en) Interface display method, terminal, computer program and recording medium
CN106919629B (en) Method and device for realizing information screening in group chat
CN104462296B (en) File management method and device and terminal
CN106896991B (en) Method and device for updating information
CN108881634B (en) Terminal control method, device and computer readable storage medium
CN110611733A (en) Configuration method of shortcut entrance, terminal and computer storage medium
CN110968364A (en) Method and device for adding shortcut plug-in and intelligent equipment
CN110085066B (en) Method and device for displaying reading information and electronic equipment
KR101753800B1 (en) Method, and device for displaying task
KR101895701B1 (en) Method and device for pushing user information
CN105260088B (en) Information classification display processing method and device
WO2018032261A1 (en) Application prompting method and device
CN107948442B (en) Message management method, device and computer readable storage medium
CN107885571B (en) Display page control method and device
CN114466204B (en) Video bullet screen display method and device, electronic equipment and storage medium
CN106060253B (en) Information presentation method and device
CN106339470B (en) File processing method and device
EP3995943A1 (en) Method for operating a display device, terminal, and storage medium
CN105278941A (en) Application program display method and device
CN114860661A (en) List data structure establishing method and device and storage medium
CN110502484B (en) Method, device and medium for displaying file information on mobile terminal

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