* Windows version of ext2fs_get_device_size by Chris Li, VMware.
*
* %Begin-Header%
- * This file may be redistributed under the terms of the GNU Public
- * License.
+ * This file may be redistributed under the terms of the GNU Library
+ * General Public License, version 2.
* %End-Header%
*/
#define _LARGEFILE_SOURCE
#define _LARGEFILE64_SOURCE
+#include "config.h"
#include <stdio.h>
#if HAVE_UNISTD_H
#include <unistd.h>
char ch;
#endif /* HAVE_SYS_DISKLABEL_H */
-#ifdef HAVE_OPEN64
- fd = open64(file, O_RDONLY);
-#else
- fd = open(file, O_RDONLY);
-#endif
+ fd = ext2fs_open_file(file, O_RDONLY, 0);
if (fd < 0)
return errno;
#endif /* HAVE_SYS_DISKLABEL_H */
{
-#ifdef HAVE_FSTAT64
- struct stat64 st;
- if (fstat64(fd, &st) == 0)
-#else
- struct stat st;
- if (fstat(fd, &st) == 0)
-#endif
+ ext2fs_struct_stat st;
+
+ if (ext2fs_fstat(fd, &st) == 0)
if (S_ISREG(st.st_mode)) {
*retblocks = st.st_size / blocksize;
goto out;