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

Function mqfs_create

freebsd/kern/uipc_mqueue.c:983–1020  ·  view source on GitHub ↗

* vnode creation operation */

Source from the content-addressed store, hash-verified

981 * vnode creation operation
982 */
983static int
984mqfs_create(struct vop_create_args *ap)
985{
986 struct mqfs_info *mqfs = VFSTOMQFS(ap->a_dvp->v_mount);
987 struct componentname *cnp = ap->a_cnp;
988 struct mqfs_node *pd;
989 struct mqfs_node *pn;
990 struct mqueue *mq;
991 int error;
992
993 pd = VTON(ap->a_dvp);
994 if (pd->mn_type != mqfstype_root && pd->mn_type != mqfstype_dir)
995 return (ENOTDIR);
996 mq = mqueue_alloc(NULL);
997 if (mq == NULL)
998 return (EAGAIN);
999 sx_xlock(&mqfs->mi_lock);
1000 if ((cnp->cn_flags & HASBUF) == 0)
1001 panic("%s: no name", __func__);
1002 pn = mqfs_create_file(pd, cnp->cn_nameptr, cnp->cn_namelen,
1003 cnp->cn_cred, ap->a_vap->va_mode);
1004 if (pn == NULL) {
1005 sx_xunlock(&mqfs->mi_lock);
1006 error = ENOSPC;
1007 } else {
1008 mqnode_addref(pn);
1009 sx_xunlock(&mqfs->mi_lock);
1010 error = mqfs_allocv(ap->a_dvp->v_mount, ap->a_vpp, pn);
1011 mqnode_release(pn);
1012 if (error)
1013 mqfs_destroy(pn);
1014 else
1015 pn->mn_data = mq;
1016 }
1017 if (error)
1018 mqueue_free(mq);
1019 return (error);
1020}
1021
1022/*
1023 * Remove an entry

Callers

nothing calls this directly

Calls 8

mqueue_allocFunction · 0.85
mqfs_create_fileFunction · 0.85
mqnode_addrefFunction · 0.85
mqfs_allocvFunction · 0.85
mqnode_releaseFunction · 0.85
mqfs_destroyFunction · 0.85
mqueue_freeFunction · 0.85
panicFunction · 0.70

Tested by

no test coverage detected