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);
/** * Returns a string representation of this <code>Address</code>. * * @return a string representation of this <code>Address</code>. */ @Override public java.lang.String toString() { return java.lang.Integer.toString(intValue(), 10); } }
@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 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; }
/** * Returns a {@code byte} representation of this <tt>Number</tt>. * * @return a {@code byte} value for this <tt>Number</tt>. */ public byte byteValue() { return (byte) 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()); }
/** * Returns a {@code short} representation of this <tt>Number</tt>. * * @return a {@code short} value for this <tt>Number</tt>. */ public short shortValue() { return (short) intValue(); }
/** * Returns an {@code float} representation of this <tt>Number</tt>. * * @return an {@code float} value for this <tt>Number</tt>. */ public float floatValue() { return (float) intValue(); }
/** * Returns a {@code short} representation of this <tt>Number</tt>. * * @return a {@code short} value for this <tt>Number</tt>. */ public short shortValue() { return (short) intValue(); }
/** * Gets the protocol family of this unix socket address. * * @return The protocol family */ final ProtocolFamily getFamily() { return ProtocolFamily.valueOf(getFamilyField().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().pid.get()); }
/** * Returns an {@code float} representation of this <tt>Number</tt>. * * @return an {@code float} value for this <tt>Number</tt>. */ public float floatValue() { return (float) intValue(); }
/** * Returns a {@code byte} representation of this <tt>Number</tt>. * * @return a {@code byte} value for this <tt>Number</tt>. */ public byte byteValue() { return (byte) intValue(); }
/** * Returns an {@code float} representation of this <tt>Number</tt>. * * @return an {@code float} value for this <tt>Number</tt>. */ public double doubleValue() { return (double) longValue(); }
/** * 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()); }
/** * Returns a {@code short} representation of this <tt>Number</tt>. * * @return a {@code short} value for this <tt>Number</tt>. */ public short shortValue() { return (short) intValue(); }
/** * Gets the protocol family of this unix socket address. * * @return The protocol family */ public final ProtocolFamily getFamily() { return ProtocolFamily.valueOf(getFamilyField().intValue()); }