Annotation of 43BSD/ingres/source/iutil/create_btree.c, revision 1.1

1.1     ! root        1: #include       <btree.h>
        !             2: #include       <ingres.h>
        !             3: #include       <aux.h>
        !             4: #include       <sccs.h>
        !             5: 
        !             6: SCCSID(@(#)create_btree.c      8.2     1/18/85)
        !             7: 
        !             8: /*     CREATE_BTREE -- creates a new B-Tree
        !             9: **
        !            10: **     Creates an empty B-Tree whose root is an empty leaf.  The B-Tree
        !            11: **     filename is the relation name with "TREE" concatenated to the end
        !            12: **     of the name.
        !            13: **
        !            14: **     Parameters:
        !            15: **             relname - relation name (I)
        !            16: */
        !            17: 
        !            18: create_btree(relname)
        !            19: char *relname;
        !            20: 
        !            21: {
        !            22:        struct BTreeNode        root;
        !            23:        register int            i;
        !            24:        extern int              Btree_fd;
        !            25: 
        !            26:        root.depth = 1;
        !            27:        root.prevtree = root.nexttree = 0l;
        !            28:        bmove(&root.prevtree, &root.prttree, LIDSIZE);
        !            29:        /* the root is initially an empty leaf node */
        !            30:        root.nodetype = 'L';
        !            31:        root.nelmts = 0;
        !            32:        root.parent = 0;        /* '0' indicates no other empty pages in file */
        !            33: 
        !            34:        root.node.leafnode.prevleaf = 0;
        !            35:        root.node.leafnode.nextleaf = 0;
        !            36: 
        !            37:        for (i = 0; i< MAXLEAVES; ++i)
        !            38:                root.node.leafnode.tid_loc[i] = root.node.leafnode.back_ptr[i] = i;
        !            39: 
        !            40:        close(creat(relname, FILEMODE));
        !            41:        if ((Btree_fd = open(relname, O_RDWR)) < 0)
        !            42:                syserr("create_btree: can't open %s", relname);
        !            43:        write_node(RT, &root);
        !            44: 
        !            45: #      ifdef xATR1
        !            46:        if (tTf(24, 0))
        !            47:                printf("creating btree %s", relname);
        !            48: #      endif
        !            49: 
        !            50: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.