963 * Return the CTF handle for the parent CTF container, if one exists.
964 * Otherwise return NULL to indicate this container has no imported parent.
965 */
966 ctf_file_t *
967 ctf_parent_file(ctf_file_t *fp)
968 {
969 return (fp->ctf_parent);
970 }
971
972 /*
973 * Return the name of the parent CTF container, if one exists. Otherwise
974 * return NULL to indicate this container is a root container.
975 */
976 const char *
977 ctf_parent_name(ctf_file_t *fp)
978 {
979 return (fp->ctf_parname);
980 }
981
982 /*
983 * Import the types from the specified parent container by storing a pointer
984 * to it in ctf_parent and incrementing its reference count. Only one parent
985 * is allowed: if a parent already exists, it is replaced by the new parent.
986 */
987 int
988 ctf_import(ctf_file_t *fp, ctf_file_t *pfp)
989 {
990 if (fp == NULL || fp == pfp || (pfp != NULL && pfp->ctf_refcnt == 0))
991 return (ctf_set_errno(fp, EINVAL));
992
993 if (pfp != NULL && pfp->ctf_dmodel != fp->ctf_dmodel)
994 return (ctf_set_errno(fp, ECTF_DMODEL));
995
996 if (fp->ctf_parent != NULL)
997 ctf_close(fp->ctf_parent);
998
999 if (pfp != NULL) {
1000 fp->ctf_flags |= LCTF_CHILD;
1001 pfp->ctf_refcnt++;
1002 }
|
963 * Return the CTF handle for the parent CTF container, if one exists.
964 * Otherwise return NULL to indicate this container has no imported parent.
965 */
966 ctf_file_t *
967 ctf_parent_file(ctf_file_t *fp)
968 {
969 return (fp->ctf_parent);
970 }
971
972 /*
973 * Return the name of the parent CTF container, if one exists. Otherwise
974 * return NULL to indicate this container is a root container.
975 */
976 const char *
977 ctf_parent_name(ctf_file_t *fp)
978 {
979 return (fp->ctf_parname);
980 }
981
982 /*
983 * Return the label of the parent CTF container, if one exists. Otherwise
984 * return NULL.
985 */
986 const char *
987 ctf_parent_label(ctf_file_t *fp)
988 {
989 return (fp->ctf_parlabel);
990 }
991
992 /*
993 * Import the types from the specified parent container by storing a pointer
994 * to it in ctf_parent and incrementing its reference count. Only one parent
995 * is allowed: if a parent already exists, it is replaced by the new parent.
996 */
997 int
998 ctf_import(ctf_file_t *fp, ctf_file_t *pfp)
999 {
1000 if (fp == NULL || fp == pfp || (pfp != NULL && pfp->ctf_refcnt == 0))
1001 return (ctf_set_errno(fp, EINVAL));
1002
1003 if (pfp != NULL && pfp->ctf_dmodel != fp->ctf_dmodel)
1004 return (ctf_set_errno(fp, ECTF_DMODEL));
1005
1006 if (fp->ctf_parent != NULL)
1007 ctf_close(fp->ctf_parent);
1008
1009 if (pfp != NULL) {
1010 fp->ctf_flags |= LCTF_CHILD;
1011 pfp->ctf_refcnt++;
1012 }
|