userlandfs: implement get_fs_info using ioctl

This avoids introducing an entirely custom hook in FUSE.
It uses the ioctl hook in an unconventional way (calling it with no
valid fuse_file_info) but this can be fixed if a filesystem requires it
(by opening a file handle on /, doing the ioctl, then closing again).

An updated version of fusesmb-haiku is available and confirmed working:
https://github.com/haikuarchives/fusesmb-haiku

Change-Id: If1268113874363fa035e5340be75e9f5198216d6
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5199
Reviewed-by: Adrien Destugues <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
PulkoMandy
2022-09-13 18:51:12 +00:00
committed by waddlesplash
parent 750afaef94
commit 49a00a128a
7 changed files with 27 additions and 28 deletions
-13
View File
@@ -37,11 +37,6 @@
extern "C" {
#endif
#ifdef HAS_FUSE_HAIKU_EXTENSIONS
struct fs_info;
extern int gHasHaikuFuseExtensions;
#endif
/* ----------------------------------------------------------- *
* Basic FUSE API *
@@ -459,10 +454,6 @@ struct fuse_operations {
*/
int (*bmap) (const char *, size_t blocksize, uint64_t *idx);
#ifdef HAS_FUSE_HAIKU_EXTENSIONS
int (*get_fs_info) (struct fs_info*);
#endif
/**
* Flag indicating that the filesystem can accept a NULL path
* as the first argument for the following operations:
@@ -903,10 +894,6 @@ void fuse_fs_destroy(struct fuse_fs *fs);
int fuse_notify_poll(struct fuse_pollhandle *ph);
#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
*
@@ -113,6 +113,12 @@ struct fuse_file_info {
#define FUSE_CAP_FLOCK_LOCKS (1 << 10)
#define FUSE_CAP_IOCTL_DIR (1 << 11)
/* Indicate support for Haiku-specific extensions in struct fuse_operations and fuse_ll_ops */
#define FUSE_CAP_HAIKU_FUSE_EXTENSIONS (1 << 31)
#define FUSE_HAIKU_GET_DRIVE_INFO (((uint32_t)'H' << 24) | ((uint32_t)'G' << 16) \
| ((uint32_t)'D' << 8) | (uint32_t)'I')
/**
* Ioctl flags
*