2 * Unix SMB/CIFS implementation.
5 * Copyright (C) Tim Prouty, 2008
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, see <http://www.gnu.org/licenses/>.
25 #define DBGC_CLASS DBGC_VFS
27 static int onefs_mkdir(vfs_handle_struct *handle, const char *path,
30 /* SMB_VFS_MKDIR should never be called in vfs_onefs */
32 return SMB_VFS_NEXT_MKDIR(handle, path, mode);
35 static int onefs_open(vfs_handle_struct *handle, const char *fname,
36 files_struct *fsp, int flags, mode_t mode)
38 /* SMB_VFS_OPEN should never be called in vfs_onefs */
40 return SMB_VFS_NEXT_OPEN(handle, fname, fsp, flags, mode);
43 static int onefs_statvfs(vfs_handle_struct *handle, const char *path,
44 vfs_statvfs_struct *statbuf)
46 struct statvfs statvfs_buf;
49 DEBUG(5, ("Calling SMB_STAT_VFS \n"));
50 result = statvfs(path, &statvfs_buf);
51 ZERO_STRUCTP(statbuf);
54 statbuf->OptimalTransferSize = statvfs_buf.f_iosize;
55 statbuf->BlockSize = statvfs_buf.f_bsize;
56 statbuf->TotalBlocks = statvfs_buf.f_blocks;
57 statbuf->BlocksAvail = statvfs_buf.f_bfree;
58 statbuf->UserBlocksAvail = statvfs_buf.f_bavail;
59 statbuf->TotalFileNodes = statvfs_buf.f_files;
60 statbuf->FreeFileNodes = statvfs_buf.f_ffree;
61 statbuf->FsIdentifier =
62 (((uint64_t)statvfs_buf.f_fsid.val[0]<<32) &
63 0xffffffff00000000LL) |
64 (uint64_t)statvfs_buf.f_fsid.val[1];
69 static uint32_t onefs_fs_capabilities(struct vfs_handle_struct *handle)
71 return SMB_VFS_NEXT_FS_CAPABILITIES(handle) | FILE_NAMED_STREAMS;
74 static vfs_op_tuple onefs_ops[] = {
75 {SMB_VFS_OP(onefs_fs_capabilities), SMB_VFS_OP_FS_CAPABILITIES,
76 SMB_VFS_LAYER_TRANSPARENT},
77 {SMB_VFS_OP(onefs_mkdir), SMB_VFS_OP_MKDIR,
78 SMB_VFS_LAYER_OPAQUE},
79 {SMB_VFS_OP(onefs_open), SMB_VFS_OP_OPEN,
80 SMB_VFS_LAYER_OPAQUE},
81 {SMB_VFS_OP(onefs_create_file), SMB_VFS_OP_CREATE_FILE,
82 SMB_VFS_LAYER_OPAQUE},
83 {SMB_VFS_OP(onefs_close), SMB_VFS_OP_CLOSE,
84 SMB_VFS_LAYER_TRANSPARENT},
85 {SMB_VFS_OP(onefs_rename), SMB_VFS_OP_RENAME,
86 SMB_VFS_LAYER_TRANSPARENT},
87 {SMB_VFS_OP(onefs_stat), SMB_VFS_OP_STAT,
88 SMB_VFS_LAYER_TRANSPARENT},
89 {SMB_VFS_OP(onefs_fstat), SMB_VFS_OP_FSTAT,
90 SMB_VFS_LAYER_TRANSPARENT},
91 {SMB_VFS_OP(onefs_lstat), SMB_VFS_OP_LSTAT,
92 SMB_VFS_LAYER_TRANSPARENT},
93 {SMB_VFS_OP(onefs_unlink), SMB_VFS_OP_UNLINK,
94 SMB_VFS_LAYER_TRANSPARENT},
95 {SMB_VFS_OP(onefs_chflags), SMB_VFS_OP_CHFLAGS,
96 SMB_VFS_LAYER_TRANSPARENT},
97 {SMB_VFS_OP(onefs_streaminfo), SMB_VFS_OP_STREAMINFO,
98 SMB_VFS_LAYER_OPAQUE},
99 {SMB_VFS_OP(onefs_fget_nt_acl), SMB_VFS_OP_FGET_NT_ACL,
100 SMB_VFS_LAYER_OPAQUE},
101 {SMB_VFS_OP(onefs_get_nt_acl), SMB_VFS_OP_GET_NT_ACL,
102 SMB_VFS_LAYER_OPAQUE},
103 {SMB_VFS_OP(onefs_fset_nt_acl), SMB_VFS_OP_FSET_NT_ACL,
104 SMB_VFS_LAYER_OPAQUE},
105 {SMB_VFS_OP(onefs_statvfs), SMB_VFS_OP_STATVFS,
106 SMB_VFS_LAYER_OPAQUE},
107 {SMB_VFS_OP(NULL), SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP}
110 NTSTATUS vfs_onefs_init(void)
112 return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "onefs",