Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
3d814731
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
160
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
3d814731
编写于
5月 12, 2011
作者:
K
Konrad Rzeszutek Wilk
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
xen/blkback: Prefix 'vbd' with 'xen' in structs and functions.
Signed-off-by:
N
Konrad Rzeszutek Wilk
<
konrad.wilk@oracle.com
>
上级
30fd1502
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
29 addition
and
29 deletion
+29
-29
drivers/block/xen-blkback/blkback.c
drivers/block/xen-blkback/blkback.c
+10
-10
drivers/block/xen-blkback/common.h
drivers/block/xen-blkback/common.h
+2
-2
drivers/block/xen-blkback/xenbus.c
drivers/block/xen-blkback/xenbus.c
+17
-17
未找到文件。
drivers/block/xen-blkback/blkback.c
浏览文件 @
3d814731
...
@@ -166,10 +166,10 @@ static void free_req(struct pending_req *req)
...
@@ -166,10 +166,10 @@ static void free_req(struct pending_req *req)
/*
/*
* Routines for managing virtual block devices (vbds).
* Routines for managing virtual block devices (vbds).
*/
*/
static
int
vbd_translate
(
struct
phys_req
*
req
,
struct
xen_blkif
*
blkif
,
static
int
xen_
vbd_translate
(
struct
phys_req
*
req
,
struct
xen_blkif
*
blkif
,
int
operation
)
int
operation
)
{
{
struct
vbd
*
vbd
=
&
blkif
->
vbd
;
struct
xen_
vbd
*
vbd
=
&
blkif
->
vbd
;
int
rc
=
-
EACCES
;
int
rc
=
-
EACCES
;
if
((
operation
!=
READ
)
&&
vbd
->
readonly
)
if
((
operation
!=
READ
)
&&
vbd
->
readonly
)
...
@@ -186,9 +186,9 @@ static int vbd_translate(struct phys_req *req, struct xen_blkif *blkif,
...
@@ -186,9 +186,9 @@ static int vbd_translate(struct phys_req *req, struct xen_blkif *blkif,
return
rc
;
return
rc
;
}
}
static
void
vbd_resize
(
struct
xen_blkif
*
blkif
)
static
void
xen_
vbd_resize
(
struct
xen_blkif
*
blkif
)
{
{
struct
vbd
*
vbd
=
&
blkif
->
vbd
;
struct
xen_
vbd
*
vbd
=
&
blkif
->
vbd
;
struct
xenbus_transaction
xbt
;
struct
xenbus_transaction
xbt
;
int
err
;
int
err
;
struct
xenbus_device
*
dev
=
xen_blkbk_xenbus
(
blkif
->
be
);
struct
xenbus_device
*
dev
=
xen_blkbk_xenbus
(
blkif
->
be
);
...
@@ -263,7 +263,7 @@ static void print_stats(struct xen_blkif *blkif)
...
@@ -263,7 +263,7 @@ static void print_stats(struct xen_blkif *blkif)
int
xen_blkif_schedule
(
void
*
arg
)
int
xen_blkif_schedule
(
void
*
arg
)
{
{
struct
xen_blkif
*
blkif
=
arg
;
struct
xen_blkif
*
blkif
=
arg
;
struct
vbd
*
vbd
=
&
blkif
->
vbd
;
struct
xen_
vbd
*
vbd
=
&
blkif
->
vbd
;
xen_blkif_get
(
blkif
);
xen_blkif_get
(
blkif
);
...
@@ -271,7 +271,7 @@ int xen_blkif_schedule(void *arg)
...
@@ -271,7 +271,7 @@ int xen_blkif_schedule(void *arg)
if
(
try_to_freeze
())
if
(
try_to_freeze
())
continue
;
continue
;
if
(
unlikely
(
vbd
->
size
!=
vbd_sz
(
vbd
)))
if
(
unlikely
(
vbd
->
size
!=
vbd_sz
(
vbd
)))
vbd_resize
(
blkif
);
xen_
vbd_resize
(
blkif
);
wait_event_interruptible
(
wait_event_interruptible
(
blkif
->
wq
,
blkif
->
wq
,
...
@@ -538,7 +538,7 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif,
...
@@ -538,7 +538,7 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif,
blkif
->
st_f_req
++
;
blkif
->
st_f_req
++
;
operation
=
WRITE_FLUSH
;
operation
=
WRITE_FLUSH
;
/*
/*
* The frontend likes to set this to -1, which vbd_translate
* The frontend likes to set this to -1, which
xen_
vbd_translate
* is alergic too.
* is alergic too.
*/
*/
req
->
u
.
rw
.
sector_number
=
0
;
req
->
u
.
rw
.
sector_number
=
0
;
...
@@ -580,7 +580,7 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif,
...
@@ -580,7 +580,7 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif,
}
}
if
(
vbd_translate
(
&
preq
,
blkif
,
operation
)
!=
0
)
{
if
(
xen_
vbd_translate
(
&
preq
,
blkif
,
operation
)
!=
0
)
{
pr_debug
(
DRV_PFX
"access denied: %s of [%llu,%llu] on dev=%04x
\n
"
,
pr_debug
(
DRV_PFX
"access denied: %s of [%llu,%llu] on dev=%04x
\n
"
,
operation
==
READ
?
"read"
:
"write"
,
operation
==
READ
?
"read"
:
"write"
,
preq
.
sector_number
,
preq
.
sector_number
,
...
@@ -589,7 +589,7 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif,
...
@@ -589,7 +589,7 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif,
}
}
/*
/*
* This check _MUST_ be done after vbd_translate as the preq.bdev
* This check _MUST_ be done after
xen_
vbd_translate as the preq.bdev
* is set there.
* is set there.
*/
*/
for
(
i
=
0
;
i
<
nseg
;
i
++
)
{
for
(
i
=
0
;
i
<
nseg
;
i
++
)
{
...
...
drivers/block/xen-blkback/common.h
浏览文件 @
3d814731
...
@@ -113,7 +113,7 @@ enum blkif_protocol {
...
@@ -113,7 +113,7 @@ enum blkif_protocol {
BLKIF_PROTOCOL_X86_64
=
3
,
BLKIF_PROTOCOL_X86_64
=
3
,
};
};
struct
vbd
{
struct
xen_
vbd
{
/* What the domain refers to this vbd as. */
/* What the domain refers to this vbd as. */
blkif_vdev_t
handle
;
blkif_vdev_t
handle
;
/* Non-zero -> read-only */
/* Non-zero -> read-only */
...
@@ -141,7 +141,7 @@ struct xen_blkif {
...
@@ -141,7 +141,7 @@ struct xen_blkif {
union
blkif_back_rings
blk_rings
;
union
blkif_back_rings
blk_rings
;
struct
vm_struct
*
blk_ring_area
;
struct
vm_struct
*
blk_ring_area
;
/* The VBD attached to this interface. */
/* The VBD attached to this interface. */
struct
vbd
vbd
;
struct
xen_
vbd
vbd
;
/* Back pointer to the backend_info. */
/* Back pointer to the backend_info. */
struct
backend_info
*
be
;
struct
backend_info
*
be
;
/* Private fields. */
/* Private fields. */
...
...
drivers/block/xen-blkback/xenbus.c
浏览文件 @
3d814731
...
@@ -275,7 +275,7 @@ VBD_SHOW(f_req, "%d\n", be->blkif->st_f_req);
...
@@ -275,7 +275,7 @@ VBD_SHOW(f_req, "%d\n", be->blkif->st_f_req);
VBD_SHOW
(
rd_sect
,
"%d
\n
"
,
be
->
blkif
->
st_rd_sect
);
VBD_SHOW
(
rd_sect
,
"%d
\n
"
,
be
->
blkif
->
st_rd_sect
);
VBD_SHOW
(
wr_sect
,
"%d
\n
"
,
be
->
blkif
->
st_wr_sect
);
VBD_SHOW
(
wr_sect
,
"%d
\n
"
,
be
->
blkif
->
st_wr_sect
);
static
struct
attribute
*
vbdstat_attrs
[]
=
{
static
struct
attribute
*
xen_
vbdstat_attrs
[]
=
{
&
dev_attr_oo_req
.
attr
,
&
dev_attr_oo_req
.
attr
,
&
dev_attr_rd_req
.
attr
,
&
dev_attr_rd_req
.
attr
,
&
dev_attr_wr_req
.
attr
,
&
dev_attr_wr_req
.
attr
,
...
@@ -285,9 +285,9 @@ static struct attribute *vbdstat_attrs[] = {
...
@@ -285,9 +285,9 @@ static struct attribute *vbdstat_attrs[] = {
NULL
NULL
};
};
static
struct
attribute_group
vbdstat_group
=
{
static
struct
attribute_group
xen_
vbdstat_group
=
{
.
name
=
"statistics"
,
.
name
=
"statistics"
,
.
attrs
=
vbdstat_attrs
,
.
attrs
=
xen_
vbdstat_attrs
,
};
};
VBD_SHOW
(
physical_device
,
"%x:%x
\n
"
,
be
->
major
,
be
->
minor
);
VBD_SHOW
(
physical_device
,
"%x:%x
\n
"
,
be
->
major
,
be
->
minor
);
...
@@ -305,13 +305,13 @@ int xenvbd_sysfs_addif(struct xenbus_device *dev)
...
@@ -305,13 +305,13 @@ int xenvbd_sysfs_addif(struct xenbus_device *dev)
if
(
error
)
if
(
error
)
goto
fail2
;
goto
fail2
;
error
=
sysfs_create_group
(
&
dev
->
dev
.
kobj
,
&
vbdstat_group
);
error
=
sysfs_create_group
(
&
dev
->
dev
.
kobj
,
&
xen_
vbdstat_group
);
if
(
error
)
if
(
error
)
goto
fail3
;
goto
fail3
;
return
0
;
return
0
;
fail3:
sysfs_remove_group
(
&
dev
->
dev
.
kobj
,
&
vbdstat_group
);
fail3:
sysfs_remove_group
(
&
dev
->
dev
.
kobj
,
&
xen_
vbdstat_group
);
fail2:
device_remove_file
(
&
dev
->
dev
,
&
dev_attr_mode
);
fail2:
device_remove_file
(
&
dev
->
dev
,
&
dev_attr_mode
);
fail1:
device_remove_file
(
&
dev
->
dev
,
&
dev_attr_physical_device
);
fail1:
device_remove_file
(
&
dev
->
dev
,
&
dev_attr_physical_device
);
return
error
;
return
error
;
...
@@ -319,24 +319,24 @@ fail1: device_remove_file(&dev->dev, &dev_attr_physical_device);
...
@@ -319,24 +319,24 @@ fail1: device_remove_file(&dev->dev, &dev_attr_physical_device);
void
xenvbd_sysfs_delif
(
struct
xenbus_device
*
dev
)
void
xenvbd_sysfs_delif
(
struct
xenbus_device
*
dev
)
{
{
sysfs_remove_group
(
&
dev
->
dev
.
kobj
,
&
vbdstat_group
);
sysfs_remove_group
(
&
dev
->
dev
.
kobj
,
&
xen_
vbdstat_group
);
device_remove_file
(
&
dev
->
dev
,
&
dev_attr_mode
);
device_remove_file
(
&
dev
->
dev
,
&
dev_attr_mode
);
device_remove_file
(
&
dev
->
dev
,
&
dev_attr_physical_device
);
device_remove_file
(
&
dev
->
dev
,
&
dev_attr_physical_device
);
}
}
static
void
vbd_free
(
struct
vbd
*
vbd
)
static
void
xen_vbd_free
(
struct
xen_
vbd
*
vbd
)
{
{
if
(
vbd
->
bdev
)
if
(
vbd
->
bdev
)
blkdev_put
(
vbd
->
bdev
,
vbd
->
readonly
?
FMODE_READ
:
FMODE_WRITE
);
blkdev_put
(
vbd
->
bdev
,
vbd
->
readonly
?
FMODE_READ
:
FMODE_WRITE
);
vbd
->
bdev
=
NULL
;
vbd
->
bdev
=
NULL
;
}
}
static
int
vbd_create
(
struct
xen_blkif
*
blkif
,
blkif_vdev_t
handle
,
static
int
xen_
vbd_create
(
struct
xen_blkif
*
blkif
,
blkif_vdev_t
handle
,
unsigned
major
,
unsigned
minor
,
int
readonly
,
unsigned
major
,
unsigned
minor
,
int
readonly
,
int
cdrom
)
int
cdrom
)
{
{
struct
vbd
*
vbd
;
struct
xen_
vbd
*
vbd
;
struct
block_device
*
bdev
;
struct
block_device
*
bdev
;
struct
request_queue
*
q
;
struct
request_queue
*
q
;
...
@@ -351,7 +351,7 @@ static int vbd_create(struct xen_blkif *blkif, blkif_vdev_t handle,
...
@@ -351,7 +351,7 @@ static int vbd_create(struct xen_blkif *blkif, blkif_vdev_t handle,
FMODE_READ
:
FMODE_WRITE
,
NULL
);
FMODE_READ
:
FMODE_WRITE
,
NULL
);
if
(
IS_ERR
(
bdev
))
{
if
(
IS_ERR
(
bdev
))
{
DPRINTK
(
"vbd_create: device %08x could not be opened.
\n
"
,
DPRINTK
(
"
xen_
vbd_create: device %08x could not be opened.
\n
"
,
vbd
->
pdevice
);
vbd
->
pdevice
);
return
-
ENOENT
;
return
-
ENOENT
;
}
}
...
@@ -360,9 +360,9 @@ static int vbd_create(struct xen_blkif *blkif, blkif_vdev_t handle,
...
@@ -360,9 +360,9 @@ static int vbd_create(struct xen_blkif *blkif, blkif_vdev_t handle,
vbd
->
size
=
vbd_sz
(
vbd
);
vbd
->
size
=
vbd_sz
(
vbd
);
if
(
vbd
->
bdev
->
bd_disk
==
NULL
)
{
if
(
vbd
->
bdev
->
bd_disk
==
NULL
)
{
DPRINTK
(
"vbd_create: device %08x doesn't exist.
\n
"
,
DPRINTK
(
"
xen_
vbd_create: device %08x doesn't exist.
\n
"
,
vbd
->
pdevice
);
vbd
->
pdevice
);
vbd_free
(
vbd
);
xen_
vbd_free
(
vbd
);
return
-
ENOENT
;
return
-
ENOENT
;
}
}
...
@@ -396,7 +396,7 @@ static int xen_blkbk_remove(struct xenbus_device *dev)
...
@@ -396,7 +396,7 @@ static int xen_blkbk_remove(struct xenbus_device *dev)
if
(
be
->
blkif
)
{
if
(
be
->
blkif
)
{
xen_blkif_disconnect
(
be
->
blkif
);
xen_blkif_disconnect
(
be
->
blkif
);
vbd_free
(
&
be
->
blkif
->
vbd
);
xen_
vbd_free
(
&
be
->
blkif
->
vbd
);
xen_blkif_free
(
be
->
blkif
);
xen_blkif_free
(
be
->
blkif
);
be
->
blkif
=
NULL
;
be
->
blkif
=
NULL
;
}
}
...
@@ -535,7 +535,7 @@ static void backend_changed(struct xenbus_watch *watch,
...
@@ -535,7 +535,7 @@ static void backend_changed(struct xenbus_watch *watch,
be
->
major
=
major
;
be
->
major
=
major
;
be
->
minor
=
minor
;
be
->
minor
=
minor
;
err
=
vbd_create
(
be
->
blkif
,
handle
,
major
,
minor
,
err
=
xen_
vbd_create
(
be
->
blkif
,
handle
,
major
,
minor
,
(
NULL
==
strchr
(
be
->
mode
,
'w'
)),
cdrom
);
(
NULL
==
strchr
(
be
->
mode
,
'w'
)),
cdrom
);
if
(
err
)
{
if
(
err
)
{
be
->
major
=
0
;
be
->
major
=
0
;
...
@@ -546,7 +546,7 @@ static void backend_changed(struct xenbus_watch *watch,
...
@@ -546,7 +546,7 @@ static void backend_changed(struct xenbus_watch *watch,
err
=
xenvbd_sysfs_addif
(
dev
);
err
=
xenvbd_sysfs_addif
(
dev
);
if
(
err
)
{
if
(
err
)
{
vbd_free
(
&
be
->
blkif
->
vbd
);
xen_
vbd_free
(
&
be
->
blkif
->
vbd
);
be
->
major
=
0
;
be
->
major
=
0
;
be
->
minor
=
0
;
be
->
minor
=
0
;
xenbus_dev_fatal
(
dev
,
err
,
"creating sysfs entries"
);
xenbus_dev_fatal
(
dev
,
err
,
"creating sysfs entries"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录