From victor@alf.dyndns.ws  Fri Sep 19 15:19:54 2003
Return-Path: <victor@alf.dyndns.ws>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 67D6016A4B3
	for <FreeBSD-gnats-submit@freebsd.org>; 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 <FreeBSD-gnats-submit@freebsd.org>; 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 <FreeBSD-gnats-submit@freebsd.org>; 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 <victor@alf.dyndns.ws>
Reply-To: Victor Balada Diaz <victor@alf.dyndns.ws>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [PATCH] There is no way to know the label of a cdrom
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         57026
>Category:       bin
>Synopsis:       [PATCH] mount_cd9660(8): there is no way to know the label of a cdrom
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Sep 19 15:30:22 PDT 2003
>Closed-Date:    Mon May 15 06:29:13 GMT 2006
>Last-Modified:  Mon May 15 06:29:13 GMT 2006
>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 <sys/param.h>
 #include <sys/mount.h>
 #include <sys/../isofs/cd9660/cd9660_mount.h>
+#include <isofs/cd9660/iso.h>
+#include <sys/types.h>
 
 #include <arpa/inet.h>
 
@@ -67,6 +69,7 @@
 #include <string.h>
 #include <sysexits.h>
 #include <unistd.h>
+#include <fcntl.h>
 
 #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:
State-Changed-From-To: open->closed 
State-Changed-By: rodrigc 
State-Changed-When: Mon May 15 06:28:13 UTC 2006 
State-Changed-Why:  
The isoinfo tool in the sysutils/cdrtools port 
is a better tool for getting the CD label, rather than modifying  
mount_cd9660. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=57026 
>Unformatted:
