Пример #1
0
inflate_blocks_statef *inflate_blocks_new(
z_streamp z,
check_func c,
uInt w)
{
  inflate_blocks_statef *s;

  if ((s = (inflate_blocks_statef *)ZALLOC
       (z,1,sizeof(struct inflate_blocks_state))) == Z_NULL)
    return s;
  if ((s->hufts =
       (inflate_huft *)ZALLOC(z, sizeof(inflate_huft), MANY)) == Z_NULL)
  {
    ZFREE(z, s);
    return Z_NULL;
  }
  if ((s->window = (Bytef *)ZALLOC(z, 1, w)) == Z_NULL)
  {
    ZFREE(z, s->hufts);
    ZFREE(z, s);
    return Z_NULL;
  }
  s->end = s->window + w;
  s->checkfn = c;
  s->mode = TYPE;
  Tracev((stderr, "inflate:   blocks allocated\n"));
  inflate_blocks_reset(s, z, Z_NULL);
  return s;
}
Пример #2
0
void nitro_prefix_trie_add(nitro_prefix_trie_node **t,
                           const uint8_t *rep, uint8_t length, void *ptr) {
    nitro_prefix_trie_node *n, *on;

    if (!*t) {
        ZALLOC(*t);

        if (length) {
            (*t)->length = length;
            (*t)->rep = malloc(length);
            memmove((*t)->rep, rep, length);
        }
    }

    on = n = *t;

    if (n->length < length && !memcmp(n->rep, rep, n->length)) {
        uint8_t c = rep[n->length];
        nitro_prefix_trie_add(&n->subs[c], rep, length, ptr);
    } else {
        // alloc
        nitro_prefix_trie_mem *m;
        ZALLOC(m);
        m->ptr = ptr;

        if (n->length == length && !memcmp(n->rep, rep, length)) {
            DL_APPEND(n->members, m);
        } else {
            ZALLOC(n);
            n->length = length;
            n->rep = malloc(length);
            memmove(n->rep, rep, length);
            DL_APPEND(n->members, m);

            if (n->length < on->length && !memcmp(on->rep, n->rep, n->length)) {
                *t = n;
                n->subs[on->rep[length]] = on;
            } else if (n->length > on->length && !memcmp(on->rep, n->rep, on->length)) {
                *t = on;
                on->subs[n->rep[on->length]] = n;
            } else {
                int i;

                for (i = 0; i < length && on->rep[i] == n->rep[i]; i++) {}

                nitro_prefix_trie_node *parent;
                ZALLOC(parent);
                parent->length = i;
                parent->rep = malloc(parent->length);
                memmove(parent->rep, rep, parent->length);
                parent->subs[rep[parent->length]] = n;
                parent->subs[on->rep[parent->length]] = on;
                *t = parent;
            }
        }
    }
}
Пример #3
0
Файл: gen.c Проект: 5kg/gdb
gen_table *
make_gen_tables (insn_table *isa, decode_table *rules)
{
  gen_table *gen = ZALLOC (gen_table);
  gen->isa = isa;
  gen->rules = rules;
  if (options.gen.multi_sim)
    {
      gen_list **last = &gen->tables;
      model_entry *model;
      filter *processors;
      if (options.model_filter != NULL)
	processors = options.model_filter;
      else
	processors = isa->model->processors;
      for (model = isa->model->models; model != NULL; model = model->next)
	{
	  if (filter_is_member (processors, model->name))
	    {
	      *last = make_table (isa, rules, model);
	      last = &(*last)->next;
	    }
	}
    }
  else
    {
      gen->tables = make_table (isa, rules, NULL);
    }
  return gen;
}
Пример #4
0
lf *
lf_open (char *name,
	 char *real_name,
	 lf_file_references references,
	 lf_file_type type, const char *program)
{
  /* create a file object */
  lf *new_lf = ZALLOC (lf);
  ASSERT (new_lf != NULL);
  new_lf->references = references;
  new_lf->type = type;
  new_lf->name = (real_name == NULL ? name : real_name);
  new_lf->program = program;
  /* attach to stdout if pipe */
  if (!strcmp (name, "-"))
    {
      new_lf->stream = stdout;
    }
  else
    {
      /* create a new file */
      new_lf->stream = fopen (name, "w");
      if (new_lf->stream == NULL)
	{
	  perror (name);
	  exit (1);
	}
    }
  return new_lf;
}
Пример #5
0
nitro_async_t *nitro_async_new(int type) {
    /* eventually.. pool? */
    nitro_async_t *a;
    ZALLOC(a);
    a->type = type;
    return a;
}
Пример #6
0
decode_table *
load_decode_table(char *file_name,
		  int hi_bit_nr)
{
  table *file = table_open(file_name, nr_decode_fields, 0);
  table_entry *entry;
  decode_table *table = NULL;
  decode_table **curr_rule = &table;
  while ((entry = table_entry_read(file)) != NULL) {
    decode_table *new_rule = ZALLOC(decode_table);
    new_rule->type = name2i(entry->fields[op_options], decode_type_map);
    new_rule->gen = (overriding_gen_type != invalid_gen
		     ? overriding_gen_type
		     : name2i(entry->fields[op_options], decode_gen_map));
    new_rule->force_slash = name2i(entry->fields[op_options], decode_slash_map);
    new_rule->first = target_a2i(hi_bit_nr, entry->fields[op_first]);
    new_rule->last = target_a2i(hi_bit_nr, entry->fields[op_last]);
    new_rule->force_first = (strlen(entry->fields[op_force_first])
			     ? target_a2i(hi_bit_nr, entry->fields[op_force_first])
			     : new_rule->last + 1);
    new_rule->force_last = (strlen(entry->fields[op_force_last])
			    ? target_a2i(hi_bit_nr, entry->fields[op_force_last])
			    : new_rule->first - 1);
    new_rule->force_expansion = entry->fields[op_force_expansion];
    new_rule->special_mask = a2i(entry->fields[op_special_mask]);
    new_rule->special_value = a2i(entry->fields[op_special_value]);
    new_rule->special_constant = a2i(entry->fields[op_special_constant]);
    *curr_rule = new_rule;
    curr_rule = &new_rule->next;
  }
  return table;
}
Пример #7
0
static sim_core_mapping *
new_sim_core_mapping (SIM_DESC sd,
		      int level,
		      int space,
		      address_word addr,
		      address_word nr_bytes,
		      unsigned modulo,
#if WITH_HW
		      struct hw *device,
#else
		      device *device,
#endif
		      void *buffer,
		      void *free_buffer)
{
  sim_core_mapping *new_mapping = ZALLOC (sim_core_mapping);
  /* common */
  new_mapping->level = level;
  new_mapping->space = space;
  new_mapping->base = addr;
  new_mapping->nr_bytes = nr_bytes;
  new_mapping->bound = addr + (nr_bytes - 1);
  if (modulo == 0)
    new_mapping->mask = (unsigned) 0 - 1;
  else
    new_mapping->mask = modulo - 1;
  new_mapping->buffer = buffer;
  new_mapping->free_buffer = free_buffer;
  new_mapping->device = device;
  return new_mapping;
}
Пример #8
0
static form_fields *
insn_table_cache_fields (insn_table *isa)
{
  form_fields *forms = NULL;
  insn_entry *insn;
  for (insn = isa->insns; insn != NULL; insn = insn->next)
    {
      form_fields **form = &forms;
      while (1)
	{
	  if (*form == NULL)
	    {
	      /* new format name, add it */
	      form_fields *new_form = ZALLOC (form_fields);
	      new_form->name = insn->format_name;
	      filter_add (&new_form->fields, insn->field_names);
	      *form = new_form;
	      break;
	    }
	  else if (strcmp ((*form)->name, insn->format_name) == 0)
	    {
	      /* already present, add field names to the existing list */
	      filter_add (&(*form)->fields, insn->field_names);
	      break;
	    }
	  form = &(*form)->next;
	}
    }
  return forms;
}
Пример #9
0
static icache_tree *
icache_tree_insert(icache_tree *tree,
		   char *name)
{
  icache_tree *new_tree;
  /* find it */
  icache_tree **ptr_to_cur_tree = &tree->children;
  icache_tree *cur_tree = *ptr_to_cur_tree;
  while (cur_tree != NULL
	 && strcmp(cur_tree->name, name) < 0) {
    ptr_to_cur_tree = &cur_tree->next;
    cur_tree = *ptr_to_cur_tree;
  }
  ASSERT(cur_tree == NULL
	 || strcmp(cur_tree->name, name) >= 0);
  /* already in the tree */
  if (cur_tree != NULL
      && strcmp(cur_tree->name, name) == 0)
    return cur_tree;
  /* missing, insert it */
  ASSERT(cur_tree == NULL
	 || strcmp(cur_tree->name, name) > 0);
  new_tree = ZALLOC(icache_tree);
  new_tree->name = name;
  new_tree->next = cur_tree;
  *ptr_to_cur_tree = new_tree;
  return new_tree;
}
Пример #10
0
static void
insn_table_insert_expanded(insn_table *table,
			   insn *old_insn,
			   int new_opcode_nr,
			   insn_bits *new_bits)
{
  insn_table **ptr_to_cur_entry = &table->entries;
  insn_table *cur_entry = *ptr_to_cur_entry;

  /* find the new table for this entry */
  while (cur_entry != NULL
	 && cur_entry->opcode_nr < new_opcode_nr) {
    ptr_to_cur_entry = &cur_entry->sibling;
    cur_entry = *ptr_to_cur_entry;
  }

  if (cur_entry == NULL || cur_entry->opcode_nr != new_opcode_nr) {
    insn_table *new_entry = ZALLOC(insn_table);
    new_entry->opcode_nr = new_opcode_nr;
    new_entry->expanded_bits = new_bits;
    new_entry->opcode_rule = table->opcode_rule->next;
    new_entry->sibling = cur_entry;
    new_entry->parent = table;
    *ptr_to_cur_entry = new_entry;
    cur_entry = new_entry;
    table->nr_entries++;
  }
  /* ASSERT new_bits == cur_entry bits */
  ASSERT(cur_entry != NULL && cur_entry->opcode_nr == new_opcode_nr);
  insn_table_insert_insn(cur_entry,
			 old_insn->file_entry,
			 old_insn->fields);
}
Пример #11
0
static void storeline(GVC_t *gvc, textlabel_t *lp, char *line, char terminator)
{
    pointf size;
    textspan_t *span;
    static textfont_t tf;
    int oldsz = lp->u.txt.nspans + 1;

    lp->u.txt.span = ZALLOC(oldsz + 1, lp->u.txt.span, textspan_t, oldsz);
    span = &(lp->u.txt.span[lp->u.txt.nspans]);
    span->str = line;
    span->just = terminator;
    if (line && line[0]) {
	tf.name = lp->fontname;
	tf.size = lp->fontsize;
	span->font = dtinsert(gvc->textfont_dt, &tf);
        size = textspan_size(gvc, span);
    }
    else {
	size.x = 0.0;
	span->size.y = size.y = (int)(lp->fontsize * LINESPACING);
    }

    lp->u.txt.nspans++;
    /* width = max line width */
    lp->dimen.x = MAX(lp->dimen.x, size.x);
    /* accumulate height */
    lp->dimen.y += size.y;
}
Пример #12
0
static void
model_table_insert(insn_table *table,
		   table_entry *file_entry)
{
  int len;

  /* create a new model */
  model *new_model = ZALLOC(model);

  new_model->name = file_entry->fields[model_identifer];
  new_model->printable_name = file_entry->fields[model_name];
  new_model->insn_default = file_entry->fields[model_default];

  while (*new_model->insn_default && isspace(*new_model->insn_default))
    new_model->insn_default++;

  len = strlen(new_model->insn_default);
  if (max_model_fields_len < len)
    max_model_fields_len = len;

  /* append it to the end of the model list */
  if (last_model)
    last_model->next = new_model;
  else
    models = new_model;
  last_model = new_model;
}
Пример #13
0
static line_ref *
current_line (open_table * file)
{
  line_ref *entry = ZALLOC (line_ref);
  *entry = file->pseudo_line;
  return entry;
}
Пример #14
0
static void
test_detect()
{
	struct memory_block mhuge_used = { .chunk_id = 0, 0, 0, 0 };
	struct memory_block mhuge_free = { .chunk_id = 1, 0, 0, 0 };
	struct memory_block mrun = { .chunk_id = 2, 0, 0, 0 };

	pop->hlayout->zone0.chunk_headers[0].size_idx = 1;
	pop->hlayout->zone0.chunk_headers[0].type = CHUNK_TYPE_USED;

	pop->hlayout->zone0.chunk_headers[1].size_idx = 1;
	pop->hlayout->zone0.chunk_headers[1].type = CHUNK_TYPE_FREE;

	pop->hlayout->zone0.chunk_headers[2].size_idx = 1;
	pop->hlayout->zone0.chunk_headers[2].type = CHUNK_TYPE_RUN;

	UT_ASSERTeq(memblock_autodetect_type(&mhuge_used, pop->hlayout),
		MEMORY_BLOCK_HUGE);
	UT_ASSERTeq(memblock_autodetect_type(&mhuge_free, pop->hlayout),
		MEMORY_BLOCK_HUGE);
	UT_ASSERTeq(memblock_autodetect_type(&mrun, pop->hlayout),
		MEMORY_BLOCK_RUN);
}

