From a11fed1671a3f00506438b180d3b6c009093a04f Mon Sep 17 00:00:00 2001 From: Christof Schmitt Date: Wed, 10 Dec 2014 16:05:16 -0700 Subject: gpfs: Rename library wrapper to gpfswrap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The code in gpfs.c and vfs_gpfs.h now only wraps the gpfs library. Rename the files to gpfswrap to make it clear that this is the only purpose of that file. Signed-off-by: Christof Schmitt Reviewed-by: Ralph Böhme --- source3/modules/gpfs.c | 226 ------------------------------------------ source3/modules/gpfswrap.c | 226 ++++++++++++++++++++++++++++++++++++++++++ source3/modules/gpfswrap.h | 43 ++++++++ source3/modules/vfs_gpfs.c | 2 +- source3/modules/vfs_gpfs.h | 43 -------- source3/modules/wscript_build | 2 +- 6 files changed, 271 insertions(+), 271 deletions(-) delete mode 100644 source3/modules/gpfs.c create mode 100644 source3/modules/gpfswrap.c create mode 100644 source3/modules/gpfswrap.h delete mode 100644 source3/modules/vfs_gpfs.h (limited to 'source3') diff --git a/source3/modules/gpfs.c b/source3/modules/gpfs.c deleted file mode 100644 index 05ff992680..0000000000 --- a/source3/modules/gpfs.c +++ /dev/null @@ -1,226 +0,0 @@ -/* - * Unix SMB/CIFS implementation. - * Wrapper for GPFS library - * Copyright (C) Volker Lendecke 2005 - * Copyright (C) Christof Schmitt 2015 - * - * This program 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; either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 this program; if not, see . - */ - -#include "replace.h" -#include "vfs_gpfs.h" - -static int (*gpfs_set_share_fn)(int fd, unsigned int allow, unsigned int deny); -static int (*gpfs_set_lease_fn)(int fd, unsigned int type); -static int (*gpfs_getacl_fn)(char *pathname, int flags, void *acl); -static int (*gpfs_putacl_fn)(char *pathname, int flags, void *acl); -static int (*gpfs_get_realfilename_path_fn)(char *pathname, char *filenamep, - int *len); -static int (*gpfs_set_winattrs_path_fn)(char *pathname, int flags, - struct gpfs_winattr *attrs); -static int (*gpfs_get_winattrs_path_fn)(char *pathname, - struct gpfs_winattr *attrs); -static int (*gpfs_get_winattrs_fn)(int fd, struct gpfs_winattr *attrs); -static int (*gpfs_prealloc_fn)(int fd, gpfs_off64_t start, gpfs_off64_t bytes); -static int (*gpfs_ftruncate_fn)(int fd, gpfs_off64_t length); -static int (*gpfs_lib_init_fn)(int flags); -static int (*gpfs_set_times_path_fn)(char *pathname, int flags, - gpfs_timestruc_t times[4]); -static int (*gpfs_quotactl_fn)(char *pathname, int cmd, int id, void *bufp); -static int (*gpfs_fcntl_fn)(int fd, void *argp); -static int (*gpfs_getfilesetid_fn)(char *pathname, char *name, int *idp); - -int gpfswrap_init(void) -{ - static void *l; - - if (l != NULL) { - return 0; - } - - l = dlopen("libgpfs.so", RTLD_LAZY); - if (l == NULL) { - return -1; - } - - gpfs_set_share_fn = dlsym(l, "gpfs_set_share"); - gpfs_set_lease_fn = dlsym(l, "gpfs_set_lease"); - gpfs_getacl_fn = dlsym(l, "gpfs_getacl"); - gpfs_putacl_fn = dlsym(l, "gpfs_putacl"); - gpfs_get_realfilename_path_fn = dlsym(l, "gpfs_get_realfilename_path"); - gpfs_set_winattrs_path_fn = dlsym(l, "gpfs_set_winattrs_path"); - gpfs_get_winattrs_path_fn = dlsym(l, "gpfs_get_winattrs_path"); - gpfs_get_winattrs_fn = dlsym(l, "gpfs_get_winattrs"); - gpfs_prealloc_fn = dlsym(l, "gpfs_prealloc"); - gpfs_ftruncate_fn = dlsym(l, "gpfs_ftruncate"); - gpfs_lib_init_fn = dlsym(l, "gpfs_lib_init"); - gpfs_set_times_path_fn = dlsym(l, "gpfs_set_times_path"); - gpfs_quotactl_fn = dlsym(l, "gpfs_quotactl"); - gpfs_fcntl_fn = dlsym(l, "gpfs_fcntl"); - gpfs_getfilesetid_fn = dlsym(l, "gpfs_getfilesetid"); - - return 0; -} - -int gpfswrap_set_share(int fd, unsigned int allow, unsigned int deny) -{ - if (gpfs_set_share_fn == NULL) { - errno = ENOSYS; - return -1; - } - - return gpfs_set_share_fn(fd, allow, deny); -} - -int gpfswrap_set_lease(int fd, unsigned int type) -{ - if (gpfs_set_lease_fn == NULL) { - errno = ENOSYS; - return -1; - } - - return gpfs_set_lease_fn(fd, type); -} - -int gpfswrap_getacl(char *pathname, int flags, void *acl) -{ - if (gpfs_getacl_fn == NULL) { - errno = ENOSYS; - return -1; - } - - return gpfs_getacl_fn(pathname, flags, acl); -} - -int gpfswrap_putacl(char *pathname, int flags, void *acl) -{ - if (gpfs_putacl_fn == NULL) { - errno = ENOSYS; - return -1; - } - - return gpfs_putacl_fn(pathname, flags, acl); -} - -int gpfswrap_get_realfilename_path(char *pathname, char *filenamep, int *len) -{ - if (gpfs_get_realfilename_path_fn == NULL) { - errno = ENOSYS; - return -1; - } - - return gpfs_get_realfilename_path_fn(pathname, filenamep, len); -} - -int gpfswrap_set_winattrs_path(char *pathname, int flags, - struct gpfs_winattr *attrs) -{ - if (gpfs_set_winattrs_path_fn == NULL) { - errno = ENOSYS; - return -1; - } - - return gpfs_set_winattrs_path_fn(pathname, flags, attrs); -} - -int gpfswrap_get_winattrs_path(char *pathname, struct gpfs_winattr *attrs) -{ - if (gpfs_get_winattrs_path_fn == NULL) { - errno = ENOSYS; - return -1; - } - - return gpfs_get_winattrs_path_fn(pathname, attrs); -} - -int gpfswrap_get_winattrs(int fd, struct gpfs_winattr *attrs) -{ - if (gpfs_get_winattrs_fn == NULL) { - errno = ENOSYS; - return -1; - } - - return gpfs_get_winattrs_fn(fd, attrs); -} - -int gpfswrap_prealloc(int fd, gpfs_off64_t start, gpfs_off64_t bytes) -{ - if (gpfs_prealloc_fn == NULL) { - errno = ENOSYS; - return -1; - } - - return gpfs_prealloc_fn(fd, start, bytes); -} - -int gpfswrap_ftruncate(int fd, gpfs_off64_t length) -{ - if (gpfs_ftruncate_fn == NULL) { - errno = ENOSYS; - return -1; - } - - return gpfs_ftruncate_fn(fd, length); -} - -int gpfswrap_lib_init(int flags) -{ - if (gpfs_lib_init_fn == NULL) { - errno = ENOSYS; - return -1; - } - - return gpfs_lib_init_fn(flags); -} - -int gpfswrap_set_times_path(char *pathname, int flags, - gpfs_timestruc_t times[4]) -{ - if (gpfs_set_times_path_fn == NULL) { - errno = ENOSYS; - return -1; - } - - return gpfs_set_times_path_fn(pathname, flags, times); -} - -int gpfswrap_quotactl(char *pathname, int cmd, int id, void *bufp) -{ - if (gpfs_quotactl_fn == NULL) { - errno = ENOSYS; - return -1; - } - - return gpfs_quotactl_fn(pathname, cmd, id, bufp); -} - -int gpfswrap_fcntl(int fd, void *argp) -{ - if (gpfs_fcntl_fn == NULL) { - errno = ENOSYS; - return -1; - } - - return gpfs_fcntl_fn(fd, argp); -} - -int gpfswrap_getfilesetid(char *pathname, char *name, int *idp) -{ - if (gpfs_getfilesetid_fn == NULL) { - errno = ENOSYS; - return -1; - } - - return gpfs_getfilesetid_fn(pathname, name, idp); -} diff --git a/source3/modules/gpfswrap.c b/source3/modules/gpfswrap.c new file mode 100644 index 0000000000..aac2f44405 --- /dev/null +++ b/source3/modules/gpfswrap.c @@ -0,0 +1,226 @@ +/* + * Unix SMB/CIFS implementation. + * Wrapper for GPFS library + * Copyright (C) Volker Lendecke 2005 + * Copyright (C) Christof Schmitt 2015 + * + * This program 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; either version 3 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, see . + */ + +#include "replace.h" +#include "gpfswrap.h" + +static int (*gpfs_set_share_fn)(int fd, unsigned int allow, unsigned int deny); +static int (*gpfs_set_lease_fn)(int fd, unsigned int type); +static int (*gpfs_getacl_fn)(char *pathname, int flags, void *acl); +static int (*gpfs_putacl_fn)(char *pathname, int flags, void *acl); +static int (*gpfs_get_realfilename_path_fn)(char *pathname, char *filenamep, + int *len); +static int (*gpfs_set_winattrs_path_fn)(char *pathname, int flags, + struct gpfs_winattr *attrs); +static int (*gpfs_get_winattrs_path_fn)(char *pathname, + struct gpfs_winattr *attrs); +static int (*gpfs_get_winattrs_fn)(int fd, struct gpfs_winattr *attrs); +static int (*gpfs_prealloc_fn)(int fd, gpfs_off64_t start, gpfs_off64_t bytes); +static int (*gpfs_ftruncate_fn)(int fd, gpfs_off64_t length); +static int (*gpfs_lib_init_fn)(int flags); +static int (*gpfs_set_times_path_fn)(char *pathname, int flags, + gpfs_timestruc_t times[4]); +static int (*gpfs_quotactl_fn)(char *pathname, int cmd, int id, void *bufp); +static int (*gpfs_fcntl_fn)(int fd, void *argp); +static int (*gpfs_getfilesetid_fn)(char *pathname, char *name, int *idp); + +int gpfswrap_init(void) +{ + static void *l; + + if (l != NULL) { + return 0; + } + + l = dlopen("libgpfs.so", RTLD_LAZY); + if (l == NULL) { + return -1; + } + + gpfs_set_share_fn = dlsym(l, "gpfs_set_share"); + gpfs_set_lease_fn = dlsym(l, "gpfs_set_lease"); + gpfs_getacl_fn = dlsym(l, "gpfs_getacl"); + gpfs_putacl_fn = dlsym(l, "gpfs_putacl"); + gpfs_get_realfilename_path_fn = dlsym(l, "gpfs_get_realfilename_path"); + gpfs_set_winattrs_path_fn = dlsym(l, "gpfs_set_winattrs_path"); + gpfs_get_winattrs_path_fn = dlsym(l, "gpfs_get_winattrs_path"); + gpfs_get_winattrs_fn = dlsym(l, "gpfs_get_winattrs"); + gpfs_prealloc_fn = dlsym(l, "gpfs_prealloc"); + gpfs_ftruncate_fn = dlsym(l, "gpfs_ftruncate"); + gpfs_lib_init_fn = dlsym(l, "gpfs_lib_init"); + gpfs_set_times_path_fn = dlsym(l, "gpfs_set_times_path"); + gpfs_quotactl_fn = dlsym(l, "gpfs_quotactl"); + gpfs_fcntl_fn = dlsym(l, "gpfs_fcntl"); + gpfs_getfilesetid_fn = dlsym(l, "gpfs_getfilesetid"); + + return 0; +} + +int gpfswrap_set_share(int fd, unsigned int allow, unsigned int deny) +{ + if (gpfs_set_share_fn == NULL) { + errno = ENOSYS; + return -1; + } + + return gpfs_set_share_fn(fd, allow, deny); +} + +int gpfswrap_set_lease(int fd, unsigned int type) +{ + if (gpfs_set_lease_fn == NULL) { + errno = ENOSYS; + return -1; + } + + return gpfs_set_lease_fn(fd, type); +} + +int gpfswrap_getacl(char *pathname, int flags, void *acl) +{ + if (gpfs_getacl_fn == NULL) { + errno = ENOSYS; + return -1; + } + + return gpfs_getacl_fn(pathname, flags, acl); +} + +int gpfswrap_putacl(char *pathname, int flags, void *acl) +{ + if (gpfs_putacl_fn == NULL) { + errno = ENOSYS; + return -1; + } + + return gpfs_putacl_fn(pathname, flags, acl); +} + +int gpfswrap_get_realfilename_path(char *pathname, char *filenamep, int *len) +{ + if (gpfs_get_realfilename_path_fn == NULL) { + errno = ENOSYS; + return -1; + } + + return gpfs_get_realfilename_path_fn(pathname, filenamep, len); +} + +int gpfswrap_set_winattrs_path(char *pathname, int flags, + struct gpfs_winattr *attrs) +{ + if (gpfs_set_winattrs_path_fn == NULL) { + errno = ENOSYS; + return -1; + } + + return gpfs_set_winattrs_path_fn(pathname, flags, attrs); +} + +int gpfswrap_get_winattrs_path(char *pathname, struct gpfs_winattr *attrs) +{ + if (gpfs_get_winattrs_path_fn == NULL) { + errno = ENOSYS; + return -1; + } + + return gpfs_get_winattrs_path_fn(pathname, attrs); +} + +int gpfswrap_get_winattrs(int fd, struct gpfs_winattr *attrs) +{ + if (gpfs_get_winattrs_fn == NULL) { + errno = ENOSYS; + return -1; + } + + return gpfs_get_winattrs_fn(fd, attrs); +} + +int gpfswrap_prealloc(int fd, gpfs_off64_t start, gpfs_off64_t bytes) +{ + if (gpfs_prealloc_fn == NULL) { + errno = ENOSYS; + return -1; + } + + return gpfs_prealloc_fn(fd, start, bytes); +} + +int gpfswrap_ftruncate(int fd, gpfs_off64_t length) +{ + if (gpfs_ftruncate_fn == NULL) { + errno = ENOSYS; + return -1; + } + + return gpfs_ftruncate_fn(fd, length); +} + +int gpfswrap_lib_init(int flags) +{ + if (gpfs_lib_init_fn == NULL) { + errno = ENOSYS; + return -1; + } + + return gpfs_lib_init_fn(flags); +} + +int gpfswrap_set_times_path(char *pathname, int flags, + gpfs_timestruc_t times[4]) +{ + if (gpfs_set_times_path_fn == NULL) { + errno = ENOSYS; + return -1; + } + + return gpfs_set_times_path_fn(pathname, flags, times); +} + +int gpfswrap_quotactl(char *pathname, int cmd, int id, void *bufp) +{ + if (gpfs_quotactl_fn == NULL) { + errno = ENOSYS; + return -1; + } + + return gpfs_quotactl_fn(pathname, cmd, id, bufp); +} + +int gpfswrap_fcntl(int fd, void *argp) +{ + if (gpfs_fcntl_fn == NULL) { + errno = ENOSYS; + return -1; + } + + return gpfs_fcntl_fn(fd, argp); +} + +int gpfswrap_getfilesetid(char *pathname, char *name, int *idp) +{ + if (gpfs_getfilesetid_fn == NULL) { + errno = ENOSYS; + return -1; + } + + return gpfs_getfilesetid_fn(pathname, name, idp); +} diff --git a/source3/modules/gpfswrap.h b/source3/modules/gpfswrap.h new file mode 100644 index 0000000000..40b2c9e8da --- /dev/null +++ b/source3/modules/gpfswrap.h @@ -0,0 +1,43 @@ +/* + * Unix SMB/CIFS implementation. + * Wrapper for GPFS library + * Copyright (C) Christian Ambach 2006 + * Copyright (C) Christof Schmitt 2015 + * + * Major code contributions by Chetan Shringarpure + * and Gomati Mohanan + * + * This program 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; either version 3 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, see . + */ + +#include + +int gpfswrap_init(void); +int gpfswrap_set_share(int fd, unsigned int allow, unsigned int deny); +int gpfswrap_set_lease(int fd, unsigned int type); +int gpfswrap_getacl(char *pathname, int flags, void *acl); +int gpfswrap_putacl(char *pathname, int flags, void *acl); +int gpfswrap_get_realfilename_path(char *pathname, char *filenamep, int *len); +int gpfswrap_set_winattrs_path(char *pathname, int flags, + struct gpfs_winattr *attrs); +int gpfswrap_get_winattrs_path(char *pathname, struct gpfs_winattr *attrs); +int gpfswrap_get_winattrs(int fd, struct gpfs_winattr *attrs); +int gpfswrap_prealloc(int fd, gpfs_off64_t start, gpfs_off64_t bytes); +int gpfswrap_ftruncate(int fd, gpfs_off64_t length); +int gpfswrap_lib_init(int flags); +int gpfswrap_set_times_path(char *pathname, int flags, + gpfs_timestruc_t times[4]); +int gpfswrap_quotactl(char *pathname, int cmd, int id, void *bufp); +int gpfswrap_fcntl(int fd, void *argp); +int gpfswrap_getfilesetid(char *pathname, char *name, int *idp); diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c index c8a5ee2707..21707c5f6c 100644 --- a/source3/modules/vfs_gpfs.c +++ b/source3/modules/vfs_gpfs.c @@ -27,10 +27,10 @@ #include "modules/non_posix_acls.h" #include "libcli/security/security.h" #include "nfs4_acls.h" -#include "vfs_gpfs.h" #include "system/filesys.h" #include "auth.h" #include "lib/util/tevent_unix.h" +#include "gpfswrap.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_VFS diff --git a/source3/modules/vfs_gpfs.h b/source3/modules/vfs_gpfs.h deleted file mode 100644 index 40b2c9e8da..0000000000 --- a/source3/modules/vfs_gpfs.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Unix SMB/CIFS implementation. - * Wrapper for GPFS library - * Copyright (C) Christian Ambach 2006 - * Copyright (C) Christof Schmitt 2015 - * - * Major code contributions by Chetan Shringarpure - * and Gomati Mohanan - * - * This program 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; either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 this program; if not, see . - */ - -#include - -int gpfswrap_init(void); -int gpfswrap_set_share(int fd, unsigned int allow, unsigned int deny); -int gpfswrap_set_lease(int fd, unsigned int type); -int gpfswrap_getacl(char *pathname, int flags, void *acl); -int gpfswrap_putacl(char *pathname, int flags, void *acl); -int gpfswrap_get_realfilename_path(char *pathname, char *filenamep, int *len); -int gpfswrap_set_winattrs_path(char *pathname, int flags, - struct gpfs_winattr *attrs); -int gpfswrap_get_winattrs_path(char *pathname, struct gpfs_winattr *attrs); -int gpfswrap_get_winattrs(int fd, struct gpfs_winattr *attrs); -int gpfswrap_prealloc(int fd, gpfs_off64_t start, gpfs_off64_t bytes); -int gpfswrap_ftruncate(int fd, gpfs_off64_t length); -int gpfswrap_lib_init(int flags); -int gpfswrap_set_times_path(char *pathname, int flags, - gpfs_timestruc_t times[4]); -int gpfswrap_quotactl(char *pathname, int cmd, int id, void *bufp); -int gpfswrap_fcntl(int fd, void *argp); -int gpfswrap_getfilesetid(char *pathname, char *name, int *idp); diff --git a/source3/modules/wscript_build b/source3/modules/wscript_build index 7fe66ecfef..a4afcd7ed0 100644 --- a/source3/modules/wscript_build +++ b/source3/modules/wscript_build @@ -275,7 +275,7 @@ bld.SAMBA3_MODULE('vfs_commit', bld.SAMBA3_MODULE('vfs_gpfs', subsystem='vfs', - source='vfs_gpfs.c gpfs.c', + source='vfs_gpfs.c gpfswrap.c', deps='NFS4_ACLS non_posix_acls', init_function='', internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_gpfs'), -- cgit