List data structure establishment method and device and storage medium
By establishing a folder list data structure, the problems of data corruption and slow reading speed caused by disk removal were solved, achieving efficient file searching and improved system performance.
Patent Information
- Application Number
- CN202110166718.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-02-04
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2041-02-04
AI Technical Summary
Unplugging the disk while writing data can corrupt the file system, making it impossible to read data properly. Furthermore, compatibility issues during data reading can lead to slow reading speeds, affecting the smoothness of electronic devices.
A folder list data structure is established. By statistically analyzing and recording the attribute information of the disk root directory and folders, the directory entries are traversed using a depth-first approach to generate the folder list data structure. The full path of the files is not recorded to reduce memory usage, and the full path of multimedia files is determined by the attribute information of the folders.
This avoids data corruption caused by disk removal, improves read speed and system performance, reduces CPU time usage, and ensures efficient file searching and a better user experience.
Smart Images

Figure CN114860661B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of file storage technology, and in particular to a method, apparatus and storage medium for creating a list data structure. Background Technology
[0002] In related technologies, the hard disk is the main storage medium for computers, which can store a large amount of binary data and retain the data even after power failure.
[0003] If the disk is unplugged while data is being written to it, there is a risk of damaging the disk file system, making it impossible to read the data normally. Summary of the Invention
[0004] To overcome the problems existing in related technologies, this disclosure provides a method, apparatus and storage medium for establishing a list data structure.
[0005] According to a first aspect of the present disclosure, a method for establishing a list data structure is provided, comprising:
[0006] In response to the system startup operation, count the number of multimedia files in the root directory of the preset disk and record the attribute information of the root directory;
[0007] Traverse the directory entries of the root directory. If it is determined that a folder directory entry in the root directory has been traversed, count the number of multimedia files included in the folder directory entry and record the attribute information of the folder directory entry until all folder directory entries included in the preset disk have been traversed.
[0008] Based on the attribute information of the root directory and the attribute information of the folder directory items, establish a folder list data structure;
[0009] The folder list data structure includes attribute information for multiple folders, and the multiple folders include the root directory and the folders included under the root directory. The attribute information is used to determine the full path of the target multimedia file in the search request.
[0010] Optionally, traversing the directory entries of the root directory includes:
[0011] Traverse the directory entries of the root directory according to the depth-first principle;
[0012] The folder list data structure includes the attribute information of the root directory and the attribute information of the folders located after the root directory, which are traversed sequentially according to the depth-first principle.
[0013] Optionally, the method further includes:
[0014] Obtain the search request, which includes the ID of the target multimedia file to be searched;
[0015] Based on the number of the target multimedia file and the number of multimedia files in the multiple folders, the position of the target multimedia file in the folder list data structure is determined, wherein the position includes the target folder where the target multimedia file is located and the sequence number of the target multimedia file among all multimedia files displayed in the directory entry of the target folder;
[0016] Based on the attribute information of the multiple folders and their locations, a full path to the target multimedia file on the preset disk is generated, and the full path is used to respond to the search request.
[0017] Optionally, determining the position of the target multimedia file in the folder list data structure based on the target multimedia file's ID and the number of multimedia files in the plurality of folders includes:
[0018] The target folder containing the target multimedia file is determined based on the target multimedia file's ID and the number of multimedia files in the multiple folders.
[0019] Based on the target multimedia file's number, the number of multimedia files in the folder preceding the target folder in the folder list data structure, and the number of multimedia files in the target folder, determine the sequence number of the target multimedia file among all multimedia files displayed in the directory entry of the target folder;
[0020] The position of the target multimedia file in the folder list data structure is determined based on the sequence number of the target multimedia file among all multimedia files displayed in the directory entry of the target folder.
[0021] Optionally, the attribute information includes the parent cluster number, directory entry offset, starting cluster number, and the number of multimedia files. Generating the full path of the target multimedia file on the preset disk based on the attribute information of the multiple folders and the location includes:
[0022] The file name of the target multimedia file is determined based on the sequence number of all multimedia files displayed in the directory entry of the target folder and the directory entry of the target folder;
[0023] The target folder is set as the current folder, and it is determined whether the current folder is the root directory of the preset disk;
[0024] If it is determined that the current folder is not the root directory, the parent folder of the current folder is found according to the parent cluster number of the current folder and the starting cluster number in the folder list data structure. The folder name of the current folder is determined according to the directory item offset of the current folder and the directory item of the parent folder. The parent folder is then determined as the new current folder until the new current folder is determined to be the root directory.
[0025] Based on the file name of the target multimedia file, all determined folder names, and the disk name of the preset disk, generate the full path of the target multimedia file on the preset disk.
[0026] Optionally, determining whether the current folder is the root directory includes:
[0027] Determine whether the parent cluster number of the current folder is a preset identifier;
[0028] If the parent cluster number of the current folder is a preset identifier, then the current folder is determined to be the root directory.
[0029] Optionally, the folder directory entry carries a folder identifier, and the method further includes:
[0030] If a target entry carrying a folder identifier is found during traversal of the directory entries in the root directory, it is determined that the folder directory entry in the root directory has been traversed.
[0031] According to a second aspect of the present disclosure, an apparatus for establishing a list data structure is provided, comprising:
[0032] The response module is configured to respond to the system startup operation, count the number of multimedia files in the root directory of the preset disk, and record the attribute information of the root directory.
[0033] The traversal module is configured to traverse the directory entries of the root directory. When it is determined that a folder directory entry of the root directory has been traversed, the number of multimedia files included in the folder directory entry is counted and the attribute information of the folder directory entry is recorded until all folder directory entries included in the preset disk have been traversed.
[0034] The generation module is configured to establish a folder list data structure based on the attribute information of the root directory and the attribute information of the folder directory items;
[0035] The folder list data structure includes attribute information for multiple folders, and the multiple folders include the root directory and the folders included under the root directory. The attribute information is used to determine the full path of the target multimedia file in the search request.
[0036] According to a third aspect of the present disclosure, an apparatus for establishing a list data structure is provided, comprising:
[0037] processor;
[0038] Memory used to store processor-executable instructions;
[0039] The processor is configured to perform the steps in the method for establishing a list data structure as described in the first aspect above.
[0040] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided that stores computer program instructions thereon, which, when executed by a processor, implement the steps of the method for establishing a list data structure provided in the first aspect of the present disclosure.
[0041] The technical solutions provided by the embodiments of this disclosure may include the following beneficial effects: the established folder list data structure does not record the full path of the files, so it occupies less memory. In this way, the folder list data structure can be stored in the memory of the small machine to avoid data corruption caused by disk removal. Moreover, the attribute information of the recorded multiple folders can be used to determine the full path of each multimedia file.
[0042] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0043] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.
[0044] Figure 1 This is a flowchart illustrating a method for creating a list data structure according to an exemplary embodiment.
[0045] Figure 2 This is a schematic diagram illustrating a directory structure according to an exemplary embodiment.
[0046] Figure 3 This is a schematic diagram illustrating a folder list data structure according to an exemplary embodiment.
[0047] Figure 4 This is another flowchart illustrating a method for creating a list data structure according to an exemplary embodiment.
[0048] Figure 5 This is a block diagram illustrating an apparatus for creating a list data structure according to an exemplary embodiment.
[0049] Figure 6This is a block diagram illustrating an apparatus for creating a list data structure according to an exemplary embodiment. Detailed Implementation
[0050] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.
[0051] As mentioned in the background section, if the disk is unplugged while writing data, there is a risk of damaging the disk file system, resulting in the inability to read the data normally. In addition, due to some disk read / write compatibility issues, performing write operations while reading data will affect the reading speed, and slow reading speed will cause electronic devices to play choppy or stutter.
[0052] To address the aforementioned technical problems, this embodiment provides a method, apparatus, and storage medium for establishing a list data structure.
[0053] Figure 1 This is a flowchart illustrating a method for creating a list data structure according to an exemplary embodiment, such as... Figure 1 As shown, the method can be used in electronic devices such as computers, and includes the following steps.
[0054] S101 responds to the system startup operation, counts the number of multimedia files in the root directory of the preset disk, and records the attribute information of the root directory.
[0055] In this disclosure, when the system boots up, a preset disk is scanned and a folder list data structure is established. The process involves traversing all folders and multimedia files within the preset disk, recording the parent cluster number, directory entry offset, starting cluster number, and number of multimedia files for each folder.
[0056] The attribute information is used to determine the full path of the target multimedia file in the search request. The attribute information may include, for example, the parent cluster number, the directory entry offset, the starting cluster number, and the number of multimedia files. Based on this attribute information, the full path of each multimedia file can be determined.
[0057] In this disclosure, multimedia files can be audio files, video files, or Word files, etc., and this embodiment is not limited to any of them. It should be noted that the following description will use audio files as the example of multimedia files.
[0058] S102, traverse the directory entries of the root directory. If it is determined that a folder directory entry in the root directory has been traversed, count the number of multimedia files included in the folder directory entry and record the attribute information of the folder directory entry until all folder directory entries included in the preset disk have been traversed.
[0059] Figure 2 This is a schematic diagram illustrating a directory structure according to an exemplary embodiment, such as... Figure 2 As shown, taking the directory structure consisting of Folder0, Folder1, Folder2, and Folder3 as an example, Folder0 is the name of the default disk, meaning it is the root directory of the default disk, and contains three multimedia files: a.mp3, b.mp3, and c.mp3. Folder1 is a subfolder of Folder0, containing three multimedia files: d.mp3, e.mp3, and f.mp3. Folder2 is a subfolder of Folder1, containing three multimedia files: g.mp3, h.mp3, and i.mp3. Folder3 is a subfolder of Folder0, containing three multimedia files: j.mp3, k.mp3, and l.mp3. Figure 2 Taking the directory structure shown as an example, the electronic device will first traverse the root directory Folder0 and record the attribute information of the root directory Folder0. Then, when it is determined that the folder directory items (such as Folder1, Folder2 and Folder3) in the root directory have been traversed, the attribute information of Folder1, Folder2 and Folder3 will be recorded in sequence.
[0060] S103. Based on the attribute information of the root directory and the attribute information of the folder directory entries, establish the folder list data structure.
[0061] In this disclosure, the folder list data structure includes attribute information for multiple folders, and these multiple folders include a root directory and the folders contained within the root directory. Taking the directory structure described above as an example, the folder list data structure includes the folders Folder0, Folder1, Folder2, and Folder3.
[0062] The folder list data structure established using the above technical solution does not record the full path of files, thus occupying less memory. This allows the folder list data structure to be stored in the mainframe's memory, avoiding data corruption caused by disk removal. Furthermore, the recorded attribute information of multiple folders can be used to determine the full path of each multimedia file. In addition, establishing the folder list data structure using this method reduces the time spent on the electronic device's CPU (central processing unit), thereby improving system performance.
[0063] In some implementations, the folder directory entry carries a folder identifier. When a target entry carrying a folder identifier is found during traversal of the directory entries in the root directory, it is determined that the traversed target entry is a folder directory entry in the root directory.
[0064] In some implementations, a depth-first traversal of the root directory entries can be used. The depth-first traversal continuously follows the depth direction of a vertex, where the depth direction refers to the direction of its adjacent vertices. The traversal process described in this embodiment is explained in conjunction with the above directory structure and the depth-first principle. After recording the attribute information of the root directory (Folder0), according to the depth-first principle, the Folder1 folder is traversed first. After counting the multimedia files in Folder1, the Folder2 folder under Folder1 is traversed first. After counting the multimedia files in Folder2, the system returns to directories at the same level as Folder1, and then traverses to Folder3, which is at the same level as Folder1, while also counting the multimedia files in Folder3.
[0065] Taking the above directory structure as an example, and applying the depth-first search principle to obtain the folder list data structure, it can be as follows: Figure 3 As shown, the folder list data structure includes the attribute information of the root directory and the attribute information of the folders located after the root directory, which are traversed sequentially according to the depth-first principle.
[0066] Figure 4 This is another flowchart illustrating a method for creating a list data structure according to an exemplary embodiment. For example... Figure 4 As shown, it includes the following steps:
[0067] S401, Obtain a search request. The search request includes the number of the target multimedia file to be searched.
[0068] In this disclosure, for example, the 8th song in the directory structure, 8 corresponds to the number of the target multimedia file.
[0069] S402, determine the position of the target multimedia file in the folder list data structure based on the target multimedia file's ID and the number of multimedia files in multiple folders.
[0070] In this 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 sequence number of the target multimedia file among all multimedia files displayed in the directory entry of the target folder.
[0071] Taking the above directory structure and number 8 as an example, the target folder where the target multimedia file is located is Folder2, and the sequence number of all multimedia files displayed in the directory entry of the target folder is the second, which is the corresponding h.mp3.
[0072] S403 generates the full path of the target multimedia file on the preset disk based on the attribute information and location of multiple folders.
[0073] In this disclosure, the full path is used to respond to the search request, that is, the corresponding multimedia file can be automatically opened based on the full path.
[0074] By adopting the above technical solution, the full path name of the target multimedia file can be determined based on the established folder list data structure and the search request carrying the target multimedia file information. This method of determining the full path is fast, ensuring the efficiency of file search and response, reducing the user's waiting time, and also avoiding the phenomenon of electronic devices playing unsmoothly or stuttering due to slow reading speed.
[0075] In some implementations, after generating the full path of the target multimedia file on a preset disk, the generated full path can also be displayed on the screen of an electronic device to improve the user experience.
[0076] In some implementations... Figure 4 Step S402 shown may include, for example, the following steps:
[0077] First, based on the target multimedia file's ID and the number of multimedia files in multiple folders, determine the target folder containing the target multimedia file. Using the folder list data structure and search request corresponding to the above directory structure as an example, since Folder0, Folder1, and Folder2 each contain 3 songs, we can conclude that the 8th song is in Folder2, making Folder2 the target folder.
[0078] Next, based on the target multimedia file's ID, the number of multimedia files in the folder preceding the target folder in the folder list data structure, and the number of multimedia files in the target folder, the sequence number of the target multimedia file among all multimedia files displayed in the directory entry of the target folder is determined. Taking the folder list data structure and search request corresponding to the above directory structure as an example, the number of multimedia files in the folder preceding the target folder in the folder list data structure includes the number of multimedia files in Folder0 and Folder1. Specifically, the sequence number of the target multimedia file among all multimedia files displayed in the directory entry of the target folder is determined using the following formula:
[0079] N = N1 - (N2 - N3);
[0080] N is the sequence number, N1 is the target multimedia file number, N2 is the sum of the number of multimedia files in Folder0, Folder1 and Folder2, and N3 is the number of multimedia files in Folder2.
[0081] Then, based on the sequence number of the target multimedia file among 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.
[0082] In some implementations... Figure 4 Step S403 shown may include, for example, the following steps:
[0083] First, determine the filename of the target multimedia file based on its sequence number among all multimedia files displayed in the directory entry of the target folder and the directory entry of the target folder.
[0084] Next, the target folder is set as the current folder, and it is determined whether the current folder is the root directory of the preset disk.
[0085] Then, if it is determined that the current folder is not the root directory, the parent folder of the current folder is found based on the parent cluster number of the current folder and the starting cluster number in the folder list data structure. Based on the directory entry offset of the current folder and the directory entry of the parent folder, the folder name of the current folder is determined, and the parent folder is determined as the new current folder, until the new current folder is determined as the root directory.
[0086] Finally, based on the target multimedia file's filename, all determined folder names, and the default disk's disk name, the full path of the target multimedia file on the default disk is generated.
[0087] For example, using the directory structure and number 8 as an example, the process of generating the full path of the target multimedia file on the preset disk will be further explained:
[0088] First, the target multimedia file is numbered 2 among all multimedia files displayed in the directory entry of the target folder. Based on this number, the file name of the directory entry of the second multimedia file can be read as h.mp3.
[0089] Second, after confirming that Folder2 is not the root directory of the default disk, we proceed to the third step: determining the folder name that includes h.mp3.
[0090] Third, determine the parent folder of the current folder, and determine the folder name of Folder2 based on the directory entry of the parent folder and the offset of the directory entry of Folder2. Specifically, query the starting cluster number of each folder in the folder list data structure. The parent cluster number of Folder2 matches the starting cluster number of Folder1, confirming that Folder1 is the parent folder of Folder2. Open the directory entry of Folder1, and based on the offset of the directory entry of the current folder (Folder2), obtain the directory entry of Folder2 at the offset of the directory entry of Folder2, and further determine the folder name of Folder2. This gives the partial path of the target multimedia file searched for as Folder2 / h.mp3. Finally, using Folder1 as the new current folder, determine if Folder1 is the root directory of the preset disk. If so, the preset disk name: Folder2 / h.mp3 is the full path of the target multimedia folder. 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 default disk. Therefore, the file name of Folder1 is determined by determining the file name of Folder2, and the parent folder of Folder1 is the root directory.
[0091] Fourth, based on the target multimedia file's name, all determined folder names, and the preset disk's name, following the above process, the target multimedia file's name is determined to be h.mp3, all determined folder names include Folder1 and Folder2, and the preset disk's name is Folder0. The full path of the determined target multimedia folder is: Preset disk name: Folder1 / Folder2 / h.mp3. It can be understood that in this embodiment, the preset disk name is also Folder0.
[0092] In some implementations, determining whether the current folder is the root directory can be done by determining whether the parent cluster number of the current folder is a preset identifier. If the parent cluster number of the current folder is a preset identifier, the current folder is determined to be the root directory.
[0093] The preset identifier can be identified by numeric characters or alphabetic characters; this embodiment does not limit this.
[0094] Figure 5 This is a block diagram illustrating an apparatus for creating a list data structure according to an exemplary embodiment. (Refer to...) Figure 5 The device 500 includes:
[0095] The response module 501 is configured to respond to the system startup operation, count the number of multimedia files included in the root directory of the preset disk, and record the attribute information of the root directory.
[0096] The traversal module 502 is configured to traverse the directory entries of the root directory. When it is determined that a folder directory entry of the root directory has been traversed, the number of multimedia files included in the folder directory entry is counted and the attribute information of the folder directory entry is recorded until all folder directory entries included in the preset disk have been traversed.
[0097] The generation module 503 is configured to establish a folder list data structure based on the attribute information of the root directory and the attribute information of the folder directory items;
[0098] The folder list data structure includes attribute information for multiple folders, and the multiple folders include the root directory and the folders included under the root directory. The attribute information is used to determine the full path of the target multimedia file in the search request.
[0099] Optionally, the traversal module 502 includes:
[0100] The traversal submodule is configured to traverse the directory entries of the root directory according to the depth-first principle. 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 traversed in sequence according to the depth-first principle.
[0101] Optionally, the device 500 further includes:
[0102] The acquisition module is configured to acquire a search request, the search request including the number of the target multimedia file to be searched.
[0103] The location determination module is configured to determine 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 multiple folders, wherein the location includes the target folder where the target multimedia file is located and the sequence number of the target multimedia file among all multimedia files displayed in the directory entry of the target folder;
[0104] The full path generation module is configured to generate the full path of the target multimedia file on the preset disk based on the attribute information of the multiple folders and the location, and the full path is used to respond to the search request.
[0105] Optionally, the location determination module includes:
[0106] The target folder determination submodule is configured to determine the target folder where the target multimedia file is located based on the number of the target multimedia file and the number of multimedia files in the multiple folders;
[0107] The sequence number determination submodule is configured to determine the sequence number of the target multimedia file among all multimedia files displayed in the directory entry of the target folder based on the number of the target multimedia file, the number of multimedia files in the folder preceding the target folder in the folder list data structure, and the number of multimedia files in the target folder.
[0108] The location determination submodule is configured to determine the position of the target multimedia file in the folder list data structure based on the sequence number of the target multimedia file among all multimedia files displayed in the directory entry of the target folder.
[0109] Optionally, the attribute information includes the parent cluster number, directory entry offset, starting cluster number, and the number of multimedia files, and the full path generation module includes:
[0110] The first file name determination submodule is configured to determine the file name of the target multimedia file based on the sequence number of all multimedia files displayed in the directory entry of the target folder and the directory entry of the target folder;
[0111] The root directory determination submodule is configured to use the target folder as the current folder and determine whether the current folder is the root directory of the preset disk;
[0112] The second file name determination submodule is configured to, when it is determined that the current folder is not the root directory, find the parent folder of the current folder based on the parent cluster number of the current folder and the starting cluster number in the folder list data structure, determine the folder name of the current folder based on the directory item offset of the current folder and the directory item of the parent folder, and determine the parent folder as the new current folder, until the new current folder is determined to be the root directory;
[0113] The full path generation submodule is configured to generate the full path of the target multimedia file on the preset disk based on the file name of the target multimedia file, all determined folder names, and the disk name of the preset disk.
[0114] Optionally, the root directory determination submodule includes:
[0115] The first root directory determination submodule is configured to determine whether the parent cluster number of the current folder is a preset identifier;
[0116] The second root directory determination submodule is configured to determine the current folder as the root directory when the parent cluster number of the current folder is a preset identifier.
[0117] Optionally, the folder directory entry carries a folder identifier, and the device 500 further includes:
[0118] The folder directory entry determination module is configured to determine the folder directory entry traversed in the root directory when a target entry carrying a folder identifier is found during traversal of the directory entries in the root directory.
[0119] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0120] This disclosure also provides a computer-readable storage medium having stored thereon computer program instructions that, when executed by a processor, implement the steps of the method for establishing a list data structure provided in this disclosure.
[0121] Figure 6 This is a block diagram illustrating an apparatus 600 for establishing a list data structure according to an exemplary embodiment. For example, apparatus 600 may be a mobile phone, computer, digital broadcasting terminal, messaging device, game console, tablet device, medical device, fitness equipment, personal digital assistant, etc.
[0122] Reference Figure 6The device 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 input / output (I / O) interface 612, a sensor component 614, and a communication component 616.
[0123] Processing component 602 typically controls the overall operation of device 600, such as operations associated with display, telephone calls, data communication, camera operation, and recording. Processing component 602 may include one or more processors 620 to execute instructions to complete all or part of the steps of the method for establishing the list data structure described above. Furthermore, processing component 602 may include one or more modules to facilitate interaction between processing component 602 and other components. For example, processing component 602 may include a multimedia module to facilitate interaction between multimedia component 608 and processing component 602.
[0124] Memory 604 is configured to store various types of data to support the operation of device 600. Examples of such data include instructions for any application or method operating on device 600, contact data, phonebook data, messages, pictures, videos, etc. Memory 604 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, 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 storage, flash memory, magnetic disk, or optical disk.
[0125] The power supply component 606 provides power to the various components of the device 600. The power supply component 606 may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power to the device 600.
[0126] Multimedia component 608 includes a screen that provides an output interface between the device 600 and the 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 touchscreen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors may sense not only the boundaries of the touch or swipe action but also the duration and pressure associated with the touch or swipe operation. In some embodiments, multimedia component 608 includes a front-facing camera and / or a rear-facing camera. When the device 600 is in an operating mode, such as a shooting mode or a video mode, the front-facing camera and / or the rear-facing camera may receive external multimedia data. Each front-facing camera and rear-facing camera may be a fixed optical lens system or have focal length and optical zoom capabilities.
[0127] 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 device 600 is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 604 or transmitted via communication component 616. In some embodiments, audio component 610 also includes a speaker for outputting audio signals.
[0128] I / O interface 612 provides an interface between processing component 602 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to, home buttons, volume buttons, power buttons, and lock buttons.
[0129] Sensor assembly 614 includes one or more sensors for providing status assessments of various aspects of device 600. For example, sensor assembly 614 may detect the on / off state of device 600, the relative positioning of components such as the display and keypad of device 600, changes in the position of device 600 or a component of device 600, the presence or absence of user contact with device 600, the orientation or acceleration / deceleration of device 600, and temperature changes of device 600. Sensor assembly 614 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. 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, sensor assembly 614 may also include an accelerometer, a gyroscope, a magnetometer, a pressure sensor, or a temperature sensor.
[0130] Communication component 616 is configured to facilitate wired or wireless communication between device 600 and other devices. Device 600 can access wireless networks based on communication standards, such as WiFi, 2G, or 3G, or combinations thereof. In one exemplary embodiment, communication component 616 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 616 also includes a near-field communication (NFC) module to facilitate short-range communication. 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.
[0131] In an exemplary embodiment, device 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, microcontrollers, microprocessors, or other electronic components to perform the method for establishing the above-described list data structure.
[0132] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 604 including instructions, which can be executed by a processor 620 of the device 600 to complete the method for establishing the list data structure described above. For example, the non-transitory computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.
[0133] In another exemplary embodiment, a computer program product is also provided, the computer program product comprising a computer program executable by a programmable device, the computer program having a code portion for performing the above-described method for establishing a list data structure when executed by the programmable device.
[0134] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of this disclosure. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the following claims.
[0135] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.
Claims
1. A method for establishing a list data structure, characterized in that, include: In response to the system startup operation, count the number of multimedia files in the root directory of the preset disk and record the attribute information of the root directory; Traverse the directory entries of the root directory. If it is determined that a folder directory entry in the root directory has been traversed, count the number of multimedia files included in the folder directory entry and record the attribute information of the folder directory entry until all folder directory entries included in the preset disk have been traversed. Based on the attribute information of the root directory and the attribute information of the folder directory items, establish a folder list data structure; The folder list data structure includes attribute information for multiple folders, and the multiple folders include the root directory and the folders included under the root directory. The attribute information is used to determine the full path of the target multimedia file in the search request. The method further includes: obtaining the search request, the search request including the ID of the target multimedia file to be searched; determining the position of the target multimedia file in the folder list data structure according to the ID of the target multimedia file and the number of multimedia files in the plurality of folders, wherein the position includes the target folder where the target multimedia file is located and the sequence number of the target multimedia file among all multimedia files displayed in the directory entry of the target folder; generating the full path of the target multimedia file on the preset disk according to the attribute information of the plurality of folders and the position, the full path being used to respond to the search request.
2. The method according to claim 1, characterized in that, The directory entries traversed in the root directory include: Traverse the directory entries of the root directory according to the depth-first principle; The folder list data structure includes the attribute information of the root directory and the attribute information of the folders located after the root directory, which are traversed sequentially according to the depth-first principle.
3. The method according to claim 1, characterized in that, Determining the position of the target multimedia file in the folder list data structure based on the target multimedia file's ID and the number of multimedia files in the multiple folders includes: The target folder containing the target multimedia file is determined based on the target multimedia file's ID and the number of multimedia files in the multiple folders. Based on the target multimedia file's number, the number of multimedia files in the folder preceding the target folder in the folder list data structure, and the number of multimedia files in the target folder, determine the sequence number of the target multimedia file among 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 based on the sequence number of all multimedia files displayed in the directory entry of the target folder and the target multimedia file.
4. The method according to claim 1, characterized in that, The attribute information includes the parent cluster number, directory entry offset, starting cluster number, and the number of multimedia files. Generating the full path of the target multimedia file on the preset disk based on the attribute information of the multiple folders and the location includes: The file name of the target multimedia file is determined based on the sequence number of all multimedia files displayed in the directory entry of the target folder and the directory entry of the target folder; The target folder is set as the current folder, and it is determined whether the current folder is the root directory of the preset disk; If it is determined that the current folder is not the root directory, the parent folder of the current folder is found according to the parent cluster number of the current folder and the starting cluster number in the folder list data structure. The folder name of the current folder is determined according to the directory item offset of the current folder and the directory item of the parent folder. The parent folder is then determined as the new current folder until the new current folder is determined to be the root directory. Based on the file name of the target multimedia file, all determined folder names, and the disk name of the preset disk, generate the full path of the target multimedia file on the preset disk.
5. The method according to claim 4, characterized in that, Determining whether the current folder is the root directory includes: Determine whether the parent cluster number of the current folder is a preset identifier; If the parent cluster number of the current folder is a preset identifier, then the current folder is determined to be the root directory.
6. The method according to claim 1, characterized in that, The folder directory entry carries a folder identifier, and the method further includes: If a target entry carrying a folder identifier is found during traversal of the directory entries in the root directory, it is determined that the folder directory entry in the root directory has been traversed.
7. A device for creating a list data structure, characterized in that, include: The response module is configured to respond to the system startup operation, count the number of multimedia files in the root directory of the preset disk, and record the attribute information of the root directory. The traversal module is configured to traverse the directory entries of the root directory. When it is determined that a folder directory entry of the root directory has been traversed, the number of multimedia files included in the folder directory entry is counted and the attribute information of the folder directory entry is recorded until all folder directory entries included in the preset disk have been traversed. The generation module is configured to establish a folder list data structure based on the attribute information of the root directory and the attribute information of the folder directory items; The folder list data structure includes attribute information for multiple folders, and the multiple folders include the root directory and the folders included under the root directory. The attribute information is used to determine the full path of the target multimedia file in the search request. The apparatus for establishing the list data structure further includes: The acquisition module is configured to acquire a search request, the search request including the number of the target multimedia file to be searched. The location determination module is configured to determine 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 multiple folders, wherein the location includes the target folder where the target multimedia file is located and the sequence number of the target multimedia file among all multimedia files displayed in the directory entry of the target folder; The full path generation module is configured to generate the full path of the target multimedia file on the preset disk based on the attribute information of the multiple folders and the location, and the full path is used to respond to the search request.
8. A device for creating a list data structure, characterized in that, include: processor; Memory used to store processor-executable instructions; The processor is configured to perform the method as described in any one of claims 1-6.
9. A computer-readable storage medium having computer program instructions stored thereon, characterized in that, When executed by a processor, the program instructions implement the steps of the method described in any one of claims 1-6.
Citation Information
Patent Citations
Method for re-setting up catalogue structure and restoring data in FAI volume
CN1945571A