$NetBSD: patch-aa,v 1.2 2022/01/22 18:41:21 pho Exp $ Hunk #0: Be explicit about the API version it wants to use. Hunk #1, #2, #3, #5: httpfs performs a weird hack that obtains a reference to the directory it is going to be mounted on, and then tries to call statvfs(2) and opendir(3) on that directory in respective filesystem callbacks. On Linux this can somehow avoid deadlocks it seems (possibly due to the way how Linux vfs is implemented?), but on NetBSD it can't. Don't try to do that. Hunk #4: Workaround for NetBSD librefuse that had an API incompatible with FUSE. Already fixed in HEAD. --- httpfs.c.orig 2006-08-26 06:29:28.000000000 +0000 +++ httpfs.c @@ -1,3 +1,5 @@ +#define FUSE_USE_VERSION 25 + /* * HTTPFS: import a file from a web server to local file system * the main use is, to mount an iso on a web server with loop device @@ -550,6 +552,9 @@ static int httpfs_readlink(const char *p static int httpfs_readdir(const char *path, void *buf, fuse_fill_dir_t filler, off_t offset, struct fuse_file_info *fi) { +#if defined(__NetBSD__) + filler(buf, httpfs_path + 1, NULL, 0); +#else DIR *dp; struct dirent *de; (void) offset; @@ -574,6 +579,7 @@ static int httpfs_readdir(const char *pa } closedir(dp); +#endif return 0; } @@ -778,11 +784,15 @@ static int httpfs_statfs(const char *pat int res; (void) path; +#if defined(__NetBSD__) + return -ENOSYS; +#else res = statvfs(".", stbuf); if (res == -1) return -errno; return 0; +#endif } static int httpfs_release(const char *path, struct fuse_file_info *fi) { @@ -802,7 +812,11 @@ static int httpfs_fsync(const char *path return 0; } +#if defined(__NetBSD__) && FUSE_H_ < 20211204 +static void *httpfs_init(struct fuse_conn_info *conn) { +#else static void *httpfs_init(void) { +#endif fchdir(targetFd); /* that's the catch */ return NULL; } @@ -924,11 +938,15 @@ int main(int argc, char *argv[]) { (void) fprintf(stderr, "%s: %s is not a directory\n", argv0, argv2); return 1; } - + +#if defined(__NetBSD__) + targetFd = open("/", 0); /* Unused */ +#else if ((targetFd = open(argv2, 0)) == -1) { (void) fprintf(stderr, "%s: open %s failed\n", argv0, argv2); return 1; } +#endif ri = rindex(file_name, '/'); if (ri == (char *) 0) {