static krb5_error_code mcc_move(krb5_context context, krb5_ccache from, krb5_ccache to) { krb5_mcache *mfrom = MCACHE(from), *mto = MCACHE(to); struct link *creds; krb5_principal principal; krb5_mcache **n; HEIMDAL_MUTEX_lock(&mcc_mutex); /* drop the from cache from the linked list to avoid lookups */ for(n = &mcc_head; n && *n; n = &(*n)->next) { if(mfrom == *n) { *n = mfrom->next; break; } } /* swap creds */ creds = mto->creds; mto->creds = mfrom->creds; mfrom->creds = creds; /* swap principal */ principal = mto->primary_principal; mto->primary_principal = mfrom->primary_principal; mfrom->primary_principal = principal; HEIMDAL_MUTEX_unlock(&mcc_mutex); mcc_destroy(context, from); return 0; }
static int imx_mcc_test_probe(struct platform_device *pdev) { int ret = 0; MCC_INFO_STRUCT mcc_info; ret = mcc_initialize(MCC_NODE_A9); if (ret) { pr_err("failed to initialize mcc.\n"); ret = -EINVAL; return ret; } ret = mcc_get_info(MCC_NODE_A9, &mcc_info); if (ret) { pr_err("failed to get mcc info.\n"); ret = -EINVAL; goto out_node; } pr_info("\nA9 mcc prepares run, MCC version is %s\n", mcc_info.version_string); if (strcmp(mcc_info.version_string, MCC_VERSION_STRING) != 0) { pr_err("\nError, different versions of the MCC library"); pr_err("is used on each core!\n"); pr_err("\nApplication is stopped now.\n"); ret = -EINVAL; goto out_node; } /* add attributes for device. */ ret = sysfs_create_group(&pdev->dev.kobj, &imx_mcc_attrgroup); if (ret) goto out_node; return ret; out_node: mcc_destroy(MCC_NODE_A9); return ret; }
XYPenPlotterController::XYPenPlotterController(QObject *parent) : QObject(parent) { MCC_INFO_STRUCT info_data; int retval = 0; uint32_t node_num = mqx_endpoint_a5.node; retval = mcc_initialize(node_num); if(retval) { qDebug("Error during mcc_initialize, result = %d", retval); return; } retval = mcc_get_info(node_num, &info_data); if(retval) { qDebug("Error during mcc_get_info, result = %d", retval); return; } qDebug("Plotter app"); qDebug("mcc version: %s", info_data.version_string); retval = mcc_create_endpoint(&mqx_endpoint_a5, mqx_endpoint_a5.port); if(retval) { qDebug("mcc_create_endpoint failes, result = 0x%x", retval); mcc_destroy(node_num); return; } qDebug("Connecting to plotter..."); msg.data = PLOTTER_WELCOME; do { retval = send_msg(&msg); if(retval == MCC_ERR_ENDPOINT) { // Firmware is not loaded!? Load the plotter firmware... qDebug("Loading firmware..."); QProcess *process = new QProcess(this); process->start("mqxboot /var/cache/xyplotter/plotter.bin 0x8f000400 0x0f000411"); process->waitForFinished(); // Wait until its ready... QTime dieTime= QTime::currentTime().addMSecs(100); while( QTime::currentTime() < dieTime ); } } while (retval != MCC_SUCCESS); qDebug("Welocme message sent! Waiting for response..."); if(receive_msg(&rcv_msg, 1000000)) return; if(rcv_msg.status != PLOTTER_WELCOME) { qDebug("Oops! Something went wrong! Plotter response = 0x%x\n", rcv_msg.status); return; } else { qDebug("Greeting received. Connected to ploter!\n"); } qDebug("Homing plotter"); fflush(stdout); msg.data = PLOTTER_HOME; if(send_msg(&msg)) return; timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(receivePlotterMessages())); timer->start(100); }