Changeset - 9a81eb0cca5d
[Not reviewed]
default
0 1 0
LordOfWar - 16 years ago 2009-10-07 12:26:45

created function used to create the xml file that contains the information the slaves will use to process their job
1 file changed with 38 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/server/distrend.c
Show inline comments
 
@@ -36,6 +36,11 @@
 
#include <sys/stat.h>
 
#include <string.h>
 

	
 
#include <libxml/parser.h>
 
#include <libxml/tree.h>
 
#include <libxml/encoding.h>
 
#include <libxml/xmlwriter.h>
 

	
 
/* ******************* Structs ************************ */
 

	
 
// Gets config info from confs
 
@@ -463,6 +468,39 @@ int distrend_config_free(struct distrend
 

	
 
  return 0;
 
}
 
/* ************************** XML Functions ************************* */
 
int makeSlaveDataXML(struct distrenjob *job, char *height, char *width)
 
{
 
  xmlTextWriterPtr writer;
 
  char *path_to_xml;
 

	
 
  _distren_asprintf(&path_to_xml, "stor/job%d/job_info.xml", job->jobnum);
 

	
 
  // create xml document at the location path_to_xml with no compression
 
  writer = xmlNewTextWriterFilename(path_to_xml, 0);
 
  xmlTextWriterStartDocument(writer, NULL, "UTF-8", NULL);
 

	
 
  // write resolution element and add its attributes
 
  xmlTextWriterStartElement(writer, (xmlChar*)"distrenjob");
 
  xmlTextWriterWriteAttribute(writer, (xmlChar*)"name", (xmlChar*)job->name);
 
  xmlTextWriterWriteAttribute(writer, (xmlChar*)"submitter", (xmlChar*)job->submitter);
 
  xmlTextWriterWriteAttribute(writer, (xmlChar*)"priority", (xmlChar*)job->priority);
 

	
 
  // write resolution element and add its attributes
 
  xmlTextWriterStartElement(writer, (xmlChar*)"resolution");
 
  xmlTextWriterWriteAttribute(writer, (xmlChar*)"width", (xmlChar*)height);
 
  xmlTextWriterWriteAttribute(writer, (xmlChar*)"height", (xmlChar*)width);
 
  xmlTextWriterEndElement(writer);
 

	
 
  // end document
 
  xmlTextWriterEndDocument(writer);
 

	
 
  // free writer and save xml file to disk
 
  xmlFreeTextWriter(writer);
 

	
 
  return 1;
 
}
 

	
 
/* ************************** Test Functions ************************* */
 
void printFrameInfo(struct frameset *frame)
 
{
0 comments (0 inline, 0 general)