[Pvfs2-users] PVFS_isys_io call: Invalid argument
Becky Ligon
ligon at omnibond.com
Mon Feb 20 13:37:26 EST 2012
No. I haven't tried to compile it.
Which version of OrangeFS are you using?
Send me your PVFS configuration file.
Becky
2012/2/20 g_p g_p <g_p_java at hotmail.com>
> a correction here ')'
>
> char *buffer = (char *) malloc( count * (sizeof(char) + 1))
>
> ------------------------------
> From: g_p_java at hotmail.com
> To: ligon at omnibond.com
> Subject: RE: [Pvfs2-users] PVFS_isys_io call: Invalid argument
> Date: Mon, 20 Feb 2012 20:21:23 +0200
> CC: pvfs2-users at beowulf-underground.org
>
>
>
> Hello and thanks for replying,
>
> i already did that
>
> char *buffer = (char *) malloc( count * (sizeof(char) + 1)
>
> but it didn't work too
>
> Have you compiled it at all?
> Does it work for you?
>
> I'm sure i've made a mistake in the code, but i can't find it
> and i have to find it as soon as possible cause i need it
>
> May you please help me?
>
> Thanks
>
> ------------------------------
> Date: Mon, 20 Feb 2012 09:58:41 -0500
> Subject: Re: [Pvfs2-users] PVFS_isys_io call: Invalid argument
> From: ligon at omnibond.com
> To: g_p_java at hotmail.com
> CC: pvfs2-users at beowulf-underground.org
>
> See below for correction.
>
> Becky
>
> 2012/2/19 g_p g_p <g_p_java at hotmail.com>
>
> Hello,
>
> i'm trying to create a file and read from it.
> The creation is working fine. When i'm trying to read the file, i get an
> error when i call the "pvfs_sys_read"
>
> invalid (NULL) required argument
> PVFS_isys_io call: Invalid argument
> PVFS_sys_read : Invalid argument (error class: 0)
>
>
> *The problem is in the following line:*
> " ret = PVFS_sys_read(resp_create.ref, file_req, 0,buffer, mem_req,
> &credentials, &resp_io, hints);"
> I can't understand which one of the arguments is causing the problem,
> can you understand?How can i solve it?
>
> The program is as follows:
>
> #include <stdio.h>
> #include <stdlib.h>
> #include <unistd.h>
> #include <limits.h>
> #include <string.h>
> #include <sys/time.h>
> #include <sys/types.h>
> #include <sys/stat.h>
> #include <fcntl.h>
> #include <time.h>
> #include <libgen.h>
> #include <getopt.h>
> #include "pvfs2.h"
>
>
> #include "str-utils.h"
> #include "pint-sysint-utils.h"
> #include "pvfs2-internal.h"
>
> #include "pvfs2-hint.h"
>
>
> int main(void) {
>
> int ret = -1;
>
>
> PVFS_sys_layout layout;
>
> layout.algorithm = PVFS_SYS_LAYOUT_ROUND_ROBIN;
> layout.server_list.count = 0;
> layout.server_list.servers = NULL;
>
> /* Initialize the pvfs2 server */
> ret = PVFS_util_init_defaults();
> if(ret < 0)
> {
> PVFS_perror("PVFS_util_init_defaults", ret);
> return -1;
> }
>
> int rc;
> int num_segs;
> char *working_file = "test2.txt";
>
> char directory[PVFS_NAME_MAX] = "/mnt/pvfs2/testDir/";
> char filename[PVFS_SEGMENT_MAX];
>
> layout.algorithm = PVFS_SYS_LAYOUT_ROUND_ROBIN;
> layout.server_list.count = 0;
> if(layout.server_list.servers)
> {
> free(layout.server_list.servers);
> }
> layout.server_list.servers = NULL;
>
> char pvfs_path[PVFS_NAME_MAX] = {0};
> PVFS_fs_id cur_fs;
> PVFS_sysresp_lookup resp_lookup;
> PVFS_sysresp_create resp_create;
> PVFS_credentials credentials;
> PVFS_object_ref parent_ref;
> PVFS_sys_attr attr;
>
> /* Translate path into pvfs2 relative path */
> rc = PINT_get_base_dir(working_file, directory, PVFS_NAME_MAX);
> num_segs = PINT_string_count_segments(working_file);
> rc = PINT_get_path_element(working_file, num_segs - 1,filename,
> PVFS_SEGMENT_MAX);
>
> if (rc)
> {
> fprintf(stderr, "Unknown path format: %s\n", working_file);
> ret = -1;
>
> }
>
> rc = PVFS_util_resolve(directory, &cur_fs,pvfs_path, PVFS_NAME_MAX);
> if (rc)
> {
> PVFS_perror("PVFS_util_resolve", rc);
> ret = -1;
>
> }
>
> PVFS_util_gen_credentials(&credentials);
>
> memset(&resp_lookup, 0, sizeof(PVFS_sysresp_lookup));
> rc = PVFS_sys_lookup(cur_fs, pvfs_path, &credentials,&resp_lookup,
> PVFS2_LOOKUP_LINK_NO_FOLLOW, NULL);
> if (rc)
> {
> PVFS_perror("PVFS_sys_lookup", rc);
> ret = -1;
>
> }
>
> /* Set attributes */
> imemset(&attr, 0, sizeof(PVFS_sys_attr));
> attr.owner = credentials.uid;
> attr.group = credentials.gid;
> attr.perms = 0777;
> attr.atime = time(NULL);
> attr.mtime = attr.atime;
> attr.mask = PVFS_ATTR_SYS_ALL_SETABLE;
> attr.dfile_count = 0;
>
> parent_ref = resp_lookup.ref;
>
> layout.algorithm = PVFS_SYS_LAYOUT_RANDOM;
>
> lrc = PVFS_sys_create(filename,
> parent_ref,
> attr,
> parent_ref,
> attr,
> &credentials,
> NULL,
> &resp_create,
> &layout,
> NULL);
> if (rc)
> {
> fprintf(stderr, "Error: An error occurred while creating
> %s\n",working_file);
> PVFS_perror("PVFS_sys_create", rc);
> ret = -1;
> }
>
> /* Everthing fine till here! */
>
> PVFS_Request mem_req, file_req;
> PVFS_sysresp_io resp_io;
>
>
> /********* buffer needs to be allocated, at least 100 bytes in your
> case, then you can send in the
> ********* pointer to the PVFS_sys_read call.
>
>
> char * buffer;
>
>
> *************/
>
>
>
> size_t count = 100;
> int64_t offset;
> PVFS_hint hints = NULL;
> file_req = PVFS_BYTE;
> ret = PVFS_Request_contiguous(count, PVFS_BYTE, &mem_req);
>
> if (ret < 0)
> {
> fprintf(stderr, "Error: PVFS_Request_contiguous failure\n");
> return (ret);
> }
> ret = PVFS_sys_read(resp_create.ref, file_req, 0,buffer, mem_req,
> &credentials, &resp_io, hints); /* problem here!!! */
> if (ret == 0)
> {
> PVFS_Request_free(&mem_req);
>
> }
> else {
> PVFS_perror("PVFS_sys_read === ", ret);
> printf("ret = %d\n",ret);
> }
> PVFS_sys_finalize();
>
>
> }
>
>
>
> Can you understand where the problem is?Where is that NULL value that
> causes the problem?
> Thanks, in advance
>
>
>
>
> _______________________________________________
> Pvfs2-users mailing list
> Pvfs2-users at beowulf-underground.org
> http://www.beowulf-underground.org/mailman/listinfo/pvfs2-users
>
>
>
>
> --
> Becky Ligon
> OrangeFS Support and Development
> Omnibond Systems
> Anderson, South Carolina
>
>
>
> _______________________________________________ Pvfs2-users mailing list
> Pvfs2-users at beowulf-underground.org
> http://www.beowulf-underground.org/mailman/listinfo/pvfs2-users
>
--
Becky Ligon
OrangeFS Support and Development
Omnibond Systems
Anderson, South Carolina
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.beowulf-underground.org/pipermail/pvfs2-users/attachments/20120220/a5391f8a/attachment.htm
More information about the Pvfs2-users
mailing list