We now keep a link to our parent seat and set it to NULL when our session
is unregistered. In this case, any further request that depends on the
session being registered and probably a valid seat pointer, we will stop
with ENODEV.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
struct uvt_ctx *uctx;
struct shl_hook *hook;
struct uvtd_session *session;
struct uvt_ctx *uctx;
struct shl_hook *hook;
struct uvtd_session *session;
+ struct uvtd_seat *seat;
bool is_legacy;
unsigned int mode;
bool is_legacy;
unsigned int mode;
switch (event) {
case UVTD_SESSION_UNREGISTER:
vt->session = NULL;
switch (event) {
case UVTD_SESSION_UNREGISTER:
vt->session = NULL;
vt_hup(vt);
break;
case UVTD_SESSION_ACTIVATE:
vt_hup(vt);
break;
case UVTD_SESSION_ACTIVATE:
memset(vt, 0, sizeof(*vt));
vt->ref = 1;
vt->uctx = uctx;
memset(vt, 0, sizeof(*vt));
vt->ref = 1;
vt->uctx = uctx;
vt->is_legacy = is_legacy;
vt->mode = KD_TEXT;
vt->kbmode = K_UNICODE;
vt->is_legacy = is_legacy;
vt->mode = KD_TEXT;
vt->kbmode = K_UNICODE;
int uvtd_vt_read(struct uvtd_vt *vt, uint8_t *mem, size_t len)
{
int uvtd_vt_read(struct uvtd_vt *vt, uint8_t *mem, size_t len)
{
+ if (!vt || !vt->seat)
+ return -ENODEV;
+
return -EAGAIN;
}
int uvtd_vt_write(struct uvtd_vt *vt, const uint8_t *mem, size_t len)
{
return -EAGAIN;
}
int uvtd_vt_write(struct uvtd_vt *vt, const uint8_t *mem, size_t len)
{
+ if (!vt || !vt->seat)
+ return -ENODEV;
+
return len;
}
unsigned int uvtd_vt_poll(struct uvtd_vt *vt)
{
return len;
}
unsigned int uvtd_vt_poll(struct uvtd_vt *vt)
{
+ if (!vt || !vt->seat)
+ return UVT_TTY_HUP | UVT_TTY_READ | UVT_TTY_WRITE;
+
static int vt_ioctl_VT_ACTIVATE(void *data, unsigned long arg)
{
static int vt_ioctl_VT_ACTIVATE(void *data, unsigned long arg)
{
+ struct uvtd_vt *vt = data;
+
+ if (!vt->seat)
+ return -ENODEV;
+
return -EINVAL;
}
static int vt_ioctl_VT_WAITACTIVE(void *data, unsigned long arg)
{
return -EINVAL;
}
static int vt_ioctl_VT_WAITACTIVE(void *data, unsigned long arg)
{
+ struct uvtd_vt *vt = data;
+
+ if (!vt->seat)
+ return -ENODEV;
+
return -EINVAL;
}
static int vt_ioctl_VT_GETSTATE(void *data, struct vt_stat *arg)
{
return -EINVAL;
}
static int vt_ioctl_VT_GETSTATE(void *data, struct vt_stat *arg)
{
+ struct uvtd_vt *vt = data;
+
+ if (!vt->seat)
+ return -ENODEV;
+
return -EINVAL;
}
static int vt_ioctl_VT_OPENQRY(void *data, unsigned int *arg)
{
return -EINVAL;
}
static int vt_ioctl_VT_OPENQRY(void *data, unsigned int *arg)
{
+ struct uvtd_vt *vt = data;
+
+ if (!vt->seat)
+ return -ENODEV;
+
static int vt_ioctl_VT_RELDISP(void *data, unsigned long arg)
{
static int vt_ioctl_VT_RELDISP(void *data, unsigned long arg)
{
+ struct uvtd_vt *vt = data;
+
+ if (!vt->seat)
+ return -ENODEV;
+