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
6ebe755c
Commit
6ebe755c
authored
Sep 21, 2002
by
Alexander Viro
Committed by
Linus Torvalds
Sep 21, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] gendisk for z2ram
z2ram.c switched to use of gendisks
parent
3f028def
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
16 deletions
+24
-16
drivers/block/z2ram.c
drivers/block/z2ram.c
+24
-16
No files found.
drivers/block/z2ram.c
View file @
6ebe755c
...
@@ -63,7 +63,6 @@ extern struct mem_info m68k_memory[NUM_MEMINFO];
...
@@ -63,7 +63,6 @@ extern struct mem_info m68k_memory[NUM_MEMINFO];
static
u_long
*
z2ram_map
=
NULL
;
static
u_long
*
z2ram_map
=
NULL
;
static
u_long
z2ram_size
=
0
;
static
u_long
z2ram_size
=
0
;
static
int
z2_sizes
[
Z2MINOR_COUNT
];
static
int
z2_count
=
0
;
static
int
z2_count
=
0
;
static
int
chip_count
=
0
;
static
int
chip_count
=
0
;
static
int
list_count
=
0
;
static
int
list_count
=
0
;
...
@@ -71,6 +70,15 @@ static int current_device = -1;
...
@@ -71,6 +70,15 @@ static int current_device = -1;
static
spinlock_t
z2ram_lock
=
SPIN_LOCK_UNLOCKED
;
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
,
.
major_name
=
"z2ram"
};
static
void
static
void
do_z2_request
(
request_queue_t
*
q
)
do_z2_request
(
request_queue_t
*
q
)
{
{
...
@@ -312,8 +320,7 @@ z2_open( struct inode *inode, struct file *filp )
...
@@ -312,8 +320,7 @@ z2_open( struct inode *inode, struct file *filp )
current_device
=
device
;
current_device
=
device
;
z2ram_size
<<=
Z2RAM_CHUNKSHIFT
;
z2ram_size
<<=
Z2RAM_CHUNKSHIFT
;
z2_sizes
[
device
]
=
z2ram_size
>>
10
;
set_capacity
(
&
z2ram_gendisk
,
z2ram_size
>>
9
;
blk_size
[
MAJOR_NR
]
=
z2_sizes
;
}
}
return
0
;
return
0
;
...
@@ -339,11 +346,18 @@ z2_release( struct inode *inode, struct file *filp )
...
@@ -339,11 +346,18 @@ z2_release( struct inode *inode, struct file *filp )
static
struct
block_device_operations
z2_fops
=
static
struct
block_device_operations
z2_fops
=
{
{
owner:
THIS_MODULE
,
.
owner
=
THIS_MODULE
,
open:
z2_open
,
.
open
=
z2_open
,
release:
z2_release
,
.
release
=
z2_release
,
};
};
static
struct
gendisk
*
z2_find
(
int
minor
)
{
if
(
minor
>
Z2MINOR_COUNT
)
return
NULL
;
return
&
z2ram_gendisk
;
}
int
__init
int
__init
z2_init
(
void
)
z2_init
(
void
)
{
{
...
@@ -358,17 +372,9 @@ z2_init( void )
...
@@ -358,17 +372,9 @@ z2_init( void )
return
-
EBUSY
;
return
-
EBUSY
;
}
}
{
/* Initialize size arrays. */
int
i
;
for
(
i
=
0
;
i
<
Z2MINOR_COUNT
;
i
++
)
{
z2_sizes
[
i
]
=
0
;
}
}
blk_init_queue
(
BLK_DEFAULT_QUEUE
(
MAJOR_NR
),
do_z2_request
,
&
z2ram_lock
);
blk_init_queue
(
BLK_DEFAULT_QUEUE
(
MAJOR_NR
),
do_z2_request
,
&
z2ram_lock
);
blk_size
[
MAJOR_NR
]
=
z2_sizes
;
add_disk
(
&
z2ram_gendisk
);
blk_set_probe
(
MAJOR_NR
,
z2_find
);
return
0
;
return
0
;
}
}
...
@@ -396,9 +402,11 @@ cleanup_module( void )
...
@@ -396,9 +402,11 @@ cleanup_module( void )
{
{
int
i
,
j
;
int
i
,
j
;
blk_set_probe
(
MAJOR_NR
,
NULL
);
if
(
unregister_blkdev
(
MAJOR_NR
,
DEVICE_NAME
)
!=
0
)
if
(
unregister_blkdev
(
MAJOR_NR
,
DEVICE_NAME
)
!=
0
)
printk
(
KERN_ERR
DEVICE_NAME
": unregister of device failed
\n
"
);
printk
(
KERN_ERR
DEVICE_NAME
": unregister of device failed
\n
"
);
del_gendisk
(
&
z2ram_gendisk
);
blk_cleanup_queue
(
BLK_DEFAULT_QUEUE
(
MAJOR_NR
));
blk_cleanup_queue
(
BLK_DEFAULT_QUEUE
(
MAJOR_NR
));
if
(
current_device
!=
-
1
)
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