Skip to content

Commit b83430a

Browse files
committed
gnrc_pktbuf: remove gnrc_pktbuf_duplicate_upto
The removal of this function was already announced for the 2019.04 release. So it is safe to remove it.
1 parent e8650f5 commit b83430a

File tree

3 files changed

+0
-156
lines changed

3 files changed

+0
-156
lines changed

sys/include/net/gnrc/pktbuf.h

-55
Original file line numberDiff line numberDiff line change
@@ -229,61 +229,6 @@ gnrc_pktsnip_t *gnrc_pktbuf_replace_snip(gnrc_pktsnip_t *pkt, gnrc_pktsnip_t *ol
229229
*/
230230
gnrc_pktsnip_t *gnrc_pktbuf_reverse_snips(gnrc_pktsnip_t *pkt);
231231

232-
/**
233-
* @brief Duplicates pktsnip chain upto (including) a snip with the given type
234-
* as a continuous snip.
235-
*
236-
* Example:
237-
* Input:
238-
* buffer
239-
* +---------------------------+ +------+
240-
* | size = 8 | data +-------->| |
241-
* | type = NETTYPE_IPV6_EXT |------------+ +------+
242-
* +---------------------------+ . .
243-
* | next . .
244-
* v . .
245-
* +---------------------------+ +------+
246-
* | size = 40 | data +----------->| |
247-
* | type = NETTYPE_IPV6 |---------+ +------+
248-
* +---------------------------+ . .
249-
* | next . .
250-
* v
251-
* +---------------------------+ +------+
252-
* | size = 14 | data +-------------->| |
253-
* | type = NETTYPE_NETIF |------+ +------+
254-
* +---------------------------+ . .
255-
*
256-
*
257-
* Output:
258-
* buffer
259-
* +---------------------------+ +------+
260-
* | size = 48 | data +-------->| |
261-
* | type = NETTYPE_IPV6 |------------+ | |
262-
* +---------------------------+ | |
263-
* | +------+
264-
* | . .
265-
* | next . .
266-
* v
267-
* +---------------------------+ +------+
268-
* | size = 14 | data +-------------->| |
269-
* | type = NETTYPE_NETIF |------+ +------+
270-
* +---------------------------+ . .
271-
*
272-
* The original snip is keeped as is except `users` decremented.
273-
*
274-
* @deprecated This function breaks the abstraction of `gnrc_pktbuf` and its
275-
* only user within the RIOT code base `gnrc_ipv6_ext` was reworked
276-
* so it isn't needed anymore.
277-
* It will be removed after the 2019.04 release.
278-
*
279-
* @param[in,out] pkt The snip to duplicate.
280-
* @param[in] type The type of snip to stop duplication.
281-
*
282-
* @return The duplicated snip, if succeeded.
283-
* @return NULL, if no space is left in the packet buffer.
284-
*/
285-
gnrc_pktsnip_t *gnrc_pktbuf_duplicate_upto(gnrc_pktsnip_t *pkt, gnrc_nettype_t type);
286-
287232
/**
288233
* @brief Merge pktsnip chain to single pktsnip.
289234
*

sys/net/gnrc/pktbuf_malloc/gnrc_pktbuf_malloc.c

-50
Original file line numberDiff line numberDiff line change
@@ -295,54 +295,4 @@ static gnrc_pktsnip_t *_create_snip(gnrc_pktsnip_t *next, const void *data, size
295295
return pkt;
296296
}
297297

298-
gnrc_pktsnip_t *gnrc_pktbuf_duplicate_upto(gnrc_pktsnip_t *pkt, gnrc_nettype_t type)
299-
{
300-
mutex_lock(&_mutex);
301-
302-
bool is_shared = pkt->users > 1;
303-
size_t size = gnrc_pkt_len_upto(pkt, type);
304-
305-
DEBUG("ipv6_ext: duplicating %d octets\n", (int) size);
306-
307-
gnrc_pktsnip_t *tmp;
308-
gnrc_pktsnip_t *target = gnrc_pktsnip_search_type(pkt, type);
309-
gnrc_pktsnip_t *next = (target == NULL) ? NULL : target->next;
310-
gnrc_pktsnip_t *new = _create_snip(next, NULL, size, type);
311-
312-
if (new == NULL) {
313-
mutex_unlock(&_mutex);
314-
315-
return NULL;
316-
}
317-
318-
/* copy payloads */
319-
for (tmp = pkt; tmp != NULL; tmp = tmp->next) {
320-
uint8_t *dest = ((uint8_t *)new->data) + (size - tmp->size);
321-
322-
memcpy(dest, tmp->data, tmp->size);
323-
324-
size -= tmp->size;
325-
326-
if (tmp->type == type) {
327-
break;
328-
}
329-
}
330-
331-
/* decrements reference counters */
332-
333-
if (target != NULL) {
334-
target->next = NULL;
335-
}
336-
337-
_release_error_locked(pkt, GNRC_NETERR_SUCCESS);
338-
339-
if (is_shared && (target != NULL)) {
340-
target->next = next;
341-
}
342-
343-
mutex_unlock(&_mutex);
344-
345-
return new;
346-
}
347-
348298
/** @} */

sys/net/gnrc/pktbuf_static/gnrc_pktbuf_static.c

-51
Original file line numberDiff line numberDiff line change
@@ -485,55 +485,4 @@ static void _pktbuf_free(void *data, size_t size)
485485
}
486486
}
487487

488-
489-
gnrc_pktsnip_t *gnrc_pktbuf_duplicate_upto(gnrc_pktsnip_t *pkt, gnrc_nettype_t type)
490-
{
491-
mutex_lock(&_mutex);
492-
493-
bool is_shared = pkt->users > 1;
494-
size_t size = gnrc_pkt_len_upto(pkt, type);
495-
496-
DEBUG("ipv6_ext: duplicating %d octets\n", (int) size);
497-
498-
gnrc_pktsnip_t *tmp;
499-
gnrc_pktsnip_t *target = gnrc_pktsnip_search_type(pkt, type);
500-
gnrc_pktsnip_t *next = (target == NULL) ? NULL : target->next;
501-
gnrc_pktsnip_t *new = _create_snip(next, NULL, size, type);
502-
503-
if (new == NULL) {
504-
mutex_unlock(&_mutex);
505-
506-
return NULL;
507-
}
508-
509-
/* copy payloads */
510-
for (tmp = pkt; tmp != NULL; tmp = tmp->next) {
511-
uint8_t *dest = ((uint8_t *)new->data) + (size - tmp->size);
512-
513-
memcpy(dest, tmp->data, tmp->size);
514-
515-
size -= tmp->size;
516-
517-
if (tmp->type == type) {
518-
break;
519-
}
520-
}
521-
522-
/* decrements reference counters */
523-
524-
if (target != NULL) {
525-
target->next = NULL;
526-
}
527-
528-
_release_error_locked(pkt, GNRC_NETERR_SUCCESS);
529-
530-
if (is_shared && (target != NULL)) {
531-
target->next = next;
532-
}
533-
534-
mutex_unlock(&_mutex);
535-
536-
return new;
537-
}
538-
539488
/** @} */

0 commit comments

Comments
 (0)