Commit Graph

230 Commits

Author SHA1 Message Date
nyan
864080610e Rename the dos_partition structure for pc98 to pc98_partition. 2003-01-04 08:50:48 +00:00
schweikh
d3367c5f5d Correct typos, mostly s/ a / an / where appropriate. Some whitespace cleanup,
especially in troff files.
2003-01-01 18:49:04 +00:00
nyan
63904a7353 Return an error if the size of the sector is zero. This is for removable
devices that is not inserted any media.

This is MFC candidate.

Submitted by:	ISAKA Yoji <isaka@cory.jp>
2002-12-26 15:50:45 +00:00
ru
ea13b9803b Consistently mark std(in|out|err) with .Dv, because that's how they
are marked up in stdio(3), and because they are defined expressions
of type "FILE *".

Approved by:	re
2002-12-04 18:57:46 +00:00
jhb
cfb76a5993 Break up a bunch of crazy if statements to use a case statement instead
to be cleaner.  Also, when deleting a chunk, try to find the mother chunk
as a whole chunk by default if this isn't a BSD partition or a unused or
whole chunk.  Before we just did this for FreeBSD and FAT slices, which
means that other chunk types such as EFI and mbr (mbr is used for slices
that don't have their own chunk type).

Submitted by:	nyan (mostly)
Approved by:	re
2002-12-02 21:42:29 +00:00
nyan
948193c5df - Ease sanity check to get cylinders.
- Get the slice name from the result of kern.geom.conftxt.
2002-11-17 13:51:22 +00:00
nyan
6677381325 Fixed style(9) 2002-11-15 13:24:29 +00:00
marcel
51b18a9ea3 Handle EFI partitions the same as regular FAT partitions. The only
difference between the two from a low-level point of view is that
the partition type is different. This change adds EFI related cases
to existing switch statements with existing FAT related cases.
2002-11-13 05:31:32 +00:00
davidc
95ac1af78c - Document the chunk_name() function that replaces chunk_n[].
- Rearrange things a tiny bit.
2002-11-11 19:37:19 +00:00
davidc
a9e193bc9a Remove parameter names from function prototypes (at least one collided
with stdlib.h).

discussed with: phk
2002-11-11 18:55:57 +00:00
phk
33be7592cc Remove debugging printfs. 2002-11-11 10:08:46 +00:00
marcel
8c44e1c3f9 MBR slices are named the same on ia64 as they are on i386. 2002-11-11 04:46:39 +00:00
jake
8ea3f3d908 Write the boot block to the first 16 sectors of all partitions, instead of
always to the first 16 sectors of the disk.  The firmware reads the boot
code from a partition, defaulting to 'a' if none is specified, which only
corresponds to the first 16 sectors of the disk if 'a' is first.  Solaris
often makes the swap partition first, instead of the root partition, and
users expect to be able to do the same with freebsd as well.  This also
allows one to temporarily boot from another partition if the boot block
on the root partition gets scrambled somehow.
2002-11-10 21:07:29 +00:00
marcel
c0696a1676 Add efi to the list of types for which we need to return tha name.
Also, return chunk type efi in case we find an EFI partition in
the GPT. We used to return FAT due to a lack of EFI type.
2002-11-10 20:53:10 +00:00
marcel
b5cdcf6ad1 Add an efi chunk type. We need to be able to create an EFI partition
on ia64, because that's where we need to put the loader and the
kernel.
2002-11-10 20:49:28 +00:00
marcel
474626e5e1 General cleanup:
o  Remove all code guarded by !defined(__ia64__). This file is
   specifically written for ia64,
o  Handle the case when read_block() or write_block() fails. We
   don't want sysinstall(8) to signal a thumbs-up on error,
o  Set the starting (cyl,hd,sect) triple to 0xFFFFFF when either
   bios_hd or bios_sect is zero or the LBA us not representable
   with the triple. In that case automaticly initialize the
   ending triple with 0xFFFFFF as well,
o  Reindent Write_Int32() as it was different than the rest of
   the file,
o  Remove some unused variables that appeared to be used but
   were effectively useless.
o  Plug a memory leak: The second timne we read the MBR, we write
   out a modified block, but didn't free the memory after writing.
o  Replace d1->sector_size with 512 when we read/write the MBR.
   We ignore the sector size in cases we shouldn't but adhered to
   it in cases it would be wrong if the sector_size wasn't 512.

This file should eventually be rewritten to write out a GPT. For
now, a MBR will do...
2002-11-10 20:47:02 +00:00
nyan
fd118b4af5 - Recognize FAT partition on MBR and PC98 disks.
- Fix to convert to the name of partition.
2002-11-08 15:25:15 +00:00
nyan
aecfe31a1d MFi386: revision 1.4. 2002-11-08 14:49:14 +00:00
jhb
fa9c6cb843 Don't set a variable to a bogus value right before setting it to the
correct value in the next statement.
2002-11-08 14:00:44 +00:00
jhb
c849fe6dd8 Don't set a value to a variable that we don't use. 2002-11-08 14:00:09 +00:00
jhb
481edf29a7 - Merge Write_FreeBSD() into Write_Disk().
- Miscellaneous cleanups.
2002-11-08 13:58:00 +00:00
nyan
2a35147541 Fixed pc98 support.
(merged i386 changes from chunk.c 1.41 and disk.c 1.100)
2002-11-07 14:54:53 +00:00
jhb
2b9783b539 Get this closer to working. The Write_Disk() function's for loop needed
to use the same start condition as the i386 version.  However, since
Alpha's only have one fake "slice" from sysinstall's perspective we don't
need to use a loop, but can just write out the BSD label in the first
fake "slice".
2002-11-07 14:39:21 +00:00
jhb
c558e52c47 Remove unused MBR gunk leftover from i386. 2002-11-03 21:18:17 +00:00
nyan
7479c2d936 Fix to compile for pc98. 2002-11-03 09:35:08 +00:00
marcel
c9f86b731d Initialize d->bios_cyl. We know the media size in sectors, the number
of heads end the number of sectors per track. If there's an obvious
insanity (heads and sectors are both zero or the media size is not
an integral multiple of heads times sector) we set the number of
cylinders to zero.
2002-11-03 01:37:08 +00:00
marcel
27850e5112 Add support for GPT:
1. When the parition type is not an integer, try to parse the type
   as an UUID. If that succeeds, map the UUID to chunk_e.
2. For GPT partitions, pass the type constructed in point 1 above
   to Add_Chunk.

While here, fix the MBREXT case by only checking if the first 3
characters are MBR. This avoids duplication.
2002-11-02 12:14:04 +00:00
marcel
24ab0000c9 Add support for ia64. This is almost identical to i386, except that
with GPT chunks of type "part" do not necessarily live under chunks
of type "freebsd". We don't necessarily have a disklabel.
2002-11-02 12:05:16 +00:00
phk
01e8832a61 Don't claim all MBR's have subtype 165 on i386.
Spotted by:	Frode Nordahl <frode@nordahl.net>
2002-11-02 10:57:44 +00:00
phk
e7002ff1e5 Fill in partition 2 with with "whole disk" parameters. 2002-11-01 16:28:19 +00:00
phk
5dbff154c8 Style(9) improvements. 2002-10-31 07:56:40 +00:00
phk
a1b493e265 Set the sector size for the disk. 2002-10-31 07:55:38 +00:00
nyan
674ee79610 Restore to pc98 support. 2002-10-31 05:51:25 +00:00
nyan
0315c477ee Use ${MACHINE} variable instead of using '.if .endif' each machines. 2002-10-31 05:43:49 +00:00
nyan
2616a319ce Add '#include <err.h>' for warn(). 2002-10-31 05:38:48 +00:00
jake
3523a0f8a2 Actually save the bootblock in the disk structure. Write the bootblock
to the right place on the disk instead of srewn all over it.
2002-10-31 04:25:17 +00:00
phk
c925cf4a99 Untested alpha disk writer. 2002-10-30 20:54:22 +00:00
phk
01d1bdfdb0 Write out 15 sectors of boot code. 2002-10-30 20:52:07 +00:00
phk
d52f4602e2 Getting closer to getting things right:
Always ignore the RAW_PART for BSD.
Having no quirks is not a mistake for an architecture.

Tested by:	DES
2002-10-29 17:12:02 +00:00
phk
885738b312 Don't call warn(3). 2002-10-29 14:45:43 +00:00
phk
9ac588fcdc Since make release is toast anyway, add wood to the pyre:
This significantly rewamps libdisks discovery of existing disk
layout.

Please send me reports if this does not work as expected on
i386 or sparc64 platforms.

I need to sort out alpha, pc98 and ia64 (in that order) before
testing on those platforms make a lot of sense.

Belived to work for:	i386 sparc64
Unknown state:		pc98 alpha ia64
2002-10-29 12:13:36 +00:00
phk
6e81beacf8 Fix various minor issues.
Don't explode on 'write' because we access a pointer we just freed.
2002-10-29 07:39:18 +00:00
phk
4d780c389d the 'd' partition hasn't been magic for years, so allocate it in natural
order instead of last.
2002-10-29 07:37:11 +00:00
phk
aee7fb11fe Add the write_spar64_disk.c to make life easier for testers.
This file depends on some major surgery in the rest of libdisk which is
not yet committed.
2002-10-29 07:35:36 +00:00
peter
29db798cec Add back ia64 support that was removed in the last few revisions.
I've cloned write_ia64_disk.c from write_i386_disk.c.
2002-10-27 00:21:02 +00:00
gallatin
e5963e51d5 #ifdef out assignToPartition on non x86 arches to unbreak the world
on alpha, sparc64 and ia64
2002-10-24 13:35:52 +00:00
phk
f9fe53ba89 More lobotomy:
remove CHUNK_BSD_COMPAT, it was a bad idea, and now its gone.
        remove DOSPTYP_ONTRACK, missed in OnTrack removal commit.
        unifdef -DHAVE_GEOM
make tst01 compile again.
2002-10-23 21:05:42 +00:00
phk
8e1649e9df Remove another 10 mindless #ifdefs. 2002-10-23 20:35:42 +00:00
phk
7be332e622 Rely on sysctl kern.disks to be there, and get rid of one of the far too
many lists of disk device driver names in the system.  At this point
we should really get the names from the XML, but hey...
2002-10-23 20:15:10 +00:00
phk
c17cb9154e Remove unnecessary ioctls tickling kernel side to realize that we fiddled
with the disk.  GEOM will automatically retaste when we closet he filedesc.
2002-10-23 20:02:33 +00:00