Example #1
0
static int
stormfs_create(const char *path, mode_t mode, struct fuse_file_info *fi)
{
  int result;
  struct stat st;
  struct file *f;

  DEBUG("create: %s\n", path);

  if((result = valid_path(path)) != 0)
    return result;

  cache_invalidate_dir(path);

  f = cache_get(path);
  fi->fh = cache_create_file(f);

  st.st_gid = getgid();
  st.st_uid = getuid();
  st.st_mode = mode;
  st.st_ctime = time(NULL);
  st.st_mtime = time(NULL);

  if((result = proxy_create(path, &st)) != 0)
    return result;

  pthread_mutex_lock(&f->lock);
  if(f->st == NULL)
    f->st = g_new0(struct stat, 1);
  memcpy(f->st, &st, sizeof(struct stat));
  cache_touch(f);
  pthread_mutex_unlock(&f->lock);

  return result;
}
Example #2
0
static struct wl_proxy *
create_outgoing_proxy(struct wl_proxy *proxy, const struct wl_message *message,
		      union wl_argument *args,
		      const struct wl_interface *interface)
{
	int i, count;
	const char *signature;
	struct argument_details arg;
	struct wl_proxy *new_proxy = NULL;

	signature = message->signature;
	count = arg_count_for_signature(signature);
	for (i = 0; i < count; i++) {
		signature = get_next_argument(signature, &arg);

		switch (arg.type) {
		case 'n':
			new_proxy = proxy_create(proxy, interface);
			if (new_proxy == NULL)
				return NULL;

			args[i].o = &new_proxy->object;
			break;
		}
	}

	return new_proxy;
}
Example #3
0
/** Create a proxy object with a given interface
 *
 * \param factory Factory proxy object
 * \param interface Interface the proxy object should use
 * \return A newly allocated proxy object or NULL on failure
 *
 * This function creates a new proxy object with the supplied interface. The
 * proxy object will have an id assigned from the client id space. The id
 * should be created on the compositor side by sending an appropriate request
 * with \ref wl_proxy_marshal().
 *
 * The proxy will inherit the display and event queue of the factory object.
 *
 * \note This should not normally be used by non-generated code.
 *
 * \sa wl_display, wl_event_queue, wl_proxy_marshal()
 *
 * \memberof wl_proxy
 */
WL_EXPORT struct wl_proxy *
wl_proxy_create(struct wl_proxy *factory, const struct wl_interface *interface)
{
	struct wl_display *display = factory->display;
	struct wl_proxy *proxy;

	pthread_mutex_lock(&display->mutex);
	proxy = proxy_create(factory, interface);
	pthread_mutex_unlock(&display->mutex);

	return proxy;
}
Example #4
0
int _tmain(int argc, _TCHAR* argv[])
{
	WSADATA	ws;
	WSAStartup(MAKEWORD(2, 2), &ws);;

	struct proxy *prox;

	prox = proxy_create();
	assert(prox);


	proxy_set(prox, "192.168.79.1", 1080, "test", "0");
	proxy_connect(prox, "113.108.16.44", 25);
	proxy_recv_line(prox, buff, 512);

	return 0;
}
Example #5
0
static void connect_done(void * args, int error, Channel * c2) {
    ConnectInfo * info = (ConnectInfo *)args;
    Channel * c1 = info->c1;

    if (!is_channel_closed(c1)) {
        assert(c1->state == ChannelStateRedirectReceived);
        if (error) {
            fprintf(stderr, "cannot connect to peer: %s\n", dest_url);
            channel_close(c1);
        }
        else {
            proxy_create(c1, c2);
        }
    }
    else if (!error) {
        channel_close(c2);
    }
    channel_unlock(c1);
    peer_server_free(info->ps);
    loc_free(info);
}