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
be95d9fb
Commit
be95d9fb
authored
Oct 05, 2002
by
Alexander Viro
Committed by
Linus Torvalds
Oct 05, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] umem switched to alloc_disk()
parent
7afbe994
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
5 deletions
+19
-5
drivers/block/umem.c
drivers/block/umem.c
+19
-5
No files found.
drivers/block/umem.c
View file @
be95d9fb
...
@@ -161,7 +161,7 @@ static struct timer_list battery_timer;
...
@@ -161,7 +161,7 @@ static struct timer_list battery_timer;
static
int
num_cards
=
0
;
static
int
num_cards
=
0
;
static
struct
gendisk
mm_gendisk
[
MM_MAXCARDS
];
static
struct
gendisk
*
mm_gendisk
[
MM_MAXCARDS
];
static
void
check_batteries
(
struct
cardinfo
*
card
);
static
void
check_batteries
(
struct
cardinfo
*
card
);
...
@@ -813,7 +813,7 @@ static void del_battery_timer(void)
...
@@ -813,7 +813,7 @@ static void del_battery_timer(void)
static
int
mm_revalidate
(
kdev_t
i_rdev
)
static
int
mm_revalidate
(
kdev_t
i_rdev
)
{
{
int
card_number
=
DEVICE_NR
(
i_rdev
);
int
card_number
=
DEVICE_NR
(
i_rdev
);
set_capacity
(
mm_gendisk
+
card_number
,
cards
[
card_number
].
mm_size
<<
1
);
set_capacity
(
mm_gendisk
[
card_number
]
,
cards
[
card_number
].
mm_size
<<
1
);
return
0
;
return
0
;
}
}
/*
/*
...
@@ -1186,11 +1186,17 @@ int __init mm_init(void)
...
@@ -1186,11 +1186,17 @@ int __init mm_init(void)
printk
(
KERN_ERR
"MM: Could not register block device
\n
"
);
printk
(
KERN_ERR
"MM: Could not register block device
\n
"
);
return
-
EIO
;
return
-
EIO
;
}
}
for
(
i
=
0
;
i
<
num_cards
;
i
++
)
{
mm_gendisk
[
i
]
=
alloc_disk
();
if
(
!
mm_gendisk
[
i
])
goto
out
;
}
devfs_handle
=
devfs_mk_dir
(
NULL
,
"umem"
,
NULL
);
devfs_handle
=
devfs_mk_dir
(
NULL
,
"umem"
,
NULL
);
blk_dev
[
MAJOR_NR
].
queue
=
mm_queue_proc
;
blk_dev
[
MAJOR_NR
].
queue
=
mm_queue_proc
;
for
(
i
=
0
;
i
<
num_cards
;
i
++
)
{
for
(
i
=
0
;
i
<
num_cards
;
i
++
)
{
struct
gendisk
*
disk
=
mm_gendisk
+
i
;
struct
gendisk
*
disk
=
mm_gendisk
[
i
]
;
sprintf
(
disk
->
disk_name
,
"umem%c"
,
'a'
+
i
);
sprintf
(
disk
->
disk_name
,
"umem%c"
,
'a'
+
i
);
spin_lock_init
(
&
cards
[
i
].
lock
);
spin_lock_init
(
&
cards
[
i
].
lock
);
disk
->
major
=
major_nr
;
disk
->
major
=
major_nr
;
...
@@ -1205,6 +1211,12 @@ int __init mm_init(void)
...
@@ -1205,6 +1211,12 @@ int __init mm_init(void)
printk
(
"MM: desc_per_page = %ld
\n
"
,
DESC_PER_PAGE
);
printk
(
"MM: desc_per_page = %ld
\n
"
,
DESC_PER_PAGE
);
/* printk("mm_init: Done. 10-19-01 9:00\n"); */
/* printk("mm_init: Done. 10-19-01 9:00\n"); */
return
0
;
return
0
;
out:
unregister_blkdev
(
MAJOR_NR
,
"umem"
);
while
(
i
--
)
put_disk
(
mm_gendisk
[
i
]);
return
-
ENOMEM
;
}
}
/*
/*
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
...
@@ -1217,8 +1229,10 @@ void __exit mm_cleanup(void)
...
@@ -1217,8 +1229,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
++
)
{
del_gendisk
(
mm_gendisk
+
i
);
del_gendisk
(
mm_gendisk
[
i
]);
put_disk
(
mm_gendisk
[
i
]);
}
if
(
devfs_handle
)
if
(
devfs_handle
)
devfs_unregister
(
devfs_handle
);
devfs_unregister
(
devfs_handle
);
devfs_handle
=
NULL
;
devfs_handle
=
NULL
;
...
...
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