Skip to content

Add binding for csp_iflist_remove() #29

@kivkiv12345

Description

@kivkiv12345

@Ahbork We have discussed adding a binding for lib/csp/src/csp_iflist.c:238 csp_iflist_remove(). This is quite simple to do, but libcsp does not offer any way to free the memory of interfaces, which may allocate some additional context driver, that may also need to be freed.
The interface (or its driver) could also be static, I which case attempting to free it would segfault.

There's a couple of ways to solve this, all of which are very likely compatible with eachother at the API level:

  • I think the best would be if interfaces could register a free() function. But this requires changes to all interface types, and to upstream; a lot of work.
  • Alternatively we just don't free the interface. Python Interface instances would remain valid, and an Interface.csp_iflist_add() could be added, so they could be registered again. But if all Python references to the csp_iface_t are lost, we would leak the memory. Nevertheless, this is probably my preferred initial solution.
  • We could also have Python maintain a list of all interfaces it has ever removed, so that the references are never truly lost. But I don't see an issue in adding this later.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions