+2005-04-01 Miklos Szeredi <miklos@szeredi.hu>
+
+ * Released 2.3-pre2
+
+2005-04-01 Miklos Szeredi <miklos@szeredi.hu>
+
+ * kernel: fix dirent offset handling
+
+ * lib: add readdir and releasedir methods
+
+ * lib: use fh field of fuse_file_info in opendir, readdir,
+ releasedir and fsyncdir methods
+
+ * lib: check kernel API version and bail out of it's old. This
+ will be properly fixed in the next release
+
+2005-03-31 Miklos Szeredi <miklos@szeredi.hu>
+
+ * Released 2.3-pre1
+
2005-03-31 Miklos Szeredi <miklos@szeredi.hu>
* kernel API: add padding to structures, so 64bit and 32bit
typedef int (*fuse_dirfil_t) (fuse_dirh_t h, const char *name, int type,
ino_t ino);
+/** Function to add an entry in a readdir() operation
+ *
+ * @param buf the buffer passed to the readdir() operation
+ * @param name the file name of the directory entry
+ * @param type the file type (0 if unknown) see <dirent.h>
+ * @param ino the inode number, ignored if "use_ino" mount option is
+ * not specified
+ * @param off offset of the next entry
+ * @return 0 on success, 1 if buffer is full
+ */
+typedef int (*fuse_dirfil5_t) (void *buf, const char *name, int type,
+ ino_t ino, off_t off);
+
/** Information about open files */
struct fuse_file_info {
/** Open flags. Available in open() and release() */
* negated error value (-errno) directly.
*
* All methods are optional, but some are essential for a useful
- * filesystem (e.g. getattr). Flush, release, fsync, init and destroy
- * are special purpose methods, without which a full featured
- * filesystem can still be implemented.
+ * filesystem (e.g. getattr). Flush, release, fsync, opendir,
+ * readdir, releasedir, fsyncdir, init and destroy are special purpose
+ * methods, without which a full featured filesystem can still be
+ * implemented.
*/
struct fuse_operations {
/** Get file attributes.
int (*removexattr) (const char *, const char *);
/** Open direcory
- *
+ *
* This method should check if the open operation is permitted for
- * this directory. The fuse_file_info parameter is currently
- * unused.
+ * this directory
*/
int (*opendir) (const char *, struct fuse_file_info *);
+ /** Read directory
+ *
+ * This is an alternative inteface to getdir(), and if defined
+ * getdir() will not be called
+ */
+ int (*readdir) (const char *, void *, fuse_dirfil5_t, off_t,
+ struct fuse_file_info *);
+
+ /** Release directory */
+ int (*releasedir) (const char *, struct fuse_file_info *);
+
/** Synchronize directory contents
*
* If the datasync parameter is non-zero, then only the user data
- * should be flushed, not the meta data. The fuse_file_info
- * parameter is currently unused
+ * should be flushed, not the meta data
*/
int (*fsyncdir) (const char *, int, struct fuse_file_info *);
/**
* Clean up filesystem
- *
+ *
* Called on filesystem exit.
*/
void (*destroy) (void *);
struct fuse_dirent *dirent = (struct fuse_dirent *) buf;
size_t reclen = FUSE_DIRENT_SIZE(dirent);
int over;
- if (dirent->namelen > FUSE_NAME_MAX)
+ if (!dirent->namelen || dirent->namelen > FUSE_NAME_MAX)
return -EIO;
if (reclen > nbytes)
break;
over = filldir(dstbuf, dirent->name, dirent->namelen,
- dirent->off, dirent->ino, dirent->type);
+ file->f_pos, dirent->ino, dirent->type);
if (over)
break;
buf += reclen;
- file->f_pos += reclen;
nbytes -= reclen;
+ file->f_pos = dirent->off;
}
return 0;