Subversion Repository

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2246 - (show annotations)
Tue Feb 15 00:28:15 2011 UTC (2 years, 3 months ago) by acrux
File size: 5663 byte(s)
mac-fdisk: moved to 0.13-2 with patches from Gentoo
1 diff -Naur mac-fdisk-0.1.bak/fdisklabel.c mac-fdisk-0.1/fdisklabel.c
2 --- mac-fdisk-0.1.bak/fdisklabel.c 2007-03-16 10:56:26.000000000 -0400
3 +++ mac-fdisk-0.1/fdisklabel.c 2007-03-16 10:56:13.000000000 -0400
4 @@ -72,7 +72,7 @@
5 static int bsd_readlabel (struct partition *p, struct disklabel *d);
6 static int bsd_writelabel (struct partition *p, struct disklabel *d);
7 static void sync_disks (void);
8 -#if defined (i386)
9 +#if defined (i386) || defined (__amd64)
10 static int bsd_translate_fstype (int linux_type);
11 static void bsd_link_part (void);
12 #endif
13 @@ -82,7 +82,7 @@
14
15 static struct disklabel bsd_dlabel;
16 static char buffer[BSD_BBSIZE];
17 -#if defined (i386)
18 +#if defined (i386) || defined (__amd64)
19 static struct partition *bsd_part;
20 static int bsd_part_index;
21 #endif
22 @@ -99,13 +99,13 @@
23 " n add a new BSD partition\n"
24 " p print BSD partition table\n"
25 " q quit without saving changes\n"
26 -#if defined (i386)
27 +#if defined (i386) || defined (__amd64)
28 " r return to main menu\n"
29 #endif
30 " s show complete disklabel\n"
31 " t change a partition's filesystem id\n"
32 " w write disklabel to disk\n"
33 -#if defined (i386)
34 +#if defined (i386) || defined (__amd64)
35 " x link BSD partition to non-BSD partition"
36 #endif
37 );
38 @@ -114,7 +114,7 @@
39 void
40 bselect (void)
41 {
42 -#if defined (i386)
43 +#if defined (i386) || defined (__amd64)
44 int t;
45
46 for (t=0; t<4; t++)
47 @@ -185,7 +185,7 @@
48 case 'w':
49 bsd_write_disklabel ();
50 break;
51 -#if defined (i386)
52 +#if defined (i386) || defined (__amd64)
53 case 'r':
54 return;
55 case 'x':
56 @@ -223,7 +223,7 @@
57 if (!bsd_check_new_partition (&i))
58 return;
59
60 -#if defined (i386)
61 +#if defined (i386) || defined (__amd64)
62 begin = bsd_part -> start_sect;
63 end = begin + bsd_part -> nr_sects - 1;
64 #elif defined (__alpha__) || defined (__powerpc__)
65 @@ -257,7 +257,7 @@
66
67 if (show_all)
68 {
69 -#if defined (i386)
70 +#if defined (i386) || defined (__amd64)
71 fprintf(f, "# %s%d:\n", disk_device, bsd_part_index+1);
72 #elif defined (__alpha__) || defined (__powerpc__)
73 fprintf(f, "# %s:\n", disk_device);
74 @@ -352,7 +352,7 @@
75 static void
76 bsd_write_disklabel (void)
77 {
78 -#if defined (i386)
79 +#if defined (i386) || defined (__amd64)
80 printf ("Writing disklabel to %s%d.\n", disk_device, bsd_part_index+1);
81 bsd_writelabel (bsd_part, &bsd_dlabel);
82 #elif defined (__alpha__) || defined (__powerpc__)
83 @@ -366,7 +366,7 @@
84 {
85 char c;
86
87 -#if defined (i386)
88 +#if defined (i386) || defined(__amd64)
89 fprintf (stderr, "%s%d contains no disklabel.\n",
90 disk_device, bsd_part_index+1);
91 #elif defined (__alpha__) || defined (__powerpc__)
92 @@ -376,7 +376,7 @@
93 while (1)
94 if ((c = tolower (read_char ("Do you want to create a disklabel? (y/n) "))) == 'y')
95 {
96 -#if defined (i386)
97 +#if defined (i386) || defined(__amd64)
98 if (bsd_initlabel (bsd_part, &bsd_dlabel, bsd_part_index) == 1)
99 #elif defined (__alpha__) || defined (__powerpc__) || defined (__mc68000__)
100 if (bsd_initlabel (NULL, &bsd_dlabel, 0) == 1)
101 @@ -507,7 +507,7 @@
102
103 bcopy (&dl, d, sizeof (struct disklabel));
104
105 -#if defined (i386)
106 +#if defined (i386) || defined (__amd64)
107 sector = bsd_part -> start_sect;
108 #elif defined (__powerpc__)
109 sector = 0;
110 @@ -521,7 +521,7 @@
111 if (BSD_BBSIZE != write (fd, buffer, BSD_BBSIZE))
112 fatal (unable_to_write);
113
114 -#if defined (i386)
115 +#if defined (i386) || defined (__amd64)
116 printf ("Bootstrap installed on %s%d.\n", disk_device, bsd_part_index+1);
117 #elif defined (__alpha__) || defined (__powerpc__)
118 printf ("Bootstrap installed on %s.\n", disk_device);
119 @@ -625,7 +625,7 @@
120 d -> d_subtype = BSD_DSTYPE_INDOSPART & pindex;
121 #endif
122
123 -#if defined (i386)
124 +#if defined (i386) || defined (__amd64)
125 d -> d_flags = BSD_D_DOSPART;
126 #else
127 d -> d_flags = 0;
128 @@ -648,7 +648,7 @@
129 d -> d_bbsize = BSD_BBSIZE;
130 d -> d_sbsize = BSD_SBSIZE;
131
132 -#if defined (i386)
133 +#if defined (i386) || defined (__amd64)
134 d -> d_npartitions = 4;
135 pp = &d -> d_partitions[2]; /* Partition C should be the NetBSD partition */
136 pp -> p_offset = p -> start_sect;
137 @@ -674,7 +674,7 @@
138 {
139 int t, sector;
140
141 -#if defined (i386)
142 +#if defined (i386) || defined (__amd64)
143 sector = p -> start_sect;
144 #elif defined (__alpha__) || defined (__powerpc__)
145 sector = 0;
146 @@ -708,7 +708,7 @@
147 {
148 int sector;
149
150 -#if defined (i386)
151 +#if defined (i386) || defined (__amd64)
152 sector = p -> start_sect + BSD_LABELSECTOR;
153 #elif defined (__alpha__) || defined (__powerpc__)
154 sector = BSD_LABELSECTOR;
155 @@ -749,7 +749,7 @@
156 sleep (4);
157 }
158
159 -#if defined (i386)
160 +#if defined (i386) || defined (__amd64)
161 static int
162 bsd_translate_fstype (int linux_type)
163 {
164 diff -Naur mac-fdisk-0.1.bak/fdisklabel.h mac-fdisk-0.1/fdisklabel.h
165 --- mac-fdisk-0.1.bak/fdisklabel.h 2007-03-16 10:56:26.000000000 -0400
166 +++ mac-fdisk-0.1/fdisklabel.h 2007-03-16 10:56:13.000000000 -0400
167 @@ -35,7 +35,7 @@
168 #define BSD_MAXPARTITIONS 8
169 #define BSD_LINUX_BOOTDIR "/usr/ucb/mdec"
170
171 -#if defined (i386)
172 +#if defined (i386) || defined(__amd64)
173 #define BSD_LABELSECTOR 1
174 #define BSD_LABELOFFSET 0
175 #define BSD_BBSIZE 8192 /* size of boot area, with label */
176 diff -Naur mac-fdisk-0.1.bak/kernel-defs.h mac-fdisk-0.1/kernel-defs.h
177 --- mac-fdisk-0.1.bak/kernel-defs.h 2007-03-16 10:56:26.000000000 -0400
178 +++ mac-fdisk-0.1/kernel-defs.h 2007-03-16 10:56:13.000000000 -0400
179 @@ -15,8 +15,14 @@
180 /* from asm/ioctl.h */
181 #define _IOC_NRBITS 8
182 #define _IOC_TYPEBITS 8
183 +
184 +#ifndef _IOC_SIZEBITS
185 #define _IOC_SIZEBITS 13
186 +#endif
187 +
188 +#ifndef _IOC_DIRBITS
189 #define _IOC_DIRBITS 3
190 +#endif
191
192 #define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
193 #define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)