42 /*
43 * Declarations for FCN (file change notification) FEM monitors
44 */
45
46 static int smb_fem_fcn_create(femarg_t *, char *, vattr_t *, vcexcl_t, int,
47 vnode_t **, cred_t *, int, caller_context_t *, vsecattr_t *);
48 static int smb_fem_fcn_remove(femarg_t *, char *, cred_t *,
49 caller_context_t *, int);
50 static int smb_fem_fcn_rename(femarg_t *, char *, vnode_t *, char *,
51 cred_t *, caller_context_t *, int);
52 static int smb_fem_fcn_mkdir(femarg_t *, char *, vattr_t *, vnode_t **,
53 cred_t *, caller_context_t *, int, vsecattr_t *);
54 static int smb_fem_fcn_rmdir(femarg_t *, char *, vnode_t *, cred_t *,
55 caller_context_t *, int);
56 static int smb_fem_fcn_link(femarg_t *, vnode_t *, char *, cred_t *,
57 caller_context_t *, int);
58 static int smb_fem_fcn_symlink(femarg_t *, char *, vattr_t *,
59 char *, cred_t *, caller_context_t *, int);
60
61 static const fs_operation_def_t smb_fcn_tmpl[] = {
62 VOPNAME_CREATE, { .femop_create = smb_fem_fcn_create },
63 VOPNAME_REMOVE, {.femop_remove = smb_fem_fcn_remove},
64 VOPNAME_RENAME, {.femop_rename = smb_fem_fcn_rename},
65 VOPNAME_MKDIR, {.femop_mkdir = smb_fem_fcn_mkdir},
66 VOPNAME_RMDIR, {.femop_rmdir = smb_fem_fcn_rmdir},
67 VOPNAME_LINK, {.femop_link = smb_fem_fcn_link},
68 VOPNAME_SYMLINK, {.femop_symlink = smb_fem_fcn_symlink},
69 NULL, NULL
70 };
71
72 /*
73 * Declarations for oplock FEM monitors
74 */
75
76 static int smb_fem_oplock_open(femarg_t *, int, cred_t *,
77 struct caller_context *);
78 static int smb_fem_oplock_read(femarg_t *, uio_t *, int, cred_t *,
79 struct caller_context *);
80 static int smb_fem_oplock_write(femarg_t *, uio_t *, int, cred_t *,
81 struct caller_context *);
82 static int smb_fem_oplock_setattr(femarg_t *, vattr_t *, int, cred_t *,
83 caller_context_t *);
84 static int smb_fem_oplock_rwlock(femarg_t *, int, caller_context_t *);
85 static int smb_fem_oplock_space(femarg_t *, int, flock64_t *, int,
86 offset_t, cred_t *, caller_context_t *);
87 static int smb_fem_oplock_vnevent(femarg_t *, vnevent_t, vnode_t *, char *,
88 caller_context_t *);
89
90 static const fs_operation_def_t smb_oplock_tmpl[] = {
91 VOPNAME_OPEN, { .femop_open = smb_fem_oplock_open },
92 VOPNAME_READ, { .femop_read = smb_fem_oplock_read },
93 VOPNAME_WRITE, { .femop_write = smb_fem_oplock_write },
94 VOPNAME_SETATTR, { .femop_setattr = smb_fem_oplock_setattr },
95 VOPNAME_RWLOCK, { .femop_rwlock = smb_fem_oplock_rwlock },
96 VOPNAME_SPACE, { .femop_space = smb_fem_oplock_space },
97 VOPNAME_VNEVENT, { .femop_vnevent = smb_fem_oplock_vnevent },
98 NULL, NULL
99 };
100
101 static int smb_fem_oplock_break(femarg_t *, caller_context_t *, uint32_t);
102
103 /*
104 * smb_fem_init
105 *
106 * This function is not multi-thread safe. The caller must make sure only one
107 * thread makes the call.
108 */
109 int
110 smb_fem_init(void)
111 {
112 int rc = 0;
113
114 if (smb_fem_initialized)
115 return (0);
116
117 rc = fem_create("smb_fcn_ops", smb_fcn_tmpl, &smb_fcn_ops);
118 if (rc)
|
42 /*
43 * Declarations for FCN (file change notification) FEM monitors
44 */
45
46 static int smb_fem_fcn_create(femarg_t *, char *, vattr_t *, vcexcl_t, int,
47 vnode_t **, cred_t *, int, caller_context_t *, vsecattr_t *);
48 static int smb_fem_fcn_remove(femarg_t *, char *, cred_t *,
49 caller_context_t *, int);
50 static int smb_fem_fcn_rename(femarg_t *, char *, vnode_t *, char *,
51 cred_t *, caller_context_t *, int);
52 static int smb_fem_fcn_mkdir(femarg_t *, char *, vattr_t *, vnode_t **,
53 cred_t *, caller_context_t *, int, vsecattr_t *);
54 static int smb_fem_fcn_rmdir(femarg_t *, char *, vnode_t *, cred_t *,
55 caller_context_t *, int);
56 static int smb_fem_fcn_link(femarg_t *, vnode_t *, char *, cred_t *,
57 caller_context_t *, int);
58 static int smb_fem_fcn_symlink(femarg_t *, char *, vattr_t *,
59 char *, cred_t *, caller_context_t *, int);
60
61 static const fs_operation_def_t smb_fcn_tmpl[] = {
62 { VOPNAME_CREATE, { .femop_create = smb_fem_fcn_create } },
63 { VOPNAME_REMOVE, {.femop_remove = smb_fem_fcn_remove} },
64 { VOPNAME_RENAME, {.femop_rename = smb_fem_fcn_rename} },
65 { VOPNAME_MKDIR, {.femop_mkdir = smb_fem_fcn_mkdir} },
66 { VOPNAME_RMDIR, {.femop_rmdir = smb_fem_fcn_rmdir} },
67 { VOPNAME_LINK, {.femop_link = smb_fem_fcn_link} },
68 { VOPNAME_SYMLINK, {.femop_symlink = smb_fem_fcn_symlink} },
69 { NULL, {NULL} }
70 };
71
72 /*
73 * Declarations for oplock FEM monitors
74 */
75
76 static int smb_fem_oplock_open(femarg_t *, int, cred_t *,
77 struct caller_context *);
78 static int smb_fem_oplock_read(femarg_t *, uio_t *, int, cred_t *,
79 struct caller_context *);
80 static int smb_fem_oplock_write(femarg_t *, uio_t *, int, cred_t *,
81 struct caller_context *);
82 static int smb_fem_oplock_setattr(femarg_t *, vattr_t *, int, cred_t *,
83 caller_context_t *);
84 static int smb_fem_oplock_rwlock(femarg_t *, int, caller_context_t *);
85 static int smb_fem_oplock_space(femarg_t *, int, flock64_t *, int,
86 offset_t, cred_t *, caller_context_t *);
87 static int smb_fem_oplock_vnevent(femarg_t *, vnevent_t, vnode_t *, char *,
88 caller_context_t *);
89
90 static const fs_operation_def_t smb_oplock_tmpl[] = {
91 { VOPNAME_OPEN, { .femop_open = smb_fem_oplock_open } },
92 { VOPNAME_READ, { .femop_read = smb_fem_oplock_read } },
93 { VOPNAME_WRITE, { .femop_write = smb_fem_oplock_write } },
94 { VOPNAME_SETATTR, { .femop_setattr = smb_fem_oplock_setattr } },
95 { VOPNAME_RWLOCK, { .femop_rwlock = smb_fem_oplock_rwlock } },
96 { VOPNAME_SPACE, { .femop_space = smb_fem_oplock_space } },
97 { VOPNAME_VNEVENT, { .femop_vnevent = smb_fem_oplock_vnevent } },
98 { NULL, {NULL} }
99 };
100
101 static int smb_fem_oplock_break(femarg_t *, caller_context_t *, uint32_t);
102
103 /*
104 * smb_fem_init
105 *
106 * This function is not multi-thread safe. The caller must make sure only one
107 * thread makes the call.
108 */
109 int
110 smb_fem_init(void)
111 {
112 int rc = 0;
113
114 if (smb_fem_initialized)
115 return (0);
116
117 rc = fem_create("smb_fcn_ops", smb_fcn_tmpl, &smb_fcn_ops);
118 if (rc)
|