| 269 | } |
| 270 | |
| 271 | static int |
| 272 | kobj_init1(kobj_t obj, kobj_class_t cls, int mflags) |
| 273 | { |
| 274 | int error; |
| 275 | |
| 276 | KOBJ_LOCK(); |
| 277 | while (cls->ops == NULL) { |
| 278 | /* |
| 279 | * kobj_class_compile doesn't want the lock held |
| 280 | * because of the call to malloc - we drop the lock |
| 281 | * and re-try. |
| 282 | */ |
| 283 | KOBJ_UNLOCK(); |
| 284 | error = kobj_class_compile1(cls, mflags); |
| 285 | if (error != 0) |
| 286 | return (error); |
| 287 | KOBJ_LOCK(); |
| 288 | } |
| 289 | kobj_init_common(obj, cls); |
| 290 | KOBJ_UNLOCK(); |
| 291 | return (0); |
| 292 | } |
| 293 | |
| 294 | kobj_t |
| 295 | kobj_create(kobj_class_t cls, struct malloc_type *mtype, int mflags) |
no test coverage detected