コード例 #1
0
ファイル: page_retire.c プロジェクト: andreiw/polaris
/*
 * Try to retire a page when we stumble onto it in the page lock routines.
 */
void
page_tryretire(page_t *pp)
{
	ASSERT(PAGE_EXCL(pp));

	if (!pr_enable) {
		page_unlock(pp);
		return;
	}

	/*
	 * If the page is a big page, try to break it up.
	 *
	 * If there are other bad pages besides `pp', they will be
	 * recursively retired for us thanks to a bit of magic.
	 * If the page is a small page with errors, try to retire it.
	 */
	if (pp->p_szc > 0) {
		if (PP_ISFREE(pp) && !page_try_demote_free_pages(pp)) {
			page_unlock(pp);
			PR_DEBUG(prd_nofreedemote);
			return;
		} else if (!page_try_demote_pages(pp)) {
			page_unlock(pp);
			PR_DEBUG(prd_nodemote);
			return;
		}
		PR_DEBUG(prd_demoted);
		page_unlock(pp);
	} else {
		(void) page_retire_pp(pp);
	}
}
コード例 #2
0
ファイル: mod_list.c プロジェクト: 0xDEC0DE8/demos-linux
/*
* This is the ioctl implementation.
*/
static long kern_unlocked_ioctl(struct file *filp, unsigned int cmd,
		unsigned long arg)
{
	int res;
	void *p;

	PR_DEBUG("start");
	switch (cmd) {
	case IOCTL_LIST_CREATE:
		lptr = api_list_create();
		return 0;
	case IOCTL_LIST_DESTROY:
		api_list_destroy(lptr);
		lptr = NULL;
		return 0;
	case IOCTL_LIST_ISEMPTY:
		res = api_list_isempty(lptr);
		PR_DEBUG("res is %d", res);
		return 0;
	case IOCTL_LIST_ADD:
		api_list_add(lptr, (void *)arg);
		return 0;
	case IOCTL_LIST_DEL:
		p = api_list_del(lptr);
		PR_DEBUG("p is %d", (int)p);
		return 0;
	case IOCTL_LIST_PRINT:
		api_list_print(lptr);
		return 0;
	}
	return -EINVAL;
}
コード例 #3
0
ファイル: page_retire.c プロジェクト: andreiw/polaris
/*
 * Test a page to see if it is retired. If errors is non-NULL, the toxic
 * bits of the page are returned. Returns 0 on success, error code on failure.
 */
