示例#1
0
/**
 * Get the value of an extended attribute from its name.
 *
 * \param p_objecthandle Handle of the object you want to get attribute for.
 * \param xattr_name the name of the attribute to be read.
 * \param p_context pointer to the current security context.
 * \param buffer_addr address of the buffer where the xattr value is to be stored.
 * \param buffer_size size of the buffer where the xattr value is to be stored.
 * \param p_output_size size of the data actually stored into the buffer.
 */
fsal_status_t POSIXFSAL_GetXAttrValueByName(fsal_handle_t * objecthandle,   /* IN */
                                            const fsal_name_t * xattr_name, /* IN */
                                            fsal_op_context_t * context, /* IN */
                                            caddr_t buffer_addr,        /* IN/OUT */
                                            size_t buffer_size, /* IN */
                                            size_t * p_output_size      /* OUT */
    )
{
  posixfsal_handle_t * p_objecthandle = (posixfsal_handle_t *) objecthandle;
  posixfsal_op_context_t * p_context = (posixfsal_op_context_t *) context;
  unsigned int index;

  /* sanity checks */
  if(!p_objecthandle || !p_context || !p_output_size || !buffer_addr || !xattr_name)
    Return(ERR_FSAL_FAULT, 0, INDEX_FSAL_GetXAttrValue);

  /* look for this name */

  for(index = 0; index < XATTR_COUNT; index++)
    {
      if(do_match_type(xattr_list[index].flags, p_objecthandle->data.info.ftype)
         && !strcmp(xattr_list[index].xattr_name, xattr_name->name))
        {

          return POSIXFSAL_GetXAttrValueById(objecthandle, index, context,
                                             buffer_addr, buffer_size, p_output_size);

        }
    }

  /* not found */
  Return(ERR_FSAL_NOENT, 0, INDEX_FSAL_GetXAttrValue);

}
示例#2
0
文件: fsal_compat.c 项目: ic-hep/emi3
fsal_status_t WRAP_POSIXFSAL_GetXAttrValueById(fsal_handle_t * p_objecthandle,  /* IN */
                                               unsigned int xattr_id,   /* IN */
                                               fsal_op_context_t * p_context,   /* IN */
                                               caddr_t buffer_addr,     /* IN/OUT */
                                               size_t buffer_size,      /* IN */
                                               size_t * p_output_size /* OUT */ )
{
  return POSIXFSAL_GetXAttrValueById((posixfsal_handle_t *) p_objecthandle, xattr_id,
                                     (posixfsal_op_context_t *) p_context, buffer_addr,
                                     buffer_size, p_output_size);
}