ultrix.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * fs/partitions/ultrix.c
  3. *
  4. * Code extracted from drivers/block/genhd.c
  5. *
  6. * Re-organised Jul 1999 Russell King
  7. */
  8. #include "check.h"
  9. #include "ultrix.h"
  10. int ultrix_partition(struct parsed_partitions *state)
  11. {
  12. int i;
  13. Sector sect;
  14. unsigned char *data;
  15. struct ultrix_disklabel {
  16. s32 pt_magic; /* magic no. indicating part. info exits */
  17. s32 pt_valid; /* set by driver if pt is current */
  18. struct pt_info {
  19. s32 pi_nblocks; /* no. of sectors */
  20. u32 pi_blkoff; /* block offset for start */
  21. } pt_part[8];
  22. } *label;
  23. #define PT_MAGIC 0x032957 /* Partition magic number */
  24. #define PT_VALID 1 /* Indicates if struct is valid */
  25. data = read_part_sector(state, (16384 - sizeof(*label))/512, &sect);
  26. if (!data)
  27. return -1;
  28. label = (struct ultrix_disklabel *)(data + 512 - sizeof(*label));
  29. if (label->pt_magic == PT_MAGIC && label->pt_valid == PT_VALID) {
  30. for (i=0; i<8; i++)
  31. if (label->pt_part[i].pi_nblocks)
  32. put_partition(state, i+1,
  33. label->pt_part[i].pi_blkoff,
  34. label->pt_part[i].pi_nblocks);
  35. put_dev_sector(sect);
  36. strlcat(state->pp_buf, "\n", PAGE_SIZE);
  37. return 1;
  38. } else {
  39. put_dev_sector(sect);
  40. return 0;
  41. }
  42. }