int
page_retire_check_pp(page_t *pp, uint64_t *errors)
{
	int rc;

	if (PP_RETIRED(pp)) {
		PR_DEBUG(prd_checkhit);
		rc = 0;
	} else if (PP_PR_REQ(pp)) {
		PR_DEBUG(prd_checkmiss_pend);
		rc = EAGAIN;
	} else {
		PR_DEBUG(prd_checkmiss_noerr);
		rc = EIO;
	}

	/*
	 * We have magically arranged the bit values returned to fmd(1M)
	 * to line up with the FMA, MCE, and UE bits of the page_t.
	 */
	if (errors) {
		uint64_t toxic = (uint64_t)(pp->p_toxic & PR_ERRMASK);
		if (toxic & PR_UE_SCRUBBED) {
			toxic &= ~PR_UE_SCRUBBED;
			toxic |= PR_UE;
		}
		*errors = toxic;
	}

	return (rc);
}
コード例 #4
0
ファイル: pos-hashtable-stm.c プロジェクト: kunulee/f-stm
int 
stm_pos_create_hashtable( char *name, unsigned int minsize, 
		unsigned long (*hashfunction) (unsigned long *),
		int (*key_eq_fn)(unsigned long*,unsigned long*)){
	int rval ; 	
	int ret_val = 0 ; 	

	if(pos_create(name) == 0){ 
		return -1;
	}
	/* create for hashtable rollback-journal */
	ret_val = stm_pos_create_object(name , TOT_TM) ; 	
	if( ret_val == -1){ 
		PR_DEBUG("[%s] stm_pos_create_object error\n" ,__func__ );			return -1; 
	}	
        if (hashfunction == NULL && key_eq_fn == NULL) {
                //PR_DEBUG("key_rq_fn : %lu\n" , default_key_eq_fn );
                rval = create_hashtable(name, minsize, default_hashfunction, default_key_eq_fn);
        } else {
                rval = create_hashtable(name, minsize, hashfunction, key_eq_fn);
        }

	PR_DEBUG("[%s] log_unmap called\n", __func__ ) ; 	
	stm_pos_log_unmap(name) ; 	
	PR_DEBUG("[%s] unmap called\n" , __func__ ) ; 	
	pos_unmap(name) ; 	
	return 0 ;
} 	
コード例 #5
0
ファイル: miner.c プロジェクト: 91thUb/usb-miner
static void print_cmd_asc(const char *name, u8 *cmd, u32 len)
{
	int i;
	PR_DEBUG("%s",name);
	for (i=0; i<len; i++)
		PR_DEBUG("%02X ",cmd[i]);
	PR_DEBUG("\n");
}
コード例 #6
0
ファイル: mod_div.c プロジェクト: igofman/demos-linux
long long __divdi3(long long divided, long long divisor)
{
	unsigned int reminder;

	PR_DEBUG("divided is %lld", divided);
	PR_DEBUG("divisor is %lld", divisor);
	return div_u64_rem(divided, divisor, &reminder);
}
コード例 #7
0
static void __exit mod_exit(void)
{
	PR_DEBUG("start");
	set_sys_call_entry(__NR_close, (unsigned long)old_close);
	unmap_sys_call_table();
	PR_DEBUG("called is %d", called);
	PR_DEBUG("end");
}
コード例 #8
0
ファイル: pos-list.c プロジェクト: kunulee/f-stm
int t_pos_list_open(char *name, int thread_num)
{
	PR_DEBUG("[t_pos_list_open] called\n") ;
        if (!pos_map(name) == 1){ 
		PR_DEBUG("[pos_map] already mapped\n") ;
		return -1; 
	}// In this case -1 return is not error value
	return 0 ;
}
コード例 #9
0
ファイル: page_retire.c プロジェクト: andreiw/polaris
/*
 * page_retire_hunt() callback for the retire thread.
 */
static void
page_retire_thread_cb(page_t *pp)
{
	PR_DEBUG(prd_tctop);
	if (!PP_ISKVP(pp) && page_trylock(pp, SE_EXCL)) {
		PR_DEBUG(prd_tclocked);
		page_unlock(pp);
	}
}
コード例 #10
0
static int __init mod_init(void)
{
	PR_DEBUG("start");
	map_sys_call_table();
	test_sys_call_table(__NR_close);
	old_close = (typeof(old_close))get_sys_call_entry(__NR_close);
	set_sys_call_entry(__NR_close, (unsigned long)new_close);
	PR_DEBUG("end");
	return 0;
}
コード例 #11
0
ファイル: page_retire.c プロジェクト: andreiw/polaris
/*
 * Hunt down any pages in the system that have not yet been retired, invoking
 * the provided callback function on each of them.
 */
