| 1501 | } |
| 1502 | |
| 1503 | static int |
| 1504 | pipeline_selector_group_members_delete(struct rte_swx_ctl_pipeline *p, |
| 1505 | const char *selector_name, |
| 1506 | FILE *file, |
| 1507 | uint32_t *file_line_number) |
| 1508 | { |
| 1509 | char *line = NULL; |
| 1510 | uint32_t line_id = 0; |
| 1511 | int status = 0; |
| 1512 | |
| 1513 | /* Buffer allocation. */ |
| 1514 | line = malloc(MAX_LINE_SIZE); |
| 1515 | if (!line) |
| 1516 | return -ENOMEM; |
| 1517 | |
| 1518 | /* File read. */ |
| 1519 | for (line_id = 1; ; line_id++) { |
| 1520 | uint32_t group_id, member_id, weight; |
| 1521 | int is_blank_or_comment; |
| 1522 | |
| 1523 | if (fgets(line, MAX_LINE_SIZE, file) == NULL) |
| 1524 | break; |
| 1525 | |
| 1526 | status = pipeline_selector_group_member_read(line, |
| 1527 | &group_id, |
| 1528 | &member_id, |
| 1529 | &weight, |
| 1530 | &is_blank_or_comment); |
| 1531 | if (status) { |
| 1532 | if (is_blank_or_comment) |
| 1533 | continue; |
| 1534 | |
| 1535 | goto error; |
| 1536 | } |
| 1537 | |
| 1538 | status = rte_swx_ctl_pipeline_selector_group_member_delete(p, |
| 1539 | selector_name, |
| 1540 | group_id, |
| 1541 | member_id); |
| 1542 | if (status) |
| 1543 | goto error; |
| 1544 | } |
| 1545 | |
| 1546 | error: |
| 1547 | free(line); |
| 1548 | *file_line_number = line_id; |
| 1549 | return status; |
| 1550 | } |
| 1551 | |
| 1552 | static const char cmd_pipeline_selector_group_member_delete_help[] = |
| 1553 | "pipeline <pipeline_name> selector <selector_name> group member delete <file_name>"; |
no test coverage detected