// ----------------------------------------------------------------- // Return file descriptor for opened file gauge_file* r_serial_i(char *filename) { gauge_header *gh; gauge_file *gf; FILE *fp; int byterevflag; char editfilename[513]; /* All nodes set up a gauge file and gauge header structure for reading */ gf = setup_input_gauge_file(filename); gh = gf->header; /* Node 0 alone opens the file and reads the header */ g_sync(); if (this_node == 0) { fp = fopen(filename, "rb"); if (fp == NULL) { /* If this is a partition format SciDAC file the node0 name has an extension ".vol0000". So try again. */ printf("r_serial_i: Node %d can't open file %s, error %d\n", this_node,filename,errno);fflush(stdout); strncpy(editfilename,filename,504); editfilename[504] = '\0'; /* Just in case of truncation */ strcat(editfilename,".vol0000"); printf("r_serial_i: Trying SciDAC partition volume %s\n",editfilename); fp = fopen(editfilename, "rb"); if (fp == NULL) { printf("r_serial_i: Node %d can't open file %s, error %d\n", this_node,editfilename,errno);fflush(stdout);terminate(1); } printf("r_serial_i: Open succeeded\n"); } gf->fp = fp; byterevflag = read_gauge_hdr(gf); } else gf->fp = NULL; /* The other nodes don't know about this file */ // Broadcast the byterevflag and header structure from node0 to all nodes broadcast_bytes((char *)&byterevflag, sizeof(byterevflag)); gf->byterevflag = byterevflag; broadcast_bytes((char *)gh,sizeof(gauge_header)); // No further processing here if this is a SciDAC file if (gh->magic_number == LIME_MAGIC_NO) return gf; // Read site list and broadcast to all nodes read_site_list(gf); return gf; }
/*--------------------------------------------------------------------------*/ static void add_select_download_page( GnomeDruid *wdruid, GdkPixbuf *logo ) { GtkWidget *wvbox; GdkColor druid_bg_color = DRUID_BG_COLOR; GdkColor druid_title_color = DRUID_TITLE_COLOR; GtkWidget *whbox, *wcombo; GList *name_list = NULL; GList *p; Site *site; gb_debug (DEBUG_UPDATE, "START"); download_page = gnome_druid_page_standard_new_with_vals (_("Select download site"), logo, NULL); gnome_druid_page_standard_set_background(GNOME_DRUID_PAGE_STANDARD(download_page), &druid_bg_color); gnome_druid_page_standard_set_logo_background(GNOME_DRUID_PAGE_STANDARD(download_page), &druid_bg_color); gnome_druid_page_standard_set_title_foreground( GNOME_DRUID_PAGE_STANDARD(download_page), &druid_title_color); gnome_druid_append_page( wdruid, GNOME_DRUID_PAGE(download_page) ); wvbox = GNOME_DRUID_PAGE_STANDARD(download_page)->vbox; whbox = gtk_hbox_new( FALSE, 10 ); gtk_container_set_border_width( GTK_CONTAINER(whbox), 20 ); gtk_box_pack_start( GTK_BOX(wvbox), whbox, TRUE, TRUE, 0 ); gtk_box_pack_start( GTK_BOX(whbox), gtk_label_new( _("Download site:") ), FALSE, TRUE, 0 ); if ( site_list == NULL ) { site_list = read_site_list(); } for ( p=site_list; p!= NULL; p=p->next ) { site = (Site *)p->data; name_list = g_list_append( name_list, site->name ); } wcombo = gtk_combo_new(); gtk_combo_set_popdown_strings( GTK_COMBO(wcombo), name_list ); g_list_free( name_list ); name_list = NULL; site_entry = GTK_COMBO(wcombo)->entry; gtk_entry_set_editable( GTK_ENTRY(site_entry), FALSE ); gtk_box_pack_start( GTK_BOX(whbox), wcombo, TRUE, TRUE, 0 ); gb_debug (DEBUG_UPDATE, "END"); }