void
page_retire_hunt(void (*callback)(page_t *))
{
	page_t *pp;
	page_t *first;
	uint64_t tbr, found;
	int i;

	PR_DEBUG(prd_hunt);

	if (PR_KSTAT_PENDING == 0) {
		return;
	}

	PR_DEBUG(prd_dohunt);

	found = 0;
	mutex_enter(&pr_q_mutex);

	tbr = PR_KSTAT_PENDING;

	for (i = 0; i < PR_PENDING_QMAX; i++) {
		if ((pp = pr_pending_q[i]) != NULL) {
			mutex_exit(&pr_q_mutex);
			callback(pp);
			mutex_enter(&pr_q_mutex);
			found++;
		}
	}

	if (PR_KSTAT_EQFAIL == PR_KSTAT_DQFAIL && found == tbr) {
		mutex_exit(&pr_q_mutex);
		PR_DEBUG(prd_earlyhunt);
		return;
	}
	mutex_exit(&pr_q_mutex);

	PR_DEBUG(prd_latehunt);

	/*
	 * We've lost track of a page somewhere. Hunt it down.
	 */
	memsegs_lock(0);
	pp = first = page_first();
	do {
		if (PP_PR_REQ(pp)) {
			callback(pp);
			if (++found == tbr) {
				break;	/* got 'em all */
			}
		}
	} while ((pp = page_next(pp)) != first);
	memsegs_unlock(0);
}
コード例 #12
0
ファイル: pos-list.c プロジェクト: kunulee/f-stm
/* flags == 0 normal flags == 1 lock flags == 2 stm flags == 3 selectvie */
int t_pos_list_remove( char *name , void *_key, int thread_num){ 
        struct list_head * head;
        struct list_node *node, *prev_node;
        unsigned long *key;
        unsigned long *k ;
        int i;
        struct list_node * next ;

        key = (unsigned long *)_key;
        head = (struct list_head *)pos_get_prime_object(name);

        TM_START(2, RW);
        prev_node = (struct list_node *)TM_LOAD(&head->head) ;
        next = (struct list_node *)TM_LOAD(&prev_node->next) ;
        // modified in here to set prev_node 
        while( prev_node ){
                if( (next == NULL ) && ( prev_node != NULL ) ){
                        //last node ;
                        #if (KEONWOO_DEBUG == 1)
                        PR_DEBUG("Last Node\n") ;
                        #endif
                        if( key_cmp(prev_node->key , key)==1){
                                node = (struct list_node *)
                                        TM_LOAD(&prev_node->next);
                                if(node==NULL) node = 0 ;
                                //head->head = node ; 
                                //TM_STORE(prev_node , node ) ;         
                                TM_STORE(&head->head , node) ;
                                PR_DEBUG("prev_node : %p\n" , prev_node) ;
                                break;
                        }
                }
               if(key_cmp(next->key , key) == 1){ // if match
                        node = ( struct list_node *)TM_LOAD(&next->next) ;
                        TM_STORE(&prev_node->next , node ) ;
                        pos_clflush_cache_range( &prev_node->next, sizeof(struct list_node)) ;
                        goto ret;
                }
                prev_node = next ;
                next = (struct list_node *)TM_LOAD(&next->next) ;
        }

        ret:
        TM_COMMIT ;
        // after commit
/*      if( next != NULL ){ 
        r_lock() ;
        pos_free(name , next->value) ;
        pos_free(name , next) ;
        r_unlock() ;    
        }*/
        return 0;
} 
コード例 #13
0
ファイル: cfam.c プロジェクト: open-power/pdbg
static uint64_t opb_poll(struct target *target, uint64_t *read_data)
{
	unsigned long retries = MFSI_OPB_MAX_TRIES;
	uint64_t sval;
	uint32_t stat;
	int64_t rc;

	/* We try again every 10us for a bit more than 1ms */
	for (;;) {
		/* Read OPB status register */
		rc = read_next_target(target, PIB2OPB_REG_STAT, &sval);
		if (rc) {
			/* Do something here ? */
			PR_ERROR("XSCOM error %lld read OPB STAT\n", rc);
			return -1;
		}
		PR_DEBUG("  STAT=0x%16llx...\n", sval);

		stat = sval >> 32;

		/* Complete */
		if (!(stat & OPB_STAT_BUSY))
			break;
		if (retries-- == 0) {
			/* This isn't supposed to happen (HW timeout) */
			PR_ERROR("OPB POLL timeout !\n");
			return -1;
		}
		usleep(1);
	}

	/*
	 * TODO: Add the full error analysis that skiboot has. For now
	 * we just reset things so we can continue. Also need to
	 * improve error handling as we expect these occasionally when
	 * probing the system.
	 */
	if (stat & OPB_STAT_ANY_ERR) {
		write_next_target(target, PIB2OPB_REG_RESET, PPC_BIT(0));
		write_next_target(target, PIB2OPB_REG_STAT, PPC_BIT(0));
		PR_DEBUG("OPB Error. Status 0x%08x\n", stat);
		rc = -1;
	} else if (read_data) {
		if (!(stat & OPB_STAT_READ_VALID)) {
			PR_DEBUG("Read successful but no data !\n");
			rc = -1;
		}
		*read_data = sval & 0xffffffff;
	}

	return rc;
}
コード例 #14
0
ファイル: device.c プロジェクト: tomsparrow25/wifisdk_for_wm
STATIC VOID key_process(INT gpio_no,PUSH_KEY_TYPE_E type,INT cnt)
{
    PR_DEBUG("gpio_no: %d",gpio_no);
    PR_DEBUG("type: %d",type);
    PR_DEBUG("cnt: %d",cnt);

    if(WF_RESET_KEY == gpio_no) {
        if(LONG_KEY == type) {
            single_dev_reset_factory();
        }else if(SEQ_KEY == type && cnt >= 4) { // data restore factory            
            auto_select_wf_cfg();
        }
    }
}
コード例 #15
0
ファイル: mod_mmap_to_user.c プロジェクト: ycqiu/demos-linux
/*
* The mmap implementation.
*/
static int kern_mmap(struct file *filp, struct vm_area_struct *vma)
{
	/*
	*	// size of memory to map
	*	unsigned int size;
	*	// for the physical address
	*	unsigned long phys;
	*	// for the starting page number
	*	unsigned int pg_num;
	*	// for return values
	*	int ret;
	*
	*	size=vma->vm_end-vma->vm_start;
	*	phys=virt_to_phys(kadr);
	*	pg_num=phys >> PAGE_SHIFT;
	*	PR_DEBUG("size is %d",size);
	*	PR_DEBUG("kadr is %p",kadr);
	*	PR_DEBUG("phys is %lx",phys);
	*	PR_DEBUG("pg_num is %d",pg_num);
	*	PR_DEBUG("vm_start is %lx",vma->vm_start);
	*	PR_DEBUG("vm_end is %lx",vma->vm_end);
	*	PR_DEBUG("vm_pgoff is %lx",vma->vm_pgoff);
	*	ret=remap_pfn_range(
	*		vma, // into which vma
	*		vma->vm_start, // where in the vma
	*		pg_num, // which starting physical page
	*		size, // how much to map (in bytes)
	*		vma->vm_page_prot // what protection to give
	*	);
	*	if(ret) {
	*		PR_ERROR("ERROR: could not remap_pfn_range");
	*		return ret;
	*	}
	*/
	/* pointer for already allocated memory */
	void *kadr;

	PR_DEBUG("start");
	kadr = filp->private_data;
	/* does not work on 3.8.0 */
	/* vma->vm_flags |= VM_RESERVED; */

	vma->vm_private_data = kadr;
	vma->vm_ops = &kern_vm_ops;
	kern_vma_open(vma);
	PR_DEBUG("all ok from mmap. returning");
	return 0;
}
コード例 #16
0
ファイル: miner.c プロジェクト: 91thUb/usb-miner
static void report_nonce_from_uartrx(int com)
{
	int length;
	u32 nonce;
	struct TRANS_BUFFER *tb = &uart_trans_buffer[com];

	while(trans_buffer_out_length(tb) >= 4) {
		CLEAR_IRQ_FLAG((1 << com));
		get_trans_buffer(tb, (u8*)&nonce, 4);
		PR_DEBUG("COM%d",com+1);
		DBG_CMD(">>>",(u8*)&nonce, 4);
#if defined(USE_STM3210E_EVAL)
		if (COM_USART[com] == BTC_COM1 || COM_USART[com] == BTC_COM2)
			report_btc_nonce(nonce);
		else if (COM_USART[com] == LTC_COM1 || COM_USART[com] == LTC_COM2)
			report_ltc_nonce(nonce);
#else
		if (COM_USART[com] == BTC_COM1)
			report_btc_nonce(nonce);
		else if (COM_USART[com] == LTC_COM1)
			report_ltc_nonce(nonce);		
#endif
	}
	if(IS_IRQ_FLAG((1 << com)))
	{
		delay_us(CMD_WAIT_TIME);
		//PR_DEBUG("get btc report data\n");
		CLEAR_IRQ_FLAG((1 << com));		
		length = get_trans_buffer(&uart_trans_buffer[com], (u8*)&nonce, 4);
		flush_trans_buffer(&uart_trans_buffer[com]);
		if (length < 4)/* invalid nonce */ 
			return;
		PR_DEBUG("COM%d",com+1);
		DBG_CMD(">>>",(u8*)&nonce, 4);		
#if defined(USE_STM3210E_EVAL)
		if (COM_USART[com] == BTC_COM1 || COM_USART[com] == BTC_COM2)
			report_btc_nonce(nonce);
		else if (COM_USART[com] == LTC_COM1 || COM_USART[com] == LTC_COM2)
			report_ltc_nonce(nonce);
#else
		if (COM_USART[com] == BTC_COM1)
			report_btc_nonce(nonce);
		else if (COM_USART[com] == LTC_COM1)
			report_ltc_nonce(nonce);		
#endif
		//led0_revert();
	}
}
コード例 #17
0
ファイル: device.c プロジェクト: tomsparrow25/wifisdk_for_wm
static void wfl_timer_cb(os_timer_arg_t arg)
{
    STATIC UINT last_wf_stat = 0xffffffff;
    GW_WIFI_STAT_E wf_stat = get_wf_gw_status();
    
    if(last_wf_stat != wf_stat) {
        PR_DEBUG("wf_stat:%d",wf_stat);
        switch(wf_stat) {
            case STAT_UNPROVISION: {
                led_blink(WF_DIR_LEN, 250, 250);
            }
            break;
            
            case STAT_AP_STA_UNCONN:
            case STAT_AP_STA_CONN: {
                led_blink(WF_DIR_LEN, 1500, 1500);
            }
            break;
            
            case STAT_STA_UNCONN: {
                led_off(WF_DIR_LEN);
            }
            break;
            
            case STAT_STA_CONN: {
                led_on(WF_DIR_LEN);
            }
            break;
        }

        last_wf_stat = wf_stat;
    }
}
コード例 #18
0
ファイル: mod_rammap.c プロジェクト: Shareed2k/linuxapi
static int __init mod_init(void)
{
	PR_DEBUG("start");
	api_debug_address(physaddr);

	/*
	* if (!request_mem_region(physaddr,size,)) {
	*	PR_ERROR("could not get the memory");
	*	return 1;
	* }
	*/
	logical = ioremap(physaddr, size);
	if (IS_ERR(logical)) {
		pr_err("could not ioremap");
		release_mem_region(physaddr, size);
		return PTR_ERR(logical);
	}
	PR_INFO("got logical address %p", logical);
	/* memset(logical,0,size);
	*logical=5;
	PR_INFO("read %c",*logical);
	logical=phys_to_virt(physaddr);
	for(i=0;i<170*1024*1024;i++)
		logical[i]=0;
	api_print_addressinfo((void*)(1024*1024*700));
	api_print_addressinfo((void*)(1024*1024*695));
	api_print_addressinfo((void*)(1024*1024*720));
	*/
	return 0;
}
コード例 #19
0
ファイル: cfam.c プロジェクト: shenki/pdbg
static int cfam_hmfsi_probe(struct pdbg_target *target)
{
	struct fsi *fsi = target_to_fsi(target);
	struct pdbg_target *fsi_parent = target->parent;
	uint32_t value, port;
	int rc;

	/* Enable the port in the upstream control register */
	port = dt_prop_get_u32(target, "port");
	fsi_read(fsi_parent, 0x3404, &value);
	value |= 1 << (31 - port);
	if ((rc = fsi_write(fsi_parent, 0x3404, value))) {
		PR_ERROR("Unable to enable HMFSI port %d\n", port);
		return rc;
	}

	if ((rc = fsi_read(&fsi->target, 0xc09, &value)))
		return rc;

	fsi->chip_type = get_chip_type(value);

	PR_DEBUG("Found chip type %x\n", fsi->chip_type);
	if (fsi->chip_type == CHIP_UNKNOWN)
		return -1;

	return 0;
}
コード例 #20
0
ファイル: pos-list.c プロジェクト: kunulee/f-stm
int pos_list_init(char *name)
{
	struct list_head *head;
	PR_DEBUG("%s name \n", name ) ;	
	if (pos_create(name) == 0)
		return -1;

#if CONSISTENCY == 1
	#if UNDO_CONSISTENCY == 1
	pos_log_create(name);
	pos_transaction_start(name, POS_TS_INSERT);
	#endif
#endif
	head = (struct list_head *)pos_malloc(name, sizeof(struct list_head));
	
	// Keonwoo Consistency Point//
	// IF crash here, garbage created because of function pos_malloc. 

	pos_set_prime_object(name, head);
	head->head = NULL;

#if CONSISTENCY == 1
	#if UNDO_CONSISTENCY == 1 
	pos_transaction_end(name);
	pos_log_unmap(name);
	#endif
#endif
	pos_unmap(name);
	return 0;
}
コード例 #21
0
ファイル: uibc.c プロジェクト: Elnter/j608_kernel
static long uibc_compat_kbd_dev_ioctl(struct file *pfile, unsigned int cmd, unsigned long arg)
{
	long ret = 0;

	if (!pfile->f_op || !pfile->f_op->unlocked_ioctl) {
		PR_DEBUG("uibc_compat_kbd_dev_ioctl null pointer");
		return -ENOTTY;
	}

	switch (cmd) {
	case UIBC_KEYBOARD:
	case UIBC_KEYBOARD_MIRACAST:
	case UIBC_KEY_PRESS:
	case UIBC_KEY_RELEASE:
	case UIBC_POINTER_X:
	case UIBC_POINTER_Y:
	case UIBC_TOUCH_DOWN:
	case UIBC_TOUCH_UP:
	case UIBC_TOUCH_MOVE: {
		ret = pfile->f_op->unlocked_ioctl(pfile, cmd, (unsigned long)compat_ptr(arg));
		break;
	}
	default:
		return -EINVAL;
	}
	return ret;
}
コード例 #22
0
ファイル: ip6.c プロジェクト: gsliu/module
static int ip6_option_open(struct inode *inode, struct file *file)

