minimal example filesystem that prints out all capabilities supported by the kernel and then exits.
Compile with:
gcc -Wall printcap.c `pkg-config fuse3 --cflags --libs` -o printcap
Source code
#define FUSE_USE_VERSION 31
#include <config.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
struct fuse_session *se;
static void pc_init(void *userdata,
{
(void) userdata;
printf("Capabilities:\n");
printf("\tFUSE_CAP_WRITEBACK_CACHE\n");
printf("\tFUSE_CAP_ASYNC_READ\n");
printf("\tFUSE_CAP_POSIX_LOCKS\n");
printf("\tFUSE_CAP_ATOMIC_O_TRUNC\n");
printf("\tFUSE_CAP_EXPORT_SUPPORT\n");
printf("\tFUSE_CAP_DONT_MASK\n");
printf("\tFUSE_CAP_SPLICE_MOVE\n");
printf("\tFUSE_CAP_SPLICE_READ\n");
printf("\tFUSE_CAP_SPLICE_WRITE\n");
printf("\tFUSE_CAP_FLOCK_LOCKS\n");
printf("\tFUSE_CAP_IOCTL_DIR\n");
printf("\tFUSE_CAP_AUTO_INVAL_DATA\n");
printf("\tFUSE_CAP_READDIRPLUS\n");
printf("\tFUSE_CAP_READDIRPLUS_AUTO\n");
printf("\tFUSE_CAP_ASYNC_DIO\n");
printf("\tFUSE_CAP_WRITEBACK_CACHE\n");
printf("\tFUSE_CAP_NO_OPEN_SUPPORT\n");
printf("\tFUSE_CAP_PARALLEL_DIROPS\n");
printf("\tFUSE_CAP_POSIX_ACL\n");
printf("\tFUSE_CAP_CACHE_SYMLINKS\n");
printf("\tFUSE_CAP_NO_OPENDIR_SUPPORT\n");
printf("\tFUSE_CAP_EXPLICIT_INVAL_DATA\n");
}
};
int main(int argc, char **argv)
{
char *mountpoint;
int ret = -1;
mountpoint = strdup("/tmp/fuse_printcap_XXXXXX");
if(mkdtemp(mountpoint) == NULL) {
perror("mkdtemp");
return 1;
}
sizeof(pc_oper), NULL);
if (se == NULL)
goto err_out1;
goto err_out2;
goto err_out3;
err_out3:
err_out2:
err_out1:
rmdir(mountpoint);
free(mountpoint);
return ret ? 1 : 0;
}
Definition in file printcap.c.