aboutsummaryrefslogtreecommitdiffstats
path: root/fs/partitions/osf.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /fs/partitions/osf.c
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'fs/partitions/osf.c')
-rw-r--r--fs/partitions/osf.c78
1 files changed, 78 insertions, 0 deletions
diff --git a/fs/partitions/osf.c b/fs/partitions/osf.c
new file mode 100644
index 000000000000..c05c17bc5df3
--- /dev/null
+++ b/fs/partitions/osf.c
@@ -0,0 +1,78 @@
1/*
2 * fs/partitions/osf.c
3 *
4 * Code extracted from drivers/block/genhd.c
5 *
6 * Copyright (C) 1991-1998 Linus Torvalds
7 * Re-organised Feb 1998 Russell King
8 */
9
10#include "check.h"
11#include "osf.h"
12
13int osf_partition(struct parsed_partitions *state, struct block_device *bdev)
14{
15 int i;
16 int slot = 1;
17 Sector sect;
18 unsigned char *data;
19 struct disklabel {
20 __le32 d_magic;
21 __le16 d_type,d_subtype;
22 u8 d_typename[16];
23 u8 d_packname[16];
24 __le32 d_secsize;
25 __le32 d_nsectors;
26 __le32 d_ntracks;
27 __le32 d_ncylinders;
28 __le32 d_secpercyl;
29 __le32 d_secprtunit;
30 __le16 d_sparespertrack;
31 __le16 d_sparespercyl;
32 __le32 d_acylinders;
33 __le16 d_rpm, d_interleave, d_trackskew, d_cylskew;
34 __le32 d_headswitch, d_trkseek, d_flags;
35 __le32 d_drivedata[5];
36 __le32 d_spare[5];
37 __le32 d_magic2;
38 __le16 d_checksum;
39 __le16 d_npartitions;
40 __le32 d_bbsize, d_sbsize;
41 struct d_partition {
42 __le32 p_size;
43 __le32 p_offset;
44 __le32 p_fsize;
45 u8 p_fstype;
46 u8 p_frag;
47 __le16 p_cpg;
48 } d_partitions[8];
49 } * label;
50 struct d_partition * partition;
51
52 data = read_dev_sector(bdev, 0, &sect);
53 if (!data)
54 return -1;
55
56 label = (struct disklabel *) (data+64);
57 partition = label->d_partitions;
58 if (le32_to_cpu(label->d_magic) != DISKLABELMAGIC) {
59 put_dev_sector(sect);
60 return 0;
61 }
62 if (le32_to_cpu(label->d_magic2) != DISKLABELMAGIC) {
63 put_dev_sector(sect);
64 return 0;
65 }
66 for (i = 0 ; i < le16_to_cpu(label->d_npartitions); i++, partition++) {
67 if (slot == state->limit)
68 break;
69 if (le32_to_cpu(partition->p_size))
70 put_partition(state, slot,
71 le32_to_cpu(partition->p_offset),
72 le32_to_cpu(partition->p_size));
73 slot++;
74 }
75 printk("\n");
76 put_dev_sector(sect);
77 return 1;
78}