@Test public void statfs() throws Exception { Runtime runtime = Runtime.getSystemRuntime(); Pointer pointer = runtime.getMemoryManager().allocateTemporary(4 * Constants.KB, true); Statvfs stbuf = Statvfs.of(pointer); int blockSize = 4 * Constants.KB; int totalBlocks = 4; int freeBlocks = 3; BlockMasterClient blockMasterClient = PowerMockito.mock(BlockMasterClient.class); PowerMockito.mockStatic(BlockMasterClient.Factory.class); when(BlockMasterClient.Factory.create(any())).thenReturn(blockMasterClient); BlockMasterInfo blockMasterInfo = new BlockMasterInfo(); blockMasterInfo.setCapacityBytes(totalBlocks * blockSize); blockMasterInfo.setFreeBytes(freeBlocks * blockSize); when(blockMasterClient.getBlockMasterInfo(any())).thenReturn(blockMasterInfo); assertEquals(0, mFuseFs.statfs("/", stbuf)); assertEquals(blockSize, stbuf.f_bsize.intValue()); assertEquals(blockSize, stbuf.f_frsize.intValue()); assertEquals(totalBlocks, stbuf.f_blocks.longValue()); assertEquals(freeBlocks, stbuf.f_bfree.longValue()); assertEquals(freeBlocks, stbuf.f_bavail.longValue()); assertEquals(AlluxioFuseFileSystem.UNKNOWN_INODES, stbuf.f_files.intValue()); assertEquals(AlluxioFuseFileSystem.UNKNOWN_INODES, stbuf.f_ffree.intValue()); assertEquals(AlluxioFuseFileSystem.UNKNOWN_INODES, stbuf.f_favail.intValue()); assertEquals(AlluxioFuseFileSystem.MAX_NAME_LENGTH, stbuf.f_namemax.intValue()); }
@Override public int statfs(String path, Statvfs stbuf) { return AlluxioFuseUtils.call(LOG, () -> statfsInternal(path, stbuf), "statfs", "path=%s", path); }
AlluxioFuseFileSystem extends FuseStubFS { @Override public int statfs(String path, Statvfs stbuf) { return AlluxioFuseUtils.call(LOG, () -> statfsInternal(path, stbuf), "statfs", "path=%s", path); } }
AlluxioFuseFileSystem extends FuseStubFS { @Override public int statfs(String path, Statvfs stbuf) { return AlluxioFuseUtils.call(LOG, () -> statfsInternal(path, stbuf), "statfs", "path=%s", path); } AlluxioFuseFileSystem(FileSystem fs, AlluxioFuseOptions opts, AlluxioConfiguration conf); }
AlluxioFuseFileSystem extends FuseStubFS { @Override public int statfs(String path, Statvfs stbuf) { return AlluxioFuseUtils.call(LOG, () -> statfsInternal(path, stbuf), "statfs", "path=%s", path); } AlluxioFuseFileSystem(FileSystem fs, AlluxioFuseOptions opts, AlluxioConfiguration conf); @Override int chmod(String path, @mode_t long mode); @Override int chown(String path, @uid_t long uid, @gid_t long gid); @Override int create(String path, @mode_t long mode, FuseFileInfo fi); @Override int flush(String path, FuseFileInfo fi); @Override int getattr(String path, FileStat stat); @Override String getFSName(); @Override int mkdir(String path, @mode_t long mode); @Override int open(String path, FuseFileInfo fi); @Override int read(String path, Pointer buf, @size_t long size, @off_t long offset,
      FuseFileInfo fi); @Override int readdir(String path, Pointer buff, FuseFillDir filter,
      @off_t long offset, FuseFileInfo fi); @Override int release(String path, FuseFileInfo fi); @Override int rename(String oldPath, String newPath); @Override int rmdir(String path); @Override int statfs(String path, Statvfs stbuf); @Override int truncate(String path, long size); @Override int unlink(String path); @Override int utimens(String path, Timespec[] timespec); @Override int write(String path, Pointer buf, @size_t long size, @off_t long offset,
                   FuseFileInfo fi); }
AlluxioFuseFileSystem extends FuseStubFS { @Override public int statfs(String path, Statvfs stbuf) { return AlluxioFuseUtils.call(LOG, () -> statfsInternal(path, stbuf), "statfs", "path=%s", path); } AlluxioFuseFileSystem(FileSystem fs, AlluxioFuseOptions opts, AlluxioConfiguration conf); @Override int chmod(String path, @mode_t long mode); @Override int chown(String path, @uid_t long uid, @gid_t long gid); @Override int create(String path, @mode_t long mode, FuseFileInfo fi); @Override int flush(String path, FuseFileInfo fi); @Override int getattr(String path, FileStat stat); @Override String getFSName(); @Override int mkdir(String path, @mode_t long mode); @Override int open(String path, FuseFileInfo fi); @Override int read(String path, Pointer buf, @size_t long size, @off_t long offset,
      FuseFileInfo fi); @Override int readdir(String path, Pointer buff, FuseFillDir filter,
      @off_t long offset, FuseFileInfo fi); @Override int release(String path, FuseFileInfo fi); @Override int rename(String oldPath, String newPath); @Override int rmdir(String path); @Override int statfs(String path, Statvfs stbuf); @Override int truncate(String path, long size); @Override int unlink(String path); @Override int utimens(String path, Timespec[] timespec); @Override int write(String path, Pointer buf, @size_t long size, @off_t long offset,
                   FuseFileInfo fi); @VisibleForTesting
  static final int UNKNOWN_INODES; @VisibleForTesting
  static final int MAX_NAME_LENGTH; @VisibleForTesting
  static final long ID_NOT_SET_VALUE; @VisibleForTesting
  static final long ID_NOT_SET_VALUE_UNSIGNED; }