| 290 | }; |
| 291 | |
| 292 | void |
| 293 | sx_init_flags(struct sx *sx, const char *description, int opts) |
| 294 | { |
| 295 | int flags; |
| 296 | |
| 297 | MPASS((opts & ~(SX_QUIET | SX_RECURSE | SX_NOWITNESS | SX_DUPOK | |
| 298 | SX_NOPROFILE | SX_NEW)) == 0); |
| 299 | |
| 300 | flags = LO_SLEEPABLE | LO_UPGRADABLE; |
| 301 | if (opts & SX_DUPOK) |
| 302 | flags |= LO_DUPOK; |
| 303 | if (opts & SX_NOPROFILE) |
| 304 | flags |= LO_NOPROFILE; |
| 305 | if (!(opts & SX_NOWITNESS)) |
| 306 | flags |= LO_WITNESS; |
| 307 | if (opts & SX_RECURSE) |
| 308 | flags |= LO_RECURSABLE; |
| 309 | if (opts & SX_QUIET) |
| 310 | flags |= LO_QUIET; |
| 311 | if (opts & SX_NEW) |
| 312 | flags |= LO_NEW; |
| 313 | |
| 314 | lock_init(&sx->lock_object, &lock_class_sx, description, NULL, flags); |
| 315 | //sx->sx_lock = SX_LOCK_UNLOCKED; |
| 316 | //sx->sx_recurse = 0; |
| 317 | } |
| 318 | |
| 319 | void |
| 320 | sx_destroy(struct sx *sx) |
nothing calls this directly
no test coverage detected