gpfswrap: Add wrappers for gpfs_fstat_x and gpfs_stat_x
authorChristof Schmitt <cs@samba.org>
Mon, 19 Aug 2019 22:35:18 +0000 (15:35 -0700)
committerChristof Schmitt <cs@samba.org>
Tue, 19 Nov 2019 21:19:36 +0000 (21:19 +0000)
Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
lib/util/gpfswrap.c
lib/util/gpfswrap.h

index 32be942bc7c30e9aa4d072c4cbdc7d6823143194..7bc2ec06c15a3cfbfb043dd74a8e0ee3a66a8f65 100644 (file)
@@ -44,6 +44,10 @@ static int (*gpfs_init_trace_fn)(void);
 static int (*gpfs_query_trace_fn)(void);
 static void (*gpfs_add_trace_fn)(int level, const char *msg);
 static void (*gpfs_fini_trace_fn)(void);
+static int (*gpfs_fstat_x_fn)(int fd, unsigned int *litemask,
+                             struct gpfs_iattr64 *iattr, size_t len);
+static int (*gpfs_stat_x_fn)(const char *pathname, unsigned int *litemask,
+                            struct gpfs_iattr64 *iattr, size_t len);
 
 int gpfswrap_init(void)
 {
@@ -76,6 +80,8 @@ int gpfswrap_init(void)
        gpfs_query_trace_fn           = dlsym(l, "gpfs_query_trace");
        gpfs_add_trace_fn             = dlsym(l, "gpfs_add_trace");
        gpfs_fini_trace_fn            = dlsym(l, "gpfs_fini_trace");
+       gpfs_fstat_x_fn       = dlsym(l, "gpfs_fstat_x");
+       gpfs_stat_x_fn                = dlsym(l, "gpfs_stat_x");
 
        return 0;
 }
@@ -259,3 +265,25 @@ void gpfswrap_fini_trace(void)
 
        gpfs_fini_trace_fn();
 }
+
+int gpfswrap_fstat_x(int fd, unsigned int *litemask,
+                    struct gpfs_iattr64 *iattr, size_t len)
+{
+       if (gpfs_fstat_x_fn == NULL) {
+               errno = ENOSYS;
+               return -1;
+       }
+
+       return gpfs_fstat_x_fn(fd, litemask, iattr, len);
+}
+
+int gpfswrap_stat_x(const char *pathname, unsigned int *litemask,
+                   struct gpfs_iattr64 *iattr, size_t len)
+{
+       if (gpfs_stat_x_fn == NULL) {
+               errno = ENOSYS;
+               return -1;
+       }
+
+       return gpfs_stat_x_fn(pathname, litemask, iattr, len);
+}
index 402021040642d3188adfd7ae244cb144fa489f62..3141360a5845162023c13dd1a5f785543dd3cb36 100644 (file)
@@ -47,5 +47,9 @@ int gpfswrap_init_trace(void);
 int gpfswrap_query_trace(void);
 void gpfswrap_add_trace(int level, const char *msg);
 void gpfswrap_fini_trace(void);
+int gpfswrap_fstat_x(int fd, unsigned int *litemask,
+                    struct gpfs_iattr64 *iattr, size_t len);
+int gpfswrap_stat_x(const char *pathname, unsigned int *litemask,
+                   struct gpfs_iattr64 *iattr, size_t len);
 
 #endif