static void
test_block_size()
{
	struct memory_block mhuge = { .chunk_id = 0, 0, 0, 0 };
	struct memory_block mrun = { .chunk_id = 1, 0, 0, 0 };
	pop->hlayout->zone0.chunk_headers[0].size_idx = 1;
	pop->hlayout->zone0.chunk_headers[0].type = CHUNK_TYPE_USED;

	pop->hlayout->zone0.chunk_headers[1].size_idx = 1;
	pop->hlayout->zone0.chunk_headers[1].type = CHUNK_TYPE_RUN;
	struct chunk_run *run = (struct chunk_run *)
		&pop->hlayout->zone0.chunks[1];
	run->block_size = 1234;

	UT_ASSERTeq(MEMBLOCK_OPS(, &mhuge)->block_size(&mhuge, pop->hlayout),
		CHUNKSIZE);
	UT_ASSERTeq(MEMBLOCK_OPS(, &mrun)->block_size(&mrun, pop->hlayout),
		1234);
}

int
main(int argc, char *argv[])
{
	START(argc, argv, "obj_memblock");
	PMEMobjpool pool;
	pop = &pool;

	pop->hlayout = ZALLOC(sizeof(struct heap_layout) +
		NCHUNKS * sizeof(struct chunk));

	test_detect();
	test_block_size();

	DONE(NULL);
}
Пример #15
0
static void *
hw_eeprom_create(const char *name,
		 const device_unit *unit_address,
		 const char *args)
{
  hw_eeprom_device *eeprom = ZALLOC(hw_eeprom_device);
  return eeprom;
}
Пример #16
0
Файл: hw_vm.c Проект: 5kg/gdb
static void *
hw_vm_create(const char *name,
	     const device_unit *address,
	     const char *args)
{
  hw_vm_device *vm = ZALLOC(hw_vm_device);
  return vm;
}
Пример #17
0
Файл: hw_nvram.c Проект: 5kg/gdb
static void *
hw_nvram_create(const char *name,
		const device_unit *unit_address,
		const char *args)
{
  hw_nvram_device *nvram = ZALLOC(hw_nvram_device);
  return nvram;
}
Пример #18
0
static void *
hw_ide_create(const char *name,
	      const device_unit *unit_address,
	      const char *args)
{
  hw_ide_device *ide = ZALLOC(hw_ide_device);
  return ide;
}
Пример #19
0
Файл: hw_com.c Проект: 5kg/gdb
static void *
hw_com_create(const char *name,
	      const device_unit *unit_address,
	      const char *args)
{
  /* create the descriptor */
  hw_com_device *hw_com = ZALLOC(hw_com_device);
  return hw_com;
}
Пример #20
0
extern void
insn_table_insert_insn(insn_table *table,
		       table_entry *file_entry,
		       insn_fields *fields)
{
  insn **ptr_to_cur_insn = &table->insns;
  insn *cur_insn = *ptr_to_cur_insn;
  table_model_entry *insn_model_ptr;
  model *model_ptr;

  /* create a new instruction */
  insn *new_insn = ZALLOC(insn);
  new_insn->file_entry = file_entry;
  new_insn->fields = fields;

  /* Check out any model information returned to make sure the model
     is correct.  */
  for(insn_model_ptr = file_entry->model_first; insn_model_ptr; insn_model_ptr = insn_model_ptr->next) {
    char *name = insn_model_ptr->fields[insn_model_name];
    int len = strlen (insn_model_ptr->fields[insn_model_fields]);

    while (len > 0 && isspace(*insn_model_ptr->fields[insn_model_fields])) {
      len--;
      insn_model_ptr->fields[insn_model_fields]++;
    }

    if (max_model_fields_len < len)
      max_model_fields_len = len;

    for(model_ptr = models; model_ptr; model_ptr = model_ptr->next) {
      if (strcmp(name, model_ptr->printable_name) == 0) {

	/* Replace the name field with that of the global model, so that when we
	   want to print it out, we can just compare pointers.  */
	insn_model_ptr->fields[insn_model_name] = model_ptr->printable_name;
	break;
      }
    }

    if (!model_ptr)
      error("%s:%d: machine model `%s' was not known about\n",
	    file_entry->file_name, file_entry->line_nr, name);
  }

  /* insert it according to the order of the fields */
  while (cur_insn != NULL
	 && new_insn->fields->value >= cur_insn->fields->value) {
    ptr_to_cur_insn = &cur_insn->next;
    cur_insn = *ptr_to_cur_insn;
  }

  new_insn->next = cur_insn;
  *ptr_to_cur_insn = new_insn;

  table->nr_insn++;
}
Пример #21
0
static table_entry *
new_table_entry (open_table * file, table_entry_type type)
{
  table_entry *entry;
  entry = ZALLOC (table_entry);
  entry->file = file->root;
  entry->line = current_line (file);
  entry->type = type;
  return entry;
}
Пример #22
0
int
main(int argc, char *argv[])
{
	START(argc, argv, "obj_fragmentation2");

	if (argc < 3)
		UT_FATAL("usage: %s filename workload [seed]", argv[0]);

	const char *path = argv[1];

	PMEMobjpool *pop = pmemobj_create(path, LAYOUT_NAME, DEFAULT_FILE_SIZE,
				S_IWUSR | S_IRUSR);
	if (pop == NULL)
		UT_FATAL("!pmemobj_create: %s", path);

	int w = atoi(argv[2]);

	if (argc > 3)
		seed = (unsigned)atoi(argv[3]);
	else
		seed = time(NULL);

	objects = ZALLOC(sizeof(uint64_t) * MAX_OBJECTS);
	UT_ASSERTne(objects, NULL);

	workloads[w - 1](pop);

	PMEMoid oid;
	size_t remaining = 0;
	size_t chunk = 100; /* calc at chunk level */
	while (pmemobj_alloc(pop, &oid, chunk, 0, NULL, NULL) == 0)
		remaining += pmemobj_alloc_usable_size(oid) + 16;

	size_t allocated_sum = 0;
	oid = pmemobj_root(pop, 1);
	for (size_t n = 0; n < nobjects; ++n) {
		if (objects[n] == 0)
			continue;
		oid.off = objects[n];
		allocated_sum += pmemobj_alloc_usable_size(oid) + 16;
	}

	size_t used = DEFAULT_FILE_SIZE - remaining;
	float frag = ((float)used / allocated_sum) - 1.f;

	UT_ASSERT(frag <= workloads_target[w - 1]);

	pmemobj_close(pop);

	FREE(objects);

	DONE(NULL);
}
Пример #23
0
event_queue_create(void)
{
  event_queue *new_event_queue = ZALLOC(event_queue);

  new_event_queue->processing = 0;
  new_event_queue->queue = NULL;
  new_event_queue->held = NULL;
  new_event_queue->held_end = &new_event_queue->held;

  /* both times are already zero */
  return new_event_queue;
}
Пример #24
0
void
sim_module_add_uninstall_fn (SIM_DESC sd, MODULE_UNINSTALL_FN fn)
{
  struct module_list *modules = STATE_MODULES (sd);
  MODULE_UNINSTALL_LIST *l = ZALLOC (MODULE_UNINSTALL_LIST);

  SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
  SIM_ASSERT (STATE_MODULES (sd) != NULL);

  l->fn = fn;
  l->next = modules->uninstall_list;
  modules->uninstall_list = l;
}
Пример #25
0
Файл: hw_pal.c Проект: 5kg/gdb
static void *
hw_pal_create(const char *name,
	      const device_unit *unit_address,
	      const char *args)
{
  /* create the descriptor */
  hw_pal_device *hw_pal = ZALLOC(hw_pal_device);
  hw_pal->output.status = 1;
  hw_pal->output.buffer = '\0';
  hw_pal->input.status = 0;
  hw_pal->input.buffer = '\0';
  return hw_pal;
}
Пример #26
0
insn_table *
load_insn_table(const char *file_name,
		decode_table *decode_rules,
		filter *filters)
{
  table *file = table_open(file_name, nr_insn_table_fields, nr_insn_model_table_fields);
  insn_table *table = ZALLOC(insn_table);
  table_entry *file_entry;
  table->opcode_rule = decode_rules;

  while ((file_entry = table_entry_read(file)) != NULL) {
    if (it_is("function", file_entry->fields[insn_flags])
	|| it_is("internal", file_entry->fields[insn_flags])) {
      insn_table_insert_function(table, file_entry);
    }
    else if (it_is("model", file_entry->fields[insn_flags])) {
      model_table_insert(table, file_entry);
    }
    else if (it_is("model-macro", file_entry->fields[insn_flags])) {
      model_table_insert_specific(table, file_entry, &model_macros, &last_model_macro);
    }
    else if (it_is("model-function", file_entry->fields[insn_flags])) {
      model_table_insert_specific(table, file_entry, &model_functions, &last_model_function);
    }
    else if (it_is("model-internal", file_entry->fields[insn_flags])) {
      model_table_insert_specific(table, file_entry, &model_internal, &last_model_internal);
    }
    else if (it_is("model-static", file_entry->fields[insn_flags])) {
      model_table_insert_specific(table, file_entry, &model_static, &last_model_static);
    }
    else if (it_is("model-data", file_entry->fields[insn_flags])) {
      model_table_insert_specific(table, file_entry, &model_data, &last_model_data);
    }
    else {
      insn_fields *fields;
      /* skip instructions that aren't relevant to the mode */
      if (is_filtered_out(file_entry->fields[insn_flags], filters)) {
	fprintf(stderr, "Dropping %s - %s\n",
		file_entry->fields[insn_name],
		file_entry->fields[insn_flags]);
      }
      else {
	/* create/insert the new instruction */
	fields = parse_insn_format(file_entry,
				   file_entry->fields[insn_format]);
	insn_table_insert_insn(table, file_entry, fields);
      }
    }
  }
  return table;
}
Пример #27
0
nitro_sockopt_t *nitro_sockopt_new() {
    nitro_sockopt_t *opt;
    ZALLOC(opt);

    /* defaults (otherwise, 0) */
    opt->ident = malloc(SOCKET_IDENT_LENGTH);
    opt->ident_buf = nitro_counted_buffer_new(opt->ident, just_free, NULL);
    opt->close_linger = 1.0;
    opt->reconnect_interval = 0.2; /* seconds */
    opt->max_message_size = 16 * NITRO_MB;

    opt->error_handler = nitro_error_log_handler;
    return opt;
}
Пример #28
0
static void
model_table_insert_specific(insn_table *table,
			    table_entry *file_entry,
			    insn **start_ptr,
			    insn **end_ptr)
{
  insn *ptr = ZALLOC(insn);
  ptr->file_entry = file_entry;
  if (*end_ptr)
    (*end_ptr)->next = ptr;
  else
    (*start_ptr) = ptr;
  (*end_ptr) = ptr;
}
Пример #29
0
static device_instance *
hw_eeprom_create_instance(device *me,
			  const char *path,
			  const char *args)
{
  hw_eeprom_device *eeprom = device_data(me);
  hw_eeprom_instance *data = ZALLOC(hw_eeprom_instance);
  data->eeprom = eeprom;
  data->me = me;
  return device_create_instance_from(me, NULL,
				     data,
				     path, args,
				     &hw_eeprom_instance_callbacks);
}
Пример #30
0
Файл: ut.c Проект: Neuvenen/nvml
/*
 * open_file_add -- add an open file to the lut
 */
static struct fd_lut *
open_file_add(struct fd_lut *root, int fdnum, const char *fdfile)
{
	if (root == NULL) {
		root = ZALLOC(sizeof (*root));
		root->fdnum = fdnum;
		root->fdfile = STRDUP(fdfile);
	} else if (root->fdnum == fdnum)
		FATAL("duplicate fdnum: %d", fdnum);
	else if (root->fdnum < fdnum)
		root->left = open_file_add(root->left, fdnum, fdfile);
	else
		root->right = open_file_add(root->right, fdnum, fdfile);
	return root;
}