sym = sym->next; } return( sym ); } extern sym_handle SymAdd( const char *sym_name, sym_class class ) { //***************************************************************** // Add a symbol with the given name and class to our symbol table. // Other symbol attrs will have to be added individually. sym_handle sym; sym_handle *bucket; assert( SymLookup( sym_name ) == NULL ); bucket = &hashTable[ symHash( sym_name ) ]; sym = symAlloc( sym_name ); sym->class = class; sym->flags = SF_EXTERN; sym->linkage = SL_UNKNOWN; sym->hi_relocs = sym->lo_relocs = NULL; sym->obj_hdl = NULL; sym->next = *bucket; *bucket = sym; return( sym ); } #ifndef _STANDALONE_ extern bool SymLocationKnown( sym_handle sym ) { //********************************************** // Return true if we know where a given label is // going to be located.
STATUS newfh(vxfh_t * vxfhp, char *fullpath) { DEV_HDR *devhdrp; SYMBOL *sp, *sp2; int fd; char *valuep, type; if ((fd = open(fullpath, O_RDONLY, 0)) < 0) return ERROR; if ((devhdrp = iosFdDevFind(fd)) == NULL) { close(fd); return ERROR; } if (devhdrp->drvNum == rt11FsDrvNum) { vxfhp->type = rt11FsDrvNum; strcpy(vxfhp->opaque, fullpath); close(fd); return OK; } if (devhdrp->drvNum == dosFsDrvNum) { path_to_all_lower(fullpath); if (symFindByName(nfsd_pathtab, fullpath, &valuep, &type) == OK) { vxfhp->type = dosFsDrvNum; *((int *) (vxfhp->opaque)) = (int) valuep; close(fd); nfsd_debug("newfh: return existing valuep %x <%s>\n", valuep, fullpath); return OK; } if (!(sp = symAlloc(nfsd_pathtab, fullpath, 0, (SYM_TYPE) NFSD_MSDOS_TYPE, 0))) { nfsd_debug("newfh: can't symAlloc sp %x <%s>\n", sp, fullpath); nfsd_debugno(); close(fd); return ERROR; } sp->value = (char *) sp; if (symTblAdd(nfsd_pathtab, sp) == ERROR) { /* * XXX -- only try 2 times if it fails. highly * unlikely hash will collide two times in a row with * different values. but this is obviously imperfect. */ if (!(sp2 = symAlloc(nfsd_pathtab, fullpath, 0, (SYM_TYPE) NFSD_MSDOS_TYPE, 0))) { nfsd_debug("newfh: can't symAlloc sp2 <%s>\n", fullpath); close(fd); symFree(nfsd_pathtab, sp); return ERROR; } symFree(nfsd_pathtab, sp); sp = sp2; sp->value = (char *) sp; if (symTblAdd(nfsd_pathtab, sp) == ERROR) { nfsd_debugno(); nfsd_debug("newfh: couldn't add <%s>\n", fullpath); symFree(nfsd_pathtab, sp); close(fd); return ERROR; } } nfsd_debug("newfh: <%s> added as <%x>\n", fullpath, sp); nfsd_debug("newfh: total %d paths are in pathtab now.\n", nfsd_pathtab->nsymbols); vxfhp->type = dosFsDrvNum; *((int *) (vxfhp->opaque)) = (int) sp; close(fd); return OK; } close(fd); return ERROR; }