~ubuntu-branches/debian/stretch/jfsutils/stretch

« back to all changes in this revision

Viewing changes to logredo/xlogredo.c

  • Committer: Bazaar Package Importer
  • Author(s): Christopher L Cheney
  • Date: 2002-02-10 01:00:00 UTC
  • Revision ID: james.westby@ubuntu.com-20020210010000-v63g4150dcpnehzq
Tags: upstream-1.0.14
ImportĀ upstreamĀ versionĀ 1.0.14

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *   Copyright (c) International Business Machines  Corp., 2000
 
3
 *
 
4
 *   This program is free software;  you can redistribute it and/or modify
 
5
 *   it under the terms of the GNU General Public License as published by
 
6
 *   the Free Software Foundation; either version 2 of the License, or
 
7
 *   (at your option) any later version.
 
8
 *
 
9
 *   This program is distributed in the hope that it will be useful,
 
10
 *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
 
11
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
 
12
 *   the GNU General Public License for more details.
 
13
 *
 
14
 *   You should have received a copy of the GNU General Public License
 
15
 *   along with this program;  if not, write to the Free Software
 
16
 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
17
 *
 
18
 *   MODULE_NAME:               xlogredo.c
 
19
 *
 
20
 *   COMPONENT_NAME:    jfs utilities
 
21
 *
 
22
 *
 
23
 *   FUNCTIONS:
 
24
 *       main
 
25
 *
 
26
*/
 
27
 
 
28
#include "config.h"
 
29
 
 
30
#include <stdarg.h>
 
31
#include <stddef.h>
 
32
#include <stdio.h>
 
33
#include <string.h>
 
34
#include <stdlib.h>
 
35
#include <pwd.h>
 
36
#include <unistd.h>
 
37
 
 
38
#include "jfs_types.h"
 
39
#include "jfs_version.h"
 
40
#include "devices.h"
 
41
 
 
42
/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 
43
 *
 
44
 * For message processing in called routines
 
45
 *
 
46
 */
 
47
 
 
48
char message_parm_0[64];
 
49
char message_parm_1[64];
 
50
char message_parm_2[64];
 
51
char message_parm_3[64];
 
52
char message_parm_4[64];
 
53
char message_parm_5[64];
 
54
char message_parm_6[64];
 
55
char message_parm_7[64];
 
56
char message_parm_8[64];
 
57
char message_parm_9[64];
 
58
 
 
59
char *msgprms[10] = { message_parm_0, message_parm_1, message_parm_2,
 
60
  message_parm_3, message_parm_4, message_parm_5,
 
61
  message_parm_6, message_parm_7, message_parm_8,
 
62
  message_parm_9};
 
63
 
 
64
int16_t msgprmidx[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
 
65
 
 
66
char message_buffer_0[256];
 
67
char message_buffer_1[1024];
 
68
char message_buffer_2[1024];
 
69
char *terse_msg_ptr =   &message_buffer_0[0];
 
70
char *verbose_msg_ptr = &message_buffer_1[0];
 
71
char *msgs_txt_ptr =    &message_buffer_2[0];
 
72
unsigned long msgs_txt_maxlen = 1024;
 
73
 
 
74
extern char *MsgText[];
 
75
 
 
76
extern void fsck_send_msg( int, int, int );        /* defined in fsckmsg.c */
 
77
extern int alloc_wrksp( uint32_t, int, int, void ** );  /* defined in fsckwsp.c */
 
78
 
 
79
 
 
80
/*
 
81
 *      main()
 
82
 */
 
83
int main( int argc, char **argv)
 
84
{
 
85
  int32_t  rc;
 
86
  int32_t  Blksize;
 
87
  HFILE    fd;
 
88
  caddr_t  dev_name;
 
89
  extern int32_t jfs_logredo(caddr_t, int32_t, int32_t );
 
90
 
 
91
  printf( "logredo version %s, %s\n", 
 
92
          VERSION, JFSUTILS_DATE);
 
93
   
 
94
  if (argc < 2) {
 
95
    fprintf (stderr, "Usage: logredo <block device>\n");
 
96
    return -1;
 
97
  }
 
98
 
 
99
  dev_name = *++argv;
 
100
 
 
101
  rc = ujfs_open_device(dev_name, &fd, &Blksize, RDWR_EXCL);
 
102
 
 
103
  if ( rc != 0 ) {
 
104
    fprintf(stderr,"Error: Cannot open device %s, rc = %d.\n",
 
105
            dev_name, rc);
 
106
    return(-1);
 
107
  }
 
108
 
 
109
  /*
 
110
   * logredo it
 
111
   */
 
112
 
 
113
  if ( (rc = jfs_logredo(dev_name, fd, 0)) ) {
 
114
    fprintf (stderr, "Failure replaying log: %d\n",rc);
 
115
    return -1;
 
116
  }
 
117
  return 0;
 
118
}  /* end main() */