static int fuafsd_release(const char *path, struct fuse_file_info * fi) { int fd; fd = fi->fh; if (uafs_close(fd) < 0) { return -errno; } return 0; }
/** * Closes this file output stream and releases any system resources * associated with this stream. This file output stream may no longer * be used for writing bytes. * * env the Java environment * obj the current Java object * * @exception AFSFileException if an I/O or other file related error occurs. */ JNIEXPORT void JNICALL Java_org_openafs_jafs_FileOutputStream_close (JNIEnv *env, jobject obj) { int fd, rc; jclass thisClass; jmethodID getFileDescriptorID; char *bytes; jfieldID fid; thisClass = (*env)->GetObjectClass(env, obj); fid = (*env)->GetFieldID(env, thisClass, "fileDescriptor", "I"); fd = (*env)->GetIntField(env, obj, fid); if(fd < 0) { fprintf(stderr, "FileOutputStream::close(): failed to get file descriptor\n"); throwAFSFileException(env, 0, "Failed to get file descriptor!"); } rc = uafs_close(fd); if (rc != 0) { throwAFSFileException(env, rc, NULL); } }