summaryrefslogtreecommitdiffstats
path: root/lib/libdisk/write_disk.c
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2001-04-01 12:18:20 +0000
committerobrien <obrien@FreeBSD.org>2001-04-01 12:18:20 +0000
commitbe7c1d12489eca9263a2127dedf1cdfeb2ad8b93 (patch)
treea48d82e5adc3563378b2bd88d4318266ec48cd3e /lib/libdisk/write_disk.c
parent51dae2254ac1cd5dc67d293758322c96c592a731 (diff)
downloadFreeBSD-src-be7c1d12489eca9263a2127dedf1cdfeb2ad8b93.zip
FreeBSD-src-be7c1d12489eca9263a2127dedf1cdfeb2ad8b93.tar.gz
Add spaces around operators.
It's OK, the Project and afford them now -- they aren't as expensive as they used to be.
Diffstat (limited to 'lib/libdisk/write_disk.c')
-rw-r--r--lib/libdisk/write_disk.c77
1 files changed, 38 insertions, 39 deletions
diff --git a/lib/libdisk/write_disk.c b/lib/libdisk/write_disk.c
index cf75d7f..bdf04e5 100644
--- a/lib/libdisk/write_disk.c
+++ b/lib/libdisk/write_disk.c
@@ -46,28 +46,28 @@ Write_FreeBSD(int fd, struct disk *new, struct disk *old, struct chunk *c1)
u_long *lp, sum;
#endif
- for(i=0;i<BBSIZE/512;i++) {
- p = read_block(fd,WHERE(i + c1->offset,new));
- memcpy(buf+512*i,p,512);
+ for(i = 0; i < BBSIZE/512; i++) {
+ p = read_block(fd, WHERE(i + c1->offset, new));
+ memcpy(buf + 512 * i, p, 512);
free(p);
}
#if defined(__i386__)
if(new->boot1)
- memcpy(buf,new->boot1,512);
+ memcpy(buf, new->boot1, 512);
if(new->boot2)
- memcpy(buf+512,new->boot2,BBSIZE-512);
+ memcpy(buf + 512, new->boot2, BBSIZE-512);
#elif defined(__alpha__)
if(new->boot1)
- memcpy(buf+512,new->boot1,BBSIZE-512);
+ memcpy(buf + 512, new->boot1, BBSIZE-512);
#endif
- dl = (struct disklabel *) (buf+512*LABELSECTOR+LABELOFFSET);
- memset(dl,0,sizeof *dl);
+ dl = (struct disklabel *)(buf + 512 * LABELSECTOR + LABELOFFSET);
+ memset(dl, 0, sizeof *dl);
- for(c2=c1->part;c2;c2=c2->next) {
+ for(c2 = c1->part; c2; c2 = c2->next) {
if (c2->type == unused) continue;
- if (!strcmp(c2->name,"X")) continue;
+ if (!strcmp(c2->name, "X")) continue;
#ifdef __alpha__
j = c2->name[strlen(c2->name) - 1] - 'a';
#else
@@ -75,7 +75,7 @@ Write_FreeBSD(int fd, struct disk *new, struct disk *old, struct chunk *c1)
#endif
if (j < 0 || j >= MAXPARTITIONS || j == RAW_PART) {
#ifdef DEBUG
- warn("weird partition letter %c",c2->name[strlen(new->name) + 2]);
+ warn("weird partition letter %c", c2->name[strlen(new->name) + 2]);
#endif
continue;
}
@@ -92,7 +92,7 @@ Write_FreeBSD(int fd, struct disk *new, struct disk *old, struct chunk *c1)
dl->d_interleave = DEF_INTERLEAVE;
dl->d_rpm = DEF_RPM;
- strcpy(dl->d_typename,c1->name);
+ strcpy(dl->d_typename, c1->name);
dl->d_secsize = 512;
dl->d_secperunit = new->chunks->size;
@@ -140,7 +140,7 @@ Write_FreeBSD(int fd, struct disk *new, struct disk *old, struct chunk *c1)
#endif /*__alpha__*/
for(i=0;i<BBSIZE/512;i++) {
- write_block(fd,WHERE(i + c1->offset,new),buf+512*i);
+ write_block(fd,WHERE(i + c1->offset, new), buf + 512 * i);
}
return 0;
@@ -219,7 +219,7 @@ Write_Disk(struct disk *d1)
fd = open(device,O_RDWR);
if (fd < 0) {
#ifdef DEBUG
- warn("open(%s) failed",device);
+ warn("open(%s) failed", device);
#endif
return 1;
}
@@ -227,17 +227,17 @@ Write_Disk(struct disk *d1)
memset(s,0,sizeof s);
#ifdef PC98
- mbr = read_block(fd,WHERE(1,d1));
+ mbr = read_block(fd, WHERE(1, d1));
#else
- mbr = read_block(fd,WHERE(0,d1));
+ mbr = read_block(fd, WHERE(0, d1));
#endif
- dp = (struct dos_partition*) (mbr + DOSPARTOFF);
- memcpy(work,dp,sizeof work);
+ dp = (struct dos_partition*)(mbr + DOSPARTOFF);
+ memcpy(work, dp, sizeof work);
dp = work;
free(mbr);
- for (c1=d1->chunks->part; c1 ; c1 = c1->next) {
+ for (c1 = d1->chunks->part; c1; c1 = c1->next) {
if (c1->type == unused) continue;
- if (!strcmp(c1->name,"X")) continue;
+ if (!strcmp(c1->name, "X")) continue;
#ifdef __i386__
j = c1->name[4] - '1';
j = c1->name[strlen(d1->name) + 1] - '1';
@@ -251,10 +251,10 @@ Write_Disk(struct disk *d1)
#endif
#ifndef PC98
if (c1->type == extended)
- ret += Write_Extended(fd, d1,old,c1);
+ ret += Write_Extended(fd, d1, old, c1);
#endif
if (c1->type == freebsd)
- ret += Write_FreeBSD(fd, d1,old,c1);
+ ret += Write_FreeBSD(fd, d1, old, c1);
#ifdef __i386__
#ifndef PC98
@@ -292,7 +292,7 @@ Write_Disk(struct disk *d1)
#ifdef DEBUG
printf("S:%lu = (%x/%x/%x)",
- c1->offset,dp[j].dp_scyl,dp[j].dp_shd,dp[j].dp_ssect);
+ c1->offset, dp[j].dp_scyl, dp[j].dp_shd, dp[j].dp_ssect);
#endif
i = c1->end;
@@ -324,7 +324,7 @@ Write_Disk(struct disk *d1)
#ifdef DEBUG
printf(" E:%lu = (%x/%x/%x)\n",
- c1->end,dp[j].dp_ecyl,dp[j].dp_ehd,dp[j].dp_esect);
+ c1->end, dp[j].dp_ecyl, dp[j].dp_ehd, dp[j].dp_esect);
#endif
#ifdef PC98
@@ -345,9 +345,9 @@ Write_Disk(struct disk *d1)
}
#ifdef __i386__
j = 0;
- for(i=0;i<NDOSPART;i++) {
+ for(i = 0; i < NDOSPART; i++) {
if (!s[i])
- memset(dp+i,0,sizeof *dp);
+ memset(dp + i, 0, sizeof *dp);
#ifndef PC98
if (dp[i].dp_flag)
j++;
@@ -355,46 +355,46 @@ Write_Disk(struct disk *d1)
}
#ifndef PC98
if (!j)
- for(i=0;i<NDOSPART;i++)
+ for(i = 0; i < NDOSPART; i++)
if (dp[i].dp_typ == 0xa5)
dp[i].dp_flag = 0x80;
#endif
#ifdef PC98
if (d1->bootipl)
- write_block(fd,WHERE(0,d1),d1->bootipl);
+ write_block(fd, WHERE(0, d1), d1->bootipl);
- mbr = read_block(fd,WHERE(1,d1));
- memcpy(mbr+DOSPARTOFF,dp,sizeof *dp * NDOSPART);
+ mbr = read_block(fd, WHERE(1, d1));
+ memcpy(mbr + DOSPARTOFF, dp, sizeof *dp * NDOSPART);
/* XXX - for entire FreeBSD(98) */
for (c1 = d1->chunks->part; c1; c1 = c1->next)
if (((c1->type == freebsd) || (c1->type == fat))
&& (c1->offset == 0))
PC98_EntireDisk = 1;
if (PC98_EntireDisk == 0)
- write_block(fd,WHERE(1,d1),mbr);
+ write_block(fd, WHERE(1, d1), mbr);
if (d1->bootmenu)
for (i = 0; i * 512 < d1->bootmenu_size; i++)
- write_block(fd,WHERE(2+i,d1),&d1->bootmenu[i * 512]);
+ write_block(fd, WHERE(2 + i, d1), &d1->bootmenu[i * 512]);
#else
- mbr = read_block(fd,WHERE(0,d1));
+ mbr = read_block(fd, WHERE(0, d1));
if (d1->bootmgr) {
- memcpy(mbr,d1->bootmgr,DOSPARTOFF);
+ memcpy(mbr, d1->bootmgr, DOSPARTOFF);
Cfg_Boot_Mgr(mbr, need_edd);
}
- memcpy(mbr+DOSPARTOFF,dp,sizeof *dp * NDOSPART);
+ memcpy(mbr + DOSPARTOFF, dp, sizeof *dp * NDOSPART);
mbr[512-2] = 0x55;
mbr[512-1] = 0xaa;
- write_block(fd,WHERE(0,d1),mbr);
+ write_block(fd, WHERE(0, d1), mbr);
if (d1->bootmgr && d1->bootmgr_size > 512)
for(i = 1; i * 512 <= d1->bootmgr_size; i++)
- write_block(fd,WHERE(i,d1),&d1->bootmgr[i * 512]);
+ write_block(fd, WHERE(i, d1), &d1->bootmgr[i * 512]);
#endif
#endif
i = 1;
- i = ioctl(fd,DIOCSYNCSLICEINFO,&i);
+ i = ioctl(fd, DIOCSYNCSLICEINFO, &i);
#ifdef DEBUG
if (i != 0)
warn("ioctl(DIOCSYNCSLICEINFO)");
@@ -403,4 +403,3 @@ Write_Disk(struct disk *d1)
close(fd);
return 0;
}
-
OpenPOWER on IntegriCloud