From owner-freebsd-bugs@FreeBSD.ORG Fri Sep 19 15:30:24 2003 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E700D16A4B3 for ; Fri, 19 Sep 2003 15:30:23 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7AFF043FDD for ; Fri, 19 Sep 2003 15:30:22 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with ESMTP id h8JMUMFY068234 for ; Fri, 19 Sep 2003 15:30:22 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.9/8.12.9/Submit) id h8JMUMbd068233; Fri, 19 Sep 2003 15:30:22 -0700 (PDT) (envelope-from gnats) Resent-Date: Fri, 19 Sep 2003 15:30:22 -0700 (PDT) Resent-Message-Id: <200309192230.h8JMUMbd068233@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Victor Balada Diaz Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 67D6016A4B3 for ; Fri, 19 Sep 2003 15:19:54 -0700 (PDT) Received: from alf.dyndns.ws (244.Red-217-126-240.pooles.rima-tde.net [217.126.240.244]) by mx1.FreeBSD.org (Postfix) with ESMTP id CF80443FE1 for ; Fri, 19 Sep 2003 15:19:52 -0700 (PDT) (envelope-from victor@alf.dyndns.ws) Received: from alf.euesrg02.net (localhost [127.0.0.1]) by alf.dyndns.ws (8.12.8/8.12.8) with ESMTP id h8JMJoR2061895 for ; Sat, 20 Sep 2003 00:19:50 +0200 (CEST) (envelope-from victor@alf.euesrg02.net) Received: (from victor@localhost) by alf.euesrg02.net (8.12.8/8.12.8/Submit) id h8JMJns4061894; Sat, 20 Sep 2003 00:19:49 +0200 (CEST) Message-Id: <200309192219.h8JMJns4061894@alf.euesrg02.net> Date: Sat, 20 Sep 2003 00:19:49 +0200 (CEST) From: Victor Balada Diaz To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: bin/57026: [PATCH] Therer is no way to know the label of a cdrom X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Victor Balada Diaz List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Sep 2003 22:30:24 -0000 >Number: 57026 >Category: bin >Synopsis: [PATCH] Therer is no way to know the label of a cdrom >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Fri Sep 19 15:30:22 PDT 2003 >Closed-Date: >Last-Modified: >Originator: Victor Balada Diaz >Release: FreeBSD 5.1-CURRENT i386 >Organization: >Environment: System: FreeBSD amnesiac.euesrg02.net 5.1-CURRENT FreeBSD 5.1-CURRENT #5: Mon Sep 8 16:58:54 CEST 2003 victor@amnesiac.euesrg02.net:/usr/src/sys/i386/compile/MYKERNEL i386 >Description: I can't find any tool for read the cdrom label, and i think that could be usefull that the mount_cd9660(8) says the label when the cdrom is mounted >How-To-Repeat: >Fix: Apply the next patch to /usr/src/sbin/mount_cd9660/mount_cd9660.c v 1.21 --- mount.patch begins here --- --- /usr/src/sbin/mount_cd9660/mount_cd9660.c Wed Aug 21 20:10:55 2002 +++ mount_cd9660.c Mon Sep 15 17:03:02 2003 @@ -57,6 +57,8 @@ #include #include #include +#include +#include #include @@ -67,6 +69,7 @@ #include #include #include +#include #include "mntopts.h" @@ -172,7 +175,9 @@ } if (mount("cd9660", mntpath, mntflags, &args) < 0) - err(1, "%s", args.fspec); + err(1, "%s", args.fspec); + else + print_label(dev); exit(0); } @@ -225,3 +230,26 @@ return ntohl(toc_buffer[i].addr.lba); } + +int +print_label(const char *dev) +{ + struct iso_primary_descriptor *cdinfo; + int fd; + + if (( cdinfo=(void *)malloc(2048))==NULL) + return 1; + if (( fd = open(dev, O_RDONLY) ) == -1 ) + perror("open:"); + else{ + lseek(fd, (off_t)2048*16, SEEK_SET); + read(fd, cdinfo, 2048); + if ( cdinfo->volume_id==NULL ) + printf("The cd hasn't got a label"); + else + printf("The cd label is: %s\n", cdinfo->volume_id); + } + return 0; +} + + --- mount.patch ends here --- >Release-Note: >Audit-Trail: >Unformatted: