stat.st_size.set(size); stat.st_blocks.set((int) Math.ceil((double) size / 512)); stat.st_ctim.tv_nsec.set(ctime_nsec); stat.st_mtim.tv_sec.set(ctime_sec); stat.st_mtim.tv_nsec.set(ctime_nsec); mode |= FileStat.S_IFREG; stat.st_mode.set(mode); stat.st_nlink.set(1); } catch (Throwable t) { LOG.error("Failed to get info of {}", path, t);
@Override public int getattr(String path, FileStat stat) { int res = 0; if (Objects.equals(path, "/")) { stat.st_mode.set(FileStat.S_IFDIR | 0755); stat.st_nlink.set(2); } else if (HELLO_PATH.equals(path)) { stat.st_mode.set(FileStat.S_IFREG | 0444); stat.st_nlink.set(1); stat.st_size.set(HELLO_STR.getBytes().length); } else { res = -ErrorCodes.ENOENT(); } return res; }
@Override public int getattr(String path, FileStat stat) { int res = 0; if (Objects.equals(path, "/")) { stat.st_mode.set(FileStat.S_IFDIR | 0755); stat.st_nlink.set(2); } else if (HELLO_PATH.equals(path)) { stat.st_mode.set(FileStat.S_IFREG | 0444); stat.st_nlink.set(1); stat.st_size.set(HELLO_STR.getBytes().length); } else { res = -ErrorCodes.ENOENT(); } return res; }
@Override public int statfs(String path, Statvfs stbuf) { if (Platform.getNativePlatform().getOS() == WINDOWS) { // statfs needs to be implemented on Windows in order to allow for copying // data from other devices because winfsp calculates the volume size based // on the statvfs call. // see https://github.com/billziss-gh/winfsp/blob/14e6b402fe3360fdebcc78868de8df27622b565f/src/dll/fuse/fuse_intf.c#L654 if ("/".equals(path)) { stbuf.f_blocks.set(1024 * 1024); // total data blocks in file system stbuf.f_frsize.set(1024); // fs block size stbuf.f_bfree.set(1024 * 1024); // free blocks in fs } } return super.statfs(path, stbuf); }
@Override public int statfs(String path, Statvfs stbuf) { if (Platform.getNativePlatform().getOS() == WINDOWS) { // statfs needs to be implemented on Windows in order to allow for copying // data from other devices because winfsp calculates the volume size based // on the statvfs call. // see https://github.com/billziss-gh/winfsp/blob/14e6b402fe3360fdebcc78868de8df27622b565f/src/dll/fuse/fuse_intf.c#L654 if ("/".equals(path)) { stbuf.f_blocks.set(1024 * 1024); // total data blocks in file system stbuf.f_frsize.set(1024); // fs block size stbuf.f_bfree.set(1024 * 1024); // free blocks in fs } } return super.statfs(path, stbuf); }
@Override protected void getattr(FileStat stat) { stat.st_mode.set(FileStat.S_IFDIR | 0777); stat.st_uid.set(getContext().uid.get()); stat.st_gid.set(getContext().pid.get()); }
/** * Sets the protocol family of this unix socket address. * * @param family The protocol family, usually {@link ProtocolFamily#PF_UNIX} */ final void setFamily(ProtocolFamily family) { getFamilyField().set(family.intValue()); }
@Override protected void getattr(FileStat stat) { stat.st_mode.set(FileStat.S_IFDIR | 0777); stat.st_uid.set(getContext().uid.get()); stat.st_gid.set(getContext().gid.get()); }
/** * Sets the protocol family of this unix socket address. * * @param family The protocol family, usually {@link com.kenai.constantine.platform.ProtocolFamily.PF_UNIX} */ public final void setFamily(ProtocolFamily family) { getFamilyField().set(family.value()); }