From owner-svn-src-all@freebsd.org Fri Jan 26 04:24:40 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 087C4EBDA87; Fri, 26 Jan 2018 04:24:40 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9D4CB81A2B; Fri, 26 Jan 2018 04:24:39 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9285116D0E; Fri, 26 Jan 2018 04:24:39 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0Q4OdDN002670; Fri, 26 Jan 2018 04:24:39 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0Q4OdcK002668; Fri, 26 Jan 2018 04:24:39 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201801260424.w0Q4OdcK002668@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Fri, 26 Jan 2018 04:24:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328428 - head/share/examples/kld/cdev/module X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/share/examples/kld/cdev/module X-SVN-Commit-Revision: 328428 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jan 2018 04:24:40 -0000 Author: eadler Date: Fri Jan 26 04:24:39 2018 New Revision: 328428 URL: https://svnweb.freebsd.org/changeset/base/328428 Log: example cdev: use make_dev_s Make use of make_dev_s in the example cdev. While here, fix warnings. Reviewed by: rpokala Modified: head/share/examples/kld/cdev/module/cdev.c head/share/examples/kld/cdev/module/cdevmod.c Modified: head/share/examples/kld/cdev/module/cdev.c ============================================================================== --- head/share/examples/kld/cdev/module/cdev.c Fri Jan 26 03:30:05 2018 (r328427) +++ head/share/examples/kld/cdev/module/cdev.c Fri Jan 26 04:24:39 2018 (r328428) @@ -104,7 +104,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; @@ -116,7 +116,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); } @@ -128,7 +128,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) { @@ -152,7 +152,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); @@ -172,7 +172,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: head/share/examples/kld/cdev/module/cdevmod.c ============================================================================== --- head/share/examples/kld/cdev/module/cdevmod.c Fri Jan 26 03:30:05 2018 (r328427) +++ head/share/examples/kld/cdev/module/cdevmod.c Fri Jan 26 04:24:39 2018 (r328428) @@ -109,6 +109,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: @@ -120,8 +121,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");