From nobody Sun Jan 14 21:22:38 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4TCpC41ZHLz579Kx; Sun, 14 Jan 2024 21:22:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TCpC33cn4z47jh; Sun, 14 Jan 2024 21:22:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705267359; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=V+1C28rOfFAuLD5uj2tZwjW47QtCo2E6WiQ53s9MxvA=; b=aramRFYyjBaadUj4U+H3e78NU5VGEoHY29E2russit9Hcyfpk12CmqNtiA3RlOc2s5Lb9V c6yBQ2Jwjl1s0lz1L5IINKkK0o+GN/Z5Nm93k/I13j4wh5SAQc4Sytl7LAmZR7FBSsHL14 mDKp3+e8fo2jZF0bZTu66ZLHmszuKxSSJVLbP6VnZgA568FIlubZqSXAKCZL8euAwwLHRD saFM6tF0/2SKP6z8QzO/mhW22qmJDR1rJ+EEX5wTjMoVOr3yEtQiZqi/7JeTusuojNMSNm 2AxJyhLCe4Tr1ZSO30l7iq58ZcEKvWl9hF8zlwtJ7LGUS8g+4kotNB5pJYRFUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705267359; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=V+1C28rOfFAuLD5uj2tZwjW47QtCo2E6WiQ53s9MxvA=; b=tqxBdAbkA6mOxwEAnvVDMl2+MBhzo6IQ7PET6qFVXtw/BUg1/1M/ROGWKvaR12PoIAVk2r ntNSgZEa6WTre+cHcSj+0itwGUzeuLTNILGmtCGm2oWEWUeKVzZLQrCSyOVlHE79ksYivP tYi9jD0ghcc2OXQsMADLFa24HLJ/EASkjUU3DIt9or3pM4E8CJpg3QggE531oYVYZauhcV zosBxC0zr4OfLrQE+4etAK2F4Aby0ye+NzBRWKUm54THRRPOI/eXSv3Pm5sPghLNH0ppMW fzYU8Cp2pvdjPKHnPRRNHdMXUCOgT2Dt10khvXNt9BF/orDgDJAXbk7urPGrlg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1705267359; a=rsa-sha256; cv=none; b=NGhznGXMoPhgmy2ABSqT+Zd0lOwOUWdOAvhFYPIr7PtNigKvbRYo8h3o0HMYx7UJFxTE1j 5D8Ilaj3UHMEYniDU6/j9LE2z7oeviP414XlGJJdEmpKYsGiouxOTGBRJiyYYPGp10jcEv bh2mK0wUaa2tAkhYb8tfxZv4f5IWSOm07HwT4WUYytE8U/tff47jvSJHT9C3X7V83JYM2+ q3prGYTRrsxjuvNt0w+sZ5Kj/xf2OsuQeu6PSwZNCXM3EtRIaS0zTFSAK6ieKOs3L/+xTo iIXSmR2sD5BwC8A9R9VYcWTTWL1EsvQ/gaNvmM5x/uip/cPtgDv//I3puGJZog== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4TCpC320Z0zVGd; Sun, 14 Jan 2024 21:22:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 40ELMcWr091089; Sun, 14 Jan 2024 21:22:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40ELMcUK091086; Sun, 14 Jan 2024 21:22:38 GMT (envelope-from git) Date: Sun, 14 Jan 2024 21:22:38 GMT Message-Id: <202401142122.40ELMcUK091086@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marius Strobl Subject: git: 03e8d25b1f92 - main - geom_map(4): Garbage collect disconnected driver List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: marius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 03e8d25b1f9218dcd52d13819dda14dbbaf622b7 Auto-Submitted: auto-generated The branch main has been updated by marius: URL: https://cgit.FreeBSD.org/src/commit/?id=03e8d25b1f9218dcd52d13819dda14dbbaf622b7 commit 03e8d25b1f9218dcd52d13819dda14dbbaf622b7 Author: Marius Strobl AuthorDate: 2024-01-14 08:31:26 +0000 Commit: Marius Strobl CommitDate: 2024-01-14 21:22:21 +0000 geom_map(4): Garbage collect disconnected driver The last MIPS user has been removed in c09981f1 2 years ago, the last ARM one in 58d5c511 even 5.5 years ago. --- ObsoleteFiles.inc | 3 + share/man/man4/Makefile | 1 - share/man/man4/geom_map.4 | 209 -------------------- sys/conf/files | 1 - sys/geom/geom_map.c | 392 ------------------------------------- sys/modules/geom/geom_map/Makefile | 7 - 6 files changed, 3 insertions(+), 610 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 7265d0a19741..a6c15187e847 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -51,6 +51,9 @@ # xargs -n1 | sort | uniq -d; # done +# 20240114: Removal of geom_map(4) +OLD_FILES+=usr/share/man/man4/geom_map.4 + # 20240112: remove pmap_init2() OLD_FILES+=usr/share/man/man9/pmap_init2.9.gz diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index e1191eedebe5..978ec6887f85 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -170,7 +170,6 @@ MAN= aac.4 \ genetlink.4 \ geom.4 \ geom_linux_lvm.4 \ - geom_map.4 \ geom_uzip.4 \ gif.4 \ ${_gve.4} \ diff --git a/share/man/man4/geom_map.4 b/share/man/man4/geom_map.4 deleted file mode 100644 index 5ae49500d6a9..000000000000 --- a/share/man/man4/geom_map.4 +++ /dev/null @@ -1,209 +0,0 @@ -.\" -.\" Copyright (c) 2011 Aleksandr Rybalko -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.Dd June 8, 2015 -.Dt GEOM_MAP 4 -.Os -.Sh NAME -.Nm geom_map -.Nd "GEOM module that maps defined items as separate partitions" -.Sh SYNOPSIS -To compile this driver into the kernel, -place the following line in your -kernel configuration file: -.Bd -ragged -offset indent -.Cd "options geom_map" -.Ed -.Sh DESCRIPTION -The -.Nm -framework provides support for mapping defined parts of the media. -Basically it is helpful for embedded devices where in the one continuous -flash are loader, kernel and rootfs parts. -.Nm -allows making them available as separate parts and protects the loader from -being overwritten. -.Pp -At boot time -.Nm -partitions are listed (only with bootverbose) as: -.Bd -literal -offset indent -MAP: 0x30000, data=0x30000 "/dev/map/bootloader" -MAP: 30000x10000, data=0x10000 "/dev/map/factory" -MAP: 40000x7a0000, data=0x7a0000 "/dev/map/upgrade" -MAP: search key ".!/bin/sh" from 0x100000, step 0x10000 -MAP: 40000x110000, data=0x110000 "/dev/map/kernel" -MAP: search key ".!/bin/sh" from 0x100000, step 0x10000 -MAP: 150000x690000, data=0x690000 "/dev/map/rootfs" -MAP: 7e0000x20000, data=0x20000 "/dev/map/config" -.Ed -.Pp -The current -.Nm -configuration can be accessed with the following -.Xr sysctl 8 -nodes: -.Va kern.geom.conftxt , kern.geom.confxml , -and -.Va kern.geom.confdot -or by using -.Dq Li "geom map list" . -.Bd -literal -offset indent -# sysctl -n kern.geom.conftxt -0 MD md0 10485760 512 u 0 s 512 f 0 fs 0 l 10485760 t malloc -0 DISK cfid0 8388608 4 hd 0 sc 0 -1 MAP map/config 131072 4 i 5 o 8257536 entry 0 dsize 131072 -1 MAP map/rootfs 6881280 4 i 4 o 1376256 entry 0 dsize 6881280 -2 UZIP map/rootfs.uzip 18677760 512 -1 MAP map/kernel 1114112 4 i 3 o 262144 entry 0 dsize 1114112 -1 MAP map/upgrade 7995392 4 i 2 o 262144 entry 0 dsize 7995392 -1 MAP map/factory 65536 4 i 1 o 196608 entry 0 dsize 65536 -1 MAP map/bootloader 196608 4 i 0 o 0 entry 0 dsize 196608 -.Ed -.Pp -Driver configuration can be done in -.Xr device.hints 5 . -List of used parameters: -.Bl -tag -width indent -.It Va at -select media to attach -.It Va name -name of partition (will create device -.Pa /dev/map/ Ns Ar that_name ) -.It Va start -offset from the beginning of the parent media to start of the mapped partition. -This field can also have a special value -.Qq Li search: Ns Ar searchstart Ns Li : Ns Ar searchstep Ns Li : Ns Ar searchkey , -where: -.Bl -tag -width indent -.It Ar searchstart -offset from the beginning of the parent media where search will be started -.It Ar searchstep -value of the increment used while searching for the partition boundary markers -.It Ar searchkey -key which will be used to find partition boundary markers. -The wildcard -.Ql .\& -can be used to match any character on that position -.El -.It Va end -offset from the beginning of the parent media to the end of the mapped partition. -This field can also have the special value -.Qq Li search: Ns Ar searchstart Ns Li : Ns Ar searchstep Ns Li : Ns Ar searchkey , -as described above. -.It Va offset -offset where the data of the mapped partition begins -.El -.Pp -Each record contains the start address (in bytes) from the media begin, size -(in bytes), offset where the data of mapped partition begins, and the name of -new device. -.Bd -literal -offset indent -MAP: 150000x690000, data=0x690000 "/dev/map/rootfs" -.Ed -.Bd -literal -00150000 - start address -00690000 - size -00000000 - data begin from zero offset -00690000 - data size -"map/rootfs" - new media will be accessible via /dev/map/rootfs dev. -.Ed -.Sh EXAMPLES -If we need to implement layout shown above, we need to define the following -hints: -.Bd -literal -offset indent -hint.map.0.at="cfid0" -hint.map.0.start=0x00000000 -hint.map.0.end=0x00030000 -hint.map.0.name="bootloader" -hint.map.0.readonly=1 -.Ed -.Pp -This defines -.Pa /dev/map/bootloader -at disk -.Pa cfid0 -starting at -.Li 0x00000000 -and ending at -.Li 0x00030000 , -it is also marked as readonly. -.Bd -literal -offset indent -hint.map.1.at="cfid0" -hint.map.1.start=0x00030000 -hint.map.1.end=0x00040000 -hint.map.1.name="factory" - -hint.map.2.at="cfid0" -hint.map.2.start=0x00040000 -hint.map.2.end=0x007e0000 -hint.map.2.name="upgrade" - -hint.map.3.at="cfid0" -hint.map.3.name="kernel" -hint.map.3.start=0x00040000 -hint.map.3.end="search:0x00100000:0x10000:.!/bin/sh" -.Ed -.Pp -This defines -.Pa /dev/map/kernel -at disk -.Pa cfid0 -starting at -.Li 0x00040000 , -but the end position must be searched by finding the key -.Dq Li ".!/bin/sh" , -from offset -.Li 0x00100000 -to the end of media with step -.Li 0x10000 . -The real marker in this case is -.Dq Li "#!/bin/sh" , -but -.Ql # -terminates the line when the hints file is parsed, so we need to use wildcard -.Ql .\& -instead of -.Ql # . -.Bd -literal -offset indent -hint.map.4.at="cfid0" -hint.map.4.name="rootfs" -hint.map.4.start="search:0x00100000:0x10000:.!/bin/sh" -hint.map.4.end=0x007e0000 - -hint.map.5.at="cfid0" -hint.map.5.start=0x007e0000 -hint.map.5.end=0x00800000 -hint.map.5.name="config" -.Ed -.Sh SEE ALSO -.Xr geom 4 , -.Xr geom 8 , -.Xr sysctl 8 -.Sh AUTHORS -The -.Nm -driver was written by -.An Aleksandr Rybalko Aq Mt ray@ddteam.net . diff --git a/sys/conf/files b/sys/conf/files index 6a089de5bb98..1069079b162a 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -3618,7 +3618,6 @@ geom/geom_event.c standard geom/geom_flashmap.c optional fdt cfi | fdt mx25l | mmcsd | fdt n25q | fdt at45d geom/geom_io.c standard geom/geom_kern.c standard -geom/geom_map.c optional geom_map geom/geom_redboot.c optional geom_redboot geom/geom_slice.c standard geom/geom_subr.c standard diff --git a/sys/geom/geom_map.c b/sys/geom/geom_map.c deleted file mode 100644 index 65c313fcfa0c..000000000000 --- a/sys/geom/geom_map.c +++ /dev/null @@ -1,392 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2010-2011 Aleksandr Rybalko - * based on geom_redboot.c - * Copyright (c) 2009 Sam Leffler, Errno Consulting - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any - * redistribution must be conditioned upon including a substantially - * similar Disclaimer requirement for further binary redistribution. - * - * NO WARRANTY - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, - * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGES. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#define MAP_CLASS_NAME "MAP" -#define MAP_MAXSLICE 64 -#define MAP_MAX_MARKER_LEN 64 - -struct g_map_softc { - off_t offset[MAP_MAXSLICE]; /* offset in flash */ - off_t size[MAP_MAXSLICE]; /* image size in bytes */ - off_t entry[MAP_MAXSLICE]; - off_t dsize[MAP_MAXSLICE]; - uint8_t readonly[MAP_MAXSLICE]; - g_access_t *parent_access; -}; - -static int -g_map_access(struct g_provider *pp, int dread, int dwrite, int dexcl) -{ - struct g_geom *gp; - struct g_slicer *gsp; - struct g_map_softc *sc; - - gp = pp->geom; - gsp = gp->softc; - sc = gsp->softc; - - if (dwrite > 0 && sc->readonly[pp->index]) - return (EPERM); - - return (sc->parent_access(pp, dread, dwrite, dexcl)); -} - -static int -g_map_start(struct bio *bp) -{ - struct g_provider *pp; - struct g_geom *gp; - struct g_map_softc *sc; - struct g_slicer *gsp; - int idx; - - pp = bp->bio_to; - idx = pp->index; - gp = pp->geom; - gsp = gp->softc; - sc = gsp->softc; - - if (bp->bio_cmd == BIO_GETATTR) { - if (g_handleattr_int(bp, MAP_CLASS_NAME "::entry", - sc->entry[idx])) { - return (1); - } - if (g_handleattr_int(bp, MAP_CLASS_NAME "::dsize", - sc->dsize[idx])) { - return (1); - } - } - - return (0); -} - -static void -g_map_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, - struct g_consumer *cp __unused, struct g_provider *pp) -{ - struct g_map_softc *sc; - struct g_slicer *gsp; - - gsp = gp->softc; - sc = gsp->softc; - g_slice_dumpconf(sb, indent, gp, cp, pp); - if (pp != NULL) { - if (indent == NULL) { - sbuf_printf(sb, " entry %jd", (intmax_t)sc->entry[pp->index]); - sbuf_printf(sb, " dsize %jd", (intmax_t)sc->dsize[pp->index]); - } else { - sbuf_printf(sb, "%s%jd\n", indent, - (intmax_t)sc->entry[pp->index]); - sbuf_printf(sb, "%s%jd\n", indent, - (intmax_t)sc->dsize[pp->index]); - } - } -} - -static int -find_marker(struct g_consumer *cp, const char *line, off_t *offset) -{ - off_t search_start, search_offset, search_step; - size_t sectorsize; - uint8_t *buf; - char *op, key[MAP_MAX_MARKER_LEN], search_key[MAP_MAX_MARKER_LEN]; - int ret, c; - - /* Try convert to numeric first */ - *offset = strtouq(line, &op, 0); - if (*op == '\0') - return (0); - - bzero(search_key, MAP_MAX_MARKER_LEN); - sectorsize = cp->provider->sectorsize; - -#ifdef __LP64__ - ret = sscanf(line, "search:%li:%li:%63c", - &search_start, &search_step, search_key); -#else - ret = sscanf(line, "search:%qi:%qi:%63c", - &search_start, &search_step, search_key); -#endif - if (ret < 3) - return (1); - - if (bootverbose) { - printf("MAP: search %s for key \"%s\" from 0x%jx, step 0x%jx\n", - cp->geom->name, search_key, (intmax_t)search_start, (intmax_t)search_step); - } - - /* error if search_key is empty */ - if (strlen(search_key) < 1) - return (1); - - /* sscanf successful, and we start marker search */ - for (search_offset = search_start; - search_offset < cp->provider->mediasize; - search_offset += search_step) { - g_topology_unlock(); - buf = g_read_data(cp, rounddown(search_offset, sectorsize), - roundup(strlen(search_key), sectorsize), NULL); - g_topology_lock(); - - /* - * Don't bother doing the rest if buf==NULL; eg derefencing - * to assemble 'key'. - */ - if (buf == NULL) - continue; - - /* Wildcard, replace '.' with byte from data */ - /* TODO: add support wildcard escape '\.' */ - - strncpy(key, search_key, MAP_MAX_MARKER_LEN); - - for (c = 0; c < MAP_MAX_MARKER_LEN && key[c]; c++) { - if (key[c] == '.') { - key[c] = ((char *)(buf + - (search_offset % sectorsize)))[c]; - } - } - - /* Assume buf != NULL here */ - if (memcmp(buf + search_offset % sectorsize, - key, strlen(search_key)) == 0) { - g_free(buf); - /* Marker found, so return their offset */ - *offset = search_offset; - return (0); - } - g_free(buf); - } - - /* Marker not found */ - return (1); -} - -static int -g_map_parse_part(struct g_class *mp, struct g_provider *pp, - struct g_consumer *cp, struct g_geom *gp, struct g_map_softc *sc, int i) -{ - const char *value, *name; - char *op; - off_t start, end, offset, size, dsize; - int readonly, ret; - - /* hint.map.0.at="cfid0" - bind to cfid0 media */ - if (resource_string_value("map", i, "at", &value) != 0) - return (1); - - /* Check if this correct provider */ - if (strcmp(pp->name, value) != 0) - return (1); - - /* - * hint.map.0.name="uboot" - name of partition, will be available - * as "/dev/map/uboot" - */ - if (resource_string_value("map", i, "name", &name) != 0) { - if (bootverbose) - printf("MAP: hint.map.%d has no name\n", i); - return (1); - } - - /* - * hint.map.0.start="0x00010000" - partition start at 0x00010000 - * or hint.map.0.start="search:0x00010000:0x200:marker text" - - * search for text "marker text", begin at 0x10000, step 0x200 - * until we found marker or end of media reached - */ - if (resource_string_value("map", i, "start", &value) != 0) { - if (bootverbose) - printf("MAP: \"%s\" has no start value\n", name); - return (1); - } - if (find_marker(cp, value, &start) != 0) { - if (bootverbose) { - printf("MAP: \"%s\" can't parse/use start value\n", - name); - } - return (1); - } - - /* like "start" */ - if (resource_string_value("map", i, "end", &value) != 0) { - if (bootverbose) - printf("MAP: \"%s\" has no end value\n", name); - return (1); - } - if (find_marker(cp, value, &end) != 0) { - if (bootverbose) { - printf("MAP: \"%s\" can't parse/use end value\n", - name); - } - return (1); - } - - /* variable readonly optional, disable write access */ - if (resource_int_value("map", i, "readonly", &readonly) != 0) - readonly = 0; - - /* offset of partition data, from partition begin */ - if (resource_string_value("map", i, "offset", &value) == 0) { - offset = strtouq(value, &op, 0); - if (*op != '\0') { - if (bootverbose) { - printf("MAP: \"%s\" can't parse offset\n", - name); - } - return (1); - } - } else { - offset = 0; - } - - /* partition data size */ - if (resource_string_value("map", i, "dsize", &value) == 0) { - dsize = strtouq(value, &op, 0); - if (*op != '\0') { - if (bootverbose) { - printf("MAP: \"%s\" can't parse dsize\n", - name); - } - return (1); - } - } else { - dsize = 0; - } - - size = end - start; - if (dsize == 0) - dsize = size - offset; - - /* end is 0 or size is 0, No MAP - so next */ - if (end < start) { - if (bootverbose) { - printf("MAP: \"%s\", \"end\" less than " - "\"start\"\n", name); - } - return (1); - } - - if (offset + dsize > size) { - if (bootverbose) { - printf("MAP: \"%s\", \"dsize\" bigger than " - "partition - offset\n", name); - } - return (1); - } - - ret = g_slice_config(gp, i, G_SLICE_CONFIG_SET, start + offset, - dsize, cp->provider->sectorsize, "map/%s", name); - if (ret != 0) { - if (bootverbose) { - printf("MAP: g_slice_config returns %d for \"%s\"\n", - ret, name); - } - return (1); - } - - if (bootverbose) { - printf("MAP: %s: %jxx%jx, data=%jxx%jx " - "\"/dev/map/%s\"\n", - cp->geom->name, (intmax_t)start, (intmax_t)size, (intmax_t)offset, - (intmax_t)dsize, name); - } - - sc->offset[i] = start; - sc->size[i] = size; - sc->entry[i] = offset; - sc->dsize[i] = dsize; - sc->readonly[i] = readonly ? 1 : 0; - - return (0); -} - -static struct g_geom * -g_map_taste(struct g_class *mp, struct g_provider *pp, int insist __unused) -{ - struct g_map_softc *sc; - struct g_consumer *cp; - struct g_geom *gp; - int i; - - g_trace(G_T_TOPOLOGY, "map_taste(%s,%s)", mp->name, pp->name); - g_topology_assert(); - if (strcmp(pp->geom->class->name, MAP_CLASS_NAME) == 0) - return (NULL); - - gp = g_slice_new(mp, MAP_MAXSLICE, pp, &cp, &sc, sizeof(*sc), - g_map_start); - if (gp == NULL) - return (NULL); - - /* interpose our access method */ - sc->parent_access = gp->access; - gp->access = g_map_access; - - for (i = 0; i < MAP_MAXSLICE; i++) - g_map_parse_part(mp, pp, cp, gp, sc, i); - - g_access(cp, -1, 0, 0); - if (LIST_EMPTY(&gp->provider)) { - if (bootverbose) - printf("MAP: No valid partition found at %s\n", pp->name); - g_slice_spoiled(cp); - return (NULL); - } - return (gp); -} - -static struct g_class g_map_class = { - .name = MAP_CLASS_NAME, - .version = G_VERSION, - .taste = g_map_taste, - .dumpconf = g_map_dumpconf, -}; -DECLARE_GEOM_CLASS(g_map_class, g_map); -MODULE_VERSION(geom_map, 0); diff --git a/sys/modules/geom/geom_map/Makefile b/sys/modules/geom/geom_map/Makefile deleted file mode 100644 index 85beccbf493e..000000000000 --- a/sys/modules/geom/geom_map/Makefile +++ /dev/null @@ -1,7 +0,0 @@ - -.PATH: ${SRCTOP}/sys/geom - -KMOD= geom_map -SRCS= geom_map.c bus_if.h device_if.h - -.include