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
3b9d011d
Commit
3b9d011d
authored
Sep 22, 2003
by
Kevin Corry
Committed by
Linus Torvalds
Sep 22, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] dm: Move retrieve_status function
Move retrieve_status up so dev_wait() can use it.
parent
e0738c98
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
63 deletions
+63
-63
drivers/md/dm-ioctl-v4.c
drivers/md/dm-ioctl-v4.c
+63
-63
No files found.
drivers/md/dm-ioctl-v4.c
View file @
3b9d011d
...
@@ -699,6 +699,69 @@ static int dev_status(struct dm_ioctl *param, size_t param_size)
...
@@ -699,6 +699,69 @@ static int dev_status(struct dm_ioctl *param, size_t param_size)
return
r
;
return
r
;
}
}
/*
* Build up the status struct for each target
*/
static
void
retrieve_status
(
struct
dm_table
*
table
,
struct
dm_ioctl
*
param
,
size_t
param_size
)
{
unsigned
int
i
,
num_targets
;
struct
dm_target_spec
*
spec
;
char
*
outbuf
,
*
outptr
;
status_type_t
type
;
size_t
remaining
,
len
,
used
=
0
;
outptr
=
outbuf
=
get_result_buffer
(
param
,
param_size
,
&
len
);
if
(
param
->
flags
&
DM_STATUS_TABLE_FLAG
)
type
=
STATUSTYPE_TABLE
;
else
type
=
STATUSTYPE_INFO
;
/* Get all the target info */
num_targets
=
dm_table_get_num_targets
(
table
);
for
(
i
=
0
;
i
<
num_targets
;
i
++
)
{
struct
dm_target
*
ti
=
dm_table_get_target
(
table
,
i
);
remaining
=
len
-
(
outptr
-
outbuf
);
if
(
remaining
<
sizeof
(
struct
dm_target_spec
))
{
param
->
flags
|=
DM_BUFFER_FULL_FLAG
;
break
;
}
spec
=
(
struct
dm_target_spec
*
)
outptr
;
spec
->
status
=
0
;
spec
->
sector_start
=
ti
->
begin
;
spec
->
length
=
ti
->
len
;
strncpy
(
spec
->
target_type
,
ti
->
type
->
name
,
sizeof
(
spec
->
target_type
));
outptr
+=
sizeof
(
struct
dm_target_spec
);
remaining
=
len
-
(
outptr
-
outbuf
);
/* Get the status/table string from the target driver */
if
(
ti
->
type
->
status
)
{
if
(
ti
->
type
->
status
(
ti
,
type
,
outptr
,
remaining
))
{
param
->
flags
|=
DM_BUFFER_FULL_FLAG
;
break
;
}
}
else
outptr
[
0
]
=
'\0'
;
outptr
+=
strlen
(
outptr
)
+
1
;
used
=
param
->
data_start
+
(
outptr
-
outbuf
);
align_ptr
(
outptr
);
spec
->
next
=
outptr
-
outbuf
;
}
if
(
used
)
param
->
data_size
=
used
;
param
->
target_count
=
num_targets
;
}
/*
/*
* Wait for a device to report an event
* Wait for a device to report an event
*/
*/
...
@@ -919,69 +982,6 @@ static int table_deps(struct dm_ioctl *param, size_t param_size)
...
@@ -919,69 +982,6 @@ static int table_deps(struct dm_ioctl *param, size_t param_size)
return
r
;
return
r
;
}
}
/*
* Build up the status struct for each target
*/
static
void
retrieve_status
(
struct
dm_table
*
table
,
struct
dm_ioctl
*
param
,
size_t
param_size
)
{
unsigned
int
i
,
num_targets
;
struct
dm_target_spec
*
spec
;
char
*
outbuf
,
*
outptr
;
status_type_t
type
;
size_t
remaining
,
len
,
used
=
0
;
outptr
=
outbuf
=
get_result_buffer
(
param
,
param_size
,
&
len
);
if
(
param
->
flags
&
DM_STATUS_TABLE_FLAG
)
type
=
STATUSTYPE_TABLE
;
else
type
=
STATUSTYPE_INFO
;
/* Get all the target info */
num_targets
=
dm_table_get_num_targets
(
table
);
for
(
i
=
0
;
i
<
num_targets
;
i
++
)
{
struct
dm_target
*
ti
=
dm_table_get_target
(
table
,
i
);
remaining
=
len
-
(
outptr
-
outbuf
);
if
(
remaining
<
sizeof
(
struct
dm_target_spec
))
{
param
->
flags
|=
DM_BUFFER_FULL_FLAG
;
break
;
}
spec
=
(
struct
dm_target_spec
*
)
outptr
;
spec
->
status
=
0
;
spec
->
sector_start
=
ti
->
begin
;
spec
->
length
=
ti
->
len
;
strncpy
(
spec
->
target_type
,
ti
->
type
->
name
,
sizeof
(
spec
->
target_type
));
outptr
+=
sizeof
(
struct
dm_target_spec
);
remaining
=
len
-
(
outptr
-
outbuf
);
/* Get the status/table string from the target driver */
if
(
ti
->
type
->
status
)
{
if
(
ti
->
type
->
status
(
ti
,
type
,
outptr
,
remaining
))
{
param
->
flags
|=
DM_BUFFER_FULL_FLAG
;
break
;
}
}
else
outptr
[
0
]
=
'\0'
;
outptr
+=
strlen
(
outptr
)
+
1
;
used
=
param
->
data_start
+
(
outptr
-
outbuf
);
align_ptr
(
outptr
);
spec
->
next
=
outptr
-
outbuf
;
}
if
(
used
)
param
->
data_size
=
used
;
param
->
target_count
=
num_targets
;
}
/*
/*
* Return the status of a device as a text string for each
* Return the status of a device as a text string for each
* target.
* target.
...
...
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