smb_rename.c revision bbf6f00c25b6a2bed23c35eac6d62998ecdb338c
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * CDDL HEADER START
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * The contents of this file are subject to the terms of the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Common Development and Distribution License (the "License").
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * You may not use this file except in compliance with the License.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * See the License for the specific language governing permissions
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * and limitations under the License.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * When distributing Covered Code, include this CDDL HEADER in each
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * If applicable, add the following below this CDDL HEADER, with the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * fields enclosed by brackets "[]" replaced with your own identifying
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * information: Portions Copyright [yyyy] [name of copyright owner]
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * CDDL HEADER END
2c2961f8403049d948b9f3e6c35d6488b6b7e1aajose borrego * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Use is subject to license terms.
b1352070d318187b41b088da3533692976f3f225Alan Wright * NT_RENAME InformationLevels:
b1352070d318187b41b088da3533692976f3f225Alan Wright * SMB_NT_RENAME_MOVE_CLUSTER_INFO Server returns invalid parameter.
b1352070d318187b41b088da3533692976f3f225Alan Wright * SMB_NT_RENAME_SET_LINK_INFO Create a hard link to a file.
b1352070d318187b41b088da3533692976f3f225Alan Wright * SMB_NT_RENAME_RENAME_FILE In-place rename of a file.
b1352070d318187b41b088da3533692976f3f225Alan Wright * SMB_NT_RENAME_MOVE_FILE Move (rename) a file.
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * SMB_TRANS2_SET_FILE/PATH_INFO (RENAME_INFORMATION level) flag
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brownstatic int smb_common_rename(smb_request_t *, smb_fqi_t *, smb_fqi_t *);
b1352070d318187b41b088da3533692976f3f225Alan Wrightstatic int smb_make_link(smb_request_t *, smb_fqi_t *, smb_fqi_t *);
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brownstatic int smb_rename_check_stream(smb_fqi_t *, smb_fqi_t *);
037cac007b685e7ea79f6ef7e8e62bfd342a4d56joyce mcintoshstatic int smb_rename_check_attr(smb_request_t *, smb_node_t *, uint16_t);
b1352070d318187b41b088da3533692976f3f225Alan Wrightstatic void smb_rename_set_error(smb_request_t *, int);
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brownstatic int smb_rename_lookup_src(smb_request_t *);
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brownstatic void smb_rename_release_src(smb_request_t *);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * smb_com_rename
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Rename a file. Files OldFileName must exist and NewFileName must not.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Both pathnames must be relative to the Tid specified in the request.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Open files may be renamed.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Multiple files may be renamed in response to a single request as Rename
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * File supports wildcards in the file name (last component of the path).
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * NOTE: we don't support rename with wildcards.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * SearchAttributes indicates the attributes that the target file(s) must
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * have. If SearchAttributes is zero then only normal files are renamed.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * If the system file or hidden attributes are specified then the rename
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * is inclusive - both the specified type(s) of files and normal files are
b89a8333f5e1f75ec0c269b22524bd2eccb972banatalie li - Sun Microsystems - Irvine United States smb_fqi_t *src_fqi = &sr->arg.dirop.fqi;
b89a8333f5e1f75ec0c269b22524bd2eccb972banatalie li - Sun Microsystems - Irvine United States smb_fqi_t *dst_fqi = &sr->arg.dirop.dst_fqi;
eb1d736b1c19f6abeee90c921a9320b67fedd016afshin salek ardakani - Sun Microsystems - Irvine United States if ((rc = smbsr_decode_vwv(sr, "w", &src_fqi->fq_sattr)) == 0) {
eb1d736b1c19f6abeee90c921a9320b67fedd016afshin salek ardakani - Sun Microsystems - Irvine United States rc = smbsr_decode_data(sr, "%SS", sr, &src_fqi->fq_path.pn_path,
eb1d736b1c19f6abeee90c921a9320b67fedd016afshin salek ardakani - Sun Microsystems - Irvine United States &dst_fqi->fq_path.pn_path);
eb1d736b1c19f6abeee90c921a9320b67fedd016afshin salek ardakani - Sun Microsystems - Irvine United States dst_fqi->fq_sattr = 0;
b89a8333f5e1f75ec0c269b22524bd2eccb972banatalie li - Sun Microsystems - Irvine United States smb_fqi_t *src_fqi = &sr->arg.dirop.fqi;
b89a8333f5e1f75ec0c269b22524bd2eccb972banatalie li - Sun Microsystems - Irvine United States smb_fqi_t *dst_fqi = &sr->arg.dirop.dst_fqi;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (rc != 0) {
b1352070d318187b41b088da3533692976f3f225Alan Wright * smb_com_nt_rename
b1352070d318187b41b088da3533692976f3f225Alan Wright * Rename a file. Files OldFileName must exist and NewFileName must not.
b1352070d318187b41b088da3533692976f3f225Alan Wright * Both pathnames must be relative to the Tid specified in the request.
b1352070d318187b41b088da3533692976f3f225Alan Wright * Open files may be renamed.
b1352070d318187b41b088da3533692976f3f225Alan Wright * SearchAttributes indicates the attributes that the target file(s) must
b1352070d318187b41b088da3533692976f3f225Alan Wright * have. If SearchAttributes is zero then only normal files are renamed.
b1352070d318187b41b088da3533692976f3f225Alan Wright * If the system file or hidden attributes are specified then the rename
b1352070d318187b41b088da3533692976f3f225Alan Wright * is inclusive - both the specified type(s) of files and normal files are
b1352070d318187b41b088da3533692976f3f225Alan Wright rc = smbsr_decode_vwv(sr, "wwl", &src_fqi->fq_sattr,
b1352070d318187b41b088da3533692976f3f225Alan Wright &src_fqi->fq_path.pn_path, &dst_fqi->fq_path.pn_path);
b1352070d318187b41b088da3533692976f3f225Alan Wright DTRACE_SMB_2(op__NtRename__start, smb_request_t *, sr,
b1352070d318187b41b088da3533692976f3f225Alan Wright DTRACE_SMB_1(op__NtRename__done, smb_request_t *, sr);
b1352070d318187b41b088da3533692976f3f225Alan Wright if (smb_convert_wildcards(src_fqi->fq_path.pn_path) != 0) {
b1352070d318187b41b088da3533692976f3f225Alan Wright smbsr_error(sr, NT_STATUS_OBJECT_PATH_SYNTAX_BAD,
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * smb_nt_transact_rename
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * Windows servers return SUCCESS without renaming file.
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * The only check required is to check that the handle (fid) is valid.
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brownsmb_nt_transact_rename(smb_request_t *sr, smb_xa_t *xa)
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown if (smb_mbc_decodef(&xa->req_param_mb, "w", &sr->smb_fid) != 0)
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown smbsr_error(sr, NT_STATUS_INVALID_HANDLE, ERRDOS, ERRbadfid);
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * smb_trans2_rename
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * Implements SMB_FILE_RENAME_INFORMATION level of Trans2_Set_FileInfo
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * and Trans2_Set_PathInfo.
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * If the new filename (dst_fqi) already exists it may be overwritten
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * if flags == 1.
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brownsmb_trans2_rename(smb_request_t *sr, smb_node_t *node, char *fname, int flags)
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown sr->arg.dirop.flags = flags ? SMB_RENAME_FLAG_OVERWRITE : 0;
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown sr->arg.dirop.info_level = SMB_NT_RENAME_RENAME_FILE;
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown (void) strlcpy(dst_fqi->fq_last_comp, fname, MAXNAMELEN);
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown return (-1);
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * smb_common_rename
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * Common code for renaming a file.
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * If the source and destination are identical, we go through all
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * the checks but we don't actually do the rename. If the source
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * and destination files differ only in case, we do a case-sensitive
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * rename. Otherwise, we do a full case-insensitive rename.
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * Returns errno values.
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brownsmb_common_rename(smb_request_t *sr, smb_fqi_t *src_fqi, smb_fqi_t *dst_fqi)
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown smb_node_t *src_fnode, *src_dnode, *dst_fnode, *dst_dnode;
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown /* Check if attempting to rename a stream - not yet supported */
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown rc = smb_rename_check_stream(src_fqi, dst_fqi);
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown /* The source node may already have been provided */
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown smb_node_start_crit(src_fqi->fq_fnode, RW_READER);
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown /* lookup and validate src node */
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown /* Find destination dnode and last_comp */
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown rc = smb_pathname_reduce(sr, sr->user_cr, path, tnode, tnode,
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown /* If exact name match in same directory, we're done */
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown /* Lookup destination node */
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown rc = smb_fsop_lookup(sr, sr->user_cr, 0, tnode,
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * Handle case where changing case of the same directory entry.
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * If we found the dst node in the same directory as the src node,
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * and their names differ only in case:
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * If the tree is case sensitive (or mixed):
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * Do case sensitive lookup to see if exact match exists.
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * If the exact match is the same node as src_node we're done.
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * If the tree is case insensitive:
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * There is currently no way to tell if the case is different
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * or not, so do the rename (unless the specified new name was
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown if ((rc == 0) &&
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown SMB_CASE_SENSITIVE, tnode, dst_dnode, new_name,
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown if ((rc == 0) &&
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown if (!(sr->arg.dirop.flags && SMB_RENAME_FLAG_OVERWRITE)) {
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown (void) smb_oplock_break(dst_fnode, sr->session, B_FALSE);
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * smb_rename_check_stream
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * For a stream rename the dst path must begin with ':', or "\\:".
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * We don't yet support stream rename, Return EACCES.
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * If not a stream rename, in accordance with the above rule,
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * it is not valid for either the src or dst to be a stream.
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * Return EINVAL.
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brownsmb_rename_check_stream(smb_fqi_t *src_fqi, smb_fqi_t *dst_fqi)
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown /* We do not yet support named stream rename - ACCESS DENIED */
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown ((dst_path[0] == '\\') && (dst_path[1] == ':'))) {
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * If not stream rename (above) neither src or dst can be
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * a named stream.
b1352070d318187b41b088da3533692976f3f225Alan Wright * smb_make_link
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * Creating a hard link (adding an additional name) for a file.
b1352070d318187b41b088da3533692976f3f225Alan Wright * If the source and destination are identical, we go through all
b1352070d318187b41b088da3533692976f3f225Alan Wright * the checks but we don't create a link.
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * If the file is a symlink we create the hardlink on the target
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * of the symlink (i.e. use SMB_FOLLOW_LINKS when looking up src).
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * If the target of the symlink does not exist we fail with ENOENT.
b1352070d318187b41b088da3533692976f3f225Alan Wright * Returns errno values.
b1352070d318187b41b088da3533692976f3f225Alan Wrightsmb_make_link(smb_request_t *sr, smb_fqi_t *src_fqi, smb_fqi_t *dst_fqi)
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown /* Cannnot create link on named stream */
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown if (smb_is_stream_name(src_fqi->fq_path.pn_path) ||
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown smb_is_stream_name(dst_fqi->fq_path.pn_path)) {
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown /* lookup and validate src node */
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown /* if src and dest paths match we're done */
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown /* find the destination dnode and last_comp */
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown rc = smb_pathname_reduce(sr, sr->user_cr, path, tnode, tnode,
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown /* If name match in same directory, we're done */
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown if ((src_fqi->fq_dnode == dst_fqi->fq_dnode) &&
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown /* Lookup the destination node. It MUST NOT exist. */
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown rc = smb_fsop_lookup(sr, sr->user_cr, 0, tnode,
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown dst_fqi->fq_dnode, dst_fqi->fq_last_comp, &dst_fqi->fq_fnode);
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown rc = smb_fsop_link(sr, sr->user_cr, src_fqi->fq_fnode,
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * smb_rename_lookup_src
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * Lookup the src node, checking for sharing violations and
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * breaking any existing oplock.
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * Populate sr->arg.dirop.fqi
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * Upon success, the dnode and fnode will have holds and the
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * fnode will be in a critical section. These should be
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * released using smb_rename_release_src().
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * Returns errno values.
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown if (smb_is_stream_name(src_fqi->fq_path.pn_path))
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown /* Lookup the source node */
e3f2c991a8548408db0a2787bd8b43d5124821d3Keyur Desai rc = smb_pathname_reduce(sr, sr->user_cr, path, tnode, tnode,
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown rc = smb_fsop_lookup(sr, sr->user_cr, 0, tnode,
e3f2c991a8548408db0a2787bd8b43d5124821d3Keyur Desai src_fqi->fq_dnode, src_fqi->fq_last_comp, &src_fqi->fq_fnode);
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown /* Not valid to create hardlink for directory */
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown if ((dirop->info_level == SMB_NT_RENAME_SET_LINK_INFO) &&
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown rc = smb_rename_check_attr(sr, src_node, src_fqi->fq_sattr);
b1352070d318187b41b088da3533692976f3f225Alan Wright * Break the oplock before access checks. If a client
b1352070d318187b41b088da3533692976f3f225Alan Wright * has a file open, this will force a flush or close,
b1352070d318187b41b088da3533692976f3f225Alan Wright * which may affect the outcome of any share checking.
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown (void) smb_oplock_break(src_node, sr->session, B_FALSE);
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown status = smb_range_check(sr, src_node, 0, UINT64_MAX, B_TRUE);
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown * smb_rename_release_src
037cac007b685e7ea79f6ef7e8e62bfd342a4d56joyce mcintoshsmb_rename_check_attr(smb_request_t *sr, smb_node_t *node, uint16_t sattr)
037cac007b685e7ea79f6ef7e8e62bfd342a4d56joyce mcintosh if ((attr.sa_dosattr & FILE_ATTRIBUTE_HIDDEN) &&
037cac007b685e7ea79f6ef7e8e62bfd342a4d56joyce mcintosh if ((attr.sa_dosattr & FILE_ATTRIBUTE_SYSTEM) &&
b1352070d318187b41b088da3533692976f3f225Alan Wright * The following values are based on observed WFWG, Windows 9x, Windows NT
b1352070d318187b41b088da3533692976f3f225Alan Wright * and Windows 2000 behaviour.
b1352070d318187b41b088da3533692976f3f225Alan Wright * ERROR_FILE_EXISTS doesn't work for Windows 98 clients.
b1352070d318187b41b088da3533692976f3f225Alan Wright * Windows 95 clients don't see the problem because the target is deleted
b1352070d318187b41b088da3533692976f3f225Alan Wright * before the rename request.
b1352070d318187b41b088da3533692976f3f225Alan Wrightsmb_rename_set_error(smb_request_t *sr, int errnum)
b1352070d318187b41b088da3533692976f3f225Alan Wright static struct {
b1352070d318187b41b088da3533692976f3f225Alan Wright { EEXIST, ERROR_ALREADY_EXISTS, NT_STATUS_OBJECT_NAME_COLLISION },
b1352070d318187b41b088da3533692976f3f225Alan Wright { EPIPE, ERROR_SHARING_VIOLATION, NT_STATUS_SHARING_VIOLATION },
b1352070d318187b41b088da3533692976f3f225Alan Wright { ENOENT, ERROR_FILE_NOT_FOUND, NT_STATUS_OBJECT_NAME_NOT_FOUND },
b1352070d318187b41b088da3533692976f3f225Alan Wright { ESRCH, ERROR_FILE_NOT_FOUND, NT_STATUS_NO_SUCH_FILE },
b1352070d318187b41b088da3533692976f3f225Alan Wright { EINVAL, ERROR_INVALID_PARAMETER, NT_STATUS_INVALID_PARAMETER },
037cac007b685e7ea79f6ef7e8e62bfd342a4d56joyce mcintosh { EACCES, ERROR_ACCESS_DENIED, NT_STATUS_ACCESS_DENIED },
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown { EISDIR, ERROR_ACCESS_DENIED, NT_STATUS_FILE_IS_A_DIRECTORY },
037cac007b685e7ea79f6ef7e8e62bfd342a4d56joyce mcintosh { EIO, ERROR_INTERNAL_ERROR, NT_STATUS_INTERNAL_ERROR }
b1352070d318187b41b088da3533692976f3f225Alan Wright for (i = 0; i < sizeof (rc_map)/sizeof (rc_map[0]); ++i) {