Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
4099a966
Commit
4099a966
authored
Mar 02, 2008
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] switch ub
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
b4d9a442
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
14 deletions
+12
-14
drivers/block/ub.c
drivers/block/ub.c
+12
-14
No files found.
drivers/block/ub.c
View file @
4099a966
...
@@ -1667,10 +1667,9 @@ static void ub_revalidate(struct ub_dev *sc, struct ub_lun *lun)
...
@@ -1667,10 +1667,9 @@ static void ub_revalidate(struct ub_dev *sc, struct ub_lun *lun)
* This is mostly needed to keep refcounting, but also to support
* This is mostly needed to keep refcounting, but also to support
* media checks on removable media drives.
* media checks on removable media drives.
*/
*/
static
int
ub_bd_open
(
struct
inode
*
inode
,
struct
file
*
filp
)
static
int
ub_bd_open
(
struct
block_device
*
bdev
,
fmode_t
mode
)
{
{
struct
gendisk
*
disk
=
inode
->
i_bdev
->
bd_disk
;
struct
ub_lun
*
lun
=
bdev
->
bd_disk
->
private_data
;
struct
ub_lun
*
lun
=
disk
->
private_data
;
struct
ub_dev
*
sc
=
lun
->
udev
;
struct
ub_dev
*
sc
=
lun
->
udev
;
unsigned
long
flags
;
unsigned
long
flags
;
int
rc
;
int
rc
;
...
@@ -1684,19 +1683,19 @@ static int ub_bd_open(struct inode *inode, struct file *filp)
...
@@ -1684,19 +1683,19 @@ static int ub_bd_open(struct inode *inode, struct file *filp)
spin_unlock_irqrestore
(
&
ub_lock
,
flags
);
spin_unlock_irqrestore
(
&
ub_lock
,
flags
);
if
(
lun
->
removable
||
lun
->
readonly
)
if
(
lun
->
removable
||
lun
->
readonly
)
check_disk_change
(
inode
->
i_
bdev
);
check_disk_change
(
bdev
);
/*
/*
* The sd.c considers ->media_present and ->changed not equivalent,
* The sd.c considers ->media_present and ->changed not equivalent,
* under some pretty murky conditions (a failure of READ CAPACITY).
* under some pretty murky conditions (a failure of READ CAPACITY).
* We may need it one day.
* We may need it one day.
*/
*/
if
(
lun
->
removable
&&
lun
->
changed
&&
!
(
filp
->
f_
mode
&
FMODE_NDELAY
))
{
if
(
lun
->
removable
&&
lun
->
changed
&&
!
(
mode
&
FMODE_NDELAY
))
{
rc
=
-
ENOMEDIUM
;
rc
=
-
ENOMEDIUM
;
goto
err_open
;
goto
err_open
;
}
}
if
(
lun
->
readonly
&&
(
filp
->
f_
mode
&
FMODE_WRITE
))
{
if
(
lun
->
readonly
&&
(
mode
&
FMODE_WRITE
))
{
rc
=
-
EROFS
;
rc
=
-
EROFS
;
goto
err_open
;
goto
err_open
;
}
}
...
@@ -1710,9 +1709,8 @@ static int ub_bd_open(struct inode *inode, struct file *filp)
...
@@ -1710,9 +1709,8 @@ static int ub_bd_open(struct inode *inode, struct file *filp)
/*
/*
*/
*/
static
int
ub_bd_release
(
struct
inode
*
inode
,
struct
file
*
filp
)
static
int
ub_bd_release
(
struct
gendisk
*
disk
,
fmode_t
mode
)
{
{
struct
gendisk
*
disk
=
inode
->
i_bdev
->
bd_disk
;
struct
ub_lun
*
lun
=
disk
->
private_data
;
struct
ub_lun
*
lun
=
disk
->
private_data
;
struct
ub_dev
*
sc
=
lun
->
udev
;
struct
ub_dev
*
sc
=
lun
->
udev
;
...
@@ -1723,13 +1721,13 @@ static int ub_bd_release(struct inode *inode, struct file *filp)
...
@@ -1723,13 +1721,13 @@ static int ub_bd_release(struct inode *inode, struct file *filp)
/*
/*
* The ioctl interface.
* The ioctl interface.
*/
*/
static
int
ub_bd_ioctl
(
struct
inode
*
inode
,
struct
file
*
filp
,
static
int
ub_bd_ioctl
(
struct
block_device
*
bdev
,
fmode_t
mode
,
unsigned
int
cmd
,
unsigned
long
arg
)
unsigned
int
cmd
,
unsigned
long
arg
)
{
{
struct
gendisk
*
disk
=
inode
->
i_
bdev
->
bd_disk
;
struct
gendisk
*
disk
=
bdev
->
bd_disk
;
void
__user
*
usermem
=
(
void
__user
*
)
arg
;
void
__user
*
usermem
=
(
void
__user
*
)
arg
;
return
scsi_cmd_ioctl
(
disk
->
queue
,
disk
,
filp
?
filp
->
f_mode
:
0
,
cmd
,
usermem
);
return
scsi_cmd_ioctl
(
disk
->
queue
,
disk
,
mode
,
cmd
,
usermem
);
}
}
/*
/*
...
@@ -1791,9 +1789,9 @@ static int ub_bd_media_changed(struct gendisk *disk)
...
@@ -1791,9 +1789,9 @@ static int ub_bd_media_changed(struct gendisk *disk)
static
struct
block_device_operations
ub_bd_fops
=
{
static
struct
block_device_operations
ub_bd_fops
=
{
.
owner
=
THIS_MODULE
,
.
owner
=
THIS_MODULE
,
.
__
open
=
ub_bd_open
,
.
open
=
ub_bd_open
,
.
__
release
=
ub_bd_release
,
.
release
=
ub_bd_release
,
.
__ioctl
=
ub_bd_ioctl
,
.
locked_ioctl
=
ub_bd_ioctl
,
.
media_changed
=
ub_bd_media_changed
,
.
media_changed
=
ub_bd_media_changed
,
.
revalidate_disk
=
ub_bd_revalidate
,
.
revalidate_disk
=
ub_bd_revalidate
,
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment