Changeset 197
- Timestamp:
- 01/25/07 18:20:24 (2 years ago)
- Files:
-
- trunk/client/revimage/Makefile (modified) (4 diffs)
- trunk/client/revimage/autorestore/Makefile (modified) (1 diff)
- trunk/client/revimage/autorestore/autorestore.c (modified) (18 diffs)
- trunk/client/revimage/autorestore/revoboot (modified) (2 diffs)
- trunk/client/revimage/autorestore/ui_newt.c (modified) (3 diffs)
- trunk/client/revimage/autosave/Makefile (modified) (1 diff)
- trunk/client/revimage/autosave/autosave.c (modified) (4 diffs)
- trunk/client/revimage/client.c (added)
- trunk/client/revimage/client.h (added)
- trunk/client/revimage/compress-loop.h (modified) (3 diffs)
- trunk/client/revimage/compress.c (modified) (7 diffs)
- trunk/client/revimage/compress.h (modified) (2 diffs)
- trunk/client/revimage/easy_sock.c (added)
- trunk/client/revimage/easy_sock.h (added)
- trunk/client/revimage/image_e2fs.c (modified) (6 diffs)
- trunk/client/revimage/image_jfs.c (modified) (3 diffs)
- trunk/client/revimage/image_lvm.c (modified) (4 diffs)
- trunk/client/revimage/image_lvmreiserfs.c (modified) (5 diffs)
- trunk/client/revimage/image_raw.c (modified) (5 diffs)
- trunk/client/revimage/image_swap.c (modified) (3 diffs)
- trunk/client/revimage/image_xfs.c (modified) (4 diffs)
- trunk/client/revimage/lvm.c (modified) (1 diff)
- trunk/client/revimage/mount/mount.sh (added)
- trunk/client/revimage/server.c (added)
- trunk/client/revimage/server.h (added)
- trunk/client/revimage/ui_newt (added)
- trunk/client/revimage/ui_newt/Makefile (added)
- trunk/client/revimage/ui_newt/ui_newt.c (added)
- trunk/client/revimage/ui_newt/ui_newt.h (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/client/revimage/Makefile
r189 r197 3 3 # 4 4 5 OBJ=compress.o ui_newt.o6 LIBOBJ=compress.o ui_newt.o5 OBJ=compress.o 6 LIBOBJ=compress.o easy_sock.o client.o 7 7 8 8 ZLIB=./zlib … … 11 11 CFLAGS=-Wall -O2 -DLBLIMAGEVER=\"1.2\" -I$(ZLIB) -I./e2fsprogs-1.22/lib/ 12 12 LDFLAGS=-s 13 LIBS= - lnewt -L. -llrs13 LIBS= -L. -llrs 14 14 RFSLIBS=-L./reiserfsprogs/lib/ -lcore -lmisc 15 15 16 all: $(OBJ) $(LIBOBJ) liblrs.so.1 liblrs.a image_swap image_lvmreiserfs\17 image_ e2fs image_xfs image_jfs image_lvm\18 decompress decompress-test\19 image_errorimage_raw decompress-bitmap16 all: $(OBJ) $(LIBOBJ) liblrs.so.1 liblrs.a \ 17 image_swap image_lvmreiserfs image_fat \ 18 image_ntfs image_e2fs image_xfs image_jfs image_lvm \ 19 decompress decompress-test image_raw decompress-bitmap 20 20 21 21 depend: 22 22 gcc -M $(CFLAGS) *.c >.depend 23 23 24 #image_fat: image_fat.o24 image_fat: 25 25 # cc $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) 26 26 … … 31 31 cc $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) 32 32 33 #image_ntfs: image_ntfs.o 33 image_ntfs: 34 34 # cc $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) 35 35 … … 58 58 cc $(CFLAGS) $(LDFLAGS) -o $@ $< -L. -llrs -lnewt 59 59 60 #image_reiserfs: image_reiserfs.o lvm.o61 # cc $(CFLAGS) -o $@ $(OBJ) $< $(LIBS) $(RFSLIBS)62 63 image_error: image_error.o64 cc $(CFLAGS) -s -o $@ $< $(LIBS)65 66 60 image_e2fs.o: image_e2fs.c compress.h compress-loop.h config.h 67 61 cc $(CFLAGS) -o image_e2fs.o -c image_e2fs.c -I./e2fsprogs-1.22/lib 68 62 69 liblrs.so.1: $( OBJ)63 liblrs.so.1: $(LIBOBJ) 70 64 gcc -shared -Wl,-soname,liblrs.so.1 -o liblrs.so.1 $^ $(ZLIBOBJ) 71 65 strip $@ 72 66 ln -sf $@ liblrs.so 73 67 74 liblrs.a: $( OBJ)68 liblrs.a: $(LIBOBJ) 75 69 ar rc $@ $^ $(ZLIBOBJ) 76 70 ranlib $@ 77 71 78 79 72 include .depend trunk/client/revimage/autorestore/Makefile
r174 r197 1 CFLAGS=-I../zlib -1.2.1 -Wall -DLBLIMAGEVER=\"1.3\" -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -pedantic2 LIBS=-L.. /zlib-1.2.1/ -lz -lnewt-s1 CFLAGS=-I../zlib -Wall -DLBLIMAGEVER=\"1.4\" -Os -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Wall 2 LIBS=-L.. -llrs -s 3 3 CC=gcc 4 4 5 autorestore: autorestore.o ui_newt.oMakefile6 $(CC) $(CFLAGS) -o $@ autorestore.o ui_newt.o$(LIBS)5 autorestore: autorestore.o Makefile 6 $(CC) $(CFLAGS) -o $@ autorestore.o $(LIBS) trunk/client/revimage/autorestore/autorestore.c
r190 r197 37 37 #include <getopt.h> 38 38 #include <ctype.h> 39 #include <errno.h> 39 40 #include <sys/types.h> 40 41 #include <sys/stat.h> … … 53 54 54 55 //#include "autosave.h" 55 #include " ui_newt.h"56 #include "../client.h" 56 57 57 58 #define DEBUG(a) … … 87 88 88 89 /* paths mainly used by mtftp restoration */ 89 unsigned char servip[40] = " ";90 unsigned char servprefix[80] = " ";91 unsigned char storagedir[80] = " ";90 unsigned char servip[40] = "127.0.0.1"; 91 unsigned char servprefix[80] = "/"; 92 unsigned char storagedir[80] = "/"; 92 93 char hostname[32] = ""; 93 94 … … 135 136 136 137 /* KB decompressed */ 137 int todo = 0, done = 0; 138 unsigned int todo = 0, done = 0; 139 char todos[32]; 138 140 139 141 /* … … 159 161 int mysystem(const char *s) 160 162 { 161 char cmd[102 4];163 char cmd[1025]; 162 164 FILE *foerr; 163 165 164 strncpy(cmd, s, 1024 - s izeof(logtxt) - 9 - 1);166 strncpy(cmd, s, 1024 - strlen(logtxt) - 9 - 1); 165 167 strcat(cmd, " >> "); 166 168 strcat(cmd, logtxt); … … 225 227 return; 226 228 system("revosendlog 8"); 227 while (1) 228 sleep(1); 229 exit(EXIT_FAILURE); 230 } 231 232 /* Update the current file label */ 233 void update_file(char *f, int n, int max, char *dev) 234 { 235 char ns[32], maxs[32]; 236 237 sprintf(ns, "%d", n); 238 sprintf(maxs, "%d", max); 239 ui_send("refresh_file", 4, f, ns, maxs, dev); 240 } 241 242 /* fatal write error */ 243 void ui_seek_error(char *s, int l, int err, int fd, off64_t seek) 244 { 245 char tmp[256]; 246 int bs=0, mb=0; 247 off64_t offset; 248 249 /* get device block size */ 250 ioctl(fd, BLKBSZGET, &bs); 251 /* get current offset */ 252 offset = lseek64(fd, 0, SEEK_CUR); 253 254 if (seek != 0) { 255 offset = seek; 256 } 257 mb = (int)(offset/1024/1024); 258 snprintf(tmp, 255, "Hard Disk Write Error ! Bad or too small hard disk !\n" 259 "errno %d (%s)\n" 260 "file %s, line %d \n" 261 "bs=%d %s=%08lx%08lx (%d MiB)", 262 err, strerror(err), s, l, bs, (seek!=0?"seek":"offset"), 263 (long)((long long)offset>>32), (long)offset, mb); 264 fprintf(stderr, "ERROR: %s\n", tmp); 265 266 /* fatal error */ 267 system("/bin/revosendlog 8"); 268 ui_send("misc_error", 2, "HD Write error", tmp); 269 } 270 271 void ui_write_error(char *s, int l, int err, int fd) 272 { 273 ui_seek_error(s, l, err, fd, 0); 274 } 275 276 277 /* zlib error */ 278 void ui_zlib_error(int err) 279 { 280 char tmp[32]; 281 282 sprintf(tmp, "%d", err); 283 ui_send("zlib_error", 1, tmp); 229 284 } 230 285 … … 285 340 system("umount /revosave"); 286 341 /* wait */ 287 system 288 ("/revobin/image_error \"Please insert the next CD, and press a key\""); 289 getchar(); 342 ui_send("misc_error", 2, "Media change", "Please insert the next CD, and press the 'c' key"); 290 343 system("mount -t iso9660 /dev/cdrom /revosave"); 291 344 goto retry; … … 321 374 chdir("/tmpfs"); 322 375 if (!nonewt) 323 update_file(fname, filenum, -2, "Waiting" , done);376 update_file(fname, filenum, -2, "Waiting"); 324 377 sprintf(cmd, "revowait %s", f); 325 378 system(cmd); 326 379 if (!nonewt) 327 update_file(fname, filenum, -2, "Downloading" , done);380 update_file(fname, filenum, -2, "Downloading"); 328 381 /* get files */ 329 382 do { … … 414 467 // {int i; for(i=0;i<15;i++) printf("%02x ",ptr[i]); printf("\n");} 415 468 if (cp->fo) { 416 if (write(cp->fo, ptr, 512) != 512) {469 if (write(cp->fo, ptr, 512) != 512) { 417 470 ui_write_error(__FILE__, __LINE__, errno, cp->fo); 418 471 } … … 435 488 int fo; /* output device */ 436 489 z_stream zptr; 437 int state, filenum, fmax = -1 ;490 int state, filenum, fmax = -1, upcnt; 438 491 int ret, firstpass, bitmaplg; 439 492 FILE *fi; … … 469 522 start: 470 523 if (!nonewt) 471 update_file(fname, filenum, fmax, device , done);524 update_file(fname, filenum, fmax, device); 472 525 473 526 state = Z_SYNC_FLUSH; … … 482 535 fi = fops.open(fname, filenum); 483 536 if (fi == NULL) { 484 /*printf ("Cannot open input file\n"); */ 485 system("/revobin/image_error \"Cannot open input file\""); 537 ui_send("misc_error", 2, "Error", "Cannot open input file"); 486 538 fatal(); 487 539 } … … 498 550 inflateInit(&zptr); 499 551 552 upcnt = 0; 500 553 do { 501 // if (inflateSyncPoint(&zptr)) printf("#"); 502 554 /* decompress */ 503 555 ret = inflate(&zptr, state); 504 if (!nonewt) 505 update_progress(done + (zptr.total_in / 1024)); 506 507 // printf("-> %d : %d / %d\n",ret ,zptr.avail_in ,zptr.avail_out ); 508 556 557 if ( upcnt++ % 100 == 0 ) { 558 /* update status */ 559 char tmp[32]; 560 sprintf(tmp, "%llu", ((long long unsigned)done)*1024 + zptr.total_in); 561 ui_send("refresh_backup_progress", 1, tmp); 562 } 509 563 if ((ret == Z_OK) && (zptr.avail_out == 0)) { 510 564 if (firstpass) { … … 569 623 inflateEnd(&zptr); 570 624 571 572 625 if (ret < 0) { 573 626 /*printf ("Returned : %d\t", ret); … … 675 728 } 676 729 677 f = fopen("/revoinfo/hostname", "r"); 730 tmprintf("%s/hostname", revoinfo); 731 f = fopen(tmppath, "r"); 678 732 if (f == NULL) 679 733 return; … … 805 859 if (!nolrs) 806 860 system("revosendlog 8"); 807 sprintf(command, 808 "/revobin/image_error \"Your hard disk seems to be to small to restore this image (%u vs %u KB).\n\nIf you want to restore anyway, you can disable the disk space checks in the client's options panel.\"", 809 sect, orig); 810 system(command); 861 sprintf(command, "Your hard disk seems to be to small to restore this image (%u vs %u KB).\n\nIf you want to restore anyway, you can disable the disk space checks in the client's options panel.", sect, orig); 862 ui_send("misc_error", 2, "Error", command); 811 863 while (1) 812 864 sleep(1); … … 1014 1066 gethost(); 1015 1067 todo = getbytes(); 1016 1017 if (!nonewt) 1018 init_newt(servip, servprefix, storagedir, hostname, todo);1068 snprintf(todos, 32, "%u", todo); 1069 1070 ui_send("init_restore", 4, servip, servprefix, hostname, todos); 1019 1071 if (!nolrs) 1020 1072 system("revosendlog 2"); … … 1027 1079 system(tmprintf("echo \"\">%s/progress.txt", revoinfo)); 1028 1080 mysystem1("cat /var/log/messages"); 1029 1030 if (!nonewt)1031 close_newt(); 1081 1082 ui_send("close", 0); 1083 1032 1084 return 0; 1033 1085 } 1086 trunk/client/revimage/autorestore/revoboot
r190 r197 288 288 # Env Set-up 289 289 # 290 ulimit -c 100000 290 291 [ ! -f /etc/cmdline ] && cp -f /proc/cmdline /etc 291 292 ETH=`cat /etc/eth` … … 330 331 grep -q revodebug /etc/cmdline && exit 0 331 332 333 # Launch the UI 334 [ -x /bin/uinewt ] && /bin/uinewt & 335 332 336 # CDROM boot ? 333 337 grep -q revocdrom /etc/cmdline && do_cdrom trunk/client/revimage/autorestore/ui_newt.c
r152 r197 119 119 120 120 if (max == -1) 121 s printf (buf, "- Restoring : %s%03d -> %s\n ", f, n, dev);121 snprintf (buf, 255, "- Restoring : %s%03d -> %s\n ", f, n, dev); 122 122 else if (max == -2) 123 s printf (buf, "- Restoring : %s%03d (%s) ", f, n, dev);123 snprintf (buf, 255, "- Restoring : %s%03d (%s) ", f, n, dev); 124 124 else 125 s printf (buf, "- Restoring : %s%03d (/%d) -> %s\n ", f, n, max-1, dev);125 snprintf (buf, 255, "- Restoring : %s%03d (/%d) -> %s\n ", f, n, max-1, dev); 126 126 newtLabelSetText(i2, buf); 127 127 newtRefresh(); … … 230 230 } 231 231 232 /* fatal write error */ 232 /* 233 * fatal write error 234 */ 233 235 void ui_seek_error(char *s, int l, int err, int fd, off64_t seek) 234 236 { … … 271 273 } 272 274 275 273 276 void ui_write_error(char *s, int l, int err, int fd) 274 277 { trunk/client/revimage/autosave/Makefile
r75 r197 1 1 autosave: autosave.c Makefile 2 gcc -Os - Wall -o autosave autosave.c2 gcc -Os -s -Wall -o autosave autosave.c -L.. -llrs trunk/client/revimage/autosave/autosave.c
r190 r197 58 58 59 59 #include "autosave.h" 60 #include "../client.h" 60 61 61 62 #define DEBUG(a) … … 384 385 if (stat( tmprintf("%s/CONF", revosave) , &st) == 0) { 385 386 /* A backup is already here, stop everything ! */ 386 sprintf(command, 387 "/revobin/image_error \"A Backup is already present in the server's directory\nYou may have a problem with getClientResponse on the server!\n\""); 388 mysystem(command); 387 ui_send("misc_error", 2, "Backup error", "A Backup is already present in the server's directory\nYou may have a problem with getClientResponse on the server!\n"); 388 389 389 #ifndef TEST 390 while (1) 391 sleep(1); 390 exit(1); 392 391 #endif 393 392 } … … 635 634 dnum, poff[i], ttype[i]); 636 635 fclose(foerr); 636 637 fatal(); 637 638 /* Show a nice error message */ 638 sprintf(command, 639 "/revobin/image_error \"Unsupported or corrupted file system...\n\n(disk %d, part %d, type %x)\"", 639 sprintf(command, "Unsupported or corrupted file system...\n\n(disk %d, part %d, type %x)", 640 640 dnum, poff[i], ttype[i]); 641 system(command); 642 fatal(); 643 while (getchar() != 'c') 644 sleep(1); 641 ui_send("misc_error", 2, "Backup error", command); 645 642 646 643 } … … 652 649 if (backuped == 0) { 653 650 /* nothing backuped !!! */ 654 sprintf(command,655 "/revobin/image_error \"Nothing was backuped !\nMaybe your disk controller was not recognized...\"");656 mysystem(command);657 651 fatal(); 658 while (getchar() != 'c')659 sleep(1);652 ui_send("misc_error", 2, "Backup error", "Nothing was backuped !\nMaybe your disk controller was not" 653 " recognized..."); 660 654 } 661 655 trunk/client/revimage/compress-loop.h
r12 r197 5 5 6 6 //debug("- Block %d : O",i+1); 7 #ifndef BENCH8 update_block (i, nb);9 #endif10 11 7 #ifdef BENCH 12 8 sprintf (filename, "/dev/null"); … … 60 56 { 61 57 //debug("%3d\b\b\b",(100*j)/lg); 62 if (j % 100 == 0)58 if (j % 200 == 0) 63 59 { 64 60 #ifndef BENCH 65 update_progress ((100 * j) / lg); 61 char tmp[32]; 62 sprintf(tmp, "%llu", done); 63 ui_send("refresh_backup_progress", 1, tmp); 66 64 #endif 67 65 } … … 74 72 if (skip) 75 73 { 76 // if (fseek (fi, skip, SEEK_CUR)) UI_READ_ERROR;77 74 if (lseek (fi, skip, SEEK_CUR) == -1) UI_READ_ERROR; 78 75 c->cbytes += skip; 79 76 } 80 // if (fread (dataptr, 512, 1, fi) != 1) UI_READ_ERROR;81 // if (fread (dataptr, 512, 1, fi) != 1) ui_read_error("read", c->cbytes, j);82 77 if (read (fi, dataptr, 512) != 512) UI_READ_ERROR; 83 // if (read (fi, dataptr, 512) != 512) ui_read_error("read", k, j, fi);84 78 skip = 0; 85 79 dataptr += 512; trunk/client/revimage/compress.c
r154 r197 26 26 #include <stdlib.h> 27 27 #include <unistd.h> 28 #include <errno.h> 28 29 #include <sys/ioctl.h> 29 30 #include <linux/fs.h> 30 31 #include <string.h> 32 #include <time.h> 31 33 32 34 #include "compress.h" 33 #include " ui_newt.h"35 #include "client.h" 34 36 35 37 #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) 38 #define UI_READ_ERROR ui_read_error(__FILE__,__LINE__, errno, fi) 36 39 37 40 /* Check that off_t can represent 2**63 - 1 correctly. … … 47 50 48 51 unsigned long long done, todo; 49 52 50 53 #if 0 51 54 void setblocksize(FILE *f) … … 81 84 #endif 82 85 86 87 /* Fatal error, notify the server about it */ 88 void fatal(void) 89 { 90 system("/bin/revosendlog 8"); 91 } 92 93 /* 94 * backup read error: disk dead ? out of bounds read ? 95 */ 96 void ui_read_error(char *file, int line, int err, int fd) 97 { 98 char sline[32], serrno[32], soffset[32], tmp[256]; 99 off64_t offset; 100 101 sprintf(sline, "%d", line); 102 sprintf(serrno, "%d", err); 103 offset = lseek64(fd, 0, SEEK_CUR); 104 sprintf(soffset, "%llu", (unsigned long long)offset); 105 106 snprintf(tmp, 255, 107 "Hard Disk Read Error ! Bad hard disk or filesystem !\n" 108 "errno %d (%s)\n" " file %s, line %d \n" 109 "offset=%08lx%08lx ", err, strerror(err), file, line, 110 (long) ((long long) offset >> 32), (long) offset); 111 fprintf(stderr, "ERROR: %s\n", tmp); 112 113 fatal(); 114 ui_send("misc_error", 2, "Hard Disc read error", tmp); 115 } 116 117 /* 118 * prints the number of total/used sectors 119 */ 120 void print_sect_info(long long unsigned tot_sec, long long unsigned used_sec) 121 { 122 debug("- Total sectors : %llu = %llu MiB\n", tot_sec, (tot_sec / 2048)); 123 debug("- Used sectors : %llu = %llu MiB (%3.2f%%)\n", used_sec, 124 (used_sec / 2048), 100.0 * (float) used_sec / tot_sec); 125 } 126 127 /* 128 * Compression initialization 129 */ 83 130 void 84 131 compress_init (COMPRESS ** c, int block, unsigned long long bytes, … … 124 171 int ret, lout = c->outbuff - c->zptr->next_out; 125 172 size_t w; 126 static int nocomp = 0, slg = 0, sout = 0;173 //static int nocomp = 0, slg = 0, sout = 0; 127 174 128 175 c->zptr->next_in = data; … … 242 289 } 243 290 291 /* Write error */ 244 292 void 245 293 compress_write_error (void) 246 294 { 247 ui_write_error();248 // loop foreever249 while (1)250 sleep (1);295 fatal(); 296 fprintf(stderr, "ERROR: Write error ! Server's disk might be full.\n"); 297 ui_send("backup_write_error", 0); 298 exit(EXIT_FAILURE); 251 299 } 252 300 … … 265 313 unsigned short lg, datalg; 266 314 FILE *fo, *fs, *index; 267 unsigned char filename[128], firststring[200], *filestring,315 char filename[128], firststring[200], *filestring, *sec, 268 316 line[400], empty[] = "", numline[8]; 269 317 time_t start, now; 318 270 319 setblocksize(fi); 271 272 // debug("Compressing Image :\n");273 320 274 321 //debug("- Bitmap lg : %ld\n",p->bitmaplg); … … 281 328 skip = 0; 282 329 283 sprintf (firststring, "SECTORS=%l d|BLOCKS=%d|%s", p->nb_sect, nb, info);330 sprintf (firststring, "SECTORS=%llu|BLOCKS=%d|%s", p->nb_sect, nb, info); 284 331 285 332 sprintf (filename, "%sidx", nameprefix); 286 333 index = fopen (filename, "w"); 287 334 335 start = time(NULL); 336 288 337 #include "compress-loop.h" 289 338 339 now = time(NULL); 290 340 fclose (index); 291 292 } 341 342 sec = ui_send("close", 0); 343 debug("- saved in %d seconds\n", (int)difftime(now, start)); 344 } trunk/client/revimage/compress.h
r189 r197 18 18 #define BLKGETSIZE _IO(0x12,96) /* return device size /512 (long *arg) */ 19 19 20 #define debug(...) fprintf(stderr, __VA_ARGS__) 21 20 22 typedef struct { 21 23 unsigned char *bitmap; 22 24 unsigned long bitmaplg; 23 unsigned long nb_sect;25 unsigned long long nb_sect; 24 26 } PARAMS; 25 27 … … 49 51 //void setblocksize(FILE *f); 50 52 void setblocksize(int f); 53 void print_sect_info(long long unsigned tot_sec, long long unsigned used_sec); trunk/client/revimage/image_e2fs.c
r154 r197 54 54 55 55 #include "compress.h" 56 #include " ui_newt.h"56 #include "client.h" 57 57 58 58 #define in_use(m, x) (ext2fs_test_bit ((x), (m))) … … 60 60 #define _(a) a 61 61 62 unsigned long info1; 63 unsigned long info2; 62 char info1[32], info2[32]; 64 63 65 64 static void … … 151 150 } 152 151 153 info1 = ((long) fs->super->s_blocks_count * nbsect); 154 info2 = used; 152 sprintf(info1, "%lu", ((long) fs->super->s_blocks_count * nbsect)); 153 sprintf(info2, "%lu", used); 154 print_sect_info(((long) fs->super->s_blocks_count * nbsect), used); 155 155 156 } 156 157 … … 164 165 char *device_name; 165 166 PARAMS p; 166 FILE *fi;167 167 int big_endian; 168 168 int fd; … … 190 190 if (big_endian) 191 191 debug (_("Note: This is a byte-swapped filesystem\n")); 192 list_super (fs->super);192 //list_super (fs->super); 193 193 194 194 retval = ext2fs_read_bitmaps (fs); … … 206 206 exit (0); 207 207 208 init_newt (argv[1], argv[2], info1, info2, argv[0]);208 ui_send("init_backup", 5, argv[1], argv[2], info1, info2, argv[0]); 209 209 fd = open (argv[1], O_RDONLY); 210 210 p.nb_sect = 0; 211 211 compress_volume (fd, argv[2], &p, "E2FS=1|TYPE=131"); 212 212 close (fd); 213 stats();214 close_newt ();215 213 216 214 exit (0); trunk/client/revimage/image_jfs.c
r154 r197 35 35 36 36 #include "compress.h" 37 #include " ui_newt.h"37 #include "client.h" 38 38 39 unsigned long info1, info2;39 char info1[32], info2[32]; 40 40 41 41 void checkit(char *dev) … … 98 98 } 99 99 100 info1 = size;101 info2 = size;102 100 sprintf(info1, "%u", size); 101 sprintf(info2, "%u", size); 102 print_sect_info(size, size); 103 103 } 104 104 … … 123 123 allocated_sectors(¶ms, argv[1]); 124 124 125 init_newt (argv[1], argv[2], info1, info2, argv[0]);125 ui_send("init_backup", 5, argv[1], argv[2], info1, info2, argv[0]); 126 126 fd = open (argv[1], O_RDONLY); 127 127 compress_volume (fd, argv[2], ¶ms, ""); 128 128 close (fd); 129 stats(); 130 close_newt (); 131 129 132 130 return 0; 133 131 } trunk/client/revimage/image_lvm.c
r154 r197 5 5 #include "config.h" 6 6 7 #define _GNU_SOURCE8 7 #include <stdio.h> 9 8 #include <stdlib.h> … … 28 27 29 28 #include "compress.h" 30 #include " ui_newt.h"29 #include "client.h" 31 30 #include "lvm.h" 32 31 33 unsigned long info1, info2;32 char info1[32], info2[32]; 34 33 unsigned long lvm_sect; 35 34 … … 56 55 setbit(p->bitmap, i); 57 56 58 info1 = off; 59 info2 = off; 57 sprintf(info1, "%u", off); 58 sprintf(info2, "%u", off); 59 print_sect_info(off, off); 60 60 61 } 61 62 … … 84 85 // Compress now 85 86 86 init_newt(argv[1], argv[2], info1, info2, argv[0]);87 ui_send("init_backup", 5, argv[1], argv[2], info1, info2, argv[0]); 87 88 fd = open(argv[1], O_RDONLY); 88 89 89 90 compress_volume(fd, argv[2], ¶ms, "LVM"); 90 91 close(fd); 91 stats();92 close_newt();93 92 94 93 return 0; trunk/client/revimage/image_lvmreiserfs.c
r154 r197 23 23 #include "config.h" 24 24 25 #define _GNU_SOURCE26 25 #include <stdio.h> 27 26 #include <stdlib.h> … … 51 50 52 51 #include "compress.h" 53 #include " ui_newt.h"52 #include "client.h" 54 53 #include "lvm.h" 55 54 … … 60 59 } CPARAMS; 61 60 62 unsigned long info1, info2;61 char info1[32], info2[32]; 63 62 unsigned long lvm_sect = 0; 64 63 … … 296 295 } 297 296 298 info1 = p->nb_sect + off; 299 info2 = used + off; 297 sprintf(info1, "%lu", p->nb_sect + off); 298 sprintf(info2, "%lu", used + off); 299 print_sect_info(p->nb_sect + off, used + off); 300 300 301 301 if (p->nb_sect != lvm_sect && lvm_sect != 0) { … … 360 360 // 361 361 362 init_newt(argv[1], argv[2], info1, info2, argv[0]);362 ui_send("init_backup", 5, argv[1], argv[2], info1, info2, argv[0]); 363 363 fd = open(argv[1], O_RDONLY); 364 364 compress_volume(fd, argv[2], ¶ms, "RFS3"); 365 365 close(fd); 366 stats();367 close_newt();368 366 369 367 return 0; trunk/client/revimage/image_raw.c
r154 r197 21 21 */ 22 22 23 #include " config.h"23 #include "../config.h" 24 24 25 25 #include <stdio.h> … … 35 35 36 36 #include "compress.h" 37 #include " ui_newt.h"37 #include "client.h" 38 38 39 40 unsigned long info1, info2; 39 char info1[32], info2[32]; 41 40 42 41 void … … 44 43 { 45 44 int i, fd, bytes; 46 int size;45 unsigned int size; 47 46 48 47 if ((fd = open (dev, O_RDONLY)) == -1) exit(1); … … 74 73 } 75 74 76 info1 = size;77 info2 = size;78 75 sprintf(info1, "%u", size); 76 sprintf(info2, "%u", size); 77 print_sect_info(size, size); 79 78 } 80 79 … … 96 95 allocated_sectors(¶ms, argv[1]); 97 96 98 init_newt (argv[1], argv[2], info1, info2, argv[0]);97 ui_send("init_backup", 5, argv[1], argv[2], info1, info2, argv[0]); 99 98 fd = open (argv[1], O_RDONLY); // |O_DIRECT); 100 99 compress_volume (fd, argv[2], ¶ms, ""); 101 100 close (fd); 102 stats(); 103 close_newt (); 104 101 105 102 return 0; 106 103 } trunk/client/revimage/image_swap.c
r154 r197 29 29 30 30 #include "compress.h" 31 #include " ui_newt.h"31 #include "client.h" 32 32 33 unsigned long info1, info2;33 char info1[32], info2[32]; 34 34 35 35 void … … 62 62 p->bitmap[i] = 0xFF; 63 63 64 info1 = p->nb_sect; 65 info2 = used; 64 sprintf(info1, "%u", p->nb_sect); 65 sprintf(info2, "%u", used); 66 print_sect_info(p->nb_sect, used); 66 67 } 67 68 … … 92 93 // 93 94 94 init_newt (argv[1], argv[2], info1, info2, argv[0]);95 ui_send("init_backup", 5, argv[1], argv[2], info1, info2, argv[0]); 95 96 fd = open (argv[1], O_RDONLY); 96 97 compress_volume (fd, argv[2], ¶ms, "SWAP=1"); 97 98 close (fd); 98 close_newt (); 99 99 100 100 return 0; 101 101 } trunk/client/revimage/image_xfs.c
r154 r197 36 36 37 37 #include "compress.h" 38 #include " ui_newt.h"38 #include "client.h" 39 39 #include "image_xfs.h" 40 40 41 unsigned long info1, info2;41 char info1[32], info2[32]; 42 42 43 43 struct xfs_superblock sb; … … 46 46 void scanSbtree(int fd, PARAMS *p, struct xfs_agf *agf, __u32 root, __u32 levels); 47 47 void scanfuncBno(int fd, PARAMS *p, char *ablock, __u32 level, struct xfs_agf *agf); 48 49 48 50 49 /* */ … … 263 262 } 264 263 265 info1 = p->nb_sect;266 info2 = used;267 264 sprintf(info1, "%llu", p->nb_sect); 265 sprintf(info2, "%llu", used); 266 print_sect_info(p->nb_sect, used); 268 267 } 269 268 … … 286 285 exit (0); 287 286 288 init_newt (argv[1], argv[2], info1, info2, argv[0]);287 ui_send("init_backup", 5, argv[1], argv[2], info1, info2, argv[0]); 289 288 fd = open (argv[1], O_RDONLY); 290 289 compress_volume (fd, argv[2], ¶ms, "XFS"); 291 290 close (fd); 292 stats();293 close_newt ();294 291 295 292 return 0; trunk/client/revimage/lvm.c
r146 r197 24 24 #include <sys/vfs.h> 25 25 26 #include " ui_newt.h"26 #include "compress.h" 27 27 28 28 #define FMTT_MAGIC "\040\114\126\115\062\040\170\133\065\101\045\162\060\116\052\076"
