union smb_open in *_open

Amin Azez azez at ufomechanic.net
Thu Sep 27 15:41:02 GMT 2007


I'm just writing some simple proof of concept cifs caching so I can see
where the integration problems are going to be.

In cifs_open I need to get at the cifs filename, so I can produced a key
based on what is being opened, but io->ntcreatex.in.fname doesn't point
to a valid string in my vfs.

In the pvfs backend, function pvfs_open pvfs_open.c accesses the smbopen
union to get at the cifs name of the file being opened, as:
  io->ntcreatex.in.fname

    /* resolve the cifs name to a posix name */
    status = pvfs_resolve_name(pvfs, req, io->ntcreatex.in.fname,
                   PVFS_RESOLVE_STREAMS, &name);
    if (!NT_STATUS_IS_OK(status)) {
        return status;
    }



So in vfs_cifs.c (yeah, I know it may be vfs_cifs_proxy.c later, but I
want to get the updates till then)

static NTSTATUS cvfs_open(struct ntvfs_module_context *ntvfs,
              struct ntvfs_request *req, union smb_open *io)
{
...

    f = talloc_zero(h, struct cvfs_file);
    NT_STATUS_HAVE_NO_MEMORY(f);
    f->h = h;

    /* Set up caching */
    f->cache_state=0; /* set based on op-lock status */
    DEBUG(1,("Open proxied for file: %x\n",(io->ntcreatex.in.fname)));
    //f->cache_name=talloc_strdup(ntvfs->ctx,io->ntcreatex.in.fname);


Now for in my debug statement I get debug lines like:
Open proxied for file: 4e000000

which is NOT a valid filename pointer, and I get a segfault if I try to
use it as one?

What am I missing? What does pvfs have over the cifs back end?

Sam




More information about the samba-technical mailing list