Re: [RFC] Unify all programs into a single 'ksmbdctl' binary

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

On Thu, Dec 2, 2021 at 1:57 AM Enzo Matsumiya <ematsumiya@xxxxxxx> wrote:
> > ...
> > The intention is to make it more like other modern tools (e.g. git,
> > nvme, virsh, etc) which have more clear user interface, readable
> > commands, and also makes it easier to script.
> >
> > Example commands:
> >   # ksmbdctl share add myshare -o "guest ok=yes, writable=yes, path=/mnt/data"
> >   # ksmbdctl user add myuser
> >   # ksmbdctl user add -i $HOME/mysmb.conf anotheruser
> >   # ksmbdctl daemon start
> >
> > Besides adding a new "share list" command, any previously working
> > functionality shouldn't be affected.
>
> - clearer user interface: having a single binary looks much clearer than
>    having several separate programs when, e.g. the user is looking which
>    program does what.
>
> - more readable commands: continuing from topic above, the situation is
>    improved especially when you see that, e.g., the ksmbd.addshare program
>    also updates and deletes shares. With this unification, it is way more
>    intuitive to use:

I've always preferred the UNIX way: one app does one thing and one thing only.
This is why we have cp and mv, mkdir and touch, etc. we don't have a
single vfs-ctl
app that takes several hundred arguments and whose man page is basically a
small book (20+ pages long). This way we:
- keep manpages short and clear
- avoid params conflicts and ambiguity
- keep eggs in different baskets

> I ask you to consider the applications I used as inspiration for such change, such as git

Git is a tricky example. But OK. If this will be implemented in a way
git builtins are
implemented - then I don't see why we would not want this.

git builtins are basically independent apps (they even link all
commands into separate
binaries and then symlink them during installation) which have been
rewritten from either
shell/perl scripts or standalone binaries in C and put into builtins/
directory, for performance
reasons. There are still a handful of shell/perl and standalone
binaries - e.g. git-remote-ftp,
git-http-fetch, git-http-push, ./git-bisect is a shell script. And so on.

Built-in commands are, basically, independent binaris that have a
common ancestor with the
only exception that git does not fork/exec them (not all of them).
They even have entry points
that resemble main() - they take "int argc, const char **argv" - and
git passes its argc and argv
down to built-ins.

Schematically

git: main(int argc, char **argv) {
      builtin = lookup_builtin_command();
      builtin->run(argc, argv);
}

Is this what you have in mind?

>   # ksmbdctl daemon start

Is this going to fork ksmb daemon? Otherwise this looks confusing. I'd
say that ksmbd daemon
needs to have a different name that will clearly show that it's a ksmb
daemon, not the "control"
tool that adds shares and deletes users.



[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux