1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-17 10:26:15 +00:00

Prepare for the final onslaught on devices:

Move uid/gid/mode from cdev to cdevsw.

Add kind field to use for devd(8) later.

Bump both D_VERSION and __FreeBSD_version
This commit is contained in:
Poul-Henning Kamp 2005-03-17 12:07:00 +00:00
parent ee39666a76
commit 800b42bde0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=143746
4 changed files with 19 additions and 13 deletions

View File

@ -318,9 +318,9 @@ devfs_populate(struct devfs_mount *dm)
bcopy(pdev->si_name, de->de_symlink, j);
} else {
de->de_inode = i;
de->de_uid = dev->si_uid;
de->de_gid = dev->si_gid;
de->de_mode = dev->si_mode;
de->de_uid = dev->si_devsw->d_uid;
de->de_gid = dev->si_devsw->d_gid;
de->de_mode = dev->si_devsw->d_mode;
de->de_dirent->d_type = DT_CHR;
}
#ifdef MAC

View File

@ -365,7 +365,7 @@ prep_cdevsw(struct cdevsw *devsw)
dev_lock();
if (devsw->d_version != D_VERSION_00) {
if (devsw->d_version != D_VERSION_01) {
printf(
"WARNING: Device driver \"%s\" has wrong version %s\n",
devsw->d_name, "and is disabled. Recompile KLD module.");
@ -419,8 +419,15 @@ make_dev(struct cdevsw *devsw, int minornr, uid_t uid, gid_t gid, int perms, con
KASSERT((minornr & ~MAXMINOR) == 0,
("Invalid minor (0x%x) in make_dev", minornr));
if (!(devsw->d_flags & D_INIT))
if (!(devsw->d_flags & D_INIT)) {
prep_cdevsw(devsw);
if (devsw->d_uid == 0)
devsw->d_uid = uid;
if (devsw->d_gid == 0)
devsw->d_gid = gid;
if (devsw->d_mode == 0)
devsw->d_mode = perms;
}
dev = allocdev();
dev_lock();
dev = newdev(devsw->d_maj, minornr, dev);
@ -448,9 +455,6 @@ make_dev(struct cdevsw *devsw, int minornr, uid_t uid, gid_t gid, int perms, con
va_end(ap);
dev->si_devsw = devsw;
dev->si_uid = uid;
dev->si_gid = gid;
dev->si_mode = perms;
dev->si_flags |= SI_NAMED;
LIST_INSERT_HEAD(&devsw->d_devs, dev, si_list);

View File

@ -79,9 +79,6 @@ struct cdev {
void *si_drv1, *si_drv2;
struct cdevsw *si_devsw;
int si_iosize_max; /* maximum I/O size (for physio &al) */
uid_t si_uid;
gid_t si_gid;
mode_t si_mode;
u_long si_usecount;
u_long si_threadcount;
union {
@ -176,7 +173,8 @@ typedef int dumper_t(
* Version numbers.
*/
#define D_VERSION_00 0x20011966
#define D_VERSION D_VERSION_00
#define D_VERSION_01 0x17032005 /* Add d_uid,gid,mode & kind */
#define D_VERSION D_VERSION_01
/*
* Flags used for internal housekeeping
@ -205,6 +203,10 @@ struct cdevsw {
d_kqfilter_t *d_kqfilter;
d_purge_t *d_purge;
d_spare2_t *d_spare2;
uid_t d_uid;
gid_t d_gid;
mode_t d_mode;
const char *d_kind;
/* These fields should not be messed with by drivers */
LIST_ENTRY(cdevsw) d_list;

View File

@ -57,7 +57,7 @@
* is created, otherwise 1.
*/
#undef __FreeBSD_version
#define __FreeBSD_version 600020 /* Master, propagated to newvers */
#define __FreeBSD_version 600021 /* Master, propagated to newvers */
#ifndef LOCORE
#include <sys/types.h>