Hi!Yep, we "freeze too much", so we can't just use the shell and pipe it. Too bad. 218 int write_image(char *resume_dev_name) 219 { 220 static struct swap_map_handle handle; 221 struct swsusp_info *header; 222 unsigned long start; 223 int fd; 224 int error; 225 226 fd = open(resume_dev_name, O_RDWR | O_SYNC); 227 if (fd < 0) { 228 printf("suspend: Could not open resume device\n"); 229 return error; 230 } 231 error = read(dev, buffer, PAGE_SIZE); 232 if (error < PAGE_SIZE) 233 return error < 0 ? error : -EFAULT; 234 header = (struct swsusp_info *)buffer; 235 if (!enough_swap(header->pages)) { 236 printf("suspend: Not enough free swap\n"); 237 return -ENOSPC; 238 } 239 error = init_swap_writer(&handle, fd); 240 if (!error) { 241 start = handle.cur_swap; 242 error = swap_write_page(&handle, header); 243 } 244 if (!error) 245 error = save_image(&handle, header->pages - 1); 246 if (!error) { 247 flush_swap_writer(&handle); 248 printf( "S" ); 249 error = mark_swap(fd, start); 250 printf( "|\n" ); 251 } 252 fsync(fd); 253 close(fd); 254 return error; 255 } This is basically the loop above, made complex by the fact that we do not want to have separate partition for snapshot; we just want to reuse free space in swap partition. I think you've just invented uswsusp. Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html -
| Justin C. Sherrill | Re: dragonflybsd.org website link? |
| David Woodhouse | Re: -mm merge plans for 2.6.23 |
| Greg Kroah-Hartman | [PATCH 002/196] Chinese: rephrase English introduction in HOWTO |
| Eric Sandeen | Re: [RFC] Heads up on sys_fallocate() |
git: | |
| David Miller | [GIT]: Networking |
| Gerrit Renker | [PATCH 15/37] dccp: Set per-connection CCIDs via socket options |
| Patrick McHardy | [NET_SCHED 01/15]: sch_atm: fix format string warning |
