From 7dabaf8bfd90f7ed252f884d16aee2fb359fad54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonin=20D=C3=A9cimo?= Date: Mon, 24 Apr 2023 12:46:57 +0200 Subject: [PATCH 1/5] Remove trailing whitespace --- README.md | 2 +- lib/Fuse.ml | 6 ++--- lib/Fuse.mli | 6 ++--- lib/Fuse_bindings.idl | 13 +++++------ lib/Fuse_lib.ml | 6 ++--- lib/Fuse_result.ml | 6 ++--- lib/Fuse_util.c | 54 +++++++++++++++++++++---------------------- lib/Thread_pool.ml | 6 ++--- lib/Thread_pool.mli | 6 ++--- lib/Unix_util.ml | 8 +++---- lib/Unix_util_stubs.c | 22 +++++++++--------- 11 files changed, 67 insertions(+), 68 deletions(-) diff --git a/README.md b/README.md index efef7e3..fd112aa 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ prerequisites: - dune >= 1.6 available at - + https://dune.build/ 2) Installing OCamlFuse diff --git a/lib/Fuse.ml b/lib/Fuse.ml index e4705e5..bbd3bda 100644 --- a/lib/Fuse.ml +++ b/lib/Fuse.ml @@ -4,16 +4,16 @@ OCamlFuse is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation (version 2 of the License). - + OCamlFuse is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with OCamlFuse. See the file LICENSE. If you haven't received a copy of the GNU General Public License, write to: - + Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA diff --git a/lib/Fuse.mli b/lib/Fuse.mli index cbc1dd8..1c78fc9 100644 --- a/lib/Fuse.mli +++ b/lib/Fuse.mli @@ -4,16 +4,16 @@ OCamlFuse is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation (version 2 of the License). - + OCamlFuse is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with OCamlFuse. See the file LICENSE. If you haven't received a copy of the GNU General Public License, write to: - + Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA diff --git a/lib/Fuse_bindings.idl b/lib/Fuse_bindings.idl index a5ab8e4..911a0c1 100644 --- a/lib/Fuse_bindings.idl +++ b/lib/Fuse_bindings.idl @@ -4,16 +4,16 @@ OCamlFuse is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation (version 2 of the License). - + OCamlFuse is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with OCamlFuse. See the file LICENSE. If you haven't received a copy of the GNU General Public License, write to: - + Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -24,7 +24,7 @@ vincenzo_ml@yahoo.it */ quote(h,"#define FUSE_USE_VERSION 26") -quote(h,"#include ") +quote(h,"#include ") typedef [abstract] void * fuse; @@ -62,13 +62,13 @@ struct fuse_operation_names { [string,unique] char * setxattr; [string,unique] char * getxattr; [string,unique] char * listxattr; - [string,unique] char * removexattr; + [string,unique] char * removexattr; }; struct __fuse_context { /* TODO: what's the meaning of the private_data field? */ [ptr] struct fuse *fuse; unsigned int uid; - unsigned int gid; + unsigned int gid; unsigned int pid; }; @@ -87,4 +87,3 @@ void ml_fuse_init(); void ml_fuse_main(int argc,[size_is(argc)] str argv[],[ptr] const struct fuse_operations *op); [blocking] boolean fuse_exited([ptr] struct fuse * f); - diff --git a/lib/Fuse_lib.ml b/lib/Fuse_lib.ml index 8258a5e..f58f1b3 100644 --- a/lib/Fuse_lib.ml +++ b/lib/Fuse_lib.ml @@ -4,16 +4,16 @@ OCamlFuse is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation (version 2 of the License). - + OCamlFuse is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with OCamlFuse. See the file LICENSE. If you haven't received a copy of the GNU General Public License, write to: - + Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA diff --git a/lib/Fuse_result.ml b/lib/Fuse_result.ml index 23dfb14..ad76917 100644 --- a/lib/Fuse_result.ml +++ b/lib/Fuse_result.ml @@ -4,16 +4,16 @@ OCamlFuse is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation (version 2 of the License). - + OCamlFuse is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with OCamlFuse. See the file LICENSE. If you haven't received a copy of the GNU General Public License, write to: - + Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA diff --git a/lib/Fuse_util.c b/lib/Fuse_util.c index 1c1d1eb..2f3fb9a 100644 --- a/lib/Fuse_util.c +++ b/lib/Fuse_util.c @@ -4,16 +4,16 @@ OCamlFuse is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation (version 2 of the License). - + OCamlFuse is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with OCamlFuse. See the file LICENSE. If you haven't received a copy of the GNU General Public License, write to: - + Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -119,8 +119,8 @@ CAMLprim value c_flags_to_open_flag_list (int flags) { } /* End of shame */ -static int ml2c_unix_error_vect[] = -{ +static int ml2c_unix_error_vect[] = +{ E2BIG, EACCES, EAGAIN, @@ -210,16 +210,16 @@ int * invert_array(int * src,int * indim,int * outdim) int i=0; int srcdim = 0; - while (src[srcdim]!=0) + while (src[srcdim]!=0) { - if (src[srcdim]+1>dim) dim=src[srcdim]+1; + if (src[srcdim]+1>dim) dim=src[srcdim]+1; srcdim++; } - + /* Create the result */ int * res = malloc(dim * sizeof(int)); for (i = 0;i < dim;i++) res[i]=UNKNOWN_ERR; /* TODO: find a meaningful value */ - + /* Invert the array */ for (i = 0;i < srcdim;i++) res[src[i]]=i; @@ -262,7 +262,7 @@ void ml2c_Unix_stats_struct_stat(value v,struct stat * s) s->st_uid=Int_val(Field(v,5)); s->st_gid=Int_val(Field(v,6)); s->st_rdev=Int_val(Field(v,7)); - s->st_size=Int64_val(Field(v,8)); + s->st_size=Int64_val(Field(v,8)); s->st_blksize=512; /* TODO: STUB, at least use the one from statfs */ s->st_blocks=ceil(((double)s->st_size)/((double)s->st_blksize)); /* TODO: STUB! */ s->st_atime=Double_val(Field(v,9)); @@ -323,7 +323,7 @@ void ml2c_Unix_struct_statvfs(value v,struct statvfs * st) MACRO(listxattr) \ MACRO(removexattr) -/* +/* TODO: missing callbacks for fuse API version 2.7 CALLS INTRODUCED FROM 2.3 ON @@ -357,7 +357,7 @@ FOR_ALL_OPS(DECLARE_OP_CLOSURE) #define init_RTYPE void * #define init_CB vres=callback(*init_closure,Val_unit); /* TODO: the result from init is wrong, it should return unit */ -#define init_RES +#define init_RES #define getattr_ARGS (const char* path, struct stat * buf) #define getattr_CALL_ARGS (path, buf) @@ -482,21 +482,21 @@ FOR_ALL_OPS(DECLARE_OP_CLOSURE) #define read_RES res=Int_val(Field(vres,0)); #define write_ARGS (const char *path, const char *buf, size_t size,off_t offset,struct fuse_file_info * fi) /* TODO: check usage of the writepages field of fi */ -#define write_CALL_ARGS (path, buf, size,offset,fi) +#define write_CALL_ARGS (path, buf, size,offset,fi) #define write_RTYPE int #define write_CB \ vpath = copy_string(path); \ - vres=callback4(*write_closure,vpath,alloc_bigarray_dims(BIGARRAY_UINT8|BIGARRAY_C_LAYOUT,1,(char *)buf,size),copy_int64(offset),Val_int(fi->fh)); + vres=callback4(*write_closure,vpath,alloc_bigarray_dims(BIGARRAY_UINT8|BIGARRAY_C_LAYOUT,1,(char *)buf,size),copy_int64(offset),Val_int(fi->fh)); #define write_RES res=Int_val(Field(vres,0)); -#define release_ARGS (const char *path, struct fuse_file_info * fi) -#define release_CALL_ARGS (path, fi) +#define release_ARGS (const char *path, struct fuse_file_info * fi) +#define release_CALL_ARGS (path, fi) #define release_RTYPE int #define release_CB vpath = copy_string(path); vres=callback3(*release_closure,vpath,c_flags_to_open_flag_list(fi->flags),Val_int(fi->fh)); #define release_RES -#define releasedir_ARGS (const char *path, struct fuse_file_info * fi) -#define releasedir_CALL_ARGS (path, fi) +#define releasedir_ARGS (const char *path, struct fuse_file_info * fi) +#define releasedir_CALL_ARGS (path, fi) #define releasedir_RTYPE int #define releasedir_CB vpath = copy_string(path); vres=callback3(*releasedir_closure,vpath,c_flags_to_open_flag_list(fi->flags),Val_int(fi->fh)); #define releasedir_RES @@ -505,7 +505,7 @@ FOR_ALL_OPS(DECLARE_OP_CLOSURE) #define flush_CALL_ARGS (path, fi) #define flush_RTYPE int #define flush_CB vpath = copy_string(path); vres=callback2(*flush_closure,vpath,Val_int(fi->fh)); -#define flush_RES +#define flush_RES #define statfs_ARGS (const char *path, struct statvfs *stbuf) #define statfs_CALL_ARGS (path, stbuf) @@ -513,14 +513,14 @@ FOR_ALL_OPS(DECLARE_OP_CLOSURE) #define statfs_CB vpath = copy_string(path); vres=callback(*statfs_closure,vpath); #define statfs_RES ml2c_Unix_struct_statvfs(Field(vres,0),stbuf); -#define fsync_ARGS (const char *path, int isdatasync,struct fuse_file_info * fi) -#define fsync_CALL_ARGS (path, isdatasync, fi) +#define fsync_ARGS (const char *path, int isdatasync,struct fuse_file_info * fi) +#define fsync_CALL_ARGS (path, isdatasync, fi) #define fsync_RTYPE int #define fsync_CB vpath = copy_string(path); vres=callback3(*fsync_closure,vpath,Val_bool(isdatasync),Val_int(fi->fh)); #define fsync_RES -#define fsyncdir_ARGS (const char *path, int isdatasync,struct fuse_file_info * fi) -#define fsyncdir_CALL_ARGS (path, isdatasync, fi) +#define fsyncdir_ARGS (const char *path, int isdatasync,struct fuse_file_info * fi) +#define fsyncdir_CALL_ARGS (path, isdatasync, fi) #define fsyncdir_RTYPE int #define fsyncdir_CB vpath = copy_string(path); vres=callback3(*fsync_closure,vpath,Val_bool(isdatasync),Val_int(fi->fh)); #define fsyncdir_RES @@ -632,7 +632,7 @@ FOR_ALL_OPS(CALLBACK) ops.OPNAME=ops_##OPNAME; \ } -void set_fuse_operations(struct fuse_operation_names const *op) +void set_fuse_operations(struct fuse_operation_names const *op) { FOR_ALL_OPS(SET_OPERATION) } @@ -649,11 +649,11 @@ int mainloop(struct fuse * f,int multithreaded) CAMLparam0(); if (f == NULL) return(-1); - + CAMLlocal1(_fuse); _fuse=caml_alloc(1, Abstract_tag); Store_field(_fuse, 0, (value) f); - + CAMLreturnT(int, callback2(*ocaml_fuse_loop_closure,_fuse,Val_bool(multithreaded))); } @@ -673,7 +673,7 @@ void ml_fuse_main(int argc,str * argv,struct fuse_operations const * op) struct fuse * fuse = fuse_setup(argc,argv,op,sizeof(struct fuse_operations),&mountpoint,&multithreaded,&fd); - if (fuse!=NULL) + if (fuse!=NULL) { mainloop(fuse,multithreaded); fuse_teardown(fuse,mountpoint); diff --git a/lib/Thread_pool.ml b/lib/Thread_pool.ml index 3b1fdb6..57ff1c3 100644 --- a/lib/Thread_pool.ml +++ b/lib/Thread_pool.ml @@ -4,16 +4,16 @@ OCamlFuse is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation (version 2 of the License). - + OCamlFuse is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with OCamlFuse. See the file LICENSE. If you haven't received a copy of the GNU General Public License, write to: - + Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA diff --git a/lib/Thread_pool.mli b/lib/Thread_pool.mli index 14e88b2..627ceb4 100644 --- a/lib/Thread_pool.mli +++ b/lib/Thread_pool.mli @@ -4,16 +4,16 @@ OCamlFuse is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation (version 2 of the License). - + OCamlFuse is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with OCamlFuse. See the file LICENSE. If you haven't received a copy of the GNU General Public License, write to: - + Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA diff --git a/lib/Unix_util.ml b/lib/Unix_util.ml index 47f6463..9fc194a 100644 --- a/lib/Unix_util.ml +++ b/lib/Unix_util.ml @@ -4,16 +4,16 @@ OCamlFuse is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation (version 2 of the License). - + OCamlFuse is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with OCamlFuse. See the file LICENSE. If you haven't received a copy of the GNU General Public License, write to: - + Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -47,7 +47,7 @@ external file_descr_of_int : int -> Unix.file_descr http://caml.inria.fr/pub/ml-archives/caml-list/2005/07/bb434b103b1cdbbec3c832d9a72af9a3.fr.html http://caml.inria.fr/pub/ml-archives/caml-list/2005/07/49ee60ceadbcbbc84b0bce54ad5949b6.fr.html - + TODO: learn about caml_failwith (see their code) *) diff --git a/lib/Unix_util_stubs.c b/lib/Unix_util_stubs.c index 5c01587..6bd1620 100644 --- a/lib/Unix_util_stubs.c +++ b/lib/Unix_util_stubs.c @@ -4,16 +4,16 @@ OCamlFuse is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation (version 2 of the License). - + OCamlFuse is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with OCamlFuse. See the file LICENSE. If you haven't received a copy of the GNU General Public License, write to: - + Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -56,16 +56,16 @@ CAMLprim value unix_util_read(value fd,value buf) int c_fd = Int_val(fd); /* TODO: unsafe coercion */ void * c_data = Data_bigarray_val(buf); int c_dim = Bigarray_val(buf)->dim[0]; - + enter_blocking_section(); - res = read(c_fd, c_data, c_dim); + res = read(c_fd, c_data, c_dim); leave_blocking_section(); if (res >=0) { vres=alloc(1,1); /* Ok result */ Store_field(vres,0,Val_int(res)); } - else + else { vres=alloc(1,0); /* Bad result */ Store_field(vres,0,Val_int(c2ml_unix_error(res))); /* TODO: EUNKNOWN x is a block */ @@ -81,7 +81,7 @@ CAMLprim value unix_util_write(value fd,value buf) int c_fd = Int_val(fd); /* TODO: unsafe coercion */ void * c_data = Data_bigarray_val(buf); int c_dim = Bigarray_val(buf)->dim[0]; - + enter_blocking_section(); res = write(c_fd, c_data, c_dim); leave_blocking_section(); @@ -90,7 +90,7 @@ CAMLprim value unix_util_write(value fd,value buf) vres=alloc(1,1); /* Ok result */ Store_field(vres,0,Val_int(res)); } - else + else { vres=alloc(1,0); /* Bad result */ Store_field(vres,0,Val_int(c2ml_unix_error(res))); /* TODO: EUNKNOWN x is a block */ @@ -148,12 +148,12 @@ CAMLprim value unix_util_statvfs (value pathv) enter_blocking_section(); res = statvfs(path,&buf); leave_blocking_section(); - if (res >=0) - { + if (res >=0) + { bufv = copy_statvfs (&buf); Store_field(vres,0,bufv); } - else + else { Tag_val(vres)=0; /* Bad result */ Store_field(vres,0,Val_int(c2ml_unix_error(res))); /* TODO: EUNKNOWN x is a block */ From de9bbb704d2c88229cd2cec09fb7463f8d6314cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonin=20D=C3=A9cimo?= Date: Mon, 24 Apr 2023 12:45:56 +0200 Subject: [PATCH 2/5] Use the caml namespace in C FFI --- lib/Fuse_util.c | 104 ++++++++++++++++++++++-------------------- lib/Unix_util_stubs.c | 59 +++++++++++++----------- 2 files changed, 88 insertions(+), 75 deletions(-) diff --git a/lib/Fuse_util.c b/lib/Fuse_util.c index 2f3fb9a..eb86c17 100644 --- a/lib/Fuse_util.c +++ b/lib/Fuse_util.c @@ -24,6 +24,12 @@ vincenzo_ml@yahoo.it */ +#include + +#if OCAML_VERSION < 50000 +#define CAML_NAME_SPACE +#endif + #define UNKNOWN_ERR 127 #include @@ -36,6 +42,7 @@ #include #include #include +#include #include #include @@ -64,7 +71,7 @@ CAMLprim value callback4(value closure,value arg1,value arg2,value arg3,value ar args[1]=arg2; args[2]=arg3; args[3]=arg4; - CAMLreturn(callbackN(closure,4,args)); + CAMLreturn(caml_callbackN(closure,4,args)); } CAMLprim value c2ml_setxattr_flags(int flags) @@ -355,14 +362,14 @@ FOR_ALL_OPS(DECLARE_OP_CLOSURE) #define init_ARGS (struct fuse_conn_info *conn) #define init_CALL_ARGS (conn) #define init_RTYPE void * -#define init_CB vres=callback(*init_closure,Val_unit); +#define init_CB vres=caml_callback(*init_closure,Val_unit); /* TODO: the result from init is wrong, it should return unit */ #define init_RES #define getattr_ARGS (const char* path, struct stat * buf) #define getattr_CALL_ARGS (path, buf) #define getattr_RTYPE int -#define getattr_CB vpath = copy_string(path); vres=callback(*getattr_closure,vpath); +#define getattr_CB vpath = caml_copy_string(path); vres=caml_callback(*getattr_closure,vpath); #define getattr_RES \ ml2c_Unix_stats_struct_stat(Field(vres,0),buf); @@ -370,7 +377,7 @@ FOR_ALL_OPS(DECLARE_OP_CLOSURE) #define readdir_ARGS (const char * path, void * buf, fuse_fill_dir_t filler, off_t offset, struct fuse_file_info * info) #define readdir_CALL_ARGS (path, buf, filler, offset, info) #define readdir_RTYPE int -#define readdir_CB vpath = copy_string(path); vres=callback2(*readdir_closure,vpath,Val_int(info->fh)); +#define readdir_CB vpath = caml_copy_string(path); vres=caml_callback2(*readdir_closure,vpath,Val_int(info->fh)); #define readdir_RES \ vtmp=Field(vres,0); \ while (Is_block(vtmp)) \ @@ -383,180 +390,180 @@ FOR_ALL_OPS(DECLARE_OP_CLOSURE) #define mknod_ARGS (const char *path, mode_t mode, dev_t rdev) #define mknod_CALL_ARGS (path, mode, rdev) #define mknod_RTYPE int -#define mknod_CB vpath = copy_string(path); vres=callback2(*mknod_closure,vpath,Val_int(mode)); +#define mknod_CB vpath = caml_copy_string(path); vres=caml_callback2(*mknod_closure,vpath,Val_int(mode)); #define mknod_RES #define mkdir_ARGS (const char *path, mode_t mode) #define mkdir_CALL_ARGS (path, mode) #define mkdir_RTYPE int -#define mkdir_CB vpath = copy_string(path); vres=callback2(*mkdir_closure,vpath,Val_int(mode)); +#define mkdir_CB vpath = caml_copy_string(path); vres=caml_callback2(*mkdir_closure,vpath,Val_int(mode)); #define mkdir_RES #define unlink_ARGS (const char *path) #define unlink_CALL_ARGS (path) #define unlink_RTYPE int -#define unlink_CB vpath = copy_string(path); vres=callback(*unlink_closure,vpath); +#define unlink_CB vpath = caml_copy_string(path); vres=caml_callback(*unlink_closure,vpath); #define unlink_RES #define rmdir_ARGS (const char *path) #define rmdir_CALL_ARGS (path) #define rmdir_RTYPE int -#define rmdir_CB vpath = copy_string(path); vres=callback(*rmdir_closure,vpath); +#define rmdir_CB vpath = caml_copy_string(path); vres=caml_callback(*rmdir_closure,vpath); #define rmdir_RES #define readlink_ARGS (const char *path, char *buf, size_t size) #define readlink_CALL_ARGS (path, buf, size) #define readlink_RTYPE int -#define readlink_CB vpath = copy_string(path); vres=callback(*readlink_closure,vpath); +#define readlink_CB vpath = caml_copy_string(path); vres=caml_callback(*readlink_closure,vpath); #define readlink_RES strncpy(buf,String_val(Field(vres,0)),size-1); #define symlink_ARGS (const char *path, const char *dest) #define symlink_CALL_ARGS (path, dest) #define symlink_RTYPE int #define symlink_CB \ - vpath = copy_string(path); \ - vtmp = copy_string(dest); \ - vres=callback2(*symlink_closure,vpath,vtmp); + vpath = caml_copy_string(path); \ + vtmp = caml_copy_string(dest); \ + vres=caml_callback2(*symlink_closure,vpath,vtmp); #define symlink_RES #define rename_ARGS (const char *path, const char *dest) #define rename_CALL_ARGS (path, dest) #define rename_RTYPE int #define rename_CB \ - vpath = copy_string(path); \ - vtmp = copy_string(dest); \ - vres=callback2(*rename_closure,vpath,vtmp); + vpath = caml_copy_string(path); \ + vtmp = caml_copy_string(dest); \ + vres=caml_callback2(*rename_closure,vpath,vtmp); #define rename_RES #define link_ARGS (const char *path, const char *dest) #define link_CALL_ARGS (path, dest) #define link_RTYPE int #define link_CB \ - vpath = copy_string(path); \ - vtmp = copy_string(dest); \ - vres=callback2(*link_closure,vpath,vtmp); + vpath = caml_copy_string(path); \ + vtmp = caml_copy_string(dest); \ + vres=caml_callback2(*link_closure,vpath,vtmp); #define link_RES #define chmod_ARGS (const char *path, mode_t mode) #define chmod_CALL_ARGS (path, mode) #define chmod_RTYPE int -#define chmod_CB vpath = copy_string(path); vres=callback2(*chmod_closure,vpath,Val_int(mode)); +#define chmod_CB vpath = caml_copy_string(path); vres=caml_callback2(*chmod_closure,vpath,Val_int(mode)); #define chmod_RES #define chown_ARGS (const char *path, uid_t uid, gid_t gid) #define chown_CALL_ARGS (path, uid, gid) #define chown_RTYPE int -#define chown_CB vpath = copy_string(path); vres=callback3(*chown_closure,vpath,Val_int(uid),Val_int(gid)); +#define chown_CB vpath = caml_copy_string(path); vres=caml_callback3(*chown_closure,vpath,Val_int(uid),Val_int(gid)); #define chown_RES #define truncate_ARGS (const char *path, off_t size) #define truncate_CALL_ARGS (path, size) #define truncate_RTYPE int -#define truncate_CB vpath = copy_string(path); vres=callback2(*truncate_closure,vpath,copy_int64(size)); +#define truncate_CB vpath = caml_copy_string(path); vres=caml_callback2(*truncate_closure,vpath,caml_copy_int64(size)); #define truncate_RES #define utime_ARGS (const char *path, struct utimbuf *buf) #define utime_CALL_ARGS (path, buf) #define utime_RTYPE int -#define utime_CB vpath = copy_string(path); vres=callback3(*utime_closure,vpath,copy_double(buf->actime),copy_double(buf->modtime)); +#define utime_CB vpath = caml_copy_string(path); vres=caml_callback3(*utime_closure,vpath,caml_copy_double(buf->actime),caml_copy_double(buf->modtime)); #define utime_RES #define open_ARGS (const char *path, struct fuse_file_info *fi) #define open_CALL_ARGS (path, fi) #define open_RTYPE int -#define open_CB vpath = copy_string(path); vres=callback2(*open_closure,vpath,c_flags_to_open_flag_list(fi->flags)); +#define open_CB vpath = caml_copy_string(path); vres=caml_callback2(*open_closure,vpath,c_flags_to_open_flag_list(fi->flags)); #define open_RES if (Field(vres,0) != Val_int(0)) fi->fh = Int_val(Field(Field(vres,0),0)); #define opendir_ARGS (const char *path, struct fuse_file_info *fi) #define opendir_CALL_ARGS (path, fi) #define opendir_RTYPE int -#define opendir_CB vpath = copy_string(path); vres=callback2(*opendir_closure,vpath,c_flags_to_open_flag_list(fi->flags)); +#define opendir_CB vpath = caml_copy_string(path); vres=caml_callback2(*opendir_closure,vpath,c_flags_to_open_flag_list(fi->flags)); #define opendir_RES if (Field(vres,0) != Val_int(0)) fi->fh = Int_val(Field(Field(vres,0),0)); #define read_ARGS (const char *path, char *buf, size_t size, off_t offset,struct fuse_file_info * fi) #define read_CALL_ARGS (path, buf, size, offset,fi) #define read_RTYPE int #define read_CB \ - vpath = copy_string(path); \ - vres=callback4(*read_closure,vpath,alloc_bigarray_dims(BIGARRAY_UINT8|BIGARRAY_C_LAYOUT,1,buf,size),copy_int64(offset),Val_int(fi->fh)); + vpath = caml_copy_string(path); \ + vres=callback4(*read_closure,vpath,caml_ba_alloc_dims(CAML_BA_UINT8|CAML_BA_C_LAYOUT,1,buf,size),caml_copy_int64(offset),Val_int(fi->fh)); #define read_RES res=Int_val(Field(vres,0)); #define write_ARGS (const char *path, const char *buf, size_t size,off_t offset,struct fuse_file_info * fi) /* TODO: check usage of the writepages field of fi */ #define write_CALL_ARGS (path, buf, size,offset,fi) #define write_RTYPE int #define write_CB \ - vpath = copy_string(path); \ - vres=callback4(*write_closure,vpath,alloc_bigarray_dims(BIGARRAY_UINT8|BIGARRAY_C_LAYOUT,1,(char *)buf,size),copy_int64(offset),Val_int(fi->fh)); + vpath = caml_copy_string(path); \ + vres=callback4(*write_closure,vpath,caml_ba_alloc_dims(CAML_BA_UINT8|CAML_BA_C_LAYOUT,1,(char *)buf,size),caml_copy_int64(offset),Val_int(fi->fh)); #define write_RES res=Int_val(Field(vres,0)); #define release_ARGS (const char *path, struct fuse_file_info * fi) #define release_CALL_ARGS (path, fi) #define release_RTYPE int -#define release_CB vpath = copy_string(path); vres=callback3(*release_closure,vpath,c_flags_to_open_flag_list(fi->flags),Val_int(fi->fh)); +#define release_CB vpath = caml_copy_string(path); vres=caml_callback3(*release_closure,vpath,c_flags_to_open_flag_list(fi->flags),Val_int(fi->fh)); #define release_RES #define releasedir_ARGS (const char *path, struct fuse_file_info * fi) #define releasedir_CALL_ARGS (path, fi) #define releasedir_RTYPE int -#define releasedir_CB vpath = copy_string(path); vres=callback3(*releasedir_closure,vpath,c_flags_to_open_flag_list(fi->flags),Val_int(fi->fh)); +#define releasedir_CB vpath = caml_copy_string(path); vres=caml_callback3(*releasedir_closure,vpath,c_flags_to_open_flag_list(fi->flags),Val_int(fi->fh)); #define releasedir_RES #define flush_ARGS (const char *path,struct fuse_file_info * fi) #define flush_CALL_ARGS (path, fi) #define flush_RTYPE int -#define flush_CB vpath = copy_string(path); vres=callback2(*flush_closure,vpath,Val_int(fi->fh)); +#define flush_CB vpath = caml_copy_string(path); vres=caml_callback2(*flush_closure,vpath,Val_int(fi->fh)); #define flush_RES #define statfs_ARGS (const char *path, struct statvfs *stbuf) #define statfs_CALL_ARGS (path, stbuf) #define statfs_RTYPE int -#define statfs_CB vpath = copy_string(path); vres=callback(*statfs_closure,vpath); +#define statfs_CB vpath = caml_copy_string(path); vres=caml_callback(*statfs_closure,vpath); #define statfs_RES ml2c_Unix_struct_statvfs(Field(vres,0),stbuf); #define fsync_ARGS (const char *path, int isdatasync,struct fuse_file_info * fi) #define fsync_CALL_ARGS (path, isdatasync, fi) #define fsync_RTYPE int -#define fsync_CB vpath = copy_string(path); vres=callback3(*fsync_closure,vpath,Val_bool(isdatasync),Val_int(fi->fh)); +#define fsync_CB vpath = caml_copy_string(path); vres=caml_callback3(*fsync_closure,vpath,Val_bool(isdatasync),Val_int(fi->fh)); #define fsync_RES #define fsyncdir_ARGS (const char *path, int isdatasync,struct fuse_file_info * fi) #define fsyncdir_CALL_ARGS (path, isdatasync, fi) #define fsyncdir_RTYPE int -#define fsyncdir_CB vpath = copy_string(path); vres=callback3(*fsync_closure,vpath,Val_bool(isdatasync),Val_int(fi->fh)); +#define fsyncdir_CB vpath = caml_copy_string(path); vres=caml_callback3(*fsync_closure,vpath,Val_bool(isdatasync),Val_int(fi->fh)); #define fsyncdir_RES #define setxattr_ARGS (const char *path, const char *name, const char *val,size_t size,int flags) #define setxattr_CALL_ARGS (path, name, val, size, flags) #define setxattr_RTYPE int #define setxattr_CB \ - vpath = copy_string(path); \ - vstring = alloc_string(size); \ + vpath = caml_copy_string(path); \ + vstring = caml_alloc_string(size); \ memcpy(&Byte(String_val(vstring),0),val,size); \ - vres=callback4(*setxattr_closure,vpath,copy_string(name),vstring,c2ml_setxattr_flags(flags)); + vres=callback4(*setxattr_closure,vpath,caml_copy_string(name),vstring,c2ml_setxattr_flags(flags)); #define setxattr_RES #define getxattr_ARGS (const char *path, const char *name, char *val,size_t size) #define getxattr_CALL_ARGS (path, name, val, size) #define getxattr_RTYPE int #define getxattr_CB \ - vpath = copy_string(path); \ - vres=callback2(*getxattr_closure,vpath,copy_string(name)); + vpath = caml_copy_string(path); \ + vres=caml_callback2(*getxattr_closure,vpath,caml_copy_string(name)); #define getxattr_RES \ - res=string_length(Field(vres,0)); \ + res=caml_string_length(Field(vres,0)); \ if (size > 0) \ - if (string_length(Field(vres,0))>=size) \ + if (caml_string_length(Field(vres,0))>=size) \ { \ res = -UNKNOWN_ERR; \ } \ else \ { \ - memcpy(val,String_val(Field(vres,0)),string_length(Field(vres,0))); \ + memcpy(val,String_val(Field(vres,0)),caml_string_length(Field(vres,0))); \ } #define listxattr_ARGS (const char *path, char *list, size_t size) #define listxattr_CALL_ARGS (path, list, size) #define listxattr_RTYPE int -#define listxattr_CB vpath = copy_string(path); vres=callback(*listxattr_closure,vpath); +#define listxattr_CB vpath = caml_copy_string(path); vres=caml_callback(*listxattr_closure,vpath); #define listxattr_RES \ vtmp=Field(Field(vres,0),0);\ int len; \ @@ -570,7 +577,7 @@ FOR_ALL_OPS(DECLARE_OP_CLOSURE) { \ while (Is_block(vtmp)) \ { \ - len = string_length(Field(vtmp,0))+1; \ + len = caml_string_length(Field(vtmp,0))+1; \ if (rem>=len) \ { \ memcpy(dest,String_val(Field(vtmp,0)),len); \ @@ -590,7 +597,7 @@ FOR_ALL_OPS(DECLARE_OP_CLOSURE) #define removexattr_ARGS (const char *path, const char *name) #define removexattr_CALL_ARGS (path, name) #define removexattr_RTYPE int -#define removexattr_CB vpath = copy_string(path); vres=callback2(*removexattr_closure,vpath,copy_string(name)); +#define removexattr_CB vpath = caml_copy_string(path); vres=caml_callback2(*removexattr_closure,vpath,caml_copy_string(name)); #define removexattr_RES #define CALLBACK(OPNAME) \ @@ -616,9 +623,9 @@ static OPNAME##_RTYPE gm281_ops_##OPNAME OPNAME##_ARGS \ \ static OPNAME##_RTYPE ops_##OPNAME OPNAME##_ARGS \ { \ - leave_blocking_section(); \ + caml_release_runtime_system(); \ OPNAME##_RTYPE ret = gm281_ops_##OPNAME OPNAME##_CALL_ARGS; \ - enter_blocking_section(); \ + caml_acquire_runtime_system(); \ return ret; \ } @@ -654,7 +661,7 @@ int mainloop(struct fuse * f,int multithreaded) _fuse=caml_alloc(1, Abstract_tag); Store_field(_fuse, 0, (value) f); - CAMLreturnT(int, callback2(*ocaml_fuse_loop_closure,_fuse,Val_bool(multithreaded))); + CAMLreturnT(int, caml_callback2(*ocaml_fuse_loop_closure,_fuse,Val_bool(multithreaded))); } void ml_fuse_init() @@ -685,4 +692,3 @@ value ocaml_fuse_is_null(value v) /* For Com.opaque values */ CAMLparam1(v); CAMLreturn(Val_bool(0==Field(v,0))); // Is this the right way to check for null? } - diff --git a/lib/Unix_util_stubs.c b/lib/Unix_util_stubs.c index 6bd1620..2424ac0 100644 --- a/lib/Unix_util_stubs.c +++ b/lib/Unix_util_stubs.c @@ -24,6 +24,12 @@ vincenzo_ml@yahoo.it */ +#include + +#if OCAML_VERSION < 50000 +#define CAML_NAME_SPACE +#endif + #include #include #include @@ -40,6 +46,7 @@ #include #include #include +#include #ifdef Custom_tag #include #include @@ -54,20 +61,20 @@ CAMLprim value unix_util_read(value fd,value buf) CAMLlocal1(vres); int res; int c_fd = Int_val(fd); /* TODO: unsafe coercion */ - void * c_data = Data_bigarray_val(buf); - int c_dim = Bigarray_val(buf)->dim[0]; + void * c_data = Caml_ba_data_val(buf); + int c_dim = Caml_ba_array_val(buf)->dim[0]; - enter_blocking_section(); + caml_release_runtime_system(); res = read(c_fd, c_data, c_dim); - leave_blocking_section(); + caml_acquire_runtime_system(); if (res >=0) { - vres=alloc(1,1); /* Ok result */ + vres=caml_alloc(1,1); /* Ok result */ Store_field(vres,0,Val_int(res)); } else { - vres=alloc(1,0); /* Bad result */ + vres=caml_alloc(1,0); /* Bad result */ Store_field(vres,0,Val_int(c2ml_unix_error(res))); /* TODO: EUNKNOWN x is a block */ } CAMLreturn (vres); @@ -79,20 +86,20 @@ CAMLprim value unix_util_write(value fd,value buf) CAMLlocal1(vres); int res; int c_fd = Int_val(fd); /* TODO: unsafe coercion */ - void * c_data = Data_bigarray_val(buf); - int c_dim = Bigarray_val(buf)->dim[0]; + void * c_data = Caml_ba_data_val(buf); + int c_dim = Caml_ba_array_val(buf)->dim[0]; - enter_blocking_section(); + caml_release_runtime_system(); res = write(c_fd, c_data, c_dim); - leave_blocking_section(); + caml_acquire_runtime_system(); if (res >=0) { - vres=alloc(1,1); /* Ok result */ + vres=caml_alloc(1,1); /* Ok result */ Store_field(vres,0,Val_int(res)); } else { - vres=alloc(1,0); /* Bad result */ + vres=caml_alloc(1,0); /* Bad result */ Store_field(vres,0,Val_int(c2ml_unix_error(res))); /* TODO: EUNKNOWN x is a block */ } CAMLreturn (vres); @@ -122,17 +129,17 @@ CAMLprim value copy_statvfs (struct statvfs *buf) CAMLparam0 (); CAMLlocal2 (bufv,v); bufv = caml_alloc (11, 0); - v=copy_int64 (buf->f_bsize);caml_modify (&Field (bufv, 0),v); - v=copy_int64 (buf->f_frsize);caml_modify (&Field (bufv, 1),v); - v=copy_int64 (buf->f_blocks);caml_modify (&Field (bufv, 2),v); - v=copy_int64 (buf->f_bfree);caml_modify (&Field (bufv, 3),v); - v=copy_int64 (buf->f_bavail);caml_modify (&Field (bufv, 4),v); - v=copy_int64 (buf->f_files);caml_modify (&Field (bufv, 5),v); - v=copy_int64 (buf->f_ffree);caml_modify (&Field (bufv, 6),v); - v=copy_int64 (buf->f_favail);caml_modify (&Field (bufv, 7),v); - v=copy_int64 (buf->f_fsid);caml_modify (&Field (bufv, 8),v); - v=copy_int64 (buf->f_flag);caml_modify (&Field (bufv, 9),v); - copy_int64 (buf->f_namemax);caml_modify (&Field (bufv, 10),v); + v=caml_copy_int64 (buf->f_bsize);caml_modify (&Field (bufv, 0),v); + v=caml_copy_int64 (buf->f_frsize);caml_modify (&Field (bufv, 1),v); + v=caml_copy_int64 (buf->f_blocks);caml_modify (&Field (bufv, 2),v); + v=caml_copy_int64 (buf->f_bfree);caml_modify (&Field (bufv, 3),v); + v=caml_copy_int64 (buf->f_bavail);caml_modify (&Field (bufv, 4),v); + v=caml_copy_int64 (buf->f_files);caml_modify (&Field (bufv, 5),v); + v=caml_copy_int64 (buf->f_ffree);caml_modify (&Field (bufv, 6),v); + v=caml_copy_int64 (buf->f_favail);caml_modify (&Field (bufv, 7),v); + v=caml_copy_int64 (buf->f_fsid);caml_modify (&Field (bufv, 8),v); + v=caml_copy_int64 (buf->f_flag);caml_modify (&Field (bufv, 9),v); + caml_copy_int64 (buf->f_namemax);caml_modify (&Field (bufv, 10),v); CAMLreturn (bufv); } @@ -140,14 +147,14 @@ CAMLprim value unix_util_statvfs (value pathv) { CAMLparam1 (pathv); CAMLlocal2 (vres,bufv); - vres=alloc(1,1); /* Ok result */ + vres=caml_alloc(1,1); /* Ok result */ bufv; const char *path = String_val (pathv); struct statvfs buf; int res; - enter_blocking_section(); + caml_release_runtime_system(); res = statvfs(path,&buf); - leave_blocking_section(); + caml_acquire_runtime_system(); if (res >=0) { bufv = copy_statvfs (&buf); From 47577bcaef35661991b483b0ba7ba15c5e720219 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonin=20D=C3=A9cimo?= Date: Mon, 24 Apr 2023 12:46:28 +0200 Subject: [PATCH 3/5] Update to Dune 3.7 and generate opam files --- conf-libfuse.opam | 18 ++++++++------ conf-libfuse.opam.template | 12 ++++++++++ dune-project | 44 +++++++++++++++++++++++++++++++++- lib/dune | 8 ++++--- ocamlfuse.opam | 49 +++++++++++++++++++++++++------------- ocamlfuse.opam.template | 2 ++ 6 files changed, 106 insertions(+), 27 deletions(-) create mode 100644 conf-libfuse.opam.template create mode 100644 ocamlfuse.opam.template diff --git a/conf-libfuse.opam b/conf-libfuse.opam index 77c0790..2ad33e2 100644 --- a/conf-libfuse.opam +++ b/conf-libfuse.opam @@ -1,13 +1,20 @@ +# This file is generated by dune, edit dune-project instead opam-version: "2.0" -maintainer: "https://github.com/ocaml/opam-repository/issues" +synopsis: "Virtual package relying on FUSE" +description: + "This package can only install if the fuse library is installed on the system." +maintainer: ["https://github.com/ocaml/opam-repository/issues"] +authors: ["Multiple"] +license: "LGPL-2.1-only" homepage: "https://github.com/libfuse/libfuse" bug-reports: "https://github.com/ocaml/opam-repository/issues" -authors: "Multiple" -license: "LGPL-2.1-only" -build: ["pkg-config" "--exists" "fuse"] depends: [ + "dune" {>= "3.7"} "conf-pkg-config" {build} + "odoc" {with-doc} ] +dev-repo: "git+https://github.com/astrada/ocamlfuse.git" +build: ["pkg-config" "--exists" "fuse"] depexts: [ ["libfuse-dev"] {os-family = "debian"} ["fuse-dev"] {os-distribution = "alpine"} @@ -18,7 +25,4 @@ depexts: [ ["fuse2"] {os-family = "arch"} ["macfuse"] {os = "macos" & os-distribution = "homebrew"} ] -synopsis: "Virtual package relying on FUSE" -description: - "This package can only install if the fuse library is installed on the system." flags: conf diff --git a/conf-libfuse.opam.template b/conf-libfuse.opam.template new file mode 100644 index 0000000..8fd89cc --- /dev/null +++ b/conf-libfuse.opam.template @@ -0,0 +1,12 @@ +build: ["pkg-config" "--exists" "fuse"] +depexts: [ + ["libfuse-dev"] {os-family = "debian"} + ["fuse-dev"] {os-distribution = "alpine"} + ["fuse-devel"] {os-distribution = "centos"} + ["fuse-devel"] {os-distribution = "fedora"} + ["fuse-devel"] {os-distribution = "ol"} + ["fuse-devel"] {os-family = "suse"} + ["fuse2"] {os-family = "arch"} + ["macfuse"] {os = "macos" & os-distribution = "homebrew"} +] +flags: conf diff --git a/dune-project b/dune-project index a26d6e2..56299fe 100644 --- a/dune-project +++ b/dune-project @@ -1 +1,43 @@ -(lang dune 1.6) +(lang dune 3.7) + +(generate_opam_files true) + +(source (github astrada/ocamlfuse)) +(authors + "Vincenzo Ciancia" + "Olaf Hering " + "Alessandro Strada ") +(maintainers "Alessandro Strada ") +(license "GPL-1.0-or-later") + +(package + (name conf-libfuse) + (synopsis "Virtual package relying on FUSE") + (description "This package can only install if the fuse library is installed on the system.") + (maintainers "https://github.com/ocaml/opam-repository/issues") + (authors "Multiple") + (homepage "https://github.com/libfuse/libfuse") + (bug_reports "https://github.com/ocaml/opam-repository/issues") + (license "LGPL-2.1-only") + (allow_empty) + (depends + ("conf-pkg-config" :build))) + +(package + (name ocamlfuse) + (synopsis "OCaml bindings for FUSE (Filesystem in UserSpacE)") + (description "\ +This is a binding to FUSE for the OCaml programming language, enabling +you to write multithreaded filesystems in the OCaml language. It has +been designed with simplicity as a goal, as you can see by looking at +example/fusexmp.ml. Efficiency has also been a separate goal. The +Bigarray library is used for read and writes, allowing the library to +do zero-copy in OCaml land.") + (depends + (ocaml (>= 4.02.3)) + base-bigarray + base-threads + base-unix + camlidl + dune-configurator + conf-libfuse)) diff --git a/lib/dune b/lib/dune index fe0446d..d744307 100644 --- a/lib/dune +++ b/lib/dune @@ -3,9 +3,11 @@ (public_name ocamlfuse) (libraries unix threads bigarray camlidl) (flags -thread) - (c_names Fuse_bindings_stubs Fuse_util Unix_util_stubs) - (c_flags (:include fuse.cflags.sexp)) - (c_library_flags ((:include fuse.libs.sexp) (:include camlidl.libs.sexp)))) + (foreign_stubs + (language c) + (names Fuse_bindings_stubs Fuse_util Unix_util_stubs) + (flags :standard (:include fuse.cflags.sexp))) + (c_library_flags :standard ((:include fuse.libs.sexp) (:include camlidl.libs.sexp)))) (rule (targets fuse.libs.sexp fuse.cflags.sexp camlidl.libs.sexp) diff --git a/ocamlfuse.opam b/ocamlfuse.opam index 8fcc711..11b9078 100644 --- a/ocamlfuse.opam +++ b/ocamlfuse.opam @@ -1,29 +1,46 @@ +# This file is generated by dune, edit dune-project instead opam-version: "2.0" -maintainer: "Alessandro Strada " -authors: [ "Vincenzo Ciancia" ] +synopsis: "OCaml bindings for FUSE (Filesystem in UserSpacE)" +description: """ +This is a binding to FUSE for the OCaml programming language, enabling +you to write multithreaded filesystems in the OCaml language. It has +been designed with simplicity as a goal, as you can see by looking at +example/fusexmp.ml. Efficiency has also been a separate goal. The +Bigarray library is used for read and writes, allowing the library to +do zero-copy in OCaml land.""" +maintainer: ["Alessandro Strada "] +authors: [ + "Vincenzo Ciancia" + "Olaf Hering " + "Alessandro Strada " +] license: "GPL-1.0-or-later" -homepage: "http://sourceforge.net/apps/mediawiki/ocamlfuse" -dev-repo: "git+https://github.com/astrada/ocamlfuse.git" bug-reports: "https://github.com/astrada/ocamlfuse/issues" -build: [ - ["dune" "build" "-p" name "-j" jobs] -] depends: [ + "dune" {>= "3.7"} "ocaml" {>= "4.02.3"} "base-bigarray" "base-threads" "base-unix" "camlidl" - "dune" {>= "1.6"} "dune-configurator" "conf-libfuse" + "odoc" {with-doc} ] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] +] +dev-repo: "git+https://github.com/astrada/ocamlfuse.git" +homepage: "http://sourceforge.net/apps/mediawiki/ocamlfuse" x-ci-accept-failures: ["oraclelinux-7"] -synopsis: "OCaml bindings for FUSE (Filesystem in UserSpacE)" -description: """ -This is a binding to FUSE for the OCaml programming language, enabling -you to write multithreaded filesystems in the OCaml language. It has -been designed with simplicity as a goal, as you can see by looking at -example/fusexmp.ml. Efficiency has also been a separate goal. The -Bigarray library is used for read and writes, allowing the library to -do zero-copy in OCaml land.""" diff --git a/ocamlfuse.opam.template b/ocamlfuse.opam.template new file mode 100644 index 0000000..6d1319d --- /dev/null +++ b/ocamlfuse.opam.template @@ -0,0 +1,2 @@ +homepage: "http://sourceforge.net/apps/mediawiki/ocamlfuse" +x-ci-accept-failures: ["oraclelinux-7"] From 7df4fa2b2503a8104c08c268fb8ecbcb9ea89f09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonin=20D=C3=A9cimo?= Date: Mon, 24 Apr 2023 13:47:52 +0200 Subject: [PATCH 4/5] Reindent C macros --- lib/Fuse_util.c | 286 ++++++++++++++++++++++++------------------------ 1 file changed, 143 insertions(+), 143 deletions(-) diff --git a/lib/Fuse_util.c b/lib/Fuse_util.c index eb86c17..6078e24 100644 --- a/lib/Fuse_util.c +++ b/lib/Fuse_util.c @@ -93,13 +93,13 @@ CAMLprim value c2ml_setxattr_flags(int flags) } /* This part shamelessly copied from mlfuse */ -#define ADDFLAGT(T, X) \ - num_ml_constr--;\ - if (T) {\ - tmp = caml_alloc(2, 0);\ - Store_field (tmp, 0, Val_int(num_ml_constr));\ - Store_field (tmp, 1, res);\ - res = tmp;\ +#define ADDFLAGT(T, X) \ + num_ml_constr--; \ + if (T) { \ + tmp = caml_alloc(2, 0); \ + Store_field (tmp, 0, Val_int(num_ml_constr)); \ + Store_field (tmp, 1, res); \ + res = tmp; \ } #define ADDFLAG(X) ADDFLAGT(flags & X, X) @@ -299,36 +299,36 @@ void ml2c_Unix_struct_statvfs(value v,struct statvfs * st) */ } -#define FOR_ALL_OPS(MACRO) \ - MACRO(init) \ - MACRO(getattr) \ - MACRO(readlink) \ - MACRO(readdir) \ - MACRO(opendir) \ - MACRO(releasedir) \ - MACRO(fsyncdir) \ - MACRO(mknod) \ - MACRO(mkdir) \ - MACRO(symlink) \ - MACRO(unlink) \ - MACRO(rmdir) \ - MACRO(rename) \ - MACRO(link) \ - MACRO(chmod) \ - MACRO(chown) \ - MACRO(truncate) \ - MACRO(utime) \ - MACRO(open) \ - MACRO(read) \ - MACRO(write) \ - MACRO(statfs) \ - MACRO(release) \ - MACRO(flush) \ - MACRO(fsync) \ - MACRO(setxattr) \ - MACRO(getxattr) \ - MACRO(listxattr) \ - MACRO(removexattr) +#define FOR_ALL_OPS(MACRO) \ + MACRO(init) \ + MACRO(getattr) \ + MACRO(readlink) \ + MACRO(readdir) \ + MACRO(opendir) \ + MACRO(releasedir) \ + MACRO(fsyncdir) \ + MACRO(mknod) \ + MACRO(mkdir) \ + MACRO(symlink) \ + MACRO(unlink) \ + MACRO(rmdir) \ + MACRO(rename) \ + MACRO(link) \ + MACRO(chmod) \ + MACRO(chown) \ + MACRO(truncate) \ + MACRO(utime) \ + MACRO(open) \ + MACRO(read) \ + MACRO(write) \ + MACRO(statfs) \ + MACRO(release) \ + MACRO(flush) \ + MACRO(fsync) \ + MACRO(setxattr) \ + MACRO(getxattr) \ + MACRO(listxattr) \ + MACRO(removexattr) /* TODO: missing callbacks for fuse API version 2.7 @@ -378,14 +378,14 @@ FOR_ALL_OPS(DECLARE_OP_CLOSURE) #define readdir_CALL_ARGS (path, buf, filler, offset, info) #define readdir_RTYPE int #define readdir_CB vpath = caml_copy_string(path); vres=caml_callback2(*readdir_closure,vpath,Val_int(info->fh)); -#define readdir_RES \ - vtmp=Field(vres,0); \ - while (Is_block(vtmp)) \ - { \ - if (filler(buf,String_val(Field(vtmp,0)),NULL,0)) break; \ - if (res != 0) break; \ - vtmp=Field(vtmp,1); \ - } +#define readdir_RES \ + vtmp=Field(vres,0); \ + while (Is_block(vtmp)) \ + { \ + if (filler(buf,String_val(Field(vtmp,0)),NULL,0)) break; \ + if (res != 0) break; \ + vtmp=Field(vtmp,1); \ + } #define mknod_ARGS (const char *path, mode_t mode, dev_t rdev) #define mknod_CALL_ARGS (path, mode, rdev) @@ -420,28 +420,28 @@ FOR_ALL_OPS(DECLARE_OP_CLOSURE) #define symlink_ARGS (const char *path, const char *dest) #define symlink_CALL_ARGS (path, dest) #define symlink_RTYPE int -#define symlink_CB \ - vpath = caml_copy_string(path); \ - vtmp = caml_copy_string(dest); \ - vres=caml_callback2(*symlink_closure,vpath,vtmp); +#define symlink_CB \ + vpath = caml_copy_string(path); \ + vtmp = caml_copy_string(dest); \ + vres=caml_callback2(*symlink_closure,vpath,vtmp); #define symlink_RES #define rename_ARGS (const char *path, const char *dest) #define rename_CALL_ARGS (path, dest) #define rename_RTYPE int -#define rename_CB \ - vpath = caml_copy_string(path); \ - vtmp = caml_copy_string(dest); \ - vres=caml_callback2(*rename_closure,vpath,vtmp); +#define rename_CB \ + vpath = caml_copy_string(path); \ + vtmp = caml_copy_string(dest); \ + vres=caml_callback2(*rename_closure,vpath,vtmp); #define rename_RES #define link_ARGS (const char *path, const char *dest) #define link_CALL_ARGS (path, dest) #define link_RTYPE int -#define link_CB \ - vpath = caml_copy_string(path); \ - vtmp = caml_copy_string(dest); \ - vres=caml_callback2(*link_closure,vpath,vtmp); +#define link_CB \ + vpath = caml_copy_string(path); \ + vtmp = caml_copy_string(dest); \ + vres=caml_callback2(*link_closure,vpath,vtmp); #define link_RES #define chmod_ARGS (const char *path, mode_t mode) @@ -483,16 +483,16 @@ FOR_ALL_OPS(DECLARE_OP_CLOSURE) #define read_ARGS (const char *path, char *buf, size_t size, off_t offset,struct fuse_file_info * fi) #define read_CALL_ARGS (path, buf, size, offset,fi) #define read_RTYPE int -#define read_CB \ - vpath = caml_copy_string(path); \ +#define read_CB \ + vpath = caml_copy_string(path); \ vres=callback4(*read_closure,vpath,caml_ba_alloc_dims(CAML_BA_UINT8|CAML_BA_C_LAYOUT,1,buf,size),caml_copy_int64(offset),Val_int(fi->fh)); #define read_RES res=Int_val(Field(vres,0)); #define write_ARGS (const char *path, const char *buf, size_t size,off_t offset,struct fuse_file_info * fi) /* TODO: check usage of the writepages field of fi */ #define write_CALL_ARGS (path, buf, size,offset,fi) #define write_RTYPE int -#define write_CB \ - vpath = caml_copy_string(path); \ +#define write_CB \ + vpath = caml_copy_string(path); \ vres=callback4(*write_closure,vpath,caml_ba_alloc_dims(CAML_BA_UINT8|CAML_BA_C_LAYOUT,1,(char *)buf,size),caml_copy_int64(offset),Val_int(fi->fh)); #define write_RES res=Int_val(Field(vres,0)); @@ -535,64 +535,64 @@ FOR_ALL_OPS(DECLARE_OP_CLOSURE) #define setxattr_ARGS (const char *path, const char *name, const char *val,size_t size,int flags) #define setxattr_CALL_ARGS (path, name, val, size, flags) #define setxattr_RTYPE int -#define setxattr_CB \ - vpath = caml_copy_string(path); \ - vstring = caml_alloc_string(size); \ - memcpy(&Byte(String_val(vstring),0),val,size); \ - vres=callback4(*setxattr_closure,vpath,caml_copy_string(name),vstring,c2ml_setxattr_flags(flags)); +#define setxattr_CB \ + vpath = caml_copy_string(path); \ + vstring = caml_alloc_string(size); \ + memcpy(&Byte(String_val(vstring),0),val,size); \ + vres=callback4(*setxattr_closure,vpath,caml_copy_string(name),vstring,c2ml_setxattr_flags(flags)); #define setxattr_RES #define getxattr_ARGS (const char *path, const char *name, char *val,size_t size) #define getxattr_CALL_ARGS (path, name, val, size) #define getxattr_RTYPE int -#define getxattr_CB \ - vpath = caml_copy_string(path); \ +#define getxattr_CB \ + vpath = caml_copy_string(path); \ vres=caml_callback2(*getxattr_closure,vpath,caml_copy_string(name)); -#define getxattr_RES \ - res=caml_string_length(Field(vres,0)); \ - if (size > 0) \ - if (caml_string_length(Field(vres,0))>=size) \ - { \ - res = -UNKNOWN_ERR; \ - } \ - else \ - { \ - memcpy(val,String_val(Field(vres,0)),caml_string_length(Field(vres,0))); \ - } +#define getxattr_RES \ + res=caml_string_length(Field(vres,0)); \ + if (size > 0) \ + if (caml_string_length(Field(vres,0))>=size) \ + { \ + res = -UNKNOWN_ERR; \ + } \ + else \ + { \ + memcpy(val,String_val(Field(vres,0)),caml_string_length(Field(vres,0))); \ + } #define listxattr_ARGS (const char *path, char *list, size_t size) #define listxattr_CALL_ARGS (path, list, size) #define listxattr_RTYPE int #define listxattr_CB vpath = caml_copy_string(path); vres=caml_callback(*listxattr_closure,vpath); -#define listxattr_RES \ - vtmp=Field(Field(vres,0),0);\ - int len; \ - char * dest=list; \ - int rem=size; \ - if (size==0) \ - { \ - res = Int_val(Field(Field(vres,0),1)); \ - } \ - else \ - { \ - while (Is_block(vtmp)) \ - { \ - len = caml_string_length(Field(vtmp,0))+1; \ - if (rem>=len) \ - { \ - memcpy(dest,String_val(Field(vtmp,0)),len); \ - vtmp=Field(vtmp,1);\ - dest+=len; \ - rem=rem-len; \ - } \ - else \ - { \ - res = -ERANGE; \ - break; \ - } \ - } \ - res=size-rem; \ - } +#define listxattr_RES \ + vtmp=Field(Field(vres,0),0); \ + int len; \ + char * dest=list; \ + int rem=size; \ + if (size==0) \ + { \ + res = Int_val(Field(Field(vres,0),1)); \ + } \ + else \ + { \ + while (Is_block(vtmp)) \ + { \ + len = caml_string_length(Field(vtmp,0))+1; \ + if (rem>=len) \ + { \ + memcpy(dest,String_val(Field(vtmp,0)),len); \ + vtmp=Field(vtmp,1); \ + dest+=len; \ + rem=rem-len; \ + } \ + else \ + { \ + res = -ERANGE; \ + break; \ + } \ + } \ + res=size-rem; \ + } #define removexattr_ARGS (const char *path, const char *name) #define removexattr_CALL_ARGS (path, name) @@ -600,44 +600,44 @@ FOR_ALL_OPS(DECLARE_OP_CLOSURE) #define removexattr_CB vpath = caml_copy_string(path); vres=caml_callback2(*removexattr_closure,vpath,caml_copy_string(name)); #define removexattr_RES -#define CALLBACK(OPNAME) \ -static OPNAME##_RTYPE gm281_ops_##OPNAME OPNAME##_ARGS \ -{\ - CAMLparam0(); \ - CAMLlocal4(vstring, vpath, vres, vtmp); \ - OPNAME##_RTYPE res=(typeof (res))-1L; \ - OPNAME##_CB \ - if (Tag_val(vres)==1) /* Result is not Bad */ \ - { \ - res=(typeof (res))0L; \ - OPNAME##_RES /* res can be changed here */ \ - } \ - else \ - { \ - if (Is_block(Field(vres,0))) /* This is EUNKNOWNERR of int in ocaml */ \ - res=(typeof (res))(long)-Int_val(Field(Field(vres,0),0)); \ - else res=(typeof (res))(long)-ml2c_unix_error(Int_val(Field(vres,0))); \ - } \ - CAMLreturnT(OPNAME##_RTYPE, res); \ -}\ -\ -static OPNAME##_RTYPE ops_##OPNAME OPNAME##_ARGS \ -{ \ - caml_release_runtime_system(); \ - OPNAME##_RTYPE ret = gm281_ops_##OPNAME OPNAME##_CALL_ARGS; \ - caml_acquire_runtime_system(); \ - return ret; \ -} +#define CALLBACK(OPNAME) \ + static OPNAME##_RTYPE gm281_ops_##OPNAME OPNAME##_ARGS \ + { \ + CAMLparam0(); \ + CAMLlocal4(vstring, vpath, vres, vtmp); \ + OPNAME##_RTYPE res=(typeof (res))-1L; \ + OPNAME##_CB \ + if (Tag_val(vres)==1) /* Result is not Bad */ \ + { \ + res=(typeof (res))0L; \ + OPNAME##_RES /* res can be changed here */ \ + } \ + else \ + { \ + if (Is_block(Field(vres,0))) /* This is EUNKNOWNERR of int in ocaml */ \ + res=(typeof (res))(long)-Int_val(Field(Field(vres,0),0)); \ + else res=(typeof (res))(long)-ml2c_unix_error(Int_val(Field(vres,0))); \ + } \ + CAMLreturnT(OPNAME##_RTYPE, res); \ + } \ + \ + static OPNAME##_RTYPE ops_##OPNAME OPNAME##_ARGS \ + { \ + caml_release_runtime_system(); \ + OPNAME##_RTYPE ret = gm281_ops_##OPNAME OPNAME##_CALL_ARGS; \ + caml_acquire_runtime_system(); \ + return ret; \ + } FOR_ALL_OPS(CALLBACK) -#define SET_OPERATION(OPNAME) \ - if (op->OPNAME==NULL) ops.OPNAME=NULL; \ - else \ - { \ - OPNAME##_closure=caml_named_value(op->OPNAME); \ - ops.OPNAME=ops_##OPNAME; \ - } +#define SET_OPERATION(OPNAME) \ + if (op->OPNAME==NULL) ops.OPNAME=NULL; \ + else \ + { \ + OPNAME##_closure=caml_named_value(op->OPNAME); \ + ops.OPNAME=ops_##OPNAME; \ + } void set_fuse_operations(struct fuse_operation_names const *op) { From 383e9d2b401297d06711fa3179d6f428bb77e5e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonin=20D=C3=A9cimo?= Date: Mon, 24 Apr 2023 14:08:41 +0200 Subject: [PATCH 5/5] Use OCamlFormat 0.25.1 --- .ocamlformat | 2 +- example/fusexmp.ml | 110 ++++++++++++++++++++++------------------- example/hello.ml | 4 +- lib/Fuse.mli | 2 - lib/Thread_pool.mli | 2 - lib/config/discover.ml | 4 +- lib/dune | 24 ++++++--- 7 files changed, 81 insertions(+), 67 deletions(-) diff --git a/.ocamlformat b/.ocamlformat index ae254d9..bd1f239 100644 --- a/.ocamlformat +++ b/.ocamlformat @@ -1,2 +1,2 @@ -version=0.14.2 +version=0.25.1 profile=conventional diff --git a/example/fusexmp.ml b/example/fusexmp.ml index 85daf33..d64f616 100644 --- a/example/fusexmp.ml +++ b/example/fusexmp.ml @@ -36,24 +36,29 @@ let retrieve_descr i = Unix_util.file_descr_of_int i let xmp_read _path buf offset d = let hnd = retrieve_descr d in - ignore (LargeFile.lseek hnd offset SEEK_SET) ; + ignore (LargeFile.lseek hnd offset SEEK_SET); Unix_util.read hnd buf let xmp_write _path buf offset d = let hnd = retrieve_descr d in - ignore (LargeFile.lseek hnd offset SEEK_SET) ; + ignore (LargeFile.lseek hnd offset SEEK_SET); Unix_util.write hnd buf (* Extended attributes helpers *) let xattr = Hashtbl.create 256 - let xattr_lock = Mutex.create () let with_xattr_lock f x = - Mutex.lock xattr_lock ; - let v = try f x with e -> Mutex.unlock xattr_lock ; raise e in - Mutex.unlock xattr_lock ; v + Mutex.lock xattr_lock; + let v = + try f x + with e -> + Mutex.unlock xattr_lock; + raise e + in + Mutex.unlock xattr_lock; + v let lskeys t = with_xattr_lock (Hashtbl.fold (fun k _v l -> k :: l) t) [] @@ -65,64 +70,67 @@ let init_attr xattr path = let _ = main Sys.argv - { init= (fun () -> Printf.printf "filesystem started\n%!") - ; statfs= Unix_util.statvfs - ; getattr= Unix.LargeFile.lstat - ; readdir= - (fun path _hnd -> "." :: ".." :: Array.to_list (Sys.readdir path)) - ; opendir= + { + init = (fun () -> Printf.printf "filesystem started\n%!"); + statfs = Unix_util.statvfs; + getattr = Unix.LargeFile.lstat; + readdir = + (fun path _hnd -> "." :: ".." :: Array.to_list (Sys.readdir path)); + opendir = (fun path flags -> - Unix.close (Unix.openfile path flags 0) ; - None ) - ; releasedir= (fun _path _mode _hnd -> ()) - ; fsyncdir= (fun _path _ds _hnd -> Printf.printf "sync dir\n%!") - ; readlink= Unix.readlink - ; utime= Unix.utimes - ; fopen= (fun path flags -> Some (store_descr (Unix.openfile path flags 0))) - ; read= xmp_read - ; write= xmp_write - ; mknod= (fun path mode -> close (openfile path [O_CREAT; O_EXCL] mode)) - ; mkdir= Unix.mkdir - ; unlink= Unix.unlink - ; rmdir= Unix.rmdir - ; symlink= Unix.symlink - ; rename= Unix.rename - ; link= Unix.link - ; chmod= Unix.chmod - ; chown= Unix.chown - ; truncate= Unix.LargeFile.truncate - ; release= (fun _path _mode hnd -> Unix.close (retrieve_descr hnd)) - ; flush= (fun _path _hnd -> ()) - ; fsync= (fun _path _ds _hnd -> Printf.printf "sync\n%!") - ; listxattr= + Unix.close (Unix.openfile path flags 0); + None); + releasedir = (fun _path _mode _hnd -> ()); + fsyncdir = (fun _path _ds _hnd -> Printf.printf "sync dir\n%!"); + readlink = Unix.readlink; + utime = Unix.utimes; + fopen = + (fun path flags -> Some (store_descr (Unix.openfile path flags 0))); + read = xmp_read; + write = xmp_write; + mknod = (fun path mode -> close (openfile path [ O_CREAT; O_EXCL ] mode)); + mkdir = Unix.mkdir; + unlink = Unix.unlink; + rmdir = Unix.rmdir; + symlink = Unix.symlink; + rename = Unix.rename; + link = Unix.link; + chmod = Unix.chmod; + chown = Unix.chown; + truncate = Unix.LargeFile.truncate; + release = (fun _path _mode hnd -> Unix.close (retrieve_descr hnd)); + flush = (fun _path _hnd -> ()); + fsync = (fun _path _ds _hnd -> Printf.printf "sync\n%!"); + listxattr = (fun path -> - init_attr xattr path ; - lskeys (Hashtbl.find xattr path) ) - ; getxattr= + init_attr xattr path; + lskeys (Hashtbl.find xattr path)); + getxattr = (fun path attr -> with_xattr_lock (fun () -> - init_attr xattr path ; + init_attr xattr path; try Hashtbl.find (Hashtbl.find xattr path) attr with Not_found -> raise (Unix.Unix_error - ( EUNKNOWNERR 61 (* TODO: this is system-dependent *) - , "getxattr" - , path )) ) - () ) - ; setxattr= + ( EUNKNOWNERR 61 (* TODO: this is system-dependent *), + "getxattr", + path ))) + ()); + setxattr = (fun path attr value _flag -> (* TODO: This currently ignores flags *) with_xattr_lock (fun () -> - init_attr xattr path ; - Hashtbl.replace (Hashtbl.find xattr path) attr value ) - () ) - ; removexattr= + init_attr xattr path; + Hashtbl.replace (Hashtbl.find xattr path) attr value) + ()); + removexattr = (fun path attr -> with_xattr_lock (fun () -> - init_attr xattr path ; - Hashtbl.remove (Hashtbl.find xattr path) attr ) - () ) } + init_attr xattr path; + Hashtbl.remove (Hashtbl.find xattr path) attr) + ()); + } diff --git a/example/hello.ml b/example/hello.ml index db2b1c1..d4ae155 100644 --- a/example/hello.ml +++ b/example/hello.ml @@ -4,9 +4,7 @@ open Bigarray open Fuse let default_stats = LargeFile.stat "." - let fname = "hello" - let name = "/" ^ fname let contents : Fuse.buffer = @@ -39,7 +37,7 @@ let do_read path buf ofs _ = let ofs = Int64.to_int ofs in let len = min (Array1.dim contents - ofs) (Array1.dim buf) in Array1.blit (Array1.sub contents ofs len) (Array1.sub buf 0 len); - len ) + len) else raise (Unix_error (ENOENT, "read", path)) let _ = diff --git a/lib/Fuse.mli b/lib/Fuse.mli index 1c78fc9..157fff4 100644 --- a/lib/Fuse.mli +++ b/lib/Fuse.mli @@ -75,7 +75,5 @@ type operations = { } val op_names_of_operations : operations -> Fuse_bindings.fuse_operation_names - val default_operations : operations - val main : Fuse_bindings.str array -> operations -> unit diff --git a/lib/Thread_pool.mli b/lib/Thread_pool.mli index 627ceb4..a51fbbc 100644 --- a/lib/Thread_pool.mli +++ b/lib/Thread_pool.mli @@ -26,7 +26,5 @@ type t val create : ?max_threads:int -> unit -> t - val add_work : ('a -> 'b) -> 'a -> t -> unit - val shutdown : t -> unit diff --git a/lib/config/discover.ml b/lib/config/discover.ml index 1afb89c..742c949 100644 --- a/lib/config/discover.ml +++ b/lib/config/discover.ml @@ -27,7 +27,7 @@ let () = | Some pkgc -> ( match C.Pkg_config.query pkgc ~package:"fuse" with | Some flags -> flags - | None -> default ) + | None -> default) | None -> default in let calmidl_fname = "camlidl.libs.sexp" in @@ -43,7 +43,7 @@ let () = (Printf.sprintf "ocamlfind query camlidl > %s" calmidl_fname) with | 0 -> String.trim (read_file calmidl_fname) - | _ -> C.die "Could not query camlidl lib path" ) + | _ -> C.die "Could not query camlidl lib path") in let camlidl_libs = [ "-L" ^ camlidl_lib_path; "-lcamlidl" ] in C.Flags.( diff --git a/lib/dune b/lib/dune index d744307..9302cf1 100644 --- a/lib/dune +++ b/lib/dune @@ -6,15 +6,27 @@ (foreign_stubs (language c) (names Fuse_bindings_stubs Fuse_util Unix_util_stubs) - (flags :standard (:include fuse.cflags.sexp))) - (c_library_flags :standard ((:include fuse.libs.sexp) (:include camlidl.libs.sexp)))) + (flags + :standard + (:include fuse.cflags.sexp))) + (c_library_flags + :standard + ((:include fuse.libs.sexp) + (:include camlidl.libs.sexp)))) (rule (targets fuse.libs.sexp fuse.cflags.sexp camlidl.libs.sexp) - (deps (:discover config/discover.exe)) - (action (run %{discover}))) + (deps + (:discover config/discover.exe)) + (action + (run %{discover}))) (rule - (targets Fuse_bindings.h Fuse_bindings_stubs.c Fuse_bindings.ml Fuse_bindings.mli) + (targets + Fuse_bindings.h + Fuse_bindings_stubs.c + Fuse_bindings.ml + Fuse_bindings.mli) (deps Fuse_bindings.idl) - (action (run camlidl -header Fuse_bindings.idl))) + (action + (run camlidl -header Fuse_bindings.idl)))