mbox series

[0/9] Unify all programs into a single binary "ksmbdctl"

Message ID 20220307013344.29064-1-ematsumiya@suse.de (mailing list archive)
Headers show
Series Unify all programs into a single binary "ksmbdctl" | expand

Message

Enzo Matsumiya March 7, 2022, 1:33 a.m. UTC
Hello,

This commit unifies all existing programs
(ksmbd.{adduser,addshare,control,mountd}) into a single ksmbdctl binary.

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.

Basic testing was done manually.

TODO:
- run more complex tests in more complex environments
- implement unit tests (for each command and subcommand)
- create an abstract command interface, to make it easier to add/modify
  commands

Enzo Matsumiya (9):
  ksmbd-tools: rename dirs to reflect new commands
  ksmbd-tools: move control functions to daemon
  ksmbd-tools: use quotes for local includes
  share: introduce share_cmd
  user: introduce user_cmd
  daemon: introduce daemon_cmd
  daemon/rpc_samr: drop unused function rpc_samr_remove_domain_entry()
  Unify all programs into a single binary "ksmbdctl"
  README: change to markdown, updates for ksmbdctl

 Makefile.am                        |  14 +-
 README                             | 100 -------
 README.md                          |  57 ++--
 addshare/addshare.c                | 172 -------------
 addshare/share_admin.h             |  15 --
 adduser/adduser.c                  | 180 -------------
 adduser/user_admin.h               |  15 --
 configure.ac                       |   7 +-
 control/Makefile.am                |   7 -
 control/control.c                  | 128 ---------
 {mountd => daemon}/Makefile.am     |   2 +-
 mountd/mountd.c => daemon/daemon.c | 401 +++++++++++++++++++++--------
 daemon/daemon.h                    |  55 ++++
 {mountd => daemon}/ipc.c           |  27 +-
 {mountd => daemon}/rpc.c           |  21 +-
 {mountd => daemon}/rpc_lsarpc.c    |  13 +-
 {mountd => daemon}/rpc_samr.c      |  22 +-
 {mountd => daemon}/rpc_srvsvc.c    |  11 +-
 {mountd => daemon}/rpc_wkssvc.c    |  10 +-
 {mountd => daemon}/smbacl.c        |   4 +-
 {mountd => daemon}/worker.c        |  32 +--
 include/config_parser.h            |   2 +-
 include/ksmbdtools.h               |  24 +-
 ksmbdctl.c                         | 182 +++++++++++++
 lib/config_parser.c                |  15 +-
 lib/ksmbdtools.c                   |  26 +-
 lib/management/spnego.c            |   6 +-
 lib/management/spnego_krb5.c       |   4 +-
 {addshare => share}/Makefile.am    |   2 +-
 share/share.c                      | 227 ++++++++++++++++
 {addshare => share}/share_admin.c  |  97 +++++--
 share/share_admin.h                |  44 ++++
 {adduser => user}/Makefile.am      |   2 +-
 {adduser => user}/md4_hash.c       |   2 +-
 {adduser => user}/md4_hash.h       |   0
 user/user.c                        | 238 +++++++++++++++++
 {adduser => user}/user_admin.c     | 263 ++++++++++---------
 user/user_admin.h                  |  44 ++++
 38 files changed, 1458 insertions(+), 1013 deletions(-)
 delete mode 100644 README
 delete mode 100644 addshare/addshare.c
 delete mode 100644 addshare/share_admin.h
 delete mode 100644 adduser/adduser.c
 delete mode 100644 adduser/user_admin.h
 delete mode 100644 control/Makefile.am
 delete mode 100644 control/control.c
 rename {mountd => daemon}/Makefile.am (95%)
 rename mountd/mountd.c => daemon/daemon.c (55%)
 create mode 100644 daemon/daemon.h
 rename {mountd => daemon}/ipc.c (95%)
 rename {mountd => daemon}/rpc.c (98%)
 rename {mountd => daemon}/rpc_lsarpc.c (98%)
 rename {mountd => daemon}/rpc_samr.c (98%)
 rename {mountd => daemon}/rpc_srvsvc.c (98%)
 rename {mountd => daemon}/rpc_wkssvc.c (97%)
 rename {mountd => daemon}/smbacl.c (99%)
 rename {mountd => daemon}/worker.c (95%)
 create mode 100644 ksmbdctl.c
 rename {addshare => share}/Makefile.am (74%)
 create mode 100644 share/share.c
 rename {addshare => share}/share_admin.c (68%)
 create mode 100644 share/share_admin.h
 rename {adduser => user}/Makefile.am (69%)
 rename {adduser => user}/md4_hash.c (99%)
 rename {adduser => user}/md4_hash.h (100%)
 create mode 100644 user/user.c
 rename {adduser => user}/user_admin.c (52%)
 create mode 100644 user/user_admin.h

Comments

Namjae Jeon March 10, 2022, 2:11 a.m. UTC | #1
2022-03-07 10:33 GMT+09:00, Enzo Matsumiya <ematsumiya@suse.de>:
> Hello,
Hi Enzo,

