support setting of inodes (using use_ino option)

creates a 64bit inode value from the underlying device value + original inode

final_ino = orig_ino | (dev << 32)

not perfect but given few filesystems use 64bit inodes nor is st_dev more than 16bit usually it should be fine
This commit is contained in:
Antonio SJ Musumeci 2016-12-11 18:27:52 -05:00
parent 365e153ae7
commit c8fa51c81a
6 changed files with 101 additions and 25 deletions

View file

@ -19,6 +19,7 @@
#include "errno.hpp"
#include "fileinfo.hpp"
#include "fs_base_stat.hpp"
#include "fs_inode.hpp"
static
int
@ -28,8 +29,12 @@ _fgetattr(const int fd,
int rv;
rv = fs::fstat(fd,st);
if(rv == -1)
return -errno;
return ((rv == -1) ? -errno : 0);
fs::inode::recompute(st);
return 0;
}
namespace mergerfs
@ -43,8 +48,7 @@ namespace mergerfs
{
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi->fh);
return _fgetattr(fi->fd,
*st);
return _fgetattr(fi->fd,*st);
}
}
}