disk.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #pragma src "/sys/src/libdisk"
  2. #pragma lib "libdisk.a"
  3. /* SCSI interface */
  4. typedef struct Scsi Scsi;
  5. struct Scsi {
  6. QLock;
  7. char* inquire;
  8. int rawfd;
  9. int nchange;
  10. ulong changetime;
  11. };
  12. enum {
  13. Sread = 0,
  14. Swrite,
  15. Snone,
  16. };
  17. char* scsierror(int, int);
  18. int scsicmd(Scsi*, uchar*, int, void*, int, int);
  19. int scsi(Scsi*, uchar*, int, void*, int, int);
  20. Scsi* openscsi(char*);
  21. int scsiready(Scsi*);
  22. extern int scsiverbose;
  23. /* disk partition interface */
  24. typedef struct Disk Disk;
  25. struct Disk {
  26. char *prefix;
  27. char *part;
  28. int fd;
  29. int wfd;
  30. int ctlfd;
  31. int rdonly;
  32. int type;
  33. vlong secs;
  34. vlong secsize;
  35. vlong size;
  36. vlong offset; /* within larger disk, perhaps */
  37. int width; /* of disk size in bytes as decimal string */
  38. int c;
  39. int h;
  40. int s;
  41. int chssrc;
  42. };
  43. Disk* opendisk(char*, int, int);
  44. enum {
  45. Tfile = 0,
  46. Tsd,
  47. Tfloppy,
  48. Gpart = 0, /* partition info source */
  49. Gdisk,
  50. Gguess,
  51. };
  52. /* proto file parsing */
  53. typedef void Protoenum(char *new, char *old, Dir *d, void *a);
  54. typedef void Protowarn(char *msg, void *a);
  55. int rdproto(char*, char*, Protoenum*, Protowarn*, void*);