summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorKirk McKusick <mckusick@FreeBSD.org>2017-08-24 21:44:23 +0000
committerKirk McKusick <mckusick@FreeBSD.org>2017-08-24 21:44:23 +0000
commit2ef8c9b479445bd08b5033225fcc41dc4f478999 (patch)
treee3258b205c3cffde490a1746483c3f1587f4222f /sys
parent8a79f020049f65a753738038a7f2f59ba891482d (diff)
Notes
Diffstat (limited to 'sys')
-rw-r--r--sys/geom/geom_bsd.c92
-rw-r--r--sys/sys/disklabel.h7
-rw-r--r--sys/ufs/ffs/fs.h14
3 files changed, 16 insertions, 97 deletions
diff --git a/sys/geom/geom_bsd.c b/sys/geom/geom_bsd.c
index 5742509f7810..6cb65cd0366c 100644
--- a/sys/geom/geom_bsd.c
+++ b/sys/geom/geom_bsd.c
@@ -305,8 +305,8 @@ g_bsd_hotwrite(void *arg, int flag)
gsp = gp->softc;
ms = gsp->softc;
gsl = &gsp->slices[bp->bio_to->index];
- p = (u_char*)bp->bio_data + ms->labeloffset
- - (bp->bio_offset + gsl->offset);
+ p = (u_char*)bp->bio_data + ms->labeloffset -
+ (bp->bio_offset + gsl->offset);
error = g_bsd_modify(gp, p);
if (error) {
g_io_deliver(bp, EPERM);
@@ -315,93 +315,6 @@ g_bsd_hotwrite(void *arg, int flag)
g_slice_finish_hot(bp);
}
-/*-
- * This start routine is only called for non-trivial requests, all the
- * trivial ones are handled autonomously by the slice code.
- * For requests we handle here, we must call the g_io_deliver() on the
- * bio, and return non-zero to indicate to the slice code that we did so.
- * This code executes in the "DOWN" I/O path, this means:
- * * No sleeping.
- * * Don't grab the topology lock.
- * * Don't call biowait, g_getattr(), g_setattr() or g_read_data()
- */
-static int
-g_bsd_ioctl(struct g_provider *pp, u_long cmd, void *data, int fflag, struct thread *td)
-{
- struct g_geom *gp;
- struct g_bsd_softc *ms;
- struct g_slicer *gsp;
- u_char *label;
- int error;
-
- gp = pp->geom;
- gsp = gp->softc;
- ms = gsp->softc;
-
- switch(cmd) {
- case DIOCGDINFO:
- /* Return a copy of the disklabel to userland. */
- bsd_disklabel_le_dec(ms->label, data, MAXPARTITIONS);
- return(0);
- case DIOCBSDBB: {
- struct g_consumer *cp;
- u_char *buf;
- void *p;
- int error, i;
- uint64_t sum;
-
- if (!(fflag & FWRITE))
- return (EPERM);
- /* The disklabel to set is the ioctl argument. */
- buf = g_malloc(BBSIZE, M_WAITOK);
- p = *(void **)data;
- error = copyin(p, buf, BBSIZE);
- if (!error) {
- /* XXX: Rude, but supposedly safe */
- DROP_GIANT();
- g_topology_lock();
- /* Validate and modify our slice instance to match. */
- error = g_bsd_modify(gp, buf + ms->labeloffset);
- if (!error) {
- cp = LIST_FIRST(&gp->consumer);
- if (ms->labeloffset == ALPHA_LABEL_OFFSET) {
- sum = 0;
- for (i = 0; i < 63; i++)
- sum += le64dec(buf + i * 8);
- le64enc(buf + 504, sum);
- }
- error = g_write_data(cp, 0, buf, BBSIZE);
- }
- g_topology_unlock();
- PICKUP_GIANT();
- }
- g_free(buf);
- return (error);
- }
- case DIOCSDINFO:
- case DIOCWDINFO: {
- if (!(fflag & FWRITE))
- return (EPERM);
- label = g_malloc(LABELSIZE, M_WAITOK);
- /* The disklabel to set is the ioctl argument. */
- bsd_disklabel_le_enc(label, data);
-
- DROP_GIANT();
- g_topology_lock();
- /* Validate and modify our slice instance to match. */
- error = g_bsd_modify(gp, label);
- if (error == 0 && cmd == DIOCWDINFO)
- error = g_bsd_writelabel(gp, NULL);
- g_topology_unlock();
- PICKUP_GIANT();
- g_free(label);
- return(error);
- }
- default:
- return (ENOIOCTL);
- }
-}
-
static int
g_bsd_start(struct bio *bp)
{
@@ -698,7 +611,6 @@ static struct g_class g_bsd_class = {
.taste = g_bsd_taste,
.ctlreq = g_bsd_config,
.dumpconf = g_bsd_dumpconf,
- .ioctl = g_bsd_ioctl,
};
DECLARE_GEOM_CLASS(g_bsd_class, g_bsd);
diff --git a/sys/sys/disklabel.h b/sys/sys/disklabel.h
index c3501e0d148f..5ec9240f7c11 100644
--- a/sys/sys/disklabel.h
+++ b/sys/sys/disklabel.h
@@ -284,15 +284,8 @@ static const char *fstypenames[] = {
#define D_CHAIN 0x10 /* can do back-back transfers */
/*
- * Disklabel-specific ioctls.
- *
* NB: <sys/disk.h> defines ioctls from 'd'/128 and up.
*/
- /* get and set disklabel */
-#define DIOCGDINFO _IOR('d', 101, struct disklabel)/* get */
-#define DIOCSDINFO _IOW('d', 102, struct disklabel)/* set */
-#define DIOCWDINFO _IOW('d', 103, struct disklabel)/* set, update disk */
-#define DIOCBSDBB _IOW('d', 110, void *) /* write bootblocks */
/*
* Functions for proper encoding/decoding of struct disklabel into/from
diff --git a/sys/ufs/ffs/fs.h b/sys/ufs/ffs/fs.h
index 835a8f9a5ea6..bb54ff7a9964 100644
--- a/sys/ufs/ffs/fs.h
+++ b/sys/ufs/ffs/fs.h
@@ -234,6 +234,20 @@ struct fsck_cmd {
};
/*
+ * A recovery structure placed at the end of the boot block area by newfs
+ * that can be used by fsck to search for alternate superblocks.
+ */
+#define RESID (4096 - 20) /* disk sector size minus recovery area size */
+struct fsrecovery {
+ char block[RESID]; /* unused part of sector */
+ int32_t fsr_magic; /* magic number */
+ int32_t fsr_fsbtodb; /* fsbtodb and dbtofsb shift constant */
+ int32_t fsr_sblkno; /* offset of super-block in filesys */
+ int32_t fsr_fpg; /* blocks per group * fs_frag */
+ u_int32_t fsr_ncg; /* number of cylinder groups */
+};
+
+/*
* Per cylinder group information; summarized in blocks allocated
* from first cylinder group data blocks. These blocks have to be
* read in from fs_csaddr (size fs_cssize) in addition to the