Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
kernel_linux
提交
a7792aad
K
kernel_linux
项目概览
OpenHarmony
/
kernel_linux
上一次同步 4 年多
通知
15
Star
8
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kernel_linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
a7792aad
编写于
5月 20, 2016
作者:
D
Dave Chinner
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'xfs-4.7-cleanup-attr-listent' into for-next
上级
5b911354
3ab3ffca
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
39 addition
and
67 deletion
+39
-67
fs/xfs/xfs_attr.h
fs/xfs/xfs_attr.h
+2
-2
fs/xfs/xfs_attr_list.c
fs/xfs/xfs_attr_list.c
+26
-59
fs/xfs/xfs_xattr.c
fs/xfs/xfs_xattr.c
+11
-6
未找到文件。
fs/xfs/xfs_attr.h
浏览文件 @
a7792aad
...
@@ -112,8 +112,9 @@ typedef struct attrlist_cursor_kern {
...
@@ -112,8 +112,9 @@ typedef struct attrlist_cursor_kern {
*========================================================================*/
*========================================================================*/
/* Return 0 on success, or -errno; other state communicated via *context */
typedef
int
(
*
put_listent_func_t
)(
struct
xfs_attr_list_context
*
,
int
,
typedef
int
(
*
put_listent_func_t
)(
struct
xfs_attr_list_context
*
,
int
,
unsigned
char
*
,
int
,
int
,
unsigned
char
*
);
unsigned
char
*
,
int
,
int
);
typedef
struct
xfs_attr_list_context
{
typedef
struct
xfs_attr_list_context
{
struct
xfs_inode
*
dp
;
/* inode */
struct
xfs_inode
*
dp
;
/* inode */
...
@@ -126,7 +127,6 @@ typedef struct xfs_attr_list_context {
...
@@ -126,7 +127,6 @@ typedef struct xfs_attr_list_context {
int
firstu
;
/* first used byte in buffer */
int
firstu
;
/* first used byte in buffer */
int
flags
;
/* from VOP call */
int
flags
;
/* from VOP call */
int
resynch
;
/* T/F: resynch with cursor */
int
resynch
;
/* T/F: resynch with cursor */
int
put_value
;
/* T/F: need value for listent */
put_listent_func_t
put_listent
;
/* list output fmt function */
put_listent_func_t
put_listent
;
/* list output fmt function */
int
index
;
/* index into output buffer */
int
index
;
/* index into output buffer */
}
xfs_attr_list_context_t
;
}
xfs_attr_list_context_t
;
...
...
fs/xfs/xfs_attr_list.c
浏览文件 @
a7792aad
...
@@ -106,18 +106,15 @@ xfs_attr_shortform_list(xfs_attr_list_context_t *context)
...
@@ -106,18 +106,15 @@ xfs_attr_shortform_list(xfs_attr_list_context_t *context)
sfe
->
flags
,
sfe
->
flags
,
sfe
->
nameval
,
sfe
->
nameval
,
(
int
)
sfe
->
namelen
,
(
int
)
sfe
->
namelen
,
(
int
)
sfe
->
valuelen
,
(
int
)
sfe
->
valuelen
);
&
sfe
->
nameval
[
sfe
->
namelen
]);
if
(
error
)
return
error
;
/*
/*
* Either search callback finished early or
* Either search callback finished early or
* didn't fit it all in the buffer after all.
* didn't fit it all in the buffer after all.
*/
*/
if
(
context
->
seen_enough
)
if
(
context
->
seen_enough
)
break
;
break
;
if
(
error
)
return
error
;
sfe
=
XFS_ATTR_SF_NEXTENTRY
(
sfe
);
sfe
=
XFS_ATTR_SF_NEXTENTRY
(
sfe
);
}
}
trace_xfs_attr_list_sf_all
(
context
);
trace_xfs_attr_list_sf_all
(
context
);
...
@@ -200,8 +197,7 @@ xfs_attr_shortform_list(xfs_attr_list_context_t *context)
...
@@ -200,8 +197,7 @@ xfs_attr_shortform_list(xfs_attr_list_context_t *context)
sbp
->
flags
,
sbp
->
flags
,
sbp
->
name
,
sbp
->
name
,
sbp
->
namelen
,
sbp
->
namelen
,
sbp
->
valuelen
,
sbp
->
valuelen
);
&
sbp
->
name
[
sbp
->
namelen
]);
if
(
error
)
{
if
(
error
)
{
kmem_free
(
sbuf
);
kmem_free
(
sbuf
);
return
error
;
return
error
;
...
@@ -416,6 +412,9 @@ xfs_attr3_leaf_list_int(
...
@@ -416,6 +412,9 @@ xfs_attr3_leaf_list_int(
*/
*/
retval
=
0
;
retval
=
0
;
for
(;
i
<
ichdr
.
count
;
entry
++
,
i
++
)
{
for
(;
i
<
ichdr
.
count
;
entry
++
,
i
++
)
{
char
*
name
;
int
namelen
,
valuelen
;
if
(
be32_to_cpu
(
entry
->
hashval
)
!=
cursor
->
hashval
)
{
if
(
be32_to_cpu
(
entry
->
hashval
)
!=
cursor
->
hashval
)
{
cursor
->
hashval
=
be32_to_cpu
(
entry
->
hashval
);
cursor
->
hashval
=
be32_to_cpu
(
entry
->
hashval
);
cursor
->
offset
=
0
;
cursor
->
offset
=
0
;
...
@@ -425,56 +424,25 @@ xfs_attr3_leaf_list_int(
...
@@ -425,56 +424,25 @@ xfs_attr3_leaf_list_int(
continue
;
/* skip incomplete entries */
continue
;
/* skip incomplete entries */
if
(
entry
->
flags
&
XFS_ATTR_LOCAL
)
{
if
(
entry
->
flags
&
XFS_ATTR_LOCAL
)
{
xfs_attr_leaf_name_local_t
*
name_loc
=
xfs_attr_leaf_name_local_t
*
name_loc
;
xfs_attr3_leaf_name_local
(
leaf
,
i
);
name_loc
=
xfs_attr3_leaf_name_local
(
leaf
,
i
);
retval
=
context
->
put_listent
(
context
,
name
=
name_loc
->
nameval
;
entry
->
flags
,
namelen
=
name_loc
->
namelen
;
name_loc
->
nameval
,
valuelen
=
be16_to_cpu
(
name_loc
->
valuelen
);
(
int
)
name_loc
->
namelen
,
be16_to_cpu
(
name_loc
->
valuelen
),
&
name_loc
->
nameval
[
name_loc
->
namelen
]);
if
(
retval
)
return
retval
;
}
else
{
}
else
{
xfs_attr_leaf_name_remote_t
*
name_rmt
=
xfs_attr_leaf_name_remote_t
*
name_rmt
;
xfs_attr3_leaf_name_remote
(
leaf
,
i
);
name_rmt
=
xfs_attr3_leaf_name_remote
(
leaf
,
i
);
int
valuelen
=
be32_to_cpu
(
name_rmt
->
valuelen
);
name
=
name_rmt
->
name
;
namelen
=
name_rmt
->
namelen
;
if
(
context
->
put_value
)
{
valuelen
=
be32_to_cpu
(
name_rmt
->
valuelen
);
xfs_da_args_t
args
;
memset
((
char
*
)
&
args
,
0
,
sizeof
(
args
));
args
.
geo
=
context
->
dp
->
i_mount
->
m_attr_geo
;
args
.
dp
=
context
->
dp
;
args
.
whichfork
=
XFS_ATTR_FORK
;
args
.
valuelen
=
valuelen
;
args
.
rmtvaluelen
=
valuelen
;
args
.
value
=
kmem_alloc
(
valuelen
,
KM_SLEEP
|
KM_NOFS
);
args
.
rmtblkno
=
be32_to_cpu
(
name_rmt
->
valueblk
);
args
.
rmtblkcnt
=
xfs_attr3_rmt_blocks
(
args
.
dp
->
i_mount
,
valuelen
);
retval
=
xfs_attr_rmtval_get
(
&
args
);
if
(
!
retval
)
retval
=
context
->
put_listent
(
context
,
entry
->
flags
,
name_rmt
->
name
,
(
int
)
name_rmt
->
namelen
,
valuelen
,
args
.
value
);
kmem_free
(
args
.
value
);
}
else
{
retval
=
context
->
put_listent
(
context
,
entry
->
flags
,
name_rmt
->
name
,
(
int
)
name_rmt
->
namelen
,
valuelen
,
NULL
);
}
if
(
retval
)
return
retval
;
}
}
retval
=
context
->
put_listent
(
context
,
entry
->
flags
,
name
,
namelen
,
valuelen
);
if
(
retval
)
break
;
if
(
context
->
seen_enough
)
if
(
context
->
seen_enough
)
break
;
break
;
cursor
->
offset
++
;
cursor
->
offset
++
;
...
@@ -551,8 +519,7 @@ xfs_attr_put_listent(
...
@@ -551,8 +519,7 @@ xfs_attr_put_listent(
int
flags
,
int
flags
,
unsigned
char
*
name
,
unsigned
char
*
name
,
int
namelen
,
int
namelen
,
int
valuelen
,
int
valuelen
)
unsigned
char
*
value
)
{
{
struct
attrlist
*
alist
=
(
struct
attrlist
*
)
context
->
alist
;
struct
attrlist
*
alist
=
(
struct
attrlist
*
)
context
->
alist
;
attrlist_ent_t
*
aep
;
attrlist_ent_t
*
aep
;
...
@@ -581,7 +548,7 @@ xfs_attr_put_listent(
...
@@ -581,7 +548,7 @@ xfs_attr_put_listent(
trace_xfs_attr_list_full
(
context
);
trace_xfs_attr_list_full
(
context
);
alist
->
al_more
=
1
;
alist
->
al_more
=
1
;
context
->
seen_enough
=
1
;
context
->
seen_enough
=
1
;
return
1
;
return
0
;
}
}
aep
=
(
attrlist_ent_t
*
)
&
context
->
alist
[
context
->
firstu
];
aep
=
(
attrlist_ent_t
*
)
&
context
->
alist
[
context
->
firstu
];
...
...
fs/xfs/xfs_xattr.c
浏览文件 @
a7792aad
...
@@ -146,7 +146,7 @@ __xfs_xattr_put_listent(
...
@@ -146,7 +146,7 @@ __xfs_xattr_put_listent(
arraytop
=
context
->
count
+
prefix_len
+
namelen
+
1
;
arraytop
=
context
->
count
+
prefix_len
+
namelen
+
1
;
if
(
arraytop
>
context
->
firstu
)
{
if
(
arraytop
>
context
->
firstu
)
{
context
->
count
=
-
1
;
/* insufficient space */
context
->
count
=
-
1
;
/* insufficient space */
return
1
;
return
0
;
}
}
offset
=
(
char
*
)
context
->
alist
+
context
->
count
;
offset
=
(
char
*
)
context
->
alist
+
context
->
count
;
strncpy
(
offset
,
prefix
,
prefix_len
);
strncpy
(
offset
,
prefix
,
prefix_len
);
...
@@ -166,8 +166,7 @@ xfs_xattr_put_listent(
...
@@ -166,8 +166,7 @@ xfs_xattr_put_listent(
int
flags
,
int
flags
,
unsigned
char
*
name
,
unsigned
char
*
name
,
int
namelen
,
int
namelen
,
int
valuelen
,
int
valuelen
)
unsigned
char
*
value
)
{
{
char
*
prefix
;
char
*
prefix
;
int
prefix_len
;
int
prefix_len
;
...
@@ -221,11 +220,15 @@ xfs_xattr_put_listent(
...
@@ -221,11 +220,15 @@ xfs_xattr_put_listent(
}
}
ssize_t
ssize_t
xfs_vn_listxattr
(
struct
dentry
*
dentry
,
char
*
data
,
size_t
size
)
xfs_vn_listxattr
(
struct
dentry
*
dentry
,
char
*
data
,
size_t
size
)
{
{
struct
xfs_attr_list_context
context
;
struct
xfs_attr_list_context
context
;
struct
attrlist_cursor_kern
cursor
=
{
0
};
struct
attrlist_cursor_kern
cursor
=
{
0
};
struct
inode
*
inode
=
d_inode
(
dentry
);
struct
inode
*
inode
=
d_inode
(
dentry
);
int
error
;
/*
/*
* First read the regular on-disk attributes.
* First read the regular on-disk attributes.
...
@@ -239,7 +242,9 @@ xfs_vn_listxattr(struct dentry *dentry, char *data, size_t size)
...
@@ -239,7 +242,9 @@ xfs_vn_listxattr(struct dentry *dentry, char *data, size_t size)
context
.
firstu
=
context
.
bufsize
;
context
.
firstu
=
context
.
bufsize
;
context
.
put_listent
=
xfs_xattr_put_listent
;
context
.
put_listent
=
xfs_xattr_put_listent
;
xfs_attr_list_int
(
&
context
);
error
=
xfs_attr_list_int
(
&
context
);
if
(
error
)
return
error
;
if
(
context
.
count
<
0
)
if
(
context
.
count
<
0
)
return
-
ERANGE
;
return
-
ERANGE
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录