Date: Sat, 20 Sep 2003 00:19:49 +0200 (CEST) From: Victor Balada Diaz <victor@alf.dyndns.ws> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/57026: [PATCH] Therer is no way to know the label of a cdrom Message-ID: <200309192219.h8JMJns4061894@alf.euesrg02.net> Resent-Message-ID: <200309192230.h8JMUMbd068233@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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 <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: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200309192219.h8JMJns4061894>