SYNOPSIS
#include <ixp_srvutil.h>
void ixp_srv_walkandclone(Ixp9Req *req, IxpLookupFn lookup);
void ixp_srv_readdir(Ixp9Req *req, IxpLookupFn lookup, void (*dostat)(IxpStat *, IxpFileId *));
bool ixp_srv_verifyfile(IxpFileId *file, IxpLookupFn lookup);
typedef IxpFileId* (*IxpLookupFn)(IxpFileId*, char*);
DESCRIPTION
These convenience functions simplify the writing of basic and static file servers. They use a generic file lookup function to simplify the process of walking, cloning, and returning directory listings. Given the IxpFileId(3) of a directory and a filename name should return a new IxpFileId (allocated via ixp_srv_getfile(3)) for the matching directory entry, or null if there is no match. If the passed name is null, lookup should return a linked list of IxpFileIds, one for each child directory entry.
ixp_srv_walkandclone handles the moderately complex process of walking from a directory entry and cloning fids, and calls ixp_respond(3). It should be called in response to a TWalk request.
ixp_srv_readdir should be called to handle read requests on directories. It prepares a stat for each child of the directory, taking into account the requested offset, and calls ixp_respond(3). The dostat parameter must be a function which fills the passed IxpStat(3) pointer based on the contents of the passed IxpFileId.
ixp_srv_verifyfile returns whether a file still exists in the filesystem, and should be used by filesystems that invalidate files once they have been deleted.