Remove unnecessary ioctls tickling kernel side to realize that we fiddled
with the disk. GEOM will automatically retaste when we closet he filedesc.
This commit is contained in:
parent
3c688df114
commit
c17cb9154e
@ -4,6 +4,7 @@ LIB= disk
|
||||
SRCS= blocks.c chunk.c disk.c change.c \
|
||||
create_chunk.c rules.c write_disk.c
|
||||
INCS= libdisk.h
|
||||
|
||||
WARNS= 2
|
||||
|
||||
.if ${MACHINE} == "pc98"
|
||||
|
@ -362,7 +362,7 @@ Delete_Chunk2(struct disk *d, struct chunk *c, int rflags)
|
||||
{
|
||||
struct chunk *c1=0, *c2, *c3;
|
||||
chunk_e type = c->type;
|
||||
long offset = c->offset;
|
||||
u_long offset = c->offset;
|
||||
|
||||
if(type == whole)
|
||||
return 1;
|
||||
|
@ -73,7 +73,7 @@ Write_FreeBSD(int fd, const struct disk *new, const struct disk *old, const stru
|
||||
int
|
||||
Write_Disk(const struct disk *d1)
|
||||
{
|
||||
int fd,i;
|
||||
int fd;
|
||||
struct disk *old = 0;
|
||||
struct chunk *c1;
|
||||
int ret = 0;
|
||||
@ -81,8 +81,6 @@ Write_Disk(const struct disk *d1)
|
||||
u_char *mbr;
|
||||
struct dos_partition *dp,work[NDOSPART];
|
||||
int s[4];
|
||||
int one = 1;
|
||||
int zero = 0;
|
||||
|
||||
strcpy(device,_PATH_DEV);
|
||||
strcat(device,d1->name);
|
||||
@ -95,7 +93,6 @@ Write_Disk(const struct disk *d1)
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
ioctl(fd, DIOCWLABEL, &one);
|
||||
|
||||
memset(s,0,sizeof s);
|
||||
mbr = read_block(fd, 0, d1->sector_size);
|
||||
@ -111,13 +108,6 @@ Write_Disk(const struct disk *d1)
|
||||
|
||||
}
|
||||
|
||||
i = 1;
|
||||
i = ioctl(fd, DIOCSYNCSLICEINFO, &i);
|
||||
#ifdef DEBUG
|
||||
if (i != 0)
|
||||
warn("ioctl(DIOCSYNCSLICEINFO)");
|
||||
#endif
|
||||
ioctl(fd, DIOCWLABEL, &zero);
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
|
@ -17,7 +17,6 @@ __FBSDID("$FreeBSD$");
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/disklabel.h>
|
||||
#include <sys/diskslice.h>
|
||||
#include <sys/diskmbr.h>
|
||||
@ -93,8 +92,6 @@ Write_Disk(const struct disk *d1)
|
||||
struct dos_partition *dp,work[NDOSPART];
|
||||
int s[4];
|
||||
int need_edd = 0; /* Need EDD (packet interface) */
|
||||
int one = 1;
|
||||
int zero = 0;
|
||||
|
||||
strcpy(device,_PATH_DEV);
|
||||
strcat(device,d1->name);
|
||||
@ -107,7 +104,6 @@ Write_Disk(const struct disk *d1)
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
ioctl(fd, DIOCWLABEL, &one);
|
||||
|
||||
memset(s,0,sizeof s);
|
||||
mbr = read_block(fd, 0, d1->sector_size);
|
||||
@ -200,13 +196,6 @@ Write_Disk(const struct disk *d1)
|
||||
for(i = 1; i * d1->sector_size <= d1->bootmgr_size; i++)
|
||||
write_block(fd, i, &d1->bootmgr[i * d1->sector_size], d1->sector_size);
|
||||
|
||||
i = 1;
|
||||
i = ioctl(fd, DIOCSYNCSLICEINFO, &i);
|
||||
#ifdef DEBUG
|
||||
if (i != 0)
|
||||
warn("ioctl(DIOCSYNCSLICEINFO)");
|
||||
#endif
|
||||
ioctl(fd, DIOCWLABEL, &zero);
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
|
@ -17,7 +17,6 @@ __FBSDID("$FreeBSD$");
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/disklabel.h>
|
||||
#include <sys/diskslice.h>
|
||||
#include <sys/diskmbr.h>
|
||||
@ -93,8 +92,6 @@ Write_Disk(const struct disk *d1)
|
||||
struct dos_partition *dp,work[NDOSPART];
|
||||
int s[4];
|
||||
int need_edd = 0; /* Need EDD (packet interface) */
|
||||
int one = 1;
|
||||
int zero = 0;
|
||||
|
||||
strcpy(device,_PATH_DEV);
|
||||
strcat(device,d1->name);
|
||||
@ -107,7 +104,6 @@ Write_Disk(const struct disk *d1)
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
ioctl(fd, DIOCWLABEL, &one);
|
||||
|
||||
memset(s,0,sizeof s);
|
||||
mbr = read_block(fd, 0, d1->sector_size);
|
||||
@ -200,13 +196,6 @@ Write_Disk(const struct disk *d1)
|
||||
for(i = 1; i * d1->sector_size <= d1->bootmgr_size; i++)
|
||||
write_block(fd, i, &d1->bootmgr[i * d1->sector_size], d1->sector_size);
|
||||
|
||||
i = 1;
|
||||
i = ioctl(fd, DIOCSYNCSLICEINFO, &i);
|
||||
#ifdef DEBUG
|
||||
if (i != 0)
|
||||
warn("ioctl(DIOCSYNCSLICEINFO)");
|
||||
#endif
|
||||
ioctl(fd, DIOCWLABEL, &zero);
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
|
@ -17,7 +17,6 @@ __FBSDID("$FreeBSD$");
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/disklabel.h>
|
||||
#include <sys/diskslice.h>
|
||||
#include <sys/diskmbr.h>
|
||||
@ -93,8 +92,6 @@ Write_Disk(const struct disk *d1)
|
||||
struct dos_partition *dp,work[NDOSPART];
|
||||
int s[4];
|
||||
int need_edd = 0; /* Need EDD (packet interface) */
|
||||
int one = 1;
|
||||
int zero = 0;
|
||||
|
||||
strcpy(device,_PATH_DEV);
|
||||
strcat(device,d1->name);
|
||||
@ -107,7 +104,6 @@ Write_Disk(const struct disk *d1)
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
ioctl(fd, DIOCWLABEL, &one);
|
||||
|
||||
memset(s,0,sizeof s);
|
||||
mbr = read_block(fd, 0, d1->sector_size);
|
||||
@ -200,13 +196,6 @@ Write_Disk(const struct disk *d1)
|
||||
for(i = 1; i * d1->sector_size <= d1->bootmgr_size; i++)
|
||||
write_block(fd, i, &d1->bootmgr[i * d1->sector_size], d1->sector_size);
|
||||
|
||||
i = 1;
|
||||
i = ioctl(fd, DIOCSYNCSLICEINFO, &i);
|
||||
#ifdef DEBUG
|
||||
if (i != 0)
|
||||
warn("ioctl(DIOCSYNCSLICEINFO)");
|
||||
#endif
|
||||
ioctl(fd, DIOCWLABEL, &zero);
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
|
@ -71,8 +71,6 @@ Write_Disk(const struct disk *d1)
|
||||
struct dos_partition *dp,work[NDOSPART];
|
||||
int s[7];
|
||||
int PC98_EntireDisk = 0;
|
||||
int one = 1;
|
||||
int zero = 0;
|
||||
|
||||
strcpy(device,_PATH_DEV);
|
||||
strcat(device,d1->name);
|
||||
@ -90,7 +88,6 @@ Write_Disk(const struct disk *d1)
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
ioctl(fd, DIOCWLABEL, &one);
|
||||
|
||||
memset(s,0,sizeof s);
|
||||
mbr = read_block(fd, 1, d1->sector_size);
|
||||
@ -173,13 +170,6 @@ Write_Disk(const struct disk *d1)
|
||||
for (i = 0; i * d1->sector_size < d1->bootmenu_size; i++)
|
||||
write_block(fd, 2 + i, &d1->bootmenu[i * d1->sector_size], d1->sector_size);
|
||||
|
||||
i = 1;
|
||||
i = ioctl(fd, DIOCSYNCSLICEINFO, &i);
|
||||
#ifdef DEBUG
|
||||
if (i != 0)
|
||||
warn("ioctl(DIOCSYNCSLICEINFO)");
|
||||
#endif
|
||||
ioctl(fd, DIOCWLABEL, &zero);
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user