param: Rename variable used for lp_interfaces szInterfaces
[Samba.git] / source3 / modules / vfs_glusterfs.c
blob9bcd0cb67b84edf005ecdcdb67983a85b0df3595
1 /*
2 Unix SMB/CIFS implementation.
4 Wrap GlusterFS GFAPI calls in vfs functions.
6 Copyright (c) 2013 Anand Avati <avati@redhat.com>
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #include "includes.h"
23 #include "smbd/smbd.h"
24 #include <stdio.h>
25 #include "api/glfs.h"
26 #include "lib/util/dlinklist.h"
28 #define DEFAULT_VOLFILE_SERVER "localhost"
31 TODO
32 ----
33 Short term:
34 - AIO support
35 - sendfile/recvfile support
38 /* Helpers to provide 'integer' fds */
40 /* This is global. gfapi's FD operations do not
41 require filesystem context.
44 static glfs_fd_t **glfd_fd;
45 static int glfd_fd_size;
46 static int glfd_fd_used;
48 static int glfd_fd_store(glfs_fd_t *glfd)
50 int i;
51 void *tmp;
53 if (glfd_fd_size == glfd_fd_used) {
54 if (glfd_fd_size >= INT_MAX - 1) {
55 errno = ENOMEM;
56 return -1;
59 tmp = talloc_realloc(glfd_fd, glfd_fd, glfs_fd_t *,
60 glfd_fd_size + 1);
61 if (tmp == NULL) {
62 errno = ENOMEM;
63 return -1;
66 glfd_fd = tmp;
67 glfd_fd[glfd_fd_size] = 0;
68 glfd_fd_size++;
71 for (i = 0; i < glfd_fd_size; i++) {
72 if (glfd_fd[i] == NULL) {
73 break;
76 glfd_fd_used++;
77 glfd_fd[i] = glfd;
78 return i;
81 static glfs_fd_t *glfd_fd_get(int i)
83 if (i < 0 || i >= glfd_fd_size) {
84 return NULL;
86 return glfd_fd[i];
89 static glfs_fd_t *glfd_fd_clear(int i)
91 glfs_fd_t *glfd = NULL;
93 if (i < 0 || i >= glfd_fd_size) {
94 return NULL;
97 glfd = glfd_fd[i];
99 glfd_fd[i] = 0;
100 glfd_fd_used--;
101 return glfd;
104 /* Helper to convert stat to stat_ex */
106 static void smb_stat_ex_from_stat(struct stat_ex *dst, const struct stat *src)
108 ZERO_STRUCTP(dst);
110 dst->st_ex_dev = src->st_dev;
111 dst->st_ex_ino = src->st_ino;
112 dst->st_ex_mode = src->st_mode;
113 dst->st_ex_nlink = src->st_nlink;
114 dst->st_ex_uid = src->st_uid;
115 dst->st_ex_gid = src->st_gid;
116 dst->st_ex_rdev = src->st_rdev;
117 dst->st_ex_size = src->st_size;
118 dst->st_ex_atime.tv_sec = src->st_atime;
119 #ifdef STAT_HAVE_NSEC
120 dst->st_ex_atime.tv_nsec = src->st_atime_nsec;
121 #endif
122 dst->st_ex_mtime.tv_sec = src->st_mtime;
123 #ifdef STAT_HAVE_NSEC
124 dst->st_ex_mtime.tv_nsec = src->st_mtime_nsec;
125 #endif
126 dst->st_ex_ctime.tv_sec = src->st_ctime;
127 #ifdef STAT_HAVE_NSEC
128 dst->st_ex_ctime.tv_nsec = src->st_ctime_nsec;
129 #endif
130 dst->st_ex_btime.tv_sec = src->st_mtime;
131 #ifdef STAT_HAVE_NSEC
132 dst->st_ex_btime.tv_nsec = src->st_mtime_nsec;
133 #endif
134 dst->st_ex_blksize = src->st_blksize;
135 dst->st_ex_blocks = src->st_blocks;
138 /* pre-opened glfs_t */
140 static struct glfs_preopened {
141 char *volume;
142 glfs_t *fs;
143 int ref;
144 struct glfs_preopened *next, *prev;
145 } *glfs_preopened;
148 static int glfs_set_preopened(const char *volume, glfs_t *fs)
150 struct glfs_preopened *entry = NULL;
152 entry = talloc_zero(NULL, struct glfs_preopened);
153 if (!entry) {
154 errno = ENOMEM;
155 return -1;
158 entry->volume = talloc_strdup(entry, volume);
159 if (!entry->volume) {
160 talloc_free(entry);
161 errno = ENOMEM;
162 return -1;
165 entry->fs = fs;
166 entry->ref = 1;
168 DLIST_ADD(glfs_preopened, entry);
170 return 0;
173 static glfs_t *glfs_find_preopened(const char *volume)
175 struct glfs_preopened *entry = NULL;
177 for (entry = glfs_preopened; entry; entry = entry->next) {
178 if (strcmp(entry->volume, volume) == 0) {
179 entry->ref++;
180 return entry->fs;
184 return NULL;
187 static void glfs_clear_preopened(glfs_t *fs)
189 struct glfs_preopened *entry = NULL;
191 for (entry = glfs_preopened; entry; entry = entry->next) {
192 if (entry->fs == fs) {
193 if (--entry->ref)
194 return;
196 DLIST_REMOVE(glfs_preopened, entry);
198 glfs_fini(entry->fs);
199 talloc_free(entry);
204 /* Disk Operations */
206 static int vfs_gluster_connect(struct vfs_handle_struct *handle,
207 const char *service,
208 const char *user)
210 const char *volfile_server;
211 const char *volume;
212 char *logfile;
213 int loglevel;
214 glfs_t *fs = NULL;
215 TALLOC_CTX *tmp_ctx;
216 int ret = 0;
218 tmp_ctx = talloc_new(NULL);
219 if (tmp_ctx == NULL) {
220 ret = -1;
221 goto done;
223 logfile = lp_parm_talloc_string(tmp_ctx, SNUM(handle->conn), "glusterfs",
224 "logfile", NULL);
226 loglevel = lp_parm_int(SNUM(handle->conn), "glusterfs", "loglevel", -1);
228 volfile_server = lp_parm_const_string(SNUM(handle->conn), "glusterfs",
229 "volfile_server", NULL);
230 if (volfile_server == NULL) {
231 volfile_server = DEFAULT_VOLFILE_SERVER;
234 volume = lp_parm_const_string(SNUM(handle->conn), "glusterfs", "volume",
235 NULL);
236 if (volume == NULL) {
237 volume = service;
240 fs = glfs_find_preopened(volume);
241 if (fs) {
242 goto done;
245 fs = glfs_new(volume);
246 if (fs == NULL) {
247 ret = -1;
248 goto done;
251 ret = glfs_set_volfile_server(fs, "tcp", volfile_server, 0);
252 if (ret < 0) {
253 DEBUG(0, ("Failed to set volfile_server %s\n", volfile_server));
254 goto done;
257 ret = glfs_set_xlator_option(fs, "*-md-cache", "cache-posix-acl",
258 "true");
259 if (ret < 0) {
260 DEBUG(0, ("%s: Failed to set xlator options\n", volume));
261 goto done;
264 ret = glfs_set_logging(fs, logfile, loglevel);
265 if (ret < 0) {
266 DEBUG(0, ("%s: Failed to set logfile %s loglevel %d\n",
267 volume, logfile, loglevel));
268 goto done;
271 ret = glfs_init(fs);
272 if (ret < 0) {
273 DEBUG(0, ("%s: Failed to initialize volume (%s)\n",
274 volume, strerror(errno)));
275 goto done;
278 ret = glfs_set_preopened(volume, fs);
279 if (ret < 0) {
280 DEBUG(0, ("%s: Failed to register volume (%s)\n",
281 volume, strerror(errno)));
282 goto done;
284 done:
285 talloc_free(tmp_ctx);
286 if (ret < 0) {
287 if (fs)
288 glfs_fini(fs);
289 return -1;
290 } else {
291 DEBUG(0, ("%s: Initialized volume from server %s\n",
292 volume, volfile_server));
293 handle->data = fs;
294 return 0;
298 static void vfs_gluster_disconnect(struct vfs_handle_struct *handle)
300 glfs_t *fs = NULL;
302 fs = handle->data;
304 glfs_clear_preopened(fs);
307 static uint64_t vfs_gluster_disk_free(struct vfs_handle_struct *handle,
308 const char *path, bool small_query,
309 uint64_t *bsize_p, uint64_t *dfree_p,
310 uint64_t *dsize_p)
312 struct statvfs statvfs = { 0, };
313 int ret;
315 ret = glfs_statvfs(handle->data, path, &statvfs);
316 if (ret < 0) {
317 return -1;
320 if (bsize_p != NULL) {
321 *bsize_p = (uint64_t)statvfs.f_bsize; /* Block size */
323 if (dfree_p != NULL) {
324 *dfree_p = (uint64_t)statvfs.f_bavail; /* Available Block units */
326 if (dsize_p != NULL) {
327 *dsize_p = (uint64_t)statvfs.f_blocks; /* Total Block units */
330 return (uint64_t)statvfs.f_bavail;
333 static int vfs_gluster_get_quota(struct vfs_handle_struct *handle,
334 enum SMB_QUOTA_TYPE qtype, unid_t id,
335 SMB_DISK_QUOTA *qt)
337 errno = ENOSYS;
338 return -1;
341 static int
342 vfs_gluster_set_quota(struct vfs_handle_struct *handle,
343 enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *qt)
345 errno = ENOSYS;
346 return -1;
349 static int vfs_gluster_statvfs(struct vfs_handle_struct *handle,
350 const char *path,
351 struct vfs_statvfs_struct *vfs_statvfs)
353 struct statvfs statvfs = { 0, };
354 int ret;
356 ret = glfs_statvfs(handle->data, path, &statvfs);
357 if (ret < 0) {
358 DEBUG(0, ("glfs_statvfs(%s) failed: %s\n",
359 path, strerror(errno)));
360 return -1;
363 ZERO_STRUCTP(vfs_statvfs);
365 vfs_statvfs->OptimalTransferSize = statvfs.f_frsize;
366 vfs_statvfs->BlockSize = statvfs.f_bsize;
367 vfs_statvfs->TotalBlocks = statvfs.f_blocks;
368 vfs_statvfs->BlocksAvail = statvfs.f_bfree;
369 vfs_statvfs->UserBlocksAvail = statvfs.f_bavail;
370 vfs_statvfs->TotalFileNodes = statvfs.f_files;
371 vfs_statvfs->FreeFileNodes = statvfs.f_ffree;
372 vfs_statvfs->FsIdentifier = statvfs.f_fsid;
373 vfs_statvfs->FsCapabilities =
374 FILE_CASE_SENSITIVE_SEARCH | FILE_CASE_PRESERVED_NAMES;
376 return ret;
379 static uint32_t vfs_gluster_fs_capabilities(struct vfs_handle_struct *handle,
380 enum timestamp_set_resolution *p_ts_res)
382 uint32_t caps = FILE_CASE_SENSITIVE_SEARCH | FILE_CASE_PRESERVED_NAMES;
384 #ifdef STAT_HAVE_NSEC
385 *p_ts_res = TIMESTAMP_SET_NT_OR_BETTER;
386 #endif
388 return caps;
391 static DIR *vfs_gluster_opendir(struct vfs_handle_struct *handle,
392 const char *path, const char *mask,
393 uint32 attributes)
395 glfs_fd_t *fd;
397 fd = glfs_opendir(handle->data, path);
398 if (fd == NULL) {
399 DEBUG(0, ("glfs_opendir(%s) failed: %s\n",
400 path, strerror(errno)));
403 return (DIR *) fd;
406 static DIR *vfs_gluster_fdopendir(struct vfs_handle_struct *handle,
407 files_struct *fsp, const char *mask,
408 uint32 attributes)
410 return (DIR *) glfd_fd_get(fsp->fh->fd);
413 static int vfs_gluster_closedir(struct vfs_handle_struct *handle, DIR *dirp)
415 return glfs_closedir((void *)dirp);
418 static struct dirent *vfs_gluster_readdir(struct vfs_handle_struct *handle,
419 DIR *dirp, SMB_STRUCT_STAT *sbuf)
421 static char direntbuf[512];
422 int ret;
423 struct stat stat;
424 struct dirent *dirent = 0;
426 if (sbuf != NULL) {
427 ret = glfs_readdirplus_r((void *)dirp, &stat, (void *)direntbuf,
428 &dirent);
429 } else {
430 ret = glfs_readdir_r((void *)dirp, (void *)direntbuf, &dirent);
433 if ((ret < 0) || (dirent == NULL)) {
434 return NULL;
437 if (sbuf != NULL) {
438 smb_stat_ex_from_stat(sbuf, &stat);
441 return dirent;
444 static long vfs_gluster_telldir(struct vfs_handle_struct *handle, DIR *dirp)
446 return glfs_telldir((void *)dirp);
449 static void vfs_gluster_seekdir(struct vfs_handle_struct *handle, DIR *dirp,
450 long offset)
452 glfs_seekdir((void *)dirp, offset);
455 static void vfs_gluster_rewinddir(struct vfs_handle_struct *handle, DIR *dirp)
457 glfs_seekdir((void *)dirp, 0);
460 static void vfs_gluster_init_search_op(struct vfs_handle_struct *handle,
461 DIR *dirp)
463 return;
466 static int vfs_gluster_mkdir(struct vfs_handle_struct *handle, const char *path,
467 mode_t mode)
469 return glfs_mkdir(handle->data, path, mode);
472 static int vfs_gluster_rmdir(struct vfs_handle_struct *handle, const char *path)
474 return glfs_rmdir(handle->data, path);
477 static int vfs_gluster_open(struct vfs_handle_struct *handle,
478 struct smb_filename *smb_fname, files_struct *fsp,
479 int flags, mode_t mode)
481 glfs_fd_t *glfd;
483 if (flags & O_DIRECTORY) {
484 glfd = glfs_opendir(handle->data, smb_fname->base_name);
485 } else if (flags & O_CREAT) {
486 glfd = glfs_creat(handle->data, smb_fname->base_name, flags,
487 mode);
488 } else {
489 glfd = glfs_open(handle->data, smb_fname->base_name, flags);
492 if (glfd == NULL) {
493 return -1;
495 return glfd_fd_store(glfd);
498 static int vfs_gluster_close(struct vfs_handle_struct *handle,
499 files_struct *fsp)
501 return glfs_close(glfd_fd_clear(fsp->fh->fd));
504 static ssize_t vfs_gluster_read(struct vfs_handle_struct *handle,
505 files_struct *fsp, void *data, size_t n)
507 return glfs_read(glfd_fd_get(fsp->fh->fd), data, n, 0);
510 static ssize_t vfs_gluster_pread(struct vfs_handle_struct *handle,
511 files_struct *fsp, void *data, size_t n,
512 off_t offset)
514 return glfs_pread(glfd_fd_get(fsp->fh->fd), data, n, offset, 0);
517 static struct tevent_req *vfs_gluster_pread_send(struct vfs_handle_struct
518 *handle, TALLOC_CTX *mem_ctx,
519 struct tevent_context *ev,
520 files_struct *fsp, void *data,
521 size_t n, off_t offset)
523 errno = ENOTSUP;
524 return NULL;
527 static ssize_t vfs_gluster_pread_recv(struct tevent_req *req, int *err)
529 errno = ENOTSUP;
530 return -1;
533 static ssize_t vfs_gluster_write(struct vfs_handle_struct *handle,
534 files_struct *fsp, const void *data, size_t n)
536 return glfs_write(glfd_fd_get(fsp->fh->fd), data, n, 0);
539 static ssize_t vfs_gluster_pwrite(struct vfs_handle_struct *handle,
540 files_struct *fsp, const void *data,
541 size_t n, off_t offset)
543 return glfs_pwrite(glfd_fd_get(fsp->fh->fd), data, n, offset, 0);
546 static struct tevent_req *vfs_gluster_pwrite_send(struct vfs_handle_struct
547 *handle, TALLOC_CTX *mem_ctx,
548 struct tevent_context *ev,
549 files_struct *fsp,
550 const void *data, size_t n,
551 off_t offset)
553 errno = ENOTSUP;
554 return NULL;
557 static ssize_t vfs_gluster_pwrite_recv(struct tevent_req *req, int *err)
559 errno = ENOTSUP;
560 return -1;
563 static off_t vfs_gluster_lseek(struct vfs_handle_struct *handle,
564 files_struct *fsp, off_t offset, int whence)
566 return glfs_lseek(glfd_fd_get(fsp->fh->fd), offset, whence);
569 static ssize_t vfs_gluster_sendfile(struct vfs_handle_struct *handle, int tofd,
570 files_struct *fromfsp,
571 const DATA_BLOB *hdr,
572 off_t offset, size_t n)
574 errno = ENOTSUP;
575 return -1;
578 static ssize_t vfs_gluster_recvfile(struct vfs_handle_struct *handle,
579 int fromfd, files_struct *tofsp,
580 off_t offset, size_t n)
582 errno = ENOTSUP;
583 return -1;
586 static int vfs_gluster_rename(struct vfs_handle_struct *handle,
587 const struct smb_filename *smb_fname_src,
588 const struct smb_filename *smb_fname_dst)
590 return glfs_rename(handle->data, smb_fname_src->base_name,
591 smb_fname_dst->base_name);
594 static int vfs_gluster_fsync(struct vfs_handle_struct *handle,
595 files_struct *fsp)
597 return glfs_fsync(glfd_fd_get(fsp->fh->fd));
600 static struct tevent_req *vfs_gluster_fsync_send(struct vfs_handle_struct
601 *handle, TALLOC_CTX *mem_ctx,
602 struct tevent_context *ev,
603 files_struct *fsp)
605 errno = ENOTSUP;
606 return NULL;
609 static int vfs_gluster_fsync_recv(struct tevent_req *req, int *err)
611 errno = ENOTSUP;
612 return -1;
615 static int vfs_gluster_stat(struct vfs_handle_struct *handle,
616 struct smb_filename *smb_fname)
618 struct stat st;
619 int ret;
621 ret = glfs_stat(handle->data, smb_fname->base_name, &st);
622 if (ret == 0) {
623 smb_stat_ex_from_stat(&smb_fname->st, &st);
625 if (ret < 0 && errno != ENOENT) {
626 DEBUG(0, ("glfs_stat(%s) failed: %s\n",
627 smb_fname->base_name, strerror(errno)));
629 return ret;
632 static int vfs_gluster_fstat(struct vfs_handle_struct *handle,
633 files_struct *fsp, SMB_STRUCT_STAT *sbuf)
635 struct stat st;
636 int ret;
638 ret = glfs_fstat(glfd_fd_get(fsp->fh->fd), &st);
639 if (ret == 0) {
640 smb_stat_ex_from_stat(sbuf, &st);
642 if (ret < 0) {
643 DEBUG(0, ("glfs_fstat(%d) failed: %s\n",
644 fsp->fh->fd, strerror(errno)));
646 return ret;
649 static int vfs_gluster_lstat(struct vfs_handle_struct *handle,
650 struct smb_filename *smb_fname)
652 struct stat st;
653 int ret;
655 ret = glfs_lstat(handle->data, smb_fname->base_name, &st);
656 if (ret == 0) {
657 smb_stat_ex_from_stat(&smb_fname->st, &st);
659 if (ret < 0 && errno != ENOENT) {
660 DEBUG(0, ("glfs_lstat(%s) failed: %s\n",
661 smb_fname->base_name, strerror(errno)));
663 return ret;
666 static uint64_t vfs_gluster_get_alloc_size(struct vfs_handle_struct *handle,
667 files_struct *fsp,
668 const SMB_STRUCT_STAT *sbuf)
670 return sbuf->st_ex_blocks * 512;
673 static int vfs_gluster_unlink(struct vfs_handle_struct *handle,
674 const struct smb_filename *smb_fname)
676 return glfs_unlink(handle->data, smb_fname->base_name);
679 static int vfs_gluster_chmod(struct vfs_handle_struct *handle,
680 const char *path, mode_t mode)
682 return glfs_chmod(handle->data, path, mode);
685 static int vfs_gluster_fchmod(struct vfs_handle_struct *handle,
686 files_struct *fsp, mode_t mode)
688 return glfs_fchmod(glfd_fd_get(fsp->fh->fd), mode);
691 static int vfs_gluster_chown(struct vfs_handle_struct *handle,
692 const char *path, uid_t uid, gid_t gid)
694 return glfs_chown(handle->data, path, uid, gid);
697 static int vfs_gluster_fchown(struct vfs_handle_struct *handle,
698 files_struct *fsp, uid_t uid, gid_t gid)
700 return glfs_fchown(glfd_fd_get(fsp->fh->fd), uid, gid);
703 static int vfs_gluster_lchown(struct vfs_handle_struct *handle,
704 const char *path, uid_t uid, gid_t gid)
706 return glfs_lchown(handle->data, path, uid, gid);
709 static int vfs_gluster_chdir(struct vfs_handle_struct *handle, const char *path)
711 return glfs_chdir(handle->data, path);
714 static char *vfs_gluster_getwd(struct vfs_handle_struct *handle)
716 char *cwd;
717 char *ret;
719 cwd = SMB_CALLOC_ARRAY(char, PATH_MAX);
720 if (cwd == NULL) {
721 return NULL;
724 ret = glfs_getcwd(handle->data, cwd, PATH_MAX - 1);
725 if (ret == 0) {
726 free(cwd);
728 return ret;
731 static int vfs_gluster_ntimes(struct vfs_handle_struct *handle,
732 const struct smb_filename *smb_fname,
733 struct smb_file_time *ft)
735 struct timespec times[2];
737 if (null_timespec(ft->atime)) {
738 times[0].tv_sec = smb_fname->st.st_ex_atime.tv_sec;
739 times[0].tv_nsec = smb_fname->st.st_ex_atime.tv_nsec;
740 } else {
741 times[0].tv_sec = ft->atime.tv_sec;
742 times[0].tv_nsec = ft->atime.tv_nsec;
745 if (null_timespec(ft->mtime)) {
746 times[1].tv_sec = smb_fname->st.st_ex_mtime.tv_sec;
747 times[1].tv_nsec = smb_fname->st.st_ex_mtime.tv_nsec;
748 } else {
749 times[1].tv_sec = ft->mtime.tv_sec;
750 times[1].tv_nsec = ft->mtime.tv_nsec;
753 if ((timespec_compare(&times[0],
754 &smb_fname->st.st_ex_atime) == 0) &&
755 (timespec_compare(&times[1],
756 &smb_fname->st.st_ex_mtime) == 0)) {
757 return 0;
760 return glfs_utimens(handle->data, smb_fname->base_name, times);
763 static int vfs_gluster_ftruncate(struct vfs_handle_struct *handle,
764 files_struct *fsp, off_t offset)
766 return glfs_ftruncate(glfd_fd_get(fsp->fh->fd), offset);
769 static int vfs_gluster_fallocate(struct vfs_handle_struct *handle,
770 struct files_struct *fsp,
771 enum vfs_fallocate_mode mode,
772 off_t offset, off_t len)
774 errno = ENOTSUP;
775 return -1;
778 static char *vfs_gluster_realpath(struct vfs_handle_struct *handle,
779 const char *path)
781 return glfs_realpath(handle->data, path, 0);
784 static bool vfs_gluster_lock(struct vfs_handle_struct *handle,
785 files_struct *fsp, int op, off_t offset,
786 off_t count, int type)
788 struct flock flock = { 0, };
789 int ret;
791 flock.l_type = type;
792 flock.l_whence = SEEK_SET;
793 flock.l_start = offset;
794 flock.l_len = count;
795 flock.l_pid = 0;
797 ret = glfs_posix_lock(glfd_fd_get(fsp->fh->fd), op, &flock);
799 if (op == F_GETLK) {
800 /* lock query, true if someone else has locked */
801 if ((ret != -1) &&
802 (flock.l_type != F_UNLCK) &&
803 (flock.l_pid != 0) && (flock.l_pid != getpid()))
804 return true;
805 /* not me */
806 return false;
809 if (ret == -1) {
810 return false;
813 return true;
816 static int vfs_gluster_kernel_flock(struct vfs_handle_struct *handle,
817 files_struct *fsp, uint32 share_mode,
818 uint32_t access_mask)
820 errno = ENOSYS;
821 return -1;
824 static int vfs_gluster_linux_setlease(struct vfs_handle_struct *handle,
825 files_struct *fsp, int leasetype)
827 errno = ENOSYS;
828 return -1;
831 static bool vfs_gluster_getlock(struct vfs_handle_struct *handle,
832 files_struct *fsp, off_t *poffset,
833 off_t *pcount, int *ptype, pid_t *ppid)
835 struct flock flock = { 0, };
836 int ret;
838 flock.l_type = *ptype;
839 flock.l_whence = SEEK_SET;
840 flock.l_start = *poffset;
841 flock.l_len = *pcount;
842 flock.l_pid = 0;
844 ret = glfs_posix_lock(glfd_fd_get(fsp->fh->fd), F_GETLK, &flock);
846 if (ret == -1) {
847 return false;
850 *ptype = flock.l_type;
851 *poffset = flock.l_start;
852 *pcount = flock.l_len;
853 *ppid = flock.l_pid;
855 return true;
858 static int vfs_gluster_symlink(struct vfs_handle_struct *handle,
859 const char *oldpath, const char *newpath)
861 return glfs_symlink(handle->data, oldpath, newpath);
864 static int vfs_gluster_readlink(struct vfs_handle_struct *handle,
865 const char *path, char *buf, size_t bufsiz)
867 return glfs_readlink(handle->data, path, buf, bufsiz);
870 static int vfs_gluster_link(struct vfs_handle_struct *handle,
871 const char *oldpath, const char *newpath)
873 return glfs_link(handle->data, oldpath, newpath);
876 static int vfs_gluster_mknod(struct vfs_handle_struct *handle, const char *path,
877 mode_t mode, SMB_DEV_T dev)
879 return glfs_mknod(handle->data, path, mode, dev);
882 static NTSTATUS vfs_gluster_notify_watch(struct vfs_handle_struct *handle,
883 struct sys_notify_context *ctx,
884 const char *path, uint32_t *filter,
885 uint32_t *subdir_filter,
886 void (*callback) (struct sys_notify_context *ctx,
887 void *private_data,
888 struct notify_event *ev),
889 void *private_data, void *handle_p)
891 return NT_STATUS_NOT_IMPLEMENTED;
894 static int vfs_gluster_chflags(struct vfs_handle_struct *handle,
895 const char *path, unsigned int flags)
897 errno = ENOSYS;
898 return -1;
901 static int vfs_gluster_get_real_filename(struct vfs_handle_struct *handle,
902 const char *path, const char *name,
903 TALLOC_CTX *mem_ctx, char **found_name)
905 int ret;
906 char key_buf[NAME_MAX + 64];
907 char val_buf[NAME_MAX + 1];
909 if (strlen(name) >= NAME_MAX) {
910 errno = ENAMETOOLONG;
911 return -1;
914 snprintf(key_buf, NAME_MAX + 64,
915 "user.glusterfs.get_real_filename:%s", name);
917 ret = glfs_getxattr(handle->data, path, key_buf, val_buf, NAME_MAX + 1);
918 if (ret == -1) {
919 if (errno == ENODATA) {
920 errno = EOPNOTSUPP;
922 return -1;
925 *found_name = talloc_strdup(mem_ctx, val_buf);
926 if (found_name[0] == NULL) {
927 errno = ENOMEM;
928 return -1;
930 return 0;
933 static const char *vfs_gluster_connectpath(struct vfs_handle_struct *handle,
934 const char *filename)
936 return handle->conn->connectpath;
939 /* EA Operations */
941 static ssize_t vfs_gluster_getxattr(struct vfs_handle_struct *handle,
942 const char *path, const char *name,
943 void *value, size_t size)
945 return glfs_getxattr(handle->data, path, name, value, size);
948 static ssize_t vfs_gluster_fgetxattr(struct vfs_handle_struct *handle,
949 files_struct *fsp, const char *name,
950 void *value, size_t size)
952 return glfs_fgetxattr(glfd_fd_get(fsp->fh->fd), name, value, size);
955 static ssize_t vfs_gluster_listxattr(struct vfs_handle_struct *handle,
956 const char *path, char *list, size_t size)
958 return glfs_listxattr(handle->data, path, list, size);
961 static ssize_t vfs_gluster_flistxattr(struct vfs_handle_struct *handle,
962 files_struct *fsp, char *list,
963 size_t size)
965 return glfs_flistxattr(glfd_fd_get(fsp->fh->fd), list, size);
968 static int vfs_gluster_removexattr(struct vfs_handle_struct *handle,
969 const char *path, const char *name)
971 return glfs_removexattr(handle->data, path, name);
974 static int vfs_gluster_fremovexattr(struct vfs_handle_struct *handle,
975 files_struct *fsp, const char *name)
977 return glfs_fremovexattr(glfd_fd_get(fsp->fh->fd), name);
980 static int vfs_gluster_setxattr(struct vfs_handle_struct *handle,
981 const char *path, const char *name,
982 const void *value, size_t size, int flags)
984 return glfs_setxattr(handle->data, path, name, value, size, flags);
987 static int vfs_gluster_fsetxattr(struct vfs_handle_struct *handle,
988 files_struct *fsp, const char *name,
989 const void *value, size_t size, int flags)
991 return glfs_fsetxattr(glfd_fd_get(fsp->fh->fd), name, value, size,
992 flags);
995 /* AIO Operations */
997 static bool vfs_gluster_aio_force(struct vfs_handle_struct *handle,
998 files_struct *fsp)
1000 return false;
1003 /* Offline Operations */
1005 static bool vfs_gluster_is_offline(struct vfs_handle_struct *handle,
1006 const struct smb_filename *fname,
1007 SMB_STRUCT_STAT *sbuf)
1009 return false;
1012 static int vfs_gluster_set_offline(struct vfs_handle_struct *handle,
1013 const struct smb_filename *fname)
1015 errno = ENOTSUP;
1016 return -1;
1020 Gluster ACL Format:
1022 Size = 4 (header) + N * 8 (entry)
1024 Offset Size Field (Little Endian)
1025 -------------------------------------
1026 0-3 4-byte Version
1028 4-5 2-byte Entry-1 tag
1029 6-7 2-byte Entry-1 perm
1030 8-11 4-byte Entry-1 id
1032 12-13 2-byte Entry-2 tag
1033 14-15 2-byte Entry-2 perm
1034 16-19 4-byte Entry-2 id
1040 /* header version */
1041 #define GLUSTER_ACL_VERSION 2
1043 /* perm bits */
1044 #define GLUSTER_ACL_READ 0x04
1045 #define GLUSTER_ACL_WRITE 0x02
1046 #define GLUSTER_ACL_EXECUTE 0x01
1048 /* tag values */
1049 #define GLUSTER_ACL_UNDEFINED_TAG 0x00
1050 #define GLUSTER_ACL_USER_OBJ 0x01
1051 #define GLUSTER_ACL_USER 0x02
1052 #define GLUSTER_ACL_GROUP_OBJ 0x04
1053 #define GLUSTER_ACL_GROUP 0x08
1054 #define GLUSTER_ACL_MASK 0x10
1055 #define GLUSTER_ACL_OTHER 0x20
1057 #define GLUSTER_ACL_UNDEFINED_ID (-1)
1059 #define GLUSTER_ACL_HEADER_SIZE 4
1060 #define GLUSTER_ACL_ENTRY_SIZE 8
1062 static SMB_ACL_T gluster_to_smb_acl(const char *buf, size_t xattr_size,
1063 TALLOC_CTX *mem_ctx)
1065 int count;
1066 size_t size;
1067 struct smb_acl_entry *smb_ace;
1068 struct smb_acl_t *result;
1069 int i;
1070 int offset;
1071 uint16_t tag;
1072 uint16_t perm;
1073 uint32_t id;
1075 size = xattr_size;
1077 if (size < GLUSTER_ACL_HEADER_SIZE) {
1078 /* ACL should be at least as big as the header (4 bytes) */
1079 errno = EINVAL;
1080 return NULL;
1083 size -= GLUSTER_ACL_HEADER_SIZE; /* size of header = 4 bytes */
1085 if (size % GLUSTER_ACL_ENTRY_SIZE) {
1086 /* Size of entries must strictly be a multiple of
1087 size of an ACE (8 bytes)
1089 errno = EINVAL;
1090 return NULL;
1093 count = size / GLUSTER_ACL_ENTRY_SIZE;
1095 /* Version is the first 4 bytes of the ACL */
1096 if (IVAL(buf, 0) != GLUSTER_ACL_VERSION) {
1097 DEBUG(0, ("Unknown gluster ACL version: %d\n",
1098 IVAL(buf, 0)));
1099 return NULL;
1101 offset = GLUSTER_ACL_HEADER_SIZE;
1103 result = sys_acl_init(mem_ctx);
1104 if (!result) {
1105 errno = ENOMEM;
1106 return NULL;
1109 result->acl = talloc_array(result, struct smb_acl_entry, count);
1110 if (!result->acl) {
1111 errno = ENOMEM;
1112 talloc_free(result);
1113 return NULL;
1116 result->count = count;
1118 smb_ace = result->acl;
1120 for (i = 0; i < count; i++) {
1121 /* TAG is the first 2 bytes of an entry */
1122 tag = SVAL(buf, offset);
1123 offset += 2;
1125 /* PERM is the next 2 bytes of an entry */
1126 perm = SVAL(buf, offset);
1127 offset += 2;
1129 /* ID is the last 4 bytes of an entry */
1130 id = IVAL(buf, offset);
1131 offset += 4;
1133 switch(tag) {
1134 case GLUSTER_ACL_USER:
1135 smb_ace->a_type = SMB_ACL_USER;
1136 break;
1137 case GLUSTER_ACL_USER_OBJ:
1138 smb_ace->a_type = SMB_ACL_USER_OBJ;
1139 break;
1140 case GLUSTER_ACL_GROUP:
1141 smb_ace->a_type = SMB_ACL_GROUP;
1142 break;
1143 case GLUSTER_ACL_GROUP_OBJ:
1144 smb_ace->a_type = SMB_ACL_GROUP_OBJ;
1145 break;
1146 case GLUSTER_ACL_OTHER:
1147 smb_ace->a_type = SMB_ACL_OTHER;
1148 break;
1149 case GLUSTER_ACL_MASK:
1150 smb_ace->a_type = SMB_ACL_MASK;
1151 break;
1152 default:
1153 DEBUG(0, ("unknown tag type %d\n", (unsigned int) tag));
1154 return NULL;
1158 switch(smb_ace->a_type) {
1159 case SMB_ACL_USER:
1160 smb_ace->info.user.uid = id;
1161 break;
1162 case SMB_ACL_GROUP:
1163 smb_ace->info.group.gid = id;
1164 break;
1165 default:
1166 break;
1169 smb_ace->a_perm = 0;
1170 smb_ace->a_perm |=
1171 ((perm & GLUSTER_ACL_READ) ? SMB_ACL_READ : 0);
1172 smb_ace->a_perm |=
1173 ((perm & GLUSTER_ACL_WRITE) ? SMB_ACL_WRITE : 0);
1174 smb_ace->a_perm |=
1175 ((perm & GLUSTER_ACL_EXECUTE) ? SMB_ACL_EXECUTE : 0);
1177 smb_ace++;
1180 return result;
1184 static int gluster_ace_cmp(const void *left, const void *right)
1186 int ret = 0;
1187 uint16_t tag_left, tag_right;
1188 uint32_t id_left, id_right;
1191 Sorting precedence:
1193 - Smaller TAG values must be earlier.
1195 - Within same TAG, smaller identifiers must be earlier, E.g:
1196 UID 0 entry must be earlier than UID 200
1197 GID 17 entry must be earlier than GID 19
1200 /* TAG is the first element in the entry */
1201 tag_left = SVAL(left, 0);
1202 tag_right = SVAL(right, 0);
1204 ret = (tag_left - tag_right);
1205 if (!ret) {
1206 /* ID is the third element in the entry, after two short
1207 integers (tag and perm), i.e at offset 4.
1209 id_left = IVAL(left, 4);
1210 id_right = IVAL(right, 4);
1211 ret = id_left - id_right;
1214 return ret;
1218 static ssize_t smb_to_gluster_acl(SMB_ACL_T theacl, char *buf, size_t len)
1220 ssize_t size;
1221 struct smb_acl_entry *smb_ace;
1222 int i;
1223 int count;
1224 uint16_t tag;
1225 uint16_t perm;
1226 uint32_t id;
1227 int offset;
1229 count = theacl->count;
1231 size = GLUSTER_ACL_HEADER_SIZE + (count * GLUSTER_ACL_ENTRY_SIZE);
1232 if (!buf) {
1233 return size;
1236 if (len < size) {
1237 errno = ERANGE;
1238 return -1;
1241 smb_ace = theacl->acl;
1243 /* Version is the first 4 bytes of the ACL */
1244 SIVAL(buf, 0, GLUSTER_ACL_VERSION);
1245 offset = GLUSTER_ACL_HEADER_SIZE;
1247 for (i = 0; i < count; i++) {
1248 /* Calculate tag */
1249 switch(smb_ace->a_type) {
1250 case SMB_ACL_USER:
1251 tag = GLUSTER_ACL_USER;
1252 break;
1253 case SMB_ACL_USER_OBJ:
1254 tag = GLUSTER_ACL_USER_OBJ;
1255 break;
1256 case SMB_ACL_GROUP:
1257 tag = GLUSTER_ACL_GROUP;
1258 break;
1259 case SMB_ACL_GROUP_OBJ:
1260 tag = GLUSTER_ACL_GROUP_OBJ;
1261 break;
1262 case SMB_ACL_OTHER:
1263 tag = GLUSTER_ACL_OTHER;
1264 break;
1265 case SMB_ACL_MASK:
1266 tag = GLUSTER_ACL_MASK;
1267 break;
1268 default:
1269 DEBUG(0, ("Unknown tag value %d\n",
1270 smb_ace->a_type));
1271 errno = EINVAL;
1272 return -1;
1276 /* Calculate id */
1277 switch(smb_ace->a_type) {
1278 case SMB_ACL_USER:
1279 id = smb_ace->info.user.uid;
1280 break;
1281 case SMB_ACL_GROUP:
1282 id = smb_ace->info.group.gid;
1283 break;
1284 default:
1285 id = GLUSTER_ACL_UNDEFINED_ID;
1286 break;
1289 /* Calculate perm */
1290 perm = 0;
1292 perm |=
1293 ((smb_ace->a_perm & SMB_ACL_READ) ? GLUSTER_ACL_READ : 0);
1294 perm |=
1295 ((smb_ace->a_perm & SMB_ACL_WRITE) ? GLUSTER_ACL_WRITE : 0);
1296 perm |=
1297 ((smb_ace->a_perm & SMB_ACL_EXECUTE) ? GLUSTER_ACL_EXECUTE : 0);
1300 /* TAG is the first 2 bytes of an entry */
1301 SSVAL(buf, offset, tag);
1302 offset += 2;
1304 /* PERM is the next 2 bytes of an entry */
1305 SSVAL(buf, offset, perm);
1306 offset += 2;
1308 /* ID is the last 4 bytes of an entry */
1309 SIVAL(buf, offset, id);
1310 offset += 4;
1312 smb_ace++;
1315 /* Skip the header, sort @count number of 8-byte entries */
1316 qsort(buf+GLUSTER_ACL_HEADER_SIZE, count, GLUSTER_ACL_ENTRY_SIZE,
1317 gluster_ace_cmp);
1319 return size;
1323 static SMB_ACL_T vfs_gluster_sys_acl_get_file(struct vfs_handle_struct *handle,
1324 const char *path_p,
1325 SMB_ACL_TYPE_T type,
1326 TALLOC_CTX *mem_ctx)
1328 struct smb_acl_t *result;
1329 char *buf;
1330 const char *key;
1331 ssize_t ret;
1333 switch (type) {
1334 case SMB_ACL_TYPE_ACCESS:
1335 key = "system.posix_acl_access";
1336 break;
1337 case SMB_ACL_TYPE_DEFAULT:
1338 key = "system.posix_acl_default";
1339 break;
1340 default:
1341 errno = EINVAL;
1342 return NULL;
1345 ret = glfs_getxattr(handle->data, path_p, key, 0, 0);
1346 if (ret <= 0) {
1347 return NULL;
1350 buf = alloca(ret);
1351 ret = glfs_getxattr(handle->data, path_p, key, buf, ret);
1352 if (ret <= 0) {
1353 return NULL;
1356 result = gluster_to_smb_acl(buf, ret, mem_ctx);
1358 return result;
1361 static SMB_ACL_T vfs_gluster_sys_acl_get_fd(struct vfs_handle_struct *handle,
1362 struct files_struct *fsp,
1363 TALLOC_CTX *mem_ctx)
1365 struct smb_acl_t *result;
1366 int ret;
1367 char *buf;
1369 ret = glfs_fgetxattr(glfd_fd_get(fsp->fh->fd),
1370 "system.posix_acl_access", 0, 0);
1371 if (ret <= 0) {
1372 return NULL;
1375 buf = alloca(ret);
1376 ret = glfs_fgetxattr(glfd_fd_get(fsp->fh->fd),
1377 "system.posix_acl_access", buf, ret);
1378 if (ret <= 0) {
1379 return NULL;
1382 result = gluster_to_smb_acl(buf, ret, mem_ctx);
1384 return result;
1387 static int vfs_gluster_sys_acl_set_file(struct vfs_handle_struct *handle,
1388 const char *name,
1389 SMB_ACL_TYPE_T acltype,
1390 SMB_ACL_T theacl)
1392 int ret;
1393 const char *key;
1394 char *buf;
1395 ssize_t size;
1397 switch (acltype) {
1398 case SMB_ACL_TYPE_ACCESS:
1399 key = "system.posix_acl_access";
1400 break;
1401 case SMB_ACL_TYPE_DEFAULT:
1402 key = "system.posix_acl_default";
1403 break;
1404 default:
1405 errno = EINVAL;
1406 return -1;
1409 size = smb_to_gluster_acl(theacl, 0, 0);
1410 buf = alloca(size);
1412 size = smb_to_gluster_acl(theacl, buf, size);
1413 if (size == -1) {
1414 return -1;
1417 ret = glfs_setxattr(handle->data, name, key, buf, size, 0);
1419 return ret;
1422 static int vfs_gluster_sys_acl_set_fd(struct vfs_handle_struct *handle,
1423 struct files_struct *fsp,
1424 SMB_ACL_T theacl)
1426 int ret;
1427 char *buf;
1428 ssize_t size;
1430 size = smb_to_gluster_acl(theacl, 0, 0);
1431 buf = alloca(size);
1433 size = smb_to_gluster_acl(theacl, buf, size);
1434 if (size == -1) {
1435 return -1;
1438 ret = glfs_fsetxattr(glfd_fd_get(fsp->fh->fd),
1439 "system.posix_acl_access", buf, size, 0);
1440 return ret;
1443 static int vfs_gluster_sys_acl_delete_def_file(struct vfs_handle_struct *handle,
1444 const char *path)
1446 return glfs_removexattr(handle->data, path, "system.posix_acl_default");
1449 static struct vfs_fn_pointers glusterfs_fns = {
1451 /* Disk Operations */
1453 .connect_fn = vfs_gluster_connect,
1454 .disconnect_fn = vfs_gluster_disconnect,
1455 .disk_free_fn = vfs_gluster_disk_free,
1456 .get_quota_fn = vfs_gluster_get_quota,
1457 .set_quota_fn = vfs_gluster_set_quota,
1458 .statvfs_fn = vfs_gluster_statvfs,
1459 .fs_capabilities_fn = vfs_gluster_fs_capabilities,
1461 .get_dfs_referrals_fn = NULL,
1463 /* Directory Operations */
1465 .opendir_fn = vfs_gluster_opendir,
1466 .fdopendir_fn = vfs_gluster_fdopendir,
1467 .readdir_fn = vfs_gluster_readdir,
1468 .seekdir_fn = vfs_gluster_seekdir,
1469 .telldir_fn = vfs_gluster_telldir,
1470 .rewind_dir_fn = vfs_gluster_rewinddir,
1471 .mkdir_fn = vfs_gluster_mkdir,
1472 .rmdir_fn = vfs_gluster_rmdir,
1473 .closedir_fn = vfs_gluster_closedir,
1474 .init_search_op_fn = vfs_gluster_init_search_op,
1476 /* File Operations */
1478 .open_fn = vfs_gluster_open,
1479 .create_file_fn = NULL,
1480 .close_fn = vfs_gluster_close,
1481 .read_fn = vfs_gluster_read,
1482 .pread_fn = vfs_gluster_pread,
1483 .pread_send_fn = vfs_gluster_pread_send,
1484 .pread_recv_fn = vfs_gluster_pread_recv,
1485 .write_fn = vfs_gluster_write,
1486 .pwrite_fn = vfs_gluster_pwrite,
1487 .pwrite_send_fn = vfs_gluster_pwrite_send,
1488 .pwrite_recv_fn = vfs_gluster_pwrite_recv,
1489 .lseek_fn = vfs_gluster_lseek,
1490 .sendfile_fn = vfs_gluster_sendfile,
1491 .recvfile_fn = vfs_gluster_recvfile,
1492 .rename_fn = vfs_gluster_rename,
1493 .fsync_fn = vfs_gluster_fsync,
1494 .fsync_send_fn = vfs_gluster_fsync_send,
1495 .fsync_recv_fn = vfs_gluster_fsync_recv,
1497 .stat_fn = vfs_gluster_stat,
1498 .fstat_fn = vfs_gluster_fstat,
1499 .lstat_fn = vfs_gluster_lstat,
1500 .get_alloc_size_fn = vfs_gluster_get_alloc_size,
1501 .unlink_fn = vfs_gluster_unlink,
1503 .chmod_fn = vfs_gluster_chmod,
1504 .fchmod_fn = vfs_gluster_fchmod,
1505 .chown_fn = vfs_gluster_chown,
1506 .fchown_fn = vfs_gluster_fchown,
1507 .lchown_fn = vfs_gluster_lchown,
1508 .chdir_fn = vfs_gluster_chdir,
1509 .getwd_fn = vfs_gluster_getwd,
1510 .ntimes_fn = vfs_gluster_ntimes,
1511 .ftruncate_fn = vfs_gluster_ftruncate,
1512 .fallocate_fn = vfs_gluster_fallocate,
1513 .lock_fn = vfs_gluster_lock,
1514 .kernel_flock_fn = vfs_gluster_kernel_flock,
1515 .linux_setlease_fn = vfs_gluster_linux_setlease,
1516 .getlock_fn = vfs_gluster_getlock,
1517 .symlink_fn = vfs_gluster_symlink,
1518 .readlink_fn = vfs_gluster_readlink,
1519 .link_fn = vfs_gluster_link,
1520 .mknod_fn = vfs_gluster_mknod,
1521 .realpath_fn = vfs_gluster_realpath,
1522 .notify_watch_fn = vfs_gluster_notify_watch,
1523 .chflags_fn = vfs_gluster_chflags,
1524 .file_id_create_fn = NULL,
1525 .copy_chunk_send_fn = NULL,
1526 .copy_chunk_recv_fn = NULL,
1527 .streaminfo_fn = NULL,
1528 .get_real_filename_fn = vfs_gluster_get_real_filename,
1529 .connectpath_fn = vfs_gluster_connectpath,
1531 .brl_lock_windows_fn = NULL,
1532 .brl_unlock_windows_fn = NULL,
1533 .brl_cancel_windows_fn = NULL,
1534 .strict_lock_fn = NULL,
1535 .strict_unlock_fn = NULL,
1536 .translate_name_fn = NULL,
1537 .fsctl_fn = NULL,
1539 /* NT ACL Operations */
1540 .fget_nt_acl_fn = NULL,
1541 .get_nt_acl_fn = NULL,
1542 .fset_nt_acl_fn = NULL,
1543 .audit_file_fn = NULL,
1545 /* Posix ACL Operations */
1546 .chmod_acl_fn = NULL, /* passthrough to default */
1547 .fchmod_acl_fn = NULL, /* passthrough to default */
1548 .sys_acl_get_file_fn = vfs_gluster_sys_acl_get_file,
1549 .sys_acl_get_fd_fn = vfs_gluster_sys_acl_get_fd,
1550 .sys_acl_blob_get_file_fn = posix_sys_acl_blob_get_file,
1551 .sys_acl_blob_get_fd_fn = posix_sys_acl_blob_get_fd,
1552 .sys_acl_set_file_fn = vfs_gluster_sys_acl_set_file,
1553 .sys_acl_set_fd_fn = vfs_gluster_sys_acl_set_fd,
1554 .sys_acl_delete_def_file_fn = vfs_gluster_sys_acl_delete_def_file,
1556 /* EA Operations */
1557 .getxattr_fn = vfs_gluster_getxattr,
1558 .fgetxattr_fn = vfs_gluster_fgetxattr,
1559 .listxattr_fn = vfs_gluster_listxattr,
1560 .flistxattr_fn = vfs_gluster_flistxattr,
1561 .removexattr_fn = vfs_gluster_removexattr,
1562 .fremovexattr_fn = vfs_gluster_fremovexattr,
1563 .setxattr_fn = vfs_gluster_setxattr,
1564 .fsetxattr_fn = vfs_gluster_fsetxattr,
1566 /* AIO Operations */
1567 .aio_force_fn = vfs_gluster_aio_force,
1569 /* Offline Operations */
1570 .is_offline_fn = vfs_gluster_is_offline,
1571 .set_offline_fn = vfs_gluster_set_offline,
1573 /* Durable handle Operations */
1574 .durable_cookie_fn = NULL,
1575 .durable_disconnect_fn = NULL,
1576 .durable_reconnect_fn = NULL,
1579 NTSTATUS vfs_glusterfs_init(void);
1580 NTSTATUS vfs_glusterfs_init(void)
1582 return smb_register_vfs(SMB_VFS_INTERFACE_VERSION,
1583 "glusterfs", &glusterfs_fns);