Browse Source

Remove pipe_key from libfuse

allocs
Antonio SJ Musumeci 2 weeks ago
parent
commit
c33ef49cdf
  1. 1
      libfuse/lib/fuse_i.h
  2. 44
      libfuse/lib/fuse_lowlevel.cpp

1
libfuse/lib/fuse_i.h

@ -52,7 +52,6 @@ struct fuse_ll
pthread_mutex_t lock;
int got_init;
int got_destroy;
pthread_key_t pipe_key;
int broken_splice_nonblock;
uint64_t notify_ctr;
struct fuse_notify_req notify_list;

44
libfuse/lib/fuse_lowlevel.cpp

@ -452,22 +452,6 @@ fuse_send_data_iov_fallback(struct fuse_ll *f,
return res;
}
struct fuse_ll_pipe
{
size_t size;
int can_grow;
int pipe[2];
};
static
void
fuse_ll_pipe_free(struct fuse_ll_pipe *llp)
{
close(llp->pipe[0]);
close(llp->pipe[1]);
free(llp);
}
static
int
fuse_send_data_iov(struct fuse_ll *f,
@ -1792,7 +1776,6 @@ void
fuse_ll_destroy(void *data)
{
struct fuse_ll *f = (struct fuse_ll *)data;
struct fuse_ll_pipe *llp;
if(f->got_init && !f->got_destroy)
{
@ -1800,24 +1783,12 @@ fuse_ll_destroy(void *data)
f->op.destroy(f->userdata);
}
llp = (fuse_ll_pipe*)pthread_getspecific(f->pipe_key);
if(llp != NULL)
fuse_ll_pipe_free(llp);
pthread_key_delete(f->pipe_key);
mutex_destroy(&f->lock);
free(f);
lfmp_clear(&g_FMP_fuse_req);
}
static
void
fuse_ll_pipe_destructor(void *data)
{
struct fuse_ll_pipe *llp = (fuse_ll_pipe*)data;
fuse_ll_pipe_free(llp);
}
static
void
fuse_send_errno(struct fuse_ll *f_,
@ -1987,7 +1958,6 @@ fuse_lowlevel_new_common(struct fuse_args *args,
size_t op_size,
void *userdata)
{
int err;
struct fuse_ll *f;
struct fuse_session *se;
@ -2008,16 +1978,8 @@ fuse_lowlevel_new_common(struct fuse_args *args,
f->notify_ctr = 1;
mutex_init(&f->lock);
err = pthread_key_create(&f->pipe_key, fuse_ll_pipe_destructor);
if(err)
{
fprintf(stderr, "fuse: failed to create thread specific key: %s\n",
strerror(err));
goto out_free;
}
if(fuse_opt_parse(args,NULL,fuse_ll_opts,fuse_ll_opt_proc) == -1)
goto out_key_destroy;
goto out_free;
memcpy(&f->op, op, op_size);
f->owner = getuid();
@ -2029,12 +1991,10 @@ fuse_lowlevel_new_common(struct fuse_args *args,
(void*)fuse_ll_destroy);
if(!se)
goto out_key_destroy;
goto out_free;
return se;
out_key_destroy:
pthread_key_delete(f->pipe_key);
out_free:
mutex_destroy(&f->lock);
free(f);

Loading…
Cancel
Save