示例#1
0
/**
 * FSAL_opendir :
 *     Opens a directory for reading its content.
 *
 * \param dir_handle (input)
 *         the handle of the directory to be opened.
 * \param p_context (input)
 *         Permission context for the operation (user, export context...).
 * \param dir_descriptor (output)
 *         pointer to an allocated structure that will receive
 *         directory stream informations, on successfull completion.
 * \param dir_attributes (optional output)
 *         On successfull completion,the structure pointed
 *         by dir_attributes receives the new directory attributes.
 *         Can be NULL.
 * 
 * \return Major error codes :
 *        - ERR_FSAL_NO_ERROR     (no error)
 *        - ERR_FSAL_ACCESS       (user does not have read permission on directory)
 *        - ERR_FSAL_STALE        (dir_handle does not address an existing object)
 *        - ERR_FSAL_FAULT        (a NULL pointer was passed as mandatory argument)
 *        - Other error codes can be returned :
 *          ERR_FSAL_IO, ...
 */
fsal_status_t HPSSFSAL_opendir(hpssfsal_handle_t * dir_handle,  /* IN */
                               hpssfsal_op_context_t * p_context,       /* IN */
                               hpssfsal_dir_t * dir_descriptor, /* OUT */
                               fsal_attrib_list_t * dir_attributes      /* [ IN/OUT ] */
    )
{
  int rc;
  fsal_status_t st;

  /* sanity checks
   * note : dir_attributes is optionnal.
   */
  if(!dir_handle || !p_context || !dir_descriptor)
    Return(ERR_FSAL_FAULT, 0, INDEX_FSAL_opendir);

  /* Test access rights for this directory
   * and retrieve asked attributes */

  st = HPSSFSAL_access(dir_handle, p_context, FSAL_R_OK, dir_attributes);

  if(FSAL_IS_ERROR(st))
    Return(st.major, st.minor, INDEX_FSAL_opendir);

  /* if everything is OK, fills the dir_desc structure */
  memcpy(&dir_descriptor->dir_handle, dir_handle, sizeof(hpssfsal_handle_t));
  memcpy(&dir_descriptor->context, p_context, sizeof(hpssfsal_op_context_t));

  Return(ERR_FSAL_NO_ERROR, 0, INDEX_FSAL_opendir);

}
示例#2
0
文件: fsal_compat.c 项目: ic-hep/emi3
fsal_status_t WRAP_HPSSFSAL_access(fsal_handle_t * object_handle,       /* IN */
                                   fsal_op_context_t * p_context,       /* IN */
                                   fsal_accessflags_t access_type,      /* IN */
                                   fsal_attrib_list_t *
                                   object_attributes /* [ IN/OUT ] */ )
{
  return HPSSFSAL_access((hpssfsal_handle_t *) object_handle,
                         (hpssfsal_op_context_t *) p_context, access_type,
                         object_attributes);
}