diff options
-rw-r--r-- | ChangeLog | 20 | ||||
-rw-r--r-- | NEWS | 10 | ||||
-rw-r--r-- | include/fuse.h | 41 | ||||
-rw-r--r-- | kernel/dir.c | 6 |
4 files changed, 65 insertions, 12 deletions
@@ -1,3 +1,23 @@ +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 @@ -1,3 +1,13 @@ +What is new in 2.3 + + - Add new directory related operations: opendir(), readdir(), + releasedir() and fsyncdir(). + + - Update kernel ABI so that on dual architectures (e.g. AMD64) 32bit + binaries work under a 64bit kernel + + - Bugfixes + What is new in 2.2 Userspace changes: diff --git a/include/fuse.h b/include/fuse.h index 5e5cd45..35ec49f 100644 --- a/include/fuse.h +++ b/include/fuse.h @@ -62,6 +62,19 @@ typedef struct fuse_dirhandle *fuse_dirh_t; 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() */ @@ -85,9 +98,10 @@ struct fuse_file_info { * 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. @@ -243,18 +257,27 @@ struct fuse_operations { 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 *); @@ -269,7 +292,7 @@ struct fuse_operations { /** * Clean up filesystem - * + * * Called on filesystem exit. */ void (*destroy) (void *); diff --git a/kernel/dir.c b/kernel/dir.c index ecd6108..093bbb9 100644 --- a/kernel/dir.c +++ b/kernel/dir.c @@ -506,19 +506,19 @@ static int parse_dirfile(char *buf, size_t nbytes, struct file *file, 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; |