[CRIU] [PATCH 11/12] dump: files tree - rename functions
Kinsbursky Stanislav
skinsbursky at openvz.org
Fri Mar 23 12:24:18 EDT 2012
From: Stanislav Kinsbursky <skinsbursky at openvz.org>
Current names are obfuscating.
Tree is used for storing info about files - not file descriptors.
Signed-off-by: Stanislav Kinsbursky <skinsbursky at openvz.org>
---
cr-dump.c | 2 +-
file-ids.c | 32 ++++++++++++++++----------------
include/file-ids.h | 2 +-
3 files changed, 18 insertions(+), 18 deletions(-)
-------------- next part --------------
diff --git a/cr-dump.c b/cr-dump.c
index 204fc3b..2a834f8 100644
--- a/cr-dump.c
+++ b/cr-dump.c
@@ -124,7 +124,7 @@ static int dump_one_reg_file(const struct file_entry *p, pid_t pid,
u8 new;
long id;
- id = fd_id_entry_collect(p, pid, target_fd, &new);
+ id = file_collect(p, pid, target_fd, &new);
if (id < 0)
goto err;
diff --git a/file-ids.c b/file-ids.c
index 149f846..aef7ffd 100644
--- a/file-ids.c
+++ b/file-ids.c
@@ -58,7 +58,7 @@
* in one pass.
*/
-struct fd_id_entry {
+struct file_node {
struct rb_node node;
struct rb_root subtree_root;
@@ -87,10 +87,10 @@ static int compare_open_files(pid_t pid1, pid_t pid2, u8 fd1, u8 fd2)
return sys_kcmp(pid1, pid2, KCMP_FILE, fd1, fd2);
}
-static struct fd_id_entry *alloc_fd_id_entry(struct fd_id_entry *parent, u32 genid,
- pid_t pid, int fd, u8 *new_entry)
+static struct file_node *alloc_file_node(struct file_node *parent, u32 genid,
+ pid_t pid, int fd, u8 *new_entry)
{
- struct fd_id_entry *e;
+ struct file_node *e;
e = xmalloc(sizeof(*e));
if (!e)
@@ -115,19 +115,19 @@ err:
return e;
}
-static struct fd_id_entry *
-lookup_alloc_subtree(struct fd_id_entry *e, u32 genid,
+static struct file_node *
+lookup_alloc_subtree(struct file_node *e, u32 genid,
pid_t pid, int fd, u8 *new_entry,
int (*compare)(pid_t , pid_t , u8 , u8 ))
{
struct rb_node *node = e->subtree_root.rb_node;
- struct fd_id_entry *sub = NULL;
+ struct file_node *sub = NULL;
struct rb_node **new = &e->subtree_root.rb_node;
struct rb_node *parent = NULL;
while (node) {
- struct fd_id_entry *this = rb_entry(node, struct fd_id_entry, subtree_node);
+ struct file_node *this = rb_entry(node, struct file_node, subtree_node);
int ret = compare(this->info.pid, pid, this->info.fd, fd);
parent = *new;
@@ -139,7 +139,7 @@ lookup_alloc_subtree(struct fd_id_entry *e, u32 genid,
return this;
}
- sub = alloc_fd_id_entry(NULL, genid, pid, fd, new_entry);
+ sub = alloc_file_node(NULL, genid, pid, fd, new_entry);
if (!sub)
goto err;
@@ -148,12 +148,12 @@ err:
return sub;
}
-static struct fd_id_entry *lookup_alloc_node(u8 type, u64 genid,
- pid_t pid, int fd, u8 *new_entry)
+static struct file_node *lookup_alloc_node(u8 type, u64 genid,
+ pid_t pid, int fd, u8 *new_entry)
{
struct rb_root *fd_root;
struct rb_node *node;
- struct fd_id_entry *e = NULL;
+ struct file_node *e = NULL;
struct rb_node **new;
struct rb_node *parent = NULL;
@@ -168,7 +168,7 @@ static struct fd_id_entry *lookup_alloc_node(u8 type, u64 genid,
compare = compare_map_files;
while (node) {
- struct fd_id_entry *this = rb_entry(node, struct fd_id_entry, node);
+ struct file_node *this = rb_entry(node, struct file_node, node);
parent = *new;
if (genid < this->u.key.genid)
@@ -180,7 +180,7 @@ static struct fd_id_entry *lookup_alloc_node(u8 type, u64 genid,
new_entry, compare);
}
- e = alloc_fd_id_entry(e, genid, pid, fd, new_entry);
+ e = alloc_file_node(e, genid, pid, fd, new_entry);
if (!e)
goto err;
@@ -189,9 +189,9 @@ err:
return e;
}
-long fd_id_entry_collect(const struct file_entry *p, pid_t pid, int fd, u8 *new_entry)
+long file_collect(const struct file_entry *p, pid_t pid, int fd, u8 *new_entry)
{
- struct fd_id_entry *e = NULL;
+ struct file_node *e = NULL;
if (p->type >= FD_INFO_MAX)
return -ENOTSUP;
diff --git a/include/file-ids.h b/include/file-ids.h
index acf479b..f8ca237 100644
--- a/include/file-ids.h
+++ b/include/file-ids.h
@@ -17,7 +17,7 @@ struct file_info {
(((u32)(dev) ^ (u32)(ino) ^ (u32)(pos)))
struct file_entry;
-extern long fd_id_entry_collect(const struct file_entry *p, pid_t pid, int fd,
+extern long file_collect(const struct file_entry *p, pid_t pid, int fd,
u8 *new_entry);
#endif /* FILE_IDS_H__ */
More information about the CRIU
mailing list