提交 8cfc7ca4 编写于 作者: A Al Viro

[PATCH] switch pf

Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
上级 b6a89530
...@@ -201,13 +201,13 @@ module_param_array(drive3, int, NULL, 0); ...@@ -201,13 +201,13 @@ module_param_array(drive3, int, NULL, 0);
#define ATAPI_READ_10 0x28 #define ATAPI_READ_10 0x28
#define ATAPI_WRITE_10 0x2a #define ATAPI_WRITE_10 0x2a
static int pf_open(struct inode *inode, struct file *file); static int pf_open(struct block_device *bdev, fmode_t mode);
static void do_pf_request(struct request_queue * q); static void do_pf_request(struct request_queue * q);
static int pf_ioctl(struct inode *inode, struct file *file, static int pf_ioctl(struct block_device *bdev, fmode_t mode,
unsigned int cmd, unsigned long arg); unsigned int cmd, unsigned long arg);
static int pf_getgeo(struct block_device *bdev, struct hd_geometry *geo); static int pf_getgeo(struct block_device *bdev, struct hd_geometry *geo);
static int pf_release(struct inode *inode, struct file *file); static int pf_release(struct gendisk *disk, fmode_t mode);
static int pf_detect(void); static int pf_detect(void);
static void do_pf_read(void); static void do_pf_read(void);
...@@ -264,9 +264,9 @@ static char *pf_buf; /* buffer for request in progress */ ...@@ -264,9 +264,9 @@ static char *pf_buf; /* buffer for request in progress */
static struct block_device_operations pf_fops = { static struct block_device_operations pf_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.__open = pf_open, .open = pf_open,
.__release = pf_release, .release = pf_release,
.__ioctl = pf_ioctl, .locked_ioctl = pf_ioctl,
.getgeo = pf_getgeo, .getgeo = pf_getgeo,
.media_changed = pf_check_media, .media_changed = pf_check_media,
}; };
...@@ -296,16 +296,16 @@ static void __init pf_init_units(void) ...@@ -296,16 +296,16 @@ static void __init pf_init_units(void)
} }
} }
static int pf_open(struct inode *inode, struct file *file) static int pf_open(struct block_device *bdev, fmode_t mode)
{ {
struct pf_unit *pf = inode->i_bdev->bd_disk->private_data; struct pf_unit *pf = bdev->bd_disk->private_data;
pf_identify(pf); pf_identify(pf);
if (pf->media_status == PF_NM) if (pf->media_status == PF_NM)
return -ENODEV; return -ENODEV;
if ((pf->media_status == PF_RO) && (file->f_mode & FMODE_WRITE)) if ((pf->media_status == PF_RO) && (mode & FMODE_WRITE))
return -EROFS; return -EROFS;
pf->access++; pf->access++;
...@@ -333,9 +333,9 @@ static int pf_getgeo(struct block_device *bdev, struct hd_geometry *geo) ...@@ -333,9 +333,9 @@ static int pf_getgeo(struct block_device *bdev, struct hd_geometry *geo)
return 0; return 0;
} }
static int pf_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) static int pf_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, unsigned long arg)
{ {
struct pf_unit *pf = inode->i_bdev->bd_disk->private_data; struct pf_unit *pf = bdev->bd_disk->private_data;
if (cmd != CDROMEJECT) if (cmd != CDROMEJECT)
return -EINVAL; return -EINVAL;
...@@ -346,9 +346,9 @@ static int pf_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un ...@@ -346,9 +346,9 @@ static int pf_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
return 0; return 0;
} }
static int pf_release(struct inode *inode, struct file *file) static int pf_release(struct gendisk *disk, fmode_t mode)
{ {
struct pf_unit *pf = inode->i_bdev->bd_disk->private_data; struct pf_unit *pf = disk->private_data;
if (pf->access <= 0) if (pf->access <= 0)
return -EINVAL; return -EINVAL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册