Skip to content

Commit

Permalink
handle 32bit inode sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
trapexit committed Apr 6, 2017
1 parent 25fe57f commit 151bd4a
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/fs_inode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,16 @@ namespace fs
void
recompute(struct stat &st)
{
/*
Some OSes have 32-bit device IDs, so box this up first.
This does also presume a 64-bit inode value.
*/
uint64_t st_dev = (uint64_t)st.st_dev;
st.st_ino |= (st_dev << 32);
switch(sizeof(st.st_ino))
{
case 4:
st.st_ino |= ((uint32_t)st.st_dev << 16);
break;
case 8:
default:
st.st_ino |= ((uint64_t)st.st_dev << 32);
break;
}
}
}
}
Expand Down

0 comments on commit 151bd4a

Please sign in to comment.