FreeBSD/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c
/*
 * gfs_readdir_pred: readdir loop predicate
 *   voffp - a pointer in which the next virtual offset should be stored
 *
 * Returns a 0 on success, a non-zero errno on failure, or -1 if the
 * readdir loop should terminate.  A non-zero result (either errno or
 * -1) from this function is typically passed directly to
 * gfs_readdir_fini().
 */
readdir loop predicate
voffp - a pointer in which the next virtual offset should be stored

Returns a 0 on success, a non-zero errno on failure, or -1 if the
readdir loop should terminate.  A non-zero result (either errno or
-1) from this function is typically passed directly to
gfs_readdir_fini().
readdir loop predicate voffp - a pointer in which the next virtual offset should be stored Returns a 0 on success a non - zero errno on failure or - 1 if the readdir loop should terminate . A non - zero result ( either errno or - 1 ) from this function is typically passed directly to gfs_readdir_fini () .
int
gfs_readdir_pred(gfs_readdir_state_t *st, uio_t *uiop, offset_t *voffp,
    int *ncookies, u_long **cookies)
{
	offset_t off, voff;
	int error;
top:
	if (uiop->uio_resid <= 0)
		return (-1);
	off = uiop->uio_loffset / st->grd_ureclen;
	voff = off - 2;
	if (off == 0) {
		if ((error = gfs_readdir_emit(st, uiop, voff, st->grd_self,
		    ".", 0, ncookies, cookies)) == 0)
			goto top;
	} else if (off == 1) {
		if ((error = gfs_readdir_emit(st, uiop, voff, st->grd_parent,
		    "..", 0, ncookies, cookies)) == 0)
			goto top;
	} else {
		*voffp = voff;
		return (0);
	}
	return (error);
}
int gfs_readdir_pred ( gfs_readdir_state_t * st , uio_t * uiop , offset_t * voffp , int * ncookies , u_long * * cookies ) { offset_t off , voff ; int error ; top : if ( uiop -> uio_resid <= 0 ) return ( -1 ) ; off = uiop -> uio_loffset / st -> grd_ureclen ; voff = off - 2 ; if ( off == 0 ) { if ( ( error = gfs_readdir_emit ( st , uiop , voff , st -> grd_self , " " , 0 , ncookies , cookies ) ) == 0 ) goto top ; } else if ( off == 1 ) { if ( ( error = gfs_readdir_emit ( st , uiop , voff , st -> grd_parent , " " , 0 , ncookies , cookies ) ) == 0 ) goto top ; } else { * voffp = voff ; return ( 0 ) ; } return ( error ) ; }
gfs_readdir_pred: readdir loop predicate
   voffp - a pointer in which the next virtual offset should be stored
gfs_readdir_pred : readdir loop predicate voffp - a pointer in which the next virtual offset should be stored