Diff for /wikisrc/users/mlelstv/disk-driver-template.mdwn between versions 1.3 and 1.4

version 1.3, 2015/12/21 10:08:45 version 1.4, 2015/12/21 10:25:04
Line 7 Line 7
 ## Declaration  ## Declaration
   
 <pre><code>  <pre><code>
   static dev_type_open(xxxopen);
   static dev_type_close(xxxclose);
   static dev_type_read(xxxread);
   static dev_type_write(xxxwrite);
   static dev_type_ioctl(xxxioctl);
   static dev_type_strategy(xxxstrategy);
   static dev_type_dump(xxxdump);
   static dev_type_size(xxxsize);
   static dev_type_discard(xxxdiscard);
   
 const struct bdevsw xxx_bdevsww= {  const struct bdevsw xxx_bdevsww= {
         .d_open = xxxopen,          .d_open = xxxopen,
         .d_close = xxxclose,          .d_close = xxxclose,
Line 33  const struct cdevsw xxx_cdevsw = { Line 43  const struct cdevsw xxx_cdevsw = {
         .d_flag = D_DISK          .d_flag = D_DISK
 };  };
   
   static void     xxxminphys(struct buf *bp);
   static int      xxxdiskstart(device_t, struct buf *bp);
   static void     xxx_iosize(device_t, int *);
   static int      xxx_dumpblocks(device_t, void *, daddr_t, int);
   static int      xxx_lastclose(device_t);
   static int      xxx_discard(device_t, off_t, off_t);
   
 static const struct dkdriver xxxdkdriver = {  static const struct dkdriver xxxdkdriver = {
         .d_open = xxxopen,          .d_open = xxxopen,
         .d_close = xxxclose,          .d_close = xxxclose,
Line 45  static const struct dkdriver xxxdkdriver Line 62  static const struct dkdriver xxxdkdriver
         .d_discard = xxx_discard          .d_discard = xxx_discard
 };  };
   
   static int      xxx_match(device_t, cfdata_t, void *);
   static void     xxx_attach(device_t, device_t, void *);
   static int      xxx_detach(device_t, int);
   
   CFATTACH_DECL3_NEW(xxx, sizeof(struct xxx_softc),
       xxx_match, xxx_attach, xxx_detach, NULL, NULL, NULL, DVF_DETACH_SHUTDOWN);
       extern struct cfdriver xxx_cd;  
 extern struct   cfdriver xxx_cd;  extern struct   cfdriver xxx_cd;
   
 static dev_type_open(xxxopen);  static int      xxxdone(struct buf *);
 static dev_type_close(xxxclose);  
 static dev_type_read(xxxread);  
 static dev_type_write(xxxwrite);  
 static dev_type_ioctl(xxxioctl);  
 static dev_type_strategy(xxxstrategy);  
 static dev_type_dump(xxxdump);  
 static dev_type_size(xxxsize);  
 static dev_type_discard(xxxdiscard);  
   
 static void     xxxminphys(struct buf *bp);  
 static int      xxxdiskstart(device_t, struct buf *bp);  
 static void     xxx_iosize(device_t, int *);  
 static int      xxx_dumpblocks(device_t, void *, daddr_t, int);  
 static int      xxx_lastclose(device_t);  
 static int      xxx_discard(device_t, off_t, off_t);  
   
   
 #define DEVPROLOG \  #define DEVPROLOG \
Line 215  xxxdone(struct xxx_softc *sc, struct buf Line 224  xxxdone(struct xxx_softc *sc, struct buf
   
 ----  ----
   
 ##  DK driver interface  ## Autoconf interface
   
   <pre><code>
   static int
   xxx_match(device_t self, cfdata_t cfdata, void *aux)
   {
           return 1;
   }
   
   static void
   xxx_attach(device_t parent, device_t self, void *aux)
   {
   }
   
   static void
   xxx_detach(device_t self, int flags)
   {
           struct xxx_softc *sc = device_private(self);
           struct dk_softc *dksc = &sc->sc_dksc;
   
           dkwedge_delall(&dksc->sc_dkdev);
   
           dk_drain(dksc);
           bufq_free(dksc->sc_bufq);
   
           dk_detach(dksc);
           disk_detach(&dksc->sc_dkdev);
           disk_destroy(&dksc->sc_dkdev);
   }
   </code></pre>
   
   ----
   
   ## DK driver interface
   
 <pre><code>  <pre><code>
 static int  static int

Removed from v.1.3  
changed lines
  Added in v.1.4


CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb