2 Unix SMB/CIFS implementation.
3 Make sure offline->online changes are propagated by notifies
5 This module must come before aio_fork in the chain, because
6 aio_fork (correcly!) does not propagate the aio calls further
8 Copyright (C) Volker Lendecke 2011
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 3 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program. If not, see <http://www.gnu.org/licenses/>.
25 #include "smbd/smbd.h"
26 #include "librpc/gen_ndr/ndr_xattr.h"
27 #include "include/smbprofile.h"
30 #define DBGC_CLASS DBGC_VFS
33 #include "nfs4_acls.h"
36 static ssize_t
vfs_gpfs_hsm_notify_pread(vfs_handle_struct
*handle
, files_struct
*fsp
,
37 void *data
, size_t n
, off_t offset
)
41 ret
= SMB_VFS_NEXT_PREAD(handle
, fsp
, data
, n
, offset
);
43 DEBUG(10, ("vfs_private = %x\n",
44 (unsigned int)fsp
->fsp_name
->st
.vfs_private
));
47 ((fsp
->fsp_name
->st
.vfs_private
& GPFS_WINATTR_OFFLINE
) != 0)) {
48 fsp
->fsp_name
->st
.vfs_private
&= ~GPFS_WINATTR_OFFLINE
;
49 notify_fname(handle
->conn
, NOTIFY_ACTION_MODIFIED
,
50 FILE_NOTIFY_CHANGE_ATTRIBUTES
,
51 fsp
->fsp_name
->base_name
);
57 static ssize_t
vfs_gpfs_hsm_notify_pwrite(struct vfs_handle_struct
*handle
,
58 struct files_struct
*fsp
,
59 const void *data
, size_t n
, off_t offset
)
63 ret
= SMB_VFS_NEXT_PWRITE(handle
, fsp
, data
, n
, offset
);
66 ((fsp
->fsp_name
->st
.vfs_private
& GPFS_WINATTR_OFFLINE
) != 0)) {
67 fsp
->fsp_name
->st
.vfs_private
&= ~GPFS_WINATTR_OFFLINE
;
68 notify_fname(handle
->conn
, NOTIFY_ACTION_MODIFIED
,
69 FILE_NOTIFY_CHANGE_ATTRIBUTES
,
70 fsp
->fsp_name
->base_name
);
76 static ssize_t
vfs_gpfs_hsm_notify_aio_return(struct vfs_handle_struct
*handle
,
77 struct files_struct
*fsp
,
78 SMB_STRUCT_AIOCB
*aiocb
)
82 ret
= SMB_VFS_NEXT_AIO_RETURN(handle
, fsp
, aiocb
);
84 DEBUG(10, ("vfs_gpfs_hsm_notify_aio_return: vfs_private = %x\n",
85 (unsigned int)fsp
->fsp_name
->st
.vfs_private
));
88 ((fsp
->fsp_name
->st
.vfs_private
& GPFS_WINATTR_OFFLINE
) != 0)) {
89 fsp
->fsp_name
->st
.vfs_private
&= ~GPFS_WINATTR_OFFLINE
;
90 DEBUG(10, ("sending notify\n"));
91 notify_fname(handle
->conn
, NOTIFY_ACTION_MODIFIED
,
92 FILE_NOTIFY_CHANGE_ATTRIBUTES
,
93 fsp
->fsp_name
->base_name
);
99 static struct vfs_fn_pointers vfs_gpfs_hsm_notify_fns
= {
100 .pread_fn
= vfs_gpfs_hsm_notify_pread
,
101 .pwrite_fn
= vfs_gpfs_hsm_notify_pwrite
,
102 .aio_return_fn
= vfs_gpfs_hsm_notify_aio_return
105 NTSTATUS
vfs_gpfs_hsm_notify_init(void);
106 NTSTATUS
vfs_gpfs_hsm_notify_init(void)
108 return smb_register_vfs(SMB_VFS_INTERFACE_VERSION
, "gpfs_hsm_notify",
109 &vfs_gpfs_hsm_notify_fns
);