linux/net/phonet
Rémi Denis-Courmont 03789f2672 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>
2010-10-08 14:09:10 -07:00
..
Kconfig Phonet: advise against enabling the pipe controller 2010-10-08 14:09:09 -07:00
Makefile Phonet: implement GPRS virtual interface over PEP socket 2008-10-05 11:16:16 -07:00
af_phonet.c Phonet: look up the resource routing table when forwarding 2010-09-15 21:31:33 -07:00
datagram.c Phonet: hook resource routing to userspace via ioctl()'s 2010-09-15 21:31:32 -07:00
pep-gprs.c Phonet: zero-copy aligned GPRS RX 2010-01-07 00:24:54 -08:00
pep.c Phonet: cleanup pipe enable socket option 2010-10-08 14:09:10 -07:00
pn_dev.c Phonet: list subscribed resources via proc_fs 2010-09-15 21:31:33 -07:00
pn_netlink.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
socket.c phonet: Fix build warning. 2010-09-15 21:34:41 -07:00
sysctl.c sysctl net: Remove unused binary sysctl code 2009-11-12 02:05:06 -08:00