2010-10-11 14:59:26 -04:00
|
|
|
/* Copyright (c) 2010
|
|
|
|
|
* The Regents of the University of Michigan
|
|
|
|
|
* All Rights Reserved
|
|
|
|
|
*
|
|
|
|
|
* Permission is granted to use, copy and redistribute this software
|
|
|
|
|
* for noncommercial education and research purposes, so long as no
|
|
|
|
|
* fee is charged, and so long as the name of the University of Michigan
|
|
|
|
|
* is not used in any advertising or publicity pertaining to the use
|
|
|
|
|
* or distribution of this software without specific, written prior
|
|
|
|
|
* authorization. Permission to modify or otherwise create derivative
|
|
|
|
|
* works of this software is not granted.
|
|
|
|
|
*
|
|
|
|
|
* This software is provided as is, without representation or warranty
|
|
|
|
|
* of any kind either express or implied, including without limitation
|
|
|
|
|
* the implied warranties of merchantability, fitness for a particular
|
|
|
|
|
* purpose, or noninfringement. The Regents of the University of
|
|
|
|
|
* Michigan shall not be liable for any damages, including special,
|
|
|
|
|
* indirect, incidental, or consequential damages, with respect to any
|
|
|
|
|
* claim arising out of or in connection with the use of the software,
|
|
|
|
|
* even if it has been or is hereafter advised of the possibility of
|
|
|
|
|
* such damages.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef __NFS41_DAEMON_UPCALL_H__
|
|
|
|
|
#define __NFS41_DAEMON_UPCALL_H__
|
|
|
|
|
|
|
|
|
|
#include "nfs41_ops.h"
|
2010-10-11 16:11:27 -04:00
|
|
|
#include "from_kernel.h"
|
2010-10-11 14:59:26 -04:00
|
|
|
|
|
|
|
|
/* structures for upcall arguments */
|
|
|
|
|
typedef struct __mount_upcall_args {
|
2010-10-12 10:04:06 -04:00
|
|
|
const char *hostname;
|
|
|
|
|
const char *path;
|
2010-10-11 14:59:26 -04:00
|
|
|
nfs41_root *root;
|
2010-12-01 19:11:47 -05:00
|
|
|
DWORD sec_flavor;
|
2010-10-11 14:59:26 -04:00
|
|
|
} mount_upcall_args;
|
|
|
|
|
|
|
|
|
|
typedef struct __unmount_upcall_args {
|
|
|
|
|
nfs41_root *root;
|
|
|
|
|
} unmount_upcall_args;
|
|
|
|
|
|
|
|
|
|
typedef struct __open_upcall_args {
|
2010-10-12 10:06:45 -04:00
|
|
|
nfs41_abs_path symlink;
|
2010-10-11 14:59:26 -04:00
|
|
|
FILE_BASIC_INFO basic_info;
|
|
|
|
|
FILE_STANDARD_INFO std_info;
|
2010-10-12 10:06:45 -04:00
|
|
|
const char *path;
|
2010-10-11 14:59:26 -04:00
|
|
|
nfs41_root *root;
|
|
|
|
|
nfs41_open_state *state;
|
|
|
|
|
ULONG access_mask;
|
|
|
|
|
ULONG access_mode;
|
|
|
|
|
ULONG file_attrs;
|
|
|
|
|
ULONG disposition;
|
|
|
|
|
ULONG create_opts;
|
|
|
|
|
ULONG open_owner_id;
|
|
|
|
|
DWORD mode;
|
|
|
|
|
LONGLONG changeattr;
|
|
|
|
|
BOOLEAN created;
|
2010-09-29 13:11:27 -04:00
|
|
|
BOOLEAN symlink_embedded;
|
2010-10-11 14:59:26 -04:00
|
|
|
} open_upcall_args;
|
|
|
|
|
|
|
|
|
|
typedef struct __close_upcall_args {
|
2010-10-12 10:04:06 -04:00
|
|
|
const char *path;
|
2010-10-11 14:59:26 -04:00
|
|
|
nfs41_root *root;
|
|
|
|
|
nfs41_open_state *state;
|
|
|
|
|
BOOLEAN remove;
|
|
|
|
|
BOOLEAN renamed;
|
|
|
|
|
} close_upcall_args;
|
|
|
|
|
|
|
|
|
|
typedef struct __readwrite_upcall_args {
|
|
|
|
|
nfs41_root *root;
|
|
|
|
|
nfs41_open_state *state;
|
|
|
|
|
unsigned char *buffer;
|
|
|
|
|
LONGLONG offset;
|
|
|
|
|
ULONG len;
|
|
|
|
|
ULONG out_len;
|
|
|
|
|
} readwrite_upcall_args;
|
|
|
|
|
|
|
|
|
|
typedef struct __lock_upcall_args {
|
|
|
|
|
nfs41_open_state *state;
|
|
|
|
|
nfs41_root *root;
|
|
|
|
|
LONGLONG offset;
|
|
|
|
|
LONGLONG length;
|
|
|
|
|
BOOLEAN exclusive;
|
|
|
|
|
BOOLEAN blocking;
|
|
|
|
|
} lock_upcall_args;
|
|
|
|
|
|
|
|
|
|
typedef struct __unlock_upcall_args {
|
|
|
|
|
nfs41_open_state *state;
|
|
|
|
|
nfs41_root *root;
|
|
|
|
|
uint32_t count;
|
|
|
|
|
unsigned char *buf;
|
|
|
|
|
uint32_t buf_len;
|
|
|
|
|
} unlock_upcall_args;
|
|
|
|
|
|
|
|
|
|
typedef struct __getattr_upcall_args {
|
|
|
|
|
FILE_BASIC_INFO basic_info;
|
|
|
|
|
FILE_STANDARD_INFO std_info;
|
|
|
|
|
FILE_ATTRIBUTE_TAG_INFO tag_info;
|
2011-03-30 14:21:40 -04:00
|
|
|
FILE_INTERNAL_INFORMATION intr_info;
|
2010-10-11 14:59:26 -04:00
|
|
|
nfs41_root *root;
|
|
|
|
|
nfs41_open_state *state;
|
|
|
|
|
int query_class;
|
|
|
|
|
int buf_len;
|
|
|
|
|
int query_reply_len;
|
|
|
|
|
} getattr_upcall_args;
|
|
|
|
|
|
|
|
|
|
typedef struct __setattr_upcall_args {
|
2010-10-12 10:04:06 -04:00
|
|
|
const char *path;
|
2010-10-11 14:59:26 -04:00
|
|
|
nfs41_root *root;
|
|
|
|
|
nfs41_open_state *state;
|
|
|
|
|
unsigned char *buf;
|
|
|
|
|
uint32_t buf_len;
|
|
|
|
|
int set_class;
|
|
|
|
|
ULONG open_owner_id;
|
|
|
|
|
ULONG access_mask;
|
|
|
|
|
ULONG access_mode;
|
|
|
|
|
} setattr_upcall_args;
|
|
|
|
|
|
|
|
|
|
typedef struct __setexattr_upcall_args {
|
|
|
|
|
nfs41_root *root;
|
|
|
|
|
nfs41_open_state *state;
|
|
|
|
|
uint32_t mode;
|
|
|
|
|
} setexattr_upcall_args;
|
|
|
|
|
|
|
|
|
|
typedef struct __readdir_upcall_args {
|
2010-10-12 10:04:06 -04:00
|
|
|
const char *filter;
|
2010-10-11 14:59:26 -04:00
|
|
|
nfs41_root *root;
|
|
|
|
|
nfs41_open_state *state;
|
|
|
|
|
unsigned char *buf;
|
|
|
|
|
int buf_len;
|
|
|
|
|
int query_class;
|
|
|
|
|
int query_reply_len;
|
|
|
|
|
BOOLEAN initial;
|
|
|
|
|
BOOLEAN restart;
|
|
|
|
|
BOOLEAN single;
|
|
|
|
|
} readdir_upcall_args;
|
|
|
|
|
|
2010-09-23 12:32:56 -04:00
|
|
|
typedef struct __symlink_upcall_args {
|
|
|
|
|
nfs41_abs_path target_get;
|
2010-10-15 14:49:43 -04:00
|
|
|
char *target_set;
|
2010-09-23 12:32:56 -04:00
|
|
|
nfs41_root *root;
|
|
|
|
|
nfs41_open_state *state;
|
|
|
|
|
const char *path;
|
|
|
|
|
BOOLEAN set;
|
|
|
|
|
} symlink_upcall_args;
|
|
|
|
|
|
2010-10-11 14:59:26 -04:00
|
|
|
typedef struct __volume_upcall_args {
|
|
|
|
|
nfs41_root *root;
|
2011-02-24 17:39:42 -08:00
|
|
|
nfs41_open_state *state;
|
2010-10-11 16:11:27 -04:00
|
|
|
FS_INFORMATION_CLASS query;
|
|
|
|
|
int len;
|
|
|
|
|
union {
|
|
|
|
|
FILE_FS_SIZE_INFORMATION size;
|
|
|
|
|
FILE_FS_FULL_SIZE_INFORMATION fullsize;
|
2010-10-11 16:12:20 -04:00
|
|
|
FILE_FS_ATTRIBUTE_INFORMATION attribute;
|
2010-10-11 16:11:27 -04:00
|
|
|
} info;
|
2010-10-11 14:59:26 -04:00
|
|
|
} volume_upcall_args;
|
|
|
|
|
|
2011-03-15 16:31:52 -04:00
|
|
|
typedef struct __getacl_upcall_args {
|
|
|
|
|
nfs41_root *root;
|
|
|
|
|
nfs41_open_state *state;
|
|
|
|
|
SECURITY_INFORMATION query;
|
|
|
|
|
PSID osid;
|
|
|
|
|
DWORD osid_len;
|
|
|
|
|
PSID gsid;
|
|
|
|
|
DWORD gsid_len;
|
|
|
|
|
} getacl_upcall_args;
|
|
|
|
|
|
2011-04-05 14:42:37 -04:00
|
|
|
typedef struct __setacl_upcall_args {
|
|
|
|
|
nfs41_root *root;
|
|
|
|
|
nfs41_open_state *state;
|
|
|
|
|
SECURITY_INFORMATION query;
|
|
|
|
|
PSECURITY_DESCRIPTOR sec_desc;
|
|
|
|
|
} setacl_upcall_args;
|
|
|
|
|
|
2010-10-11 14:59:26 -04:00
|
|
|
typedef union __upcall_args {
|
|
|
|
|
mount_upcall_args mount;
|
|
|
|
|
unmount_upcall_args unmount;
|
|
|
|
|
open_upcall_args open;
|
|
|
|
|
close_upcall_args close;
|
|
|
|
|
readwrite_upcall_args rw;
|
|
|
|
|
lock_upcall_args lock;
|
|
|
|
|
unlock_upcall_args unlock;
|
|
|
|
|
getattr_upcall_args getattr;
|
|
|
|
|
setattr_upcall_args setattr;
|
|
|
|
|
setexattr_upcall_args setexattr;
|
|
|
|
|
readdir_upcall_args readdir;
|
2010-09-23 12:32:56 -04:00
|
|
|
symlink_upcall_args symlink;
|
2010-10-11 14:59:26 -04:00
|
|
|
volume_upcall_args volume;
|
2011-03-15 16:31:52 -04:00
|
|
|
getacl_upcall_args getacl;
|
2011-04-05 14:42:37 -04:00
|
|
|
setacl_upcall_args setacl;
|
2010-10-11 14:59:26 -04:00
|
|
|
} upcall_args;
|
|
|
|
|
|
|
|
|
|
typedef struct __nfs41_upcall {
|
|
|
|
|
uint32_t xid;
|
|
|
|
|
uint32_t opcode;
|
|
|
|
|
uint32_t status;
|
|
|
|
|
uint32_t last_error;
|
|
|
|
|
upcall_args args;
|
2010-10-27 16:18:12 -04:00
|
|
|
|
2010-11-05 12:22:13 -04:00
|
|
|
uid_t uid;
|
|
|
|
|
gid_t gid;
|
|
|
|
|
|
2010-10-27 16:18:12 -04:00
|
|
|
/* store referenced pointers with the upcall for
|
|
|
|
|
* automatic dereferencing on upcall_cleanup();
|
|
|
|
|
* see upcall_root_ref() and upcall_open_state_ref() */
|
2010-10-27 13:36:22 -04:00
|
|
|
nfs41_root *root_ref;
|
2010-10-27 16:18:12 -04:00
|
|
|
nfs41_open_state *state_ref;
|
2010-10-11 14:59:26 -04:00
|
|
|
} nfs41_upcall;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* upcall operation interface */
|
|
|
|
|
typedef int (*upcall_parse_proc)(unsigned char*, uint32_t, nfs41_upcall*);
|
|
|
|
|
typedef int (*upcall_handle_proc)(nfs41_upcall*);
|
|
|
|
|
typedef int (*upcall_marshall_proc)(unsigned char*, uint32_t*, nfs41_upcall*);
|
2010-10-27 09:22:20 -04:00
|
|
|
typedef void (*upcall_cancel_proc)(nfs41_upcall*);
|
|
|
|
|
typedef void (*upcall_cleanup_proc)(nfs41_upcall*);
|
2010-10-11 14:59:26 -04:00
|
|
|
|
|
|
|
|
typedef struct __nfs41_upcall_op {
|
|
|
|
|
upcall_parse_proc parse;
|
|
|
|
|
upcall_handle_proc handle;
|
|
|
|
|
upcall_marshall_proc marshall;
|
|
|
|
|
upcall_cancel_proc cancel;
|
2010-10-27 09:22:20 -04:00
|
|
|
upcall_cleanup_proc cleanup;
|
2010-10-11 14:59:26 -04:00
|
|
|
} nfs41_upcall_op;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* upcall.c */
|
|
|
|
|
int upcall_parse(
|
|
|
|
|
IN unsigned char *buffer,
|
|
|
|
|
IN uint32_t length,
|
|
|
|
|
OUT nfs41_upcall *upcall);
|
|
|
|
|
|
|
|
|
|
int upcall_handle(
|
|
|
|
|
IN nfs41_upcall *upcall);
|
|
|
|
|
|
2010-11-02 14:40:52 -04:00
|
|
|
void upcall_marshall(
|
2010-10-11 14:59:26 -04:00
|
|
|
IN nfs41_upcall *upcall,
|
|
|
|
|
OUT unsigned char *buffer,
|
|
|
|
|
IN uint32_t length,
|
|
|
|
|
OUT uint32_t *length_out);
|
|
|
|
|
|
2010-10-27 09:22:20 -04:00
|
|
|
void upcall_cancel(
|
|
|
|
|
IN nfs41_upcall *upcall);
|
|
|
|
|
|
|
|
|
|
void upcall_cleanup(
|
2010-10-11 14:59:26 -04:00
|
|
|
IN nfs41_upcall *upcall);
|
|
|
|
|
|
2010-10-27 16:18:12 -04:00
|
|
|
|
2010-10-27 13:36:22 -04:00
|
|
|
static __inline void upcall_root_ref(
|
|
|
|
|
IN nfs41_upcall *upcall,
|
|
|
|
|
IN nfs41_root *root)
|
|
|
|
|
{
|
|
|
|
|
nfs41_root_ref(root);
|
|
|
|
|
upcall->root_ref = root;
|
|
|
|
|
}
|
|
|
|
|
|
2010-10-27 16:18:12 -04:00
|
|
|
static __inline void upcall_open_state_ref(
|
|
|
|
|
IN nfs41_upcall *upcall,
|
|
|
|
|
IN nfs41_open_state *state)
|
|
|
|
|
{
|
|
|
|
|
nfs41_open_state_ref(state);
|
|
|
|
|
upcall->state_ref = state;
|
|
|
|
|
}
|
|
|
|
|
|
2010-10-11 14:59:26 -04:00
|
|
|
#endif /* !__NFS41_DAEMON_UPCALL_H__ */
|