Commit Graph

127 Commits

Author SHA1 Message Date
Oleksandr Tymoshenko
228d330b1a Add MIPS support to libdisk
Approved by:	cognet (mentor)
2008-05-04 22:24:40 +00:00
Antoine Brodin
b08b3ca18f - Make Disk_Names() behave as documented in libdisk(3): return an array
of disk names, where you must free each pointer, as well as the array
by hand. [1]
- Destaticize "disks" in Disk_Names, it has no reasons to be static.

PR:		kern/96077 [1]
PR:		kern/114110 [1]
MFC after:	1 month
Approved by:	rwatson (mentor)
2008-02-15 21:19:15 +00:00
Maxim Konovalov
66802e2cc7 o Add IDs for Plan9, QNX4.X, Mac OS-X, Linux exteneded partitions.
PR:		bin/96326
Submitted by:	Alex Kozlov
MFC after:	2 weeks
2006-04-25 20:42:15 +00:00
Olivier Houchard
ea7075eb64 Add a dummy arm Write_Disk() function, and compile libdisk on arm. 2006-01-25 11:24:37 +00:00
Yoshihiro Takahashi
365971ecad Merge two slice_type_name() functions. 2005-04-13 13:42:38 +00:00
Pyun YongHyeon
2d25239038 Plug memory leak.
MFC after:	1 week
2004-12-22 08:17:18 +00:00
Poul-Henning Kamp
54c7ea9dbf Add 0xbf (191) as new Solaris partition identifier.
Submitted by:	Lawrence.Lee@sun.com
2004-11-10 07:50:16 +00:00
Stefan Farfeleder
a752604477 Remove spurious semicolons. Outside of functions they are actually errors but
GCC doesn't warn about them without -pedantic.

Approved by:	das (mentor)
PR:		56649
Reviewed by:	md5
2004-05-16 22:08:17 +00:00
Peter Grehan
acc2f44a41 PowerPC support.
submitted by:  Suleiman Souhlal <refugee@segfaulted.com>
approved by:   phk, jhb
2004-04-21 23:21:13 +00:00
Jun Kuriyama
653681fb30 Make libdisk WARNS=4 clean.
Glanced by:	jhb
2004-03-30 01:39:00 +00:00
Marcel Moolenaar
f5ea9b34c6 o Move Int_Open_Disk() from disk.c to open_disk.c for use by all
platforms except ia64 and use Int_Open_Disk() in open_ia64_disk.c
   on ia64. We need to know more than GEOM can provide us so we're
   forced to read from the disk. Move uuid_type() to open_ia64_disk.c
   and remove all references on non-ia64.
o  Pass the GEOM conftxt to Int_Open_Disk() so that only Open_Disk()
   needs to know about GEOM and libdisk can more easily be used with
   media not handled by GEOM.
o  Create an ia64 specific definiton of struct disk on ia64, because
   we don't need/have most of the fields other platforms need and
   other fields not applicable on platforms other than ia64.
o  Do not compile change.c on ia64. It's too PC specific.
o  In Fixup_Names() in create_chunk.c, try all partition numbers
   that are valid for the GPT disk. We have the total number of
   partitions that can be allocated in the disk structure on ia64.
   Also, use the GPT partition naming if we're creating one under
   a chunk of type "whole". It's a GPT partition in that case.
o  In Create_Chunk(), compile-out the PC specific code on ia64 that
   checks BIOS geometry restrictions.
o  In Debug_Disk() in disk.c, dump the ia64 specific fields.
o  Save the partition index in the chunk on ia64 so that we can
   preserve it when we write the data back to disk. This avoids that
   partitions get moved around or swapped after installing FreeBSD,
   which may render a disk unusable.
2003-11-02 08:39:08 +00:00
David E. O'Brien
e6f1abaa68 Ignore ccd(4)'s. This is not the best solution, but it at least removes
the "BARF 360" ccd(4) user's experience.

Submitted by:	rwatson
2003-08-28 17:39:09 +00:00
Scott Long
4e89f2d88f Sanity check the list obtained from the kern.disks sysctl so that Disk_Names()
doesn't get fooled into returning a bogus list.  This should fix sysinstall
from segfaulting when no disk devices are present.
2003-06-07 20:02:56 +00:00
Peter Wemm
2512cd4e8f Teach libdisk that AMD64 works just like i386 2003-04-30 21:03:16 +00:00
David E. O'Brien
9be6d929b1 Only define platform once -- in a C file. 2003-04-30 17:14:58 +00:00
Poul-Henning Kamp
197e5e73ef Libdisk does not need to include <sys/diskslice.h> any more.
Move the remaining bits of <sys/diskslice.h> to <i386/include/bootinfo.h>

Move i386/pc98 specific bits from <sys/reboot.h> to
<i386/include/bootinfo.h> as well.

Adjust includes in sys/boot accordingly.
2003-04-04 16:35:16 +00:00
Poul-Henning Kamp
2082addf66 Ignore GBDE devices.
Spotted by:	Lucky Green <shamrock@cypherpunks.to>
2003-03-17 07:25:50 +00:00
John Baldwin
f3c6522625 Use the fstype obtained from the GEOM dumpconf output to set the fstype
of BSD part chunks when opening a disk.

