diff options
author | Rémi Denis-Courmont <remi.denis-courmont@nokia.com> | 2010-10-08 00:02:02 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-10-08 17:09:10 -0400 |
commit | 03789f26722a15ccfe6f191e9fb3d356f2f18a1e (patch) | |
tree | a55a493a1b4804d0acafad5fd1a4a3b1100f3ff4 /Documentation/networking | |
parent | 6d8e74ed377dd4cbad7ccc69300f734090e15c05 (diff) |
Phonet: cleanup pipe enable socket option
The current code works like this:
int garbage, status;
socklen_t len = sizeof(status);
/* enable pipe */
setsockopt(fd, SOL_PNPIPE, PNPIPE_ENABLE, &garbage, sizeof(garbage));
/* disable pipe */
setsockopt(fd, SOL_PNPIPE, PNPIPE_DISABLE, &garbage, sizeof(garbage));
/* get status */
getsockopt(fd, SOL_PNPIPE, PNPIPE_INQ, &status, &len);
...which does not follow the usual socket option pattern. This patch
merges all three "options" into a single gettable&settable option,
before Linux 2.6.37 gets out:
int status;
socklen_t len = sizeof(status);
/* enable pipe */
status = 1;
setsockopt(fd, SOL_PNPIPE, PNPIPE_ENABLE, &status, sizeof(status));
/* disable pipe */
status = 0;
setsockopt(fd, SOL_PNPIPE, PNPIPE_ENABLE, &status, sizeof(status));
/* get status */
getsockopt(fd, SOL_PNPIPE, PNPIPE_ENABLE, &status, &len);
This also fixes the error code from EFAULT to ENOTCONN.
Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
Cc: Kumar Sanghvi <kumar.sanghvi@stericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'Documentation/networking')
-rw-r--r-- | Documentation/networking/phonet.txt | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/Documentation/networking/phonet.txt b/Documentation/networking/phonet.txt index cccf5ff07ec2..2d9bc2b711fc 100644 --- a/Documentation/networking/phonet.txt +++ b/Documentation/networking/phonet.txt | |||
@@ -213,12 +213,9 @@ The implementation adds socket options at SOL_PNPIPE level: | |||
213 | It then updates the pipe state associated with the sequenced socket to | 213 | It then updates the pipe state associated with the sequenced socket to |
214 | be PIPE_DISABLED. | 214 | be PIPE_DISABLED. |
215 | 215 | ||
216 | PNPIPE_ENABLE | 216 | PNPIPE_ENABLE accepts one integer value (int). If set to zero, the pipe |
217 | It follows the same sequence as above for enabling a pipe by sending | 217 | is disabled. If the value is non-zero, the pipe is enabled. If the pipe |
218 | PNS_PEP_ENABLE_REQ initially and then sending PNS_PEP_ENABLED_IND after | 218 | is not (yet) connected, ENOTCONN is error is returned. |
219 | getting responses from sequenced socket and remote-pep. | ||
220 | It will also update the pipe state associated with the sequenced socket | ||
221 | to PIPE_ENABLED. | ||
222 | 219 | ||
223 | PNPIPE_DESTROY | 220 | PNPIPE_DESTROY |
224 | This will send out PNS_PEP_DISCONNECT_REQ on the sequenced socket and | 221 | This will send out PNS_PEP_DISCONNECT_REQ on the sequenced socket and |
@@ -226,12 +223,6 @@ The implementation adds socket options at SOL_PNPIPE level: | |||
226 | It will also update the pipe state associated with the sequenced socket | 223 | It will also update the pipe state associated with the sequenced socket |
227 | to PIPE_IDLE | 224 | to PIPE_IDLE |
228 | 225 | ||
229 | PNPIPE_INQ | ||
230 | This getsocktopt allows the user-space running on the sequenced socket | ||
231 | to examine the pipe state associated with that socket ie. whether the | ||
232 | pipe is created (PIPE_DISABLED) or enabled (PIPE_ENABLED) or disabled | ||
233 | (PIPE_DISABLED) or no pipe exists (PIPE_IDLE). | ||
234 | |||
235 | After a pipe has been created and enabled successfully, the Pipe data can be | 226 | After a pipe has been created and enabled successfully, the Pipe data can be |
236 | exchanged between the host-pep and remote-pep (modem). | 227 | exchanged between the host-pep and remote-pep (modem). |
237 | 228 | ||