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
f9614209
Commit
f9614209
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] loop.c cleanup
switched to explicit devfs_register()/devfs_remove()
parent
e752c144
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
drivers/block/loop.c
drivers/block/loop.c
+9
-7
No files found.
drivers/block/loop.c
View file @
f9614209
...
@@ -84,7 +84,6 @@
...
@@ -84,7 +84,6 @@
static
int
max_loop
=
8
;
static
int
max_loop
=
8
;
static
struct
loop_device
*
loop_dev
;
static
struct
loop_device
*
loop_dev
;
static
struct
gendisk
**
disks
;
static
struct
gendisk
**
disks
;
static
devfs_handle_t
devfs_handle
;
/* For the directory */
/*
/*
* Transfer functions
* Transfer functions
...
@@ -1022,11 +1021,7 @@ int __init loop_init(void)
...
@@ -1022,11 +1021,7 @@ int __init loop_init(void)
return
-
EIO
;
return
-
EIO
;
}
}
devfs_handle
=
devfs_mk_dir
(
NULL
,
"loop"
,
NULL
);
devfs_mk_dir
(
NULL
,
"loop"
,
NULL
);
devfs_register_series
(
devfs_handle
,
"%u"
,
max_loop
,
DEVFS_FL_DEFAULT
,
MAJOR_NR
,
0
,
S_IFBLK
|
S_IRUSR
|
S_IWUSR
|
S_IRGRP
,
&
lo_fops
,
NULL
);
loop_dev
=
kmalloc
(
max_loop
*
sizeof
(
struct
loop_device
),
GFP_KERNEL
);
loop_dev
=
kmalloc
(
max_loop
*
sizeof
(
struct
loop_device
),
GFP_KERNEL
);
if
(
!
loop_dev
)
if
(
!
loop_dev
)
...
@@ -1043,6 +1038,7 @@ int __init loop_init(void)
...
@@ -1043,6 +1038,7 @@ int __init loop_init(void)
}
}
for
(
i
=
0
;
i
<
max_loop
;
i
++
)
{
for
(
i
=
0
;
i
<
max_loop
;
i
++
)
{
char
name
[
16
];
struct
loop_device
*
lo
=
&
loop_dev
[
i
];
struct
loop_device
*
lo
=
&
loop_dev
[
i
];
struct
gendisk
*
disk
=
disks
[
i
];
struct
gendisk
*
disk
=
disks
[
i
];
memset
(
lo
,
0
,
sizeof
(
*
lo
));
memset
(
lo
,
0
,
sizeof
(
*
lo
));
...
@@ -1058,6 +1054,11 @@ int __init loop_init(void)
...
@@ -1058,6 +1054,11 @@ int __init loop_init(void)
disk
->
private_data
=
lo
;
disk
->
private_data
=
lo
;
disk
->
queue
=
&
lo
->
lo_queue
;
disk
->
queue
=
&
lo
->
lo_queue
;
add_disk
(
disk
);
add_disk
(
disk
);
sprintf
(
name
,
"loop/%d"
,
i
);
devfs_register
(
NULL
,
name
,
DEVFS_FL_DEFAULT
,
disk
->
major
,
disk
->
first_minor
,
S_IFBLK
|
S_IRUSR
|
S_IWUSR
|
S_IRGRP
,
disk
->
fops
,
NULL
);
}
}
printk
(
KERN_INFO
"loop: loaded (max %d devices)
\n
"
,
max_loop
);
printk
(
KERN_INFO
"loop: loaded (max %d devices)
\n
"
,
max_loop
);
return
0
;
return
0
;
...
@@ -1078,8 +1079,9 @@ void loop_exit(void)
...
@@ -1078,8 +1079,9 @@ void loop_exit(void)
for
(
i
=
0
;
i
<
max_loop
;
i
++
)
{
for
(
i
=
0
;
i
<
max_loop
;
i
++
)
{
del_gendisk
(
disks
[
i
]);
del_gendisk
(
disks
[
i
]);
put_disk
(
disks
[
i
]);
put_disk
(
disks
[
i
]);
devfs_remove
(
"loop/%d"
,
i
);
}
}
devfs_
unregister
(
devfs_handle
);
devfs_
remove
(
"loop"
);
if
(
unregister_blkdev
(
MAJOR_NR
,
"loop"
))
if
(
unregister_blkdev
(
MAJOR_NR
,
"loop"
))
printk
(
KERN_WARNING
"loop: cannot unregister blkdev
\n
"
);
printk
(
KERN_WARNING
"loop: cannot unregister blkdev
\n
"
);
...
...
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