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
Kirill Smelkov
linux
Commits
94fa0261
Commit
94fa0261
authored
Dec 03, 2002
by
Alexander Viro
Committed by
Linus Torvalds
Dec 03, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] nbd.c cleanup
switched to explicit devfs_register()/devfs_remove()
parent
f9614209
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
12 deletions
+10
-12
drivers/block/nbd.c
drivers/block/nbd.c
+10
-12
No files found.
drivers/block/nbd.c
View file @
94fa0261
...
@@ -59,7 +59,6 @@
...
@@ -59,7 +59,6 @@
#define LO_MAGIC 0x68797548
#define LO_MAGIC 0x68797548
static
struct
nbd_device
nbd_dev
[
MAX_NBD
];
static
struct
nbd_device
nbd_dev
[
MAX_NBD
];
static
devfs_handle_t
devfs_handle
;
static
spinlock_t
nbd_lock
=
SPIN_LOCK_UNLOCKED
;
static
spinlock_t
nbd_lock
=
SPIN_LOCK_UNLOCKED
;
...
@@ -549,8 +548,10 @@ static int __init nbd_init(void)
...
@@ -549,8 +548,10 @@ static int __init nbd_init(void)
printk
(
"nbd: registered device at major %d
\n
"
,
MAJOR_NR
);
printk
(
"nbd: registered device at major %d
\n
"
,
MAJOR_NR
);
#endif
#endif
blk_init_queue
(
&
nbd_queue
,
do_nbd_request
,
&
nbd_lock
);
blk_init_queue
(
&
nbd_queue
,
do_nbd_request
,
&
nbd_lock
);
devfs_mk_dir
(
NULL
,
"nbd"
,
NULL
);
for
(
i
=
0
;
i
<
MAX_NBD
;
i
++
)
{
for
(
i
=
0
;
i
<
MAX_NBD
;
i
++
)
{
struct
gendisk
*
disk
=
nbd_dev
[
i
].
disk
;
struct
gendisk
*
disk
=
nbd_dev
[
i
].
disk
;
char
name
[
16
];
nbd_dev
[
i
].
refcnt
=
0
;
nbd_dev
[
i
].
refcnt
=
0
;
nbd_dev
[
i
].
file
=
NULL
;
nbd_dev
[
i
].
file
=
NULL
;
nbd_dev
[
i
].
magic
=
LO_MAGIC
;
nbd_dev
[
i
].
magic
=
LO_MAGIC
;
...
@@ -568,12 +569,12 @@ static int __init nbd_init(void)
...
@@ -568,12 +569,12 @@ static int __init nbd_init(void)
sprintf
(
disk
->
disk_name
,
"nbd%d"
,
i
);
sprintf
(
disk
->
disk_name
,
"nbd%d"
,
i
);
set_capacity
(
disk
,
0x3ffffe
);
set_capacity
(
disk
,
0x3ffffe
);
add_disk
(
disk
);
add_disk
(
disk
);
}
sprintf
(
name
,
"nbd/%d"
,
i
);
devfs_handle
=
devfs_mk_dir
(
NULL
,
"nbd"
,
NULL
);
devfs_register
(
NULL
,
name
,
DEVFS_FL_DEFAULT
,
devfs_register_series
(
devfs_handle
,
"%u"
,
MAX_NBD
,
disk
->
major
,
disk
->
first_minor
,
DEVFS_FL_DEFAULT
,
MAJOR_NR
,
0
,
S_IFBLK
|
S_IRUSR
|
S_IWUSR
,
S_IFBLK
|
S_IRUSR
|
S_IWUSR
,
&
nbd_fops
,
NULL
);
disk
->
fops
,
NULL
);
}
return
0
;
return
0
;
out:
out:
...
@@ -588,14 +589,11 @@ static void __exit nbd_cleanup(void)
...
@@ -588,14 +589,11 @@ static void __exit nbd_cleanup(void)
for
(
i
=
0
;
i
<
MAX_NBD
;
i
++
)
{
for
(
i
=
0
;
i
<
MAX_NBD
;
i
++
)
{
del_gendisk
(
nbd_dev
[
i
].
disk
);
del_gendisk
(
nbd_dev
[
i
].
disk
);
put_disk
(
nbd_dev
[
i
].
disk
);
put_disk
(
nbd_dev
[
i
].
disk
);
devfs_remove
(
"nbd/%d"
,
i
);
}
}
devfs_
unregister
(
devfs_handle
);
devfs_
remove
(
"nbd"
);
blk_cleanup_queue
(
&
nbd_queue
);
blk_cleanup_queue
(
&
nbd_queue
);
unregister_blkdev
(
MAJOR_NR
,
"nbd"
);
if
(
unregister_blkdev
(
MAJOR_NR
,
"nbd"
)
!=
0
)
printk
(
"nbd: cleanup_module failed
\n
"
);
else
printk
(
"nbd: module cleaned up.
\n
"
);
}
}
module_init
(
nbd_init
);
module_init
(
nbd_init
);
...
...
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