Могу ли я получить структуру устройства из старшего номера и младшего номера - PullRequest
0 голосов
/ 25 июня 2018

Я хочу реализовать хук безопасности linux security_inode_mknod. Есть параметр dev, я хочу использовать его, чтобы получить структуру устройства и поместить эту структуру в usb_deauthorize_device(struct usb_device *usb_dev) и ata_dev_disable(struct ata_device *dev), чтобы заблокировать USB-устройство и устройство sata, этот метод осуществим?Если нет, могу ли я использовать другие параметры, чтобы получить его?

 *  Check permissions when creating a special file (or a socket or a fifo
 *  file created via the mknod system call).  Note that if mknod operation
 *  is being done for a regular file, then the create hook will be called
 *  and not this hook.
 *  @dir contains the inode structure of parent of the new file.
 *  @dentry contains the dentry structure of the new file.
 *  @mode contains the mode of the new file.
 *  @dev contains the device number.
 *  Return 0 if permission is granted.
static inline int security_inode_mknod(struct inode *dir,
                    struct dentry *dentry,
                    int mode, dev_t dev)
...