devfs patch for deleted devices handling
http://phk.freebsd.dk/patch/devfs.patch 20010522devfs.patch This patch changes the way deletes are managed in DEVFS. This fixes a number of warnings relating to removed cloned devices. It also makes it possible to recreate deleted devices with mknod(2). The major/minor arguments are ignored. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 [EMAIL PROTECTED] | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-current" in the body of the message
DEVFS patch.
OK, here is the nasty bit of DEVFS: The locking and protection patch: http://phk.freebsd.dk/patch/devfs.patch -- Add support for an overflow table for DEVFS inodes. The static table defaults to 1024 inodes, if that fills, an overflow table of 32k inodes is allocated. Both numbers can be changed at compile time, the size of the overflow table also with the sysctl vfs.devfs.noverflow. Use atomic instructions to barrier between make_dev()/destroy_dev() and the mounts. Add lockmgr() locking of directories for operations accessing or modifying the directory TAILQs. Various nitpicking here and there. The patch to i386/include/atomic.h is taken from SMPng to which I added atomic_cmpset_ptr(). -- With this patch DEVFS has the features and properties it should have with respect to the "main mount". -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 [EMAIL PROTECTED] | TCP/IP since RFC 956 FreeBSD coreteam member | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-current" in the body of the message
Re: official devfs patch for review
In message <[EMAIL PROTECTED]>, Chris Costello writes: >On Sunday, August 27, 2000, Boris Popov wrote: >> No, not all bits are incorporated. At least you've missed two >> important things. First: >> >> # cd /dev/fd >> # ls >> 0 1 2 >> # cd .. >> # ls >> 0 1 2 >> >> And second - directory names supplied by readdir() function >> contains junk characters at the end. > > I'm going to commit some fdescfs-related patches sometime soon >next week. If you're not using the fdescfs code already, I can >probably integrate my work into devfs, since that was the point >of my work on fdescfs. I'm not quite ready to embrace fdescfs yet, I want to get devfs fully debugged first. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 [EMAIL PROTECTED] | TCP/IP since RFC 956 FreeBSD coreteam member | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-current" in the body of the message
Re: official devfs patch for review
On Sunday, August 27, 2000, Boris Popov wrote: > No, not all bits are incorporated. At least you've missed two > important things. First: > > # cd /dev/fd > # ls > 0 1 2 > # cd .. > # ls > 0 1 2 > > And second - directory names supplied by readdir() function > contains junk characters at the end. I'm going to commit some fdescfs-related patches sometime soon next week. If you're not using the fdescfs code already, I can probably integrate my work into devfs, since that was the point of my work on fdescfs. -- |Chris Costello <[EMAIL PROTECTED]> |All new: The software is not compatible with previous versions. `--- To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-current" in the body of the message
Re: official devfs patch for review
On Sat, 26 Aug 2000, Poul-Henning Kamp wrote: > This incorporates the functional bits from the patch Boris posted > here earlier as I've been able to extract them from his patch. No, not all bits are incorporated. At least you've missed two important things. First: # cd /dev/fd # ls 0 1 2 # cd .. # ls 0 1 2 And second - directory names supplied by readdir() function contains junk characters at the end. -- Boris Popov http://www.butya.kz/~bp/ To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-current" in the body of the message
official devfs patch for review
There is an official DEVFS patch at http://phk.freebsd.dk/patch/devfs.patch This incorporates the functional bits from the patch Boris posted here earlier as I've been able to extract them from his patch. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 [EMAIL PROTECTED] | TCP/IP since RFC 956 FreeBSD coreteam member | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-current" in the body of the message
devfs patch for review
Hello, I've made some fixes in the fs layer of new devfs. First version of this patch was passed via Poul and new version includes parts of his suggestions. Here is a brief decription of the patch: Rename de_dir to de_parent with appropritate code changes. Implement proper logic and locking in the devfs_lookup(). Fix behaviour for '.' and '..' directories with corresponding changes in the devfs_readdir(). Implement devfs_read() operation for directories. Return proper mount owner in the devfs_statfs(). Fix panic related to the incorrect handling of root vnode. Few cosmetic changes as well. Code is still not SMP safe. -- Boris Popov http://www.butya.kz/~bp/ Index: devfs.h === RCS file: /home/ncvs/src/sys/fs/devfs/devfs.h,v retrieving revision 1.2 diff -u -r1.2 devfs.h --- devfs.h 2000/08/24 15:36:47 1.2 +++ devfs.h 2000/08/26 12:28:52 @@ -48,10 +48,12 @@ #defineDE_ORPHAN 0x1 #defineDE_DOT 0x2 #defineDE_DOTDOT 0x4 - struct dirent *de_dirent; + int de_type; + char * de_name; + int de_namelen; TAILQ_ENTRY(devfs_dirent) de_list; TAILQ_HEAD(, devfs_dirent) de_dlist; - struct devfs_dirent *de_dir; + struct devfs_dirent *de_parent; int de_links; mode_t de_mode; uid_t de_uid; @@ -68,7 +70,6 @@ }; struct devfs_mount { - struct vnode*dm_root; /* Root node */ struct devfs_dirent *dm_rootdir; struct devfs_dirent *dm_basedir; unsigneddm_generation; @@ -84,6 +85,7 @@ #define VFSTODEVFS(mp) ((struct devfs_mount *)((mp)->mnt_data)) +#define VNTODEVFS(vp) ((struct devfs_dirent *)(vp)->v_data) extern vop_t **devfs_vnodeop_p; extern vop_t **devfs_specop_p; @@ -93,6 +95,9 @@ void devfs_purge __P((struct devfs_dirent *dd)); struct devfs_dirent * devfs_vmkdir __P((char *name, int namelen, struct devfs_dirent *dotdot)); +int devfs_allocv(struct devfs_dirent *de, struct mount *mp, struct vnode **vpp, + struct proc *proc); + #endif /* DEVFS_INTERN */ typedef void (*devfs_clone_fn) __P((void *arg, char *name, int namelen, dev_t *result)); Index: devfs_devs.c === RCS file: /home/ncvs/src/sys/fs/devfs/devfs_devs.c,v retrieving revision 1.3 diff -u -r1.3 devfs_devs.c --- devfs_devs.c2000/08/24 15:36:47 1.3 +++ devfs_devs.c2000/08/26 11:49:49 @@ -46,16 +46,13 @@ { int i; struct devfs_dirent *de; - struct dirent d; - d.d_namlen = namelen; - i = sizeof (*de) + GENERIC_DIRSIZ(&d); + i = sizeof (*de) + namelen + 1; MALLOC(de, struct devfs_dirent *, i, M_DEVFS, M_WAITOK); bzero(de, i); - de->de_dirent = (struct dirent *)(de + 1); - de->de_dirent->d_namlen = namelen; - de->de_dirent->d_reclen = GENERIC_DIRSIZ(&d); - bcopy(name, de->de_dirent->d_name, namelen + 1); + de->de_name = (char *)(de + 1); + de->de_namelen = namelen; + bcopy(name, de->de_name, namelen); nanotime(&de->de_ctime); de->de_mtime = de->de_atime = de->de_ctime; de->de_links = 1; @@ -63,36 +60,23 @@ } struct devfs_dirent * -devfs_vmkdir(char *name, int namelen, struct devfs_dirent *dotdot) +devfs_vmkdir(char *name, int namelen, struct devfs_dirent *parent) { - struct devfs_dirent *dd; struct devfs_dirent *de; - dd = devfs_newdirent(name, namelen); + de = devfs_newdirent(name, namelen); - TAILQ_INIT(&dd->de_dlist); + TAILQ_INIT(&de->de_dlist); - dd->de_dirent->d_type = DT_DIR; - dd->de_mode = 0755; - dd->de_links = 2; - dd->de_dir = dd; - - de = devfs_newdirent(".", 1); - de->de_dirent->d_type = DT_DIR; - de->de_dir = dd; - de->de_flags |= DE_DOT; - TAILQ_INSERT_TAIL(&dd->de_dlist, de, de_list); - - de = devfs_newdirent("..", 2); - de->de_dirent->d_type = DT_DIR; - if (dotdot == NULL) - de->de_dir = dd; - else - de->de_dir = dotdot; - de->de_flags |= DE_DOTDOT; - TAILQ_INSERT_TAIL(&dd->de_dlist, de, de_list); + de->de_type = DT_DIR; + de->de_mode = 0755; + de->de_links = 2; - return (dd); + if (parent) { + de->de_parent = parent; + TAILQ_INSERT_TAIL(&parent->de_dlist, de, de_list); + } + return (de); } static void @@ -125,7 +109,6 @@ FREE(dd, M_DEVFS); } - int devfs_populate(struct devfs_mount *dm) { @@ -145,7 +128,7 @@ continue; } if (dev == NULL && de != NULL) { -