/*= -*- c-basic-offset: 4; indent-tabs-mode: nil; -*-
 *
 * n4: A fast userspace NFSv4 server.
 * $Id: fh.h,v 1.1 2001/06/04 06:15:16 mbp Exp $
 * 
 * Copyright (C) 2001 by Martin Pool <mbp@samba.org>
 * 
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

/**
 * A server-side representation of a file handle.  In NFS4, a file
 * handle is a condensed reference to a file, and not really much like
 * a Unix fd.
 *
 * Depending on how the file handle was born, we might have any number
 * of pieces of information about it.  One is an FD open on the file
 * in the current process.  Another is the full name of the file on
 * the server, and another is the encoded form of the file handle.
 * These last two can be generated from each other, but we do that
 * generation lazily.
 **/
struct n4fh {
    int                 open_fd;
    char const          *filename;
    char const          *packed_form;
    size_t              packed_len;
    struct n4pathname   *path;
};

/* TODO: Should we store the chained pathname form, rather (or as well
 * as) than the plain filename?  That might be simpler for many kinds
 * of manipulation.
 *
 * XXX: We also need a way to represent filehandles that point into
 * named-attribute pseudo directories.  Since we don't have such
 * things yet, we don't need to worry too much.  */

#define N4_NO_FD (-1)

extern const struct n4fh root_fh;
