Exemple #1
0
void dump_disks(struct s_hardware *hardware, ZZJSON_CONFIG *config, ZZJSON **item) {
	bool found=false;

 	if (hardware->disks_count > 0)  
	    for (int drive = 0x80; drive < 0xff; drive++) {
	        if (hardware->disk_info[drive - 0x80].cbios) {
			if (found==false) {
				CREATE_NEW_OBJECT;
				add_b("disks->is_valid",true);
       				found=true;
			}
			show_disk(hardware, config, item, drive);
		}
	}

	if (found==false) {
		CREATE_NEW_OBJECT;
		add_b("disks->is_valid",false);
	}
	FLUSH_OBJECT;
	to_cpio("disks");
}
Exemple #2
0
void dump_cpu(struct s_hardware *hardware, ZZJSON_CONFIG *config, ZZJSON **item) {

        CREATE_NEW_OBJECT;
	add_hs(cpu.vendor);
	add_hs(cpu.model);
	add_hi(cpu.vendor_id);
	add_hi(cpu.family);
	add_hi(cpu.model_id);
	add_hi(cpu.stepping);
	add_hi(cpu.num_cores);
	add_hi(cpu.l1_data_cache_size);
	add_hi(cpu.l1_instruction_cache_size);
	add_hi(cpu.l2_cache_size);
	size_t i;
	for (i = 0; i < cpu_flags_count; i++) {
		char temp[128]={0};
		snprintf(temp,sizeof(temp),"cpu.flags.%s",cpu_flags_names[i]);
		add_b(temp,get_cpu_flag_value_from_name(&hardware->cpu,cpu_flags_names[i]));
	}
	FLUSH_OBJECT;
	to_cpio("cpu");
}
Exemple #3
0
void gen_nnb(t_nextnb *nnb, t_params plist[])
{
    sortable *s;
    int       i, nrbonds, nrf;

    nrbonds = 0;
    for (i = 0; (i < F_NRE); i++)
    {
        if (IS_CHEMBOND(i))
        {
            /* we need every bond twice (bidirectional) */
            nrbonds += 2*plist[i].nr;
        }
    }

    snew(s, nrbonds);

    nrf = 0;
    for (i = 0; (i < F_NRE); i++)
    {
        if (IS_CHEMBOND(i))
        {
            add_b(&plist[i], &nrf, s);
        }
    }

    /* now sort the bonds */
    prints("gen_excl before qsort", nrbonds, s);
    if (nrbonds > 1)
    {
        qsort((void *) s, nrbonds, (size_t)sizeof(sortable), bond_sort);
        prints("gen_excl after qsort", nrbonds, s);
    }

    do_gen(nrbonds, s, nnb);
    sfree(s);
}