File attribute appending method, computing device, and storage medium
By adding custom attribute fields and operation functions to files at the operating system level, the problems of high storage overhead and cross-application unavailability in existing file classification and management technologies are solved. This enables the storage and retrieval of custom attributes and supports file classification and management across applications.
Patent Information
- Application Number
- CN202111341587.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-18
- Publication Date
- 2025-12-12
- Estimated Expiration
- 2041-09-18
AI Technical Summary
In existing technologies, operating systems cannot effectively manage and classify various types of files, and index tables and file extension methods have problems such as high storage overhead and inaccessibility across applications.
At the operating system level, custom attributes are stored and managed by adding custom attribute fields and operation functions to the attribute structure of the inode, and setting and retrieving interfaces are provided so that users can customize file attributes.
It enables custom file categorization and management at the operating system level, is effective across applications, reduces storage overhead, and supports the appending and reading of user-defined attributes.
Smart Images

Figure CN114090525B_ABST
Abstract
Description
[0001] This application is a divisional application of the invention patent application 202111097112X filed on September 18, 2021. TECHNICAL FIELD
[0002] The present application relates to the technical field of computer and operating system, in particular to a file attribute appending method, a computing device and a storage medium. BACKGROUND
[0003] Linux and other Unix-like operating systems maintain consistency by treating everything as a file. The entire file system can be roughly divided into three layers. The uppermost layer is the user layer, that is, the user's application program. The second layer is the kernel space, which mainly encapsulates device drivers and virtual file systems, hides the details of different hardware devices, and provides a unified API interface for different file systems. The third layer is the hardware layer, that is, the real physical device.
[0004] With the development of modern computers, the types of files are increasingly diverse. The file classification method provided by the operating system cannot meet people's needs for file classification and management. For example, using AI to classify pictures by location, person, and animal, and classifying movies by region, type, and event.
[0005] In the prior art, some software classifies files by establishing an index table. The implementation of the index table is as follows: an index table is established in the disk, and when a user classifies a file, the user-specified file type and specific path are saved in the table. When the user obtains a certain type of file, the types in the index table can be filtered to output all files of that type. This implementation scheme of establishing an index table not only requires additional storage, but also the classification established can only be recognized in the software itself, and the classification information will be lost when browsing with other software.
[0006] Another solution is to classify files by file suffix. Based on the file suffix, the type of the file is determined, so that file types such as music, movies, and pictures can be distinguished. However, this solution can only distinguish types that can be recognized by the system, and cannot subdivide a certain type of file. In addition, if the suffix is modified, the corresponding file cannot be classified according to the file suffix.
[0007] Therefore, there is a need for a file attribute appending method that can classify and manage files by adding custom attributes to solve the problems in the above technical solutions. SUMMARY
[0008] To this end, the present application provides a file attribute appending method to try to solve or at least alleviate the above problems.
[0009] According to an aspect of the present application, there is provided a file attribute appending method, executed in an operating system of a computing device, comprising the steps of: receiving a request of a client to add a custom attribute to a file by calling a set custom attribute interface, and writing the custom attribute to a disk through a virtual file system; receiving a request of the client to obtain the custom attribute of the file by calling a get custom attribute interface, and obtaining the custom attribute of the file from the disk through the virtual file system and returning the custom attribute to the client.
[0010] Optionally, in the file attribute appending method according to the present application, the disk stores an index node corresponding to the file, the index node comprises an attribute structure body adapted to store attribute information of the file, and the attribute information comprises the custom attribute.
[0011] Optionally, in the file attribute appending method according to the present application, the step of writing the custom attribute to the disk comprises storing the custom attribute in the attribute structure body of the index node corresponding to the file, and the step of obtaining the custom attribute of the file from the disk comprises obtaining the custom attribute of the file from the attribute structure body of the index node corresponding to the file.
[0012] Optionally, in the file attribute appending method according to the present application, the step of obtaining the custom attribute of the file from the attribute structure body of the index node corresponding to the file comprises: obtaining a parent directory file corresponding to the file, finding an index number corresponding to a file name from the parent directory file, obtaining a corresponding attribute structure body based on the index number, and obtaining the custom attribute of the file from the attribute structure body.
[0013] Optionally, in the file attribute appending method according to the present application, before receiving the request of the client to add the custom attribute to the file by calling the set custom attribute interface, the method comprises the steps of: adding a user-added custom attribute length field and a user-added custom attribute content field in the attribute structure body, so as to store the user-added custom attribute in the attribute structure body.
[0014] Optionally, in the file attribute appending method according to the present application, the index node further comprises an operation structure, and before receiving a request of the client for adding a custom attribute to the file by calling a setting custom attribute interface, the method further comprises the steps of: adding an operation function of the custom attribute in the operation structure, the operation function comprising a setting custom attribute function and an obtaining custom attribute function; generating a corresponding setting custom attribute interface based on the setting custom attribute function, and generating a corresponding obtaining custom attribute interface based on the obtaining custom attribute function.
[0015] Optionally, in the file attribute appending method according to the present application, before receiving a request of the client for adding a custom attribute to the file by calling an obtaining custom attribute interface, the method further comprises the steps of: receiving a request of the client for opening the file by a system call, and returning the opened file to the client by a virtual file system; and receiving file content written by the client by a system call, and writing the file content to a disk by the virtual file system.
[0016] Optionally, in the file attribute appending method according to the present application, before receiving a request of the client for adding a custom attribute to the file by calling an obtaining custom attribute interface, the method further comprises the steps of: receiving a request of the client for opening the file by a system call, and returning the opened file to the client by a virtual file system; and receiving a request of the client for reading file content by a system call, obtaining the corresponding file content from a disk by the virtual file system, and returning the file content to the client.
[0017] Optionally, in the file attribute appending method according to the present application, the attribute information comprises one or more of position information of the file on the disk, file size, permission information, and modification time.
[0018] According to an aspect of the present application, there is provided a computing device comprising: at least one processor; and a memory storing program instructions configured to be executed by the at least one processor, the program instructions comprising instructions for performing the file attribute appending method as described above.
[0019] According to an aspect of the present application, there is provided a readable storage medium storing program instructions, which, when read and executed by a computing device, cause the computing device to perform the method as described above.
[0020] According to the technical scheme of the present application, a file attribute appending method is provided, by adding a related field for storing a custom attribute in an inode attribute structure body on a disk, and adding an operation function related to the custom attribute in an operation structure body, so that a user can add a custom attribute to a file by calling a setting custom attribute interface, and store the custom attribute in the attribute structure body. Moreover, the user can acquire the custom attribute stored in the corresponding attribute structure body on the disk by calling an acquiring custom attribute interface. In this way, according to the technical scheme of the present application, a custom attribute is appended on the basis of an original file attribute, and the custom attribute can be read, based on which the user can realize custom classification and management of files by adding custom attributes to the files. Moreover, the file attribute appending method of the present application is realized at an operating system level, so as to be suitable for various applications running on the operating system, and realize the effect of custom classification of files across applications. BRIEF DESCRIPTION OF DRAWINGS
[0021] To the accomplishment of the foregoing and related ends, certain illustrative aspects are described herein in connection with the following description and the annexed drawings. These aspects are indicative of various ways in which the principles disclosed herein can be practiced and all aspects and equivalents thereof are intended to be within the scope of the claimed subject matter. The foregoing and other objects, features, and advantages of the disclosure will be apparent from the following detailed description taken in conjunction with the accompanying drawings in which like reference characters refer to like elements in the several views. The detailed description implements the illustrative aspects and the best mode contemplated for carrying out the disclosure. The above and further advantages of the present disclosure can be better understood by referring to the following description in conjunction with the accompanying drawings in which:
[0022] Figure 1 A schematic diagram of a computing device 100 according to one embodiment of the present application is shown;
[0023] Figure 2 A flow chart of a file attribute appending method 200 according to one embodiment of the present application is shown;
[0024] Figure 3 A structural schematic diagram of a file system according to one embodiment of the present application is shown;
[0025] Figure 4 A structural schematic diagram of an inode according to one embodiment of the present application is shown;
[0026] Figure 5 A timing diagram of adding a custom attribute to a file according to one embodiment of the present application is shown; and
[0027] Figure 6 A timing diagram of acquiring a custom attribute of a file according to one embodiment of the present application is shown. DETAILED DESCRIPTION
[0028] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
[0029] Figure 1 This is a schematic block diagram of an example computing device 100.
[0030] like Figure 1 As shown, in the basic configuration 102, the computing device 100 typically includes system memory 106 and one or more processors 104. Memory bus 108 can be used for communication between processor 104 and system memory 106.
[0031] Depending on the desired configuration, processor 104 can be any type of processor, including but not limited to: microprocessor (UP), microcontroller (UC), digital information processor (DSP), or any combination thereof. Processor 104 may include one or more levels of cache such as L1 cache 110 and L2 cache 112, processor core 114, and registers 116. Example processor core 114 may include an arithmetic logic unit (ALU), floating-point unit (FPU), digital signal processing core (DSP core), or any combination thereof. Example memory controller 118 may be used with processor 104, or in some implementations, memory controller 118 may be an internal part of processor 104.
[0032] Depending on the desired configuration, system memory 106 can be any type of memory, including but not limited to volatile memory (such as RAM), non-volatile memory (such as ROM, flash memory, etc.), or any combination thereof. System memory 106 may include operating system 120, one or more applications 122, and program data 124. In some embodiments, application 122 may be arranged to execute instructions on the operating system using program data 124 by one or more processors 104.
[0033] The computing device 100 also includes a storage device 132, which includes a removable storage device 136 and a non-removable storage device 138.
[0034] The computing device 100 can also include a storage interface bus 134. The storage interface bus 134 enables communication between the storage devices 132 (e.g., removable storage 136 and non-removable storage 138) and the basic configuration 102 via the bus / interface controller 130. The operating system 120, the application programs 122, and the data 124 are likely stored on the removable storage 136 and / or the non-removable storage 138 during operation of the computing device 100 by a user. Such software components can be loaded into the system memory 106 via the storage interface bus 134, and executed by the one or more processors 104 as it is being loaded or is subsequently being executed.
[0035] The computing device 100 can also include a bus / interface bus 140 that facilitates communication from various interface devices (e.g., output devices 142, peripheral interfaces 144, and communication devices 146) to the basic configuration 102 via the bus / interface controller 130. Example output devices 142 include a graphics processing unit 148 and an audio processing unit 150, which can be configured to facilitate communication to various external devices such as a display or speakers via one or more A / V ports 152. Example peripheral interfaces 144 can include a serial interface controller 154 or a parallel interface controller 156, which can be configured to facilitate communication to various external devices such as input devices (e.g., keyboard, mouse, pen, voice input device, touch input device) or other peripheral devices (e.g., printer, scanner, etc.) via one or more I / O ports 158. An example
[0036] The network communication link can be one example of a communication media. Communication media can typically be embodied by computer readable instructions, data structures, program modules, and / or other data in a modulated data signal, such as a carrier wave or other transport mechanism, and can include any information delivery media. A "modulated data signal" can be a signal that has one or more of its characteristics set or changed in such a manner as to encode information in the signal. By way of example, and not limitation, communication media can include wired media such as a wired network or direct-wired connection, and wireless media such as acoustic, radio frequency (RF), microwave, infrared (IR) and other wireless media. The term computer readable media as used herein can include both storage media and communication media.
[0037] The computing device 100 can be implemented as a personal computer including desktop and notebook configurations. Of course, the computing device 100 can also be implemented as part of a small form factor portable (or mobile) electronic device such as a cell phone, a digital camera, a personal digital assistant (PDA), a personal media player device, a wireless web browsing device, a personal headset, an application specific device, or a hybrid device that can include any of the above functions. The computing device 100 can even be implemented as a server, such as a file server, a database server, an application server, and a web server, among others. Embodiments of the present application are not limited in this regard.
[0038] In an embodiment according to the present application, the operating system 120 of the computing device 100 is configured to perform the file attribute appending method 200 according to the present application. In this regard, the operating system 120 of the computing device 100 contains a plurality of program instructions for performing the file attribute appending method 200 according to the present application, such that the file attribute appending method 200 according to the present application can be performed in the operating system 120 of the computing device 100.
[0039] Figure 2 A flow chart of the file attribute appending method 200 according to an embodiment of the present application is shown. The file attribute appending method 200 can be performed in the operating system of a computing device, such as the aforementioned computing device 100. As shown in Figure 2 The method 200 includes steps S210-S220.
[0040] It should be noted that the file attribute appending method 200 according to the present application can be widely applied to various Unix-like operating systems including the Linux operating system. The present application does not limit the specific type of the operating system.
[0041] The file attribute appending method 200 according to the present application can be implemented based on a file system. Figure 3 A structural diagram of a file system according to an embodiment of the present application is shown. As shown in Figure 3 The file system includes a user space, a kernel space, and a hardware layer connected in sequence from top to bottom. The user space can be arranged with one or more application programs. The kernel space can encapsulate a virtual file system and a device driver. The kernel space hides the details of different hardware devices and provides a uniform interface for different file systems, and provides the application programs in the user space with the use of system calls. The hardware layer includes a disk for storing data.
[0042] It should be noted that the disk stores an index node corresponding to the file, and the index node includes an attribute structure body, through which one or more attribute information of the file can be stored. Here, the attribute information stored in the attribute structure body includes one or more of the file location information on the disk, file size, permission information, modification time, but is not limited to the attribute information listed here.
[0043] It should be noted that according to the attribute structure body of the existing index node on the disk, only the fixed attribute of the file itself is stored, and the custom attribute information added by the user cannot be stored. Based on this, according to one embodiment of the present application, two fields are added in the attribute structure body before step S210 is performed, which are user added custom attribute length field (user_attr_data_length) and user added custom attribute content field (p_user_attr_data), thereby forming a new attribute structure body.
[0044] Referring to Figure 4 The structure diagram of the index node according to one embodiment of the present application is shown, which includes an attribute structure body suitable for storing various attribute information, and the attribute structure body includes p_user_attr_data and len (representing user_attr_data_length). Based on the user_attr_data_length field and the p_user_attr_data field in the attribute structure body, the custom attribute added by the user can be stored in the new attribute structure body of the index node.
[0045] Based on the above setting, in the attribute structure body of the index node of the present application, various attribute information of the file can be stored, wherein the fixed attribute of the file itself can be stored, and one or more custom attributes added by the user can also be stored.
[0046] In addition, the index node also includes an operation structure body (struct inode_operations), and by adding an operation function for the custom attribute in the operation structure body, the attribute stored in the attribute structure body of the index node can be updated through the added operation function.
[0047] In one embodiment, the operation functions for custom attributes include, for example, functions for setting and retrieving custom attributes. By adding the functions `setcustomattr` and `getcustomattr` to the existing operation structure's function table, user-defined file attributes can be set and retrieved. Furthermore, a corresponding interface for setting custom attributes can be generated based on the function for setting custom attributes, and a corresponding interface for retrieving custom attributes can be generated based on the function for retrieving custom attributes. In this way, users can add custom attributes to files by calling the interface for setting custom attributes, and retrieve the corresponding custom attributes by calling the interface for retrieving custom attributes.
[0048] Based on the above modifications to the index node data structure, the file attribute appending method 200 of the present invention can be implemented by adding fields related to custom attributes to the attribute structure of the index node and adding operation functions related to custom attributes to the operation structure.
[0049] The following combination Figure 2 The document attribute appending method 200 of the present invention will be described in detail below.
[0050] like Figure 2 As shown, in step S210, a request from a client to add custom attributes to a file by calling the "Set Custom Attributes" interface is received, and the custom attributes of the file are written to the disk through the virtual file system. Here, the client includes one or more applications deployed in user space, which run on the operating system. That is, the user can call the "Set Custom Attributes" interface in one or more applications on the client to request the addition of custom attributes to a file. The operating system can receive requests from the user in any application to add custom attributes to a file by calling the "Set Custom Attributes" interface.
[0051] Specifically, custom attributes added to a file can be stored in the attribute structure of the inode corresponding to the file on disk (i.e., the aforementioned attribute structure with the user-added custom attribute length field and user-added custom attribute content field added). In other words, custom attributes are stored in the attribute structure of the inode based on the user-added custom attribute length field and the user-added custom attribute content field.
[0052] Thus, the file attribute information stored in the attribute structure of the index node of the present invention includes not only the fixed attributes that the file itself has, but also one or more custom attributes that the user adds to the file by calling the custom attribute setting interface.
[0053] In one embodiment, the custom attribute added by the user for the file through calling the setting custom attribute interface, for example, includes music, movie, picture, so as to customize the classification of the file based on the custom attribute of music, movie, picture, etc. It should be noted that the present application is not limited to the specific content of the custom attribute, and the custom attribute can be set by the user according to the actual needs.
[0054] In step S220, the receiving client acquires the request of the custom attribute of the file through calling the acquiring custom attribute interface, acquires the custom attribute of the file from the disk through the virtual file system, and returns the custom attribute to the client. Accordingly, the user can call the acquiring custom attribute interface in one or more applications of the client to request to acquire the custom attribute of the file. The operating system can receive the request of the user to acquire the custom attribute of the file through calling the acquiring custom attribute interface in any one application.
[0055] Here, as described above, the custom attribute of the file is saved in the attribute structure of the inode corresponding to the file on the disk, and accordingly, the virtual file system can acquire the custom attribute of the file from the attribute structure of the inode corresponding to the file on the disk.
[0056] In one embodiment, acquiring the custom attribute of the file from the attribute structure of the inode corresponding to the file can be implemented by the following method:
[0057] Acquiring the upper directory file corresponding to the file, and searching for the index number corresponding to the file name from the upper directory file. Here, the upper directory file corresponding to the file stores the file name of each file under the upper directory and the index number corresponding to the file name. In this way, the index number corresponding to the file name can be searched from the upper directory file based on the file name.
[0058] Further, the corresponding attribute structure can be acquired from the corresponding inode based on the index number, so that the custom attribute of the file can be acquired from the attribute structure.
[0059] In one embodiment, before step S210 is performed, that is, before the receiving client acquires the request of the custom attribute of the file through calling the setting custom attribute interface, the step of normally writing the file is performed first.
[0060] Figure 5 A timing diagram of adding a custom attribute for a file according to one embodiment of the present application is shown. As shown in FIG. 2, the user can add a custom attribute for a file through calling the setting custom attribute interface in the client, and the custom attribute of the file can be acquired through calling the acquiring custom attribute interface in the client. Figure 5As shown, first, a request of opening a file by a client through a system call is received, and in response to the request of the client, the opened file is returned to the client through a virtual file system. Then, a request of writing file content by the client through a system call is received, and the file content is written to a disk through the virtual file system. After the file content is written to the disk, a request of adding a custom attribute (i.e., an extended attribute) to the file by the client through a call of setting a custom attribute interface is received, and the custom attribute of the file is written to the disk through the virtual file system to realize updating the extended attribute of the file. Finally, a request of closing the file by the client through a system call is received, and the file is closed through the virtual file system.
[0061] In one embodiment, before step S220 is performed, i.e., before a request of the client of acquiring a custom attribute of a file through a call of acquiring a custom attribute interface is received, a step of normally reading the file is performed.
[0062] Figure 6 A timing diagram of acquiring a custom attribute of a file according to one embodiment of the present application is shown in FIG. 6. Figure 6 As shown, first, a request of opening a file by a client through a system call is received, and in response to the request of the client, the opened file is returned to the client through a virtual file system. Then, a request of reading file content by the client through a system call is received, and the corresponding file content is acquired from a disk through the virtual file system, and the file content is returned to the client. After the file content is returned to the client, a request of acquiring a custom attribute (i.e., an extended attribute) of the file by the client through a call of acquiring a custom attribute interface is received, and the custom attribute of the file is acquired from the disk through the virtual file system, and the custom attribute is returned to the client to realize reading the extended attribute of the file. Finally, a request of closing the file by the client through a system call is received, and the file is closed through the virtual file system.
[0063] In one embodiment, the original inode attribute structure body is as follows:
[0064]
[0065] In the original attribute structure body, in addition to the attributes of the file itself, no additional attribute defined by a user can be saved, so that the custom attribute cannot be added to the file.
[0066] According to an implementation of the present application, the original attribute structure is modified, and a user_attr_data_length field and a p_user_attr_data field are added in the original attribute structure, where the user_attr_data_length represents the length of the user-added custom attribute, and the p_user_attr_data field represents the content of the user-added custom attribute. The new attribute structure obtained after the modification is as follows:
[0067]
[0068] It should be noted that, in order not to occupy too much disk space, the length of the user-added custom attribute should not be too long, and the specific size can be determined according to the length of the string input by the user. In an implementation, the maximum length of the user_attr_data_length field is 32 bytes. The user-added custom attribute can be controlled in the following format: attr1, attr2, attr3, and each attribute is separated by an English comma, and the encoding and decoding of the format can be controlled by the upper-layer application.
[0069] In an embodiment, the original operation structure (struct inode_operations) is as follows:
[0070]
[0071] According to an implementation of the present application, the original operation structure is modified, and a setcustomattr function and a getcustomattr function are added in the operation function table of the original operation structure, so as to add the custom attribute to the file through the setcustomattr function, and obtain the custom attribute corresponding to the file through the getcustomattr function. The new operation structure obtained after the modification is as follows:
[0072]
[0073] According to the file attribute appending scheme of the present application, by adding the relevant field for storing the custom attribute in the attribute structure body of the inode on the disk, and adding the operation function related to the custom attribute in the operation structure body, the user can add the custom attribute to the file by calling the setting custom attribute interface, and store the custom attribute in the attribute structure body. And the user can acquire the custom attribute stored in the corresponding attribute structure body on the disk by calling the acquiring custom attribute interface. In this way, according to the technical scheme of the present application, the custom attribute is added on the basis of the original file attribute, and the custom attribute can be read, based on which the user can realize the classification and management of the file by adding the custom attribute to the file. And the file attribute appending method of the present application is realized at the operating system level, thus being suitable for various applications running on the operating system, and realizing the effect of classifying the file across the applications.
[0074] The various techniques described herein can be implemented in connection with hardware or software or, where appropriate, with a combination of both. Thus, the methods and apparatus of the present application, or certain aspects or portions thereof, can take the form of program code (i.e., instructions) embodied in tangible media, such as removable hard disks, U disks, floppy diskettes, CD-ROMs, or any other machine-readable storage medium wherein, when the program code is loaded into an internal memory of the machine such as a computer, the machine becomes an apparatus for practicing the present application.
[0075] Where the program code is executed on a programmable computer, the computing device generally includes a processor, a storage medium readable by the processor (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device. The storage medium is configured to store program code which implements the file attribute appending method of the present application.
[0076] In a storage medium readable by a machine, the program code can be implemented using any of high level, low level, object oriented, visual, compiled or interpreted programming languages, combinations of the foregoing, or other techniques. Examples of the machine- readable storage medium include, but are not limited to, RAM, ROM, EEPROM, CD-ROM or any other storage device. In an example, the storage medium is removable from the computing device.
[0077] In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the application can be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been described in detail in order to not obscure the understanding of this description.
[0078] In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the application can be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been described in detail in order to not obscure the understanding of this description.
[0079] Similarly, it is to be understood that the mechanical details of the inventive features sometimes are grouped into a single embodiment, figure or description of related embodiments in the above description of example embodiments of the application for clarity purpose. There is no intention to be bound by the same features in each claim. The claims are thus to be understood in their broadest reasonable manner within the scope of the appended claims. Hence, the summary of the detailed description is expressly incorporated hereinto by reference, wherein each of the individual claims is hereby expressly incorporated by reference as a separate embodiment of the application.
[0080] Those skilled in the art will understand that the modules, or units, or components of the devices in the examples disclosed herein can be arranged in the devices as described in the examples, or alternatively can be located in one or more devices different from the devices in the examples. The modules in the foregoing examples can be combined into one module or further divided into multiple sub-modules.
[0081] Those skilled in the art will understand that the modules in the devices in the examples can be adaptively changed and disposed in one or more devices different from the examples. The modules or units or components in the examples can be combined into one module or unit or component, and further can be divided into multiple sub-modules or sub-units or sub-components. Except that at least some of such features and / or processes or units are mutually exclusive, all combinations of all features disclosed in this specification (including the accompanying claims, abstract and drawings) and all processes or units of any methods or apparatuses so disclosed can be used. Unless explicitly stated otherwise, each feature disclosed in this specification (including the accompanying claims, abstract and drawings) can be replaced by alternative features providing the same, equivalent or similar functionality.
[0082] Furthermore, to the extent that the terms "comprises", "comprising", "include", "including", and "includes" are used, these terms are intended to be inclusive in a manner similar to the term "comprising" as an open transition modifer. Furthermore, the term "its" is used in the sense that it is intended to include the singular and plural forms of the noun it modifies.
[0083] Furthermore, some of the embodiments described herein are of a "method" or a "process" that can be embodied in computer executable code that can be isolated from other code or a computer- implementable program that can be run on a computer. Any of the steps of the method or process can be performed by a programmed computer under the control of computer program code and that the computer program code can be stored in a computer readable medium such as a computer program product or memory. The program code can cause a computer to do anything that the computer is programmed to do.
[0084] As used herein, unless otherwise indicated, the use of the ordinal adjectives "first", "second", "third", etc., merely to distinguish different instances of a same object, and are not intended to imply that a sequence or order to which the objects are described in the specification adheres to any prior or future sequence or order.
[0085] While the application has been described in terms of several embodiments, those skilled in the art will recognize that the application can be practiced with modifications and alterations limited only by the spirit and scope of the claims. Additionally, although the application has been described above in the context of particular embodiments, the application can be practiced with the elements in other orders and / or used in other combinations, and / or with other elements, not expressly listed or otherwise claimed.
Claims
1. A file attribute appending method, executed in an operating system of a computing device, a disk of the computing device storing an index node corresponding to a file, the index node comprising an attribute structure body adapted to store attribute information of the file, the attribute information comprising a custom attribute, the method comprising steps of: receiving a request of a client to add the custom attribute to the file by calling a set custom attribute interface, writing the custom attribute into the attribute structure body of the index node corresponding to the file on the disk through a virtual file system, so as to customize classification of the file based on the custom attribute; receiving a request of the client to obtain the custom attribute of the file by calling a get custom attribute interface, obtaining a parent directory file corresponding to the file through the virtual file system, finding an index number corresponding to a file name from the parent directory file, obtaining the attribute structure body of the index node corresponding to the file from the disk based on the index number, obtaining the custom attribute of the file from the attribute structure body, and returning the custom attribute to the client; before receiving the request of the client to add the custom attribute to the file by calling the set custom attribute interface, comprising steps of: adding a user-added custom attribute length field and a user-added custom attribute content field in the attribute structure body, so as to store the user-added custom attribute in the attribute structure body. The index node further comprises an operation structure body, and before receiving the request of the client to add the custom attribute to the file by calling the set custom attribute interface, further comprising steps of: adding an operation function of the custom attribute in the operation structure body, the operation function comprising a set custom attribute function and a get custom attribute function; generating a corresponding set custom attribute interface based on the set custom attribute function, and generating a corresponding get custom attribute interface based on the get custom attribute function. Before receiving the request of the client to add the custom attribute to the file by calling the set custom attribute interface, further comprising steps of: receiving a request of the client to open the file through a system call, returning the opened file to the client through the virtual file system; receiving file content written by the client through the system call, and writing the file content into the disk through the virtual file system.
2. The method of claim 1, wherein, Before receiving the request of the client to obtain the custom attribute of the file by calling the get custom attribute interface, further comprising steps of: receiving a request of the client to open the file through a system call, returning the opened file to the client through the virtual file system; receiving a request of the client to read file content through the system call, obtaining the corresponding file content from the disk through the virtual file system, and returning the file content to the client.
6. A computing device, comprising: at least one processor; and a memory storing program instructions configured to be executed by the at least one processor, the program instructions comprising instructions for performing the method of any one of claims 1-5.
3. The method of claim 1, wherein, 4. The method of any one of claims 1-3, wherein, 5. The method of any one of claims 1-3, wherein, 7. A readable storage medium storing program instructions, which, when read and executed by a computing device, cause the computing device to perform the method of any one of claims 1-5.
Citation Information
Patent Citations
Data information management method and device and computer readable storage medium
CN109491983A
File protection method, computing device and storage medium
CN112989427A