72 caller_context_t *, int, vsecattr_t *);
73 static int auto_rmdir(vnode_t *, char *, vnode_t *, cred_t *,
74 caller_context_t *, int);
75 static int auto_readdir(vnode_t *, uio_t *, cred_t *, int *,
76 caller_context_t *, int);
77 static int auto_symlink(vnode_t *, char *, vattr_t *, char *, cred_t *,
78 caller_context_t *, int);
79 static int auto_readlink(vnode_t *, struct uio *, cred_t *,
80 caller_context_t *);
81 static int auto_fsync(vnode_t *, int, cred_t *, caller_context_t *);
82 static void auto_inactive(vnode_t *, cred_t *, caller_context_t *);
83 static int auto_rwlock(vnode_t *, int, caller_context_t *);
84 static void auto_rwunlock(vnode_t *vp, int, caller_context_t *);
85 static int auto_seek(vnode_t *vp, offset_t, offset_t *, caller_context_t *);
86
87 static int auto_trigger_mount(vnode_t *, cred_t *, vnode_t **);
88
89 vnodeops_t *auto_vnodeops;
90
91 const fs_operation_def_t auto_vnodeops_template[] = {
92 VOPNAME_OPEN, { .vop_open = auto_open },
93 VOPNAME_CLOSE, { .vop_close = auto_close },
94 VOPNAME_GETATTR, { .vop_getattr = auto_getattr },
95 VOPNAME_SETATTR, { .vop_setattr = auto_setattr },
96 VOPNAME_ACCESS, { .vop_access = auto_access },
97 VOPNAME_LOOKUP, { .vop_lookup = auto_lookup },
98 VOPNAME_CREATE, { .vop_create = auto_create },
99 VOPNAME_REMOVE, { .vop_remove = auto_remove },
100 VOPNAME_LINK, { .vop_link = auto_link },
101 VOPNAME_RENAME, { .vop_rename = auto_rename },
102 VOPNAME_MKDIR, { .vop_mkdir = auto_mkdir },
103 VOPNAME_RMDIR, { .vop_rmdir = auto_rmdir },
104 VOPNAME_READDIR, { .vop_readdir = auto_readdir },
105 VOPNAME_SYMLINK, { .vop_symlink = auto_symlink },
106 VOPNAME_READLINK, { .vop_readlink = auto_readlink },
107 VOPNAME_FSYNC, { .vop_fsync = auto_fsync },
108 VOPNAME_INACTIVE, { .vop_inactive = auto_inactive },
109 VOPNAME_RWLOCK, { .vop_rwlock = auto_rwlock },
110 VOPNAME_RWUNLOCK, { .vop_rwunlock = auto_rwunlock },
111 VOPNAME_SEEK, { .vop_seek = auto_seek },
112 VOPNAME_FRLOCK, { .error = fs_error },
113 VOPNAME_DISPOSE, { .error = fs_error },
114 VOPNAME_SHRLOCK, { .error = fs_error },
115 VOPNAME_VNEVENT, { .vop_vnevent = fs_vnevent_support },
116 NULL, NULL
117 };
118
119
120
121 /* ARGSUSED */
122 static int
123 auto_open(vnode_t **vpp, int flag, cred_t *cred, caller_context_t *ct)
124 {
125 vnode_t *newvp;
126 int error;
127
128 AUTOFS_DPRINT((4, "auto_open: *vpp=%p\n", (void *)*vpp));
129
130 error = auto_trigger_mount(*vpp, cred, &newvp);
131 if (error)
132 goto done;
133
134 if (newvp != NULL) {
135 /*
136 * Node is now mounted on.
|
72 caller_context_t *, int, vsecattr_t *);
73 static int auto_rmdir(vnode_t *, char *, vnode_t *, cred_t *,
74 caller_context_t *, int);
75 static int auto_readdir(vnode_t *, uio_t *, cred_t *, int *,
76 caller_context_t *, int);
77 static int auto_symlink(vnode_t *, char *, vattr_t *, char *, cred_t *,
78 caller_context_t *, int);
79 static int auto_readlink(vnode_t *, struct uio *, cred_t *,
80 caller_context_t *);
81 static int auto_fsync(vnode_t *, int, cred_t *, caller_context_t *);
82 static void auto_inactive(vnode_t *, cred_t *, caller_context_t *);
83 static int auto_rwlock(vnode_t *, int, caller_context_t *);
84 static void auto_rwunlock(vnode_t *vp, int, caller_context_t *);
85 static int auto_seek(vnode_t *vp, offset_t, offset_t *, caller_context_t *);
86
87 static int auto_trigger_mount(vnode_t *, cred_t *, vnode_t **);
88
89 vnodeops_t *auto_vnodeops;
90
91 const fs_operation_def_t auto_vnodeops_template[] = {
92 { VOPNAME_OPEN, { .vop_open = auto_open } },
93 { VOPNAME_CLOSE, { .vop_close = auto_close } },
94 { VOPNAME_GETATTR, { .vop_getattr = auto_getattr } },
95 { VOPNAME_SETATTR, { .vop_setattr = auto_setattr } },
96 { VOPNAME_ACCESS, { .vop_access = auto_access } },
97 { VOPNAME_LOOKUP, { .vop_lookup = auto_lookup } },
98 { VOPNAME_CREATE, { .vop_create = auto_create } },
99 { VOPNAME_REMOVE, { .vop_remove = auto_remove } },
100 { VOPNAME_LINK, { .vop_link = auto_link } },
101 { VOPNAME_RENAME, { .vop_rename = auto_rename } },
102 { VOPNAME_MKDIR, { .vop_mkdir = auto_mkdir } },
103 { VOPNAME_RMDIR, { .vop_rmdir = auto_rmdir } },
104 { VOPNAME_READDIR, { .vop_readdir = auto_readdir } },
105 { VOPNAME_SYMLINK, { .vop_symlink = auto_symlink } },
106 { VOPNAME_READLINK, { .vop_readlink = auto_readlink } },
107 { VOPNAME_FSYNC, { .vop_fsync = auto_fsync } },
108 { VOPNAME_INACTIVE, { .vop_inactive = auto_inactive } },
109 { VOPNAME_RWLOCK, { .vop_rwlock = auto_rwlock } },
110 { VOPNAME_RWUNLOCK, { .vop_rwunlock = auto_rwunlock } },
111 { VOPNAME_SEEK, { .vop_seek = auto_seek } },
112 { VOPNAME_FRLOCK, { .error = fs_error } },
113 { VOPNAME_DISPOSE, { .error = fs_error } },
114 { VOPNAME_SHRLOCK, { .error = fs_error } },
115 { VOPNAME_VNEVENT, { .vop_vnevent = fs_vnevent_support } },
116 { NULL, { NULL } }
117 };
118
119
120
121 /* ARGSUSED */
122 static int
123 auto_open(vnode_t **vpp, int flag, cred_t *cred, caller_context_t *ct)
124 {
125 vnode_t *newvp;
126 int error;
127
128 AUTOFS_DPRINT((4, "auto_open: *vpp=%p\n", (void *)*vpp));
129
130 error = auto_trigger_mount(*vpp, cred, &newvp);
131 if (error)
132 goto done;
133
134 if (newvp != NULL) {
135 /*
136 * Node is now mounted on.
|