IMO, either is fine. I think documentation may refer to docs outside of the src tree, whereas this is in the src tree. Thanks for the submission. Best, Conrad On Thu, Jan 4, 2018 at 12:42 PM, Leonardo Fogel <leonardofogel_at_yahoo.com.br> wrote: > > > Hi, > I have written a short patch that replaces the legacy interface make_dev(9) with the newer one make_dev_s(9) in the DEV_MODULE(9) man page and in an example that is included in the base. I do not know if I should submit it as a PR to "Base System" (since they are in the base tree) or to "Documentation". > Please, could you kindly give me some suggestion? > Thank you for your time. > > Index: src/share/examples/kld/cdev/module/cdevmod.c > =================================================================== > --- src/share/examples/kld/cdev/module/cdevmod.c (revision 327530) > +++ src/share/examples/kld/cdev/module/cdevmod.c (working copy) > _at__at_ -109,6 +109,7 _at__at_ > cdev_load(module_t mod, int cmd, void *arg) > { > int err = 0; > + struct make_dev_args mda; > > switch (cmd) { > case MOD_LOAD: > _at__at_ -120,9 +121,15 _at__at_ > printf("Copyright (c) 1998\n"); > printf("Rajesh Vaidheeswarran\n"); > printf("All rights reserved\n"); > - sdev = make_dev(&my_devsw, 0, UID_ROOT, GID_WHEEL, 0600, "cdev"); > - break; /* Success*/ > > + make_dev_args_init(&mda); > + mda.mda_devsw = &my_devsw; > + mda.mda_uid = UID_ROOT; > + mda.mda_gid = GID_WHEEL; > + mda.mda_mode = 0600; > + err = make_dev_s(&mda, &sdev, "cdev"); > + break; > + > case MOD_UNLOAD: > printf("Unloaded kld character device driver\n"); > destroy_dev(sdev); > Index: src/share/man/man9/DEV_MODULE.9 > =================================================================== > --- src/share/man/man9/DEV_MODULE.9 (revision 327530) > +++ src/share/man/man9/DEV_MODULE.9 (working copy) > _at__at_ -58,11 +58,13 _at__at_ > .Xr DECLARE_MODULE 9 > for more information). > The event handler is supposed to create the device with > -.Fn make_dev > +.Fn make_dev_s > on load and to destroy it when it is unloaded using > .Fn destroy_dev . > .Sh EXAMPLES > .Bd -literal > +#include <sys/param.h> > +#include <sys/kernel.h> > #include <sys/module.h> > #include <sys/conf.h> > > _at__at_ -74,11 +76,17 _at__at_ > foo_load(module_t mod, int cmd, void *arg) > { > int err = 0; > + struct make_dev_args mda; > > switch (cmd) { > case MOD_LOAD: > - sdev = make_dev(&foo_devsw, 0, UID_ROOT, GID_WHEEL, 0600, "foo"); > - break; /* Success*/ > + make_dev_args_init(&mda); > + mda.mda_devsw = &foo_devsw; > + mda.mda_uid = UID_ROOT; > + mda.mda_gid = GID_WHEEL; > + mda.mda_mode = 0600; > + err = make_dev_s(&mda, &sdev, "foo"); > + break; > > case MOD_UNLOAD: > case MOD_SHUTDOWN: > _______________________________________________ > freebsd-current_at_freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to "freebsd-current-unsubscribe_at_freebsd.org"Received on Thu Jan 04 2018 - 20:44:56 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:14 UTC