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 DEBUG(0, ("SMB_VFS_MKDIR should never be called in vfs_onefs"));
31 return SMB_VFS_NEXT_MKDIR(handle, path, mode);
34 static int onefs_open(vfs_handle_struct *handle, const char *fname,
35 files_struct *fsp, int flags, mode_t mode)
37 DEBUG(0, ("SMB_VFS_OPEN should never be called in vfs_onefs"));
38 return SMB_VFS_NEXT_OPEN(handle, fname, fsp, flags, mode);
41 static int onefs_statvfs(vfs_handle_struct *handle, const char *path,
42 vfs_statvfs_struct *statbuf)
44 struct statvfs statvfs_buf;
47 DEBUG(5, ("Calling SMB_STAT_VFS \n"));
48 result = statvfs(path, &statvfs_buf);
49 ZERO_STRUCTP(statbuf);
52 statbuf->OptimalTransferSize = statvfs_buf.f_iosize;
53 statbuf->BlockSize = statvfs_buf.f_bsize;
54 statbuf->TotalBlocks = statvfs_buf.f_blocks;
55 statbuf->BlocksAvail = statvfs_buf.f_bfree;
56 statbuf->UserBlocksAvail = statvfs_buf.f_bavail;
57 statbuf->TotalFileNodes = statvfs_buf.f_files;
58 statbuf->FreeFileNodes = statvfs_buf.f_ffree;
59 statbuf->FsIdentifier =
60 (((uint64_t)statvfs_buf.f_fsid.val[0]<<32) &
61 0xffffffff00000000LL) |
62 (uint64_t)statvfs_buf.f_fsid.val[1];
67 static vfs_op_tuple onefs_ops[] = {
68 {SMB_VFS_OP(onefs_mkdir), SMB_VFS_OP_MKDIR,
69 SMB_VFS_LAYER_OPAQUE},
70 {SMB_VFS_OP(onefs_open), SMB_VFS_OP_OPEN,
71 SMB_VFS_LAYER_OPAQUE},
72 {SMB_VFS_OP(onefs_create_file), SMB_VFS_OP_CREATE_FILE,
73 SMB_VFS_LAYER_OPAQUE},
74 {SMB_VFS_OP(onefs_fget_nt_acl), SMB_VFS_OP_FGET_NT_ACL,
75 SMB_VFS_LAYER_OPAQUE},
76 {SMB_VFS_OP(onefs_get_nt_acl), SMB_VFS_OP_GET_NT_ACL,
77 SMB_VFS_LAYER_OPAQUE},
78 {SMB_VFS_OP(onefs_fset_nt_acl), SMB_VFS_OP_FSET_NT_ACL,
79 SMB_VFS_LAYER_OPAQUE},
80 {SMB_VFS_OP(onefs_statvfs), SMB_VFS_OP_STATVFS,
81 SMB_VFS_LAYER_OPAQUE},
82 {SMB_VFS_OP(NULL), SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP}
85 NTSTATUS vfs_onefs_init(void)
87 return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "onefs",