| 264 | } |
| 265 | |
| 266 | static int |
| 267 | pipe_zone_ctor(void *mem, int size, void *arg, int flags) |
| 268 | { |
| 269 | struct pipepair *pp; |
| 270 | struct pipe *rpipe, *wpipe; |
| 271 | |
| 272 | KASSERT(size == sizeof(*pp), ("pipe_zone_ctor: wrong size")); |
| 273 | |
| 274 | pp = (struct pipepair *)mem; |
| 275 | |
| 276 | /* |
| 277 | * We zero both pipe endpoints to make sure all the kmem pointers |
| 278 | * are NULL, flag fields are zero'd, etc. We timestamp both |
| 279 | * endpoints with the same time. |
| 280 | */ |
| 281 | rpipe = &pp->pp_rpipe; |
| 282 | bzero(rpipe, sizeof(*rpipe)); |
| 283 | pipe_timestamp(&rpipe->pipe_ctime); |
| 284 | rpipe->pipe_atime = rpipe->pipe_mtime = rpipe->pipe_ctime; |
| 285 | |
| 286 | wpipe = &pp->pp_wpipe; |
| 287 | bzero(wpipe, sizeof(*wpipe)); |
| 288 | wpipe->pipe_ctime = rpipe->pipe_ctime; |
| 289 | wpipe->pipe_atime = wpipe->pipe_mtime = rpipe->pipe_ctime; |
| 290 | |
| 291 | rpipe->pipe_peer = wpipe; |
| 292 | rpipe->pipe_pair = pp; |
| 293 | wpipe->pipe_peer = rpipe; |
| 294 | wpipe->pipe_pair = pp; |
| 295 | |
| 296 | /* |
| 297 | * Mark both endpoints as present; they will later get free'd |
| 298 | * one at a time. When both are free'd, then the whole pair |
| 299 | * is released. |
| 300 | */ |
| 301 | rpipe->pipe_present = PIPE_ACTIVE; |
| 302 | wpipe->pipe_present = PIPE_ACTIVE; |
| 303 | |
| 304 | /* |
| 305 | * Eventually, the MAC Framework may initialize the label |
| 306 | * in ctor or init, but for now we do it elswhere to avoid |
| 307 | * blocking in ctor or init. |
| 308 | */ |
| 309 | pp->pp_label = NULL; |
| 310 | |
| 311 | return (0); |
| 312 | } |
| 313 | |
| 314 | static int |
| 315 | pipe_zone_init(void *mem, int size, int flags) |
nothing calls this directly
no test coverage detected