nfs-ganesha 1.4
|
00001 /* 00002 * Copyright IBM Corporation, 2010 00003 * Contributor: Aneesh Kumar K.v <aneesh.kumar@linux.vnet.ibm.com> 00004 * 00005 * 00006 * This software is a server that implements the NFS protocol. 00007 * 00008 * 00009 * This program is free software; you can redistribute it and/or 00010 * modify it under the terms of the GNU Lesser General Public 00011 * License as published by the Free Software Foundation; either 00012 * version 3 of the License, or (at your option) any later version. 00013 * 00014 * This program is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 * Lesser General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU Lesser General Public 00020 * License along with this library; if not, write to the Free Software 00021 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00022 * 00023 * 00024 */ 00025 #ifdef HAVE_CONFIG_H 00026 #include "config.h" 00027 #endif 00028 00029 #include "fsal.h" 00030 #include "fsal_internal.h" 00031 #include "fsal_convert.h" 00032 00036 fsal_status_t GPFSFSAL_share_op( fsal_file_t * p_file_descriptor, /* IN */ 00037 fsal_handle_t * p_filehandle, /* IN */ 00038 fsal_op_context_t * p_context, /* IN */ 00039 void * p_owner, /* IN */ 00040 fsal_share_param_t request_share) /* IN */ 00041 { 00042 int rc = 0; 00043 int dirfd = 0; 00044 struct share_reserve_arg share_arg; 00045 gpfsfsal_file_t * pfd = NULL; 00046 00047 if(p_file_descriptor == NULL) 00048 { 00049 LogDebug(COMPONENT_FSAL, "p_file_descriptor arg is NULL."); 00050 Return(ERR_FSAL_FAULT, 0, INDEX_FSAL_share_op); 00051 } 00052 00053 if(p_context == NULL) 00054 { 00055 LogDebug(COMPONENT_FSAL, "p_context arg is NULL."); 00056 Return(ERR_FSAL_FAULT, 0, INDEX_FSAL_share_op); 00057 } 00058 00059 LogFullDebug(COMPONENT_FSAL, 00060 "Share reservation: access:%u deny:%u owner:%p", 00061 request_share.share_access, request_share.share_deny, p_owner); 00062 00063 dirfd = ((gpfsfsal_op_context_t *)p_context)->export_context->mount_root_fd; 00064 pfd = (gpfsfsal_file_t *) p_file_descriptor; 00065 00066 share_arg.mountdirfd = dirfd; 00067 share_arg.openfd = pfd->fd; 00068 share_arg.share_access = request_share.share_access; 00069 share_arg.share_deny = request_share.share_deny; 00070 00071 rc = gpfs_ganesha(OPENHANDLE_SHARE_RESERVE, &share_arg); 00072 00073 if(rc < 0) 00074 { 00075 LogDebug(COMPONENT_FSAL, 00076 "gpfs_ganesha: OPENHANDLE_SHARE_RESERVE returned error, rc=%d, errno=%d", 00077 rc, errno); 00078 ReturnCode(posix2fsal_error(errno), errno); 00079 } 00080 00081 Return(ERR_FSAL_NO_ERROR, 0, INDEX_FSAL_share_op); 00082 }