MCPcopy Create free account
hub / github.com/F-Stack/f-stack / mqfs_init

Function mqfs_init

freebsd/kern/uipc_mqueue.c:656–692  ·  view source on GitHub ↗

* Initialize a mqfs instance */

Source from the content-addressed store, hash-verified

654 * Initialize a mqfs instance
655 */
656static int
657mqfs_init(struct vfsconf *vfc)
658{
659 struct mqfs_node *root;
660 struct mqfs_info *mi;
661 osd_method_t methods[PR_MAXMETHOD] = {
662 [PR_METHOD_REMOVE] = mqfs_prison_remove,
663 };
664
665 mqnode_zone = uma_zcreate("mqnode", sizeof(struct mqfs_node),
666 NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0);
667 mqueue_zone = uma_zcreate("mqueue", sizeof(struct mqueue),
668 NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0);
669 mvdata_zone = uma_zcreate("mvdata",
670 sizeof(struct mqfs_vdata), NULL, NULL, NULL,
671 NULL, UMA_ALIGN_PTR, 0);
672 mqnoti_zone = uma_zcreate("mqnotifier", sizeof(struct mqueue_notifier),
673 NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0);
674 mi = &mqfs_data;
675 sx_init(&mi->mi_lock, "mqfs lock");
676 /* set up the root diretory */
677 root = mqfs_create_node("/", 1, curthread->td_ucred, 01777,
678 mqfstype_root);
679 root->mn_info = mi;
680 LIST_INIT(&root->mn_children);
681 LIST_INIT(&root->mn_vnodes);
682 mi->mi_root = root;
683 mqfs_fileno_init(mi);
684 mqfs_fileno_alloc(mi, root);
685 mqfs_fixup_dir(root);
686 exit_tag = EVENTHANDLER_REGISTER(process_exit, mq_proc_exit, NULL,
687 EVENTHANDLER_PRI_ANY);
688 mq_fdclose = mqueue_fdclose;
689 p31b_setcfg(CTL_P1003_1B_MESSAGE_PASSING, _POSIX_MESSAGE_PASSING);
690 mqfs_osd_jail_slot = osd_jail_register(NULL, methods);
691 return (0);
692}
693
694/*
695 * Destroy a mqfs instance

Callers

nothing calls this directly

Calls 6

uma_zcreateFunction · 0.85
mqfs_create_nodeFunction · 0.85
mqfs_fileno_initFunction · 0.85
mqfs_fileno_allocFunction · 0.85
mqfs_fixup_dirFunction · 0.85
p31b_setcfgFunction · 0.85

Tested by

no test coverage detected