[BACK]Return to opt.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / sndiod

Diff for /src/usr.bin/sndiod/opt.c between version 1.9 and 1.10

version 1.9, 2021/11/01 14:43:25 version 1.10, 2024/04/22 10:42:04
Line 375 
Line 375 
  * Set opt's device, and (if necessary) move clients to   * Set opt's device, and (if necessary) move clients to
  * to the new device   * to the new device
  */   */
 void  int
 opt_setdev(struct opt *o, struct dev *ndev)  opt_setdev(struct opt *o, struct dev *ndev)
 {  {
         struct dev *odev;          struct dev *odev;
Line 385 
Line 385 
         int i;          int i;
   
         if (!dev_ref(ndev))          if (!dev_ref(ndev))
                 return;                  return 0;
   
         odev = o->dev;          odev = o->dev;
         if (odev == ndev) {          if (odev == ndev) {
                 dev_unref(ndev);                  dev_unref(ndev);
                 return;                  return 1;
         }          }
   
         /* check if clients can use new device */          /* check if clients can use new device */
Line 399 
Line 399 
                         continue;                          continue;
                 if (s->ops != NULL && !dev_iscompat(odev, ndev)) {                  if (s->ops != NULL && !dev_iscompat(odev, ndev)) {
                         dev_unref(ndev);                          dev_unref(ndev);
                         return;                          return 0;
                 }                  }
         }          }
   
         /*          /*
          * if we're using MMC, move all opts to the new device, mtc_setdev()           * if we're using MMC, move all opts to the new device, mtc_setdev()
          * will call us back           * will call us back
            *
            * XXX: move this to the end to avoid the recursion
          */           */
         if (o->mtc != NULL && o->mtc->dev != ndev) {          if (o->mtc != NULL && o->mtc->dev != ndev) {
                 mtc_setdev(o->mtc, ndev);                  mtc_setdev(o->mtc, ndev);
                 dev_unref(ndev);                  dev_unref(ndev);
                 return;                  return 1;
         }          }
   
         c = ctl_find(CTL_OPT_DEV, o, o->dev);          c = ctl_find(CTL_OPT_DEV, o, o->dev);
Line 468 
Line 470 
         }          }
   
         dev_unref(ndev);          dev_unref(ndev);
           return 1;
 }  }
   
 /*  /*

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10