From owner-freebsd-geom@FreeBSD.ORG Tue Jul 26 19:35:07 2005 Return-Path: X-Original-To: geom@freebsd.org Delivered-To: freebsd-geom@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D125216A420 for ; Tue, 26 Jul 2005 19:35:07 +0000 (GMT) (envelope-from saturnero@freesbie.org) Received: from jail1-fbsd4.consiagnet.it (jail1-fbsd4.consiagnet.it [83.149.128.151]) by mx1.FreeBSD.org (Postfix) with ESMTP id 01ED143D46 for ; Tue, 26 Jul 2005 19:35:07 +0000 (GMT) (envelope-from saturnero@freesbie.org) Received: from [192.168.0.2] (host46-147.pool8254.interbusiness.it [82.54.147.46]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by jail1-fbsd4.consiagnet.it (Postfix) with ESMTP id 841F057CB for ; Tue, 26 Jul 2005 21:35:05 +0200 (CEST) Message-ID: <42E6903D.1040107@freesbie.org> Date: Tue, 26 Jul 2005 21:34:21 +0200 From: Dario Freni User-Agent: Mozilla Thunderbird 1.0.2 (Macintosh/20050317) X-Accept-Language: it, it-it, en-us, en MIME-Version: 1.0 To: geom@freebsd.org X-Enigmail-Version: 0.92.0.0 OpenPGP: url=http://www.saturnero.net/saturnero.asc Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig0F5AD16DD9F19E3956926799" Cc: Subject: CALL FOR TESTERS: geom_vol_cd9660 class X-BeenThere: freebsd-geom@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: GEOM-specific discussions and implementations List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jul 2005 19:35:07 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig0F5AD16DD9F19E3956926799 Content-Type: multipart/mixed; boundary="------------060801090004070600080406" This is a multi-part message in MIME format. --------------060801090004070600080406 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Hi everybody. I worked on a geom_vol_cd9660 class that acts like the geom_vol_ffs one, with cd9660 image. Although the actual code doesn't cover every possible type of images, this works fine for me. Can anybody test it and report here the results? Inserting an ISO9660 CD or attaching and md vnode pointing to an ISO image should create a /dev/vol/${LABEL} device, which can be used to mount it instead of /dev/acd0 or whatever. Hints and corrections are greatly appreciated, as this is my first attempt with a geom class (and also with devices issues) Bye and thanks in advance, Dario -- Dario Freni (saturnero@freesbie.org) FreeSBIE developer (http://www.freesbie.org) GPG Public key at http://www.saturnero.net/saturnero.asc --------------060801090004070600080406 Content-Type: text/plain; x-mac-type="54455854"; x-mac-creator="74657874"; name="geom_vol_cd9660.c" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="geom_vol_cd9660.c" /*- * Copyright (c) 2005 Dario Freni * 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. */ #include __FBSDID("$FreeBSD$"); #include #include #include #include #include #include #include #include #include #include #include #define VOL_CD9660_CLASS_NAME "VOL_CD9660" struct g_vol_cd9660_softc { char * vol; }; static int g_vol_cd9660_start(struct bio *bp __unused) { return(0); } static struct g_geom * g_vol_cd9660_taste(struct g_class *mp, struct g_provider *pp, int flags) { void *buf; char volname[32]; char *s; struct g_geom *gp; struct g_consumer *cp; struct g_vol_cd9660_softc *ms; int error, high_sierra=0; struct iso_volume_descriptor *vdp; struct iso_primary_descriptor *pri; struct iso_sierra_primary_descriptor *pri_sierra; g_trace(G_T_TOPOLOGY, "vol_taste(%s,%s)", mp->name, pp->name); g_topology_assert(); /* Avoid recursion */ if (flags == G_TF_NORMAL && !strcmp(pp->geom->class->name, VOL_CD9660_CLASS_NAME)) return NULL; gp = g_slice_new(mp, 1, pp, &cp, &ms, sizeof(*ms), g_vol_cd9660_start); if (gp == NULL) return (NULL); g_topology_unlock(); buf = NULL; buf = g_read_data(cp, ((off_t) 16) <<11, ISO_DEFAULT_BLOCK_SIZE, &error); if (buf == NULL || error != 0) goto end; vdp = (struct iso_volume_descriptor *) buf; if (strncmp (vdp->id, ISO_STANDARD_ID, sizeof(ISO_STANDARD_ID) - 1) != 0) { /* Untested with sierra images */ if (strncmp (vdp->id_sierra, ISO_SIERRA_ID, sizeof(ISO_SIERRA_ID) - 1) != 0) goto end; else high_sierra = 1; } switch (isonum_711 (high_sierra? vdp->type_sierra: vdp->type)) { case ISO_VD_PRIMARY: if (high_sierra) { pri_sierra = (struct iso_sierra_primary_descriptor *) vdp; s = pri_sierra->volume_id; } else { pri = (struct iso_primary_descriptor *) vdp; s = pri->volume_id; } bzero(volname,32); for (int i=0; i < 32 && *s; i++) { if (s[i] == ' ' || s[i] == '\0') break; volname[i] = s[i]; } /* Check for volume name */ if (volname[0] == '\0') goto end; break; /* XXX check for ISO_VD_SUPPLEMENTARY? */ default: break; } g_topology_lock(); g_slice_config(gp, 0, G_SLICE_CONFIG_SET, (off_t) 0, pp->mediasize, pp->sectorsize, "vol/%s", volname); g_free(buf); g_topology_unlock(); end: g_topology_lock(); g_access(cp, -1, 0, 0); if (LIST_EMPTY(&gp->provider)) { g_slice_spoiled(cp); return (NULL); } return (gp); } static struct g_class g_vol_cd9660_class = { .name = VOL_CD9660_CLASS_NAME, .version = G_VERSION, .taste = g_vol_cd9660_taste, }; DECLARE_GEOM_CLASS(g_vol_cd9660_class, g_vol_cd9660); --------------060801090004070600080406 Content-Type: text/plain; x-mac-type="0"; x-mac-creator="0"; name="Makefile" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="Makefile" # $FreeBSD$ CFLAGS+=-g KMOD= geom_vol_cd9660 SRCS= geom_vol_cd9660.c .include --------------060801090004070600080406-- --------------enig0F5AD16DD9F19E3956926799 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (Darwin) iD8DBQFC5pA9ymi72IiShysRAiqQAJ9u5JQa4tEfWAe0RO5Ju9EMwGz2BwCgiy1x 8giky9vKdS9bLhuKzZJ4/8Q= =Q/os -----END PGP SIGNATURE----- --------------enig0F5AD16DD9F19E3956926799--