mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-19 11:41:26 +00:00
isert: Make the login character device more posix compliant (merge r5999 from iser)
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/3.0.x-iser@6009 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -556,6 +556,9 @@ static ssize_t isert_read(struct file *filp, char __user *buf, size_t count,
|
||||
struct isert_conn_dev *dev = filp->private_data;
|
||||
size_t to_read;
|
||||
|
||||
if (dev->state == CS_DISCONNECTED)
|
||||
return -EPIPE;
|
||||
|
||||
if (will_read_block(dev)) {
|
||||
int ret;
|
||||
if (filp->f_flags & O_NONBLOCK)
|
||||
@@ -566,9 +569,6 @@ static ssize_t isert_read(struct file *filp, char __user *buf, size_t count,
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (dev->state == CS_DISCONNECTED)
|
||||
return -EPIPE;
|
||||
|
||||
to_read = min(count, dev->read_len);
|
||||
if (copy_to_user(buf, dev->read_buf, to_read))
|
||||
return -EFAULT;
|
||||
@@ -766,11 +766,13 @@ static unsigned int isert_poll(struct file *filp,
|
||||
poll_wait(filp, &dev->waitqueue, wait);
|
||||
|
||||
if (!dev->conn)
|
||||
mask |= POLLHUP | POLLERR;
|
||||
if (!will_read_block(dev))
|
||||
mask |= POLLIN | POLLRDNORM;
|
||||
mask |= POLLHUP | POLLIN;
|
||||
else {
|
||||
if (!will_read_block(dev))
|
||||
mask |= POLLIN | POLLRDNORM;
|
||||
|
||||
mask |= POLLOUT | POLLWRNORM;
|
||||
mask |= POLLOUT | POLLWRNORM;
|
||||
}
|
||||
|
||||
return mask;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user