Changeset 197

Show
Ignore:
Timestamp:
01/25/07 18:20:24 (2 years ago)
Author:
ludo
Message:

new client/server protocol for the UI (from r3948)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/client/revimage/Makefile

    r189 r197  
    33# 
    44 
    5 OBJ=compress.o ui_newt.o 
    6 LIBOBJ=compress.o ui_newt.o 
     5OBJ=compress.o  
     6LIBOBJ=compress.o easy_sock.o client.o 
    77 
    88ZLIB=./zlib 
     
    1111CFLAGS=-Wall -O2 -DLBLIMAGEVER=\"1.2\" -I$(ZLIB) -I./e2fsprogs-1.22/lib/  
    1212LDFLAGS=-s 
    13 LIBS= -lnewt -L. -llrs 
     13LIBS= -L. -llrs 
    1414RFSLIBS=-L./reiserfsprogs/lib/ -lcore -lmisc 
    1515 
    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_error image_raw decompress-bitmap 
     16all: $(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 
    2020 
    2121depend: 
    2222        gcc -M $(CFLAGS) *.c >.depend 
    2323 
    24 #image_fat: image_fat.o  
     24image_fat:  
    2525#       cc $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) 
    2626 
     
    3131        cc $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) 
    3232 
    33 #image_ntfs: image_ntfs.o 
     33image_ntfs: 
    3434#       cc $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) 
    3535 
     
    5858        cc $(CFLAGS) $(LDFLAGS) -o $@ $< -L. -llrs -lnewt 
    5959 
    60 #image_reiserfs: image_reiserfs.o lvm.o  
    61 #       cc $(CFLAGS) -o $@ $(OBJ) $< $(LIBS) $(RFSLIBS) 
    62  
    63 image_error: image_error.o 
    64         cc $(CFLAGS) -s -o $@ $< $(LIBS)  
    65  
    6660image_e2fs.o: image_e2fs.c compress.h compress-loop.h config.h 
    6761        cc $(CFLAGS) -o image_e2fs.o -c image_e2fs.c -I./e2fsprogs-1.22/lib 
    6862 
    69 liblrs.so.1: $(OBJ) 
     63liblrs.so.1: $(LIBOBJ) 
    7064        gcc -shared -Wl,-soname,liblrs.so.1 -o liblrs.so.1 $^ $(ZLIBOBJ) 
    7165        strip $@ 
    7266        ln -sf $@ liblrs.so 
    7367 
    74 liblrs.a: $(OBJ) 
     68liblrs.a: $(LIBOBJ)  
    7569        ar rc $@ $^ $(ZLIBOBJ) 
    7670        ranlib $@ 
    7771 
    78  
    7972include .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 -pedantic 
    2 LIBS=-L../zlib-1.2.1/ -lz -lnewt -s 
     1CFLAGS=-I../zlib  -Wall -DLBLIMAGEVER=\"1.4\"  -Os -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Wall 
     2LIBS=-L.. -llrs -s 
    33CC=gcc 
    44 
    5 autorestore: autorestore.o ui_newt.o Makefile 
    6         $(CC) $(CFLAGS) -o $@ autorestore.o ui_newt.o $(LIBS)  
     5autorestore: autorestore.o Makefile 
     6        $(CC) $(CFLAGS) -o $@ autorestore.o $(LIBS)  
  • trunk/client/revimage/autorestore/autorestore.c

    r190 r197  
    3737#include <getopt.h> 
    3838#include <ctype.h> 
     39#include <errno.h> 
    3940#include <sys/types.h> 
    4041#include <sys/stat.h> 
     
    5354 
    5455//#include "autosave.h" 
    55 #include "ui_newt.h" 
     56#include "../client.h" 
    5657 
    5758#define DEBUG(a) 
     
    8788 
    8889/* paths mainly used  by mtftp restoration */ 
    89 unsigned char servip[40] = ""; 
    90 unsigned char servprefix[80] = ""; 
    91 unsigned char storagedir[80] = ""; 
     90unsigned char servip[40] = "127.0.0.1"; 
     91unsigned char servprefix[80] = "/"; 
     92unsigned char storagedir[80] = "/"; 
    9293char hostname[32] = ""; 
    9394 
     
    135136 
    136137/* KB decompressed */ 
    137 int todo = 0, done = 0; 
     138unsigned int todo = 0, done = 0; 
     139char todos[32]; 
    138140 
    139141/* 
     
    159161int mysystem(const char *s) 
    160162{ 
    161     char cmd[1024]; 
     163    char cmd[1025]; 
    162164    FILE *foerr; 
    163165 
    164     strncpy(cmd, s, 1024 - sizeof(logtxt) - 9 - 1); 
     166    strncpy(cmd, s, 1024 - strlen(logtxt) - 9 - 1); 
    165167    strcat(cmd, " >> "); 
    166168    strcat(cmd, logtxt); 
     
    225227        return; 
    226228    system("revosendlog 8"); 
    227     while (1) 
    228         sleep(1); 
     229    exit(EXIT_FAILURE); 
     230
     231 
     232/* Update the current file label */ 
     233void 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 */ 
     243void 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 
     271void 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 */ 
     278void ui_zlib_error(int err) 
     279
     280    char tmp[32]; 
     281 
     282    sprintf(tmp, "%d", err); 
     283    ui_send("zlib_error", 1, tmp); 
    229284} 
    230285 
     
    285340        system("umount /revosave"); 
    286341        /* 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"); 
    290343        system("mount -t iso9660 /dev/cdrom /revosave"); 
    291344        goto retry; 
     
    321374    chdir("/tmpfs"); 
    322375    if (!nonewt) 
    323         update_file(fname, filenum, -2, "Waiting", done); 
     376        update_file(fname, filenum, -2, "Waiting"); 
    324377    sprintf(cmd, "revowait %s", f); 
    325378    system(cmd); 
    326379    if (!nonewt) 
    327         update_file(fname, filenum, -2, "Downloading", done); 
     380        update_file(fname, filenum, -2, "Downloading"); 
    328381    /* get files */ 
    329382    do { 
     
    414467//      {int i; for(i=0;i<15;i++) printf("%02x ",ptr[i]); printf("\n");} 
    415468        if (cp->fo) { 
    416           if (write(cp->fo, ptr, 512) != 512) { 
     469          if (write(cp->fo, ptr, 512) != 512) { 
    417470                ui_write_error(__FILE__, __LINE__, errno, cp->fo); 
    418471            } 
     
    435488    int fo;                     /* output device */ 
    436489    z_stream zptr; 
    437     int state, filenum, fmax = -1
     490    int state, filenum, fmax = -1, upcnt
    438491    int ret, firstpass, bitmaplg; 
    439492    FILE *fi; 
     
    469522      start: 
    470523        if (!nonewt) 
    471             update_file(fname, filenum, fmax, device, done); 
     524            update_file(fname, filenum, fmax, device); 
    472525 
    473526        state = Z_SYNC_FLUSH; 
     
    482535        fi = fops.open(fname, filenum); 
    483536        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"); 
    486538            fatal(); 
    487539        } 
     
    498550        inflateInit(&zptr); 
    499551 
     552        upcnt = 0; 
    500553        do { 
    501 //  if (inflateSyncPoint(&zptr)) printf("#"); 
    502  
     554            /* decompress */ 
    503555            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            } 
    509563            if ((ret == Z_OK) && (zptr.avail_out == 0)) { 
    510564                if (firstpass) { 
     
    569623        inflateEnd(&zptr); 
    570624 
    571  
    572625        if (ret < 0) { 
    573626            /*printf ("Returned : %d\t", ret); 
     
    675728    } 
    676729 
    677     f = fopen("/revoinfo/hostname", "r"); 
     730    tmprintf("%s/hostname", revoinfo); 
     731    f = fopen(tmppath, "r"); 
    678732    if (f == NULL) 
    679733        return; 
     
    805859        if (!nolrs) 
    806860            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); 
    811863        while (1) 
    812864            sleep(1); 
     
    10141066    gethost(); 
    10151067    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); 
    10191071    if (!nolrs) 
    10201072        system("revosendlog 2"); 
     
    10271079    system(tmprintf("echo \"\">%s/progress.txt", revoinfo)); 
    10281080    mysystem1("cat /var/log/messages"); 
    1029  
    1030     if (!nonewt) 
    1031         close_newt(); 
     1081     
     1082    ui_send("close", 0); 
     1083     
    10321084    return 0; 
    10331085} 
     1086 
  • trunk/client/revimage/autorestore/revoboot

    r190 r197  
    288288# Env Set-up 
    289289# 
     290ulimit -c 100000 
    290291[ ! -f /etc/cmdline ] && cp -f /proc/cmdline /etc 
    291292ETH=`cat /etc/eth` 
     
    330331grep -q revodebug /etc/cmdline && exit 0 
    331332 
     333# Launch the UI 
     334[ -x /bin/uinewt ] && /bin/uinewt & 
     335 
    332336# CDROM boot ? 
    333337grep -q revocdrom /etc/cmdline && do_cdrom 
  • trunk/client/revimage/autorestore/ui_newt.c

    r152 r197  
    119119 
    120120  if (max == -1)  
    121     sprintf (buf, "- Restoring : %s%03d  -> %s\n       ", f, n, dev); 
     121    snprintf (buf, 255, "- Restoring : %s%03d  -> %s\n       ", f, n, dev); 
    122122  else if (max == -2) 
    123     sprintf (buf, "- Restoring : %s%03d (%s)  ", f, n, dev); 
     123    snprintf (buf, 255, "- Restoring : %s%03d (%s)  ", f, n, dev); 
    124124  else  
    125     sprintf (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); 
    126126  newtLabelSetText(i2, buf); 
    127127  newtRefresh(); 
     
    230230} 
    231231 
    232 /* fatal write error */ 
     232/*  
     233 * fatal write error  
     234 */ 
    233235void ui_seek_error(char *s, int l, int err, int fd, off64_t seek) 
    234236{ 
     
    271273} 
    272274 
     275 
    273276void ui_write_error(char *s, int l, int err, int fd) 
    274277{ 
  • trunk/client/revimage/autosave/Makefile

    r75 r197  
    11autosave: autosave.c Makefile 
    2         gcc -Os -Wall -o autosave autosave.c 
     2        gcc -Os -s -Wall -o autosave autosave.c -L.. -llrs 
  • trunk/client/revimage/autosave/autosave.c

    r190 r197  
    5858 
    5959#include "autosave.h" 
     60#include "../client.h" 
    6061 
    6162#define DEBUG(a) 
     
    384385    if (stat( tmprintf("%s/CONF", revosave) , &st) == 0) { 
    385386        /* 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 
    389389#ifndef TEST 
    390         while (1) 
    391             sleep(1); 
     390        exit(1); 
    392391#endif 
    393392    } 
     
    635634                dnum, poff[i], ttype[i]); 
    636635        fclose(foerr); 
     636 
     637        fatal(); 
    637638        /* 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)", 
    640640                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); 
    645642 
    646643    } 
     
    652649    if (backuped == 0) { 
    653650        /* nothing backuped !!! */ 
    654         sprintf(command, 
    655                 "/revobin/image_error \"Nothing was backuped !\nMaybe your disk controller was not recognized...\""); 
    656         mysystem(command); 
    657651        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..."); 
    660654    } 
    661655 
  • trunk/client/revimage/compress-loop.h

    r12 r197  
    55 
    66      //debug("- Block %d : O",i+1); 
    7 #ifndef BENCH 
    8       update_block (i, nb); 
    9 #endif 
    10  
    117#ifdef BENCH 
    128      sprintf (filename, "/dev/null"); 
     
    6056        { 
    6157          //debug("%3d\b\b\b",(100*j)/lg); 
    62           if (j % 100 == 0) 
     58          if (j % 200 == 0) 
    6359            { 
    6460#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); 
    6664#endif 
    6765            } 
     
    7472                  if (skip) 
    7573                    { 
    76 //                    if (fseek (fi, skip, SEEK_CUR)) UI_READ_ERROR; 
    7774                      if (lseek (fi, skip, SEEK_CUR) == -1) UI_READ_ERROR; 
    7875                      c->cbytes += skip; 
    7976                    } 
    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); 
    8277                  if (read (fi, dataptr, 512) != 512) UI_READ_ERROR; 
    83 //                if (read (fi, dataptr, 512) != 512) ui_read_error("read", k, j, fi); 
    8478                  skip = 0; 
    8579                  dataptr += 512; 
  • trunk/client/revimage/compress.c

    r154 r197  
    2626#include <stdlib.h> 
    2727#include <unistd.h> 
     28#include <errno.h> 
    2829#include <sys/ioctl.h> 
    2930#include <linux/fs.h> 
    3031#include <string.h> 
     32#include <time.h> 
    3133 
    3234#include "compress.h" 
    33 #include "ui_newt.h" 
     35#include "client.h" 
    3436 
    3537#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) 
    3639 
    3740/* Check that off_t can represent 2**63 - 1 correctly. 
     
    4750 
    4851unsigned long long done, todo; 
    49  
     52  
    5053#if 0 
    5154void setblocksize(FILE *f) 
     
    8184#endif 
    8285 
     86 
     87/* Fatal error, notify the server about it */ 
     88void fatal(void) 
     89{ 
     90    system("/bin/revosendlog 8"); 
     91} 
     92 
     93/* 
     94 * backup read error: disk dead ? out of bounds read ? 
     95 */ 
     96void 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 */ 
     120void 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 */ 
    83130void 
    84131compress_init (COMPRESS ** c, int block, unsigned long long bytes, 
     
    124171  int ret, lout = c->outbuff - c->zptr->next_out; 
    125172  size_t w; 
    126   static int nocomp = 0, slg = 0, sout = 0; 
     173  //static int nocomp = 0, slg = 0, sout = 0; 
    127174 
    128175  c->zptr->next_in = data; 
     
    242289} 
    243290 
     291/* Write error */ 
    244292void 
    245293compress_write_error (void) 
    246294{ 
    247   ui_write_error (); 
    248   // loop foreever 
    249   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); 
    251299} 
    252300 
     
    265313  unsigned short lg, datalg; 
    266314  FILE *fo, *fs, *index; 
    267   unsigned char filename[128], firststring[200], *filestring
     315  char filename[128], firststring[200], *filestring, *sec
    268316    line[400], empty[] = "", numline[8]; 
    269  
     317  time_t start, now; 
     318   
    270319  setblocksize(fi); 
    271  
    272   // debug("Compressing Image :\n"); 
    273320 
    274321  //debug("- Bitmap lg    : %ld\n",p->bitmaplg); 
     
    281328  skip = 0; 
    282329 
    283   sprintf (firststring, "SECTORS=%ld|BLOCKS=%d|%s", p->nb_sect, nb, info); 
     330  sprintf (firststring, "SECTORS=%llu|BLOCKS=%d|%s", p->nb_sect, nb, info); 
    284331 
    285332  sprintf (filename, "%sidx", nameprefix); 
    286333  index = fopen (filename, "w"); 
    287334 
     335  start = time(NULL); 
     336   
    288337#include "compress-loop.h" 
    289338 
     339  now = time(NULL); 
    290340  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  
    1818#define BLKGETSIZE _IO(0x12,96) /* return device size /512 (long *arg) */ 
    1919 
     20#define debug(...) fprintf(stderr, __VA_ARGS__) 
     21 
    2022typedef struct { 
    2123  unsigned char *bitmap; 
    2224  unsigned long bitmaplg; 
    23   unsigned long nb_sect; 
     25  unsigned long long nb_sect; 
    2426} PARAMS; 
    2527 
     
    4951//void setblocksize(FILE *f); 
    5052void setblocksize(int f); 
     53void print_sect_info(long long unsigned tot_sec, long long unsigned used_sec); 
  • trunk/client/revimage/image_e2fs.c

    r154 r197  
    5454 
    5555#include "compress.h" 
    56 #include "ui_newt.h" 
     56#include "client.h" 
    5757 
    5858#define in_use(m, x)    (ext2fs_test_bit ((x), (m))) 
     
    6060#define _(a) a 
    6161 
    62 unsigned long info1; 
    63 unsigned long info2; 
     62char info1[32], info2[32]; 
    6463 
    6564static void 
     
    151150    } 
    152151 
    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   
    155156} 
    156157 
     
    164165  char *device_name; 
    165166  PARAMS p; 
    166   FILE *fi; 
    167167  int big_endian; 
    168168  int fd; 
     
    190190  if (big_endian) 
    191191    debug (_("Note: This is a byte-swapped filesystem\n")); 
    192   list_super (fs->super); 
     192  //list_super (fs->super); 
    193193 
    194194  retval = ext2fs_read_bitmaps (fs); 
     
    206206    exit (0); 
    207207 
    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]); 
    209209  fd = open (argv[1], O_RDONLY); 
    210210  p.nb_sect = 0; 
    211211  compress_volume (fd, argv[2], &p, "E2FS=1|TYPE=131"); 
    212212  close (fd); 
    213   stats(); 
    214   close_newt (); 
    215213 
    216214  exit (0); 
  • trunk/client/revimage/image_jfs.c

    r154 r197  
    3535 
    3636#include "compress.h" 
    37 #include "ui_newt.h" 
     37#include "client.h" 
    3838 
    39 unsigned long info1, info2
     39char info1[32], info2[32]
    4040 
    4141void checkit(char *dev) 
     
    9898  } 
    9999   
    100   info1 = size
    101   info2 = size
    102  
     100  sprintf(info1, "%u", size)
     101  sprintf(info2, "%u", size)
     102  print_sect_info(size, size); 
    103103} 
    104104 
     
    123123  allocated_sectors(&params, argv[1]); 
    124124 
    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]); 
    126126  fd = open (argv[1], O_RDONLY); 
    127127  compress_volume (fd, argv[2], &params, ""); 
    128128  close (fd); 
    129   stats(); 
    130   close_newt (); 
    131  
     129   
    132130  return 0; 
    133131} 
  • trunk/client/revimage/image_lvm.c

    r154 r197  
    55#include "config.h" 
    66 
    7 #define _GNU_SOURCE 
    87#include <stdio.h> 
    98#include <stdlib.h> 
     
    2827 
    2928#include "compress.h" 
    30 #include "ui_newt.h" 
     29#include "client.h" 
    3130#include "lvm.h" 
    3231 
    33 unsigned long info1, info2
     32char info1[32], info2[32]
    3433unsigned long lvm_sect; 
    3534 
     
    5655        setbit(p->bitmap, i); 
    5756 
    58     info1 = off; 
    59     info2 = off; 
     57    sprintf(info1, "%u", off); 
     58    sprintf(info2, "%u", off); 
     59    print_sect_info(off, off); 
     60 
    6061} 
    6162 
     
    8485    // Compress now 
    8586 
    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]); 
    8788    fd = open(argv[1], O_RDONLY); 
    8889 
    8990    compress_volume(fd, argv[2], &params, "LVM"); 
    9091    close(fd); 
    91     stats(); 
    92     close_newt(); 
    9392 
    9493    return 0; 
  • trunk/client/revimage/image_lvmreiserfs.c

    r154 r197  
    2323#include "config.h" 
    2424 
    25 #define _GNU_SOURCE 
    2625#include <stdio.h> 
    2726#include <stdlib.h> 
     
    5150 
    5251#include "compress.h" 
    53 #include "ui_newt.h" 
     52#include "client.h" 
    5453#include "lvm.h" 
    5554 
     
    6059} CPARAMS; 
    6160 
    62 unsigned long info1, info2
     61char info1[32], info2[32]
    6362unsigned long lvm_sect = 0; 
    6463 
     
    296295        } 
    297296 
    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); 
    300300 
    301301    if (p->nb_sect != lvm_sect && lvm_sect != 0) { 
     
    360360    // 
    361361 
    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]); 
    363363    fd = open(argv[1], O_RDONLY); 
    364364    compress_volume(fd, argv[2], &params, "RFS3"); 
    365365    close(fd); 
    366     stats(); 
    367     close_newt(); 
    368366 
    369367    return 0; 
  • trunk/client/revimage/image_raw.c

    r154 r197  
    2121 */ 
    2222 
    23 #include "config.h" 
     23#include "../config.h" 
    2424 
    2525#include <stdio.h> 
     
    3535 
    3636#include "compress.h" 
    37 #include "ui_newt.h" 
     37#include "client.h" 
    3838 
    39  
    40 unsigned long info1, info2; 
     39char info1[32], info2[32]; 
    4140 
    4241void 
     
    4443{ 
    4544  int i, fd, bytes; 
    46   int size; 
     45  unsigned int size; 
    4746 
    4847  if ((fd = open (dev, O_RDONLY)) == -1) exit(1); 
     
    7473  } 
    7574   
    76   info1 = size
    77   info2 = size
    78  
     75  sprintf(info1, "%u", size)
     76  sprintf(info2, "%u", size)
     77  print_sect_info(size, size); 
    7978} 
    8079 
     
    9695  allocated_sectors(&params, argv[1]); 
    9796 
    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]); 
    9998  fd = open (argv[1], O_RDONLY); // |O_DIRECT); 
    10099  compress_volume (fd, argv[2], &params, ""); 
    101100  close (fd); 
    102   stats(); 
    103   close_newt (); 
    104  
     101   
    105102  return 0; 
    106103} 
  • trunk/client/revimage/image_swap.c

    r154 r197  
    2929 
    3030#include "compress.h" 
    31 #include "ui_newt.h" 
     31#include "client.h" 
    3232 
    33 unsigned long info1, info2
     33char info1[32], info2[32]
    3434 
    3535void 
     
    6262    p->bitmap[i] = 0xFF; 
    6363 
    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); 
    6667} 
    6768 
     
    9293  // 
    9394 
    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]); 
    9596  fd = open (argv[1], O_RDONLY); 
    9697  compress_volume (fd, argv[2], &params, "SWAP=1"); 
    9798  close (fd); 
    98   close_newt (); 
    99  
     99   
    100100  return 0; 
    101101} 
  • trunk/client/revimage/image_xfs.c

    r154 r197  
    3636 
    3737#include "compress.h" 
    38 #include "ui_newt.h" 
     38#include "client.h" 
    3939#include "image_xfs.h" 
    4040 
    41 unsigned long info1, info2
     41char info1[32], info2[32]
    4242 
    4343struct xfs_superblock sb; 
     
    4646void scanSbtree(int fd, PARAMS *p, struct xfs_agf *agf, __u32 root, __u32 levels); 
    4747void scanfuncBno(int fd, PARAMS *p, char *ablock, __u32 level, struct xfs_agf *agf); 
    48  
    4948 
    5049/*  */ 
     
    263262   } 
    264263 
    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); 
    268267} 
    269268 
     
    286285    exit (0); 
    287286 
    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]); 
    289288  fd = open (argv[1], O_RDONLY); 
    290289  compress_volume (fd, argv[2], &params, "XFS"); 
    291290  close (fd); 
    292   stats(); 
    293   close_newt (); 
    294291 
    295292  return 0; 
  • trunk/client/revimage/lvm.c

    r146 r197  
    2424#include <sys/vfs.h> 
    2525 
    26 #include "ui_newt.h" 
     26#include "compress.h" 
    2727 
    2828#define FMTT_MAGIC "\040\114\126\115\062\040\170\133\065\101\045\162\060\116\052\076"