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
f53197de
Commit
f53197de
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] stram/z2ram switched to alloc_disk()
parent
2b6df45e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
20 deletions
+28
-20
arch/m68k/atari/stram.c
arch/m68k/atari/stram.c
+12
-9
drivers/block/z2ram.c
drivers/block/z2ram.c
+16
-11
No files found.
arch/m68k/atari/stram.c
View file @
f53197de
...
...
@@ -1046,13 +1046,7 @@ static struct block_device_operations stram_fops = {
.
release
=
stram_release
,
};
static
struct
gendisk
stram_disk
=
{
.
major
=
STRAM_MAJOR
,
.
first_minor
=
STRAM_MINOR
,
.
minor_shift
=
0
,
.
fops
=
&
stram_fops
,
.
disk_name
=
"stram"
};
static
struct
gendisk
*
stram_disk
;
int
__init
stram_device_init
(
void
)
{
...
...
@@ -1063,15 +1057,24 @@ int __init stram_device_init(void)
if
(
!
max_swap_size
)
/* swapping not enabled */
return
-
ENXIO
;
stram_disk
=
alloc_disk
();
if
(
!
stram_disk
)
return
-
ENOMEM
;
if
(
register_blkdev
(
STRAM_MAJOR
,
"stram"
,
&
stram_fops
))
{
printk
(
KERN_ERR
"stram: Unable to get major %d
\n
"
,
STRAM_MAJOR
);
put_disk
(
stram_disk
);
return
-
ENXIO
;
}
blk_init_queue
(
BLK_DEFAULT_QUEUE
(
STRAM_MAJOR
),
do_stram_request
);
set_capacity
(
&
stram_disk
,
(
swap_end
-
swap_start
)
/
512
);
add_disk
(
&
stram_disk
);
stram_disk
->
major
=
STRAM_MAJOR
;
stram_disk
->
first_minor
=
STRAM_MINOR
;
stram_disk
->
minor_shift
=
0
;
stram_disk
->
fops
=
&
stram_fops
;
sprintf
(
stram_disk
->
disk_name
,
"stram"
);
set_capacity
(
stram_disk
,
(
swap_end
-
swap_start
)
/
512
);
add_disk
(
stram_disk
);
return
0
;
}
...
...
drivers/block/z2ram.c
View file @
f53197de
...
...
@@ -71,13 +71,7 @@ static int current_device = -1;
static
spinlock_t
z2ram_lock
=
SPIN_LOCK_UNLOCKED
;
static
struct
block_device_operations
z2_fops
;
static
struct
gendisk
z2ram_gendisk
=
{
.
major
=
MAJOR_NR
,
.
first_minor
=
0
,
.
minor_shift
=
0
,
.
fops
=
&
z2_fops
,
.
disk_name
=
"z2ram"
};
static
struct
gendisk
*
z2ram_gendisk
;
static
void
do_z2_request
(
request_queue_t
*
q
)
...
...
@@ -320,7 +314,7 @@ z2_open( struct inode *inode, struct file *filp )
current_device
=
device
;
z2ram_size
<<=
Z2RAM_CHUNKSHIFT
;
set_capacity
(
&
z2ram_gendisk
,
z2ram_size
>>
9
;
set_capacity
(
z2ram_gendisk
,
z2ram_size
>>
9
;
}
return
0
;
...
...
@@ -355,7 +349,7 @@ static struct gendisk *z2_find(int minor)
{
if
(
minor
>
Z2MINOR_COUNT
)
return
NULL
;
return
&
z2ram_gendisk
;
return
z2ram_gendisk
;
}
int
__init
...
...
@@ -371,9 +365,19 @@ z2_init( void )
MAJOR_NR
);
return
-
EBUSY
;
}
z2ram_gendisk
=
alloc_disk
();
if
(
!
z2ram_gendisk
)
{
unregister_blkdev
(
MAJOR_NR
,
DEVICE_NAME
);
return
-
ENOMEM
;
}
z2ram_gendisk
->
major
=
MAJOR_NR
;
z2ram_gendisk
->
first_minor
=
0
;
z2ram_gendisk
->
minor_shift
=
0
;
z2ram_gendisk
->
fops
=
&
z2_fops
;
sprintf
(
z2ram_gendisk
->
disk_name
,
"z2ram"
);
blk_init_queue
(
BLK_DEFAULT_QUEUE
(
MAJOR_NR
),
do_z2_request
,
&
z2ram_lock
);
add_disk
(
&
z2ram_gendisk
);
add_disk
(
z2ram_gendisk
);
blk_set_probe
(
MAJOR_NR
,
z2_find
);
return
0
;
...
...
@@ -406,7 +410,8 @@ cleanup_module( void )
if
(
unregister_blkdev
(
MAJOR_NR
,
DEVICE_NAME
)
!=
0
)
printk
(
KERN_ERR
DEVICE_NAME
": unregister of device failed
\n
"
);
del_gendisk
(
&
z2ram_gendisk
);
del_gendisk
(
z2ram_gendisk
);
put_disk
(
z2ram_gendisk
);
blk_cleanup_queue
(
BLK_DEFAULT_QUEUE
(
MAJOR_NR
));
if
(
current_device
!=
-
1
)
...
...
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