Print this page
6595 sdev's devfsadm macros set a bad precedent


 315  * sdev_fid overlays the fid structure (for VFS_VGET)
 316  */
 317 struct sdev_fid {
 318         uint16_t        sdevfid_len;
 319         ino32_t         sdevfid_ino;
 320         int32_t         sdevfid_gen;
 321 };
 322 
 323 /*
 324  * devfsadm and devname communication defines
 325  */
 326 typedef enum {
 327         DEVNAME_DEVFSADM_STOPPED = 0,   /* devfsadm has never run */
 328         DEVNAME_DEVFSADM_RUNNING,       /* devfsadm is running */
 329         DEVNAME_DEVFSADM_RUN            /* devfsadm ran once */
 330 } devname_devfsadm_state_t;
 331 
 332 extern volatile uint_t  devfsadm_state; /* atomic mask for devfsadm status */
 333 
 334 #define DEVNAME_DEVFSADM_SET_RUNNING(devfsadm_state)    \
 335         devfsadm_state = DEVNAME_DEVFSADM_RUNNING
 336 #define DEVNAME_DEVFSADM_SET_STOP(devfsadm_state)       \
 337         devfsadm_state = DEVNAME_DEVFSADM_STOPPED
 338 #define DEVNAME_DEVFSADM_SET_RUN(devfsadm_state)        \
 339         devfsadm_state = DEVNAME_DEVFSADM_RUN
 340 #define DEVNAME_DEVFSADM_IS_RUNNING(devfsadm_state)     \
 341         devfsadm_state == DEVNAME_DEVFSADM_RUNNING
 342 #define DEVNAME_DEVFSADM_HAS_RUN(devfsadm_state)        \
 343         (devfsadm_state == DEVNAME_DEVFSADM_RUN)
 344 
 345 #define SDEV_BLOCK_OTHERS(dv, cmd)      {       \
 346         ASSERT(MUTEX_HELD(&dv->sdev_lookup_lock));       \
 347         dv->sdev_lookup_flags |= cmd;                        \
 348 }
 349 extern void sdev_unblock_others(struct sdev_node *, uint_t);
 350 #define SDEV_UNBLOCK_OTHERS(dv, cmd)    {       \
 351         sdev_unblock_others(dv, cmd);           \
 352 }
 353 
 354 #define SDEV_CLEAR_LOOKUP_FLAGS(dv, cmd)        {       \
 355         dv->sdev_lookup_flags &= ~cmd;   \
 356 }
 357 
 358 extern int sdev_wait4lookup(struct sdev_node *, int);
 359 extern int devname_filename_register(char *);
 360 extern int devname_nsmaps_register(char *, size_t);
 361 extern void sdev_devfsadm_lockinit(void);




 315  * sdev_fid overlays the fid structure (for VFS_VGET)
 316  */
 317 struct sdev_fid {
 318         uint16_t        sdevfid_len;
 319         ino32_t         sdevfid_ino;
 320         int32_t         sdevfid_gen;
 321 };
 322 
 323 /*
 324  * devfsadm and devname communication defines
 325  */
 326 typedef enum {
 327         DEVNAME_DEVFSADM_STOPPED = 0,   /* devfsadm has never run */
 328         DEVNAME_DEVFSADM_RUNNING,       /* devfsadm is running */
 329         DEVNAME_DEVFSADM_RUN            /* devfsadm ran once */
 330 } devname_devfsadm_state_t;
 331 
 332 extern volatile uint_t  devfsadm_state; /* atomic mask for devfsadm status */
 333 
 334 #define DEVNAME_DEVFSADM_SET_RUNNING(devfsadm_state)    \
 335         (devfsadm_state = DEVNAME_DEVFSADM_RUNNING)
 336 #define DEVNAME_DEVFSADM_SET_STOP(devfsadm_state)       \
 337         (devfsadm_state = DEVNAME_DEVFSADM_STOPPED)
 338 #define DEVNAME_DEVFSADM_SET_RUN(devfsadm_state)        \
 339         (devfsadm_state = DEVNAME_DEVFSADM_RUN)
 340 #define DEVNAME_DEVFSADM_IS_RUNNING(devfsadm_state)     \
 341         (devfsadm_state == DEVNAME_DEVFSADM_RUNNING)
 342 #define DEVNAME_DEVFSADM_HAS_RUN(devfsadm_state)        \
 343         (devfsadm_state == DEVNAME_DEVFSADM_RUN)
 344 
 345 #define SDEV_BLOCK_OTHERS(dv, cmd)      {       \
 346         ASSERT(MUTEX_HELD(&dv->sdev_lookup_lock));       \
 347         dv->sdev_lookup_flags |= cmd;                        \
 348 }
 349 extern void sdev_unblock_others(struct sdev_node *, uint_t);
 350 #define SDEV_UNBLOCK_OTHERS(dv, cmd)    {       \
 351         sdev_unblock_others(dv, cmd);           \
 352 }
 353 
 354 #define SDEV_CLEAR_LOOKUP_FLAGS(dv, cmd)        {       \
 355         dv->sdev_lookup_flags &= ~cmd;   \
 356 }
 357 
 358 extern int sdev_wait4lookup(struct sdev_node *, int);
 359 extern int devname_filename_register(char *);
 360 extern int devname_nsmaps_register(char *, size_t);
 361 extern void sdev_devfsadm_lockinit(void);