Re: FIRST_CHILD(frame->this)->fops->create

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If this is the actual code below you have in your fop, please look for
the comments inline -

> Example code for the "hang" case, from my prototype (inside
> a function called from inside the xlator->write handler);
>
>        loc_t data_loc;
>        char path[255];
>        char name[255];
>        char * data_path;
>        char * data_name;
>        int32_t flags;
>        mode_t mode;
>        fd_t * fd;
>
>        memset(path, 0, sizeof(path));
>        if(snprintf(path, sizeof(path) - 1, "/data.db") <= 0)
>          return -1;
>
>        memset(name, 0, sizeof(name));
>        if(snprintf(name, sizeof(name) - 1, "data.db") <= 0)
>          return -1;
>
>        data_path = CALLOC(1, strlen(path) + 1);
>        ERR_ABORT(data_path);
>        memset(data_path, 0, sizeof(data_path));
>        memcpy(data_path, path, strlen(path));
>
>        data_name = CALLOC(1, strlen(name) + 1);
>        ERR_ABORT(data_name);
>        memset(data_name, 0, sizeof(data_name));
>        memcpy(data_name, name, strlen(name));
>
>        memset(&data_loc, 0, sizeof(data_loc));
>        data_loc.inode = NULL;  // redundant

you need to have the loc->inode and loc->parent members filled in
properly. See fuse-bridge.c and server-protocol.c on how to generate
create()able inodes and fds. To reach the parent inode of the
directory where the file needs to be created, refer the
fuse_loc_fill() or server_loc_fill() functions.

>        data_loc.path = data_path;
>        data_loc.name = data_name;
>
>        flags = O_CREAT | O_RDWR | O_EXCL;
>
>        mode = (mode_t)0700;
>
>        memset(fd, 0, sizeof(fd_t));
>
>        STACK_WIND(frame,
>                    xlator_func_writev_create_cbk,
>                    FIRST_CHILD(frame->this),
>                    FIRST_CHILD(frame->this)->fops->create,
>                    &data_loc, flags, mode, &fd);

the fd pointer should be pre-allocated with fd_create(). Refer
fuse_create() and fuse_create_cbk() to figure out the right things to
do. If you can describe your requirements in more detail, we can
suggest a few tips and directions on how to proceed.

>        gf_log(this->name, GF_LOG_WARNING, "Hung above me");

Avati




[Index of Archives]     [Gluster Users]     [Ceph Users]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux