summaryrefslogtreecommitdiff
path: root/lib/libdisk/disk.c
Commit message (Collapse)AuthorAgeFilesLines
* Sanity check the list obtained from the kern.disks sysctl so that Disk_Names()Scott Long2003-06-071-1/+4
| | | | | | | | doesn't get fooled into returning a bogus list. This should fix sysinstall from segfaulting when no disk devices are present. Notes: svn path=/head/; revision=115981
* Teach libdisk that AMD64 works just like i386Peter Wemm2003-04-301-3/+5
| | | | Notes: svn path=/head/; revision=114329
* Only define platform once -- in a C file.David E. O'Brien2003-04-301-0/+20
| | | | Notes: svn path=/head/; revision=114300
* Libdisk does not need to include <sys/diskslice.h> any more.Poul-Henning Kamp2003-04-041-1/+0
| | | | | | | | | | | | 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. Notes: svn path=/head/; revision=113083
* Ignore GBDE devices.Poul-Henning Kamp2003-03-171-0/+2
| | | | | | | Spotted by: Lucky Green <shamrock@cypherpunks.to> Notes: svn path=/head/; revision=112333
* Use the fstype obtained from the GEOM dumpconf output to set the fstypeJohn Baldwin2003-01-101-1/+1
| | | | | | | | | | of BSD part chunks when opening a disk. Reviewed by: phk MFC after: 2 days Notes: svn path=/head/; revision=109082
* Return an error if the size of the sector is zero. This is for removableYoshihiro Takahashi2002-12-261-0/+6
| | | | | | | | | | | devices that is not inserted any media. This is MFC candidate. Submitted by: ISAKA Yoji <isaka@cory.jp> Notes: svn path=/head/; revision=108292
* - Ease sanity check to get cylinders.Yoshihiro Takahashi2002-11-171-6/+12
| | | | | | | - Get the slice name from the result of kern.geom.conftxt. Notes: svn path=/head/; revision=107011
* Fixed style(9)Yoshihiro Takahashi2002-11-151-31/+71
| | | | Notes: svn path=/head/; revision=106949
* Handle EFI partitions the same as regular FAT partitions. The onlyMarcel Moolenaar2002-11-131-0/+3
| | | | | | | | | 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. Notes: svn path=/head/; revision=106837
* Remove debugging printfs.Poul-Henning Kamp2002-11-111-7/+0
| | | | Notes: svn path=/head/; revision=106761
* Add efi to the list of types for which we need to return tha name.Marcel Moolenaar2002-11-101-1/+4
| | | | | | | | 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. Notes: svn path=/head/; revision=106743
* - Recognize FAT partition on MBR and PC98 disks.Yoshihiro Takahashi2002-11-081-20/+47
| | | | | | | - Fix to convert to the name of partition. Notes: svn path=/head/; revision=106633
* Don't set a value to a variable that we don't use.John Baldwin2002-11-081-1/+0
| | | | Notes: svn path=/head/; revision=106621
* Fixed pc98 support.Yoshihiro Takahashi2002-11-071-3/+3
| | | | | | | (merged i386 changes from chunk.c 1.41 and disk.c 1.100) Notes: svn path=/head/; revision=106549
* Initialize d->bios_cyl. We know the media size in sectors, the numberMarcel Moolenaar2002-11-031-4/+10
| | | | | | | | | | 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. Notes: svn path=/head/; revision=106368
* Add support for GPT:Marcel Moolenaar2002-11-021-5/+45
| | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=106343
* Don't claim all MBR's have subtype 165 on i386.Poul-Henning Kamp2002-11-021-2/+2
| | | | | | | Spotted by: Frode Nordahl <frode@nordahl.net> Notes: svn path=/head/; revision=106337
* Set the sector size for the disk.Poul-Henning Kamp2002-10-311-0/+2
| | | | Notes: svn path=/head/; revision=106240
* Restore to pc98 support.Yoshihiro Takahashi2002-10-311-43/+82
| | | | Notes: svn path=/head/; revision=106238
* Actually save the bootblock in the disk structure. Write the bootblockJake Burkholder2002-10-311-0/+7
| | | | | | | to the right place on the disk instead of srewn all over it. Notes: svn path=/head/; revision=106232
* Getting closer to getting things right:Poul-Henning Kamp2002-10-291-1/+1
| | | | | | | | | | Always ignore the RAW_PART for BSD. Having no quirks is not a mistake for an architecture. Tested by: DES Notes: svn path=/head/; revision=106155
* Since make release is toast anyway, add wood to the pyre:Poul-Henning Kamp2002-10-291-701/+181
| | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=106135
* Add back ia64 support that was removed in the last few revisions.Peter Wemm2002-10-271-0/+14
| | | | | | | I've cloned write_ia64_disk.c from write_i386_disk.c. Notes: svn path=/head/; revision=106008
* #ifdef out assignToPartition on non x86 arches to unbreak the worldAndrew Gallatin2002-10-241-0/+2
| | | | | | | on alpha, sparc64 and ia64 Notes: svn path=/head/; revision=105873
* More lobotomy:Poul-Henning Kamp2002-10-231-80/+0
| | | | | | | | | | 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. Notes: svn path=/head/; revision=105821
* Rely on sysctl kern.disks to be there, and get rid of one of the far tooPoul-Henning Kamp2002-10-231-69/+36
| | | | | | | | many lists of disk device driver names in the system. At this point we should really get the names from the XML, but hey... Notes: svn path=/head/; revision=105818
* Untangle #ifdefs in the write-end of things by giving each arch itsPoul-Henning Kamp2002-10-231-1/+1
| | | | | | | | | | 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. Notes: svn path=/head/; revision=105816
* - The GEOM system does not work on pc98.Yoshihiro Takahashi2002-10-231-0/+4
| | | | | | | - Fix to build w/o the HAVE_GEOM option. Notes: svn path=/head/; revision=105791
* Add the new extra argument also in the alpha case.Poul-Henning Kamp2002-10-231-1/+1
| | | | Notes: svn path=/head/; revision=105784
* Avoid a lot of #ifdef PC98 code by giving a couple of the Chunk functionsPoul-Henning Kamp2002-10-221-6/+2
| | | | | | | an extra argument for all archs. Notes: svn path=/head/; revision=105685
* Swing the weed-whacker around libdisk:Poul-Henning Kamp2002-10-221-55/+3
| | | | | | | | | | | | 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. Notes: svn path=/head/; revision=105681
* Sigh, d_ntracks, not d_nheads.Poul-Henning Kamp2002-10-211-1/+1
| | | | Notes: svn path=/head/; revision=105652
* fwheads and fwsectors got swapped underway.Poul-Henning Kamp2002-10-211-2/+2
| | | | | | | Approved by: sam Notes: svn path=/head/; revision=105646
* Another baby step toward getting sysinstall working:Sam Leffler2002-10-201-77/+128
| | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=105575
* o since you can't use DIOCGDINFO and DIOCGSLICEINFO on drive nodes with geom,Sam Leffler2002-10-191-62/+456
| | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=105460
* o ioctl DIOCGDINFO error wasn't checkedSam Leffler2002-10-171-7/+29
| | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=105349
* correct arg order to strlcpy/strlcat under #ifdef alphaSam Leffler2002-10-171-2/+2
| | | | Notes: svn path=/head/; revision=105348
* Use buffer-safe string functions for paranoia.Kris Kennaway2002-10-121-11/+12
| | | | Notes: svn path=/head/; revision=105007
* Zero memory after malloc. This stops sysinstall from dumping coreKris Kennaway2002-10-121-0/+1
| | | | | | | | | during disk probing with malloc debugging enabled. MFC after: 1 week Notes: svn path=/head/; revision=105005
* Fix to support pc98.Yoshihiro Takahashi2002-10-081-0/+4
| | | | Notes: svn path=/head/; revision=104674
* Split MBR and PC98 on-disk sliceformats out from disklabel.h, step 1:Poul-Henning Kamp2002-10-011-0/+1
| | | | | | | | | | | | | | | | | | | Peter had repocopied sys/disklabel.h to sys/diskpc98.h and sys/diskmbr.h. These two new copies are still intact copies of disklabel.h and therefore protected by #ifndef _SYS_DISKLABEL_H_ so #including them in programs which already include <sys.disklabel.h> is currently a no-op. This commit adds a number of such #includes. Once I have verified that I have fixed all the places which need fixing, I will commit the updated versions of the three #include files. Sponsored by: DARPA & NAI Labs. Notes: svn path=/head/; revision=104272
* Modernize my email address.Poul-Henning Kamp2002-03-251-1/+1
| | | | Notes: svn path=/head/; revision=93149
* Sort the disknames when we get them from the kernel.Poul-Henning Kamp2001-12-231-10/+23
| | | | | | | Submitted by: <anarcat@anarcat.dyndns.org> Notes: svn path=/head/; revision=88448
* Add EFI GPT (238, 0xEE) and EFI System Parition (239, 0xEF)Peter Wemm2001-10-151-0/+2
| | | | Notes: svn path=/head/; revision=84965
* Add __FBSDID()s to libdiskMatthew Dillon2001-09-301-3/+3
| | | | Notes: svn path=/head/; revision=84200
* + add u_long sector_size to struct disk (documented in libdisk.3)Jordan K. Hubbard2001-05-131-20/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | + make Open_Disk sense the sector size by trying 512, 1024 and 2048 in this order. This makes the kernel note that dscheck(cd1): bio_bcount 512 is not on a sector boundary (ssize 2048) dscheck(cd1): bio_bcount 1024 is not on a sector boundary (ssize 2048) if 2048 is the sector size. If this worries anyone: the message is from /usr/src/sys/kern/subr_diskslice.c and shutups are to be placed there. + Have read_block and write_block use an additional parameter, the sector size. + replace all barfout calls with return NULL, 0, __LINE__, etc. Note that this does NOT emit diagnostics. More often than not, you don't want library functions to scribble on stderr -- it may not even be available. The right thing is to propagate the error condition to upper management. The app should take care of errors. + use d1->sector_size instead of 512 in various places. I've left many places untouched, especially those writing MBRs. I simply added another arg hardcoded as 512. This is because I would not know what I'm doing... I felt this approach would be reasonably backward compatible and not introduce any new bugs in critical software. Famous last words. Messing with MBRs might soon put me in the same screwup meister category as, uh, never mind. :-) + bump the max no of disks from 20 to 32 (due to PR 24503). PR: 8434 / 8436 / 24503 Submitted by: Jens Schweikhardt <schweikh@schweikhardt.net> Notes: svn path=/head/; revision=76551
* Add spaces around operators.David E. O'Brien2001-04-011-73/+74
| | | | | | | | It's OK, the Project and afford them now -- they aren't as expensive as they used to be. Notes: svn path=/head/; revision=75069
* Add back <err.h> for warn().David E. O'Brien2001-04-011-0/+1
| | | | | | | | (of course it's pretty stupid to call it, as printf doesn't work w/in sysinstall, and sysinstall is the only consumer of libdisk) Notes: svn path=/head/; revision=75066
* Libraries should _never_ call exit() themselves (or its alternate spellingDavid E. O'Brien2001-03-181-10/+9
| | | | | | | | | | | | | | `err()'). libdisk does! and additionally libdisk gets confused on Alpha disks with foreign disklabels, throws up its hands and exits. This is the cause of the "going no where without my init" install bug on the Alpha. So now on the Alpha, rather than call err(), we print the error string and continue processing. Submitted by: jkh Notes: svn path=/head/; revision=74426