197049Speter/* 298503Speter * Copyright (c) 1983, 1993 397049Speter * The Regents of the University of California. All rights reserved. 497049Speter * 597049Speter * Copyright (c) 2000 697049Speter * Daniel Eischen. All rights reserved. 797049Speter * 897049Speter * Redistribution and use in source and binary forms, with or without 997049Speter * modification, are permitted provided that the following conditions 1097049Speter * are met: 1197049Speter * 1. Redistributions of source code must retain the above copyright 1297049Speter * notice, this list of conditions and the following disclaimer. 1397049Speter * 2. Redistributions in binary form must reproduce the above copyright 1497049Speter * notice, this list of conditions and the following disclaimer in the 1597049Speter * documentation and/or other materials provided with the distribution. 1697049Speter * 3. Neither the name of the University nor the names of its contributors 1797049Speter * may be used to endorse or promote products derived from this software 1897049Speter * without specific prior written permission. 1997049Speter * 2097049Speter * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2197049Speter * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2297049Speter * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2397049Speter * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2497049Speter * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2597049Speter * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2697049Speter * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2797049Speter * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2897049Speter * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2997049Speter * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3097049Speter * SUCH DAMAGE. 3197049Speter * 3297049Speter * $FreeBSD$ 3397049Speter */ 3497049Speter 3597049Speter#ifndef _TELLDIR_H_ 3697049Speter#define _TELLDIR_H_ 3797049Speter 3897049Speter#include <sys/queue.h> 3997049Speter#include <stdbool.h> 4097049Speter 4197049Speter/* 4297049Speter * One of these structures is malloced to describe the current directory 4397049Speter * position each time telldir is called. It records the current magic 4497049Speter * cookie returned by getdirentries and the offset within the buffer 4597049Speter * associated with that return value. 4697049Speter */ 4798503Speterstruct ddloc { 4898503Speter LIST_ENTRY(ddloc) loc_lqe; /* entry in list */ 4998503Speter long loc_index; /* key associated with structure */ 5097049Speter long loc_seek; /* magic cookie returned by getdirentries */ 5197049Speter long loc_loc; /* offset of entry in buffer */ 5297049Speter}; 5397049Speter 5497049Speter/* 5597049Speter * One of these structures is malloced for each DIR to record telldir 5697049Speter * positions. 5798503Speter */ 5898503Speterstruct _telldir { 5997049Speter LIST_HEAD(, ddloc) td_locq; /* list of locations */ 6097049Speter long td_loccnt; /* index of entry for sequential readdir's */ 6197049Speter}; 6297049Speter 6397049Speterbool _filldir(DIR *, bool); 6497049Speterstruct dirent *_readdir_unlocked(DIR *, int); 6597049Spetervoid _reclaim_telldir(DIR *); 6697049Spetervoid _seekdir(DIR *, long); 6797049Speter 6897049Speter#endif 6997049Speter