Commit 7c73b4c1 authored by Pavel Emelyanov's avatar Pavel Emelyanov Committed by Cyrill Gorcunov

crtools: Remove use_mask from fdset

This one is required on allocation -- it's already there as an argument.
It's also required on free, but we can check for fd being >= 0.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
parent ee133674
...@@ -121,8 +121,6 @@ int prep_cr_fdset_for_dump(struct cr_fdset *cr_fdset, ...@@ -121,8 +121,6 @@ int prep_cr_fdset_for_dump(struct cr_fdset *cr_fdset,
if (!cr_fdset) if (!cr_fdset)
goto err; goto err;
cr_fdset->use_mask = use_mask;
for (i = 0; i < CR_FD_MAX; i++) { for (i = 0; i < CR_FD_MAX; i++) {
if (!(use_mask & CR_FD_DESC_USE(i))) if (!(use_mask & CR_FD_DESC_USE(i)))
continue; continue;
...@@ -166,8 +164,6 @@ int prep_cr_fdset_for_restore(struct cr_fdset *cr_fdset, ...@@ -166,8 +164,6 @@ int prep_cr_fdset_for_restore(struct cr_fdset *cr_fdset,
if (!cr_fdset) if (!cr_fdset)
goto err; goto err;
cr_fdset->use_mask = use_mask;
for (i = 0; i < CR_FD_MAX; i++) { for (i = 0; i < CR_FD_MAX; i++) {
if (!(use_mask & CR_FD_DESC_USE(i))) if (!(use_mask & CR_FD_DESC_USE(i)))
continue; continue;
...@@ -206,16 +202,14 @@ void close_cr_fdset(struct cr_fdset *cr_fdset) ...@@ -206,16 +202,14 @@ void close_cr_fdset(struct cr_fdset *cr_fdset)
return; return;
for (i = 0; i < CR_FD_MAX; i++) { for (i = 0; i < CR_FD_MAX; i++) {
if (!(cr_fdset->use_mask & CR_FD_DESC_USE(i))) if (cr_fdset->desc[i].fd == -1)
continue; continue;
if (cr_fdset->desc[i].fd >= 0) { pr_debug("Closed %s with %d\n",
pr_debug("Closed %s with %d\n",
cr_fdset->desc[i].path, cr_fdset->desc[i].path,
cr_fdset->desc[i].fd); cr_fdset->desc[i].fd);
close(cr_fdset->desc[i].fd); close(cr_fdset->desc[i].fd);
cr_fdset->desc[i].fd = -1; cr_fdset->desc[i].fd = -1;
}
} }
} }
......
...@@ -78,10 +78,6 @@ struct cr_fd_desc { ...@@ -78,10 +78,6 @@ struct cr_fd_desc {
struct cr_fdset { struct cr_fdset {
struct cr_fd_desc desc[CR_FD_MAX]; struct cr_fd_desc desc[CR_FD_MAX];
u32 use_mask; /*
* if descriptor get used,set
* bit here
*/
}; };
#define CR_FD_DESC_USE(type) ((1 << (type))) #define CR_FD_DESC_USE(type) ((1 << (type)))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment