static int lvchange_tag(struct cmd_context *cmd, struct logical_volume *lv, int arg) { if (!change_tag(cmd, NULL, lv, NULL, arg)) return_0; log_very_verbose("Updating logical volume \"%s\" on disk(s)", lv->name); /* No need to suspend LV for this change */ if (!vg_write(lv->vg) || !vg_commit(lv->vg)) return_0; backup(lv->vg); return 1; }
oop_t primitive_fail ( oop_t selfStringForPrimitive, oop_t rcvr_for_fail, oop_t error_result, oop_t failBlock, oop_t current_activation, oop_t* activation) { assert(is_mark(error_result)); oop_t error_string = change_tag(error_result, mem_tag); oop_t argsp[2] = {error_string, selfStringForPrimitive}; oop_t selfStringForMessage; if (failBlock == badOop) { selfStringForMessage = StringObj::intern("primitiveFailedError:Name:"); *activation = ActivationObj::clone_for_failure(rcvr_for_fail, selfStringForMessage, (oop_t*) argsp, 2, current_activation); } else { rcvr_for_fail = failBlock; selfStringForMessage = StringObj::intern("value:With:"); *activation = ActivationObj::clone_for_failure(rcvr_for_fail, selfStringForMessage, (oop_t*) argsp, 2, current_activation); } return error_result; }
oop_t primitive_fail_string (error_t errorID) { oop_t error_string = ErrorCodes::stringForError(errorID); return change_tag(error_string, mark_tag); }
void scr_gt( void ) { char * p; char * pn; char savetag; int k; int len; char macname[MAC_NAME_LENGTH + 1]; condcode cc; gtentry * wk; gtflags tag_flags; enum { f_add = 1, f_change, f_delete, f_off, f_on, f_print } function; garginit(); // find end of CW /***********************************************************************/ /* isolate tagname or use previous if tagname * */ /***********************************************************************/ cc = getarg(); // Tagname if( cc == omit ) { // no operands tag_name_missing_err(); return; } p = tok_start; if( *p == '*' ) { // single * as tagname if( arg_flen > 1 ) { xx_err( err_tag_name_inv ); return; } savetag = '*'; // remember for possible global delete / print if( GlobalFlags.firstpass && input_cbs->fmflags & II_research ) { if( tag_entry != NULL ) { out_msg(" using tagname %s %s\n", tagname, tag_entry->name ); } } } else { savetag = ' '; // no global function for delete / print init_tag_att(); // forget previous values for quick access attname[0] = '*'; pn = tagname; len = 0; while( *p && is_macro_char( *p ) ) { if( len < TAG_NAME_LENGTH ) { *pn++ = tolower( *p++ );// copy lowercase tagname *pn = '\0'; } else { break; } len++; } for( k = len; k < TAG_NAME_LENGTH; k++ ) { tagname[k] = '\0'; } tagname[TAG_NAME_LENGTH] = '\0'; if( len < arg_flen ) { xx_err( err_tag_name_inv ); return; } } /***********************************************************************/ /* get function operand add, change, ... */ /***********************************************************************/ cc = getarg(); if( cc == omit ) { xx_err( err_tag_func_inv ); return; } p = tok_start; function = 0; switch( tolower( *p ) ) { case 'a': if( !strnicmp( "ADD ", p, 4 ) ) { function = f_add; } break; case 'c' : if( (arg_flen > 2) && (arg_flen < 7) && !strnicmp( "CHANGE", p, arg_flen ) ) { function = f_change; } break; case 'o' : if( !strnicmp( "OFF", p, 3 ) ) { function = f_off; } else { if( !strnicmp( "ON", p, 2 ) ) { function = f_on; } } break; case 'd' : if( (arg_flen > 2) && (arg_flen < 7) && !strnicmp( "DELETE", p, arg_flen ) ) { function = f_delete; } break; case 'p' : if( (arg_flen > 1) && (arg_flen < 6) && !strnicmp( "PRINT", p, arg_flen ) ) { function = f_print; } break; default: // nothing break; } if( function == 0 ) { // no valid function specified xx_err( err_tag_func_inv ); return; } cc = getarg(); // get possible next parm /***********************************************************************/ /* for add and change get macroname */ /***********************************************************************/ if( function == f_add || function == f_change ) { // need macroname if( cc == omit ) { xx_err( err_tag_mac_name ); return; } p = tok_start; pn = macname; len = 0; while( *p && is_macro_char( *p ) ) { if( len < MAC_NAME_LENGTH ) { *pn++ = tolower( *p++ ); // copy lowercase macroname *pn = '\0'; } else { break; } len++; } for( k = len; k < MAC_NAME_LENGTH; k++ ) { macname[k] = '\0'; } macname[MAC_NAME_LENGTH] = '\0'; tag_flags = 0; if( function == f_add ) { // collect tag options cc = scan_tag_options( &tag_flags ); if( cc != omit ) { // not all processed error xx_err( err_tag_opt_inv ); } tag_entry = add_tag( &tag_dict, tagname, macname, tag_flags ); // add to dictionary // if tag_entry is now NULL, error (+ msg) was output in add_tag } else { // is function change tag_entry = change_tag( &tag_dict, tagname, macname ); } } else { /***********************************************************************/ /* after delete, off, on, print nothing allowed */ /***********************************************************************/ if( cc != omit ) { xx_err( err_tag_toomany ); // nothing more allowed } switch( function ) { case f_print : if( savetag == '*' ) { print_tag_dict( tag_dict ); } else { print_tag_entry( find_tag( &tag_dict, tagname ) ); } break; case f_delete : if( savetag == '*' ) { free_tag_dict( &tag_dict ); } else { free_tag( &tag_dict, find_tag( &tag_dict, tagname ) ); } break; case f_off : if( savetag == '*' && tag_entry != NULL ) {// off for last defined tag_entry->tagflags |= tag_off; } else { wk = find_tag( &tag_dict, tagname ); if( wk != NULL ) { wk->tagflags |= tag_off; } } break; case f_on : if( savetag == '*' && tag_entry != NULL ) {// on for last defined tag_entry->tagflags |= tag_off; } else { wk = find_tag( &tag_dict, tagname ); if( wk != NULL ) { wk->tagflags &= ~tag_off; } } break; default: break; } } scan_restart = scan_stop +1; return; }