Date: Sun, 8 Feb 2004 03:45:19 -0500 (EST) From: Andre Guibert de Bruet <andy@siliconlandmark.com> To: current@freebsd.org Subject: make_dev(9) perms for SCSI & SCSI RAID drivers in CURRENT. Message-ID: <20040208022417.M91658@alpha.siliconlandmark.com>
index | next in thread | raw e-mail
[-- Attachment #1 --] Hi, While studying the various FreeBSD SCSI and SCSI RAID drivers, I noticed that the file mode (perm mask) varies per driver. So far, I've come across 0600, 0640 and 0644. I can't really see why any of these drivers would have anything other than 0600, as it would require root access or at least write perm to do anything useful with the card. Here's a quick illustration of what I'm refering to: aac 0640 (octal notation in code) amr 0600 (implemented as S_IRUSR | S_IWUSR) asr 0640 (octal notation in code) ciss 0600 (implemented as S_IRUSR | S_IWUSR) ida 0600 (implemented as S_IRUSR | S_IWUSR) iir 0644 (implemented as S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH) ips 0600 (implemented as S_IRUSR | S_IWUSR) isp 0600 (octal notation in code) mly 0600 (implemented as S_IRUSR | S_IWUSR) I've attached a set of patches that make the aac, asr, iir and isp drivers conform to S_IRUSR | S_IWUSR. I don't have all of these cards, but the drivers build on today's CURRENT and these changes are rather minor. As always, comments are welcome. :) Regards, Andy > Andre Guibert de Bruet | Enterprise Software Consultant > > Silicon Landmark, LLC. | http://siliconlandmark.com/ > [-- Attachment #2 --] Index: aac.c =================================================================== RCS file: /home/ncvs/src/sys/dev/aac/aac.c,v retrieving revision 1.85 diff -u -r1.85 aac.c --- aac.c 7 Feb 2004 17:40:37 -0000 1.85 +++ aac.c 8 Feb 2004 08:09:48 -0000 @@ -51,6 +51,7 @@ #include <sys/signalvar.h> #include <sys/time.h> #include <sys/eventhandler.h> +#include <sys/stat.h> #include <machine/bus_memio.h> #include <machine/bus.h> @@ -271,7 +272,7 @@ */ unit = device_get_unit(sc->aac_dev); sc->aac_dev_t = make_dev(&aac_cdevsw, unit, UID_ROOT, GID_OPERATOR, - 0640, "aac%d", unit); + S_IRUSR | S_IWUSR, "aac%d", unit); (void)make_dev_alias(sc->aac_dev_t, "afa%d", unit); (void)make_dev_alias(sc->aac_dev_t, "hpn%d", unit); sc->aac_dev_t->si_drv1 = sc; [-- Attachment #3 --] Index: asr.c =================================================================== RCS file: /home/ncvs/src/sys/dev/asr/asr.c,v retrieving revision 1.38 diff -u -r1.38 asr.c --- asr.c 26 Sep 2003 15:56:42 -0000 1.38 +++ asr.c 8 Feb 2004 07:59:18 -0000 @@ -3127,8 +3127,8 @@ /* * Generate the device node information */ - (void)make_dev(&asr_cdevsw, unit, UID_ROOT, GID_OPERATOR, 0640, - "rasr%d", unit); + (void)make_dev(&asr_cdevsw, unit, UID_ROOT, GID_OPERATOR, + S_IRUSR | S_IWUSR, "rasr%d", unit); ATTACH_RETURN(0); } /* asr_attach */ [-- Attachment #4 --] Index: iir_ctrl.c =================================================================== RCS file: /home/ncvs/src/sys/dev/iir/iir_ctrl.c,v retrieving revision 1.11 diff -u -r1.11 iir_ctrl.c --- iir_ctrl.c 26 Sep 2003 15:36:47 -0000 1.11 +++ iir_ctrl.c 8 Feb 2004 07:56:45 -0000 @@ -103,12 +103,12 @@ #ifdef SDEV_PER_HBA dev = make_dev(&iir_cdevsw, hba2minor(unit), UID_ROOT, GID_OPERATOR, - S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, "iir%d", unit); + S_IRUSR | S_IWUSR, "iir%d", unit); #else if (sdev_made) return (0); dev = make_dev(&iir_cdevsw, 0, UID_ROOT, GID_OPERATOR, - S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, "iir"); + S_IRUSR | S_IWUSR, "iir"); sdev_made = 1; #endif return (dev); [-- Attachment #5 --] Index: isp_freebsd.c =================================================================== RCS file: /home/ncvs/src/sys/dev/isp/isp_freebsd.c,v retrieving revision 1.96 diff -u -r1.96 isp_freebsd.c --- isp_freebsd.c 7 Feb 2004 03:47:33 -0000 1.96 +++ isp_freebsd.c 8 Feb 2004 08:12:40 -0000 @@ -35,6 +35,7 @@ #include <sys/conf.h> #include <sys/module.h> #include <sys/ioccom.h> +#include <sys/stat.h> #include <dev/isp/isp_ioctl.h> @@ -211,7 +212,7 @@ * Create device nodes */ (void) make_dev(&isp_cdevsw, device_get_unit(isp->isp_dev), UID_ROOT, - GID_OPERATOR, 0600, "%s", device_get_nameunit(isp->isp_dev)); + GID_OPERATOR, S_IRUSR | S_IWUSR, "%s", device_get_nameunit(isp->isp_dev)); if (isp->isp_role != ISP_ROLE_NONE) { isp->isp_state = ISP_RUNSTATE;home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040208022417.M91658>
