Ejemplo n.º 1
0
int encfs_open(const char *path, struct fuse_file_info *file)
{
  EncFS_Context *ctx = context();

  int res = -EIO;
  shared_ptr<DirNode> FSRoot = ctx->getRoot(&res);
  if(!FSRoot)
    return res;

  try
  {
    shared_ptr<FileNode> fnode = 
      FSRoot->openNode( path, "open", file->flags, &res );

    if(fnode)
    {
      VLOG(1) << "encfs_open for " << fnode->cipherName()
              << ", flags " << file->flags;

      if( res >= 0 )
      {
        file->fh = (uintptr_t)ctx->putNode(path, fnode);
        res = ESUCCESS;
      }
    }
  } catch( Error &err )
  {
    LOG(ERROR) << "error caught in open: " << err.what();
  }

  return res;
}
Ejemplo n.º 2
0
int encfs_open(const char *path, struct fuse_file_info *file) {
  EncFS_Context *ctx = context();

  if (isReadOnly(ctx) && (file->flags & O_WRONLY || file->flags & O_RDWR))
    return -EROFS;

  int res = -EIO;
  std::shared_ptr<DirNode> FSRoot = ctx->getRoot(&res);
  if (!FSRoot) return res;

  try {
    std::shared_ptr<FileNode> fnode =
        FSRoot->openNode(path, "open", file->flags, &res);

    if (fnode) {
      VLOG(1) << "encfs_open for " << fnode->cipherName() << ", flags "
              << file->flags;

      if (res >= 0) {
        file->fh =
            reinterpret_cast<uintptr_t>(ctx->putNode(path, std::move(fnode)));
        res = ESUCCESS;
      }
    }
  } catch (encfs::Error &err) {
    RLOG(ERROR) << "error caught in open: " << err.what();
  }

  return res;
}
Ejemplo n.º 3
0
int encfs_open(const char *path, struct fuse_file_info *file)
{
    EncFS_Context *ctx = context();

    int res = -EIO;
    shared_ptr<DirNode> FSRoot = ctx->getRoot(&res);
    if(!FSRoot)
	return res;

    try
    {
	shared_ptr<FileNode> fnode = 
	    FSRoot->openNode( path, "open", file->flags, &res );

	if(fnode)
	{
	    rLog(Info, "encfs_open for %s, flags %i", fnode->cipherName(), 
		    file->flags);

	    if( res >= 0 )
	    {
		file->fh = (uintptr_t)ctx->putNode(path, fnode);
		res = ESUCCESS;
	    }
	}
    } catch( rlog::Error &err )
    {
	rError("error caught in open");
	err.log( _RLWarningChannel );
    }

    return res;
}