提交 a657c00e 编写于 作者: mysterywolf's avatar mysterywolf

update pipe.c

上级 a9407281
...@@ -41,16 +41,16 @@ static int pipe_fops_open(struct dfs_fd *fd) ...@@ -41,16 +41,16 @@ static int pipe_fops_open(struct dfs_fd *fd)
switch (fd->flags & O_ACCMODE) switch (fd->flags & O_ACCMODE)
{ {
case O_RDONLY: case O_RDONLY:
pipe->readers ++; pipe->readers ++;
break; break;
case O_WRONLY: case O_WRONLY:
pipe->writers ++; pipe->writers ++;
break; break;
case O_RDWR: case O_RDWR:
pipe->readers ++; pipe->readers ++;
pipe->writers ++; pipe->writers ++;
break; break;
} }
device->ref_count ++; device->ref_count ++;
...@@ -73,16 +73,16 @@ static int pipe_fops_close(struct dfs_fd *fd) ...@@ -73,16 +73,16 @@ static int pipe_fops_close(struct dfs_fd *fd)
switch (fd->flags & O_ACCMODE) switch (fd->flags & O_ACCMODE)
{ {
case O_RDONLY: case O_RDONLY:
pipe->readers --; pipe->readers --;
break; break;
case O_WRONLY: case O_WRONLY:
pipe->writers --; pipe->writers --;
break; break;
case O_RDWR: case O_RDWR:
pipe->readers --; pipe->readers --;
pipe->writers --; pipe->writers --;
break; break;
} }
if (pipe->writers == 0) if (pipe->writers == 0)
...@@ -123,15 +123,15 @@ static int pipe_fops_ioctl(struct dfs_fd *fd, int cmd, void *args) ...@@ -123,15 +123,15 @@ static int pipe_fops_ioctl(struct dfs_fd *fd, int cmd, void *args)
switch (cmd) switch (cmd)
{ {
case FIONREAD: case FIONREAD:
*((int*)args) = rt_ringbuffer_data_len(pipe->fifo); *((int*)args) = rt_ringbuffer_data_len(pipe->fifo);
break; break;
case FIONWRITE: case FIONWRITE:
*((int*)args) = rt_ringbuffer_space_len(pipe->fifo); *((int*)args) = rt_ringbuffer_space_len(pipe->fifo);
break; break;
default: default:
ret = -EINVAL; ret = -EINVAL;
break; break;
} }
return ret; return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册