ultrix.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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, struct block_device *bdev)
  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_dev_sector(bdev, (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. printk ("\n");
  37. return 1;
  38. } else {
  39. put_dev_sector(sect);
  40. return 0;
  41. }
  42. }