final long fd = fi.fh.get(); OpenFileEntry oe = mOpenFiles.getFirstByField(ID_INDEX, fd); if (oe == null) {
synchronized (mOpenFiles) { mOpenFiles.add(new OpenFileEntry(mNextOpenFileId, path, is, null)); fi.fh.set(mNextOpenFileId);
public Statvfs(jnr.ffi.Runtime runtime) { super(runtime); if (Platform.IS_WINDOWS) { f_bsize = new u_int64_t(); f_frsize = new u_int64_t(); f_blocks = new fsblkcnt64_t(); f_bfree = new fsblkcnt64_t(); f_ffree = new fsfilcnt64_t(); f_favail = new fsfilcnt64_t(); f_fsid = new u_int64_t(); f_flag = new u_int64_t(); f_namemax = new u_int64_t(); f_unused = null; __f_spare = null;
public Statvfs(jnr.ffi.Runtime runtime) { super(runtime); if (Platform.IS_WINDOWS) { f_bsize = new u_int64_t(); f_frsize = new u_int64_t(); f_blocks = new fsblkcnt64_t(); f_bfree = new fsblkcnt64_t(); f_ffree = new fsfilcnt64_t(); f_favail = new fsfilcnt64_t(); f_fsid = new u_int64_t(); f_flag = new u_int64_t(); f_namemax = new u_int64_t(); f_unused = null; __f_spare = null;
protected FuseFileInfo(jnr.ffi.Runtime runtime) { super(runtime); if(!Platform.IS_WINDOWS) { flags = new Signed32(); fh_old = new UnsignedLong(); direct_io = new Padding(NativeType.UCHAR, 1); keep_cache = new Padding(NativeType.UCHAR, 1); flush = new Padding(NativeType.UCHAR, 1); nonseekable = new Padding(NativeType.UCHAR, 1); flock_release = new Padding(NativeType.UCHAR, 1); padding = new Padding(NativeType.UCHAR, 3); fh = new u_int64_t(); lock_owner = new u_int64_t(); } else { flags = new Signed32(); fh_old = new Unsigned32(); new Signed32(); // writepage direct_io = new Padding(NativeType.UCHAR, 1); keep_cache = new Padding(NativeType.UCHAR, 1); flush = new Padding(NativeType.UCHAR, 1); nonseekable = new Padding(NativeType.UCHAR, 1); flock_release = new Padding(NativeType.UCHAR, 0); padding = new Padding(NativeType.UCHAR, 0); fh = new u_int64_t(); lock_owner = new u_int64_t(); } }
protected FuseFileInfo(jnr.ffi.Runtime runtime) { super(runtime); if(!Platform.IS_WINDOWS) { flags = new Signed32(); fh_old = new UnsignedLong(); direct_io = new Padding(NativeType.UCHAR, 1); keep_cache = new Padding(NativeType.UCHAR, 1); flush = new Padding(NativeType.UCHAR, 1); nonseekable = new Padding(NativeType.UCHAR, 1); flock_release = new Padding(NativeType.UCHAR, 1); padding = new Padding(NativeType.UCHAR, 3); fh = new u_int64_t(); lock_owner = new u_int64_t(); } else { flags = new Signed32(); fh_old = new Unsigned32(); new Signed32(); // writepage direct_io = new Padding(NativeType.UCHAR, 1); keep_cache = new Padding(NativeType.UCHAR, 1); flush = new Padding(NativeType.UCHAR, 1); nonseekable = new Padding(NativeType.UCHAR, 1); flock_release = new Padding(NativeType.UCHAR, 0); padding = new Padding(NativeType.UCHAR, 0); fh = new u_int64_t(); lock_owner = new u_int64_t(); } }
final long fd = fi.fh.get(); OpenFileEntry oe = mOpenFiles.getFirstByField(ID_INDEX, fd); if (oe == null) {
/** * Releases the resources associated to an open file. Release() is async. * * Guaranteed to be called once for each open() or create(). * * @param path the FS path of the file to release * @param fi FileInfo data structure kept by FUSE * @return 0. The return value is ignored by FUSE (any error should be reported * on flush instead) */ @Override public int release(String path, FuseFileInfo fi) { LOG.trace("release({})", path); OpenFileEntry oe; final long fd = fi.fh.get(); synchronized (mOpenFiles) { oe = mOpenFiles.getFirstByField(ID_INDEX, fd); mOpenFiles.remove(oe); } if (oe == null) { LOG.error("Cannot find fd for {} in table", path); return -ErrorCodes.EBADFD(); } try { oe.close(); } catch (IOException e) { LOG.error("Failed closing {} [in]", path, e); } return 0; }
/** * Flushes cached data on Alluxio. * * Called on explicit sync() operation or at close(). * * @param path The path on the FS of the file to close * @param fi FileInfo data struct kept by FUSE * @return 0 on success, a negative value on error */ @Override public int flush(String path, FuseFileInfo fi) { LOG.trace("flush({})", path); final long fd = fi.fh.get(); OpenFileEntry oe = mOpenFiles.getFirstByField(ID_INDEX, fd); if (oe == null) { LOG.error("Cannot find fd for {} in table", path); return -ErrorCodes.EBADFD(); } if (oe.getOut() != null) { try { oe.getOut().flush(); } catch (IOException e) { LOG.error("Failed to flush {}", path, e); return -ErrorCodes.EIO(); } } else { LOG.debug("Not flushing: {} was not open for writing", path); } return 0; }
synchronized (mOpenFiles) { mOpenFiles.add(new OpenFileEntry(mNextOpenFileId, path, null, os)); fi.fh.set(mNextOpenFileId);