diff options
author | alfred <alfred@FreeBSD.org> | 2000-06-27 22:46:35 +0000 |
---|---|---|
committer | alfred <alfred@FreeBSD.org> | 2000-06-27 22:46:35 +0000 |
commit | 6a77970fb2e764369c86dbdb113b99c02a18dde5 (patch) | |
tree | 3d061993ccf995045859301c94491abe6e3d0319 /sys/miscfs | |
parent | ea961c73cbbffe4ff9c795ce62223d4634aaf384 (diff) | |
download | FreeBSD-src-6a77970fb2e764369c86dbdb113b99c02a18dde5.zip FreeBSD-src-6a77970fb2e764369c86dbdb113b99c02a18dde5.tar.gz |
by changing the logic here we can support dynamic additions of new
filetypes.
Reviewed by: green
Diffstat (limited to 'sys/miscfs')
-rw-r--r-- | sys/miscfs/fdesc/fdesc_vnops.c | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/sys/miscfs/fdesc/fdesc_vnops.c b/sys/miscfs/fdesc/fdesc_vnops.c index 09c5c37..e0b61f7 100644 --- a/sys/miscfs/fdesc/fdesc_vnops.c +++ b/sys/miscfs/fdesc/fdesc_vnops.c @@ -256,6 +256,11 @@ fdesc_open(ap) return (ENODEV); } +/* + * !!!! READ THIS !!!! + * the proper way to handle this sort of thing is to do proper exclusion, + * so that adding new filetypes works properly at runtime + */ static int fdesc_getattr(ap) struct vop_getattr_args /* { @@ -323,14 +328,13 @@ fdesc_getattr(ap) vap->va_fileid = VTOFDESC(vp)->fd_ix; vap->va_fsid = VNOVAL; break; - - case DTYPE_PIPE: - case DTYPE_SOCKET: - case DTYPE_KQUEUE: + + default: error = fo_stat(fp, &stb, ap->a_p); if (error == 0) { VATTR_NULL(vap); - if (fp->f_type == DTYPE_KQUEUE) + /* XXX Fake it! */ + if (fp->f_type != DTYPE_PIPE && fp->f_type != DTYPE_SOCKET) vap->va_type = VFIFO; else vap->va_type = IFTOVT(stb.st_mode); @@ -345,11 +349,9 @@ fdesc_getattr(ap) vap->va_blocksize = stb.st_blksize; /* - * XXX Sockets and kqueues don't have any - * mtime/atime/ctime data. + * XXX Only pipes have any mtime/atime/ctime data. */ - if (fp->f_type == DTYPE_SOCKET || - fp->f_type == DTYPE_KQUEUE) { + if (fp->f_type != DTYPE_PIPE) { nanotime(&stb.st_atimespec); stb.st_mtimespec = stb.st_atimespec; stb.st_ctimespec = stb.st_mtimespec; @@ -361,9 +363,6 @@ fdesc_getattr(ap) vap->va_gid = stb.st_gid; } break; - default: - panic("fdesc_getattr: Unknown fp->f_type encountered"); - break; } break; @@ -412,18 +411,12 @@ fdesc_setattr(ap) ap->a_cred, ap->a_p); break; - case DTYPE_SOCKET: - case DTYPE_PIPE: - case DTYPE_KQUEUE: + default: if (vap->va_flags != VNOVAL) error = EOPNOTSUPP; else error = 0; break; - - default: - error = EBADF; - break; } return (error); |