change defaule permissions on /dev/devstat. while i'm here remove

D_NEEDGIANT flag

Submitted by:	jhb
Reviewed by:	jhb, scottl, rwatson, delphij, phk
MFC after:	1 week
This commit is contained in:
Maksim Yevmenkin 2014-03-24 18:13:41 +00:00
parent 4d3b6a7866
commit b646225a13

View File

@ -460,7 +460,6 @@ static d_mmap_t devstat_mmap;
static struct cdevsw devstat_cdevsw = { static struct cdevsw devstat_cdevsw = {
.d_version = D_VERSION, .d_version = D_VERSION,
.d_flags = D_NEEDGIANT,
.d_mmap = devstat_mmap, .d_mmap = devstat_mmap,
.d_name = "devstat", .d_name = "devstat",
}; };
@ -482,13 +481,16 @@ devstat_mmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr,
if (nprot != VM_PROT_READ) if (nprot != VM_PROT_READ)
return (-1); return (-1);
mtx_lock(&devstat_mutex);
TAILQ_FOREACH(spp, &pagelist, list) { TAILQ_FOREACH(spp, &pagelist, list) {
if (offset == 0) { if (offset == 0) {
*paddr = vtophys(spp->stat); *paddr = vtophys(spp->stat);
mtx_unlock(&devstat_mutex);
return (0); return (0);
} }
offset -= PAGE_SIZE; offset -= PAGE_SIZE;
} }
mtx_unlock(&devstat_mutex);
return (-1); return (-1);
} }
@ -503,7 +505,7 @@ devstat_alloc(void)
mtx_assert(&devstat_mutex, MA_NOTOWNED); mtx_assert(&devstat_mutex, MA_NOTOWNED);
if (!once) { if (!once) {
make_dev_credf(MAKEDEV_ETERNAL | MAKEDEV_CHECKNAME, make_dev_credf(MAKEDEV_ETERNAL | MAKEDEV_CHECKNAME,
&devstat_cdevsw, 0, NULL, UID_ROOT, GID_WHEEL, 0400, &devstat_cdevsw, 0, NULL, UID_ROOT, GID_WHEEL, 0444,
DEVSTAT_DEVICE_NAME); DEVSTAT_DEVICE_NAME);
once = 1; once = 1;
} }