2012-03-19 12:24:43 -04:00
|
|
|
|
/* NFSv4.1 client for Windows
|
|
|
|
|
|
* Copyright <EFBFBD> 2012 The Regents of the University of Michigan
|
|
|
|
|
|
*
|
2011-08-12 13:20:12 -04:00
|
|
|
|
* Olga Kornievskaia <aglo@umich.edu>
|
|
|
|
|
|
* Casey Bodley <cbodley@umich.edu>
|
2011-06-09 15:01:16 -04:00
|
|
|
|
*
|
2012-03-19 12:24:43 -04:00
|
|
|
|
* This library 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 library 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.
|
2011-06-09 15:01:16 -04:00
|
|
|
|
*
|
2012-03-19 12:24:43 -04:00
|
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
|
|
* along with this library; if not, write to the Free Software Foundation,
|
|
|
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
2011-06-09 15:01:16 -04:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef DELEGATION_H
|
|
|
|
|
|
#define DELEGATION_H
|
|
|
|
|
|
|
|
|
|
|
|
#include "nfs41.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-07-07 13:51:21 -04:00
|
|
|
|
/* option to avoid conflicts by returning the delegation */
|
|
|
|
|
|
#define DELEGATION_RETURN_ON_CONFLICT
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-06-09 15:01:16 -04:00
|
|
|
|
/* reference counting and cleanup */
|
|
|
|
|
|
void nfs41_delegation_ref(
|
|
|
|
|
|
IN nfs41_delegation_state *state);
|
|
|
|
|
|
|
|
|
|
|
|
void nfs41_delegation_deref(
|
|
|
|
|
|
IN nfs41_delegation_state *state);
|
|
|
|
|
|
|
|
|
|
|
|
void nfs41_client_delegation_free(
|
|
|
|
|
|
IN nfs41_client *client);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* open delegation */
|
|
|
|
|
|
int nfs41_delegation_granted(
|
|
|
|
|
|
IN nfs41_session *session,
|
2011-07-19 11:04:53 -04:00
|
|
|
|
IN nfs41_path_fh *parent,
|
2011-06-09 15:01:16 -04:00
|
|
|
|
IN nfs41_path_fh *file,
|
|
|
|
|
|
IN open_delegation4 *delegation,
|
2011-07-19 11:04:53 -04:00
|
|
|
|
IN bool_t try_recovery,
|
2011-06-09 15:01:16 -04:00
|
|
|
|
OUT nfs41_delegation_state **deleg_out);
|
|
|
|
|
|
|
|
|
|
|
|
int nfs41_delegate_open(
|
2011-08-23 11:45:59 -04:00
|
|
|
|
IN nfs41_open_state *state,
|
2011-06-09 15:01:16 -04:00
|
|
|
|
IN uint32_t create,
|
2011-07-08 10:05:23 -04:00
|
|
|
|
IN uint32_t mode,
|
2011-06-09 15:01:16 -04:00
|
|
|
|
OUT nfs41_file_info *info);
|
|
|
|
|
|
|
2011-07-06 13:41:59 -04:00
|
|
|
|
int nfs41_delegation_to_open(
|
|
|
|
|
|
IN nfs41_open_state *open,
|
|
|
|
|
|
IN bool_t try_recovery);
|
|
|
|
|
|
|
2012-01-19 19:46:03 -05:00
|
|
|
|
void nfs41_delegation_remove_srvopen(
|
|
|
|
|
|
IN nfs41_session *session,
|
|
|
|
|
|
IN nfs41_path_fh *file);
|
2011-07-06 13:41:59 -04:00
|
|
|
|
|
2011-07-07 13:51:21 -04:00
|
|
|
|
/* synchronous delegation return */
|
|
|
|
|
|
#ifdef DELEGATION_RETURN_ON_CONFLICT
|
|
|
|
|
|
int nfs41_delegation_return(
|
|
|
|
|
|
IN nfs41_session *session,
|
|
|
|
|
|
IN nfs41_path_fh *file,
|
|
|
|
|
|
IN enum open_delegation_type4 access,
|
|
|
|
|
|
IN bool_t truncate);
|
|
|
|
|
|
#else
|
|
|
|
|
|
static int nfs41_delegation_return(
|
|
|
|
|
|
IN nfs41_session *session,
|
|
|
|
|
|
IN nfs41_path_fh *file,
|
|
|
|
|
|
IN enum open_delegation_type4 access,
|
|
|
|
|
|
IN bool_t truncate)
|
|
|
|
|
|
{
|
|
|
|
|
|
return NFS4_OK;
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-07-06 13:41:59 -04:00
|
|
|
|
/* asynchronous delegation recall */
|
|
|
|
|
|
int nfs41_delegation_recall(
|
|
|
|
|
|
IN nfs41_client *client,
|
|
|
|
|
|
IN nfs41_fh *fh,
|
|
|
|
|
|
IN const stateid4 *stateid,
|
|
|
|
|
|
IN bool_t truncate);
|
|
|
|
|
|
|
2011-08-30 12:53:26 -04:00
|
|
|
|
int nfs41_delegation_getattr(
|
|
|
|
|
|
IN nfs41_client *client,
|
|
|
|
|
|
IN const nfs41_fh *fh,
|
|
|
|
|
|
IN const bitmap4 *attr_request,
|
|
|
|
|
|
OUT nfs41_file_info *info);
|
|
|
|
|
|
|
2011-07-20 15:34:04 -04:00
|
|
|
|
|
|
|
|
|
|
/* after client state recovery, return any 'recalled' delegations;
|
|
|
|
|
|
* must be called under the client's state lock */
|
|
|
|
|
|
int nfs41_client_delegation_recovery(
|
|
|
|
|
|
IN nfs41_client *client);
|
|
|
|
|
|
|
2011-08-19 12:04:30 -04:00
|
|
|
|
/* attempt to return the least recently used delegation;
|
|
|
|
|
|
* fails with NFS4ERR_BADHANDLE if all delegations are in use */
|
|
|
|
|
|
int nfs41_client_delegation_return_lru(
|
|
|
|
|
|
IN nfs41_client *client);
|
|
|
|
|
|
|
2011-06-09 15:01:16 -04:00
|
|
|
|
#endif /* DELEGATION_H */
|