ultrix.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. int ultrix_partition(struct parsed_partitions *state, struct block_device *bdev)
  10. {
  11. int i;
  12. Sector sect;
  13. unsigned char *data;
  14. struct ultrix_disklabel {
  15. s32 pt_magic; /* magic no. indicating part. info exits */
  16. s32 pt_valid; /* set by driver if pt is current */
  17. struct pt_info {
  18. s32 pi_nblocks; /* no. of sectors */
  19. u32 pi_blkoff; /* block offset for start */
  20. } pt_part[8];
  21. } *label;
  22. #define PT_MAGIC 0x032957 /* Partition magic number */
  23. #define PT_VALID 1 /* Indicates if struct is valid */
  24. data = read_dev_sector(bdev, (16384 - sizeof(*label))/512, &sect);
  25. if (!data)
  26. return -1;
  27. label = (struct ultrix_disklabel *)(data + 512 - sizeof(*label));
  28. if (label->pt_magic == PT_MAGIC && label->pt_valid == PT_VALID) {
  29. for (i=0; i<8; i++)
  30. if (label->pt_part[i].pi_nblocks)
  31. put_partition(state, i+1,
  32. label->pt_part[i].pi_blkoff,
  33. label->pt_part[i].pi_nblocks);
  34. put_dev_sector(sect);
  35. printk ("\n");
  36. return 1;
  37. } else {
  38. put_dev_sector(sect);
  39. return 0;
  40. }
  41. }