summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/diskspace.h
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-09-08 03:43:49 +0200
committerDan McGee <dan@archlinux.org>2011-09-08 04:05:04 +0200
commit8ffa2b24a5e3d63d6f34a1257ed67904ec051e3d (patch)
tree0fa0ee4e513c2207af8f40eff705b18848906630 /lib/libalpm/diskspace.h
parentb961ebe16ffb75bb947a193daa9e9fe639b6403d (diff)
downloadpacman-8ffa2b24a5e3d63d6f34a1257ed67904ec051e3d.tar.gz
pacman-8ffa2b24a5e3d63d6f34a1257ed67904ec051e3d.tar.xz
Use more correct integer types in diskspace checks
This adjusts type usage to match POSIX provided types from <sys/types.h> rather than assuming everything will fit in a long or unsigned long. Use fsblkcnt_t (unsigned) and blkcnt_t (signed) as appropriate. These are affected the same way off_t is on 32 bit platforms, where the types are extende to 64 bits if large file support is enabled. Because most numbers here are block counts, this isn't near as pressing as using a 32-bit variable for file sizes where anything over 2GiB can burn you; we likely can support files at least 512 but mainly 4096 times larger. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/diskspace.h')
-rw-r--r--lib/libalpm/diskspace.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/libalpm/diskspace.h b/lib/libalpm/diskspace.h
index 79e16772..5944bb17 100644
--- a/lib/libalpm/diskspace.h
+++ b/lib/libalpm/diskspace.h
@@ -26,6 +26,9 @@
#if defined(HAVE_SYS_STATVFS_H)
#include <sys/statvfs.h>
#endif
+#if defined(HAVE_SYS_TYPES_H)
+#include <sys/types.h>
+#endif
#include "alpm.h"
@@ -39,8 +42,8 @@ typedef struct __alpm_mountpoint_t {
char *mount_dir;
size_t mount_dir_len;
/* storage for additional disk usage calculations */
- long blocks_needed;
- long max_blocks_needed;
+ blkcnt_t blocks_needed;
+ blkcnt_t max_blocks_needed;
enum mount_used_level used;
int read_only;
FSSTATSTYPE fsp;