A device mounting method, a computing device, and a readable storage medium

By obtaining the device keywords and permissions of the mobile storage device, the device mount and permission management are realized, and the problem of low efficiency in device permission management and dependence on the GVFS virtual file system in the existing technology is solved, and the effective management and diversified management of device permissions are realized.

CN114880722BActive Publication Date: 2025-06-27UNIONTECH SOFTWARE TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210395354.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-14
Publication Date
2025-06-27
Estimated Expiration
2042-04-14

AI Technical Summary

Technical Problem

The existing device mount method cannot effectively manage and control the permissions of mobile storage devices, cannot meet users' needs for diversified management of storage devices, and needs to rely on the GVFS virtual file system for mounting.

Method used

By obtaining the device keywords (including manufacturer logo, device model and serial number), obtaining the corresponding permissions, and authorizing the permissions to the device, realizing the device's mounting and permission management. This method can perform device mount independently of the GVFS virtual file system.

Benefits of technology

It realizes the management and control of device permissions, improves the management efficiency of device permissions, supports diversified management of mobile storage devices, and provides extensible permission management solutions at the system level.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114880722B_ABST
    Figure CN114880722B_ABST
Patent Text Reader

Abstract

The present invention discloses a device mounting method, which is executed in a computing device. The method includes: obtaining a device keyword of the device, where the keyword includes a manufacturer identifier, a device model, and / or a serial number; obtaining the permission corresponding to the device keyword; authorizing the obtained permission to the device, and mounting the device to the computing device. According to the technical solution of the present invention, the management and control of device permissions are realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technologies, and in particular, to a method for mounting a device, a computing device, and a readable storage medium. Background Art

[0002] Currently, with the development of computer technologies, there are various types of removable storage devices on the market, such as USB flash drives, external hard drives, optical drives, SD cards, mobile phones, and cameras. Removable storage devices bring convenience to computer users. At the same time, these storage devices also have a series of risks such as data leakage and computer viruses. Therefore, users' requirements for the security control of storage devices are gradually increasing to avoid the occurrence of computer security incidents.

[0003] The existing gsettings-desktop-schemas software can only set the attributes of removable storage devices to read-only, which cannot meet users' diversified management requirements for storage devices. Moreover, the existing software requires the GVFS virtual file system to mount devices and cannot achieve mounting without relying on GVFS.

[0004] For this reason, a method for mounting a device is needed to solve the problems existing in the prior art solutions. Summary of the Invention

[0005] For this reason, the present invention provides a method for mounting a device, a computing device, and a readable storage medium to solve or at least alleviate the problems mentioned above.

[0006] According to one aspect of the present invention, there is provided a method for mounting a device, which is executed in a computing device. The method includes: obtaining a device keyword of the device, where the device keyword includes a manufacturer identifier, a device model, and / or a serial number; obtaining a permission corresponding to the device keyword; authorizing the obtained permission to the device, and mounting the device on the computing device.

[0007] Optionally, in the method for mounting a device according to the present invention, a first predetermined software is installed in the computing device. Wherein, before the step of obtaining the device keyword of the device, the method further includes: reading a first configuration file of the first predetermined software and storing the read content in a hash table; reading a second configuration file of the first predetermined software and storing the read content in the hash table; if a keyword in the content read from the second configuration file already exists in the hash table, then using the permission currently corresponding to the keyword to overwrite the permission originally corresponding to the keyword in the hash table.

[0008] Optionally, in the device mounting method according to the present invention, the step of reading the second configuration file of the first predetermined software and storing the read content in a hash table includes: obtaining keywords in at least one list corresponding to the second configuration file of the first predetermined software, the permissions corresponding to the list, and storing the obtained keywords of the list and the corresponding permissions in the hash table, where the list includes a blacklist and / or a whitelist, and the number of the blacklist and the whitelist can be one or more; obtaining global attributes applicable to all devices, and associating and storing the permissions corresponding to the keywords outside the list with the global attributes in the hash table.

[0009] Optionally, in the device mounting method according to the present invention, the step of obtaining the permissions corresponding to the device keyword includes: matching the device keyword with the hash table; if the device keyword is matched in the hash table, obtaining the permissions corresponding to the device keyword in the hash table; if the device keyword is not matched in the hash table, checking whether there is a global attribute in the hash table; if there is a global attribute in the hash table, obtaining the permissions corresponding to the global attribute; if there is no global attribute in the hash table, obtaining the default permissions.

[0010] Optionally, in the device mounting method according to the present invention, it further includes: calling the dbus interface of the first predetermined software through the virtual file system.

