Exemplo n.º 1
0
int gbIso9660 :: open_file(const char * file)
{
	stream = fopen(file, "rb");

	if(!stream)
		return ERROR_NOT_OPENED;

	//Check the file is at least 0x8000 long
	if(fseek(stream, VOLUME_DESCRIPTOR_START_SECTOR * SECTOR_SIZE, SEEK_SET))
	{
		fclose(stream);
		return ERROR_INVALID;
	};

	//Check the volume descriptor signature
	volume_descriptor vd;
	fread(&vd, sizeof(volume_descriptor), 1, stream);
	if(memcmp(&vd.magic, VOLUME_DESCRIPTOR_SIGNATURE, sizeof(vd.magic)))
	{
		fclose(stream);
		return ERROR_NOT_ISO;
	};

	//Load primary volume descriptor
	if(load_primary_volume_descriptor() != OK)
		return ERROR_PRIMARY_VOLUME_DESCRIPTOR;

	//Create ISO filesystem tree
	delete_main_tree();
	if(create_path_table() != OK)
		return ERROR_PATH_TABLE;

	return OK;
};
Exemplo n.º 2
0
fermion_links_t *
create_fermion_links(int precision, int phases_in, su3_matrix *links) {

    fermion_links_t *fl;
    ks_action_paths *ap, *ap_du0;
    info_t info = INFO_ZERO;
    char myname[] = "create_fermion_links";

    /* Precision for MILC is ignored: use the prevailing precision */

    if(precision != PRECISION)
        if(mynode() == 0)printf("%s: Warning. Precision request replaced by %d\n",
                                    myname, PRECISION);

    if( phases_in != 1) {
        if(mynode() == 0)printf("BOTCH: %s needs phases in\n",myname);
        terminate(1);
    }

    fl = create_fermion_links_t();

    /* Create the path tables */

    /* (We copy the pointers into the fm_ap_links_t objects
       and the responsibility for freeing space is handed over to
       "destroy_fm_ap_links_t") */

    ap = create_path_table();
    if(fl->options.want_du0)
        ap_du0 = create_path_table();
    else
        ap_du0 = NULL;

    make_path_table(ap, ap_du0);

    /* Complete the structure */

    fl->flg = create_milc_fm_links_t(&info, ap, ap_du0, links, &fl->options);


#ifdef FLTIME
    if(mynode()==0)printf("FLTIME: time = %e (asqtad %s) mflops = %e\n",
                              info.final_sec,milc_prec[PRECISION-1],
                              info.final_flop/(1e6*info.final_sec) );
#endif
    return fl;
}