/** * Reads the contents of a directory. * * @param path The FS path of the directory * @param buff The FUSE buffer to fill * @param filter FUSE filter * @param offset Ignored in alluxio-fuse * @param fi FileInfo data structure kept by FUSE * @return 0 on success, a negative value on error */ @Override public int readdir(String path, Pointer buff, FuseFillDir filter, @off_t long offset, FuseFileInfo fi) { final AlluxioURI turi = mPathResolverCache.getUnchecked(path); LOG.trace("readdir({}) [Alluxio: {}]", path, turi); try { final List<URIStatus> ls = mFileSystem.listStatus(turi); // standard . and .. entries filter.apply(buff, ".", null, 0); filter.apply(buff, "..", null, 0); for (final URIStatus file : ls) { filter.apply(buff, file.getName(), null, 0); } } catch (Throwable t) { LOG.error("Failed to read directory {}", path, t); return AlluxioFuseUtils.getErrorCode(t); } return 0; }
public int write(String path, Pointer buf, @size_t long size, @off_t long offset, FuseFileInfo fi) { if (size > Integer.MAX_VALUE) {
public int read(String path, Pointer buf, @size_t long size, @off_t long offset, FuseFileInfo fi) {
/** * Allocates space for an open file * <p> * This function ensures that required space is allocated for specified * file. If this function returns success then any subsequent write * request to specified range is guaranteed not to fail because of lack * of space on the file system media. */ int fallocate(String path, int mode, @off_t long off, @off_t long length, FuseFileInfo fi); }
/** * Allocates space for an open file * <p> * This function ensures that required space is allocated for specified * file. If this function returns success then any subsequent write * request to specified range is guaranteed not to fail because of lack * of space on the file system media. */ int fallocate(String path, int mode, @off_t long off, @off_t long length, FuseFileInfo fi); }
@Override @NotImplemented public int readdir(String path, Pointer buf, FuseFillDir filter, @off_t long offset, FuseFileInfo fi) { return 0; }
/** * Write data to an open file * <p> * Write should return exactly the number of bytes requested * except on error. An exception to this is when the 'direct_io' * mount option is specified (see read operation). */ int write(String path, Pointer buf, @size_t long size, @off_t long offset, FuseFileInfo fi);
@Override @NotImplemented public int truncate(String path, @off_t long size) { return 0; }
@Override @NotImplemented public int readdir(String path, Pointer buf, FuseFillDir filter, @off_t long offset, FuseFileInfo fi) { return 0; }
/** * Read data from an open file * <p> * Read should return exactly the number of bytes requested except * on EOF or error, otherwise the rest of the data will be * substituted with zeroes. An exception to this is when the * 'direct_io' mount option is specified, in which case the return * value of the read system call will reflect the return value of * this operation. */ int read(String path, Pointer buf, @size_t long size, @off_t long offset, FuseFileInfo fi);
/** * Write data to an open file * <p> * Write should return exactly the number of bytes requested * except on error. An exception to this is when the 'direct_io' * mount option is specified (see read operation). */ int write(String path, Pointer buf, @size_t long size, @off_t long offset, FuseFileInfo fi);
@Override @NotImplemented public int truncate(String path, @off_t long size) { return 0; }
@Override @NotImplemented public int read(String path, Pointer buf, @size_t long size, @off_t long offset, FuseFileInfo fi) { return 0; }
@Override @NotImplemented public int write(String path, Pointer buf, @size_t long size, @off_t long offset, FuseFileInfo fi) { return 0; }
@Override @NotImplemented public int ftruncate(String path, @off_t long size, FuseFileInfo fi) { return truncate(path, size); }
@Override @NotImplemented public int read(String path, Pointer buf, @size_t long size, @off_t long offset, FuseFileInfo fi) { return 0; }
@Override public int readdir(String path, Pointer buf, FuseFillDir filter, @off_t long offset, FuseFileInfo fi) { if (!"/".equals(path)) { return -ErrorCodes.ENOENT(); } filter.apply(buf, ".", null, 0); filter.apply(buf, "..", null, 0); filter.apply(buf, HELLO_PATH.substring(1), null, 0); return 0; }
@Override public int write(String path, Pointer buf, @size_t long size, @off_t long offset, FuseFileInfo fi) { MemoryPath p = getPath(path); if (p == null) { return -ErrorCodes.ENOENT(); } if (!(p instanceof MemoryFile)) { return -ErrorCodes.EISDIR(); } return ((MemoryFile) p).write(buf, size, offset); } }
@Override public int read(String path, Pointer buf, @size_t long size, @off_t long offset, FuseFileInfo fi) { MemoryPath p = getPath(path); if (p == null) { return -ErrorCodes.ENOENT(); } if (!(p instanceof MemoryFile)) { return -ErrorCodes.EISDIR(); } return ((MemoryFile) p).read(buf, size, offset); }