Author: kib
Date: Fri Mar 13 10:52:22 2009
New Revision: 189766
URL: http://svn.freebsd.org/changeset/base/189766

Log:
  MFC r189450:
  Extract the no_poll() and vop_nopoll() code into the common routine
  poll_no_poll().
  Return a poll_no_poll() result from devfs_poll_f() when
  filedescriptor does not reference the live cdev, instead of ENXIO.

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/ath/ath_hal/   (props changed)
  stable/7/sys/dev/cxgb/   (props changed)
  stable/7/sys/fs/devfs/devfs_vnops.c
  stable/7/sys/kern/kern_conf.c
  stable/7/sys/kern/sys_generic.c
  stable/7/sys/kern/vfs_default.c
  stable/7/sys/sys/systm.h

Modified: stable/7/sys/fs/devfs/devfs_vnops.c
==============================================================================
--- stable/7/sys/fs/devfs/devfs_vnops.c Fri Mar 13 10:40:38 2009        
(r189765)
+++ stable/7/sys/fs/devfs/devfs_vnops.c Fri Mar 13 10:52:22 2009        
(r189766)
@@ -973,7 +973,7 @@ devfs_poll_f(struct file *fp, int events
        fpop = td->td_fpop;
        error = devfs_fp_check(fp, &dev, &dsw);
        if (error)
-               return (error);
+               return (poll_no_poll(events));
        error = dsw->d_poll(dev, events, td);
        td->td_fpop = fpop;
        dev_relthread(dev);

Modified: stable/7/sys/kern/kern_conf.c
==============================================================================
--- stable/7/sys/kern/kern_conf.c       Fri Mar 13 10:40:38 2009        
(r189765)
+++ stable/7/sys/kern/kern_conf.c       Fri Mar 13 10:52:22 2009        
(r189766)
@@ -313,18 +313,8 @@ no_strategy(struct bio *bp)
 static int
 no_poll(struct cdev *dev __unused, int events, struct thread *td __unused)
 {
-       /*
-        * Return true for read/write.  If the user asked for something
-        * special, return POLLNVAL, so that clients have a way of
-        * determining reliably whether or not the extended
-        * functionality is present without hard-coding knowledge
-        * of specific filesystem implementations.
-        * Stay in sync with vop_nopoll().
-        */
-       if (events & ~POLLSTANDARD)
-               return (POLLNVAL);
 
-       return (events & (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM));
+       return (poll_no_poll(events));
 }
 
 #define no_dump                (dumper_t *)enodev

Modified: stable/7/sys/kern/sys_generic.c
==============================================================================
--- stable/7/sys/kern/sys_generic.c     Fri Mar 13 10:40:38 2009        
(r189765)
+++ stable/7/sys/kern/sys_generic.c     Fri Mar 13 10:52:22 2009        
(r189766)
@@ -637,6 +637,22 @@ struct cv  selwait;
 u_int          nselcoll;       /* Select collisions since boot */
 SYSCTL_UINT(_kern, OID_AUTO, nselcoll, CTLFLAG_RD, &nselcoll, 0, "");
 
+int
+poll_no_poll(int events)
+{
+       /*
+        * Return true for read/write.  If the user asked for something
+        * special, return POLLNVAL, so that clients have a way of
+        * determining reliably whether or not the extended
+        * functionality is present without hard-coding knowledge
+        * of specific filesystem implementations.
+        */
+       if (events & ~POLLSTANDARD)
+               return (POLLNVAL);
+
+       return (events & (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM));
+}
+
 #ifndef _SYS_SYSPROTO_H_
 struct select_args {
        int     nd;

Modified: stable/7/sys/kern/vfs_default.c
==============================================================================
--- stable/7/sys/kern/vfs_default.c     Fri Mar 13 10:40:38 2009        
(r189765)
+++ stable/7/sys/kern/vfs_default.c     Fri Mar 13 10:52:22 2009        
(r189766)
@@ -344,18 +344,8 @@ vop_nopoll(ap)
                struct thread *a_td;
        } */ *ap;
 {
-       /*
-        * Return true for read/write.  If the user asked for something
-        * special, return POLLNVAL, so that clients have a way of
-        * determining reliably whether or not the extended
-        * functionality is present without hard-coding knowledge
-        * of specific filesystem implementations.
-        * Stay in sync with kern_conf.c::no_poll().
-        */
-       if (ap->a_events & ~POLLSTANDARD)
-               return (POLLNVAL);
 
-       return (ap->a_events & (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM));
+       return (poll_no_poll(ap->a_events));
 }
 
 /*

Modified: stable/7/sys/sys/systm.h
==============================================================================
--- stable/7/sys/sys/systm.h    Fri Mar 13 10:40:38 2009        (r189765)
+++ stable/7/sys/sys/systm.h    Fri Mar 13 10:52:22 2009        (r189766)
@@ -321,6 +321,8 @@ int uminor(dev_t dev);
 int umajor(dev_t dev);
 const char *devtoname(struct cdev *cdev);
 
+int poll_no_poll(int events);
+
 /* XXX: Should be void nanodelay(u_int nsec); */
 void   DELAY(int usec);
 
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to