MCPcopy Create free account
hub / github.com/F-Stack/f-stack / destroy_fd_instance

Function destroy_fd_instance

freebsd/net/route/fib_algo.c:824–851  ·  view source on GitHub ↗

* Finalises fd destruction by freeing all fd resources. */

Source from the content-addressed store, hash-verified

822 * Finalises fd destruction by freeing all fd resources.
823 */
824static void
825destroy_fd_instance(struct fib_data *fd)
826{
827
828 FD_PRINTF(LOG_INFO, fd, "destroy fd %p", fd);
829
830 /* Call destroy callback first */
831 if (fd->fd_algo_data != NULL)
832 fd->fd_flm->flm_destroy_cb(fd->fd_algo_data);
833
834 /* Nhop table */
835 if ((fd->nh_idx != NULL) && (fd->nh_ref_table != NULL)) {
836 for (int i = 0; i < fd->number_nhops; i++) {
837 if (!is_idx_free(fd, i)) {
838 FD_PRINTF(LOG_DEBUG2, fd, " FREE nhop %d %p",
839 i, fd->nh_idx[i]);
840 nhop_free_any(fd->nh_idx[i]);
841 }
842 }
843 free(fd->nh_idx, M_RTABLE);
844 }
845 if (fd->nh_ref_table != NULL)
846 free(fd->nh_ref_table, M_RTABLE);
847
848 fib_unref_algo(fd->fd_flm);
849
850 free(fd, M_RTABLE);
851}
852
853/*
854 * Epoch callback indicating fd is safe to destroy

Callers 1

Calls 4

is_idx_freeFunction · 0.85
nhop_free_anyFunction · 0.85
fib_unref_algoFunction · 0.85
freeFunction · 0.50

Tested by

no test coverage detected