Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

docs: networking: convert phonet.txt to ReST

- add SPDX header;
- adjust title markup;
- use copyright symbol;
- add notes markups;
- mark code blocks and literals as such;
- adjust identation, whitespaces and blank lines where needed;
- add to networking/index.rst.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Acked-by: Rémi Denis-Courmont <courmisch@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Mauro Carvalho Chehab and committed by
David S. Miller
6e94eaaa 4ba7bc9f

+39 -22
+1
Documentation/networking/index.rst
··· 90 90 openvswitch 91 91 operstates 92 92 packet_mmap 93 + phonet 93 94 94 95 .. only:: subproject and html 95 96
+1 -1
Documentation/networking/packet_mmap.rst
··· 1076 1076 ================== 1077 1077 1078 1078 - Packet sockets work well together with Linux socket filters, thus you also 1079 - might want to have a look at Documentation/networking/filter.txt 1079 + might want to have a look at Documentation/networking/filter.rst 1080 1080 1081 1081 THANKS 1082 1082 ======
+36 -20
Documentation/networking/phonet.txt Documentation/networking/phonet.rst
··· 1 + .. SPDX-License-Identifier: GPL-2.0 2 + .. include:: <isonum.txt> 3 + 4 + ============================ 1 5 Linux Phonet protocol family 2 6 ============================ 3 7 ··· 15 11 16 12 Phonet packets can be exchanged through various hardware connections 17 13 depending on the device, such as: 14 + 18 15 - USB with the CDC Phonet interface, 19 16 - infrared, 20 17 - Bluetooth, ··· 26 21 Packets format 27 22 -------------- 28 23 29 - Phonet packets have a common header as follows: 24 + Phonet packets have a common header as follows:: 30 25 31 26 struct phonethdr { 32 27 uint8_t pn_media; /* Media type (link-layer identifier) */ ··· 77 72 Network layer 78 73 ------------- 79 74 80 - The Phonet socket address family maps the Phonet packet header: 75 + The Phonet socket address family maps the Phonet packet header:: 81 76 82 77 struct sockaddr_pn { 83 78 sa_family_t spn_family; /* AF_PHONET */ ··· 99 94 2^10 object IDs available, and can send and receive packets with any 100 95 other peer. 101 96 97 + :: 98 + 102 99 struct sockaddr_pn addr = { .spn_family = AF_PHONET, }; 103 100 ssize_t len; 104 101 socklen_t addrlen = sizeof(addr); ··· 112 105 113 106 sendto(fd, msg, msglen, 0, (struct sockaddr *)&addr, sizeof(addr)); 114 107 len = recvfrom(fd, buf, sizeof(buf), 0, 115 - (struct sockaddr *)&addr, &addrlen); 108 + (struct sockaddr *)&addr, &addrlen); 116 109 117 110 This protocol follows the SOCK_DGRAM connection-less semantics. 118 111 However, connect() and getpeername() are not supported, as they did ··· 123 116 --------------------- 124 117 125 118 A Phonet datagram socket can be subscribed to any number of 8-bits 126 - Phonet resources, as follow: 119 + Phonet resources, as follow:: 127 120 128 121 uint32_t res = 0xXX; 129 122 ioctl(fd, SIOCPNADDRESOURCE, &res); ··· 143 136 socket paradigm. The listening socket is bound to an unique free object 144 137 ID. Each listening socket can handle up to 255 simultaneous 145 138 connections, one per accept()'d socket. 139 + 140 + :: 146 141 147 142 int lfd, cfd; 148 143 ··· 170 161 As of Linux kernel version 2.6.39, it is also possible to connect 171 162 two endpoints directly, using connect() on the active side. This is 172 163 intended to support the newer Nokia Wireless Modem API, as found in 173 - e.g. the Nokia Slim Modem in the ST-Ericsson U8500 platform: 164 + e.g. the Nokia Slim Modem in the ST-Ericsson U8500 platform:: 174 165 175 166 struct sockaddr_spn spn; 176 167 int fd; ··· 186 177 close(fd); 187 178 188 179 189 - WARNING: 190 - When polling a connected pipe socket for writability, there is an 191 - intrinsic race condition whereby writability might be lost between the 192 - polling and the writing system calls. In this case, the socket will 193 - block until write becomes possible again, unless non-blocking mode 194 - is enabled. 180 + .. Warning: 181 + 182 + When polling a connected pipe socket for writability, there is an 183 + intrinsic race condition whereby writability might be lost between the 184 + polling and the writing system calls. In this case, the socket will 185 + block until write becomes possible again, unless non-blocking mode 186 + is enabled. 195 187 196 188 197 189 The pipe protocol provides two socket options at the SOL_PNPIPE level: 198 190 199 191 PNPIPE_ENCAP accepts one integer value (int) of: 200 192 201 - PNPIPE_ENCAP_NONE: The socket operates normally (default). 193 + PNPIPE_ENCAP_NONE: 194 + The socket operates normally (default). 202 195 203 - PNPIPE_ENCAP_IP: The socket is used as a backend for a virtual IP 196 + PNPIPE_ENCAP_IP: 197 + The socket is used as a backend for a virtual IP 204 198 interface. This requires CAP_NET_ADMIN capability. GPRS data 205 199 support on Nokia modems can use this. Note that the socket cannot 206 200 be reliably poll()'d or read() from while in this mode. 207 201 208 - PNPIPE_IFINDEX is a read-only integer value. It contains the 209 - interface index of the network interface created by PNPIPE_ENCAP, 210 - or zero if encapsulation is off. 202 + PNPIPE_IFINDEX 203 + is a read-only integer value. It contains the 204 + interface index of the network interface created by PNPIPE_ENCAP, 205 + or zero if encapsulation is off. 211 206 212 - PNPIPE_HANDLE is a read-only integer value. It contains the underlying 213 - identifier ("pipe handle") of the pipe. This is only defined for 214 - socket descriptors that are already connected or being connected. 207 + PNPIPE_HANDLE 208 + is a read-only integer value. It contains the underlying 209 + identifier ("pipe handle") of the pipe. This is only defined for 210 + socket descriptors that are already connected or being connected. 215 211 216 212 217 213 Authors 218 214 ------- 219 215 220 216 Linux Phonet was initially written by Sakari Ailus. 217 + 221 218 Other contributors include Mikä Liljeberg, Andras Domokos, 222 219 Carlos Chinea and Rémi Denis-Courmont. 223 - Copyright (C) 2008 Nokia Corporation. 220 + 221 + Copyright |copy| 2008 Nokia Corporation.
+1 -1
MAINTAINERS
··· 13262 13262 PHONET PROTOCOL 13263 13263 M: Remi Denis-Courmont <courmisch@gmail.com> 13264 13264 S: Supported 13265 - F: Documentation/networking/phonet.txt 13265 + F: Documentation/networking/phonet.rst 13266 13266 F: include/linux/phonet.h 13267 13267 F: include/net/phonet/ 13268 13268 F: include/uapi/linux/phonet.h