| 277 | } |
| 278 | |
| 279 | void |
| 280 | rm_init_flags(struct rmlock *rm, const char *name, int opts) |
| 281 | { |
| 282 | struct lock_class *lc; |
| 283 | int liflags, xflags; |
| 284 | |
| 285 | liflags = 0; |
| 286 | if (!(opts & RM_NOWITNESS)) |
| 287 | liflags |= LO_WITNESS; |
| 288 | if (opts & RM_RECURSE) |
| 289 | liflags |= LO_RECURSABLE; |
| 290 | if (opts & RM_NEW) |
| 291 | liflags |= LO_NEW; |
| 292 | rm->rm_writecpus = all_cpus; |
| 293 | LIST_INIT(&rm->rm_activeReaders); |
| 294 | if (opts & RM_SLEEPABLE) { |
| 295 | liflags |= LO_SLEEPABLE; |
| 296 | lc = &lock_class_rm_sleepable; |
| 297 | xflags = (opts & RM_NEW ? SX_NEW : 0); |
| 298 | sx_init_flags(&rm->rm_lock_sx, "rmlock_sx", |
| 299 | xflags | SX_NOWITNESS); |
| 300 | } else { |
| 301 | lc = &lock_class_rm; |
| 302 | xflags = (opts & RM_NEW ? MTX_NEW : 0); |
| 303 | mtx_init(&rm->rm_lock_mtx, name, "rmlock_mtx", |
| 304 | xflags | MTX_NOWITNESS); |
| 305 | } |
| 306 | lock_init(&rm->lock_object, lc, name, NULL, liflags); |
| 307 | } |
| 308 | |
| 309 | void |
| 310 | rm_init(struct rmlock *rm, const char *name) |
no test coverage detected