Date: Fri, 24 Nov 2006 06:12:11 -0700 (MST) From: "M. Warner Losh" <imp@bsdimp.com> To: marc.loerner@hob.de Cc: freebsd-drivers@freebsd.org Subject: Re: Directory in /dev Message-ID: <20061124.061211.420518872.imp@bsdimp.com> In-Reply-To: <20061124.060004.-1540393187.imp@bsdimp.com> References: <200611241225.07481.marc.loerner@hob.de> <20061124.055337.-432838076.imp@bsdimp.com> <20061124.060004.-1540393187.imp@bsdimp.com>
next in thread | previous in thread | raw e-mail | index | archive | help
In message: <20061124.060004.-1540393187.imp@bsdimp.com> "M. Warner Losh" <imp@bsdimp.com> writes: : In message: <20061124.055337.-432838076.imp@bsdimp.com> : "M. Warner Losh" <imp@bsdimp.com> writes: : : In message: <200611241225.07481.marc.loerner@hob.de> : : Marc L=F6rner <marc.loerner@hob.de> writes: : : : Hello, : : : is it possible to create/make a subdirectory under /dev, : : : or is it generally forbidden to do that? : : : = : : : I found nothing by googling or reading the archives of the freebs= d mailing = : : : lists. I even found nothing by slightly looking into the kernel c= ode. : : : = : : : Does anyone have some suggestions or pointers for me? : : = : : makedev in your driver with a slash: : : = : : make_dev(cdevsw, minor, uid, gid, perm, "fred/ford%d", unit); : : = : : or if you are creating a disk device, set the d_name similarly. : = : I should have added that creating the first device in a subdirectory : automatically creates that subdirectory. Removing the last device : automatically deletes that subdirectory. You can't create a : subdirectory just because you want it there, however. I just updated the make_dev man page: struct cdev * make_dev(struct cdevsw *cdevsw, int minor, uid_t uid, gid_t gid, int perms, const char *fmt, ...); ... gid. The name is the expansion of fmt and following arguments as printf(9) would print it. The name determines its path under /dev= or other devfs(5) mount point and may contain slash `/' characters to= denote subdirectories. The permissions of the file specified in perms ar= e ... If there's a better wording, please advise. Warner
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20061124.061211.420518872.imp>