pass2a.c revision b9a41fd39fb451c441a90e8959cb2dc2db84b497
/*
* 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 */
/*
* 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 <stdlib.h>
#include <strings.h>
#include "fsck.h"
/* XXX should convert pass2a to using avl tree */
/*
* Directory contents table is keyed first by name length, and
* then the actual name.
*/
typedef struct dirtree {
int len;
} dirtree_t;
/*
* Tree of contents of directory currently being traversed.
* Elements are pointers to dirtree_t instances.
*/
static void *contents;
static int pass2acheck(struct inodesc *);
static void discard_contents(void);
static int dirtree_cmp(const void *, const void *);
/*
* Make sure directories don't contain duplicate names.
*/
void
pass2a(void)
{
continue;
/* != DSTATE also covers case of == USTATE */
continue;
}
}
/*
* Used to scan a particular directory, noting what entries it contains.
* If a duplicate entry is found, it is reported and the user given
* the option of clearing said entry.
*/
static int
{
void **foundp;
/*
* We've reached the end of the valid part of the directory.
*/
return (STOP);
}
"Duplicate entries in dir I=%d for ``%s'': I=%d and I=%d",
} else {
iscorrupt = 1;
}
} else {
goto nomem;
}
goto nomem;
}
}
}
return (retval);
}
"Out of memory while looking for duplicate names in directory I=%d",
if (reply("SKIP REST OF DUP NAME CHECK") == 0)
errexit("Program terminated.");
return (retval);
}
static void
discard_contents(void)
{
}
}
static int
{
int cmp;
if (cmp == 0)
return (cmp);
}