aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/fuse/dev.c45
-rw-r--r--fs/fuse/fuse_i.h5
-rw-r--r--fs/fuse/inode.c45
3 files changed, 45 insertions, 50 deletions
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 99325547604f..4526da8907c6 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -154,28 +154,6 @@ void fuse_release_background(struct fuse_req *req)
154 spin_unlock(&fuse_lock); 154 spin_unlock(&fuse_lock);
155} 155}
156 156
157static void process_init_reply(struct fuse_conn *fc, struct fuse_req *req)
158{
159 int i;
160 struct fuse_init_out *arg = &req->misc.init_out;
161
162 if (req->out.h.error || arg->major != FUSE_KERNEL_VERSION)
163 fc->conn_error = 1;
164 else {
165 fc->minor = arg->minor;
166 fc->max_write = arg->minor < 5 ? 4096 : arg->max_write;
167 }
168
169 /* After INIT reply is received other requests can go
170 out. So do (FUSE_MAX_OUTSTANDING - 1) number of
171 up()s on outstanding_sem. The last up() is done in
172 fuse_putback_request() */
173 for (i = 1; i < FUSE_MAX_OUTSTANDING; i++)
174 up(&fc->outstanding_sem);
175
176 fuse_put_request(fc, req);
177}
178
179/* 157/*
180 * This function is called when a request is finished. Either a reply 158 * This function is called when a request is finished. Either a reply
181 * has arrived or it was interrupted (and not yet sent) or some error 159 * has arrived or it was interrupted (and not yet sent) or some error
@@ -366,29 +344,6 @@ void request_send_background(struct fuse_conn *fc, struct fuse_req *req)
366 request_send_nowait(fc, req); 344 request_send_nowait(fc, req);
367} 345}
368 346
369void fuse_send_init(struct fuse_conn *fc)
370{
371 /* This is called from fuse_read_super() so there's guaranteed
372 to be exactly one request available */
373 struct fuse_req *req = fuse_get_request(fc);
374 struct fuse_init_in *arg = &req->misc.init_in;
375 arg->major = FUSE_KERNEL_VERSION;
376 arg->minor = FUSE_KERNEL_MINOR_VERSION;
377 req->in.h.opcode = FUSE_INIT;
378 req->in.numargs = 1;
379 req->in.args[0].size = sizeof(*arg);
380 req->in.args[0].value = arg;
381 req->out.numargs = 1;
382 /* Variable length arguement used for backward compatibility
383 with interface version < 7.5. Rest of init_out is zeroed
384 by do_get_request(), so a short reply is not a problem */
385 req->out.argvar = 1;
386 req->out.args[0].size = sizeof(struct fuse_init_out);
387 req->out.args[0].value = &req->misc.init_out;
388 req->end = process_init_reply;
389 request_send_background(fc, req);
390}
391
392/* 347/*
393 * Lock the request. Up to the next unlock_request() there mustn't be 348 * Lock the request. Up to the next unlock_request() there mustn't be
394 * anything that could cause a page-fault. If the request was already 349 * anything that could cause a page-fault. If the request was already
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index 145098056ca6..926b41c959d5 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -480,8 +480,3 @@ int fuse_do_getattr(struct inode *inode);
480 * Invalidate inode attributes 480 * Invalidate inode attributes
481 */ 481 */
482void fuse_invalidate_attr(struct inode *inode); 482void fuse_invalidate_attr(struct inode *inode);
483
484/**
485 * Send the INIT message
486 */
487void fuse_send_init(struct fuse_conn *fc);
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index d359d8de22a4..8683e7254d53 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -464,6 +464,51 @@ static struct super_operations fuse_super_operations = {
464 .show_options = fuse_show_options, 464 .show_options = fuse_show_options,
465}; 465};
466 466
467static void process_init_reply(struct fuse_conn *fc, struct fuse_req *req)
468{
469 int i;
470 struct fuse_init_out *arg = &req->misc.init_out;
471
472 if (req->out.h.error || arg->major != FUSE_KERNEL_VERSION)
473 fc->conn_error = 1;
474 else {
475 fc->minor = arg->minor;
476 fc->max_write = arg->minor < 5 ? 4096 : arg->max_write;
477 }
478
479 /* After INIT reply is received other requests can go
480 out. So do (FUSE_MAX_OUTSTANDING - 1) number of
481 up()s on outstanding_sem. The last up() is done in
482 fuse_putback_request() */
483 for (i = 1; i < FUSE_MAX_OUTSTANDING; i++)
484 up(&fc->outstanding_sem);
485
486 fuse_put_request(fc, req);
487}
488
489static void fuse_send_init(struct fuse_conn *fc)
490{
491 /* This is called from fuse_read_super() so there's guaranteed
492 to be exactly one request available */
493 struct fuse_req *req = fuse_get_request(fc);
494 struct fuse_init_in *arg = &req->misc.init_in;
495 arg->major = FUSE_KERNEL_VERSION;
496 arg->minor = FUSE_KERNEL_MINOR_VERSION;
497 req->in.h.opcode = FUSE_INIT;
498 req->in.numargs = 1;
499 req->in.args[0].size = sizeof(*arg);
500 req->in.args[0].value = arg;
501 req->out.numargs = 1;
502 /* Variable length arguement used for backward compatibility
503 with interface version < 7.5. Rest of init_out is zeroed
504 by do_get_request(), so a short reply is not a problem */
505 req->out.argvar = 1;
506 req->out.args[0].size = sizeof(struct fuse_init_out);
507 req->out.args[0].value = &req->misc.init_out;
508 req->end = process_init_reply;
509 request_send_background(fc, req);
510}
511
467static unsigned long long conn_id(void) 512static unsigned long long conn_id(void)
468{ 513{
469 static unsigned long long ctr = 1; 514 static unsigned long long ctr = 1;