89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego/*
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * CDDL HEADER START
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego *
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * The contents of this file are subject to the terms of the
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * Common Development and Distribution License (the "License").
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * You may not use this file except in compliance with the License.
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego *
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * or http://www.opensolaris.org/os/licensing.
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * See the License for the specific language governing permissions
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * and limitations under the License.
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego *
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * When distributing Covered Code, include this CDDL HEADER in each
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * If applicable, add the following below this CDDL HEADER, with the
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * fields enclosed by brackets "[]" replaced with your own identifying
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * information: Portions Copyright [yyyy] [name of copyright owner]
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego *
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * CDDL HEADER END
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego */
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego/*
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego */
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego/*
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * Volume Copy Shadow Services (VSS) provides a way for users to
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * restore/recover deleted files/directories.
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * For the server to support VSS for Microsoft clients, there is
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * two basic functions that need to be implemented.
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * The first is to intercept the NT_TRANSACT_IOCTL command with
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * the function code of FSCTL_SRV_ENUMERATE_SNAPSHOTS (0x00144064).
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * This is to report the count or the count and list of snapshots
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * for that share.
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * The second function need to trap commands with the
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * SMB_FLAGS2_REPARSE_PATH bit set in the smb header. This bit
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * means that there is a @GMT token in path that needs to be
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * processed. The @GMT token means to process this command, but
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * in the snapshot.
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego */
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown#include <smbsrv/smb_kproto.h>
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown#include <smbsrv/string.h>
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego#include <smbsrv/winioctl.h>
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States#include <smbsrv/smb_door.h>
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego/* Size of the token on the wire due to encoding */
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego#define SMB_VSS_GMT_NET_SIZE(sr) (smb_ascii_or_unicode_null_len(sr) * \
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego SMB_VSS_GMT_SIZE)
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego#define SMB_VSS_COUNT_SIZE 16
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United Statesstatic boolean_t smb_vss_is_gmttoken(const char *);
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United Statesstatic const char *smb_vss_find_gmttoken(const char *);
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Rossstatic uint32_t smb_vss_encode_gmttokens(smb_request_t *, smb_fsctl_t *,
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States int32_t, smb_gmttoken_response_t *);
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United Statesstatic void smb_vss_remove_first_token_from_path(char *);
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States
8622ec4569457733001d4982ef7f5b44427069beGordon Rossstatic uint32_t smb_vss_get_count(smb_tree_t *, char *);
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Rossstatic void smb_vss_map_gmttoken(smb_tree_t *, char *, char *, time_t, char *);
8622ec4569457733001d4982ef7f5b44427069beGordon Rossstatic void smb_vss_get_snapshots(smb_tree_t *, char *,
8622ec4569457733001d4982ef7f5b44427069beGordon Ross uint32_t, smb_gmttoken_response_t *);
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United Statesstatic void smb_vss_get_snapshots_free(smb_gmttoken_response_t *);
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wrightstatic int smb_vss_lookup_node(smb_request_t *sr, smb_node_t *, vnode_t *,
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross char *, smb_node_t *, smb_node_t **);
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego/*
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * This is to respond to the nt_transact_ioctl to either respond with the
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * number of snapshots, or to respond with the list. It needs to be sorted
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * before the reply. If the the max data bytes to return is
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * SMB_VSS_COUNT_SIZE, then all that is requested is the count, otherwise
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * return the count and the list of @GMT tokens (one token for each
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * snapshot).
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego */
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borregouint32_t
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Rosssmb_vss_enum_snapshots(smb_request_t *sr, smb_fsctl_t *fsctl)
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego{
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego uint32_t count = 0;
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego char *root_path;
b1352070d318187b41b088da3533692976f3f225Alan Wright uint32_t status = NT_STATUS_SUCCESS;
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States smb_node_t *tnode;
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross smb_gmttoken_response_t snaps;
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States ASSERT(sr->tid_tree);
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States ASSERT(sr->tid_tree->t_snode);
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross if (fsctl->MaxOutputResp < SMB_VSS_COUNT_SIZE)
b1352070d318187b41b088da3533692976f3f225Alan Wright return (NT_STATUS_INVALID_PARAMETER);
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States tnode = sr->tid_tree->t_snode;
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego root_path = kmem_zalloc(MAXPATHLEN, KM_SLEEP);
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States if (smb_node_getmntpath(tnode, root_path, MAXPATHLEN) != 0)
b1352070d318187b41b088da3533692976f3f225Alan Wright return (NT_STATUS_INVALID_PARAMETER);
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross if (fsctl->MaxOutputResp == SMB_VSS_COUNT_SIZE) {
8622ec4569457733001d4982ef7f5b44427069beGordon Ross count = smb_vss_get_count(sr->tid_tree, root_path);
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross if (smb_mbc_encodef(fsctl->out_mbc, "lllw", count, 0,
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego (count * SMB_VSS_GMT_NET_SIZE(sr) +
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego smb_ascii_or_unicode_null_len(sr)), 0) != 0) {
b1352070d318187b41b088da3533692976f3f225Alan Wright status = NT_STATUS_INVALID_PARAMETER;
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego }
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego } else {
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross count = fsctl->MaxOutputResp / SMB_VSS_GMT_NET_SIZE(sr);
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego
8622ec4569457733001d4982ef7f5b44427069beGordon Ross smb_vss_get_snapshots(sr->tid_tree, root_path,
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross count, &snaps);
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross status = smb_vss_encode_gmttokens(sr, fsctl, count, &snaps);
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross smb_vss_get_snapshots_free(&snaps);
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego }
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego kmem_free(root_path, MAXPATHLEN);
b1352070d318187b41b088da3533692976f3f225Alan Wright return (status);
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego}
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego/*
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * sr - the request info, used to find root of dataset,
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * unicode or ascii, where the share is rooted in the
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * dataset
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * root_node - root of the share
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * cur_node - where in the share for the command
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * buf - is the path for the command to be processed
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * returned without @GMT if processed
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * vss_cur_node - returned value for the snapshot version
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * of the cur_node
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * vss_root_node - returned value for the snapshot version
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * of the root_node
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego *
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * This routine is the processing for handling the
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * SMB_FLAGS2_REPARSE_PATH bit being set in the smb header.
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego *
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * By using the cur_node passed in, a new node is found or
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * created that is the same place in the directory tree, but
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * in the snapshot. We also use root_node to do the same for
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * the root.
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright * Once the new smb node is found, the path is modified by
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego * removing the @GMT token from the path in the buf.
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego */
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borregoint
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borregosmb_vss_lookup_nodes(smb_request_t *sr, smb_node_t *root_node,
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego smb_node_t *cur_node, char *buf, smb_node_t **vss_cur_node,
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego smb_node_t **vss_root_node)
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego{
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross smb_arg_open_t *op = &sr->arg.open;
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright smb_node_t *tnode;
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright char *snapname, *path;
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross char *gmttoken;
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross char gmttok_buf[SMB_VSS_GMT_SIZE];
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright vnode_t *fsrootvp = NULL;
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross time_t toktime;
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright int err = 0;
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross boolean_t smb1;
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego if (sr->tid_tree == NULL)
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego return (ESTALE);
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright tnode = sr->tid_tree->t_snode;
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright ASSERT(tnode);
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright ASSERT(tnode->vp);
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright ASSERT(tnode->vp->v_vfsp);
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross smb1 = (sr->session->dialect < SMB_VERS_2_BASE);
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross if (smb1) {
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross const char *p;
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross /* get gmttoken from buf */
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross if ((p = smb_vss_find_gmttoken(buf)) == NULL)
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross return (ENOENT);
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross bcopy(p, gmttok_buf, SMB_VSS_GMT_SIZE);
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross gmttok_buf[SMB_VSS_GMT_SIZE - 1] = '\0';
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross gmttoken = gmttok_buf;
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross toktime = 0;
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross } else {
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross /* SMB2 and later */
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross gmttoken = NULL;
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross toktime = op->timewarp.tv_sec;
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross }
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright path = smb_srm_alloc(sr, MAXPATHLEN);
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright snapname = smb_srm_alloc(sr, MAXPATHLEN);
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright err = smb_node_getmntpath(tnode, path, MAXPATHLEN);
6e3e9d9c7ec812d402e1c911922ec43d4047dec8afshin salek ardakani - Sun Microsystems - Irvine United States if (err != 0)
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright return (err);
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross /*
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross * Find the corresponding snapshot name. If snapname is
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross * empty after the map call, no such snapshot was found.
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross */
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego *snapname = '\0';
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross smb_vss_map_gmttoken(sr->tid_tree, path, gmttoken, toktime,
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross snapname);
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross if (*snapname == '\0')
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright return (ENOENT);
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright /* find snapshot nodes */
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright err = VFS_ROOT(tnode->vp->v_vfsp, &fsrootvp);
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego if (err != 0)
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright return (err);
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright /* find snapshot node corresponding to root_node */
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright err = smb_vss_lookup_node(sr, root_node, fsrootvp,
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross snapname, cur_node, vss_root_node);
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright if (err == 0) {
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright /* find snapshot node corresponding to cur_node */
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright err = smb_vss_lookup_node(sr, cur_node, fsrootvp,
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross snapname, cur_node, vss_cur_node);
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright if (err != 0)
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright smb_node_release(*vss_root_node);
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright }
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright VN_RELE(fsrootvp);
7f667e74610492ddbce8ce60f52ece95d2401949jose borrego
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross if (smb1)
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross smb_vss_remove_first_token_from_path(buf);
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright return (err);
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright}
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright/*
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright * Find snapshot node corresponding to 'node', and return it in
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright * 'vss_node', as follows:
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright * - find the path from fsrootvp to node, appending it to the
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright * the snapshot path
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright * - lookup the vnode and smb_node (vss_node).
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright */
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wrightstatic int
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wrightsmb_vss_lookup_node(smb_request_t *sr, smb_node_t *node, vnode_t *fsrootvp,
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross char *snapname, smb_node_t *dnode, smb_node_t **vss_node)
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright{
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright char *p, *path;
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright int err, len;
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright vnode_t *vp = NULL;
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright *vss_node = NULL;
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright path = kmem_alloc(MAXPATHLEN, KM_SLEEP);
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright (void) snprintf(path, MAXPATHLEN, ".zfs/snapshot/%s/", snapname);
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright len = strlen(path);
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright p = path + len;
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright err = smb_node_getpath(node, fsrootvp, p, MAXPATHLEN - len);
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright if (err == 0) {
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright vp = smb_lookuppathvptovp(sr, path, fsrootvp, fsrootvp);
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego if (vp) {
8622ec4569457733001d4982ef7f5b44427069beGordon Ross *vss_node = smb_node_lookup(sr, NULL, zone_kcred(),
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross vp, snapname, dnode, NULL);
7f667e74610492ddbce8ce60f52ece95d2401949jose borrego VN_RELE(vp);
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego }
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego }
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright kmem_free(path, MAXPATHLEN);
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright if (*vss_node != NULL)
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright return (0);
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright return (err ? err : ENOENT);
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego}
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borregostatic boolean_t
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borregosmb_vss_is_gmttoken(const char *s)
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego{
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego char *t = "@GMT-NNNN.NN.NN-NN.NN.NN";
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego const char *str;
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego char *template;
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego template = t;
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego str = s;
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego while (*template) {
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego if (*template == 'N') {
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown if (!smb_isdigit(*str))
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego return (B_FALSE);
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego } else if (*template != *str) {
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego return (B_FALSE);
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego }
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego template++;
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego str++;
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego }
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego /* Make sure it is JUST the @GMT token */
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego if ((*str == '\0') || (*str == '/'))
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego return (B_TRUE);
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego return (B_FALSE);
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego}
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borregostatic const char *
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borregosmb_vss_find_gmttoken(const char *path)
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego{
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego const char *p;
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego p = path;
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego while (*p) {
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross if (*p == '@' && smb_vss_is_gmttoken(p))
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego return (p);
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego p++;
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego }
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego return (NULL);
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego}
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borregostatic uint32_t
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Rosssmb_vss_encode_gmttokens(smb_request_t *sr, smb_fsctl_t *fsctl,
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States int32_t count, smb_gmttoken_response_t *snap_data)
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego{
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego uint32_t i;
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego uint32_t returned_count;
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego uint32_t num_gmttokens;
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego char **gmttokens;
b1352070d318187b41b088da3533692976f3f225Alan Wright uint32_t status = NT_STATUS_SUCCESS;
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego uint32_t data_size;
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States returned_count = snap_data->gtr_count;
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States num_gmttokens = snap_data->gtr_gmttokens.gtr_gmttokens_len;
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States gmttokens = snap_data->gtr_gmttokens.gtr_gmttokens_val;
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego
b1352070d318187b41b088da3533692976f3f225Alan Wright if (returned_count > count)
b1352070d318187b41b088da3533692976f3f225Alan Wright status = NT_STATUS_BUFFER_TOO_SMALL;
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego data_size = returned_count * SMB_VSS_GMT_NET_SIZE(sr) +
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego smb_ascii_or_unicode_null_len(sr);
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross if (smb_mbc_encodef(fsctl->out_mbc, "lll", returned_count,
b1352070d318187b41b088da3533692976f3f225Alan Wright num_gmttokens, data_size) != 0)
b1352070d318187b41b088da3533692976f3f225Alan Wright return (NT_STATUS_INVALID_PARAMETER);
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego
b1352070d318187b41b088da3533692976f3f225Alan Wright if (status == NT_STATUS_SUCCESS) {
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego for (i = 0; i < num_gmttokens; i++) {
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross if (smb_mbc_encodef(fsctl->out_mbc, "%u", sr,
b1352070d318187b41b088da3533692976f3f225Alan Wright *gmttokens) != 0)
b1352070d318187b41b088da3533692976f3f225Alan Wright status = NT_STATUS_INVALID_PARAMETER;
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego gmttokens++;
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego }
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego }
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego
b1352070d318187b41b088da3533692976f3f225Alan Wright return (status);
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego}
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego/* This removes the first @GMT from the path */
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borregostatic void
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borregosmb_vss_remove_first_token_from_path(char *path)
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego{
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego boolean_t found;
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego char *src, *dest;
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego src = path;
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego dest = path;
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego found = B_FALSE;
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego while (*src != '\0') {
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego if (!found && smb_vss_is_gmttoken(src)) {
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego src += SMB_VSS_GMT_SIZE - 1;
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego if (*src == '/')
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego src += 1;
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego found = B_TRUE;
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego continue;
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego }
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego *dest = *src;
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego src++;
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego dest++;
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego }
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego *dest = *src;
89dc44ce9705974a8bc4a39f1e878a0491a5be61jose borrego}
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States/*
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States * This returns the number of snapshots for the dataset
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States * of the path provided.
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States */
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United Statesstatic uint32_t
8622ec4569457733001d4982ef7f5b44427069beGordon Rosssmb_vss_get_count(smb_tree_t *tree, char *resource_path)
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States{
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States uint32_t count = 0;
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States int rc;
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States smb_string_t path;
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States path.buf = resource_path;
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States
8622ec4569457733001d4982ef7f5b44427069beGordon Ross rc = smb_kdoor_upcall(tree->t_server, SMB_DR_VSS_GET_COUNT,
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States &path, smb_string_xdr, &count, xdr_uint32_t);
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States if (rc != 0)
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States count = 0;
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States return (count);
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States}
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States/*
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States * This takes a path for the root of the dataset and gets the counts of
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States * snapshots for that dataset and the list of @GMT tokens (one for each
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States * snapshot) up to the count provided.
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States *
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States * Call smb_vss_get_snapshots_free after to free up the data.
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States */
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United Statesstatic void
8622ec4569457733001d4982ef7f5b44427069beGordon Rosssmb_vss_get_snapshots(smb_tree_t *tree, char *resource_path,
8622ec4569457733001d4982ef7f5b44427069beGordon Ross uint32_t count, smb_gmttoken_response_t *gmttokens)
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States{
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States smb_gmttoken_query_t request;
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States request.gtq_count = count;
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States request.gtq_path = resource_path;
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States bzero(gmttokens, sizeof (smb_gmttoken_response_t));
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States
8622ec4569457733001d4982ef7f5b44427069beGordon Ross (void) smb_kdoor_upcall(tree->t_server, SMB_DR_VSS_GET_SNAPSHOTS,
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States &request, smb_gmttoken_query_xdr,
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States gmttokens, smb_gmttoken_response_xdr);
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States}
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United Statesstatic void
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United Statessmb_vss_get_snapshots_free(smb_gmttoken_response_t *reply)
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States{
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States xdr_free(smb_gmttoken_response_xdr, (char *)reply);
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States}
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States/*
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States * Returns the snapshot name for the @GMT token provided for the dataset
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States * of the path. If the snapshot cannot be found, a string with a NULL
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States * is returned.
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States */
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United Statesstatic void
8622ec4569457733001d4982ef7f5b44427069beGordon Rosssmb_vss_map_gmttoken(smb_tree_t *tree, char *path, char *gmttoken,
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross time_t toktime, char *snapname)
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States{
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States smb_gmttoken_snapname_t request;
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States smb_string_t result;
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States bzero(&result, sizeof (smb_string_t));
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States result.buf = snapname;
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States request.gts_path = path;
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States request.gts_gmttoken = gmttoken;
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross request.gts_toktime = toktime;
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States
8622ec4569457733001d4982ef7f5b44427069beGordon Ross (void) smb_kdoor_upcall(tree->t_server, SMB_DR_VSS_MAP_GMTTOKEN,
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States &request, smb_gmttoken_snapname_xdr,
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States &result, smb_string_xdr);
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States}