[0011] Optionally, in the device mounting method according to the present invention, it further includes: modifying the second configuration file through the second predetermined software, which includes: calling the dbus interface of the first predetermined software through the second predetermined software; determining whether the keyword corresponding to the modification content for modifying the second configuration file belongs to a removable storage medium; if the keyword corresponding to the modification content belongs to a removable storage medium, modifying the second configuration file through the configuration file operation function in the first predetermined software; if the keyword corresponding to the modification content does not belong to a removable storage medium, no modification is made.

[0012] Optionally, in the device mounting method according to the present invention, it further includes: querying the permissions of the device to be queried through the second predetermined software, which includes: calling the dbus interface of the first predetermined software through the second predetermined software; obtaining the device keyword of the device to be queried; querying the device keyword of the device to be queried in the hash table; if the device keyword of the device to be queried exists in the hash table, returning the permissions corresponding to the device keyword of the device to be queried in the hash table; if the device keyword of the device to be queried does not exist in the hash table, returning the default permissions.

[0013] Optionally, in the device mounting method according to the present invention, before the step of obtaining the device key of the device, it further includes: determining whether the device is a removable storage medium; if the device is a removable storage medium, continue to execute the step of obtaining the device key of the device; if the device is not a removable storage medium, directly authorize the default permission to the device and mount the device to the computing device.

[0014] Optionally, in the device mounting method according to the present invention, the permission corresponding to the key in the first configuration file is the default permission.

[0015] Optionally, in the device mounting method according to the present invention, the key includes the manufacturer identifier, the device model, and / or the serial number.

[0016] Optionally, in the device mounting method according to the present invention, the permissions include read-only permission, read-write permission, and / or refusal to mount.

[0017] Optionally, in the device mounting method according to the present invention, the permission corresponding to the global attribute is one of read-only permission, read-write permission, and refusal to mount.

[0018] Optionally, in the device mounting method according to the present invention, the default permission is one of read-only permission, read-write permission, and refusal to mount.

[0019] Optionally, in the device mounting method according to the present invention, the first predetermined software is udisks or udisks2.

[0020] Optionally, in the device mounting method according to the present invention, the virtual file system is GVFS.

[0021] According to another aspect of the present invention, there is provided a computing device, including: at least one processor; a memory storing program instructions, wherein the program instructions are configured to be executed by the at least one processor, and the program instructions include instructions for executing the method as described above.

[0022] According to still another aspect of the present invention, there is provided a readable storage medium storing program instructions, which, when read and executed by a computing device, cause the computing device to execute the method as described above.

[0023] According to the technical solution of the present invention, by storing the manufacturer identifier, device model, and serial number of the storage device, the corresponding device permissions are obtained and authorized to the corresponding device during device mounting, realizing the management and control of device permissions. Moreover, through the cooperation of the list and the configuration file, the management efficiency of device permissions is improved.

[0024] Furthermore, the present invention realizes the permission management and control of mobile storage devices based on udisks or udisks2. It also realizes the permission control management of mobile storage devices based on a virtual file system. The present invention implements a permission management scheme for mobile storage devices at the system level, which has scalability, and upper-layer software can implement richer function expansions according to this scheme.

[0025] The above description is only an overview of the technical solution of the present invention. In order to be able to understand the technical means of the present invention more clearly, it can be implemented according to the content of the specification. And in order to make the above and other purposes, features and advantages of the present invention more obvious and understandable, the following specifically illustrates the specific embodiments of the present invention. Brief Description of the Drawings

[0026] To achieve the above and related purposes, certain illustrative aspects are described herein in connection with the following description and drawings, which indicate various ways in which the principles disclosed herein can be practiced, and all aspects and their equivalent aspects are intended to fall within the scope of the claimed subject matter. By reading the following detailed description in conjunction with the drawings, the above and other purposes, features and advantages of the present disclosure will become more apparent. Throughout the present disclosure, like reference numerals generally refer to like parts or elements.

[0027] Figure 1 FIG. 1 shows a schematic diagram of a computing device 100 according to an embodiment of the present invention;

[0028] Figure 2 FIG. 2 shows a flowchart of a device mounting method 200 in the initialization stage according to an embodiment of the present invention;

[0029] Figure 3 FIG. 3 shows a flowchart of a device mounting method 300 according to another embodiment of the present invention;

[0030] Figure 4 FIG. 4 shows a flowchart of a configuration file modification method 400 according to an embodiment of the present invention;

[0031] Figure 5 FIG. 5 shows a flowchart of a method 500 for querying device permissions according to an embodiment of the present invention; and

