summaryrefslogtreecommitdiff
path: root/src/readahead
diff options
context:
space:
mode:
authorHarald Hoyer <harald@redhat.com>2013-04-19 13:44:56 +0200
committerHarald Hoyer <harald@redhat.com>2013-04-19 13:59:07 +0200
commitbdd29249a882e599e5e365536372d08dee398cd4 (patch)
treec746a61af928b7458f00175a06b1a882bac18e74 /src/readahead
parentcbeabcfbc5a5fa27385e5794780e8f034e090606 (diff)
Reintroduce f_type comparison macro
This reverts commit 4826f0b7b5c0aefa08b8cc7ef64d69027f84da2c. Because statfs.t_type can be int on some architecures, we have to cast the const magic to the type, otherwise the compiler warns about signed/unsigned comparison, because the magic can be 32 bit unsigned. statfs(2) man page is also wrong on some systems, because f_type is not __SWORD_TYPE on some architecures. The following program: int main(int argc, char**argv) { struct statfs s; statfs(argv[1], &s); printf("sizeof(f_type) = %d\n", sizeof(s.f_type)); printf("sizeof(__SWORD_TYPE) = %d\n", sizeof(__SWORD_TYPE)); printf("sizeof(long) = %d\n", sizeof(long)); printf("sizeof(int) = %d\n", sizeof(int)); if (sizeof(s.f_type) == sizeof(int)) { printf("f_type = 0x%x\n", s.f_type); } else { printf("f_type = 0x%lx\n", s.f_type); } return 0; } executed on s390x gives for a btrfs: sizeof(f_type) = 4 sizeof(__SWORD_TYPE) = 8 sizeof(long) = 8 sizeof(int) = 4 f_type = 0x9123683e
Diffstat (limited to 'src/readahead')
-rw-r--r--src/readahead/readahead-collect.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/readahead/readahead-collect.c b/src/readahead/readahead-collect.c
index 02ecbe56c9..75ec5b70c7 100644
--- a/src/readahead/readahead-collect.c
+++ b/src/readahead/readahead-collect.c
@@ -505,7 +505,7 @@ done:
on_ssd = fs_on_ssd(root) > 0;
log_debug("On SSD: %s", yes_no(on_ssd));
- on_btrfs = statfs(root, &sfs) >= 0 && sfs.f_type == (__SWORD_TYPE) BTRFS_SUPER_MAGIC;
+ on_btrfs = statfs(root, &sfs) >= 0 && F_TYPE_CMP(sfs.f_type, BTRFS_SUPER_MAGIC);
log_debug("On btrfs: %s", yes_no(on_btrfs));
if (asprintf(&pack_fn_new, "%s/.readahead.new", root) < 0) {