Skip to content

Commit 6a357a1

Browse files
committed
[smart] fixup devfs porting layer of terminal
Signed-off-by: Shell <[email protected]>
1 parent 58ecde7 commit 6a357a1

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

components/lwp/lwp.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ static int lwp_startup(void)
176176
else
177177
{
178178
rt_lwp_t p = lwp_from_pid_locked(1);
179-
p->sig_protected = 0;
179+
p->sig_protected = 1;
180180

181181
error = 0;
182182
}
@@ -186,7 +186,7 @@ static int lwp_startup(void)
186186

187187
if (error)
188188
{
189-
LOG_E("%s: init program not found\n"
189+
LOG_D("%s: init program not found\n"
190190
"Switching to legacy mode...", __func__);
191191
}
192192
return error;

components/lwp/terminal/freebsd/tty_pts.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -803,13 +803,13 @@ int pts_alloc(int fflags, struct rt_thread *td, struct dfs_file *ptm_file)
803803
#else
804804
rootpath = ptyfs_get_rootpath(ptmx_device);
805805
RT_ASSERT(rootpath[strlen(rootpath) - 1] != '/');
806-
snprintf(name_buf, DIRENT_NAME_MAX, "%s/%u", rootpath, psc->pts_unit);
806+
snprintf(name_buf, DIRENT_NAME_MAX, "%s/%d", rootpath, psc->pts_unit);
807807

808808
/* setup the pts */
809809
lwp_tty_register(tp, name_buf);
810810

811811
/* now this file operating on new pty */
812-
ptm_file->vnode->data = tp;
812+
ptm_file->data = tp;
813813
#endif
814814

815815
return 0;

components/lwp/terminal/tty_ptmx.c

+10-10
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,15 @@ static int ptm_fops_close(struct dfs_file *file)
6060
lwp_tty_t tp;
6161
rt_device_t device;
6262

63-
if (file->vnode && file->vnode->data)
63+
if (file->data)
6464
{
6565
if (file->vnode->ref_count != 1)
6666
{
6767
rc = 0;
6868
}
6969
else
7070
{
71-
device = (rt_device_t)file->vnode->data;
71+
device = (rt_device_t)file->data;
7272
tp = rt_container_of(device, struct lwp_tty, parent);
7373
rc = bsd_ptsdev_methods.fo_close(tp, rt_thread_self());
7474
}
@@ -92,9 +92,9 @@ static ssize_t ptm_fops_read(struct dfs_file *file, void *buf, size_t count,
9292
struct lwp_tty *tp;
9393
int oflags = file->flags;
9494

95-
if (file->vnode && file->vnode->data)
95+
if (file->data)
9696
{
97-
device = (rt_device_t)file->vnode->data;
97+
device = (rt_device_t)file->data;
9898
tp = rt_container_of(device, struct lwp_tty, parent);
9999

100100
/* setup uio parameters */
@@ -133,9 +133,9 @@ static ssize_t ptm_fops_write(struct dfs_file *file, const void *buf,
133133
struct lwp_tty *tp;
134134
int oflags = file->flags;
135135

136-
if (file->vnode && file->vnode->data)
136+
if (file->data)
137137
{
138-
device = (rt_device_t)file->vnode->data;
138+
device = (rt_device_t)file->data;
139139
tp = rt_container_of(device, struct lwp_tty, parent);
140140

141141
/* setup uio parameters */
@@ -172,9 +172,9 @@ static int ptm_fops_ioctl(struct dfs_file *file, int cmd, void *arg)
172172
rt_device_t device;
173173
rt_ubase_t cmd_normal = (unsigned int)cmd;
174174

175-
if (file->vnode && file->vnode->data)
175+
if (file->data)
176176
{
177-
device = (rt_device_t)file->vnode->data;
177+
device = (rt_device_t)file->data;
178178
tp = rt_container_of(device, struct lwp_tty, parent);
179179

180180
switch (cmd_normal)
@@ -239,9 +239,9 @@ static int ptm_fops_poll(struct dfs_file *file, struct rt_pollreq *req)
239239
rt_device_t device;
240240
struct lwp_tty *tp;
241241

242-
if (file->vnode && file->vnode->data)
242+
if (file->data)
243243
{
244-
device = (rt_device_t)file->vnode->data;
244+
device = (rt_device_t)file->data;
245245
tp = rt_container_of(device, struct lwp_tty, parent);
246246

247247
rc = bsd_ptsdev_methods.fo_poll(tp, req, 0, rt_thread_self());

0 commit comments

Comments
 (0)