diff options
author | Christof Schmitt <cs@samba.org> | 2014-12-10 15:55:19 -0700 |
---|---|---|
committer | Christof Schmitt <cs@samba.org> | 2015-03-02 22:31:08 +0100 |
commit | a5ca63b266bd11c2523463bcd20a1a638afea845 (patch) | |
tree | a81c44dd3c085bfb389d108331cf006d3464c85c /source3/modules/vfs_gpfs.c | |
parent | a36c46d9db70ab3633fd074e88e1e832c63fe8ee (diff) | |
download | samba-a5ca63b266bd11c2523463bcd20a1a638afea845.tar.gz samba-a5ca63b266bd11c2523463bcd20a1a638afea845.tar.xz samba-a5ca63b266bd11c2523463bcd20a1a638afea845.zip |
gpfs: Move get_gpfs_fset_id to vfs_gpfs.c
Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>
Diffstat (limited to 'source3/modules/vfs_gpfs.c')
-rw-r--r-- | source3/modules/vfs_gpfs.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c index fe506cfd2d..d796170136 100644 --- a/source3/modules/vfs_gpfs.c +++ b/source3/modules/vfs_gpfs.c @@ -2005,6 +2005,50 @@ static int vfs_gpfs_connect(struct vfs_handle_struct *handle, return 0; } +static int get_gpfs_fset_id(const char *pathname, int *fset_id) +{ + int err, fd, errno_fcntl; + + struct { + gpfsFcntlHeader_t hdr; + gpfsGetFilesetName_t fsn; + } arg; + + arg.hdr.totalLength = sizeof(arg); + arg.hdr.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; + arg.hdr.fcntlReserved = 0; + arg.fsn.structLen = sizeof(arg.fsn); + arg.fsn.structType = GPFS_FCNTL_GET_FILESETNAME; + + fd = open(pathname, O_RDONLY); + if (fd == -1) { + DEBUG(1, ("Could not open %s: %s\n", + pathname, strerror(errno))); + return fd; + } + + err = gpfswrap_fcntl(fd, &arg); + errno_fcntl = errno; + close(fd); + + if (err) { + errno = errno_fcntl; + if (errno != ENOSYS) { + DEBUG(1, ("GPFS_FCNTL_GET_FILESETNAME for %s failed: " + "%s\n", pathname, strerror(errno))); + } + return err; + } + + err = gpfswrap_getfilesetid(discard_const_p(char, pathname), + arg.fsn.buffer, fset_id); + if (err && errno != ENOSYS) { + DEBUG(1, ("gpfs_getfilesetid for %s failed: %s\n", + pathname, strerror(errno))); + } + return err; +} + static int get_gpfs_quota(const char *pathname, int type, int id, struct gpfs_quotaInfo *qi) { |