16 Commits

Author SHA1 Message Date
Miklos Szeredi
c0f817320d fuse: remove #include "fuse_i.h" from dev.c and dev_uring.c
Move a couple of function declarations from fuse_i.h to dev.h and
fuse_dev_i.h.

Add fuse_conn_get_id() helper that retrieves the connection ID (s_dev) from
fuse_conn.

With the exception of cuse.c, virtio_fs.c and trace.c source files now
either include fuse_i.h or fuse_dev_i/dev_uring_i.h but not both.

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
2026-06-15 14:06:18 +02:00
Miklos Szeredi
ff572265f2 fuse: set params in fuse_chan_set_initialized()
Set minor, max_write and max_pages in the fuse_chan.  These match the same
fields in fuse_conn but are needed in both layers.

[Dongyang Jin: Pointers should use NULL instead of explicit '0']

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
2026-06-15 14:06:17 +02:00
Miklos Szeredi
ca46a4aca6 fuse: create notify.c
Move FUSE_NOTIFY_* handling into a separate source file.

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
2026-06-15 14:06:17 +02:00
Miklos Szeredi
b8b072cbaf fuse: create poll.c
Move f_op->poll related functions to the new source file.

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
2026-06-15 14:06:17 +02:00
Miklos Szeredi
994d807943 fuse: change fud->fc to fud->chan
Store pointer to struct fuse_chan instead of struct fuse_conn in fuse_dev.

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
2026-06-15 14:06:17 +02:00
Miklos Szeredi
794e811d14 fuse: split out filesystem part of request sending
Create a new source file: req.c and add the request sending entry
functions:

  __fuse_simple_request()
  fuse_simple_background()
  fuse_simple_notify_reply()

Introduce transport layer sending functions that are called by the
respective fs layer function:

  fuse_chan_send()
  fuse_chan_send_bg()
  fuse_chan_send_notify_reply()

Move calculation of request header fields uid, gid and pid from
fuse_get_req() and fuse_force_creads() to a new helper: fuse_fill_creds().

These fileds are now passed to the transport layer via struct fuse_args.

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
2026-06-15 14:06:17 +02:00
Miklos Szeredi
4eeb5e6cb0 fuse: abort related layering cleanup
- rename fuse_abort_conn() to fuse_chan_abort(), pass fuse_chan pointer
   instead of fuse_conn

 - pass an abort_with_err argument that tells fuse_dev_(read|write) to
   return with ECONNABORTED instead of ENODEV

 - move fc->aborted to fch->abort_with_err

 - rename fuse_wait_aborted() to fuse_chan_wait_aborted()

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
2026-06-15 14:06:17 +02:00
Miklos Szeredi
a3a3e06bfb fuse: remove #include "fuse_i.h" from "req_timeout.c"
Just need to move fuse_abort_conn().

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
2026-06-15 14:06:17 +02:00
Miklos Szeredi
4f5f0038d6 fuse: move forget related struct and helpers
Move:
 - struct fuse_forget_link to fuse_dev_i.h
 - fuse_alloc_forget() to dev.c/dev.h

Rename:
 - fuse_queue_forget -> fuse_chan_queue_forget

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
2026-06-15 14:06:16 +02:00
Miklos Szeredi
b6d83d4e3e fuse: don't access transport layer structs directly from the fs layer
Add helpers (get and set functions mainly) that cleanly separate the
layers.

Remove #include "fuse_dev_i.h" from:

 - inode.c
 - file.c
 - control.c

Remove #include "dev_uring_i.h" from inode.c.

[Li Wang: drop redundant initializer in process_init_limits()]

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
2026-06-15 14:06:16 +02:00
Miklos Szeredi
56b4332e12 fuse: move request timeout to fuse_chan
Move:

 - timeout

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
2026-06-15 14:06:16 +02:00
Miklos Szeredi
2b07cbc4e4 fuse: move background queuing related members to fuse_chan
Move:

 - max_background
 - num_background
 - active_background
 - bg_queue
 - bg_lock

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
2026-06-15 14:06:15 +02:00
Miklos Szeredi
d8189630a1 fuse: move fuse_dev and fuse_pqueue to dev.c
Move function definitions to dev.c, struct definitions to fuse_dev_i.h.

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
2026-06-15 14:06:15 +02:00
Miklos Szeredi
b88fb2b92b fuse: move fuse_iqueue to fuse_chan
Move the 'fiq' member from fuse_conn to fuse_chan.

Move iqueue related structure definitions and function declarations from
"fuse_i.h" to "fuse_dev_i.h".

Add a fuse_dev_chan_new() helper, that returns a fuse_chan initialized with
the fuse_dev_fiq_ops.

Add a fuse_chan_release() function, that calls fiq->ops->release().

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
2026-06-15 14:06:15 +02:00
Miklos Szeredi
a73a7883b4 fuse: add struct fuse_chan
The goal is to separate transport layer stuff out from struct fuse_conn,
leaving just the filesystem related members.

Add a new object referenced from fuse_conn.  This patch just implements the
allocation and freeing of this object.

Following patches will move transport related members from fuse_conn to
fuse_chan.

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
2026-06-15 14:06:15 +02:00
Miklos Szeredi
f14348575d fuse: move request timeout code to a new source file
This marks the first step in cleanly separating the transport layer from
the filesystem layer.

Add "dev.h", which will contain the interface definition for the transport
layer.

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
2026-06-15 14:06:15 +02:00