70 static int socket_vop_setattr(struct vnode *, struct vattr *, int,
71 struct cred *, caller_context_t *);
72 static int socket_vop_access(struct vnode *, int, int, struct cred *,
73 caller_context_t *);
74 static int socket_vop_fsync(struct vnode *, int, struct cred *,
75 caller_context_t *);
76 static void socket_vop_inactive(struct vnode *, struct cred *,
77 caller_context_t *);
78 static int socket_vop_fid(struct vnode *, struct fid *,
79 caller_context_t *);
80 static int socket_vop_seek(struct vnode *, offset_t, offset_t *,
81 caller_context_t *);
82 static int socket_vop_poll(struct vnode *, short, int, short *,
83 struct pollhead **, caller_context_t *);
84
85 extern int socket_close_internal(struct sonode *, int, cred_t *);
86 extern void socket_destroy_internal(struct sonode *, cred_t *);
87
88 struct vnodeops *socket_vnodeops;
89 const fs_operation_def_t socket_vnodeops_template[] = {
90 VOPNAME_OPEN, { .vop_open = socket_vop_open },
91 VOPNAME_CLOSE, { .vop_close = socket_vop_close },
92 VOPNAME_READ, { .vop_read = socket_vop_read },
93 VOPNAME_WRITE, { .vop_write = socket_vop_write },
94 VOPNAME_IOCTL, { .vop_ioctl = socket_vop_ioctl },
95 VOPNAME_SETFL, { .vop_setfl = socket_vop_setfl },
96 VOPNAME_GETATTR, { .vop_getattr = socket_vop_getattr },
97 VOPNAME_SETATTR, { .vop_setattr = socket_vop_setattr },
98 VOPNAME_ACCESS, { .vop_access = socket_vop_access },
99 VOPNAME_FSYNC, { .vop_fsync = socket_vop_fsync },
100 VOPNAME_INACTIVE, { .vop_inactive = socket_vop_inactive },
101 VOPNAME_FID, { .vop_fid = socket_vop_fid },
102 VOPNAME_SEEK, { .vop_seek = socket_vop_seek },
103 VOPNAME_POLL, { .vop_poll = socket_vop_poll },
104 VOPNAME_DISPOSE, { .error = fs_error },
105 NULL, NULL
106 };
107
108
109 /*
110 * generic vnode ops
111 */
112
113 /*ARGSUSED*/
114 static int
115 socket_vop_open(struct vnode **vpp, int flag, struct cred *cr,
116 caller_context_t *ct)
117 {
118 struct vnode *vp = *vpp;
119 struct sonode *so = VTOSO(vp);
120
121 flag &= ~FCREAT; /* paranoia */
122 mutex_enter(&so->so_lock);
123 so->so_count++;
124 mutex_exit(&so->so_lock);
125
|
70 static int socket_vop_setattr(struct vnode *, struct vattr *, int,
71 struct cred *, caller_context_t *);
72 static int socket_vop_access(struct vnode *, int, int, struct cred *,
73 caller_context_t *);
74 static int socket_vop_fsync(struct vnode *, int, struct cred *,
75 caller_context_t *);
76 static void socket_vop_inactive(struct vnode *, struct cred *,
77 caller_context_t *);
78 static int socket_vop_fid(struct vnode *, struct fid *,
79 caller_context_t *);
80 static int socket_vop_seek(struct vnode *, offset_t, offset_t *,
81 caller_context_t *);
82 static int socket_vop_poll(struct vnode *, short, int, short *,
83 struct pollhead **, caller_context_t *);
84
85 extern int socket_close_internal(struct sonode *, int, cred_t *);
86 extern void socket_destroy_internal(struct sonode *, cred_t *);
87
88 struct vnodeops *socket_vnodeops;
89 const fs_operation_def_t socket_vnodeops_template[] = {
90 { VOPNAME_OPEN, { .vop_open = socket_vop_open } },
91 { VOPNAME_CLOSE, { .vop_close = socket_vop_close } },
92 { VOPNAME_READ, { .vop_read = socket_vop_read } },
93 { VOPNAME_WRITE, { .vop_write = socket_vop_write } },
94 { VOPNAME_IOCTL, { .vop_ioctl = socket_vop_ioctl } },
95 { VOPNAME_SETFL, { .vop_setfl = socket_vop_setfl } },
96 { VOPNAME_GETATTR, { .vop_getattr = socket_vop_getattr } },
97 { VOPNAME_SETATTR, { .vop_setattr = socket_vop_setattr } },
98 { VOPNAME_ACCESS, { .vop_access = socket_vop_access } },
99 { VOPNAME_FSYNC, { .vop_fsync = socket_vop_fsync } },
100 { VOPNAME_INACTIVE, { .vop_inactive = socket_vop_inactive } },
101 { VOPNAME_FID, { .vop_fid = socket_vop_fid } },
102 { VOPNAME_SEEK, { .vop_seek = socket_vop_seek } },
103 { VOPNAME_POLL, { .vop_poll = socket_vop_poll } },
104 { VOPNAME_DISPOSE, { .error = fs_error } },
105 { NULL, { NULL } }
106 };
107
108
109 /*
110 * generic vnode ops
111 */
112
113 /*ARGSUSED*/
114 static int
115 socket_vop_open(struct vnode **vpp, int flag, struct cred *cr,
116 caller_context_t *ct)
117 {
118 struct vnode *vp = *vpp;
119 struct sonode *so = VTOSO(vp);
120
121 flag &= ~FCREAT; /* paranoia */
122 mutex_enter(&so->so_lock);
123 so->so_count++;
124 mutex_exit(&so->so_lock);
125
|