|
|
1.1 ! root 1: #ifndef _CHDEV_ ! 2: #define _CHDEV_ ! 3: ! 4: /* ! 5: * This file defines how the UNIX minor device number is used by the UNIX ! 6: * Chaos N.C.P. ! 7: * ! 8: * The minor device is divided into 2 fields: host and (contact) name ! 9: * The low order CHNBITS specifies how to get the contact name, ! 10: * the next higher order CHHBITS specifies how to get the host address. ! 11: * ! 12: * Host field definitions: ! 13: */ ! 14: #define CHHBITS 4 /* Number of bits of host specifier */ ! 15: #define CHHMAX ((1 << CHHBITS) - 1) ! 16: /* Maximum value of host field */ ! 17: #define CHHMASK CHHMAX /* Mask after shift for host */ ! 18: #define CHHSHIFT (8-CHHBITS-1) /* Right shift of minor for host */ ! 19: #define CHHOST(dev) ((minor(dev) >> CHHSHIFT) & CHHMASK) ! 20: /* Extraction macro */ ! 21: #define CHHSPEC CHHMAX /* Value for special devices */ ! 22: #define CHHREAD CHHMAX-1 /* Host number is in rest of path */ ! 23: #define CHHUSE CHHMAX-2 /* Host number is in last component */ ! 24: #define CHHMAXN CHHMAX-2 /* Max number of auto hosts numbers */ ! 25: ! 26: /* ! 27: * Name field values for special devices: ! 28: */ ! 29: #define CHUNMATCHED 0 /* Minor device for unmatched RFC reader */ ! 30: #define CHLISTEN 1 /* Listen */ ! 31: ! 32: /* ! 33: * Contact name field definitions: ! 34: */ ! 35: #define CHNBITS (8 - CHHBITS - 1) ! 36: #define CHNMAX ((1 << CHNBITS) - 1) /* Max value of field */ ! 37: #define CHNMASK CHNMAX /* Mask for extraction */ ! 38: #define CHNAME(dev) (minor(dev) & CHNMASK) /* Extraction macro */ ! 39: #define CHNREAD CHNMAX /* Contact name is rest of path */ ! 40: #define CHNUSE CHNMAX-1 /* Contact name is last component */ ! 41: #define CHNMAXN CHNMAX-1 /* Max number of auto contact names */ ! 42: ! 43: #define CHMKMIN(h,n) ((h << CHHSHIFT) | n) ! 44: #define CHURFCMIN CHMKMIN(CHHSPEC, CHUNMATCHED) ! 45: #define CHLISTMIN CHMKMIN(CHHSPEC, CHLISTEN) ! 46: #define CHRFCAMIN CHMKMIN(CHHREAD, CHNREAD) ! 47: #define CHRFCMIN (CHHANGMIN | (CHRFCAMIN)) ! 48: #define CHHANGMIN 0200 ! 49: #define CHHANGDEV(dev) (minor(dev)&0200) ! 50: ! 51: #define NONAME ((char *)0) ! 52: ! 53: extern char *chnames[][3]; ! 54: extern short chhosts[]; /* Array of "well known hosts" */ ! 55: ! 56: /* ! 57: * For the channel driver, and some user programs, we need to know a ! 58: * purposely invalid minor device number ! 59: */ ! 60: #define CHBADCHAN 255 ! 61: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.