tcpConnectionMonitoring.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. /*
  2. * linux/fs/partitions/acorn.c
  3. *
  4. * Copyright (c) 1996-2000 Russell King.
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. *
  10. * Scan ADFS partitions on hard disk drives. Unfortunately, there
  11. * isn't a standard for partitioning drives on Acorn machines, so
  12. * every single manufacturer of SCSI and IDE cards created their own
  13. * method.
  14. */
  15. #include <linux/buffer_head.h>
  16. #include <linux/adfs_fs.h>
  17. #include "check.h"
  18. #include "acorn.h"
  19. /*
  20. * Partition types. (Oh for reusability)
  21. */
  22. #define PARTITION_RISCIX_MFM 1
  23. #define PARTITION_RISCIX_SCSI 2
  24. #define PARTITION_LINUX 9
  25. #if defined(CONFIG_ACORN_PARTITION_CUMANA) || \
  26. defined(CONFIG_ACORN_PARTITION_ADFS)
  27. static struct adfs_discrecord *
  28. adfs_partition(struct parsed_partitions *state, char *name, char *data,
  29. unsigned long first_sector, int slot)
  30. {
  31. struct adfs_discrecord *dr;
  32. unsigned int nr_sects;
  33. if (adfs_checkbblk(data))
  34. return NULL;
  35. dr = (struct adfs_discrecord *)(data + 0x1c0);
  36. if (dr->disc_size == 0 && dr->disc_size_high == 0)
  37. return NULL;
  38. nr_sects = (le32_to_cpu(dr->disc_size_high) << 23) |
  39. (le32_to_cpu(dr->disc_size) >> 9);
  40. if (name) {
  41. strlcat(state->pp_buf, " [", PAGE_SIZE);
  42. strlcat(state->pp_buf, name, PAGE_SIZE);
  43. strlcat(state->pp_buf, "]", PAGE_SIZE);
  44. }
  45. put_partition(state, slot, first_sector, nr_sects);
  46. return dr;
  47. }
  48. #endif
  49. #ifdef CONFIG_ACORN_PARTITION_RISCIX
  50. struct riscix_part {
  51. __le32 start;
  52. __le32 length;
  53. __le32 one;
  54. char name[16];
  55. };
  56. struct riscix_record {
  57. __le32 magic;
  58. #define RISCIX_MAGIC cpu_to_le32(0x4a657320)
  59. __le32 date;
  60. struct riscix_part part[8];
  61. };
  62. #if defined(CONFIG_ACORN_PARTITION_CUMANA) || \
  63. defined(CONFIG_ACORN_PARTITION_ADFS)
  64. static int riscix_partition(struct parsed_partitions *state,
  65. unsigned long first_sect, int slot,
  66. unsigned long nr_sects)
  67. {
  68. Sector sect;
  69. struct riscix_record *rr;
  70. rr = read_part_sector(state, first_sect, &sect);
  71. if (!rr)
  72. return -1;
  73. strlcat(state->pp_buf, " [RISCiX]", PAGE_SIZE);
  74. if (rr->magic == RISCIX_MAGIC) {
  75. unsigned long size = nr_sects > 2 ? 2 : nr_sects;
  76. int part;
  77. strlcat(state->pp_buf, " <", PAGE_SIZE);
  78. put_partition(state, slot++, first_sect, size);
  79. for (part = 0; part < 8; part++) {
  80. if (rr->part[part].one &&
  81. memcmp(rr->part[part].name, "All\0", 4)) {
  82. put_partition(state, slot++,
  83. le32_to_cpu(rr->part[part].start),
  84. le32_to_cpu(rr->part[part].length));
  85. strlcat(state->pp_buf, "(", PAGE_SIZE);
  86. strlcat(state->pp_buf, rr->part[part].name, PAGE_SIZE);
  87. strlcat(state->pp_buf, ")", PAGE_SIZE);
  88. }
  89. }
  90. strlcat(state->pp_buf, " >\n", PAGE_SIZE);
  91. } else {
  92. put_partition(state, slot++, first_sect, nr_sects);
  93. }
  94. put_dev_sector(sect);
  95. return slot;
  96. }
  97. #endif
  98. #endif
  99. #define LINUX_NATIVE_MAGIC 0xdeafa1de
  100. #define LINUX_SWAP_MAGIC 0xdeafab1e