/*
* Copyright 1999 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 */
/*
* Copyright (c) 1980, 1986, 1990 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that: (1) source distributions retain this entire copyright
* notice and comment, and (2) distributions including binaries display
* the following acknowledgement: ``This product includes software
* developed by the University of California, Berkeley and its contributors''
* in the documentation or other materials provided with the distribution
* and in all advertising materials mentioning features or use of this
* software. Neither the name of the University nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <strings.h>
#include <malloc.h>
#include <sys/sysmacros.h>
#include "fsck.h"
#include "udfs.h"
#include <locale.h>
/*
* for each large file ( size > MAXOFF_T) this global counter
* gets incremented here.
*/
extern unsigned int largefile_count;
extern void pwarn(char *, ...);
extern void pfatal(char *, ...);
extern void errexit(char *, ...);
extern char *tagerrs[];
extern void putfilentry(struct bufarea *);
extern void ud_swap_short_ad(short_ad_t *);
extern void ud_swap_long_ad(long_ad_t *);
extern void dump16(char *, char *);
static void opndir(struct file_entry *);
u_offset_t *, struct file_id **);
static void ckinode(struct file_entry *);
struct bufarea *getfilentry();
/* Fields for traversing an allocation extent */
/* Keep track of where we are in the directory */
void
pass1()
{
int err;
goto next;
}
/* LINTED */
"directory\n"));
if (debug) {
(void) printf("do %x len %d type %d lcount %d"
" lseen %d end %llx\n",
}
case FTYPE_DIRECTORY:
n_dirs++;
offset = 0;
if (err) {
"file %x at offset %llx\n"),
}
continue;
}
if (dirbuf) {
}
if (fbp)
if (debug)
break;
case FTYPE_FILE:
case FTYPE_SYMLINK:
default:
n_files++;
break;
}
next:
/* At end of this set of fips, get the next set */
}
/* Find bad link counts */
/* At end of this set of fips, get the next set */
}
}
static void
{
if (dirbuf) {
}
if (extbuf) {
}
dir_baseoff = 0;
dir_basesize = 0;
dir_adrindx = 0;
case ICB_FLAG_SHORT_AD:
dir_adrsize = sizeof (short_ad_t);
break;
case ICB_FLAG_LONG_AD:
dir_adrsize = sizeof (long_ad_t);
break;
case ICB_FLAG_EXT_AD:
break;
case ICB_FLAG_ONE_AD:
dir_adrsize = 0;
dir_naddrs = 0;
dir_adrlist = NULL;
break;
}
}
/* Allocate and read in an allocation extent */
/* ARGSUSED */
int
{
int i;
int err;
if (debug)
if (extbuf)
gettext("Can't read allocation extent\n"));
return (1);
}
/* LINTED */
if (err) {
(void) printf(
return (1);
}
dir_adrindx = 0;
/* Swap the descriptors */
if (dir_adrsize == sizeof (short_ad_t)) {
/* LINTED */
} else if (dir_adrsize == sizeof (long_ad_t)) {
/* LINTED */
}
}
return (0);
}
/*
* Variables used in this function and their relationships:
* *poffset - read pointer in the directory
* dir_baseoff - offset at start of dirbuf
* dir_baselen - length of valid data in current extent
* dir_adrindx - index into current allocation extent for location of
* dir_baseoff
* dir_naddrs - number of entries in current allocation extent
* dir_fidp - pointer to dirbuf or immediate data in file entry
* baseblock - block address of dir_baseoff
* newoff - *poffset - dir_baseoff
*/
/* ARGSUSED1 */
static int32_t
{
/* LINTED */
if (debug)
if (newoff >= dir_basesize) {
if (dirbuf) {
}
} else {
if (block == 0)
goto nextone;
}
case ICB_FLAG_SHORT_AD:
/* LINTED */
if (type == 3) {
if (i < dir_naddrs - 1)
"at end of list\n"));
return (1);
goto again3;
}
break;
dir_baseoff += len;
if (debug)
(void) printf(
len);
}
dir_adrindx = i;
if (debug)
sap->sad_ext_len);
if (block == 0)
dir_basesize = len;
if (type < 2)
if (type != 0) {
*poffset += dir_basesize;
goto again;
}
"buffer\n"));
}
break;
case ICB_FLAG_LONG_AD:
/* LINTED */
if (type == 3) {
if (i < dir_naddrs - 1)
"at end of list\n"));
return (1);
goto again3;
}
break;
dir_baseoff += len;
if (debug)
(void) printf(
len);
}
dir_adrindx = i;
if (debug)
lap->lad_ext_len);
if (block == 0)
dir_basesize = len;
if (type < 2)
if (type != 0) {
*poffset += dir_basesize;
goto again;
}
"buffer\n"));
}
break;
case ICB_FLAG_EXT_AD:
break;
case ICB_FLAG_ONE_AD:
"case\n"));
break;
}
if (debug)
(void) printf("getdirend blk %x dir_baseoff %llx newoff %x\n",
/*
* If we have a fid that crosses an extent boundary, then force
* a read of the next extent, and fill up the rest of the fid.
*/
if (debug)
(void) printf("block crossing at offset %llx\n",
offset);
goto again2;
}
if (debug) {
}
if (err) {
return (err);
}
return (0);
}
static void
{
case ICB_FLAG_SHORT_AD:
dir_adrsize = sizeof (short_ad_t);
/* LINTED */
for (i = 0; i < dir_naddrs; i++, sap++) {
if (type < 2)
if (debug)
(void) printf(
sap->sad_ext_len);
if (type == 3) {
/* This changes dir_naddrs and dir_adrlist */
break;
/* LINTED */
goto again1;
}
}
break;
case ICB_FLAG_LONG_AD:
dir_adrsize = sizeof (long_ad_t);
/* LINTED */
for (i = 0; i < dir_naddrs; i++, lap++) {
if (type < 2)
if (debug)
(void) printf(
lap->lad_ext_len);
if (type == 3) {
/* This changes dir_naddrs and dir_adrlist */
break;
/* LINTED */
goto again2;
}
}
break;
case ICB_FLAG_EXT_AD:
break;
case ICB_FLAG_ONE_AD:
break;
}
}
static void
{
/* LINTED */
if (preen) {
(void) printf("\n");
}
}
}
}
void
{
register int i;
return;
/* Flip bits in the busy map */
/* Mark leftovers in byte as allocated */
}
}
void
dolvint()
{
lvintlen);
}
}