clri.c revision 68d61a2ab46a1501e83fac49f51d3dc6b057f856
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Portions of this source code were derived from Berkeley 4.3 BSD
* under license from the Regents of the University of California.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* clri filsys inumber ...
*/
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
#include <string.h>
#include "roll_log.h"
static union {
} sb_un;
static int status;
static int isnumber(const char *s);
int
{
int i, f;
unsigned int n;
int j;
time_t t;
int sbrr;
if (argc < 3) {
(void) printf("ufs usage: clri filsys inumber ...\n");
return (35);
}
if (f < 0) {
return (35);
}
return (sbrr);
}
(void) printf("bad super block magic number\n");
return (35);
}
(void) printf(
"unrecognized version of UFS on-disk format: %d\n",
return (35);
}
/* If fs is logged, roll the log. */
case RL_SUCCESS:
/*
* Reread the superblock. Rolling the log may have
* changed it.
*/
return (sbrr);
}
break;
case RL_SYSERR:
(void) printf("Warning: Cannot roll log for %s. %s. "
"Inodes will be cleared anyway.\n",
break;
default:
(void) printf("Cannot roll log for %s. "
"Inodes will be cleared anyway.\n",
argv[1]);
break;
}
}
for (i = 2; i < argc; i++) {
status = 1;
continue;
}
if (n == 0) {
status = 1;
continue;
}
status = 1;
}
}
if (status)
return (status+31);
/*
* Update the time in superblock, so fsck will check this filesystem.
*/
(void) time(&t);
return (35);
}
for (i = 2; i < argc; i++) {
(void) printf("clearing %u\n", n);
}
if (status)
return (status+31);
(void) close(f);
return (0);
}
static int
isnumber(const char *s)
{
int c;
while ((c = *s++) != '\0')
if (c < '0' || c > '9')
return (0);
return (1);
}
static int
{
return (35);
} else {
return (0);
}
}