Exemple #1
0
fsal_status_t WRAP_GPFSFSAL_create(fsal_handle_t * p_parent_directory_handle,    /* IN */
                                  fsal_name_t * p_filename,     /* IN */
                                  fsal_op_context_t * p_context,        /* IN */
                                  fsal_accessmode_t accessmode, /* IN */
                                  fsal_handle_t * p_object_handle,      /* OUT */
                                  fsal_attrib_list_t *
                                  p_object_attributes /* [ IN/OUT ] */ )
{
  return GPFSFSAL_create((gpfsfsal_handle_t *) p_parent_directory_handle, p_filename,
                        (gpfsfsal_op_context_t *) p_context, accessmode,
                        (gpfsfsal_handle_t *) p_object_handle, p_object_attributes);
}
Exemple #2
0
/* create
 * create a regular file and set its attributes
 */
fsal_status_t create(struct fsal_obj_handle *dir_hdl,
		     const char *name, struct attrlist *attr_in,
		     struct fsal_obj_handle **handle,
		     struct attrlist *attrs_out)
{
	struct gpfs_fsal_obj_handle *hdl;
	fsal_status_t status;
	/* Use a separate attrlist to getch the actual attributes into */
	struct attrlist attrib;

	struct gpfs_file_handle *fh = alloca(sizeof(struct gpfs_file_handle));

	*handle = NULL;		/* poison it */
	if (!dir_hdl->obj_ops.handle_is(dir_hdl, DIRECTORY)) {
		LogCrit(COMPONENT_FSAL,
			"Parent handle is not a directory. hdl = 0x%p",
			dir_hdl);
		return fsalstat(ERR_FSAL_NOTDIR, 0);
	}
	memset(fh, 0, sizeof(struct gpfs_file_handle));
	fh->handle_size = GPFS_MAX_FH_SIZE;

	fsal_prepare_attrs(&attrib, ATTR_GPFS_ALLOC_HANDLE);

	if (attrs_out != NULL)
		attrib.mask |= attrs_out->mask;

	status =
	    GPFSFSAL_create(dir_hdl, name, op_ctx, attr_in->mode, fh, &attrib);
	if (FSAL_IS_ERROR(status))
		return status;

	/* allocate an obj_handle and fill it up */
	hdl = alloc_handle(fh, dir_hdl->fs, &attrib, NULL, op_ctx->fsal_export);

	if (attrs_out != NULL) {
		/* Copy the attributes to caller, passing ACL ref. */
		fsal_copy_attrs(attrs_out, &attrib, true);
	} else {
		/* Done with the attrs */
		fsal_release_attrs(&attrib);
	}

	*handle = &hdl->obj_handle;
	return fsalstat(ERR_FSAL_NO_ERROR, 0);
}