Skip to content

Commit

Permalink
updated support from libfuse2 to libfuse3
Browse files Browse the repository at this point in the history
  • Loading branch information
fangfufu committed Aug 26, 2024
1 parent 4aea898 commit d9d81ad
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install libgumbo-dev libfuse-dev libssl-dev \
sudo apt-get install libgumbo-dev libfuse3-dev libssl-dev \
libcurl4-openssl-dev uuid-dev help2man libexpat1-dev pkg-config \
meson
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ For important development related documentation, please refer
Under Debian 12 "Bookworm" and newer versions, you need the following
dependencies:

libgumbo-dev libfuse-dev libssl-dev libcurl4-openssl-dev uuid-dev help2man
libgumbo-dev libfuse3-dev libssl-dev libcurl4-openssl-dev uuid-dev help2man
libexpat1-dev pkg-config meson

You can then compile the program similar to how you compile a typical program
Expand All @@ -78,6 +78,10 @@ To uninstall the program, do the following:

sudo ninja uninstall

To clean the build directory, run:

ninja clean

For more information, please refer to this
[tutorial](https://mesonbuild.com/Tutorial.html).

Expand Down
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ c_args = [

gumbo_dep = dependency('gumbo')
libcurl_dep = dependency('libcurl')
fuse_dep = dependency('fuse')
fuse_dep = dependency('fuse3')
uuid_dep = dependency('uuid')
expat_dep = dependency('expat')
openssl_dep = dependency('openssl')
Expand Down
18 changes: 11 additions & 7 deletions src/fuse_local.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@
/*
* must be included before including <fuse.h>
*/
#define FUSE_USE_VERSION 26
#define FUSE_USE_VERSION 30
#include <fuse.h>

#include <errno.h>
#include <string.h>
#include <unistd.h>

static void *fs_init(struct fuse_conn_info *conn)
static void *fs_init(struct fuse_conn_info *conn, struct fuse_config *cfg)
{
(void) conn;
(void) cfg;
return NULL;
}

Expand All @@ -31,8 +32,10 @@ static int fs_release(const char *path, struct fuse_file_info *fi)
}

/** \brief return the attributes for a single file indicated by path */
static int fs_getattr(const char *path, struct stat *stbuf)
static int fs_getattr(const char *path, struct stat *stbuf,
struct fuse_file_info *ffi_buf)
{
(void) ffi_buf;
int res = 0;
memset(stbuf, 0, sizeof(struct stat));

Expand Down Expand Up @@ -138,10 +141,11 @@ static int fs_open(const char *path, struct fuse_file_info *fi)
*/
static int
fs_readdir(const char *path, void *buf, fuse_fill_dir_t dir_add,
off_t offset, struct fuse_file_info *fi)
off_t offset, struct fuse_file_info *fi, enum fuse_readdir_flags fr_flags)
{
(void) offset;
(void) fi;
(void) fr_flags;
LinkTable *linktbl;

#ifdef DEBUG
Expand All @@ -159,13 +163,13 @@ fs_readdir(const char *path, void *buf, fuse_fill_dir_t dir_add,
/*
* start adding the links
*/
dir_add(buf, ".", NULL, 0);
dir_add(buf, "..", NULL, 0);
dir_add(buf, ".", NULL, 0, 0);
dir_add(buf, "..", NULL, 0, 0);
/* We skip the head link */
for (int i = 1; i < linktbl->num; i++) {
Link *link = linktbl->links[i];
if (link->type != LINK_INVALID) {
dir_add(buf, link->linkname, NULL, 0);
dir_add(buf, link->linkname, NULL, 0, 0);
}
}

Expand Down
30 changes: 15 additions & 15 deletions src/link.c
Original file line number Diff line number Diff line change
Expand Up @@ -504,21 +504,21 @@ static void LinkTable_fill(LinkTable *linktbl)
LinkTable_uninitialised_fill(linktbl);
}

/**
* \brief Reset invalid links in the link table
*/
static void LinkTable_invalid_reset(LinkTable *linktbl)
{
int j = 0;
for (int i = 0; i < linktbl->num; i++) {
Link *this_link = linktbl->links[i];
if (this_link->type == LINK_INVALID) {
this_link->type = LINK_UNINITIALISED_FILE;
j++;
}
}
lprintf(debug, "%d invalid links\n", j);
}
// /**
// * \brief Reset invalid links in the link table
// */
// static void LinkTable_invalid_reset(LinkTable *linktbl)
// {
// int j = 0;
// for (int i = 0; i < linktbl->num; i++) {
// Link *this_link = linktbl->links[i];
// if (this_link->type == LINK_INVALID) {
// this_link->type = LINK_UNINITIALISED_FILE;
// j++;
// }
// }
// lprintf(debug, "%d invalid links\n", j);
// }

void LinkTable_free(LinkTable *linktbl)
{
Expand Down

0 comments on commit d9d81ad

Please sign in to comment.