Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Evergreen:11.2
sblim-sfcb
0330-bnc457366B-2441640-mofc_instance_migration...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0330-bnc457366B-2441640-mofc_instance_migration.patch of Package sblim-sfcb
Index: backend_print.c =================================================================== RCS file: /cvsroot/sblim/mofc/backend_print.c,v retrieving revision 1.3 diff -u -r1.3 backend_print.c --- backend_print.c 27 Oct 2006 13:14:21 -0000 1.3 +++ backend_print.c 16 Dec 2008 23:41:28 -0000 @@ -139,6 +139,10 @@ fprintf(f,"Instance %s ",ie -> class_id); fprintf(f,"{\n"); + if (ie->instmig) + fprintf(f, " From Instance Import/Migration\n"); + else + fprintf(f, " From MOF\n"); print_property_chain(f,ie -> class_props); fprintf(f,"}\n"); fprintf(f,"\n"); Index: backend_sfcb.c =================================================================== RCS file: /cvsroot/sblim/mofc/backend_sfcb.c,v retrieving revision 1.19 diff -u -r1.19 backend_sfcb.c --- backend_sfcb.c 28 Aug 2007 08:37:13 -0000 1.19 +++ backend_sfcb.c 16 Dec 2008 23:41:28 -0000 @@ -449,7 +449,11 @@ } path = mofc_getObjectPath(ce, ie, ns); - inst = ClInstanceNew(ns, ie->class_id); + + if (ie->instmig) + inst = ClInstanceNew(ns, ie->class_id); + else + inst = ClInstanceNewFromMof(ns, ie->class_id); while (inst_props) { if (sfcb_options & BACKEND_VERBOSE) { Index: mofc.y =================================================================== RCS file: /cvsroot/sblim/mofc/mofc.y,v retrieving revision 1.6 diff -u -r1.6 mofc.y --- mofc.y 3 Jan 2007 11:44:08 -0000 1.6 +++ mofc.y 16 Dec 2008 23:41:28 -0000 @@ -31,7 +31,7 @@ extern class_chain * cls_chain_current; extern class_chain * inst_chain_current; extern qual_chain * qual_chain_current; - +extern int g_instmig; %} @@ -225,7 +225,7 @@ opt_property_initializer_list '}' ';' { - $$ = make_instance(current_symtab,$1,$4,$7); + $$ = make_instance(current_symtab,$1,$4,$7,g_instmig); add_class_list(cls_chain_current,get_class_def(current_symtab,$4)); } ; Index: mofdecl.h =================================================================== RCS file: /cvsroot/sblim/mofc/mofdecl.h,v retrieving revision 1.2 diff -u -r1.2 mofdecl.h --- mofdecl.h 20 Nov 2005 17:37:05 -0000 1.2 +++ mofdecl.h 16 Dec 2008 23:41:28 -0000 @@ -30,7 +30,7 @@ int yyparse(void); char * upstrdup( const char *, int ); int init_scanner(char * parsefiles[], int numfiles, const char * includedir, - const char * extrafile, int verbose); + const char * extrafile, const char * instmigfile, int verbose); void stop_scanner(void); FILE * try_open_file(const char * filename); extern int line_number; Index: mofparse.c =================================================================== RCS file: /cvsroot/sblim/mofc/mofparse.c,v retrieving revision 1.8 diff -u -r1.8 mofparse.c --- mofparse.c 7 Nov 2008 16:51:36 -0000 1.8 +++ mofparse.c 16 Dec 2008 23:41:29 -0000 @@ -24,6 +24,7 @@ #include <symtab.h> #include <mofdecl.h> #include <sys/stat.h> +#include <stdlib.h> #include "mofc.h" #include "backend.h" #ifdef HAVE_CONFIG_H @@ -42,9 +43,10 @@ static char prefix[3000] = {0}; static char backendopt[300] = {0}; static char namespace[600] = {0}; +static char instmigfile[600] = {0}; static size_t backendopt_used = 0; static char * inclfile = NULL; -static char * valid_options = "b:o:I:i:d:n:hvV"; +static char * valid_options = "b:o:I:i:d:n:m:hvV"; extern class_chain * cls_chain_current; extern class_chain * inst_chain_current; @@ -67,7 +69,7 @@ strncpy(outfile,optarg,sizeof(outfile)); break; case 'n': - strncpy(namespace,optarg,sizeof(outfile)); + strncpy(namespace,optarg,sizeof(namespace)); break; case 'd': strncpy(outdir,optarg,sizeof(outdir)); @@ -91,6 +93,9 @@ case 'i': inclfile = strdup(optarg); break; + case 'm': + strncpy(instmigfile,optarg,sizeof(instmigfile)); + break; default: return -1; } @@ -101,7 +106,7 @@ static void usage(const char * name) { fprintf(stderr,"usage: %s [-hvV] [-I includepath ...] [-i extrafile] [-o outfile] \ -[-b backendopts] [-d outputdirectory] [-n namespace] filename ... \n",name); +[-b backendopts] [-d outputdirectory] [-n namespace] [-m instancefile] filename ... \n",name); } static void version() @@ -123,6 +128,7 @@ printf(" -b backendopts backend options, see backend documentation\n"); printf(" -d output directory (recommended when parsing qualifiers and instances, as this creates more than one file)\n"); printf(" -n target namespace, only needed for instances and qualifiers\n"); + printf(" -m filename file that includes instances for import/migration\n"); } static int error_occured = 0; @@ -187,7 +193,7 @@ strcat(prefix, outfile); } - if (init_scanner(argv+argidx,argc-argidx,inclpath,inclfile,opt_verbose) != 0 ) { + if (init_scanner(argv+argidx,argc-argidx,inclpath,inclfile,instmigfile,opt_verbose) != 0 ) { return 2; } if ( ( yyparse() || error_occured )) { @@ -195,14 +201,22 @@ fprintf( stderr, "error has occured in %s\n", argv[argidx] ); } stop_scanner(); + if (inclfile) + free(inclfile); return 3; } if (backend_ptr(cls_chain_current, inst_chain_current, qual_chain_current, prefix, outdir, namespace, opt_verbose ? BACKEND_VERBOSE : BACKEND_DEFAULT, backendopt) ) { fprintf( stderr, "backend error has occured writing %s\n", outfile ); + stop_scanner(); + if (inclfile) + free(inclfile); + return 4; } stop_scanner(); + if (inclfile) + free(inclfile); return 0; } Index: mofs.l =================================================================== RCS file: /cvsroot/sblim/mofc/mofs.l,v retrieving revision 1.7 diff -u -r1.7 mofs.l --- mofs.l 7 Nov 2008 16:51:36 -0000 1.7 +++ mofs.l 16 Dec 2008 23:41:29 -0000 @@ -78,6 +78,7 @@ char * upyytext; char * includepath = NULL; char * extrainclude = NULL; +int g_instmig = 0; typedef struct file_stack_struct { char * file_name; @@ -88,9 +89,10 @@ #ifndef SCANDEBUG class_chain * file_cls; #endif + int instmig; } file_stack_entry; file_stack_entry *current_file; -void push_file(FILE * file_handle, char * filename, int keep_symtab); +void push_file(FILE * file_handle, char * filename, int keep_symtab, int instmig); void pop_file(); %} @@ -179,7 +181,7 @@ } file_handle = try_open_file( incfilename ); if ( file_handle ) { - push_file( file_handle, incfilename, 0 ); + push_file( file_handle, incfilename, 0, 0 ); } else { fprintf(stderr,"include file %s not found\n", incfilename); @@ -203,6 +205,7 @@ fclose(current_file -> file_handle); } current_file = current_file -> next_file; + g_instmig = current_file -> instmig; file_name = current_file -> file_name; line_number = current_file -> line_number; cls_chain_current = current_file -> file_cls; @@ -222,7 +225,7 @@ */ int init_scanner(char * parsefiles[], int numfiles, const char * includedir, - const char * extrafile, int verbose) + const char * extrafile, const char * instmigfile, int verbose) { FILE * file_handle; int i; @@ -261,20 +264,37 @@ inst_chain_current = calloc(sizeof(class_chain),1); qual_chain_current = calloc(sizeof(qual_chain),1); current_file = NULL; + /* Must push instanceMigration file prior to other files, + so it gets installed last. + This will cause any instances that are in both MOF and static + (ie previous MOF, then modified), the MOF version will be + written first, then the static instance version will be written + after, causing an overwrite, so the static instance wins + */ + if (instmigfile && *instmigfile) { + file_handle = try_open_file( instmigfile ); + if (file_handle) { + push_file(file_handle, (char *)instmigfile,1,1); + } else { + fprintf(stderr,"instance import/migration file %s not found\n", + instmigfile); + return -1; + } + } for (i=numfiles-1; i >=0; i--) { file_handle = fopen(parsefiles[i],"r"); if (file_handle == NULL) { fprintf(stderr,"could not open %s\n",parsefiles[i]); return -1; } - push_file(file_handle,parsefiles[i],1); + push_file(file_handle,parsefiles[i],1,0); } includepath = (char*) includedir; extrainclude = (char*) extrafile; if (extrainclude) { file_handle = try_open_file( extrainclude ); if (file_handle) { - push_file(file_handle, extrainclude,0); + push_file(file_handle, extrainclude,0,0); } else { fprintf(stderr,"extra file %s not found\n", extrainclude); @@ -291,12 +311,13 @@ htdelete( current_symtab ); } -void push_file( FILE *file_handle, char * filename, int keep_symtab ) +void push_file( FILE *file_handle, char * filename, int keep_symtab, int instmig ) { file_stack_entry * fse = calloc( sizeof(file_stack_entry), 1); fse -> file_handle = file_handle; fse -> file_name = strdup( filename ); + fse -> instmig = instmig; fse -> yybuffer = yy_create_buffer( file_handle, YY_BUF_SIZE ); if (current_file) { Index: symtab.c =================================================================== RCS file: /cvsroot/sblim/mofc/symtab.c,v retrieving revision 1.11 diff -u -r1.11 symtab.c --- symtab.c 4 Jan 2007 11:43:08 -0000 1.11 +++ symtab.c 16 Dec 2008 23:41:29 -0000 @@ -391,12 +391,14 @@ class_entry * make_instance( hashentry * he, qual_chain * qu_ch, const char * name, - prop_or_method_list * pom_li) + prop_or_method_list * pom_li, + int instmig) { class_entry * ce = malloc(sizeof(class_entry)); prop_chain * props; ce -> class_id = strdup(name); + ce -> instmig = instmig; if (pom_li) { ce -> class_props = pom_li -> pom_props; } @@ -650,7 +652,7 @@ prop_chain * props = e->class_props; while (props) { - if(strcmp(props->prop_id, prop_id)) + if(strcasecmp(props->prop_id, prop_id)) props = props->prop_next; else return props; Index: symtab.h =================================================================== RCS file: /cvsroot/sblim/mofc/symtab.h,v retrieving revision 1.6 diff -u -r1.6 symtab.h --- symtab.h 3 Jan 2007 11:44:08 -0000 1.6 +++ symtab.h 16 Dec 2008 23:41:29 -0000 @@ -133,7 +133,8 @@ struct class_struct * class_parent; qual_chain * class_quals; prop_chain * class_props; - method_chain * class_methods; + method_chain * class_methods; + int instmig; }; typedef struct symtab_struct { @@ -210,7 +211,8 @@ class_entry * make_instance(hashentry * he, qual_chain * qu_ch, const char * name, - prop_or_method_list * pom_li); + prop_or_method_list * pom_li, + int instmig); prop_chain * check_for_prop(class_entry * e, char * prop_id); int check_for_keys(class_entry * ce, class_entry * ie); class_entry * get_class_def_for_instance(class_entry * ie);
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor