skipped 33 lines 34 34 struct file_desc d; 35 35 }; 36 36 37 - struct eventpoll_tfd_file_info { 38 - EventpollTfdEntry *tdefe; 39 - struct list_head list; 40 - }; 41 - 42 - static LIST_HEAD(eventpoll_tfds); 43 - 44 37 /* Checks if file descriptor @lfd is eventfd */ 45 38 int is_eventpoll_link(char *link) 46 39 { skipped 141 lines 188 181 189 182 static int eventpoll_post_open(struct file_desc *d, int fd) 190 183 { 191 - struct eventpoll_tfd_file_info *td_info; 192 184 struct eventpoll_file_info *info; 193 185 int i; 194 186 skipped 8 lines 203 195 return -1; 204 196 } 205 197 206 - list_for_each_entry(td_info, &eventpoll_tfds, list) { 207 - if (epoll_not_ready_tfd(td_info->tdefe)) 208 - return 1; 209 - } 210 - list_for_each_entry(td_info, &eventpoll_tfds, list) { 211 - if (td_info->tdefe->id != info->efe->id) 212 - continue; 213 - 214 - if (eventpoll_retore_tfd(fd, info->efe->id, td_info->tdefe)) 215 - return -1; 216 - 217 - } 218 - 219 198 return 0; 220 199 } 221 200 skipped 4 lines 226 205 227 206 static int collect_one_epoll_tfd(void *o, ProtobufCMessage *msg, struct cr_img *i) 228 207 { 229 - struct eventpoll_tfd_file_info *info = o; 208 + EventpollTfdEntry *tfde; 209 + struct file_desc *d; 210 + struct eventpoll_file_info *ef; 211 + EventpollFileEntry *efe; 212 + int n_tfd; 230 213 231 214 if (!deprecated_ok("Epoll TFD image")) 232 215 return -1; 233 216 234 - info - > tdefe = pb_msg(msg, EventpollTfdEntry); 235 - list_add(&info->list, &eventpoll_tfds); 236 - pr_info_eventpoll_tfd("Collected ", info->tdefe); 217 + tfde = pb_msg(msg, EventpollTfdEntry); 218 + d = find_file_desc_raw(FD_TYPES__EVENTPOLL, tfde->id); 219 + if (!d) { 220 + pr_err("No epoll FD for %u\n", tfde->id); 221 + return -1; 222 + } 223 + 224 + ef = container_of(d, struct eventpoll_file_info, d); 225 + efe = ef->efe; 226 + 227 + n_tfd = efe->n_tfd + 1; 228 + if (xrealloc_safe(&efe->tfd, n_tfd * sizeof(EventpollTfdEntry *))) 229 + return -1; 230 + 231 + efe->tfd[efe->n_tfd] = tfde; 232 + efe->n_tfd = n_tfd; 237 233 238 234 return 0; 239 235 } skipped 1 lines 241 237 struct collect_image_info epoll_tfd_cinfo = { 242 238 .fd_type = CR_FD_EVENTPOLL_TFD, 243 239 .pb_type = PB_EVENTPOLL_TFD, 244 - .priv_size = sizeof(struct eventpoll_tfd_file_info), 245 240 .collect = collect_one_epoll_tfd, 241 + .flags = COLLECT_NOFREE, 246 242 }; 247 243 248 244 static int collect_one_epoll(void *o, ProtobufCMessage *msg, struct cr_img *i) skipped 15 lines