+ NULLFSDEBUG("%s\n", __FUNCTION__);
+
+ /* assuming for now that this happens immediately and by default after fs
+ * installation */
+ null_hashlck_grp_attr = lck_grp_attr_alloc_init();
+ if (null_hashlck_grp_attr == NULL) {
+ goto error;
+ }
+ null_hashlck_grp = lck_grp_alloc_init("com.apple.filesystems.nullfs", null_hashlck_grp_attr);
+ if (null_hashlck_grp == NULL) {
+ goto error;
+ }
+ null_hashlck_attr = lck_attr_alloc_init();
+ if (null_hashlck_attr == NULL) {
+ goto error;
+ }
+
+ lck_mtx_init(&null_hashmtx, null_hashlck_grp, null_hashlck_attr);
+ null_node_hashtbl = hashinit(NULL_HASH_SIZE, M_TEMP, &null_hash_mask);
+ NULLFSDEBUG("%s finished\n", __FUNCTION__);
+ return 0;
+error:
+ printf("NULLFS: failed to get lock element\n");
+ if (null_hashlck_grp_attr) {
+ lck_grp_attr_free(null_hashlck_grp_attr);
+ null_hashlck_grp_attr = NULL;
+ }
+ if (null_hashlck_grp) {
+ lck_grp_free(null_hashlck_grp);
+ null_hashlck_grp = NULL;
+ }
+ if (null_hashlck_attr) {
+ lck_attr_free(null_hashlck_attr);
+ null_hashlck_attr = NULL;
+ }
+ return KERN_FAILURE;
+}