[0032] Figure 6 FIG. 6 shows a flowchart of a device mounting method 600 according to yet another embodiment of the present invention. Detailed Description of the Embodiments

[0033] Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided so that the present disclosure can be more thoroughly understood and the scope of the present disclosure can be fully conveyed to those skilled in the art.

[0034] The device mounting method of the present invention is executed in a computing device. The computing device can be any device with storage and computing capabilities, which can be implemented, for example, as a server, a workstation, etc., or as a personal configured computer such as a desktop computer, a notebook computer, or as a terminal device such as a mobile phone, a tablet computer, a smart wearable device, an Internet of Things device, etc., but is not limited thereto.

[0035] Figure 1 A schematic diagram of a computing device 100 according to an embodiment of the present invention is shown. It should be noted that, Figure 1 The shown computing device 100 is only an example. In practice, the computing device for implementing the device mounting method of the present invention can be any model of device, and its hardware configuration can be the same as Figure 1 the shown computing device 100, or can be different from Figure 1 the shown computing device 100. In practice, the computing device for implementing the device mounting method of the present invention can add or delete hardware components of Figure 1 the shown computing device 100, and the present invention does not limit the specific hardware configuration of the computing device.

[0036] As Figure 1 shown, in the basic configuration 102, the computing device 100 typically includes a system memory 106 and one or more processors 104. A memory bus 108 can be used for communication between the processor 104 and the system memory 106.

[0037] Depending on the desired configuration, the processor 104 can be any type of processing, including but not limited to: microprocessor (μP), microcontroller (μC), digital signal processor (DSP), or any combination thereof. The processor 104 can include one or more levels of cache such as a level 1 cache 110 and a level 2 cache 112, a processor core 114, and registers 116. An exemplary processor core 114 can include an arithmetic logic unit (ALU), a floating point unit (FPU), a digital signal processing core (DSP core), or any combination thereof. An exemplary memory controller 118 can be used with the processor 104, or in some implementations, the memory controller 118 can be an internal part of the processor 104.

[0038] 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. Physical memory in a computing device generally refers to volatile memory RAM, and data on a disk needs to be loaded into physical memory before it can be read by processor 104. System memory 106 can include an operating system 120, one or more applications 122, and program data 124. In some embodiments, application 122 can be arranged to execute instructions on an operating system by one or more processors 104 using program data 124. The operating system 120 can be, for example, Linux, Windows, etc., which includes program instructions for handling basic system services and performing hardware-dependent tasks. Application 122 includes program instructions for implementing various user-desired functions. Application 122 can be, for example, a browser, instant messaging software, software development tools (such as integrated development environment IDE, compiler, etc.), but is not limited thereto. When application 122 is installed in computing device 100, a driver module can be added to operating system 120.

[0039] When computing device 100 starts running, processor 104 reads the program instructions of operating system 120 from memory 106 and executes them. Application 122 runs on top of operating system 120 and uses the interfaces provided by operating system 120 and the underlying hardware to implement various user-desired functions. When the user starts application 122, application 122 is loaded into memory 106, and processor 104 reads and executes the program instructions of application 122 from memory 106.

[0040] Computing device 100 further includes a storage device 132. Storage device 132 includes a removable storage 136 and a non-removable storage 138, and both removable storage 136 and non-removable storage 138 are connected to a storage interface bus 134.