First, Thanks for your work:)
>
> This commit unifies all existing programs
> (ksmbd.{adduser,addshare,control,mountd}) into a single ksmbdctl binary.
>
> 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.
>
> Basic testing was done manually.
>
> TODO:
> - run more complex tests in more complex environments
> - implement unit tests (for each command and subcommand)
If testcases are added to .travis.yml, It can be automatically tested
whenever a patch is applied.
> - create an abstract command interface, to make it easier to add/modify
>   commands
Could you please elaborate more what is abstract command interface ?

And totally looks good to me. Please run checkpatch.pl on these patches.

>
> Enzo Matsumiya (9):
>   ksmbd-tools: rename dirs to reflect new commands
>   ksmbd-tools: move control functions to daemon
>   ksmbd-tools: use quotes for local includes
>   share: introduce share_cmd
>   user: introduce user_cmd
>   daemon: introduce daemon_cmd
>   daemon/rpc_samr: drop unused function rpc_samr_remove_domain_entry()
>   Unify all programs into a single binary "ksmbdctl"
>   README: change to markdown, updates for ksmbdctl
>
>  Makefile.am                        |  14 +-
>  README                             | 100 -------
>  README.md                          |  57 ++--
>  addshare/addshare.c                | 172 -------------
>  addshare/share_admin.h             |  15 --
>  adduser/adduser.c                  | 180 -------------
>  adduser/user_admin.h               |  15 --
>  configure.ac                       |   7 +-
>  control/Makefile.am                |   7 -
>  control/control.c                  | 128 ---------
>  {mountd => daemon}/Makefile.am     |   2 +-
>  mountd/mountd.c => daemon/daemon.c | 401 +++++++++++++++++++++--------
>  daemon/daemon.h                    |  55 ++++
>  {mountd => daemon}/ipc.c           |  27 +-
>  {mountd => daemon}/rpc.c           |  21 +-
>  {mountd => daemon}/rpc_lsarpc.c    |  13 +-
>  {mountd => daemon}/rpc_samr.c      |  22 +-
>  {mountd => daemon}/rpc_srvsvc.c    |  11 +-
>  {mountd => daemon}/rpc_wkssvc.c    |  10 +-
>  {mountd => daemon}/smbacl.c        |   4 +-
>  {mountd => daemon}/worker.c        |  32 +--
>  include/config_parser.h            |   2 +-
>  include/ksmbdtools.h               |  24 +-
>  ksmbdctl.c                         | 182 +++++++++++++
>  lib/config_parser.c                |  15 +-
>  lib/ksmbdtools.c                   |  26 +-
>  lib/management/spnego.c            |   6 +-
>  lib/management/spnego_krb5.c       |   4 +-
>  {addshare => share}/Makefile.am    |   2 +-
>  share/share.c                      | 227 ++++++++++++++++
>  {addshare => share}/share_admin.c  |  97 +++++--
>  share/share_admin.h                |  44 ++++
>  {adduser => user}/Makefile.am      |   2 +-
>  {adduser => user}/md4_hash.c       |   2 +-
>  {adduser => user}/md4_hash.h       |   0
>  user/user.c                        | 238 +++++++++++++++++
>  {adduser => user}/user_admin.c     | 263 ++++++++++---------
>  user/user_admin.h                  |  44 ++++
>  38 files changed, 1458 insertions(+), 1013 deletions(-)
>  delete mode 100644 README
>  delete mode 100644 addshare/addshare.c
>  delete mode 100644 addshare/share_admin.h
>  delete mode 100644 adduser/adduser.c
>  delete mode 100644 adduser/user_admin.h
>  delete mode 100644 control/Makefile.am
>  delete mode 100644 control/control.c
>  rename {mountd => daemon}/Makefile.am (95%)
>  rename mountd/mountd.c => daemon/daemon.c (55%)
>  create mode 100644 daemon/daemon.h
>  rename {mountd => daemon}/ipc.c (95%)
>  rename {mountd => daemon}/rpc.c (98%)
>  rename {mountd => daemon}/rpc_lsarpc.c (98%)
>  rename {mountd => daemon}/rpc_samr.c (98%)
>  rename {mountd => daemon}/rpc_srvsvc.c (98%)
>  rename {mountd => daemon}/rpc_wkssvc.c (97%)
>  rename {mountd => daemon}/smbacl.c (99%)
>  rename {mountd => daemon}/worker.c (95%)
>  create mode 100644 ksmbdctl.c
>  rename {addshare => share}/Makefile.am (74%)
>  create mode 100644 share/share.c
>  rename {addshare => share}/share_admin.c (68%)
>  create mode 100644 share/share_admin.h
>  rename {adduser => user}/Makefile.am (69%)
>  rename {adduser => user}/md4_hash.c (99%)
>  rename {adduser => user}/md4_hash.h (100%)
>  create mode 100644 user/user.c
>  rename {adduser => user}/user_admin.c (52%)
>  create mode 100644 user/user_admin.h
>
> --
> 2.34.1
>
>