Date: Sat, 17 Mar 2018 05:00:07 +0000 (UTC) From: Eitan Adler <eadler@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331085 - stable/11/share/examples/kld/cdev/module Message-ID: <201803170500.w2H507qv079168@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: eadler Date: Sat Mar 17 05:00:07 2018 New Revision: 331085 URL: https://svnweb.freebsd.org/changeset/base/331085 Log: MFC r328428: example cdev: use make_dev_s Make use of make_dev_s in the example cdev. While here, fix warnings. Modified: stable/11/share/examples/kld/cdev/module/cdev.c stable/11/share/examples/kld/cdev/module/cdevmod.c Directory Properties: stable/11/ (props changed) Modified: stable/11/share/examples/kld/cdev/module/cdev.c ============================================================================== --- stable/11/share/examples/kld/cdev/module/cdev.c Sat Mar 17 03:00:24 2018 (r331084) +++ stable/11/share/examples/kld/cdev/module/cdev.c Sat Mar 17 05:00:07 2018 (r331085) @@ -102,7 +102,7 @@ mydev_open(struct cdev *dev, int flag, int otyp, struc { struct proc *procp = td->td_proc; - printf("mydev_open: dev_t=%d, flag=%x, otyp=%x, procp=%p\n", + printf("mydev_open: dev_t=%lu, flag=%x, otyp=%x, procp=%p\n", dev2udev(dev), flag, otyp, procp); memset(&buf, '\0', 513); len = 0; @@ -114,7 +114,7 @@ mydev_close(struct cdev *dev, int flag, int otyp, stru { struct proc *procp = td->td_proc; - printf("mydev_close: dev_t=%d, flag=%x, otyp=%x, procp=%p\n", + printf("mydev_close: dev_t=%lu, flag=%x, otyp=%x, procp=%p\n", dev2udev(dev), flag, otyp, procp); return (0); } @@ -126,7 +126,7 @@ mydev_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int error = 0; struct proc *procp = td->td_proc; - printf("mydev_ioctl: dev_t=%d, cmd=%lx, arg=%p, mode=%x procp=%p\n", + printf("mydev_ioctl: dev_t=%lu, cmd=%lx, arg=%p, mode=%x procp=%p\n", dev2udev(dev), cmd, arg, mode, procp); switch(cmd) { @@ -150,7 +150,7 @@ mydev_write(struct cdev *dev, struct uio *uio, int iof { int err = 0; - printf("mydev_write: dev_t=%d, uio=%p, ioflag=%d\n", + printf("mydev_write: dev_t=%lu, uio=%p, ioflag=%d\n", dev2udev(dev), uio, ioflag); err = copyinstr(uio->uio_iov->iov_base, &buf, 512, &len); @@ -170,7 +170,7 @@ mydev_read(struct cdev *dev, struct uio *uio, int iofl { int err = 0; - printf("mydev_read: dev_t=%d, uio=%p, ioflag=%d\n", + printf("mydev_read: dev_t=%lu, uio=%p, ioflag=%d\n", dev2udev(dev), uio, ioflag); if (len <= 0) { Modified: stable/11/share/examples/kld/cdev/module/cdevmod.c ============================================================================== --- stable/11/share/examples/kld/cdev/module/cdevmod.c Sat Mar 17 03:00:24 2018 (r331084) +++ stable/11/share/examples/kld/cdev/module/cdevmod.c Sat Mar 17 05:00:07 2018 (r331085) @@ -107,6 +107,7 @@ static int cdev_load(module_t mod, int cmd, void *arg) { int err = 0; + struct make_dev_args mda; switch (cmd) { case MOD_LOAD: @@ -118,8 +119,14 @@ cdev_load(module_t mod, int cmd, void *arg) 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");
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201803170500.w2H507qv079168>