Re: Re: [PATCH RFC v2 2/2] fuse: add an implementation of open+getattr
From: Horst Birthelmer
Date: Wed Jan 07 2026 - 04:11:48 EST
On Tue, Jan 06, 2026 at 05:46:09PM -0800, Joanne Koong wrote:
> On Tue, Dec 23, 2025 at 2:13 PM Horst Birthelmer
> <hbirthelmer@xxxxxxxxxxxxxx> wrote:
> >
> > + open_args.opcode = opcode;
> > + open_args.nodeid = nodeid;
> > + open_args.in_numargs = 1;
> > + open_args.in_args[0].size = sizeof(open_in);
> > + open_args.in_args[0].value = &open_in;
> > + open_args.out_numargs = 1;
> > + open_args.out_args[0].size = sizeof(struct fuse_open_out);
> > + open_args.out_args[0].value = outopenp;
> > +
> > + err = fuse_compound_add(compound, &open_args);
> > + if (err)
> > + goto out;
> > +
> > + /* Add GETATTR */
> > + getattr_args.opcode = FUSE_GETATTR;
> > + getattr_args.nodeid = nodeid;
> > + getattr_args.in_numargs = 1;
> > + getattr_args.in_args[0].size = sizeof(getattr_in);
> > + getattr_args.in_args[0].value = &getattr_in;
> > + getattr_args.out_numargs = 1;
> > + getattr_args.out_args[0].size = sizeof(struct fuse_attr_out);
> > + getattr_args.out_args[0].value = outattrp;
>
> I think things end up looking cleaner here (and above for the open
> args) if the arg initialization logic gets abstracted into helper
> functions, as fuse_do_getattr() and fuse_send_open() have pretty much
> the exact same logic.
>
> Thanks,
> Joanne
>
You are completely right.
Will change that in the next version,
Thanks,
Horst