Commit Graph

79 Commits

Author SHA1 Message Date
sam
68349b6d1c 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
8680a53ace correct arg order to strlcpy/strlcat under #ifdef alpha 2002-10-17 18:23:21 +00:00
kris
78372d114d Use buffer-safe string functions for paranoia. 2002-10-12 22:03:22 +00:00
kris
ab2f5d80c1 Zero memory after malloc. This stops sysinstall from dumping core
during disk probing with malloc debugging enabled.

MFC after:	1 week
2002-10-12 22:01:57 +00:00
nyan
4c34626aa8 Fix to support pc98. 2002-10-08 12:13:19 +00:00
phk
19150ba4f8 Split MBR and PC98 on-disk sliceformats out from disklabel.h, step 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.
2002-10-01 07:24:55 +00:00
phk
811d04c86c Modernize my email address. 2002-03-25 13:52:45 +00:00
phk
c77a6625c0 Sort the disknames when we get them from the kernel.
Submitted by:	<anarcat@anarcat.dyndns.org>
2001-12-23 21:43:48 +00:00
peter
e63461ebd8 Add EFI GPT (238, 0xEE) and EFI System Parition (239, 0xEF) 2001-10-15 07:25:29 +00:00
dillon
4015450ecd Add __FBSDID()s to libdisk 2001-09-30 21:16:57 +00:00
jkh
5b33a2af7c + add u_long sector_size to struct disk (documented in libdisk.3)
+ 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>
2001-05-13 20:08:54 +00:00
obrien
be7c1d1248 Add spaces around operators.
It's OK, the Project and afford them now -- they aren't as expensive as
they used to be.
2001-04-01 12:18:20 +00:00
obrien
e2cf0ccf62 Add back <err.h> for warn().
(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)
2001-04-01 11:32:56 +00:00
obrien
981727ddcf Libraries should _never_ call exit() themselves (or its alternate spelling
`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
2001-03-18 21:30:11 +00:00
jkh
a1a6483d6a MFS: add ATA raid support for sysinstall 2000-11-06 23:15:01 +00:00
nyan
212e24871c Use kern.disks sysctl on PC-98. 2000-10-21 10:08:57 +00:00
msmith
9f76441881 Teach libdisk about 'aac' 2000-09-13 05:04:48 +00:00
nyan
784618782e - Added support for installing boot0 and boot0.5 for PC-98.
- Cosmetic changes.
2000-08-12 14:20:31 +00:00
nyan
2a86f209a7 - Fixed warnings and typo.
- Recognize slice type 0x24 as FAT (only PC-98).

Submitted by:	Nobuyuki Koganemaru <kogane@koganemaru.co.jp>
2000-08-08 04:01:51 +00:00
nyan
fb32fc5d86 Don't use kern.disks sysctl on PC-98 because the wd driver doesn't call
disk_create() function.
2000-08-07 02:14:44 +00:00
jhb
b4c0d6aa68 - Allow support for MBR boot loaders that are longer than one sector. As
with fdisk, ensure that they are a multiple of the sector size in length.
- Axe all the 1024 cylinder checks as they are no longer relevant with the
  fixed bootstrap.
2000-07-12 18:05:18 +00:00
jhb
033721fb7a _PATH_DEV'ify libdisk 2000-06-28 22:28:50 +00:00
nbm
0b74e561b2 Let Disk_Names() take advantage of the kern.disks sysctl if it's
available.  If not, it falls back to the existing hack and slash method.

A positive side effect is that non-root users may now use Disk_Names(),
for non-dangerous libh/disk.tcl testing.

Reviewed by:	phk
2000-06-23 14:01:06 +00:00
nyan
78e26067f4 Re-support "wd" if PC98 is defined. Because PC-98 still uses the wd driver. 2000-06-05 13:33:39 +00:00
msmith
2dbe92be83 /dev/rXXX -> /dev/XXX
This should fix sysinstall and other tools that don't expect the 'r' devices
to exist anymore (and thus don't create them).
2000-05-31 00:51:57 +00:00
msmith
6af3825c82 De-support 'wd'; with it making a dual appearance with 'ad', things
depending on libdisk to detect a list of actually-there disk devices
were providing duplicate entries (eg. sysinstall).
2000-05-30 15:18:30 +00:00
msmith
3040b8e835 Teach libdisk about 'twe' disks. 2000-05-25 02:23:47 +00:00
jkh
9809e4d713 catch up to the modern ATAPI disk naming conventions and add floppy
disks.

Submitted by:	bde
2000-05-24 20:25:42 +00:00
obrien
04946447c6 Raw devices are now the normal device name, not prefixed with 'r'. 2000-04-19 18:51:28 +00:00
kato
54a7094e5d Changes for PC-98. 2000-03-29 15:10:28 +00:00
imp
a4af1d9ca0 Fix fd leak in libdisk's Disk_Names() 2000-03-10 22:54:04 +00:00
jlemon
b81515b53b Correct device naming for IDA disk nodes (idad) 2000-03-08 18:14:02 +00:00
msmith
517fd10f04 Remove 'sd' support. SCSI disks are known as 'da' these days. 1999-11-27 21:20:57 +00:00
msmith
9747814286 Teach libdisk about the AMI and Mylex RAID drivers. You should be able
to install directly to arrays managed by these controllers now.
1999-11-02 03:40:14 +00:00
peter
76f0c923fe $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
msmith
0891003b83 Merge from -stable; support for the 'ida' driver, move fla to major 102 1999-07-05 09:43:29 +00:00
dfr
d04db09021 Back out the last change to disk.c - a kernel change removed the need.
Enabled writing to the disklabel when writing a disk (only affects alpha).
1999-05-09 11:34:58 +00:00
dfr
4537aba471 Make libdisk see the existing partitiions on the alpha. 1999-05-08 21:21:50 +00:00
msmith
bccd81a06a Clean up after another half-Danish.
Add 'ad' as another known disk driver of the same kind as 'wd'.
1999-05-04 22:44:48 +00:00
imp
404ab5f9ba More egcs warning fixes:
o use braces to avoid potentially ambiguous else
	o don't default to type int (and also remove a useless register
	  modifier).
	o Use parens around assignment values used as truth values.
	o Remove unused function.

Reviewed by: obrien and chuckr
1999-04-25 22:29:30 +00:00
jkh
4468350ab5 More support for Alpha installs.
Submitted by:   dfr
1999-01-29 11:39:24 +00:00
phk
8d37d7da90 Add "fla" to Disk_Names() 1998-12-19 18:48:33 +00:00
dfr
b0393b65d5 Teach libdisk about alpha boot blocks. 1998-10-06 11:57:08 +00:00
jkh
e2bde560d5 Eliminate unaligned access on Alpha and also neaten up this code a little.
Submitted by:	dfr
1998-09-30 21:40:51 +00:00
gibbs
12e1349910 Remove references to the "od" device. 1998-09-15 10:23:17 +00:00
obrien
8bc69f7d31 Add new NetBSD FFS with FDISK partition ID 0xa9
Obtained from:	Frank van der Linden <frank@wins.uva.nl>
1998-05-19 11:15:44 +00:00
obrien
746b4b1f11 Change an arbitarly hardcoded `10' to MAX_NO_DISKS, which is currently "20".
Otherwise can't see sd10 (obtained using wired down sd unit numbers),
reguardless of the number of actual disks you have.
1998-05-15 21:17:01 +00:00
jkh
f572092cb8 Add Compaq & SCO partition types.
PR:		6092
Submitted by:	Drew Derbyshire <ahd@kew.com>
1998-03-22 07:41:23 +00:00
jkh
7561a96183 MF22: teach about LS-120 devices. 1998-03-20 23:43:04 +00:00
ache
e8c2fe252f Add more AIX/DOS/Win95 partition types 1998-03-14 21:14:31 +00:00