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
49ae70c0
Commit
49ae70c0
authored
Aug 14, 2002
by
Alexander Viro
Committed by
Linus Torvalds
Aug 14, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] umem per-disk gendisks
parent
664aa7b2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
34 deletions
+21
-34
drivers/block/umem.c
drivers/block/umem.c
+21
-34
No files found.
drivers/block/umem.c
View file @
49ae70c0
...
@@ -164,14 +164,8 @@ static struct hd_struct mm_partitions[MM_MAXCARDS << MM_SHIFT];
...
@@ -164,14 +164,8 @@ static struct hd_struct mm_partitions[MM_MAXCARDS << MM_SHIFT];
static
int
num_cards
=
0
;
static
int
num_cards
=
0
;
struct
gendisk
mm_gendisk
=
{
static
struct
gendisk
mm_gendisk
[
MM_MAXCARDS
];
major:
0
,
/* Major number assigned later */
static
char
mm_names
[
MM_MAXCARDS
*
6
];
major_name:
"umem"
,
/* Name of the major device */
minor_shift:
MM_SHIFT
,
/* Shift to get device number */
fops:
&
mm_fops
,
/* Block dev operations */
/* everything else is dynamic */
};
static
void
check_batteries
(
struct
cardinfo
*
card
);
static
void
check_batteries
(
struct
cardinfo
*
card
);
...
@@ -1182,10 +1176,6 @@ int __init mm_init(void)
...
@@ -1182,10 +1176,6 @@ int __init mm_init(void)
printk
(
KERN_INFO
DRIVER_VERSION
" : "
DRIVER_DESC
"
\n
"
);
printk
(
KERN_INFO
DRIVER_VERSION
" : "
DRIVER_DESC
"
\n
"
);
memset
(
cards
,
0
,
MM_MAXCARDS
*
sizeof
(
struct
cardinfo
));
memset
(
mm_partitions
,
0
,
(
MM_MAXCARDS
<<
MM_SHIFT
)
*
sizeof
(
struct
hd_struct
));
retval
=
pci_module_init
(
&
mm_pci_driver
);
retval
=
pci_module_init
(
&
mm_pci_driver
);
if
(
retval
)
if
(
retval
)
return
-
ENOMEM
;
return
-
ENOMEM
;
...
@@ -1197,23 +1187,23 @@ int __init mm_init(void)
...
@@ -1197,23 +1187,23 @@ int __init mm_init(void)
}
}
devfs_handle
=
devfs_mk_dir
(
NULL
,
"umem"
,
NULL
);
devfs_handle
=
devfs_mk_dir
(
NULL
,
"umem"
,
NULL
);
blk_dev
[
MAJOR_NR
].
queue
=
mm_queue_proc
;
/* Initialize partition size: partion 0 of each card is the entire card */
for
(
i
=
0
;
i
<
num_cards
;
i
++
)
{
for
(
i
=
0
;
i
<
num_cards
;
i
++
)
{
struct
gendisk
*
disk
=
mm_gendisk
+
i
;
sprintf
(
mm_names
+
i
*
6
,
"umem%c"
,
'a'
+
i
);
spin_lock_init
(
&
cards
[
i
].
lock
);
spin_lock_init
(
&
cards
[
i
].
lock
);
mm_partitions
[
i
<<
MM_SHIFT
].
nr_sects
=
disk
->
part
=
mm_partitions
+
(
i
<<
MM_SHIFT
);
cards
[
i
].
mm_size
*
(
1024
/
MM_HARDSECT
);
disk
->
nr_real
=
1
;
}
disk
->
major
=
major_nr
;
disk
->
first_minor
=
i
<<
MM_SHIFT
;
mm_gendisk
.
part
=
mm_partitions
;
disk
->
major_name
=
mm_names
+
i
*
6
;
mm_gendisk
.
nr_real
=
num_cards
;
disk
->
minor_shift
=
MM_SHIFT
;
disk
->
fops
=
&
mm_fops
;
blk_dev
[
MAJOR_NR
].
queue
=
mm_queue_proc
;
add_gendisk
(
disk
);
add_gendisk
(
&
mm_gendisk
);
register_disk
(
disk
,
mk_kdev
(
disk
->
major
,
disk
->
first_minor
),
1
<<
disk
->
minor_shift
,
for
(
i
=
0
;
i
<
num_cards
;
i
++
)
{
disk
->
fops
,
register_disk
(
&
mm_gendisk
,
mk_kdev
(
MAJOR_NR
,
i
<<
MM_SHIFT
),
MM_SHIFT
,
cards
[
i
].
mm_size
<<
1
);
&
mm_fops
,
cards
[
i
].
mm_size
<<
1
);
}
}
init_battery_timer
();
init_battery_timer
();
...
@@ -1232,8 +1222,10 @@ void __exit mm_cleanup(void)
...
@@ -1232,8 +1222,10 @@ void __exit mm_cleanup(void)
del_battery_timer
();
del_battery_timer
();
for
(
i
=
0
;
i
<
num_cards
;
i
++
)
for
(
i
=
0
;
i
<
num_cards
;
i
++
)
{
devfs_register_partitions
(
&
mm_gendisk
,
i
<<
MM_SHIFT
,
1
);
devfs_register_partitions
(
mm_gendisk
+
i
,
i
<<
MM_SHIFT
,
1
);
del_gendisk
(
mm_gendisk
+
i
);
}
if
(
devfs_handle
)
if
(
devfs_handle
)
devfs_unregister
(
devfs_handle
);
devfs_unregister
(
devfs_handle
);
devfs_handle
=
NULL
;
devfs_handle
=
NULL
;
...
@@ -1241,11 +1233,6 @@ void __exit mm_cleanup(void)
...
@@ -1241,11 +1233,6 @@ void __exit mm_cleanup(void)
pci_unregister_driver
(
&
mm_pci_driver
);
pci_unregister_driver
(
&
mm_pci_driver
);
unregister_blkdev
(
MAJOR_NR
,
"umem"
);
unregister_blkdev
(
MAJOR_NR
,
"umem"
);
/*
* Get our gendisk structure off the list.
*/
del_gendisk
(
&
mm_gendisk
);
}
}
module_init
(
mm_init
);
module_init
(
mm_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