[smart] fixup devfs porting layer of terminal (#8797)

Signed-off-by: Shell <smokewood@qq.com>
This commit is contained in:
Shell 2024-04-15 18:24:19 +08:00 committed by Rbb666
parent 82d41d192d
commit fe255a8391
3 changed files with 14 additions and 14 deletions

View File

@ -176,7 +176,7 @@ static int lwp_startup(void)
else else
{ {
rt_lwp_t p = lwp_from_pid_locked(1); rt_lwp_t p = lwp_from_pid_locked(1);
p->sig_protected = 0; p->sig_protected = 1;
error = 0; error = 0;
} }
@ -186,7 +186,7 @@ static int lwp_startup(void)
if (error) if (error)
{ {
LOG_E("%s: init program not found\n" LOG_D("%s: init program not found\n"
"Switching to legacy mode...", __func__); "Switching to legacy mode...", __func__);
} }
return error; return error;

View File

@ -803,13 +803,13 @@ int pts_alloc(int fflags, struct rt_thread *td, struct dfs_file *ptm_file)
#else #else
rootpath = ptyfs_get_rootpath(ptmx_device); rootpath = ptyfs_get_rootpath(ptmx_device);
RT_ASSERT(rootpath[strlen(rootpath) - 1] != '/'); RT_ASSERT(rootpath[strlen(rootpath) - 1] != '/');
snprintf(name_buf, DIRENT_NAME_MAX, "%s/%u", rootpath, psc->pts_unit); snprintf(name_buf, DIRENT_NAME_MAX, "%s/%d", rootpath, psc->pts_unit);
/* setup the pts */ /* setup the pts */
lwp_tty_register(tp, name_buf); lwp_tty_register(tp, name_buf);
/* now this file operating on new pty */ /* now this file operating on new pty */
ptm_file->vnode->data = tp; ptm_file->data = tp;
#endif #endif
return 0; return 0;

View File

@ -60,7 +60,7 @@ static int ptm_fops_close(struct dfs_file *file)
lwp_tty_t tp; lwp_tty_t tp;
rt_device_t device; rt_device_t device;
if (file->vnode && file->vnode->data) if (file->data)
{ {
if (file->vnode->ref_count != 1) if (file->vnode->ref_count != 1)
{ {
@ -68,7 +68,7 @@ static int ptm_fops_close(struct dfs_file *file)
} }
else else
{ {
device = (rt_device_t)file->vnode->data; device = (rt_device_t)file->data;
tp = rt_container_of(device, struct lwp_tty, parent); tp = rt_container_of(device, struct lwp_tty, parent);
rc = bsd_ptsdev_methods.fo_close(tp, rt_thread_self()); rc = bsd_ptsdev_methods.fo_close(tp, rt_thread_self());
} }
@ -92,9 +92,9 @@ static ssize_t ptm_fops_read(struct dfs_file *file, void *buf, size_t count,
struct lwp_tty *tp; struct lwp_tty *tp;
int oflags = file->flags; int oflags = file->flags;
if (file->vnode && file->vnode->data) if (file->data)
{ {
device = (rt_device_t)file->vnode->data; device = (rt_device_t)file->data;
tp = rt_container_of(device, struct lwp_tty, parent); tp = rt_container_of(device, struct lwp_tty, parent);
/* setup uio parameters */ /* setup uio parameters */
@ -133,9 +133,9 @@ static ssize_t ptm_fops_write(struct dfs_file *file, const void *buf,
struct lwp_tty *tp; struct lwp_tty *tp;
int oflags = file->flags; int oflags = file->flags;
if (file->vnode && file->vnode->data) if (file->data)
{ {
device = (rt_device_t)file->vnode->data; device = (rt_device_t)file->data;
tp = rt_container_of(device, struct lwp_tty, parent); tp = rt_container_of(device, struct lwp_tty, parent);
/* setup uio parameters */ /* setup uio parameters */
@ -172,9 +172,9 @@ static int ptm_fops_ioctl(struct dfs_file *file, int cmd, void *arg)
rt_device_t device; rt_device_t device;
rt_ubase_t cmd_normal = (unsigned int)cmd; rt_ubase_t cmd_normal = (unsigned int)cmd;
if (file->vnode && file->vnode->data) if (file->data)
{ {
device = (rt_device_t)file->vnode->data; device = (rt_device_t)file->data;
tp = rt_container_of(device, struct lwp_tty, parent); tp = rt_container_of(device, struct lwp_tty, parent);
switch (cmd_normal) switch (cmd_normal)
@ -239,9 +239,9 @@ static int ptm_fops_poll(struct dfs_file *file, struct rt_pollreq *req)
rt_device_t device; rt_device_t device;
struct lwp_tty *tp; struct lwp_tty *tp;
if (file->vnode && file->vnode->data) if (file->data)
{ {
device = (rt_device_t)file->vnode->data; device = (rt_device_t)file->data;
tp = rt_container_of(device, struct lwp_tty, parent); tp = rt_container_of(device, struct lwp_tty, parent);
rc = bsd_ptsdev_methods.fo_poll(tp, req, 0, rt_thread_self()); rc = bsd_ptsdev_methods.fo_poll(tp, req, 0, rt_thread_self());