about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/wrapped32/generated/functions_list.txt2
-rw-r--r--src/wrapped32/generated/wrappedmounttypes32.h2
-rw-r--r--src/wrapped32/wrappedmount.c37
-rw-r--r--src/wrapped32/wrappedmount_private.h2
4 files changed, 42 insertions, 1 deletions
diff --git a/src/wrapped32/generated/functions_list.txt b/src/wrapped32/generated/functions_list.txt
index 13fdb3a9..42bab578 100644
--- a/src/wrapped32/generated/functions_list.txt
+++ b/src/wrapped32/generated/functions_list.txt
@@ -3280,6 +3280,8 @@ wrappedlibxxf86vm:
 wrappedmount:
 - pFi:
   - mnt_get_builtin_optmap
+- iFpip:
+  - mnt_table_uniq_fs
 - iFpbL_p:
   - mnt_optstr_get_flags
 wrappednsl:
diff --git a/src/wrapped32/generated/wrappedmounttypes32.h b/src/wrapped32/generated/wrappedmounttypes32.h
index e0bc9af8..3e6a47a0 100644
--- a/src/wrapped32/generated/wrappedmounttypes32.h
+++ b/src/wrapped32/generated/wrappedmounttypes32.h
@@ -12,10 +12,12 @@
 #endif
 
 typedef void* (*pFi_t)(int32_t);
+typedef int32_t (*iFpip_t)(void*, int32_t, void*);
 typedef int32_t (*iFpbL_p_t)(void*, struct_L_t*, void*);
 
 #define SUPER() ADDED_FUNCTIONS() \
 	GO(mnt_get_builtin_optmap, pFi_t) \
+	GO(mnt_table_uniq_fs, iFpip_t) \
 	GO(mnt_optstr_get_flags, iFpbL_p_t)
 
 #endif // __wrappedmountTYPES32_H_
diff --git a/src/wrapped32/wrappedmount.c b/src/wrapped32/wrappedmount.c
index 543e5604..10f37f2a 100644
--- a/src/wrapped32/wrappedmount.c
+++ b/src/wrapped32/wrappedmount.c
@@ -25,6 +25,38 @@ static const char* mountName = "libmount.so.1";
 
 #include "wrappercallback32.h"
 
+#define SUPER() \
+GO(0)   \
+GO(1)   \
+GO(2)   \
+GO(3)   \
+GO(4)
+
+// cmp ...
+#define GO(A)   \
+static uintptr_t my32_cmp_fct_##A = 0;                              \
+static int my32_cmp_##A(void* a, void* b, void* c)                  \
+{                                                                   \
+    return (int)RunFunctionFmt(my32_cmp_fct_##A, "ppp", a, b, c);   \
+}
+SUPER()
+#undef GO
+static void* find_cmp_Fct(void* fct)
+{
+    if(!fct) return fct;
+    if(GetNativeFnc((uintptr_t)fct))  return GetNativeFnc((uintptr_t)fct);
+    #define GO(A) if(my32_cmp_fct_##A == (uintptr_t)fct) return my32_cmp_##A;
+    SUPER()
+    #undef GO
+    #define GO(A) if(my32_cmp_fct_##A == 0) {my32_cmp_fct_##A = (uintptr_t)fct; return my32_cmp_##A; }
+    SUPER()
+    #undef GO
+    printf_log(LOG_NONE, "Warning, no more slot for libmount cmp callback\n");
+    return NULL;
+}
+
+#undef SUPER
+
 typedef struct my_libmnt_optmap_s
 {
         /*const*/ char *name;
@@ -111,5 +143,10 @@ EXPORT int my32_mnt_optstr_get_flags(x64emu_t* emu, void* optstr, void* flag, vo
     return my->mnt_optstr_get_flags(optstr, flag, enlarge_libmnt_optmap(map));
 }
 
+EXPORT int my32_mnt_table_uniq_fs(void* tb, int flags, void* f)
+{
+    return my->mnt_table_uniq_fs(tb, flags, find_cmp_Fct(f));
+}
+
 #include "wrappedlib_init32.h"
 
diff --git a/src/wrapped32/wrappedmount_private.h b/src/wrapped32/wrappedmount_private.h
index 98992a3b..82ef6888 100644
--- a/src/wrapped32/wrappedmount_private.h
+++ b/src/wrapped32/wrappedmount_private.h
@@ -313,7 +313,7 @@ GO(mnt_table_set_iter, iFppp)
 //GOM(mnt_table_set_parser_errcb, iFEpp)
 GO(mnt_table_set_trailing_comment, iFpp)
 GO(mnt_table_set_userdata, iFpp)
-//GOM(mnt_table_uniq_fs, iFEpip)
+GOM(mnt_table_uniq_fs, iFEpip)
 GO(mnt_table_with_comments, iFp)
 GO(mnt_table_write_file, iFpS)
 GO(mnt_tag_is_valid, iFp)