Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
criu
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhul
criu
Commits
f61eb82f
Commit
f61eb82f
authored
Aug 10, 2013
by
Pavel Emelyanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
files: Convert fdescs hash from list-s into hlist-s
Signed-off-by:
Pavel Emelyanov
<
xemul@parallels.com
>
parent
10343df6
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
files.c
files.c
+6
-6
files.h
include/files.h
+1
-1
No files found.
files.c
View file @
f61eb82f
...
@@ -41,14 +41,14 @@
...
@@ -41,14 +41,14 @@
#include "protobuf/fs.pb-c.h"
#include "protobuf/fs.pb-c.h"
#define FDESC_HASH_SIZE 64
#define FDESC_HASH_SIZE 64
static
struct
list_head
file_desc_hash
[
FDESC_HASH_SIZE
];
static
struct
h
list_head
file_desc_hash
[
FDESC_HASH_SIZE
];
int
prepare_shared_fdinfo
(
void
)
int
prepare_shared_fdinfo
(
void
)
{
{
int
i
;
int
i
;
for
(
i
=
0
;
i
<
FDESC_HASH_SIZE
;
i
++
)
for
(
i
=
0
;
i
<
FDESC_HASH_SIZE
;
i
++
)
INIT_LIST_HEAD
(
&
file_desc_hash
[
i
]);
INIT_
H
LIST_HEAD
(
&
file_desc_hash
[
i
]);
return
0
;
return
0
;
}
}
...
@@ -59,16 +59,16 @@ void file_desc_add(struct file_desc *d, u32 id, struct file_desc_ops *ops)
...
@@ -59,16 +59,16 @@ void file_desc_add(struct file_desc *d, u32 id, struct file_desc_ops *ops)
d
->
ops
=
ops
;
d
->
ops
=
ops
;
INIT_LIST_HEAD
(
&
d
->
fd_info_head
);
INIT_LIST_HEAD
(
&
d
->
fd_info_head
);
list_add_tail
(
&
d
->
hash
,
&
file_desc_hash
[
id
%
FDESC_HASH_SIZE
]);
hlist_add_head
(
&
d
->
hash
,
&
file_desc_hash
[
id
%
FDESC_HASH_SIZE
]);
}
}
struct
file_desc
*
find_file_desc_raw
(
int
type
,
u32
id
)
struct
file_desc
*
find_file_desc_raw
(
int
type
,
u32
id
)
{
{
struct
file_desc
*
d
;
struct
file_desc
*
d
;
struct
list_head
*
chain
;
struct
h
list_head
*
chain
;
chain
=
&
file_desc_hash
[
id
%
FDESC_HASH_SIZE
];
chain
=
&
file_desc_hash
[
id
%
FDESC_HASH_SIZE
];
list_for_each_entry
(
d
,
chain
,
hash
)
h
list_for_each_entry
(
d
,
chain
,
hash
)
if
(
d
->
ops
->
type
==
type
&&
d
->
id
==
id
)
if
(
d
->
ops
->
type
==
type
&&
d
->
id
==
id
)
return
d
;
return
d
;
...
@@ -98,7 +98,7 @@ void show_saved_files(void)
...
@@ -98,7 +98,7 @@ void show_saved_files(void)
pr_info
(
"File descs:
\n
"
);
pr_info
(
"File descs:
\n
"
);
for
(
i
=
0
;
i
<
FDESC_HASH_SIZE
;
i
++
)
for
(
i
=
0
;
i
<
FDESC_HASH_SIZE
;
i
++
)
list_for_each_entry
(
fd
,
&
file_desc_hash
[
i
],
hash
)
{
h
list_for_each_entry
(
fd
,
&
file_desc_hash
[
i
],
hash
)
{
struct
fdinfo_list_entry
*
le
;
struct
fdinfo_list_entry
*
le
;
pr_info
(
" `- type %d ID %#x
\n
"
,
fd
->
ops
->
type
,
fd
->
id
);
pr_info
(
" `- type %d ID %#x
\n
"
,
fd
->
ops
->
type
,
fd
->
id
);
...
...
include/files.h
View file @
f61eb82f
...
@@ -100,7 +100,7 @@ struct file_desc_ops {
...
@@ -100,7 +100,7 @@ struct file_desc_ops {
struct
file_desc
{
struct
file_desc
{
u32
id
;
/* File descriptor id, unique */
u32
id
;
/* File descriptor id, unique */
struct
list_head
hash
;
/* Descriptor hashing and lookup */
struct
hlist_node
hash
;
/* Descriptor hashing and lookup */
struct
list_head
fd_info_head
;
/* Chain of fdinfo_list_entry-s with same ID and type but different pids */
struct
list_head
fd_info_head
;
/* Chain of fdinfo_list_entry-s with same ID and type but different pids */
struct
file_desc_ops
*
ops
;
/* Associated operations */
struct
file_desc_ops
*
ops
;
/* Associated operations */
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment