Make the library when building dist and normal targets
[omfsprogs.git] / disksize.c
blob735a33fe704cf16a4b346e9cb6b31b200edc6ccd
1 /*
2 * disksize.c - Try to get the size of a disk.
4 * At present this relies on fseeko and such. Could do something
5 * smarter here like a binary search if this needs to be more portable.
6 */
7 #include <stdio.h>
8 #include "disksize.h"
10 int get_disk_size(char *device, u64 *size)
12 FILE *fp = fopen(device, "r");
13 if (!fp)
14 return 0;
16 fseeko(fp, 0, SEEK_END);
17 *size = ftello(fp);
18 return 1;