169841Sdeischen/*
269841Sdeischen * Copyright (c) 1983, 1993
369841Sdeischen *	The Regents of the University of California.  All rights reserved.
469841Sdeischen *
569841Sdeischen * Copyright (c) 2000
669841Sdeischen * 	Daniel Eischen.  All rights reserved.
769841Sdeischen *
869841Sdeischen * Redistribution and use in source and binary forms, with or without
969841Sdeischen * modification, are permitted provided that the following conditions
1069841Sdeischen * are met:
1169841Sdeischen * 1. Redistributions of source code must retain the above copyright
1269841Sdeischen *    notice, this list of conditions and the following disclaimer.
1369841Sdeischen * 2. Redistributions in binary form must reproduce the above copyright
1469841Sdeischen *    notice, this list of conditions and the following disclaimer in the
1569841Sdeischen *    documentation and/or other materials provided with the distribution.
1669841Sdeischen * 3. Neither the name of the University nor the names of its contributors
1769841Sdeischen *    may be used to endorse or promote products derived from this software
1869841Sdeischen *    without specific prior written permission.
1969841Sdeischen *
2069841Sdeischen * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2169841Sdeischen * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2269841Sdeischen * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2369841Sdeischen * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2469841Sdeischen * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2569841Sdeischen * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2669841Sdeischen * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2769841Sdeischen * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2869841Sdeischen * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2969841Sdeischen * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3069841Sdeischen * SUCH DAMAGE.
3169841Sdeischen *
3269841Sdeischen * $FreeBSD$
3369841Sdeischen */
3469841Sdeischen
3569841Sdeischen#ifndef _TELLDIR_H_
3669841Sdeischen#define	_TELLDIR_H_
3769841Sdeischen
3869841Sdeischen#include <sys/queue.h>
3969841Sdeischen
4069841Sdeischen/*
4169841Sdeischen * One of these structures is malloced to describe the current directory
4269841Sdeischen * position each time telldir is called. It records the current magic
4369841Sdeischen * cookie returned by getdirentries and the offset within the buffer
4469841Sdeischen * associated with that return value.
4569841Sdeischen */
4669841Sdeischenstruct ddloc {
4769841Sdeischen	LIST_ENTRY(ddloc) loc_lqe; /* entry in list */
4869841Sdeischen	long	loc_index;	/* key associated with structure */
4969841Sdeischen	long	loc_seek;	/* magic cookie returned by getdirentries */
5069841Sdeischen	long	loc_loc;	/* offset of entry in buffer */
5169841Sdeischen};
5269841Sdeischen
5369841Sdeischen/*
5469841Sdeischen * One of these structures is malloced for each DIR to record telldir
5569841Sdeischen * positions.
5669841Sdeischen */
5769841Sdeischenstruct _telldir {
5869841Sdeischen	LIST_HEAD(, ddloc) td_locq; /* list of locations */
5969841Sdeischen	long	td_loccnt;	/* index of entry for sequential readdir's */
6069841Sdeischen};
6169841Sdeischen
62178772Skibstruct dirent	*_readdir_unlocked(DIR *, int);
6371579Sdeischenvoid 		_reclaim_telldir(DIR *);
6471579Sdeischenvoid 		_seekdir(DIR *, long);
6569841Sdeischen
6669841Sdeischen#endif
67