CIniImpl::CIniImpl() { TRACE_FUN( Routine, "CIniImpl::CIniImpl" ); _registryDriverInfo._name = "TextIni"; _registryDriverInfo._description = "Group settings into ini-format"; _registryDriverInfo._version = config::g_version; _registryDriverInfo._fileName = "l2maxRegIniDrv"; }
static int mt_fsf(int *arg) { int result; TRACE_FUN(ft_t_flow); result = zft_skip_volumes(*arg, &zft_pos); zft_just_before_eof = 0; TRACE_EXIT result; }
int ftape_in_error_state(int status) { TRACE_FUN(ft_t_any); if ((status & QIC_STATUS_READY) && (status & QIC_STATUS_ERROR)) { TRACE_ABORT(1, ft_t_warn, "warning: error status set!"); } TRACE_EXIT 0; }
int zft_verify_write_segments(unsigned int segment, __u8 *data, size_t size, __u8 *buffer) { int result; __u8 *write_buf; __u8 *src_buf; int single; int seg_pos; int seg_sz; int remaining; ft_write_mode_t write_mode; TRACE_FUN(ft_t_flow); seg_pos = segment; seg_sz = zft_get_seg_sz(seg_pos); src_buf = data; single = size <= seg_sz; remaining = size; do { TRACE(ft_t_noise, "\n" KERN_INFO "remaining: %d\n" KERN_INFO "seg_sz : %d\n" KERN_INFO "segment : %d", remaining, seg_sz, seg_pos); if (remaining == seg_sz) { write_buf = src_buf; write_mode = single ? FT_WR_SINGLE : FT_WR_MULTI; remaining = 0; } else if (remaining > seg_sz) { write_buf = src_buf; write_mode = FT_WR_ASYNC; /* don't start tape */ remaining -= seg_sz; } else { /* remaining < seg_sz */ write_buf = buffer; memcpy(write_buf, src_buf, remaining); memset(&write_buf[remaining],'\0',seg_sz-remaining); write_mode = single ? FT_WR_SINGLE : FT_WR_MULTI; remaining = 0; } if ((result = ftape_write_segment(seg_pos, write_buf, write_mode)) != seg_sz) { TRACE(ft_t_err, "Error: " "Couldn't write segment %d", seg_pos); TRACE_EXIT result < 0 ? result : -EIO; /* bail out */ } zft_written_segments ++; seg_sz = zft_get_seg_sz(++seg_pos); src_buf += result; } while (remaining > 0); if (ftape_get_status()->fti_state == writing) { TRACE_CATCH(ftape_loop_until_writes_done(),); TRACE_CATCH(ftape_abort_operation(),); zft_prevent_flush(); }
static int mt_bsf(int *arg) { int result = 0; TRACE_FUN(ft_t_flow); if (*arg != 0) { result = zft_skip_volumes(-*arg + 1, &zft_pos); } TRACE_EXIT result; }
bool CPixmap::load( const unsigned char* data, unsigned int len ) { TRACE_FUN( Frequently, "CPixmap::load( const unsigned char*, unsigned int )" ); bool ret( false ); ret = load( CByteArray( data, len ) ); return ret; }
int update_header_segment(unsigned segment, byte * buffer) { TRACE_FUN(5, "update_header_segment"); int result = 0; int status; if (buffer == NULL) { TRACE(5, "no input buffer specified"); buffer = deblock_buffer; result = read_segment(used_header_segment, buffer, &status, 0); if (bad_sector_map_changed) { store_bad_sector_map(buffer); } if (failed_sector_log_changed) { update_failed_sector_log(buffer); } } if (result >= 0 && GET4(buffer, 0) != 0xaa55aa55) { TRACE(1, "wrong header signature found, aborting"); result = -EIO; } if (result >= 0) { result = _write_segment(segment, buffer, 0); if (result >= 0 && runner_status == idle) { /* Force flush for single segment instead of relying on * flush in read_segment for multiple segments. */ result = start_writing(WRITE_SINGLE); if (result >= 0 && ftape_state == writing) { result = loop_until_writes_done(); prevent_flush(); } } #ifdef VERIFY_HEADERS if (result >= 0) { /* read back and verify */ result = read_segment(segment, scratch_buffer, &status, 0); /* Should retry if soft error during read ! * TO BE IMPLEMENTED */ if (result >= 0) { if (memcmp(buffer, scratch_buffer, sizeof(buffer)) == 0) { result = 0; /* verified */ TRACE(5, "verified"); } else { result = -EIO; /* verify failed */ TRACE(5, "verify failed"); } } } #endif } TRACE_EXIT; return result; }
void ftape_detach_drive(void) { TRACE_FUN(8, "ftape_detach_drive"); TRACE(5, "disabling tape drive and fdc"); ftape_put_drive_to_sleep(drive_type); fdc_catch_stray_interrupts(1); /* one always comes */ fdc_disable(); fdc_release_irq_and_dma(); TRACE_EXIT; }
/* Called by modules package when removing the driver */ void cleanup_module(void) { TRACE_FUN(ft_t_flow); #if defined(CONFIG_PROC_FS) && defined(CONFIG_FT_PROC_FS) ftape_proc_destroy(); #endif (void)ftape_set_nr_buffers(0); printk(KERN_INFO "ftape: unloaded.\n"); TRACE_EXIT; }
CMeter2DGraphView::~CMeter2DGraphView() { TRACE_FUN( Routine, "CMeter2DGraphView::~CMeter2DGraphView" ); killTimer( _timerId ); glDeleteLists( _meshList, 1 ); gluDeleteNurbsRenderer( _nurbsRenderer ); deviceView().mainWindow().menuBarManager().CloseSession( _menuSessionId ); }
static int correct_and_copy_fraction(buffer_struct *buff, __u8 * destination, int start, int size) { struct memory_segment mseg; int result; SectorMap read_bad; TRACE_FUN(ft_t_any); mseg.read_bad = convert_sector_map(buff); mseg.marked_bad = 0; /* not used... */ mseg.blocks = buff->bytes / FT_SECTOR_SIZE; mseg.data = buff->address; /* If there are no data sectors we can skip this segment. */ if (mseg.blocks <= 3) { TRACE_ABORT(0, ft_t_noise, "empty segment"); } read_bad = mseg.read_bad; ft_history.crc_errors += count_ones(read_bad); result = ftape_ecc_correct_data(&mseg); if (read_bad != 0 || mseg.corrected != 0) { TRACE(ft_t_noise, "crc error map: 0x%08lx", (unsigned long)read_bad); TRACE(ft_t_noise, "corrected map: 0x%08lx", (unsigned long)mseg.corrected); ft_history.corrected += count_ones(mseg.corrected); } if (result == ECC_CORRECTED || result == ECC_OK) { if (result == ECC_CORRECTED) { TRACE(ft_t_info, "ecc corrected segment: %d", buff->segment_id); } if(start < 0) { start= 0; } if((start+size) > ((mseg.blocks - 3) * FT_SECTOR_SIZE)) { size = (mseg.blocks - 3) * FT_SECTOR_SIZE - start; } if (size < 0) { size= 0; } if(size > 0) { memcpy(destination + start, mseg.data + start, size); } if ((read_bad ^ mseg.corrected) & mseg.corrected) { /* sectors corrected without crc errors set */ ft_history.crc_failures++; } TRACE_EXIT size; /* (mseg.blocks - 3) * FT_SECTOR_SIZE; */ } else { ft_history.ecc_failures++; TRACE_ABORT(-EAGAIN, ft_t_err, "ecc failure on segment %d", buff->segment_id); } TRACE_EXIT 0; }
/* the compression module has to call this function to hook into the zftape * code */ int zft_cmpr_register(struct zft_cmpr_ops *new_ops) { TRACE_FUN(ft_t_flow); if (zft_cmpr_ops != NULL) { TRACE_EXIT -EBUSY; } else { zft_cmpr_ops = new_ops; TRACE_EXIT 0; } }
void zft_memory_stats(void) { TRACE_FUN(ft_t_flow); TRACE(ft_t_noise, "Memory usage (vmalloc allocations):\n" KERN_INFO "total allocated: %d\n" KERN_INFO "peak allocation: %d", used_memory, peak_memory); peak_memory = used_memory; TRACE_EXIT; }
void CAbstractRegistryDriver::Clear() { TRACE_FUN( Routine, "CAbstractRegistryDriver::Clear" ); WaitForDriverStop(); CMutexLocker locker( synchronization().mutex() ); category()->Clear(); _isModified = false; }
void ftape_detach_drive(void) { TRACE_FUN(ft_t_any); TRACE(ft_t_flow, "disabling tape drive and fdc"); ftape_put_drive_to_sleep(ft_drive_type.wake_up); fdc_catch_stray_interrupts(1); /* one always comes */ fdc_disable(); fdc_release_irq_and_dma(); fdc_release_regions(); TRACE_EXIT; }
CPixmap::CPixmap() { TRACE_FUN( Routine, "CPixmap::CPixmap" ); _png_read_ptr = 0; _png_read_info = 0; _png_write_ptr = 0; _png_write_info = 0; _cachedImage = 0; }
/* Wait for the drive to get ready. * timeout time in milli-seconds * Returned status is valid if result != -EIO * * Should we allow to be killed by SIGINT? (^C) * Would be nice at least for large timeouts. */ int ftape_ready_wait(unsigned int timeout, int *status) { unsigned long t0; unsigned int poll_delay; int signal_retries; TRACE_FUN(ft_t_any); /* the following ** REALLY ** reduces the system load when * e.g. one simply rewinds or retensions. The tape is slow * anyway. It is really not necessary to detect error * conditions with 1/10 seconds granularity * * On my AMD 133MHZ 486: 100 ms: 23% system load * 1 sec: 5% * 5 sec: 0.6%, yeah */ if (timeout <= FT_SECOND) { poll_delay = 100 * FT_MILLISECOND; signal_retries = 20; /* two seconds */ } else if (timeout < 20 * FT_SECOND) { TRACE(ft_t_flow, "setting poll delay to 1 second"); poll_delay = FT_SECOND; signal_retries = 2; /* two seconds */ } else { TRACE(ft_t_flow, "setting poll delay to 5 seconds"); poll_delay = 5 * FT_SECOND; signal_retries = 1; /* five seconds */ } for (;;) { t0 = jiffies; TRACE_CATCH(ftape_report_raw_drive_status(status),); if (*status & QIC_STATUS_READY) { TRACE_EXIT 0; } if (!signal_retries--) { FT_SIGNAL_EXIT(_NEVER_BLOCK); } if ((int)timeout >= 0) { /* this will fail when jiffies wraps around about * once every year :-) */ timeout -= ((jiffies - t0) * FT_SECOND) / HZ; if (timeout <= 0) { TRACE_ABORT(-ETIME, ft_t_err, "timeout"); } ftape_sleep(poll_delay); timeout -= poll_delay; } else { ftape_sleep(poll_delay); } } TRACE_EXIT -ETIME; }
static inline error_cause decode_irq_cause(fdc_mode_enum mode, __u8 st[]) { error_cause cause = no_error; TRACE_FUN(ft_t_any); /* Valid st[], decode cause of interrupt. */ switch (st[0] & ST0_INT_MASK) { case FDC_INT_NORMAL: TRACE(ft_t_fdc_dma,"normal completion: %s",fdc_mode_txt(mode)); break; case FDC_INT_ABNORMAL: TRACE(ft_t_flow, "abnormal completion %s", fdc_mode_txt(mode)); TRACE(ft_t_fdc_dma, "ST0: 0x%02x, ST1: 0x%02x, ST2: 0x%02x", st[0], st[1], st[2]); TRACE(ft_t_fdc_dma, "C: 0x%02x, H: 0x%02x, R: 0x%02x, N: 0x%02x", st[3], st[4], st[5], st[6]); if (st[1] & 0x01) { if (st[2] & 0x01) { cause = data_am_error; } else { cause = id_am_error; } } else if (st[1] & 0x20) { if (st[2] & 0x20) { cause = data_crc_error; } else { cause = id_crc_error; } } else if (st[1] & 0x04) { cause = no_data_error; } else if (st[1] & 0x10) { cause = overrun_error; } print_error_cause(cause); break; case FDC_INT_INVALID: TRACE(ft_t_flow, "invalid completion %s", fdc_mode_txt(mode)); break; case FDC_INT_READYCH: if (st[0] & ST0_SEEK_END) { TRACE(ft_t_flow, "drive poll completed"); } else { TRACE(ft_t_flow, "ready change %s",fdc_mode_txt(mode)); } break; default: break; } TRACE_EXIT cause; }
int loop_until_writes_done(void) { TRACE_FUN(5, "loop_until_writes_done"); int i; int result = 0; /* * Wait until all data is actually written to tape. */ while (ftape_state == writing && buffer[head].status != done) { TRACEx2(7, "tail: %d, head: %d", tail, head); for (i = 0; i < NR_BUFFERS; ++i) { TRACEx3(8, "buffer[ %d] segment_id: %d, status: %d", i, buffer[i].segment_id, buffer[i].status); } result = fdc_interrupt_wait(5 * SECOND); if (result < 0) { TRACE(1, "fdc_interrupt_wait failed"); last_write_failed = 1; break; } if (buffer[head].status == error) { /* Allow escape from loop when signaled ! */ if (current->signal & _DONT_BLOCK) { TRACE(2, "interrupted by signal"); TRACE_EXIT; result = -EINTR; /* is this the right return value ? */ break; } if (buffer[head].hard_error_map != 0) { /* Implement hard write error recovery here */ } buffer[head].status = waiting; /* retry this one */ if (runner_status == aborting) { ftape_dumb_stop(); runner_status = idle; } if (runner_status != idle) { TRACE(1, "unexpected state: runner_status != idle"); result = -EIO; break; } start_writing(WRITE_MULTI); } TRACE(5, "looping until writes done"); result = 0; /* normal exit status */ } TRACE_EXIT; return result; }
unsigned int zft_get_seg_sz(unsigned int segment) { int size; TRACE_FUN(ft_t_any); size = FT_SEGMENT_SIZE - count_ones(ftape_get_bad_sector_entry(segment))*FT_SECTOR_SIZE; if (size > 0) { TRACE_EXIT (unsigned)size; } else { TRACE_EXIT 0; } }
pfnType CLibrary::Resolve( const std::string& anEntry )const { TRACE_FUN( Frequently, "CLibrary::resolve" ); pfnType pfn( 0 ); if( IsLoaded() ) { pfn = reinterpret_cast< pfnType >( GetProcAddress( reinterpret_cast< HMODULE >( _module ), anEntry.c_str() ) ); } return pfn; }
static void skip_bad_sector(buffer_struct * buff) { TRACE_FUN(ft_t_any); /* Mark sector as soft error and skip it */ if (buff->remaining > 0) { ++buff->sector_offset; ++buff->data_offset; --buff->remaining; buff->ptr += FT_SECTOR_SIZE; buff->bad_sector_map >>= 1; } else {
void CMeter2DGraphView::initializeGL() { TRACE_FUN( Routine, "CMeter2DGraphView::initializeGL" ); CAbstractMeterView::initializeGL(); _meshList = glGenLists( 1 ); _nurbsRenderer = gluNewNurbsRenderer(); gluNurbsProperty( _nurbsRenderer, GLU_SAMPLING_TOLERANCE, 5. ); gluNurbsProperty( _nurbsRenderer, GLU_DISPLAY_MODE, GLU_FILL ); }
/* * start formatting a new track. */ int ftape_format_track(const unsigned int track, const __u8 gap3) { unsigned long flags; buffer_struct *tail, *head; int status; TRACE_FUN(ft_t_flow); TRACE_CATCH(ftape_ready_wait(ftape_timeout.pause, &status),); if (track & 1) { if (!(status & QIC_STATUS_AT_EOT)) { TRACE_CATCH(ftape_seek_to_eot(),); } } else {
void CMeter2DGraphView::paintGL() { TRACE_FUN( Frequently, "CMeter2DGraphView::paintGL" ); CAbstractMeterView::paintGL(); if( model()->hasValues() ) { DrawTitles(); DrawMesh(); DrawValueGraph(); } }
bool CLibrary::Load() { TRACE_FUN( Frequently, "CLibrary::Load" ); if( !IsLoaded() ) { CHECK_OBJECT_STATE( _file.size(), "File is not set" ); _module = ::LoadLibrary( _file.c_str() ); } return IsLoaded(); }
bool CPixmap::fromImage( const CImage& img ) { TRACE_FUN( Frequently, "CPixmap::fromImage" ); bool ret( false ); _png_write_ptr = png_create_write_struct( PNG_LIBPNG_VER_STRING, 0, 0, 0 ); if( _png_write_ptr ) { _png_write_info = png_create_info_struct( _png_write_ptr ); if( _png_write_info ) { CByteArray ba; SCallbackContext context; context._data = &ba; context._offset = 0; png_set_write_fn( _png_write_ptr, &context, png_rw_callback, 0 ); png_set_IHDR( _png_write_ptr, _png_write_info, img.width(), img.height(), 8, PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE ); png_write_info( _png_write_ptr, _png_write_info ); png_bytep dstImgRow( new png_byte[ _png_write_info->width * 3 ] ); for( int row( 0 ); row < _png_write_info->height; ++row ) { png_bytep srcImgRow( const_cast< png_bytep >( img.data() ) + row * _png_write_info->width * 4 ); for( int col( 0 ); col < _png_write_info->width; ++col ) { dstImgRow[ col * 3 ] = srcImgRow[ col * 4 + 2]; dstImgRow[ col * 3 + 1 ] = srcImgRow[ col * 4 + 1 ]; dstImgRow[ col * 3 + 2 ] = srcImgRow[ col * 4 ]; } png_write_rows( _png_write_ptr, &dstImgRow, 1 ); } delete dstImgRow; png_write_end( _png_write_ptr, _png_write_info ); ret = load( ba ); } } return ret; }
void zft_ftape_extract_file_marks(__u8* address) { int i; TRACE_FUN(ft_t_any); zft_eof_map = NULL; if (ft_format_code == fmt_var || ft_format_code == fmt_big) { __u8* end; __u8* start = ftape_find_end_of_bsm_list(address); zft_nr_eof_marks = 0; if (start) { start += 3; /* skip end of list mark */ end = find_end_of_eof_list(start, address + FT_SEGMENT_SIZE); if (end && end - start <= FT_FSL_SIZE) { zft_nr_eof_marks = ((end - start) / sizeof(eof_mark_union)); zft_eof_map = (eof_mark_union *)start; } else { TRACE(ft_t_err, "EOF Mark List is too long or damaged!"); } } else { TRACE(ft_t_err, "Bad Sector List is too long or damaged !"); } } else { zft_eof_map = (eof_mark_union *)&address[FT_FSL]; zft_nr_eof_marks = GET2(address, FT_FSL_CNT); } TRACE(ft_t_noise, "number of file marks: %d", zft_nr_eof_marks); if (ftape_fmt_version == 1) { TRACE(ft_t_info, "swapping version 1 fields"); /* version 1 format uses swapped sector and segment * fields, correct that ! */ for (i = 0; i < zft_nr_eof_marks; ++i) { __u16 tmp = GET2(&zft_eof_map[i].mark.segment,0); PUT2(&zft_eof_map[i].mark.segment, 0, GET2(&zft_eof_map[i].mark.date,0)); PUT2(&zft_eof_map[i].mark.date, 0, tmp); } } for (i = 0; i < zft_nr_eof_marks; ++i) { TRACE(ft_t_noise, "eof mark: %5d/%2d", GET2(&zft_eof_map[i].mark.segment, 0), GET2(&zft_eof_map[i].mark.date,0)); } TRACE_EXIT; }
void ftape_log_vendor_id(void) { TRACE_FUN(5, "ftape_log_vendor_id"); int vendor_index; ftape_report_vendor_id(&drive_type.vendor_id); vendor_index = lookup_vendor_id(drive_type.vendor_id); if (drive_type.vendor_id == UNKNOWN_VENDOR && drive_type.wake_up == wake_up_colorado) { vendor_index = 0; drive_type.vendor_id = 0; /* hack to get rid of all this mail */ } if (vendor_index < 0) { /* Unknown vendor id, first time opening device. * The drive_type remains set to type found at wakeup time, this * will probably keep the driver operating for this new vendor. */ TRACE(-1, "============ unknown vendor id ==========="); TRACE(-1, "A new, yet unsupported tape drive is found"); TRACE(-1, "Please report the following values:"); TRACEx1(-1, " Vendor id : 0x%04x", drive_type.vendor_id); TRACEx1(-1, " Wakeup method : %s", methods[drive_type.wake_up].name); TRACE(-1, "And a description of your tape drive to:"); TRACE(-1, "Claus Heine <*****@*****.**>"); TRACE(-1, "=========================================="); drive_type.speed = 500; /* deci-ips: very safe value */ } else { drive_type.name = vendors[vendor_index].name; drive_type.speed = vendors[vendor_index].speed; TRACEx1(3, "tape drive type: %s", drive_type.name); /* scan all methods for this vendor_id in table */ while (drive_type.wake_up != vendors[vendor_index].wake_up) { if (vendor_index < NR_ITEMS(vendors) - 1 && vendors[vendor_index + 1].vendor_id == drive_type.vendor_id) { ++vendor_index; } else { break; } } if (drive_type.wake_up != vendors[vendor_index].wake_up) { TRACE(-1, "=========================================="); TRACE(-1, "wakeup type mismatch:"); TRACEx2(-1, "found: %s, expected: %s", methods[drive_type.wake_up].name, methods[vendors[vendor_index].wake_up].name); TRACE(-1, "please report this to <*****@*****.**>"); TRACE(-1, "=========================================="); } } TRACE_EXIT; }
void zft_clear_ftape_file_marks(void) { TRACE_FUN(ft_t_flow); /* Clear failed sector log: remove all tape marks. We * don't use old ftape-style EOF-marks. */ TRACE(ft_t_info, "Clearing old ftape's eof map"); memset(zft_eof_map, 0, zft_nr_eof_marks * sizeof(__u32)); zft_nr_eof_marks = 0; PUT2(zft_hseg_buf, FT_FSL_CNT, 0); /* nr of eof-marks */ zft_header_changed = 1; zft_update_label(zft_hseg_buf); TRACE_EXIT; }