[0041] The computing device 100 may also include an interface bus 140 that facilitates communication from various interface devices (e.g., output device 142, peripheral interface 144, and communication device 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. They may be configured to facilitate communication with various external devices such as a display or speakers via one or more A / V ports 152. Example peripheral interfaces 144 may include a serial interface controller 154 and a parallel interface controller 156, which may be configured to facilitate communication with external devices such as input devices (e.g., keyboard, mouse, pen, voice input device, touch input device) or other peripherals (e.g., printer, scanner, etc.) via one or more I / O ports 158. Example communication device 146 may include a network controller 160, which may be arranged to facilitate communication with one or more other computing devices 162 via one or more communication ports 164 over a network communication link.

[0042] The network communication link may be an example of a communication medium. A communication medium can generally embody computer-readable instructions, data structures, program modules in a modulated data signal such as a carrier wave or other transmission mechanism, and can include any information delivery medium. A "modulated data signal" can be a signal in which one or more of its data concentrations or its changes can encode information in the signal. As a non-limiting example, the communication medium can include wired media such as a wired network or a dedicated line network, and various wireless media such as sound, radio frequency (RF), microwave, infrared (IR), or other wireless media. The term computer-readable medium as used herein can include both storage media and communication media.

[0043] In the computing device 100 according to the present invention, the application 122 includes instructions for executing the methods 200-600 of the present invention, and the instructions may direct the processor 104 to execute the methods 200-600 of the present invention.

[0044] Figure 2 A flowchart of a device mounting method 200 in an initialization stage according to an embodiment of the present invention is shown. The method 200 is adapted to be executed in a computing device (e.g., the aforementioned computing device 100), and a first predetermined software is installed in the computing device, and the first predetermined software may be udisks or udisks2.

[0045] The first predetermined software includes a first configuration file and a second configuration file, wherein the first configuration file is a configuration file that comes with the first predetermined software and is used to save default setting options. The scope is all users, and the file name is usually udisks2-control-default.conf, which is stored in the following path / usr / lib / udisks2 / udisks2-control-default.conf.

[0046] The second configuration file is a user-defined configuration file, which is used to save the configuration options set by the current user. The configuration options are keywords and corresponding permissions. The second configuration file is usually a hidden file, and the scope is the current user. Taking udisks2 as an example, the file name of the second configuration file is usually udisks2-control.conf, which is stored in the following path ~ / .udisks2-control.conf. The priority of the second configuration file is greater than that of the first configuration file. When the configuration options corresponding to the two configuration files conflict, the configuration options of the second configuration file are used to overwrite the configuration options of the first configuration file.

[0047] The configuration file includes keywords (key) and corresponding permissions (access), where the keywords are used to identify the device, including the manufacturer's ID, device model and / or serial number. In the configuration file, the manufacturer's ID is represented by ID_VENDOR_ID, the device model is represented by ID_MODEL_ID, and the serial number is represented by ID_SERIAL_SHORT. Taking the manufacturer's ID, device model and serial number as an example, the setting format of the keyword and the corresponding permission in the configuration file can be "vendor_id:model_id:serial=access", where vendor_id is the manufacturer's ID, model_id is the device model, and serial is the serial number of the device. Here, vendor_id:model_id:serial is used as the key as a whole, and access is the permission corresponding to the key. The value of the permission can be ro, rw or no. Among them, ro (readonly), rw (readandwrite), and no represent read-only permission, read-write permission, and refusal to mount, respectively.

[0048] like Figure 2 As shown, the method 200 starts at step S210 .

[0049] In step S210, a first configuration file of a first predetermined software is read, and the content of the read first configuration file is stored in a hash table.

[0050] A hash table is a data structure accessed according to key values. By reading the first configuration file, the keywords stored in the first configuration file and the permissions corresponding to the keywords can be obtained. In this step, the keywords in the first configuration file are used as the keys in the hash table, and the permissions corresponding to the keywords in the first configuration file are stored as the values corresponding to the keys in the hash table.

[0051] Subsequently, in step S220, the second configuration file of the first predetermined software is read, and the content read from the second configuration file is stored in the hash table. If the keyword in the content read from the second configuration file already exists in the hash table, the permission originally corresponding to the keyword in the hash table is overwritten with the permission corresponding to the keyword in the second configuration file.

[0052] Specifically, the keywords in at least one list corresponding to the second configuration file of the first predetermined software and the permissions corresponding to the keywords in the list are obtained, and the keywords in the obtained list and their corresponding permissions are stored in the hash table. Among them, the at least one list can be a blacklist and / or a whitelist, and the number of blacklists and whitelists can be one or more. For example, the at least one list can be a single blacklist, or a single blacklist and a single whitelist, or two blacklists and a single whitelist, but it is not limited thereto. The specific selection method of the list and the permissions corresponding to each list can be set by those skilled in the art according to the technical solution of the present invention. The following is an illustration according to an embodiment of the present invention. In this embodiment, the second configuration file is provided with a whitelist and two blacklists. Among them, the permission corresponding to the whitelist is read / write permission, the permission corresponding to the first blacklist is read-only permission, and the permission corresponding to the second blacklist is refusal to mount. The keywords and their permissions included in the whitelist are, for example, 090a:1000:26D02CE0 = rw, where 090c:1000:26D02CE4 is the keyword and rw is the read / write permission; the first blacklist also includes keywords and their permissions, for example, 090b:1001:26D02CE1 = ro, where 090b:1001:26D02CE1 and ro are the read-only permissions; the second blacklist also includes keywords and their permissions, for example, 090c:1002:26D02CE2 = no, where 090c:1002:26D02CE2 and no are the refusal to mount. Here, the priorities of each list among the multiple lists are the same.

[0053] Then, the global attributes applicable to all devices in the second configuration file are obtained, and the keywords outside the list are associated with the permissions corresponding to the global attributes and stored in the hash table.

[0054] According to an embodiment of the present invention, in addition to corresponding to at least one list as described above, the second configuration file may further include global attributes and their corresponding permissions. The global attribute is a keyword applicable to all devices. Optionally, the manufacturer identifier, device model, and / or serial number included in the global attribute are marked as "ALL". For example, when the keyword includes the manufacturer identifier, device model, and serial number, the form of the keyword and its corresponding permission is "vendor_id:model_id:serial=access", then the global attribute and its corresponding permission can be expressed as "ALL:ALL:ALL=ro", where the global attribute is the keyword ALL:ALL:ALL applicable to all devices, and its corresponding permission is ro, representing that the permission corresponding to all devices is the read-only permission. Of course, the permission corresponding to the global attribute can also be the read-write permission or the rejection of mounting, and the present invention does not limit this.

[0055] It should be noted that the priority of the global attribute and its corresponding permission is lower than that of the list. After all the keywords and corresponding permissions in the list are stored in the hash table, the global attribute and its corresponding permission are stored in the hash table. However, since the priority of the second configuration file is higher than that of the first configuration file, the priorities of the global attribute, its corresponding permission, and the list included in the second configuration file are all higher than the default permission of the first configuration file. That is, when the configuration options corresponding to the two configuration files conflict, the configuration options of the second configuration file overwrite the configuration options of the first configuration file.

[0056] The above describes the initialization steps. The following details the device mounting method after the initialization phase is completed.

[0057] Figure 3 The flowchart of a device mounting method 300 according to an embodiment of the present invention is shown. The method 300 is adapted to be executed in a computing device (such as the aforementioned computing device 100). As Figure 3 shown, the method 300 starts from step S310.

[0058] In step S310, when a device is connected to the computing device, it is determined whether the device is a removable storage medium (i.e., a removable storage device).

[0059] If the device is not a removable storage medium, step S320 is executed to directly authorize the default permission to the device and mount the device to the computing device, without executing the subsequent steps in the method 300. The default permission can be the read-only permission, the read-write permission, or the rejection of mounting.

[0060] If the device is a removable storage medium, step S322 is executed to obtain the device keyword of the device, where the device keyword includes the manufacturer identifier, device model, and / or serial number.

[0061] According to an embodiment of the present invention, when a device is connected to a computing device, device parameters of the device are obtained. The device parameters include a manufacturer identifier, a device model, and / or a serial number. Then, the obtained device parameters are formed into a device keyword in the form of keywords in a hash table or a first configuration file and a second configuration file of a first predetermined software. For example, if the keyword in the hash table or the first configuration file or the second configuration file of the first predetermined software is composed of a manufacturer identifier, a device model, and a serial number in the form of vendor_id:model_id:serial, then the manufacturer identifier, the device model, and the serial number in the obtained device parameters are formed into the same form of vendor_id:model_id:serial as the keyword as the device keyword of the device.

[0062] After step S322, obtain the permissions corresponding to the device keyword.

[0063] According to an embodiment of the present invention, execute step S330 to match the device keyword with the keyword in the hash table.

[0064] If the device keyword is matched in the hash table, enter step S340 to obtain the permissions corresponding to the device keyword in the hash table. Then, enter step S360.

[0065] If the device keyword is not matched in the hash table, enter step S342 to check whether there is a global attribute in the hash table.

[0066] According to an embodiment of the present invention, the global attribute is a keyword applicable to all devices. Optionally, the manufacturer identifier, the device model, and / or the serial number included in the global attribute are marked as "ALL". For example, when the keyword includes a manufacturer identifier, a device model, and a serial number, and the form of the keyword and its corresponding permissions is "vendor_id:model_id:serial = access", the global attribute can be expressed as "ALL:ALL:ALL = ro", representing that the permissions corresponding to all devices are read-only permissions. Of course, the permissions corresponding to the global attribute can also be read-write permissions or reject mounting, and the present invention does not limit this.

[0067] If there is a global attribute in the hash table, enter step S350 to obtain the permissions corresponding to the global attribute. The permissions corresponding to the global attribute can be read-only permissions, read-write permissions, or reject mounting.

[0068] If there is no global attribute in the hash table, enter step S320 to obtain the default permissions.

[0069] In some cases, global attributes may not exist in the hash table. For example, the user has not set the global attributes. In this case, the general default permissions are obtained.

[0070] Finally, step S360 is executed to authorize the obtained permissions to the device and mount the device to the computing device.

[0071] According to the device mounting method of the present invention, the second configuration file can be modified by other software. Figure 4 The flowchart of the configuration file modification method 400 according to an embodiment of the present invention is shown. Method 400 starts from step S410.

[0072] In step S410, the dbus interface of the first predetermined software is called through the second predetermined software.

[0073] Among them, the second predetermined software is other software for modifying the configuration file of the first software other than the first predetermined software. Other software can modify the configuration file of the first predetermined software by calling the dbus interface of the first predetermined software, and this interface is the configuration file operation interface of the first predetermined software.

[0074] Subsequently, in step S420, it is determined whether the keyword corresponding to the modification content for modifying the second configuration file belongs to a removable storage medium.

[0075] For example, after calling the configuration file operation interface of the first predetermined software, if the original corresponding permission access001 of the keyword vendor_id001:model_id001:serial001 in the second configuration file is modified to access002, it is determined whether the device corresponding to the keyword vendor_id001:model_id001:serial001 is a removable storage medium. It can be determined whether the device is a removable storage medium by comparing the manufacturer identifier, device model, and / or serial number of the device included in the keyword.

[0076] If the keyword corresponding to the modification content belongs to a removable storage medium, step S430 is executed to modify the second configuration file through the configuration file operation function in the first predetermined software.

[0077] Optionally, functions corresponding to the GHashTable structure (GHashTable* UDisksLinuxAccess_table) in the glib library can be used to perform operations such as storing, searching, and replacing data in the hash table. After the data in the hash table is modified, it can be synchronized to the second configuration file.

[0078] If the keyword corresponding to the modified content does not belong to the removable storage medium, step S432 is executed without modification.

[0079] In step S430, then step S440 is entered, and the user can make the modified configuration file take effect by restarting the computing device.

[0080] According to the device mounting method of the present invention, the permissions of the device can also be queried through other software. Figure 5 The flowchart of the query method 500 for device permissions according to an embodiment of the present invention is shown. Method 500 starts from step S510.

[0081] In step S510, the dbus interface of the first predetermined software is called through the second predetermined software.

[0082] Among them, the second predetermined software is other software for querying device permissions other than the first predetermined software. Other software can query the permissions of the devices mounted on the computing device by calling the dbus interface of the first predetermined software, and this interface is the permission operation interface of the first predetermined software.

[0083] Subsequently, in step S520, the device keyword of the device mounted on the computing device (i.e., the device to be queried) is obtained. The device keyword includes the manufacturer identifier, device model, and / or serial number.

[0084] Subsequently, in step S530, the device keyword of the device to be queried is queried in the hash table.

[0085] Through the functions corresponding to the GHashTable structure (GHashTable* UDisksLinuxAccess_table;) in the glib library, operations such as storing, searching, and replacing data in the hash table can be performed, and the data in the hash table can be synchronized to the second configuration file after modification.

[0086] If the device keyword of the device to be queried exists in the keyword of the hash table, step S540 is executed to return the permissions corresponding to the device keyword of the device to be queried in the hash table.

[0087] If the device keyword of the device to be queried does not exist in the keyword of the hash table, step S550 is executed to return the default permissions.

[0088] Among them, the default permissions are one of read-only permissions, read-write permissions, and denied mounting, and can be set by those skilled in the art according to needs. The specific implementation of steps S520 - S550 can refer to steps S330 - S360 in the above text.

[0089] According to the device mounting method of the present invention, a device can be mounted through a virtual file system. Figure 6 FIG. 600 shows a flowchart of a device mounting method according to another embodiment of the present invention. Method 600 starts at step S610.

[0090] In step S610, when a device is connected to a computing device, a device key of the device is obtained, where the device key includes a manufacturer identifier, a device model, and / or a serial number.

[0091] Subsequently, in step S620, the dbus interface of a first predetermined software is called through the virtual file system, and this interface is a permission operation interface of the first predetermined software.

[0092] Among them, the virtual file system can be, for example, GVFS, a virtual file system of the GNOME desktop system. Of course, it can also be other virtual file systems, and the present invention does not limit this.

[0093] Subsequently, in step S630, the permission of the device is obtained, the obtained permission is authorized to the device, and the device is mounted on the computing device.

[0094] Specifically, the device key of the device to be queried is queried in the hash table. If the device key of the device to be queried exists in the hash table, the permission corresponding to the device key of the device to be queried in the hash table is returned. If the device key of the device to be queried does not exist in the hash table, the default permission is returned. The specific implementation of this step can refer to steps S330 - S360 in the above text.

[0095] According to the technical solution of the present invention, by storing the manufacturer identifier, device model, and serial number of the storage device, the corresponding device permission is obtained and authorized to the corresponding device during device mounting, realizing the management and control of device permissions. And, through the cooperation of the list and the configuration file, the management efficiency of device permissions is improved.

[0096] Furthermore, the present invention realizes the permission management and control of mobile storage devices based on udisks or udisks2. It also realizes the permission control management of mobile storage devices based on the virtual file system. The present invention realizes a permission management scheme for mobile storage devices at the system level, which has scalability, and upper-layer software can implement richer function expansions according to this scheme.

[0097] The various technologies described herein can be implemented in combination with hardware or software, or a combination thereof. Thus, the methods and devices of the present invention, or certain aspects or portions of the methods and devices of the present invention, may take the form of program code (i.e., instructions) embedded in a tangible medium, such as a removable hard disk, a USB flash drive, a floppy disk, a CD-ROM, or any other machine-readable storage medium, wherein when the program is loaded into and executed by a machine such as a computer, the machine becomes a device for practicing the present invention.

[0098] In the case where the program code is executed on a programmable computer, the mobile terminal generally includes a processor, a processor-readable storage medium (including volatile and non-volatile memories and / or storage elements), at least one input device, and at least one output device. Among them, the memory is configured to store the program code; the processor is configured to execute the device mounting method of the present invention according to the instructions in the program code stored in the memory.

[0099] By way of example and not limitation, the readable medium includes a readable storage medium and a communication medium. The readable storage medium stores information such as computer-readable instructions, data structures, program modules, or other data. The communication medium generally embodies computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transmission mechanism, and includes any information delivery medium. A combination of any of the above is also included within the scope of the readable medium.

[0100] In the specification provided herein, the algorithms and displays are not inherently related to any particular computer, virtual system, or other device. Various general-purpose systems can also be used in conjunction with the examples of the present invention. Based on the above description, the structure required to construct such a system is obvious. In addition, the present invention is not directed to any particular programming language. It should be understood that the content of the present invention described herein can be implemented using various programming languages, and the description of the specific language above is to disclose the best mode of the present invention.

[0101] In the specification provided herein, a large number of specific details are set forth. However, it can be understood that the embodiments of the present invention can be practiced without these specific details. In some instances, well-known methods, structures, and technologies have not been shown in detail so as not to obscure the understanding of this specification.

[0102] Similarly, it should be understood that, for the purpose of streamlining the present disclosure and aiding in the understanding of one or more of the various inventive aspects, in the foregoing description of the exemplary embodiments of the present invention, the various features of the present invention are sometimes grouped together in a single embodiment, figure, or description thereof. However, the disclosed method should not be construed as reflecting an intention that the claimed invention requires more features than are expressly recited in each claim. Rather, as reflected in the following claims, the inventive aspects lie in less than all the features of the single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into the detailed description, with each claim standing on its own as a separate embodiment of the present invention.

[0103] Those skilled in the art should understand that the modules, or units, or components of the devices in the examples disclosed herein may be arranged in the devices as described in this embodiment, or alternatively may be located in one or more devices different from those in the examples. The modules in the foregoing examples may be combined into one module or further divided into multiple sub-modules.

[0104] Those skilled in the art can understand that the modules in the devices of the embodiments can be adaptively changed and arranged in one or more devices different from those of this embodiment. The modules, or units, or components in the embodiments can be combined into one module, or unit, or component, and furthermore 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, any combination can be used to combine all the features disclosed in this specification (including the accompanying claims, abstract, and drawings) and all the processes or units of any method or device so disclosed. Unless otherwise expressly stated, each feature disclosed in this specification (including the accompanying claims, abstract, and drawings) can be replaced by an alternative feature that provides the same, equivalent, or similar purpose.

[0105] In addition, those skilled in the art will be able to understand that, although some of the embodiments described herein include certain features included in other embodiments but not other features, the combination of the features of different embodiments is meant to be within the scope of the present invention and forms different embodiments. For example, in the following claims, any one of the claimed embodiments can be used in any combination.

[0106] In addition, some of the embodiments described herein are described as methods or combinations of method elements that can be implemented by a processor of a computer system or by other devices performing the functions. Therefore, a processor having the necessary instructions for implementing the method or method element forms an apparatus for implementing the method or method element. In addition, the elements described herein in the apparatus embodiments are examples of apparatuses for performing the functions performed by the elements for the purpose of implementing the invention.

[0107] As used herein, unless otherwise specified, the use of ordinal numbers "first", "second", "third", etc. to describe ordinary objects merely indicates different instances of similar objects and is not intended to imply that the objects so described must have a given order in time, space, ranking, or in any other manner.

[0108] Although the invention has been described in terms of a limited number of embodiments, those skilled in the art of this technology will appreciate, from the foregoing description, that other embodiments can be contemplated within the scope of the invention thus described. In addition, it should be noted that the language used in this specification has been principally selected for readability and instructional purposes and not for the purpose of explaining or limiting the subject matter of the invention. Accordingly, many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the appended claims. For the scope of the invention, the disclosure of the invention is illustrative and not restrictive, and the scope of the invention is defined by the appended claims.

Claims

1. A device mounting method, which is executed in a computing device. The first predetermined software is installed in the computing device, and the first predetermined software is udisks or udisks2. The first predetermined software includes a first configuration file and a second configuration file, where, The first configuration file is a configuration file that comes with the first predetermined software, and is used to save default setting options, with a scope of all users. The second configuration file is a user-defined configuration file, and is used to save configuration options set by the current user, and the configuration options are keywords and corresponding permissions. The second configuration file is a hidden file, and is scoped to the current user. The priority of the second configuration file is greater than that of the first configuration file. The first configuration file and the second configuration file include device keywords and corresponding permissions, and the device keywords are used to identify the device. When the configuration options corresponding to the two configuration files conflict, the configuration options of the second configuration file are used to overwrite the configuration options of the first configuration file. The method includes: Reading a first configuration file of the first predetermined software, and storing the read content in a hash table; Reading a second configuration file of the first predetermined software, and storing the read content in the hash table; If the keyword in the content read from the second configuration file already exists in the hash table, the permission originally corresponding to the keyword in the hash table is overwritten with the permission currently corresponding to the keyword; Obtaining a device keyword of the device, wherein the device keyword includes a manufacturer identifier, a device model and / or a serial number; Obtain the permissions corresponding to the device keyword; Authorizing the acquired permissions to the device, and mounting the device on the computing device; Among them, before the step of obtaining the device keyword of the device, it also includes: determining whether the device is a mobile storage medium. If the device is a mobile storage medium, continuing to execute the step of obtaining the device keyword of the device; if the device is not a mobile storage medium, directly authorizing the default permission to the device and mounting the device on the computing device.

2. The method according to claim 1, wherein The step of reading the second configuration file of the first predetermined software and storing the read content in the hash table includes: Obtaining keywords in at least one list corresponding to the second configuration file of the first predetermined software and permissions corresponding to the list, and storing the obtained keywords and corresponding permissions of the list in a hash table, wherein the list includes a blacklist and / or a whitelist, and the number of the blacklist and the whitelist is one or more; A global attribute applicable to all devices is obtained, and keywords outside the list are associated with permissions corresponding to the global attribute and stored in a hash table.

3. The method according to claim 1, wherein The step of obtaining the permission corresponding to the device keyword includes: Matching the device keyword with the hash table; If the device keyword is matched in the hash table, the permission corresponding to the device keyword in the hash table is obtained; If the device keyword is not matched in the hash table, then check whether there is a global attribute in the hash table; If there are global attributes in the hash table, obtain the permissions corresponding to the global attributes; If the global attribute does not exist in the hash table, the default permissions are obtained.

4. The method according to claim 1, further comprising: The dbus interface of the first predetermined software is called through the virtual file system.

5. The method according to claim 1, further comprising: Modify the second configuration file through a second predetermined software, including: Call the dbus interface of the first predetermined software through the second predetermined software; Determine whether the keyword corresponding to the modification content for modifying the second configuration file belongs to a removable storage medium; If the keyword corresponding to the modification content belongs to a removable storage medium, modify the second configuration file through the configuration file operation function in the first predetermined software; If the keyword corresponding to the modification content does not belong to a removable storage medium, no modification is made.

6. The method according to claim 1, further including: Query the permissions of the device to be queried through the second predetermined software, including: Call the dbus interface of the first predetermined software through the second predetermined software to obtain the device keyword of the device to be queried; Query the device keyword of the device to be queried in the hash table; If the device keyword of the device to be queried exists in the hash table, return the permissions corresponding to the device keyword of the device to be queried in the hash table; If the device keyword of the device to be queried does not exist in the hash table, return the default permissions.

7. A computing device, including: At least one processor; And A memory storing program instructions, wherein the program instructions are configured to be executed by the at least one processor, and the program instructions include instructions for executing the method according to any one of claims 1 to 6.

8. A readable storage medium storing program instructions, when the program instructions are read and executed by a computing device, causing the computing device to execute the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Page access method, server and computer readable storage medium

    CN107508892A

  • Method, device and equipment for managing USB equipment in cluster and storage medium

    CN113687910A