DragonFly BSD
DragonFly kernel List (threaded) for 2003-12
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: libcaps question

From: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>
Date: Sat, 13 Dec 2003 15:53:18 -0800 (PST)

:I realize this is a work in progress but I find this to be a little 
:difficult to keep track of.  Its probably just me :)
:    caps_port_t port;
:    port = malloc(sizeof(*port));
:    bzero(port, sizeof(*port));
:    lwkt_initport(&port->lport, curthread);
:    port->lport.mp_putport = cs_putport;
:    port->lport.mp_waitport = cs_waitport;
:    port->lport.mp_replyport = cs_replyport;
:    port->lport.mp_refs = 1;
:Basically I would be more comfortable if port were (caps_port_t *).
:It would make the sizeof easier to get correct later so I don't just
:accidentally allocate something that is the size of a pointer :).

    Most of the kernel structural _t typedefs are pointers, so that is
    the convention I am using.  Use 'struct name' if you need the actual
    structural type instead of a pointer.

    So, e.g. thread_t, lwkt_msg_t, lwkt_port_t.

    There is a secondary reason for doing this and that is that we can,
    if necessary, 'typedef struct fubar *fubar_t;' and use fubar_t in 
    prototypes without having to bring in all the #include files necsesary
    for struct fubar.  This reduces #include file pollution.

					Matthew Dillon 

[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]