[CRIU] [PATCH 4/4] fsnotify: Tossing legacy bits around

Pavel Emelyanov xemul at virtuozzo.com
Mon May 15 07:02:03 PDT 2017


This just moves all the deprecated code into one place.

Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
---
 criu/fsnotify.c | 42 ++++++++++++++++--------------------------
 1 file changed, 16 insertions(+), 26 deletions(-)

diff --git a/criu/fsnotify.c b/criu/fsnotify.c
index 491816e..5af3de9 100644
--- a/criu/fsnotify.c
+++ b/criu/fsnotify.c
@@ -765,18 +765,6 @@ static int __collect_inotify_mark(struct fsnotify_file_info *p, struct fsnotify_
 	return 0;
 }
 
-static int collect_inotify_mark(struct fsnotify_mark_info *mark)
-{
-	struct file_desc *d;
-
-	d = find_file_desc_raw(FD_TYPES__INOTIFY, mark->iwe->id);
-	if (d)
-		return __collect_inotify_mark(container_of(d, struct fsnotify_file_info, d), mark);
-
-	pr_err("Can't find inotify with id %#08x\n", mark->iwe->id);
-	return -1;
-}
-
 static int __collect_fanotify_mark(struct fsnotify_file_info *p,
 				struct fsnotify_mark_info *mark)
 {
@@ -787,18 +775,6 @@ static int __collect_fanotify_mark(struct fsnotify_file_info *p,
 	return 0;
 }
 
-static int collect_fanotify_mark(struct fsnotify_mark_info *mark)
-{
-	struct file_desc *d;
-
-	d = find_file_desc_raw(FD_TYPES__FANOTIFY, mark->fme->id);
-	if (d)
-		return __collect_fanotify_mark(container_of(d, struct fsnotify_file_info, d), mark);
-
-	pr_err("Can't find fanotify with id %#08x\n", mark->fme->id);
-	return -1;
-}
-
 static int collect_one_inotify(void *o, ProtobufCMessage *msg, struct cr_img *img)
 {
 	struct fsnotify_file_info *info = o;
@@ -870,6 +846,7 @@ struct collect_image_info fanotify_cinfo = {
 static int collect_one_inotify_mark(void *o, ProtobufCMessage *msg, struct cr_img *i)
 {
 	struct fsnotify_mark_info *mark = o;
+	struct file_desc *d;
 
 	if (!deprecated_ok("separate images for fsnotify marks"))
 		return -1;
@@ -888,7 +865,13 @@ static int collect_one_inotify_mark(void *o, ProtobufCMessage *msg, struct cr_im
 	 */
 	mark->iwe->mask &= ~KERNEL_FS_EVENT_ON_CHILD;
 
-	return collect_inotify_mark(mark);
+	d = find_file_desc_raw(FD_TYPES__INOTIFY, mark->iwe->id);
+	if (!d) {
+		pr_err("Can't find inotify with id %#08x\n", mark->iwe->id);
+		return -1;
+	}
+
+	return __collect_inotify_mark(container_of(d, struct fsnotify_file_info, d), mark);
 }
 
 struct collect_image_info inotify_mark_cinfo = {
@@ -901,6 +884,7 @@ struct collect_image_info inotify_mark_cinfo = {
 static int collect_one_fanotify_mark(void *o, ProtobufCMessage *msg, struct cr_img *i)
 {
 	struct fsnotify_mark_info *mark = o;
+	struct file_desc *d;
 
 	if (!deprecated_ok("separate images for fsnotify marks"))
 		return -1;
@@ -909,7 +893,13 @@ static int collect_one_fanotify_mark(void *o, ProtobufCMessage *msg, struct cr_i
 	INIT_LIST_HEAD(&mark->list);
 	mark->remap = NULL;
 
-	return collect_fanotify_mark(mark);
+	d = find_file_desc_raw(FD_TYPES__FANOTIFY, mark->fme->id);
+	if (!d) {
+		pr_err("Can't find fanotify with id %#08x\n", mark->fme->id);
+		return -1;
+	}
+
+	return __collect_fanotify_mark(container_of(d, struct fsnotify_file_info, d), mark);
 }
 
 struct collect_image_info fanotify_mark_cinfo = {
-- 
2.1.4



More information about the CRIU mailing list