projects
/
external
/
busybox.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
tizen 2.0
[external/busybox.git]
/
debian
/
sfdisk
/
disksize.c
1
#include "common.h"
2
3
int disksize(int fd, unsigned long long *sectors) {
4
int err;
5
long sz;
6
long long b;
7
8
err = ioctl(fd, BLKGETSIZE, &sz);
9
if (err)
10
return err;
11
err = ioctl(fd, BLKGETSIZE64, &b);
12
if (err || b == 0 || b == sz)
13
*sectors = sz;
14
else
15
*sectors = (b >> 9);
16
return 0;
17
}