Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
ioping
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
ioping
Commits
9d127d20
Commit
9d127d20
authored
Jun 09, 2011
by
Konstantin Khlebnikov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add get_block_size()
parent
44aac25f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
ioping.c
ioping.c
+11
-6
No files found.
ioping.c
View file @
9d127d20
...
...
@@ -329,6 +329,16 @@ out:
fclose
(
file
);
}
off_t
get_device_size
(
int
fd
)
{
unsigned
long
long
blksize
;
if
(
ioctl
(
fd
,
BLKGETSIZE64
,
&
blksize
))
err
(
2
,
"block get size ioctl failed"
);
return
blksize
;
}
void
sig_exit
(
int
signo
)
{
(
void
)
signo
;
...
...
@@ -378,16 +388,11 @@ int main (int argc, char **argv)
if
(
!
quiet
)
parse_device
(
st
.
st_dev
);
}
else
if
(
S_ISBLK
(
st
.
st_mode
))
{
unsigned
long
long
blksize
;
fd
=
open
(
path
,
flags
);
if
(
fd
<
0
)
err
(
2
,
"failed to open
\"
%s
\"
"
,
path
);
ret
=
ioctl
(
fd
,
BLKGETSIZE64
,
&
blksize
);
if
(
ret
)
err
(
2
,
"block get size ioctl failed"
);
st
.
st_size
=
blksize
;
st
.
st_size
=
get_device_size
(
fd
);
fstype
=
"block"
;
device
=
"device"
;
...
...
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