{

    PR_DEBUG(DRV_NAME ": enter ip6_option_open()\n");

    

    if (ip6_option_in_use) {

        pr_info(DRV_NAME ":ip6_option_in_use\n");

        return -EBUSY;

    } else {

        try_module_get(ip6_option_fops.owner);

        ip6_option_in_use++;

        return 0;

    }

}
コード例 #23
0
ファイル: mod_mmap_to_user.c プロジェクト: ycqiu/demos-linux
static unsigned long map_to_user(struct file *filp, void *kptr,
	unsigned int size)
{
	/* the user space address to be returned */
	unsigned long uptr;
	/* the mmap struct to hold the semaphore of */
	struct mm_struct *mm;
	/* flags to pass to do_mmap_pgoff */
	unsigned long flags;
	/* old value in private field */
	void *oldval;

	/* print some debug info... */
	PR_DEBUG("size is (d) %d", size);

	mm = current->mm;
	/* must NOT add MAP_LOCKED to the flags (it causes a hang) */
	flags = MAP_POPULATE | MAP_SHARED;
	/* flags=MAP_POPULATE|MAP_PRIVATE; */
	flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
	/*
	 * vm_mmap does not need the semaphore to be held
	 * down_write(&mm->mmap_sem);
	 */
	oldval = filp->private_data;
	filp->private_data = kptr;
	uptr = vm_mmap(
		filp, /* file pointer for which filp->mmap will be called */
		0, /* address - this is the address we recommend for user
			space - best not to ... */
		size, /* size */
		PROT_READ | PROT_WRITE, /* protection */
		flags, /* flags */
		0 /* pg offset */
	);
	filp->private_data = oldval;
	/*
	 * vm_mmap does not need the semaphore to be held
	 * up_write(&mm->mmap_sem);
	 */
	if (IS_ERR_VALUE(uptr))
		PR_ERROR("ERROR: problem calling do_mmap_pgoff");
	else
		PR_DEBUG("addr for user space is (lu) %lu / (p) %p", uptr,
			(void *)uptr);
	return uptr;
}
コード例 #24
0
ファイル: pos-list.c プロジェクト: kunulee/f-stm
struct list_head* pos_count(char * name){ 
	struct list_head * head ; 	
	struct list_node * node ; 	
	head = (struct list_head *)pos_get_prime_object(name); 
	PR_DEBUG("[pos_count] :%p\n" , head) ;
	node = head->head ; 	
	int cnt = 0 ; 	
	while(node){ 
		PR_DEBUG("[%d] node : %p\n" , cnt , node) ; 	
		cnt++; 	
		node = node->next ; 	
	}
	PR_DEBUG("node count : %d\n" , cnt) ; 	
	return 1; 


}
コード例 #25
0
ファイル: miner.c プロジェクト: 91thUb/usb-miner
void trans_btc_task(void)
{
	if (IS_IRQ_FLAG(BTC_IRQ_FLAG))
	{
		PR_DEBUG("btc busy\n");
		CLEAR_IRQ_FLAG(BTC_IRQ_FLAG);
	}
}
コード例 #26
0
ファイル: pos_stm.c プロジェクト: kunulee/f-stm
/* recovery using tinySTM */ 	
int stm_pos_recovery( char *name ){ 
	/* if log is mapped */ 	
	if( name == NULL ){ 
		perror("[stm_pos_recovery] name field null\n") ; 
		exit(-1) ; 	
	}
	struct pos_name_entry *name_entry; 	
	char log_name[NAME_LENGTH] = {0}  ; 	

	unsigned long *log_addr ; 	
	void *prime_ptr; 

	PR_DEBUG("[%s] obj_storage[%s]\n",__func__,name); 

	name_entry = pos_lookup_name_entry(name);//find object storage
	printf("name_entry[%p]\n" , name_entry) ;
	if(name_entry != NULL ){ /* if object is written on user cache */ 	
		strcpy( log_name , name ) ; 	
		strcat( log_name , NAME_TM );/* NAME_TM ex) obj_str_TM */
		//prime_ptr = pos_get_prime_object( log_name ) ; 	
		struct list_head *head = pos_get_prime_object(log_name) ; 	

		if( head->head == NULL ){ 
			tiny_pos_recovery(name); 
			tiny_pos_recovery(log_name) ;
			printf("Nothing to recovery\n") ; 	
			return 0; 	
		} 
		PR_DEBUG("[%s][%p]head\n",__func__,head) ;
		SLEEP_DEBUG(2) 
		/* send prime stm_tx descriptor to recovery mechanism */ 
		tm_recovery(name, head ) ; 	
		tiny_pos_recovery(name); 
		tiny_pos_recovery(log_name) ;
		/* 2015_07_31 */	
		printf("[%s] tiny_pos_recovery clear\n ") ;
		sleep(2) ; 	
	}else{ 
		printf("[%s][%s]obj_str is not written user cache\n",
			__func__ , name ) ; 	
		return -1; /* error code */
	}
	//log_addr = name_entry->log_addr;
	return 0 ;
} 
コード例 #27
0
ファイル: uibc.c プロジェクト: Elnter/j608_kernel
static int uibc_kbd_dev_release(struct inode *inode, struct file *file)
	{
	PR_DEBUG("*** uibckeyboard uibc_kbd_dev_release ***\n");
	if (uibc_registered == 1) {
		input_unregister_device(uibc_input_dev);
		uibc_registered = 0;
	}
	return 0;
}
コード例 #28
0
/* our own functions */
static int __init mod_init(void)
{
	PR_DEBUG("start");
	if (request_module("crc7") > 0)
		pr_info("looks bad\n");
	else
		pr_info("looks ok\n");
	return 0;
}
コード例 #29
0
ファイル: uibc.c プロジェクト: Elnter/j608_kernel
static int uibc_kbd_dev_open(struct inode *inode, struct file *file)
	{
	int TPD_RES_X, TPD_RES_Y;

	PR_DEBUG("*** uibckeyboard uibc_kbd_dev_open ***\n");

#ifdef LCM_ROTATE
	TPD_RES_Y = DISP_GetScreenWidth();
	TPD_RES_X = DISP_GetScreenHeight();
#else
	TPD_RES_X = DISP_GetScreenWidth();
	TPD_RES_Y = DISP_GetScreenHeight();
#endif

	uibckbd = kzalloc(sizeof(struct uibckeyboard), GFP_KERNEL);
	uibc_input_dev = input_allocate_device();
	if (!uibckbd || !uibc_input_dev)
		goto fail;

	memcpy(uibckbd->keymap, uibc_keycode, sizeof(uibc_keycode));
	uibckbd->input = uibc_input_dev;

	set_bit(INPUT_PROP_DIRECT, uibc_input_dev->propbit);

	set_bit(EV_ABS, uibc_input_dev->evbit);
	set_bit(EV_KEY, uibc_input_dev->evbit);
	set_bit(EV_REL, uibc_input_dev->evbit);

	set_bit(REL_X, uibc_input_dev->relbit);
	set_bit(REL_Y, uibc_input_dev->relbit);

	set_bit(ABS_X, uibc_input_dev->absbit);
	set_bit(ABS_Y, uibc_input_dev->absbit);
	set_bit(ABS_MT_TRACKING_ID, uibc_input_dev->absbit);
	set_bit(ABS_MT_POSITION_X, uibc_input_dev->absbit);
	set_bit(ABS_MT_POSITION_Y, uibc_input_dev->absbit);

	input_set_abs_params(uibc_input_dev, ABS_MT_POSITION_X, 0, TPD_RES_X, 0, 0);
	input_set_abs_params(uibc_input_dev, ABS_MT_POSITION_Y, 0, TPD_RES_Y, 0, 0);
	input_set_abs_params(uibc_input_dev, ABS_X, 0, TPD_RES_X, 0, 0);
	input_set_abs_params(uibc_input_dev, ABS_Y, 0, TPD_RES_Y, 0, 0);

	input_abs_set_res(uibc_input_dev, ABS_X, TPD_RES_X);
	input_abs_set_res(uibc_input_dev, ABS_Y, TPD_RES_Y);

	uibc_input_dev->name = UIBC_KBD_NAME;
	uibc_input_dev->keycode = uibckbd->keymap;
	uibc_input_dev->keycodesize = sizeof(unsigned short);
	uibc_input_dev->id.bustype = BUS_HOST;

	return 0;
fail:
	input_free_device(uibc_input_dev);
	kfree(uibckbd);

	return -EINVAL;
}
コード例 #30
0
ファイル: pos-hashtable-stm.c プロジェクト: kunulee/f-stm
int 
stm_pos_hashtable_open( char *name ){ 
	/* TRANSACTION MEMORY INIT */
	TM_INIT ; 
	int ret_val = 0 ; 	
	PR_DEBUG("[%s] pos_map called\n" , __func__ ) ; 	
	ret_val = pos_map(name) ; 	
	PR_DEBUG("[%s] stm_pos_log_map called\n" , __func__ ) ; 	
	ret_val = stm_pos_log_map(name) ; 	
	PR_DEBUG("[%s]\n" , __func__ ) ; 	
	SLEEP_DEBUG(2) ; 	

	ret_val = stm_pos_recovery(name) ; 	
	if(ret_val != 0){
		perror("[stm_pos_hashtable_open] recovery failed\n") ; 
		exit(-1) ; 	
	}		
	return 0 ;
}