玩转xenstore(4)
来源:互联网 发布:手机音乐钢琴软件 编辑:程序博客网 时间:2024/04/28 13:37
4 xenstore事件机制
在xen代码中可以看到以xs_transaction_start开头,xs_transaction_end结尾的代码段,形如:
retry_transaction:
t = xs_transaction_start(ctx->xsh);
……
if (!xs_transaction_end(ctx->xsh, t, 0)) {
if (errno == EAGAIN) {
t = 0;
/*add by c00209220 on 2012-04-20*/
LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "need to retry xenstore transaction for domain %d", *domid);
/*add by c00209220 end*/
goto retry_transaction;
}
上面的就是一个事件机制的实例。那其本质是什么?xenstore事件机制会在xs_transaction_start时建立一个临时数据库,
xenstored_transaction.c中
void do_transaction_start(struct connection *conn, struct buffered_data *in)
{
//记录generation值
trans->generation = generation;
//在xenstore数据库同一目录下创建名为tdb.transID的备份数据库
trans->tdb_name = talloc_asprintf(trans, "%s.%p",
xs_daemon_tdb(), trans);
//将源数据库的内容拷贝到备份的数据库里
trans->tdb = tdb_copy(tdb_context(conn), trans->tdb_name);
在xs_transaction_start和xs_transaction_end代码中间进行对备份数据库的修改动作。
注意:一定要将tran_ID 即t值作为参数传入xs操作,若t对应参数为NULL,则是对源数据库进行操作。
t = xs_transaction_start(ctx->xsh);
xs_rm(ctx->xsh, t, dom_path);
xs_mkdir(ctx->xsh, t, dom_path);
- 玩转xenstore(4)
- 玩转xenstore(1)
- 玩转xenstore(2)
- 玩转xenstore(3)
- 玩转xenstore(5)
- xenstore
- XenStore
- XenStore相关知识(转)
- XenStore相关知识(转)
- 学习xenstore
- XenBus and XenStore
- Xenstore和Xenbus
- Xenstore and Xenbus
- xenbus and xenstore
- XenStore 和 Xenbus
- 玩转Oracle(4)
- Xenstore简介及Xenstore读写机制的研究与实现
- XenStore:使用,结构和原理(3. XenStore启动过程分析)
- 玩转xenstore(3)
- shell中的点命令与source命令详解
- BSSID,SSID,ESSID区别
- android studio的gradle问题
- 学习新技术的10个建议
- 玩转xenstore(4)
- snmp4j资料汇总
- UML中各种关系说明以及举例
- 玩转xenstore(5)
- Android通过HTTP协议实现断点续传下载
- C++中const的作用
- HDU 4335 What is N?
- VS2010 下通过命令建立.dbml文件方法
- Android的通过TCPIP协议实现断点续传上传实现