PERFORCE change 30664 for review
Robert Watson
rwatson at FreeBSD.org
Tue May 6 12:40:24 GMT 2003
http://perforce.freebsd.org/chv.cgi?CH=30664
Change 30664 by rwatson at rwatson_tislabs on 2003/05/06 05:40:02
Submerge local changes: no longer required to support UFS2.
Affected files ...
.. //depot/projects/trustedbsd/mac/lib/libdisk/Makefile#9 edit
.. //depot/projects/trustedbsd/mac/lib/libdisk/blocks.c#6 edit
.. //depot/projects/trustedbsd/mac/lib/libdisk/change.c#6 edit
.. //depot/projects/trustedbsd/mac/lib/libdisk/chunk.c#14 edit
.. //depot/projects/trustedbsd/mac/lib/libdisk/create_chunk.c#16 edit
.. //depot/projects/trustedbsd/mac/lib/libdisk/disk.c#24 edit
.. //depot/projects/trustedbsd/mac/lib/libdisk/libdisk.3#7 edit
.. //depot/projects/trustedbsd/mac/lib/libdisk/libdisk.h#16 edit
.. //depot/projects/trustedbsd/mac/lib/libdisk/rules.c#10 edit
.. //depot/projects/trustedbsd/mac/lib/libdisk/tst01.c#8 edit
.. //depot/projects/trustedbsd/mac/lib/libdisk/write_alpha_disk.c#8 edit
.. //depot/projects/trustedbsd/mac/lib/libdisk/write_amd64_disk.c#2 edit
.. //depot/projects/trustedbsd/mac/lib/libdisk/write_disk.c#11 edit
.. //depot/projects/trustedbsd/mac/lib/libdisk/write_i386_disk.c#7 edit
.. //depot/projects/trustedbsd/mac/lib/libdisk/write_ia64_disk.c#6 edit
.. //depot/projects/trustedbsd/mac/lib/libdisk/write_pc98_disk.c#9 edit
.. //depot/projects/trustedbsd/mac/lib/libdisk/write_sparc64_disk.c#6 edit
Differences ...
==== //depot/projects/trustedbsd/mac/lib/libdisk/Makefile#9 (text+ko) ====
==== //depot/projects/trustedbsd/mac/lib/libdisk/blocks.c#6 (text+ko) ====
==== //depot/projects/trustedbsd/mac/lib/libdisk/change.c#6 (text+ko) ====
==== //depot/projects/trustedbsd/mac/lib/libdisk/chunk.c#14 (text+ko) ====
==== //depot/projects/trustedbsd/mac/lib/libdisk/create_chunk.c#16 (text+ko) ====
==== //depot/projects/trustedbsd/mac/lib/libdisk/disk.c#24 (text+ko) ====
@@ -192,8 +192,6 @@
d->sector_size = s;
len /= s; /* media size in number of sectors. */
- d->bbsize = BBSIZE; /* default, insufficient for UFS2 */
-
if (Add_Chunk(d, 0, len, name, whole, 0, 0, "-"))
DPRINT(("Failed to add 'whole' chunk"));
@@ -558,40 +556,39 @@
}
int
-Set_Boot_Block_Size(struct disk *d, size_t boot_block_size)
-{
-
- d->bbsize = boot_block_size;
- return 0;
-}
-
-int
Set_Boot_Blocks(struct disk *d, const u_char *b1, const u_char *b2)
{
#if defined(__i386__) || defined(__amd64__)
if (d->boot1)
free(d->boot1);
- d->boot1 = malloc(b1size);
+ d->boot1 = malloc(512);
if (!d->boot1)
return -1;
- memcpy(d->boot1, b1, b1size);
+ memcpy(d->boot1, b1, 512);
if (d->boot2)
free(d->boot2);
- d->boot2 = malloc(b2size);
+ d->boot2 = malloc(15 * 512);
if (!d->boot2)
return -1;
- memcpy(d->boot2, b2, b2size);
-#elif defined(__alpha__) || defined(__sparc64__)
+ memcpy(d->boot2, b2, 15 * 512);
+#elif defined(__alpha__)
if (d->boot1)
free(d->boot1);
- d->boot1 = malloc(b1size);
+ d->boot1 = malloc(15 * 512);
if (!d->boot1)
return -1;
- memcpy(d->boot1, b1, b1size);
+ memcpy(d->boot1, b1, 15 * 512);
+#elif defined(__sparc64__)
+ if (d->boot1 != NULL)
+ free(d->boot1);
+ d->boot1 = malloc(16 * 512);
+ if (d->boot1 == NULL)
+ return (-1);
+ memcpy(d->boot1, b1, 16 * 512);
#elif defined(__ia64__)
/* nothing */
#else
-/* Should be: #error "Set_Large_Boot_Blocks: unknown arch"; */
+/* Should be: #error "Set_Boot_Blocks: unknown arch"; */
#endif
return 0;
}
==== //depot/projects/trustedbsd/mac/lib/libdisk/libdisk.3#7 (text+ko) ====
@@ -44,7 +44,6 @@
.Nm Disk_Names ,
.Nm Set_Boot_Mgr ,
.Nm Set_Boot_Blocks ,
-.Nm Set_Large_Boot_Blocks ,
.Nm Write_Disk ,
.Nm Cyl_Aligned ,
.Nm Next_Cyl_Aligned ,
@@ -92,8 +91,6 @@
.Ft int
.Fn Set_Boot_Blocks "struct disk *d" "const u_char *boot1" "const u_char *boot2"
.Ft int
-.Fn Set_Large_Boot_Blocks "struct disk *d" "const u_char *boot1" "size_t boot1size" "const u_char *boot2" "size_t boot2size"
-.Ft int
.Fn Write_Disk "struct disk *d"
.Ft int
.Fn Cyl_Aligned "struct disk *d" "u_long offset"
@@ -259,9 +256,7 @@
is called.
.Pp
.Fn Set_Boot_Blocks
-and
-.Fn Set_Large_Boot_Blocks
-set the boot-blocks for use on this disk. Gets written when
+sets the boot-blocks for use on this disk. Gets written when
.Fn Write_Disk
is called.
.Pp
==== //depot/projects/trustedbsd/mac/lib/libdisk/libdisk.h#16 (text+ko) ====
@@ -75,7 +75,6 @@
#endif
struct chunk *chunks;
u_long sector_size; /* media sector size, a power of 2 */
- u_int bbsize; /* boot block size for disklabel */
};
struct chunk {
@@ -151,9 +150,6 @@
Set_Bios_Geom(struct disk *, u_long, u_long, u_long);
/* Set the geometry the bios uses. */
-int
-Set_Boot_Block_Size(struct disk *, const size_t);
-
void
Sanitize_Bios_Geom(struct disk *);
/* Set the bios geometry to something sane */
@@ -216,9 +212,6 @@
int
Set_Boot_Blocks(struct disk *, const u_char *, const u_char *);
-int
-Set_Large_Boot_Blocks(struct disk *, const u_char *, size_t, const u_char *,
- size_t);
/*
* Use these boot-blocks on this disk. Gets written when Write_Disk()
* is called. Returns nonzero upon failure.
==== //depot/projects/trustedbsd/mac/lib/libdisk/rules.c#10 (text+ko) ====
==== //depot/projects/trustedbsd/mac/lib/libdisk/tst01.c#8 (text+ko) ====
==== //depot/projects/trustedbsd/mac/lib/libdisk/write_alpha_disk.c#8 (text+ko) ====
==== //depot/projects/trustedbsd/mac/lib/libdisk/write_amd64_disk.c#2 (text+ko) ====
==== //depot/projects/trustedbsd/mac/lib/libdisk/write_disk.c#11 (text+ko) ====
@@ -44,7 +44,7 @@
dl->d_partitions[j].p_fstype = c2->subtype;
}
- dl->d_bbsize = new->bbsize;
+ dl->d_bbsize = BBSIZE;
/*
* Add in defaults for superblock size, interleave, and rpms
*/
==== //depot/projects/trustedbsd/mac/lib/libdisk/write_i386_disk.c#7 (text+ko) ====
@@ -32,12 +32,9 @@
struct disklabel *dl;
int i;
void *p;
- u_char *buf;
+ u_char buf[BBSIZE];
- buf = malloc(new->bbsize);
- if (buf == NULL)
- return -1;
- for (i = 0; i < new->bbsize / 512; i++) {
+ for (i = 0; i < BBSIZE/512; i++) {
p = read_block(fd, i + c1->offset, 512);
memcpy(buf + 512 * i, p, 512);
free(p);
@@ -46,15 +43,14 @@
memcpy(buf, new->boot1, 512);
if (new->boot2)
- memcpy(buf + 512, new->boot2, new->bbsize - 512);
+ memcpy(buf + 512, new->boot2, BBSIZE - 512);
dl = (struct disklabel *)(buf + 512 * LABELSECTOR + LABELOFFSET);
Fill_Disklabel(dl, new, c1);
- for (i = 0; i < new->bbsize / 512; i++)
+ for (i = 0; i < BBSIZE / 512; i++)
write_block(fd, i + c1->offset, buf + 512 * i, 512);
- free(buf);
return 0;
}
==== //depot/projects/trustedbsd/mac/lib/libdisk/write_ia64_disk.c#6 (text+ko) ====
==== //depot/projects/trustedbsd/mac/lib/libdisk/write_pc98_disk.c#9 (text+ko) ====
@@ -34,11 +34,9 @@
struct disklabel *dl;
int i;
void *p;
- u_char *buf;
+ u_char buf[BBSIZE];
- if (buf == NULL)
- return -1;
- for (i = 0; i < new->bbsize / 512; i++) {
+ for (i = 0; i < BBSIZE / 512; i++) {
p = read_block(fd, i + c1->offset, 512);
memcpy(buf + 512 * i, p, 512);
free(p);
@@ -47,15 +45,14 @@
memcpy(buf, new->boot1, 512);
if (new->boot2)
- memcpy(buf + 512, new->boot2, new->bbsize - 512);
+ memcpy(buf + 512, new->boot2, BBSIZE - 512);
dl = (struct disklabel *)(buf + 512 * LABELSECTOR + LABELOFFSET);
Fill_Disklabel(dl, new, c1);
- for (i = 0; i < new->bbsize / 512; i++)
+ for (i = 0; i < BBSIZE / 512; i++)
write_block(fd, i + c1->offset, buf + 512 * i, 512);
- free(buf);
return 0;
}
==== //depot/projects/trustedbsd/mac/lib/libdisk/write_sparc64_disk.c#6 (text+ko) ====
To Unsubscribe: send mail to majordomo at trustedbsd.org
with "unsubscribe trustedbsd-cvs" in the body of the message
More information about the trustedbsd-cvs
mailing list