Skip to content

[smart] fixup devfs porting layer of terminal #8797

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions components/lwp/lwp.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ static int lwp_startup(void)
else
{
rt_lwp_t p = lwp_from_pid_locked(1);
p->sig_protected = 0;
p->sig_protected = 1;

error = 0;
}
Expand All @@ -186,7 +186,7 @@ static int lwp_startup(void)

if (error)
{
LOG_E("%s: init program not found\n"
LOG_D("%s: init program not found\n"
"Switching to legacy mode...", __func__);
}
return error;
Expand Down
4 changes: 2 additions & 2 deletions components/lwp/terminal/freebsd/tty_pts.c
Original file line number Diff line number Diff line change
Expand Up @@ -803,13 +803,13 @@ int pts_alloc(int fflags, struct rt_thread *td, struct dfs_file *ptm_file)
#else
rootpath = ptyfs_get_rootpath(ptmx_device);
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 */
lwp_tty_register(tp, name_buf);

/* now this file operating on new pty */
ptm_file->vnode->data = tp;
ptm_file->data = tp;
#endif

return 0;
Expand Down
20 changes: 10 additions & 10 deletions components/lwp/terminal/tty_ptmx.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ static int ptm_fops_close(struct dfs_file *file)
lwp_tty_t tp;
rt_device_t device;

if (file->vnode && file->vnode->data)
if (file->data)
{
if (file->vnode->ref_count != 1)
{
rc = 0;
}
else
{
device = (rt_device_t)file->vnode->data;
device = (rt_device_t)file->data;
tp = rt_container_of(device, struct lwp_tty, parent);
rc = bsd_ptsdev_methods.fo_close(tp, rt_thread_self());
}
Expand All @@ -92,9 +92,9 @@ static ssize_t ptm_fops_read(struct dfs_file *file, void *buf, size_t count,
struct lwp_tty *tp;
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);

/* setup uio parameters */
Expand Down Expand Up @@ -133,9 +133,9 @@ static ssize_t ptm_fops_write(struct dfs_file *file, const void *buf,
struct lwp_tty *tp;
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);

/* setup uio parameters */
Expand Down Expand Up @@ -172,9 +172,9 @@ static int ptm_fops_ioctl(struct dfs_file *file, int cmd, void *arg)
rt_device_t device;
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);

switch (cmd_normal)
Expand Down Expand Up @@ -239,9 +239,9 @@ static int ptm_fops_poll(struct dfs_file *file, struct rt_pollreq *req)
rt_device_t device;
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);

rc = bsd_ptsdev_methods.fo_poll(tp, req, 0, rt_thread_self());
Expand Down
Loading