LCOV - code coverage report
Current view: top level - base_comm/resources/hccp/rdma_service - rs_list.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 22 22
Test Date: 2026-08-04 10:52:23 Functions: 100.0 % 6 6

            Line data    Source code
       1              : /**
       2              :  * Copyright (c) 2025 Huawei Technologies Co., Ltd.
       3              :  * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
       4              :  * CANN Open Software License Agreement Version 2.0 (the "License").
       5              :  * Please refer to the License for details. You may not use this file except in compliance with the License.
       6              :  * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
       7              :  * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
       8              :  * See LICENSE in the root of the software repository for the full text of the License.
       9              :  */
      10              : 
      11              : #ifndef RS_LIST_H
      12              : #define RS_LIST_H
      13              : #include <ccan/list.h>
      14              : 
      15              : struct RsListHead {
      16              :     struct RsListHead *next, *prev;
      17              : };
      18              : 
      19          631 : static inline void RS_INIT_LIST_HEAD(struct RsListHead *list)
      20              : {
      21          631 :     list->next = list;
      22          631 :     list->prev = list;
      23          631 : }
      24              : 
      25              : #define RS_LIST_GET_HEAD_ENTRY(pos, n, head, member, type) do { \
      26              :     (pos) = list_entry((head)->next, type, member);             \
      27              :     (n) = list_entry((pos)->member.next, type, member);         \
      28              : } while (0)
      29              : 
      30          447 : static inline bool RsListEmpty(struct RsListHead *head)
      31              : {
      32          447 :     return head->next == head;
      33              : }
      34              : 
      35          243 : static inline void __rs_list_add(struct RsListHead *xnew,
      36              :                                  struct RsListHead *prev,
      37              :                                  struct RsListHead *next)
      38              : {
      39          243 :     next->prev = xnew;
      40          243 :     xnew->next = next;
      41          243 :     xnew->prev = prev;
      42          243 :     prev->next = xnew;
      43          243 : }
      44              : 
      45          243 : static inline void RsListAddTail(struct RsListHead *xnew, struct RsListHead *head)
      46              : {
      47          243 :     __rs_list_add(xnew, head->prev, head);
      48          243 : }
      49              : 
      50          234 : static inline void __rs_list_del(struct RsListHead *prev, struct RsListHead *next)
      51              : {
      52          234 :     next->prev = prev;
      53          234 :     prev->next = next;
      54          234 : }
      55              : 
      56          234 : static inline void RsListDel(struct RsListHead *entry)
      57              : {
      58          234 :     __rs_list_del(entry->prev, entry->next);
      59          234 : }
      60              : #endif // RS_LIST_H
        

Generated by: LCOV version 2.0-1