/* close any open files inside the file cache */ int ifuseFileCacheClose( fileCache_t *fileCache ) { int status = 0; LOCK_STRUCT( *fileCache ); if ( fileCache->state == NO_FILE_CACHE ) { /* close remote file */ //UNLOCK_STRUCT( *fileCache ); iFuseConn_t *conn = getAndUseConnByPath( fileCache->localPath, &status ); //LOCK_STRUCT( *fileCache ); status = closeIrodsFd( conn->conn, fileCache->iFd ); unuseIFuseConn( conn ); fileCache->offset = 0; } else { /* close local file */ status = close( fileCache->iFd ); fileCache->iFd = 0; fileCache->offset = 0; } UNLOCK_STRUCT( *fileCache ); return status; }
int irodsMknod (const char *path, mode_t mode, dev_t rdev) { pathCache_t *tmpPathCache = NULL; struct stat stbuf; int status = -1; char cachePath[MAX_NAME_LEN]; char objPath[MAX_NAME_LEN]; iFuseConn_t *iFuseConn = NULL; fileCache_t *fileCache = NULL; /* iFuseDesc_t *desc = NULL; */ int localFd; rodsLog (LOG_DEBUG, "irodsMknod: %s", path); if (irodsGetattr (path, &stbuf) >= 0) return -EEXIST; status = irodsMknodWithCache ((char *)path, mode, cachePath); localFd = status; status = parseRodsPathStr ((char *) (path + 1) , &MyRodsEnv, objPath); if (status < 0) { rodsLogError (LOG_ERROR, status, "dataObjCreateByFusePath: parseRodsPathStr of %s error", path); /* use ENOTDIR for this type of error */ return -ENOTDIR; } getAndUseIFuseConn (&iFuseConn, &MyRodsEnv); if (status < 0) { status = dataObjCreateByFusePath (iFuseConn->conn, (char *) path, mode, objPath); if (status < 0) { if (isReadMsgError (status)) { ifuseReconnect (iFuseConn); status = dataObjCreateByFusePath (iFuseConn->conn, (char *) path, mode, objPath); } if (status < 0) { rodsLogError (LOG_ERROR, status, "irodsMknod: rcDataObjCreate of %s error", path); unuseIFuseConn (iFuseConn); return -ENOENT; } } } fileCache = addFileCache(localFd, objPath, (char *) path, cachePath, mode, 0, HAVE_NEWLY_CREATED_CACHE); stbuf.st_mode = mode; pathExist ((char *) path, fileCache, &stbuf, &tmpPathCache); /* desc = newIFuseDesc (objPath, (char *) path, fileCache, &status); */ if (status < 0) { rodsLogError (LOG_ERROR, status, "irodsMknod: allocIFuseDesc of %s error", path); closeIrodsFd (iFuseConn->conn, status); unuseIFuseConn (iFuseConn); return 0; } /* rodsLog (LOG_ERROR, "irodsMknod: %s conn: %p", path, iFuseConn);*/ unuseIFuseConn (iFuseConn); return (0); }