FreeBSD Bugzilla – Attachment 189451 Details for
Bug 224941
[patch] Replaces the legacy make_dev(9) with the newer make_dev_s(9) in some doc.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
A patch (svn diff src) that replaces make_dev(9) with make_dev_s(9) in some doc.
svn_diff_src.txt (text/plain), 1.93 KB, created by
Leonardo
on 2018-01-05 20:19:51 UTC
(
hide
)
Description:
A patch (svn diff src) that replaces make_dev(9) with make_dev_s(9) in some doc.
Filename:
MIME Type:
Creator:
Leonardo
Created:
2018-01-05 20:19:51 UTC
Size:
1.93 KB
patch
obsolete
>Index: src/share/examples/kld/cdev/module/cdevmod.c >=================================================================== >--- src/share/examples/kld/cdev/module/cdevmod.c (revision 327595) >+++ 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 327595) >+++ 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:
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 224941
: 189451