int rdbi_col_actW( rdbi_context_def *context, const wchar_t *owner, const wchar_t *object_name, const wchar_t *dbaselink ) { int status; int tran_begun = FALSE; debug_on2("rdbi_col_actW", "owner='%ls', object='%ls'", ISNULL(owner), ISNULL(object_name)); if (context->rdbi_cnct->autocommit_on) { rdbi_tran_begin(context, tran_id); tran_begun = TRUE; } status = (*(context->dispatch.col_actW))(context->drvr, owner, object_name, dbaselink); context->rdbi_last_status = status; /* ingdr_col_act prefetches all columns so its safe to end the transaction * here without getting fetch across commit problems. */ if ( tran_begun ) { rdbi_tran_end(context, tran_id); } debug_return(NULL, status); }
char * get_refresh( char * line ) { char * ret = NULL; char * ptr = NULL; char * tmp = NULL; if ( ISNULL(line) ) return NULL; if ( (tmp = ptr = xstrdup(line)) && (ptr = xstrstr( ptr, REFRESH )) ) { if ( (ptr = xstrstr( ptr, URLTAG )) ) { if ( (ptr += strlen(URLTAG)) ) { NEXTFIELD( ptr ); if ( ptr ) TRUNC( ptr, "\"' >\r\n"); if ( !ISNULL(ptr) ) ret = xstrdup( ptr ); } } xfree( tmp ); } return( ret ); }
int rdbi_col_getW( rdbi_context_def *context, wchar_t *column_name, wchar_t *type, int *length, int *scale, int *nullable, int *is_autoincrement, int *position, int *eof) { int status; debug_on("rdbi_col_getW"); status = (*(context->dispatch.col_getW))(context->drvr, column_name, type, length, scale, nullable, is_autoincrement, position, eof); context->rdbi_last_status = status; debug_area() { if (*eof) { debug0("eof=TRUE"); } else { debug6("column='%ls', type='%ls', length=%d, scale=%d, nullable=%s, position=%d", ISNULL(column_name), ISNULL(type), *length, *scale, ISTRUE(*nullable), *position); } } debug_return(NULL, status); }
void bst_help_marked(node_t* pred, operation_t* pred_op, node_t* curr/*, node_t* root*/){ //fprintf(stderr, "bst help marked\n"); node_t* new_ref; if (ISNULL(curr->left)) { if (ISNULL(curr->right)) { new_ref = (node_t*)SETNULL(curr); } else { new_ref = curr->right; } } else { new_ref = curr->left; } // allocate memory // operation_t* cas_op = new child_cas_op(curr==pred->left, curr, new_ref); operation_t* cas_op = (operation_t*) ssalloc_alloc(1, sizeof(operation_t)); cas_op->child_cas_op.is_left = (curr == pred->left); cas_op->child_cas_op.expected = curr; cas_op->child_cas_op.update = new_ref; // fprintf(stderr, "cas_op address: %p, is_left address: %p, expected addr: %p, update addr: %p\n", (unsigned long)cas_op, &(cas_op->child_cas_op.is_left), &(cas_op->child_cas_op.expected), &(cas_op->child_cas_op.update) // ); if (CAS_PTR(&(pred->op), pred_op, FLAG(cas_op, STATE_OP_CHILDCAS)) == pred_op) { bst_help_child_cas(cas_op, pred/*, root*/); } }
/** * @brief Update a user contact entry in the database. * @param contactnum the numerical id of the contact entry to be modified. * @param usernum the numerical id of the user to whom the specified contact entry belongs. * @param cur_folder the numerical id of the parent contact containing the specified contact entry. * @param target_folder if not 0, sets the new parent contact folder to which the specified contact entry will belong. * @param name if not NULL, sets the new name of the specified contact entry. * @return -1 on error, 0 if the specified contact entry was not found in the database, or 1 if the contact entry was successfully updated. */ int_t contact_update(uint64_t contactnum, uint64_t usernum, uint64_t cur_folder, uint64_t target_folder, stringer_t *name) { int64_t affected; MYSQL_BIND parameters[5]; mm_wipe(parameters, sizeof(parameters)); // Destination Folder if (target_folder) { parameters[0].buffer_type = MYSQL_TYPE_LONGLONG; parameters[0].buffer_length = sizeof(uint64_t); parameters[0].buffer = &target_folder; parameters[0].is_unsigned = true; } else { parameters[0].buffer_type = MYSQL_TYPE_LONGLONG; parameters[0].is_null = ISNULL(true); } // Name if (!st_empty(name)) { parameters[1].buffer_type = MYSQL_TYPE_STRING; parameters[1].buffer_length = st_length_get(name); parameters[1].buffer = st_char_get(name); } else { parameters[1].buffer_type = MYSQL_TYPE_LONGLONG; parameters[1].is_null = ISNULL(true); } // Contact Number parameters[2].buffer_type = MYSQL_TYPE_LONGLONG; parameters[2].buffer_length = sizeof(uint64_t); parameters[2].buffer = &contactnum; parameters[2].is_unsigned = true; // User Number parameters[3].buffer_type = MYSQL_TYPE_LONGLONG; parameters[3].buffer_length = sizeof(uint64_t); parameters[3].buffer = &usernum; parameters[3].is_unsigned = true; // Current Folder parameters[4].buffer_type = MYSQL_TYPE_LONGLONG; parameters[4].buffer_length = sizeof(uint64_t); parameters[4].buffer = &cur_folder; parameters[4].is_unsigned = true; // Since the updated column is always updated this function should only return 0 if the query doesn't match any rows, otherwise 1 to indicate success. if ((affected = stmt_exec_affected(stmts.update_contact, parameters)) == -1) { log_pedantic("The contact entry update triggered an error. { usernum = %lu / foldernum = %lu / contact = %lu }", usernum, cur_folder, contactnum); return -1; } log_check(affected > 2); return (int_t)affected; }
bool_t bst_remove(bst_key_t k, node_t* root, int id){ //fprintf(stderr, "bst remove\n"); // node_t* pred; // node_t* curr; node_t* replace = NULL; // operation_t* pred_op; // operation_t* curr_op; operation_t* replace_op = NULL; operation_t* reloc_op = NULL; bst_search_result_t* my_result; while(TRUE) { //root is now a global pointer to a node, not a node my_result = bst_find(k, /*&pred, &pred_op, &curr, &curr_op,*/ root, root, id); if (my_result->result != FOUND) { return FALSE; } if (ISNULL(my_result->curr->right) || ISNULL(my_result->curr->left)) { // node has less than two children if (CAS_PTR(&(my_result->curr->op), my_result->curr_op, FLAG(my_result->curr_op, STATE_OP_MARK)) == my_result->curr_op) { bst_help_marked(my_result->pred, my_result->pred_op, my_result->curr/*, root*/); return TRUE; } } else { // node has two children node_t* curr = my_result->curr; my_search_result[id]->pred = my_result->pred; my_search_result[id]->pred_op = my_result->pred_op; my_search_result[id]->curr = replace; my_search_result[id]->curr_op = replace_op; // my_result = bst_find(k, &pred, &pred_op, &replace, &replace_op, curr, root, id); my_result = bst_find(k, curr, root, id); if ((my_result->result == ABORT) || (my_result->curr->op != my_result->curr_op)) { continue; } //allocate memory //reloc_op = new RelocateOP(curr, curr_op, k, replace->key); reloc_op = (operation_t*) ssalloc_alloc(1, sizeof(operation_t)); reloc_op->relocate_op.state = STATE_OP_ONGOING; reloc_op->relocate_op.dest = my_result->curr; reloc_op->relocate_op.dest_op = my_result->curr_op; reloc_op->relocate_op.remove_key = k; reloc_op->relocate_op.replace_key = replace->key; // fprintf(stderr, "reloc_op address: %p, state address: %p, dest addr: %p, dest_op addr: %p, remove_key addr: %p, replace_key addr: %p \n", (unsigned long)reloc_op, &(reloc_op->relocate_op.state), &(reloc_op->relocate_op.dest), &(reloc_op->relocate_op.dest_op), &(reloc_op->relocate_op.remove_key), &(reloc_op->relocate_op.replace_key) // ); if (CAS_PTR(&(replace->op), replace_op, FLAG(reloc_op, STATE_OP_RELOCATE)) == replace_op) { if (bst_help_relocate(reloc_op, my_result->pred, my_result->pred_op, replace/*, root*/)) { return TRUE; } } } } }
HFS_STATUS hfsQueueItem(PHFS_QUEUE_PROCESSOR pQueueProcessor, PHFS_QUEUE_ITEM pQueueItem) { HFS_STATUS ret=HFS_STATUS_SUCCESS; HFS_ENTRY(hfsQueueItem); if (ISNULL(pQueueItem) || ISNULL(pQueueProcessor)) { ret = HFS_STATUS_PRE_CONDITION_FAILS; goto leave; } if (!list_empty(&pQueueItem->listHead)) { HFS_LOG_ERROR("Item %p is alread on some list", pQueueItem); ret = HFS_STATUS_PRE_CONDITION_FAILS; goto leave; } if (QUEUE_STATE_STARTED!=hfsQueueGetState(pQueueProcessor)) { HFS_LOG_ERROR("Queue Not started cannot insert elements now %p", pQueueProcessor); ret = HFS_STATUS_QUEUE_NOT_STARTED; goto leave; } //- Lock the Queue -// ret = hfsMutexLock(&pQueueProcessor->queueLock); if (!HFS_SUCCESS(ret)) { ret = HFS_STATUS_LOCKING_ERROR; goto leave; } //- Insert the element -// list_add_tail(&pQueueItem->listHead, &pQueueProcessor->lstAnchorPendingCmds); ret = hfsSempost(&pQueueProcessor->semPendingItems); if (ret) { HFS_LOG_ERROR("Queue threads cannot be woken up"); ret = HFS_INTERNAL_ERROR; goto removeItem; } ret = HFS_STATUS_SUCCESS; goto unlock; //- Cleanups -// removeItem: list_del_init(&pQueueItem->listHead); unlock: //- Unlock the Queue -// hfsMutexUnlock(&pQueueProcessor->queueLock); leave: HFS_LEAVE(hfsQueueItem); return ret; }
Traits *DomainObject::getTraits (Atom a) { if (ISNULL(a)) { return core()->traits.null_itraits; } if (a == kSpecialType) { return core()->traits.void_itraits; } switch (a & 7) { case kObjectType: return AvmCore::atomToScriptObject(a)->traits(); case kNamespaceType: return core()->traits.namespace_itraits; case kStringType: return core()->traits.string_itraits; case kBooleanType: return core()->traits.boolean_itraits; case kIntegerType: return core()->traits.int_itraits; case kDoubleType: return core()->traits.number_itraits; } toplevel()->throwArgumentError(kNotImplementedError, core()->toErrorString("value")); return core()->traits.void_itraits; }
BOOL CNameEvent::Wait() { assert(ISNOTNULL(m_hEvent)); if (ISNULL(m_hEvent)) { DOLOG("can't wait null event handle!"); return FALSE; } DWORD retCode = 0; retCode = WaitForSingleObject(m_hEvent, BLOCKOUTTIMEMSEC); BOOL isOK = FALSE; switch (retCode) { case WAIT_FAILED: DOLOG("wait event failed! " + GetLastError()); isOK = FALSE; break; case WAIT_OBJECT_0: isOK = TRUE; break; case WAIT_TIMEOUT: DOLOG(" waitforSingleObject Timeout !"); isOK = FALSE; default: DOLOG("waitforSingleObject unknown conidtion ! " + GetLastError()); isOK = FALSE; }; return isOK; }
/* * write the stager config to an alternate location and skip verification. */ int dump_stager_cfg( const stager_cfg_t *cfg, /* cfg to dump */ const char *location) /* location at which to write the file */ { int err = 0; Trace(TR_FILES, "dump stager cfg to %s", location ? location : "NULL"); if (ISNULL(cfg, location)) { Trace(TR_OPRMSG, "dump stager cfg failed: %s", samerrmsg); return (-1); } if (strcmp(location, STAGE_CFG) == 0) { samerrno = SE_INVALID_DUMP_LOCATION; /* Cannot dump the file to %s */ snprintf(samerrmsg, MAX_MSG_LEN, GetCustMsg(SE_INVALID_DUMP_LOCATION), location); Trace(TR_OPRMSG, "dump stager cfg failed: %s", samerrmsg); return (-1); } err = write_stager_cmd(location, cfg); Trace(TR_OPRMSG, "dumped stager cfg"); return (err); }
BOOL fInsertTabItem(HWND hTab, WCHAR *pszText, __out int *piNewIndex, __out DWORD *pdwErrCode) { ASSERT(hTab); int nTabs; int iNewIndex; TCITEM tcItem; // First, get the number of items(pages) already in tab nTabs = SendMessage(hTab, TCM_GETITEMCOUNT, 0, 0); // Setup the TCITEM structure ZeroMemory(&tcItem, sizeof(TCITEM)); if(!ISNULL(pszText)) { tcItem.mask = TCIF_TEXT; tcItem.pszText = pszText; } // Insert the item iNewIndex = SendMessage(hTab, TCM_INSERTITEM, nTabs + 1, (LPARAM)&tcItem); if(iNewIndex == -1) { SET_ERRORCODE_PTR(pdwErrCode); return FALSE; } if(piNewIndex) { *piNewIndex = iNewIndex; } return TRUE; }
BOOL fCreateMainTabControl(HWND hMainWnd, __out HWND *phTabControl, DWORD *pdwErrCode) { ASSERT(ISVALID_HANDLE(hMainWnd)); ASSERT(phTabControl); ASSERT(pdwErrCode); RECT rcClientArea; HWND hTab = NULL; if(!GetClientRect(hMainWnd, &rcClientArea)) { // todo: log error goto error_return; } hTab = CreateWindow(WC_TABCONTROL, NULL, WS_CHILD|WS_VISIBLE|WS_BORDER, rcClientArea.left + 5, rcClientArea.top + 5, rcClientArea.right - 10, rcClientArea.bottom - 10, hMainWnd, (HMENU)IDC_MAINTAB, g_hMainInstance, NULL); if(ISNULL(hTab)) { // todo: log error goto error_return; } *phTabControl = hTab; return TRUE; error_return: *pdwErrCode = GetLastError(); return FALSE; }
/** ** checks for redirect and returns location value **/ char * redirect_get_location( const char * header ) { char * ret = NULL ; char * ptr = NULL ; char * tmp = NULL ; if ( ISNULL( header ) ) return NULL; if ( (tmp = xstrdup( header )) ) ptr = strstr( tmp, "Location: " ); if ( ptr ) { ptr += strlen( "Location: " ); NEXTFIELD( ptr ); if ( ptr ) { TRUNC( ptr, " \t\r\n" ); if ( *ptr ) ret = xstrdup(ptr); } } xfree( tmp ); return ret; }
unsigned short url_get_port( const char * url ) { char * tmp = NULL; char * ptr = NULL; unsigned short port = 80; if ( ISNULL(url) ) return port; if ( (tmp = xstrdup( url )) ) ptr = strstr( tmp, "://" ); if ( ptr ) { char * slash = NULL; ptr += strlen( "://" ); if ( ptr ) slash = strchr( ptr, '/' ); if ( slash ) { char * colon; *slash = 0; colon = strchr( ptr, ':' ); if ( colon++ ) { port = (unsigned short)atoi( colon ); debug( "URL port: %s\n", ptr ); } } } xfree( tmp ); return port; }
/* * Function to update the job struct when a host has been called * asynchronously and did not return an error on the initial call. * Note: this function is in job_control because it needs access to the * samrlock mutex. */ int calling_host(char *job_id, char *host, int host_num) { samrthread_t *ptr; dispatch_job_t *dj; if (ISNULL(job_id, host)) { Trace(TR_ERR, "failed to find the job: %d %s", samerrno, samerrmsg); return (-1); } Trace(TR_MISC, "updating dispatch job %s with response from %s", job_id, host); pthread_mutex_lock(samrlock); /* ++ LOCK samrtlist */ ptr = find_this_activity(job_id); /* If we didn't find the job, return an error */ if (ptr == NULL) { pthread_mutex_unlock(samrlock); /* ++ UNLOCK */ samrerr(SE_NO_SUCH_ACTIVITY, job_id); Trace(TR_ERR, "failed to find the job: %d %s", samerrno, samerrmsg); return (-1); } if (ptr->type != SAMA_DISPATCH_JOB) { pthread_mutex_unlock(samrlock); /* ++ UNLOCK */ setsamerr(SE_INVALID_ACTIVITY_TYPE); Trace(TR_ERR, "failed to find the job: %d %s", samerrno, samerrmsg); return (-1); } dj = (dispatch_job_t *)ptr->args->db.job; if (host_num >= dj->host_count) { pthread_mutex_unlock(samrlock); /* ++ UNLOCK */ setsamerr(SE_INVALID_HOST_ID_IN_RESPONSE); Trace(TR_ERR, "Host number outside of range"); return (-1); } dj->hosts_called++; /* * Only upgrade the status if a higher status has not been set. * Otherwise leave it alone since there is no guarantee that host_called * will be executed prior to receiving an asychronous response. */ if (dj->responses[host_num].status == OP_NOT_YET_CALLED) { dj->responses[host_num].status = OP_PENDING; } if (dj->overall_status == DJ_INITIALIZING) { dj->overall_status = DJ_PENDING; } pthread_mutex_unlock(samrlock); /* ++ UNLOCK */ return (0); }
BOOL CNameEvent::Init(LPSTR lpEventName, BOOL bIsCreate) { assert(ISNOTNULL(lpEventName)); if (ISNULL(lpEventName)) { DOLOG("length of Event Name Can't be 0 "); return FALSE; } if (ISZERO(strlen(lpEventName))) { DOLOG("length of Event Name Can't be 0 "); return FALSE; } if (ISNOZERO(strcpy_s(m_cbEventName, _countof(m_cbEventName), lpEventName))) { DOLOG("copy event name failed !"); return FALSE; } if (bIsCreate) { return this->CreateEvent(); } else { return this->OpenEvent(); } }
/* * Get a public key to be used to generate a secret key to * encrypt passwords for the cns_register rpc call * * server_pub_key is a 1024 bit DH public key in a null-terminated hex * string. The lifecycle of this key is the same as the lifecycle of * the fsmgmtd. When fsmgmtd is restarted a new key is generated. * * signature is a digital signature calculated using the mgmt daemon's * private signature key. It should be used along with mgmt daemon's * public signature key by the client to verify that the * server_pub_key is from the daemon prior to trusting the server_pub_key. */ int cns_get_public_key( ctx_t *c, /* ARGSUSED */ char **server_pub_key, crypt_str_t **sig) { unsigned char *buf; int buf_len; int retval; Trace(TR_MISC, "get public key"); if (ISNULL(server_pub_key, sig)) { Trace(TR_ERR, "getting public key failed failed %d %s", samerrno, samerrmsg); return (-1); } *sig = NULL; if ((retval = get_public_key(server_pub_key, &buf, &buf_len)) != 0) { set_registration_error(retval); Trace(TR_ERR, "getting public key failed failed %d %s", samerrno, samerrmsg); return (-1); } *sig = (crypt_str_t *)mallocer(sizeof (crypt_str_t)); if (*sig == NULL) { Trace(TR_ERR, "getting public key failed failed %d %s", samerrno, samerrmsg); return (-1); } (*sig)->str = buf; (*sig)->str_len = buf_len; Trace(TR_MISC, "got public key"); return (0); }
/* * get_all_rl_fs_directives() * Function to get all file system directive of releaser.cmd. */ int get_all_rl_fs_directives( ctx_t *ctx, /* ARGSUSED */ sqm_lst_t **rl_fs_directives) /* must be freed by caller */ { releaser_cfg_t *releaser; Trace(TR_MISC, "get all releaser's file system directives"); *rl_fs_directives = NULL; if (ISNULL(rl_fs_directives)) { Trace(TR_ERR, "%s", samerrmsg); return (-1); } /* * read releaser.cmd file to get all * releaser.cmd information. */ if (read_releaser_cfg(&releaser) != 0) { Trace(TR_ERR, "Read of %s failed with error: %s", releaser_file, samerrmsg); return (-1); } *rl_fs_directives = releaser->rl_fs_dir_list; releaser->rl_fs_dir_list = NULL; free_releaser_cfg(releaser); Trace(TR_MISC, "get all releaser's file system directives success"); return (0); }
/* * Function to create an archive set. The criteria will be added to the * end of any file system for which they are specified. Can not be used to * create a default arch set. This function will fail if the set already * exists. */ int create_arch_set( ctx_t *ctx, /* contains optional dump path */ arch_set_t *set) /* archive set to create */ { int ret_val; arch_set_arg_t arg; samrpc_result_t result; char *func_name = "rpc:create archive set"; char *err_msg; enum clnt_stat stat; PTRACE(2, "%s entry", func_name); CHECK_CLIENT_HANDLE(ctx, func_name); if (ISNULL(set)) { PTRACE(2, "%s exit %s", func_name, samerrmsg); return (-1); } PTRACE(3, " %s calling RPC...", func_name); memset((char *)&result, 0, sizeof (result)); arg.ctx = ctx; arg.set = set; SAMRPC_CLNT_CALL(samrpc_create_arch_set, arch_set_arg_t); CHECK_FUNCTION_FAILURE(result, func_name); ret_val = result.status; PTRACE(2, "%s returning with status [%d]...", func_name, ret_val); PTRACE(2, "%s exit", func_name); return (ret_val); }
static void ldc_set_tile(struct device *device, struct ldc_tile_param_s *tile) { u32 flags, base; dev_dbg(ldc_dev, __FUNCTION__ "E\n"); if (ISNULL((void *)tile)) { dev_err(ldc_dev, "frame config arg ptr is null\n"); return; } spin_lock_irqsave(&ldcdev->lock, flags); /* read/write frame base */ base = (virt_to_phys((void*) tile->frm_params.readbase) - DAVINCI_DDR_BASE) >> 5; ldc_regw(base, DAVINCI_LDC_RD_BASE); base = (virt_to_phys((void*) tile->frm_params.writebase) - DAVINCI_DDR_BASE) >> 5; ldc_regw(base, DAVINCI_LDC_WR_BASE); /* 420C read/write base */ if (ldcdev->ldc_config.mode == LDC_MODE_YC420) { base = (virt_to_phys((void*) tile->frm_params.readbase420c) - DAVINCI_DDR_BASE) >> 5; ldc_regw(base, DAVINCI_LDC_420C_RD_BASE); base = (virt_to_phys((void*) tile->frm_params.writebase420c) - DAVINCI_DDR_BASE) >> 5; ldc_regw(base, DAVINCI_LDC_420C_WR_BASE); }
int imp_get_preview_config(struct device *dev, struct imp_logical_channel *channel, struct prev_channel_config *chan_config) { if (channel->mode == IMP_MODE_INVALID) { dev_err(dev, "Channel mode is not set. \n"); return -EINVAL; } if (channel->mode != chan_config->oper_mode) { dev_err(dev, "mode mis-match, chan mode = %d, config mode = %d\n", channel->mode, chan_config->oper_mode); return -EINVAL; } if (channel->config_state != STATE_CONFIGURED) { dev_err(dev, "channel not configured\n"); return -EINVAL; } if (ISNULL(chan_config->config)) { dev_err(dev, "NULL ptr\n"); return -EINVAL; } if (copy_to_user((void *)chan_config->config, (void *)channel->user_config, channel->user_config_size)) { dev_err(dev, "Error in copy to user\n"); return -EFAULT; } return 0; }
static void ldc_get_affine(struct device *device, struct ldc_affine_param_s *arg) { u32 ret, flags; dev_dbg(ldc_dev, __FUNCTION__ "E\n"); if (ISNULL((void *)arg)) { dev_err(ldc_dev, "frame config arg ptr is null\n"); return; } memset(arg, 0, sizeof(struct ldc_affine_param_s)); spin_lock_irqsave(&ldcdev->lock, flags); ret = ldc_regr(DAVINCI_LDC_AB); arg->affine_a = ret & 0x3FFF; arg->affine_b = (ret >> 16) & 0x3FFF; ret = ldc_regr(DAVINCI_LDC_CD); arg->affine_c = ret & 0xFFFF; arg->affine_d = (ret >> 16) & 0x3FFF; ret = ldc_regr(DAVINCI_LDC_EF); spin_unlock_irqrestore(&ldcdev->lock, flags); arg->affine_e = ret & 0x3FFF; arg->affine_f = (ret >> 16) & 0xFFFF; dev_dbg(ldc_dev, __FUNCTION__ "L\n"); }
static int ldc_set_affine(struct device *device, struct ldc_affine_param_s *arg) { int ret = 0, flags; struct ldc_affine_param_s *aff = &ldcdevice.ldc_affine_param; dev_dbg(ldc_dev, __FUNCTION__ "E\n"); if (ISNULL((void *)arg)) { dev_err(ldc_dev, "frame config arg ptr is null\n"); return 1; } memcpy(aff, arg, sizeof(struct ldc_affine_param_s)); spin_lock_irqsave(&ldcdev->lock, flags); ldc_regw(aff->affine_a, DAVINCI_LDC_AB); ldc_regm(aff->affine_b << LDC_AFFINE_SHIFT, 0x3FFF << LDC_AFFINE_SHIFT, DAVINCI_LDC_AB); ldc_regw(aff->affine_c, DAVINCI_LDC_CD); ldc_regm(aff->affine_d << LDC_AFFINE_SHIFT, 0x3FFF << LDC_AFFINE_SHIFT, DAVINCI_LDC_CD); ldc_regw(aff->affine_e, DAVINCI_LDC_EF); ldc_regm(aff->affine_f << LDC_AFFINE_SHIFT, 0x3FFF << LDC_AFFINE_SHIFT, DAVINCI_LDC_EF); spin_unlock_irqrestore(&ldcdev->lock, flags); dev_dbg(ldc_dev, __FUNCTION__ "L\n"); return ret; }
/* * write the recycler.cmd file to an alternate location without running * verify. */ int dump_recycler_cfg( const recycler_cfg_t *cfg, /* cfg to write */ const char *location) /* location at which to write the cfg */ { int err = 0; Trace(TR_OPRMSG, "dumping recycler cfg %s", Str(location)); if (ISNULL(cfg, location)) { Trace(TR_OPRMSG, "dumping recycler cfg failed: %s", samerrmsg); return (-1); } if (strcmp(location, RECYCLE_CFG) == 0) { samerrno = SE_INVALID_DUMP_LOCATION; /* Cannot dump the file to %s */ snprintf(samerrmsg, MAX_MSG_LEN, GetCustMsg(SE_INVALID_DUMP_LOCATION), location); Trace(TR_OPRMSG, "dumping recycler cfg failed: %s", samerrmsg); return (-1); } err = write_recycler_cmd(location, cfg); Trace(TR_OPRMSG, "dumped recycler cfg"); return (err); }
int vpfe_resizer_init(struct vpfe_resizer_device *vpfe_rsz, struct platform_device *pdev) { struct v4l2_subdev *resizer = &vpfe_rsz->subdev; struct media_pad *pads = &vpfe_rsz->pads[0]; struct media_entity *me = &resizer->entity; struct imp_logical_channel *channel = &vpfe_rsz->channel; int ret; if (cpu_is_davinci_dm365() || cpu_is_davinci_dm355()) { vpfe_rsz->imp_hw_if = imp_get_hw_if(); if (ISNULL(vpfe_rsz->imp_hw_if)) return -1; } else return -1; vpfe_rsz->video_in.ops = &video_in_ops; vpfe_rsz->video_out.ops = &video_out1_ops; /*TODO:enable with rsz-b*/ v4l2_subdev_init(resizer, &resizer_v4l2_ops); strlcpy(resizer->name, "DAVINCI RESIZER", sizeof(resizer->name)); resizer->grp_id = 1 << 16; /* group ID for davinci subdevs */ v4l2_set_subdevdata(resizer, vpfe_rsz); resizer->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; pads[RESIZER_PAD_SINK].flags = MEDIA_PAD_FL_INPUT; pads[RESIZER_PAD_SOURCE].flags = MEDIA_PAD_FL_OUTPUT; vpfe_rsz->input = RESIZER_INPUT_NONE; vpfe_rsz->output = RESIZER_OUTPUT_NONE; channel->type = IMP_RESIZER; channel->config_state = STATE_NOT_CONFIGURED; me->ops = &resizer_media_ops; ret = media_entity_init(me, RESIZER_PADS_NUM, pads, 0); if (ret) return ret; vpfe_rsz->video_in.type = V4L2_BUF_TYPE_VIDEO_OUTPUT; ret = vpfe_video_init(&vpfe_rsz->video_in, "RSZ"); if (ret) { printk(KERN_ERR "failed to init RSZ video-in device\n"); return ret; } vpfe_rsz->video_out.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; ret = vpfe_video_init(&vpfe_rsz->video_out, "RSZ"); if (ret) { printk(KERN_ERR "failed to init RSZ video-out device\n"); return ret; } return 0; }
unsigned long bst_size(node_t* node) { if (ISNULL(node)) { return 0; } else { // fprintf(stderr, "node %p ; left: %p; right: %p\n", node, node->left, node->right); return 1 + bst_size(node->right) + bst_size(node->left); } }
int set_cat(CELL x) { cat = x; if ((isnull = ISNULL(&cat))) cat = 0; return 0; }
int stream_nullable_Object_is_a_Int( nullable_Object value ) { val_t temp; temp = value->ref.val; if ( ISNULL(temp) ) return 0; if ( ! ( ISOBJ( temp ) ? OBJISA( temp, standard___kernel___Int ): VALISA( temp, standard___kernel___Int ) ) ) return 0; return 1; }
bool_t bst_remove(bst_key_t k, node_t* root){ node_t* pred; node_t* curr; node_t* replace; operation_t* pred_op; operation_t* curr_op; operation_t* replace_op; operation_t* reloc_op; while(TRUE) { if (bst_find(k, &pred, &pred_op, &curr, &curr_op, root, root) != FOUND) { return FALSE; } if (ISNULL(curr->right) || ISNULL(curr->left)) { // node has less than two children if (CAS_PTR(&(curr->op), curr_op, FLAG(curr_op, STATE_OP_MARK)) == curr_op) { bst_help_marked(pred, pred_op, curr, root); return TRUE; } } else { // node has two children if ((bst_find(k, &pred, &pred_op, &replace, &replace_op, curr, root) == ABORT) || (curr->op != curr_op)) { continue; } reloc_op = (operation_t*) ssalloc_alloc(1, sizeof(operation_t)); reloc_op->relocate_op.state = STATE_OP_ONGOING; reloc_op->relocate_op.dest = curr; reloc_op->relocate_op.dest_op = curr_op; reloc_op->relocate_op.remove_key = k; reloc_op->relocate_op.replace_key = replace->key; #if defined(__tile__) MEM_BARRIER; #endif if (CAS_PTR(&(replace->op), replace_op, FLAG(reloc_op, STATE_OP_RELOCATE)) == replace_op) { if (bst_help_relocate(reloc_op, pred, pred_op, replace, root)) { return TRUE; } } } } }
char *ft_strchr(const char *s, int c) { ISNULL(s); while (*s && *s != (unsigned char)c) s++; if (c == 0) return ((char *)s); return (*s ? (char *)s : NULL); }