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
Kirill Smelkov
linux
Commits
f299adc6
Commit
f299adc6
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] kills CURRENT in floppy.c
dumb expansion of macro - it had #define CURRENT current_req
parent
0beb090c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
50 deletions
+49
-50
drivers/block/floppy.c
drivers/block/floppy.c
+49
-50
No files found.
drivers/block/floppy.c
View file @
f299adc6
...
...
@@ -239,7 +239,6 @@ static int allowed_drive_mask = 0x33;
static
int
irqdma_allocated
;
#define CURRENT current_req
#define LOCAL_END_REQUEST
#define MAJOR_NR FLOPPY_MAJOR
#define DEVICE_NAME "floppy"
...
...
@@ -665,12 +664,12 @@ static struct output_log {
static
int
output_log_pos
;
#endif
#define
CURRENT
D -1
#define
current_req
D -1
#define MAXTIMEOUT -2
static
void
reschedule_timeout
(
int
drive
,
const
char
*
message
,
int
marg
)
{
if
(
drive
==
CURRENT
D
)
if
(
drive
==
current_req
D
)
drive
=
current_drive
;
del_timer
(
&
fd_timeout
);
if
(
drive
<
0
||
drive
>
N_DRIVE
)
{
...
...
@@ -1898,7 +1897,7 @@ static void show_floppy(void)
printk
(
"now=%lu
\n
"
,
jiffies
);
}
printk
(
"cont=%p
\n
"
,
cont
);
printk
(
"
CURRENT=%p
\n
"
,
CURRENT
);
printk
(
"
current_req=%p
\n
"
,
current_req
);
printk
(
"command_status=%d
\n
"
,
command_status
);
printk
(
"
\n
"
);
}
...
...
@@ -2004,7 +2003,7 @@ static void floppy_ready(void)
static
void
floppy_start
(
void
)
{
reschedule_timeout
(
CURRENT
D
,
"floppy start"
,
0
);
reschedule_timeout
(
current_req
D
,
"floppy start"
,
0
);
scandrives
();
#ifdef DCL_DEBUG
...
...
@@ -2308,7 +2307,7 @@ static inline void end_request(struct request *req, int uptodate)
end_that_request_last
(
req
);
/* We're done with the request */
CURRENT
=
NULL
;
current_req
=
NULL
;
}
...
...
@@ -2317,7 +2316,7 @@ static inline void end_request(struct request *req, int uptodate)
static
void
request_done
(
int
uptodate
)
{
struct
request_queue
*
q
=
QUEUE
;
struct
request
*
req
=
CURRENT
;
struct
request
*
req
=
current_req
;
unsigned
long
flags
;
int
block
;
...
...
@@ -2441,7 +2440,7 @@ static void rw_interrupt(void)
}
if
(
CT
(
COMMAND
)
!=
FD_READ
||
raw_cmd
->
kernel_data
==
CURRENT
->
buffer
){
raw_cmd
->
kernel_data
==
current_req
->
buffer
){
/* transfer directly from buffer */
cont
->
done
(
1
);
}
else
if
(
CT
(
COMMAND
)
==
FD_READ
){
...
...
@@ -2460,10 +2459,10 @@ static int buffer_chain_size(void)
int
size
,
i
;
char
*
base
;
base
=
bio_data
(
CURRENT
->
bio
);
base
=
bio_data
(
current_req
->
bio
);
size
=
0
;
rq_for_each_bio
(
bio
,
CURRENT
)
{
rq_for_each_bio
(
bio
,
current_req
)
{
bio_for_each_segment
(
bv
,
bio
,
i
)
{
if
(
page_address
(
bv
->
bv_page
)
+
bv
->
bv_offset
!=
base
+
size
)
break
;
...
...
@@ -2502,23 +2501,23 @@ static void copy_buffer(int ssize, int max_sector, int max_sector_2)
max_sector
=
transfer_size
(
ssize
,
minimum
(
max_sector
,
max_sector_2
),
CURRENT
->
nr_sectors
);
current_req
->
nr_sectors
);
if
(
current_count_sectors
<=
0
&&
CT
(
COMMAND
)
==
FD_WRITE
&&
buffer_max
>
fsector_t
+
CURRENT
->
nr_sectors
)
buffer_max
>
fsector_t
+
current_req
->
nr_sectors
)
current_count_sectors
=
minimum
(
buffer_max
-
fsector_t
,
CURRENT
->
nr_sectors
);
current_req
->
nr_sectors
);
remaining
=
current_count_sectors
<<
9
;
#ifdef FLOPPY_SANITY_CHECK
if
((
remaining
>>
9
)
>
CURRENT
->
nr_sectors
&&
if
((
remaining
>>
9
)
>
current_req
->
nr_sectors
&&
CT
(
COMMAND
)
==
FD_WRITE
){
DPRINT
(
"in copy buffer
\n
"
);
printk
(
"current_count_sectors=%ld
\n
"
,
current_count_sectors
);
printk
(
"remaining=%d
\n
"
,
remaining
>>
9
);
printk
(
"
CURRENT->nr_sectors=%ld
\n
"
,
CURRENT
->
nr_sectors
);
printk
(
"
CURRENT
->current_nr_sectors=%u
\n
"
,
CURRENT
->
current_nr_sectors
);
printk
(
"
current_req->nr_sectors=%ld
\n
"
,
current_req
->
nr_sectors
);
printk
(
"
current_req
->current_nr_sectors=%u
\n
"
,
current_req
->
current_nr_sectors
);
printk
(
"max_sector=%d
\n
"
,
max_sector
);
printk
(
"ssize=%d
\n
"
,
ssize
);
}
...
...
@@ -2528,9 +2527,9 @@ static void copy_buffer(int ssize, int max_sector, int max_sector_2)
dma_buffer
=
floppy_track_buffer
+
((
fsector_t
-
buffer_min
)
<<
9
);
size
=
CURRENT
->
current_nr_sectors
<<
9
;
size
=
current_req
->
current_nr_sectors
<<
9
;
rq_for_each_bio
(
bio
,
CURRENT
)
{
rq_for_each_bio
(
bio
,
current_req
)
{
bio_for_each_segment
(
bv
,
bio
,
i
)
{
if
(
!
remaining
)
break
;
...
...
@@ -2637,16 +2636,16 @@ static int make_raw_rw_request(void)
return
0
;
}
set_fdc
(
DRIVE
(
CURRENT
->
rq_dev
));
set_fdc
(
DRIVE
(
current_req
->
rq_dev
));
raw_cmd
=
&
default_raw_cmd
;
raw_cmd
->
flags
=
FD_RAW_SPIN
|
FD_RAW_NEED_DISK
|
FD_RAW_NEED_DISK
|
FD_RAW_NEED_SEEK
;
raw_cmd
->
cmd_count
=
NR_RW
;
if
(
rq_data_dir
(
CURRENT
)
==
READ
)
{
if
(
rq_data_dir
(
current_req
)
==
READ
)
{
raw_cmd
->
flags
|=
FD_RAW_READ
;
COMMAND
=
FM_MODE
(
_floppy
,
FD_READ
);
}
else
if
(
rq_data_dir
(
CURRENT
)
==
WRITE
){
}
else
if
(
rq_data_dir
(
current_req
)
==
WRITE
){
raw_cmd
->
flags
|=
FD_RAW_WRITE
;
COMMAND
=
FM_MODE
(
_floppy
,
FD_WRITE
);
}
else
{
...
...
@@ -2656,10 +2655,10 @@ static int make_raw_rw_request(void)
max_sector
=
_floppy
->
sect
*
_floppy
->
head
;
TRACK
=
CURRENT
->
sector
/
max_sector
;
fsector_t
=
CURRENT
->
sector
%
max_sector
;
TRACK
=
current_req
->
sector
/
max_sector
;
fsector_t
=
current_req
->
sector
%
max_sector
;
if
(
_floppy
->
track
&&
TRACK
>=
_floppy
->
track
)
{
if
(
CURRENT
->
current_nr_sectors
&
1
)
{
if
(
current_req
->
current_nr_sectors
&
1
)
{
current_count_sectors
=
1
;
return
1
;
}
else
...
...
@@ -2676,7 +2675,7 @@ static int make_raw_rw_request(void)
max_sector
=
2
*
_floppy
->
sect
/
3
;
if
(
fsector_t
>=
max_sector
){
current_count_sectors
=
minimum
(
_floppy
->
sect
-
fsector_t
,
CURRENT
->
nr_sectors
);
current_req
->
nr_sectors
);
return
1
;
}
SIZECODE
=
2
;
...
...
@@ -2727,7 +2726,7 @@ static int make_raw_rw_request(void)
in_sector_offset
=
(
fsector_t
%
_floppy
->
sect
)
%
ssize
;
aligned_sector_t
=
fsector_t
-
in_sector_offset
;
max_size
=
CURRENT
->
nr_sectors
;
max_size
=
current_req
->
nr_sectors
;
if
((
raw_cmd
->
track
==
buffer_track
)
&&
(
current_drive
==
buffer_drive
)
&&
(
fsector_t
>=
buffer_min
)
&&
(
fsector_t
<
buffer_max
))
{
...
...
@@ -2736,10 +2735,10 @@ static int make_raw_rw_request(void)
copy_buffer
(
1
,
max_sector
,
buffer_max
);
return
1
;
}
}
else
if
(
in_sector_offset
||
CURRENT
->
nr_sectors
<
ssize
){
}
else
if
(
in_sector_offset
||
current_req
->
nr_sectors
<
ssize
){
if
(
CT
(
COMMAND
)
==
FD_WRITE
){
if
(
fsector_t
+
CURRENT
->
nr_sectors
>
ssize
&&
fsector_t
+
CURRENT
->
nr_sectors
<
ssize
+
ssize
)
if
(
fsector_t
+
current_req
->
nr_sectors
>
ssize
&&
fsector_t
+
current_req
->
nr_sectors
<
ssize
+
ssize
)
max_size
=
ssize
+
ssize
;
else
max_size
=
ssize
;
...
...
@@ -2747,7 +2746,7 @@ static int make_raw_rw_request(void)
raw_cmd
->
flags
&=
~
FD_RAW_WRITE
;
raw_cmd
->
flags
|=
FD_RAW_READ
;
COMMAND
=
FM_MODE
(
_floppy
,
FD_READ
);
}
else
if
((
unsigned
long
)
CURRENT
->
buffer
<
MAX_DMA_ADDRESS
)
{
}
else
if
((
unsigned
long
)
current_req
->
buffer
<
MAX_DMA_ADDRESS
)
{
unsigned
long
dma_limit
;
int
direct
,
indirect
;
...
...
@@ -2759,14 +2758,14 @@ static int make_raw_rw_request(void)
* on a 64 bit machine!
*/
max_size
=
buffer_chain_size
();
dma_limit
=
(
MAX_DMA_ADDRESS
-
((
unsigned
long
)
CURRENT
->
buffer
))
>>
9
;
dma_limit
=
(
MAX_DMA_ADDRESS
-
((
unsigned
long
)
current_req
->
buffer
))
>>
9
;
if
((
unsigned
long
)
max_size
>
dma_limit
)
{
max_size
=
dma_limit
;
}
/* 64 kb boundaries */
if
(
CROSS_64KB
(
CURRENT
->
buffer
,
max_size
<<
9
))
if
(
CROSS_64KB
(
current_req
->
buffer
,
max_size
<<
9
))
max_size
=
(
K_64
-
((
unsigned
long
)
CURRENT
->
buffer
)
%
K_64
)
>>
9
;
((
unsigned
long
)
current_req
->
buffer
)
%
K_64
)
>>
9
;
direct
=
transfer_size
(
ssize
,
max_sector
,
max_size
)
-
fsector_t
;
/*
* We try to read tracks, but if we get too many errors, we
...
...
@@ -2780,9 +2779,9 @@ static int make_raw_rw_request(void)
*
errors
<
DP
->
max_errors
.
read_track
&&
/*!TESTF(FD_NEED_TWADDLE) &&*/
((
!
probing
||
(
DP
->
read_track
&
(
1
<<
DRS
->
probed_format
)))))){
max_size
=
CURRENT
->
nr_sectors
;
max_size
=
current_req
->
nr_sectors
;
}
else
{
raw_cmd
->
kernel_data
=
CURRENT
->
buffer
;
raw_cmd
->
kernel_data
=
current_req
->
buffer
;
raw_cmd
->
length
=
current_count_sectors
<<
9
;
if
(
raw_cmd
->
length
==
0
){
DPRINT
(
"zero dma transfer attempted from make_raw_request
\n
"
);
...
...
@@ -2808,7 +2807,7 @@ static int make_raw_rw_request(void)
fsector_t
>
buffer_max
||
fsector_t
<
buffer_min
||
((
CT
(
COMMAND
)
==
FD_READ
||
(
!
in_sector_offset
&&
CURRENT
->
nr_sectors
>=
ssize
))
&&
(
!
in_sector_offset
&&
current_req
->
nr_sectors
>=
ssize
))
&&
max_sector
>
2
*
max_buffer_sectors
+
buffer_min
&&
max_size
+
fsector_t
>
2
*
max_buffer_sectors
+
buffer_min
)
/* not enough space */
){
...
...
@@ -2843,7 +2842,7 @@ static int make_raw_rw_request(void)
/*check_dma_crossing(raw_cmd->kernel_data, raw_cmd->length,
"end of make_raw_request");*/
if
((
raw_cmd
->
length
<
current_count_sectors
<<
9
)
||
(
raw_cmd
->
kernel_data
!=
CURRENT
->
buffer
&&
(
raw_cmd
->
kernel_data
!=
current_req
->
buffer
&&
CT
(
COMMAND
)
==
FD_WRITE
&&
(
aligned_sector_t
+
(
raw_cmd
->
length
>>
9
)
>
buffer_max
||
aligned_sector_t
<
buffer_min
))
||
...
...
@@ -2851,7 +2850,7 @@ static int make_raw_rw_request(void)
raw_cmd
->
length
<=
0
||
current_count_sectors
<=
0
){
DPRINT
(
"fractionary current count b=%lx s=%lx
\n
"
,
raw_cmd
->
length
,
current_count_sectors
);
if
(
raw_cmd
->
kernel_data
!=
CURRENT
->
buffer
)
if
(
raw_cmd
->
kernel_data
!=
current_req
->
buffer
)
printk
(
"addr=%d, length=%ld
\n
"
,
(
int
)
((
raw_cmd
->
kernel_data
-
floppy_track_buffer
)
>>
9
),
...
...
@@ -2868,7 +2867,7 @@ static int make_raw_rw_request(void)
return
0
;
}
if
(
raw_cmd
->
kernel_data
!=
CURRENT
->
buffer
){
if
(
raw_cmd
->
kernel_data
!=
current_req
->
buffer
){
if
(
raw_cmd
->
kernel_data
<
floppy_track_buffer
||
current_count_sectors
<
0
||
raw_cmd
->
length
<
0
||
...
...
@@ -2886,8 +2885,8 @@ static int make_raw_rw_request(void)
printk
(
"write
\n
"
);
return
0
;
}
}
else
if
(
raw_cmd
->
length
>
CURRENT
->
nr_sectors
<<
9
||
current_count_sectors
>
CURRENT
->
nr_sectors
){
}
else
if
(
raw_cmd
->
length
>
current_req
->
nr_sectors
<<
9
||
current_count_sectors
>
current_req
->
nr_sectors
){
DPRINT
(
"buffer overrun in direct transfer
\n
"
);
return
0
;
}
else
if
(
raw_cmd
->
length
<
current_count_sectors
<<
9
){
...
...
@@ -2916,21 +2915,21 @@ static void redo_fd_request(void)
floppy_off
(
current_drive
);
for
(;;)
{
if
(
!
CURRENT
)
{
if
(
!
current_req
)
{
struct
request
*
req
=
elv_next_request
(
QUEUE
);
if
(
!
req
)
{
do_floppy
=
NULL
;
unlock_fdc
();
return
;
}
CURRENT
=
req
;
current_req
=
req
;
}
if
(
major
(
CURRENT
->
rq_dev
)
!=
MAJOR_NR
)
if
(
major
(
current_req
->
rq_dev
)
!=
MAJOR_NR
)
panic
(
DEVICE_NAME
": request list destroyed"
);
device
=
CURRENT
->
rq_dev
;
device
=
current_req
->
rq_dev
;
set_fdc
(
DRIVE
(
device
));
reschedule_timeout
(
CURRENT
D
,
"redo fd request"
,
0
);
reschedule_timeout
(
current_req
D
,
"redo fd request"
,
0
);
set_floppy
(
device
);
raw_cmd
=
&
default_raw_cmd
;
...
...
@@ -2955,7 +2954,7 @@ static void redo_fd_request(void)
_floppy
=
floppy_type
+
DP
->
autodetect
[
DRS
->
probed_format
];
}
else
probing
=
0
;
errors
=
&
(
CURRENT
->
errors
);
errors
=
&
(
current_req
->
errors
);
tmp
=
make_raw_rw_request
();
if
(
tmp
<
2
){
request_done
(
tmp
);
...
...
@@ -2993,8 +2992,8 @@ static void do_fd_request(request_queue_t * q)
}
if
(
usage_count
==
0
)
{
printk
(
"warning: usage count=0,
CURRENT=%p exiting
\n
"
,
CURRENT
);
printk
(
"sect=%ld flags=%lx
\n
"
,
CURRENT
->
sector
,
CURRENT
->
flags
);
printk
(
"warning: usage count=0,
current_req=%p exiting
\n
"
,
current_req
);
printk
(
"sect=%ld flags=%lx
\n
"
,
current_req
->
sector
,
current_req
->
flags
);
return
;
}
if
(
fdc_busy
){
...
...
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