Reviewed by:	phk
MFC after:	2 days
2003-01-10 19:45:10 +00:00
Yoshihiro Takahashi
7a6b06168b 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
Yoshihiro Takahashi
1cfcbbd71c - 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
Yoshihiro Takahashi
021587f8c1 Fixed style(9) 2002-11-15 13:24:29 +00:00
Marcel Moolenaar
c3e6b1182b 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
Poul-Henning Kamp
efb14d4614 Remove debugging printfs. 2002-11-11 10:08:46 +00:00
Marcel Moolenaar
7593e0d3c5 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
Yoshihiro Takahashi
3b6431b5ed - Recognize FAT partition on MBR and PC98 disks.
- Fix to convert to the name of partition.
2002-11-08 15:25:15 +00:00
John Baldwin
7f55ebcd18 Don't set a value to a variable that we don't use. 2002-11-08 14:00:09 +00:00
Yoshihiro Takahashi
ba91558ce9 Fixed pc98 support.
(merged i386 changes from chunk.c 1.41 and disk.c 1.100)
2002-11-07 14:54:53 +00:00
Marcel Moolenaar
62b693d7db 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 Moolenaar
12d76c6fec 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
Poul-Henning Kamp
a6db5ac980 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
Poul-Henning Kamp
63abca411d Set the sector size for the disk. 2002-10-31 07:55:38 +00:00
Yoshihiro Takahashi
fe1f2a9a84 Restore to pc98 support. 2002-10-31 05:51:25 +00:00
Jake Burkholder
e03494dd17 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
Poul-Henning Kamp
30820b02ab 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
Poul-Henning Kamp
56d3134bfb 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
Peter Wemm
7e50af21ba 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
Andrew Gallatin
b49cf84452 #ifdef out assignToPartition on non x86 arches to unbreak the world
on alpha, sparc64 and ia64
2002-10-24 13:35:52 +00:00
Poul-Henning Kamp
d7e9a2ad8a 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
Poul-Henning Kamp
844c9bb884 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
Poul-Henning Kamp
532dd2fa86 Untangle #ifdefs in the write-end of things by giving each arch its
own file and own copy of WriteDisk() to do things in.

This should have happened years ago, instead of adding #ifdefs all
over the place.
2002-10-23 19:52:32 +00:00
Yoshihiro Takahashi
7bec978084 - The GEOM system does not work on pc98.
- Fix to build w/o the HAVE_GEOM option.
2002-10-23 13:00:09 +00:00
Poul-Henning Kamp
0bb035b962 Add the new extra argument also in the alpha case. 2002-10-23 10:47:00 +00:00
Poul-Henning Kamp
1e08b0a637 Avoid a lot of #ifdef PC98 code by giving a couple of the Chunk functions
an extra argument for all archs.
2002-10-22 10:51:58 +00:00
Poul-Henning Kamp
fa9e908771 Swing the weed-whacker around libdisk:
Constify some things.
Staticize some things.
Remove some unused things.
Prototype some things.
Don't install a gazillion man-pages links.
Drop support for ON-TRACK disk-manager.
2002-10-22 09:13:02 +00:00
Poul-Henning Kamp
1c67107149 Sigh, d_ntracks, not d_nheads. 2002-10-21 20:42:20 +00:00
Poul-Henning Kamp
53894badfd fwheads and fwsectors got swapped underway.
Approved by:	sam
2002-10-21 19:44:07 +00:00
Sam Leffler
11480fc6ae Another baby step toward getting sysinstall working:
o fillin media s/h/c fields from new XML phk just added; need this because
  sysinstall uses them in the fdisk look-alike
o add new tags to xml parser
o cleanup parser a touch; remove unused tags and move tag parsing stuff to
  a table to simplify future additions
o redo callback to pass 64-bit values since mediasize overflows u_int32_t
o loosen parsing sanity checks a touch to deal with new xml we must handle
o move sector size probing to non-geom handling since we now get it from xml
o remove WHOLE_DISK_SLICE buggery now that we get mediasize from xml
2002-10-20 22:19:37 +00:00
Sam Leffler
bf6e74b5f5 o since you can't use DIOCGDINFO and DIOCGSLICEINFO on drive nodes with geom,
get the xml configuration for the devices and "parse" the information to
  get what's needed
o replace #ifdef DEBUG constructs with DPRINT/DPRINTX to make the code more
  readable

Note the xml "parser" is very very hackish and should be replaced with a
real one.  This one was done to be very small and special-purpose; don't
think about copying it elsewhere.

Approved by:	phk
2002-10-19 16:39:28 +00:00
Sam Leffler
c1623066ca o ioctl DIOCGDINFO error wasn't checked
o memory wasn't reclaimed in certain cases
o add more msgs under #ifdef DEBUG
o rewrite tangle of for loops for clarity

NB: Open_Disk should redo how it malloc's memory so the caller can free
    everything.  Documentation says the caller can free the disk list to
    reclaim everything but this leaks the indirect strings.  Fixing this
    is simple for the sysctl case but adds complexity to the fallback,
    non-sysctl, case.
2002-10-17 18:34:32 +00:00
Sam Leffler
dda5b5a58a correct arg order to strlcpy/strlcat under #ifdef alpha 2002-10-17 18:23:21 +00:00