HP-UX Reference (11i v3 07/02) - 7 Device (Special) Files, 9 General Information, Index (vol 10)

m
mt(7) mt(7)
}
dev = stbuf.st_rdev;
io_init(O_RDWR);
if(M_BERKELEY_AGILE(dev))
printf(" This is a Berkeley style device file ");
else
printf(" This is not a Berkeley style device file ");
io_end();
exit(0);
}
Compile Line: cc -Ae -o test test.c -lIO
Sample Output:
# ./test /dev/rtape/tape1_BESTn
This is not a Berkeley style device file
# ./test /dev/rtape/tape1_BESTb
This is a Berkeley style device file
# ./test /dev/rmt/0mnb
This is a Berkeley style device file
# ./test /dev/rmt/c5t4d0BEST
This is not a Berkeley style device file
# ./test /dev/rmt/c5t4d0BESTnb
This is a Berkeley style device file
Macros similar to the one above, can be written in place of their respective legacy macros as follows:
#define M_INSTANCE_AGILE(dev) \
((io_is_legacy_dev(dev, D_CHR) == MT_IS_LEGACY_DEV) ? \
(((dev) >> MT_INSTANCE_BIT_POS) & MT_INSTANCE_MASK) : \
(((mt_get_newdev_options(dev, D_CHR)) >> MT_INSTANCE_BIT_POS) \
& MT_INSTANCE_MASK))
#define M_TARGET_AGILE(dev) \
((io_is_legacy_dev(dev, D_CHR) == MT_IS_LEGACY_DEV) ? \
(((dev) >> MT_TARGET_BIT_POS) & MT_TARGET_MASK) : \
((mt_get_newdev_options(dev, D_CHR)) >> MT_TARGET_BIT_POS) \
& MT_TARGET_MASK))
#define M_LUN_AGILE(dev) \
((io_is_legacy_dev(dev, D_CHR) == MT_IS_LEGACY_DEV) ? \
(((dev) >> MT_LUN_BIT_POS) & MT_LUN_MASK) : \
((mt_get_newdev_options(dev, D_CHR) >> MT_LUN_BIT_POS) \
& MT_LUN_MASK))
#define M_USER_CONFIG_AGILE(dev) \
((io_is_legacy_dev(dev, D_CHR) == MT_IS_LEGACY_DEV) ? \
(dev & MT_USER_CONFIG_MASK) : \
(mt_check_newdev_options(dev, D_CHR, MT_USER_CONFIG_MASK)))
#define M_INDEX_AGILE(dev) \
((io_is_legacy_dev(dev, D_CHR) == MT_IS_LEGACY_DEV) ? \
(((dev) & MT_INDEX_MASK) >> MT_INDEX_BIT_POS) : \
((mt_check_newdev_options(dev, D_CHR, MT_INDEX_MASK)) >> \
MT_INDEX_BIT_POS));
#define M_INDEX_PUT_AGILE(dev,index) \
((io_is_legacy_dev(dev, D_CHR) == MT_IS_LEGACY_DEV) ? \
HP-UX 11i Version 3: February 2007 5 Hewlett-Packard Company 93