diff options
author | jkh <jkh@FreeBSD.org> | 2001-05-13 20:08:54 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 2001-05-13 20:08:54 +0000 |
commit | 5b33a2af7cc4f8e49951b70e1fc5b616876450a6 (patch) | |
tree | ac04e3b0eea5f057863e3c3ee8b4637d07f2adb8 /lib/libdisk/chunk.c | |
parent | c6db5e77fc9682b938a8776c6e2c8cbda527cd2c (diff) | |
download | FreeBSD-src-5b33a2af7cc4f8e49951b70e1fc5b616876450a6.zip FreeBSD-src-5b33a2af7cc4f8e49951b70e1fc5b616876450a6.tar.gz |
+ 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>
Diffstat (limited to 'lib/libdisk/chunk.c')
-rw-r--r-- | lib/libdisk/chunk.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/libdisk/chunk.c b/lib/libdisk/chunk.c index aa8f308..a28ebe7 100644 --- a/lib/libdisk/chunk.c +++ b/lib/libdisk/chunk.c @@ -99,7 +99,7 @@ Clone_Chunk(struct chunk *c1) if(!c1) return 0; c2 = new_chunk(); - if (!c2) barfout(1, "malloc failed"); + if (!c2) return NULL; *c2 = *c1; if (c1->private_data && c1->private_clone) c2->private_data = c2->private_clone(c2->private_data); @@ -128,7 +128,7 @@ Insert_Chunk(struct chunk *c2, u_long offset, u_long size, const char *name, return __LINE__; ct = new_chunk(); - if (!ct) barfout(1, "malloc failed"); + if (!ct) return __LINE__; memset(ct, 0, sizeof *ct); ct->disk = c2->disk; ct->offset = offset; @@ -149,7 +149,7 @@ Insert_Chunk(struct chunk *c2, u_long offset, u_long size, const char *name, if(type==freebsd || type==extended) { cs = new_chunk(); - if (!cs) barfout(1, "malloc failed"); + if (!cs) return __LINE__; memset(cs, 0, sizeof *cs); cs->disk = c2->disk; cs->offset = offset; @@ -166,7 +166,7 @@ Insert_Chunk(struct chunk *c2, u_long offset, u_long size, const char *name, /* Make a new chunk for any trailing unused space */ if (c2->end > ct->end) { cs = new_chunk(); - if (!cs) barfout(1, "malloc failed"); + if (!cs) return __LINE__; *cs = *c2; cs->disk = c2->disk; cs->offset = ct->end + 1; @@ -224,10 +224,10 @@ Add_Chunk(struct disk *d, long offset, u_long size, const char *name, if (type == whole) { d->chunks = c1 = new_chunk(); - if (!c1) barfout(1, "malloc failed"); + if (!c1) return __LINE__; memset(c1, 0, sizeof *c1); c2 = c1->part = new_chunk(); - if (!c2) barfout(1, "malloc failed"); + if (!c2) return __LINE__; memset(c2,0,sizeof *c2); c2->disk = c1->disk = d; c2->offset = c1->offset = offset; |