FUSE compat: add Haiku extension

* Add a way for a FUSE module to supply Haiku-specific extensions.
  This allows it to integrate better with Haiku while only requiring
  minimal changes on the FUSE module itself.

* For now, there is only one extension: another function pointer for
  "get_fs_info", which lets the FUSE module fill in an fs_info struct.
  FUSE provides no good way to otherwise communicate extra information,
  such as the volume flags (e.g. B_FS_IS_SHARED).

* A FUSE module can signal that it supports the Haiku extensions by
    a) defining HAS_HAIKU_FUSE_EXTENSIONS before including the fuse
       headers
    b) setting the global variable gHasHaikuFuseExtensions to 1 in
       its initialization
  Otherwise, the Haiku extensions are completely invisible to the
  FUSE module.
This commit is contained in:
Julian Harnath
2017-02-27 19:58:13 +00:00
parent 94d8409150
commit 1263be8fc4
5 changed files with 39 additions and 0 deletions
+13
View File
@@ -36,6 +36,11 @@
extern "C" {
#endif
#ifdef HAS_FUSE_HAIKU_EXTENSIONS
struct fs_info;
extern int gHasHaikuFuseExtensions;
#endif
/* ----------------------------------------------------------- *
* Basic FUSE API *
* ----------------------------------------------------------- */
@@ -423,6 +428,10 @@ struct fuse_operations {
* Introduced in version 2.6
*/
int (*bmap) (const char *, size_t blocksize, uint64_t *idx);
#ifdef HAS_FUSE_HAIKU_EXTENSIONS
int (*get_fs_info) (struct fs_info*);
#endif
};
/** Extra context that may be needed by some filesystems
@@ -658,6 +667,10 @@ int fuse_fs_bmap(struct fuse_fs *fs, const char *path, size_t blocksize,
void fuse_fs_init(struct fuse_fs *fs, struct fuse_conn_info *conn);
void fuse_fs_destroy(struct fuse_fs *fs);
#ifdef HAS_FUSE_HAIKU_EXTENSIONS
int fuse_fs_get_fs_info(struct fuse_fs* fs, struct fs_info* info);
#endif
/**
* Create a new fuse filesystem object
*