Discussion:
To which list should I submit a patch?
(too old to reply)
Leonardo Fogel
2018-01-04 20:42:58 UTC
Permalink
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)
@@ -109,6 +109,7 @@
cdev_load(module_t mod, int cmd, void *arg)
{
int err = 0;
+ struct make_dev_args mda;

switch (cmd) {
case MOD_LOAD:
@@ -120,9 +121,15 @@
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)
@@ -58,11 +58,13 @@
.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>

@@ -74,11 +76,17 @@
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:
Conrad Meyer
2018-01-04 21:44:47 UTC
Permalink
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
Post by Leonardo Fogel
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)
@@ -109,6 +109,7 @@
cdev_load(module_t mod, int cmd, void *arg)
{
int err = 0;
+ struct make_dev_args mda;
switch (cmd) {
@@ -120,9 +121,15 @@
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;
+
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)
@@ -58,11 +58,13 @@
.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>
@@ -74,11 +76,17 @@
foo_load(module_t mod, int cmd, void *arg)
{
int err = 0;
+ struct make_dev_args mda;
switch (cmd) {
- 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;
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-current
Continue reading on narkive:
Loading...