[98502] in RedHat Linux List
Re: Volume ID
daemon@ATHENA.MIT.EDU (Fred Smith)
Mon Nov 9 13:39:50 1998
Date: Mon, 9 Nov 1998 07:01:05 -0500
From: Fred Smith <fredex@fcshome.stoneham.ma.us>
To: RedHat List <redhat-list@redhat.com>
Mail-Followup-To: RedHat List <redhat-list@redhat.com>
In-Reply-To: <36466A23.BE4A672@adelphia.net>; from Randy Smith on Mon, Nov 09, 1998 at 04:05:55AM +0000
Resent-From: redhat-list@redhat.com
Reply-To: redhat-list@redhat.com
On Mon, Nov 09, 1998 at 04:05:55AM +0000, Randy Smith wrote:
> Hello,
> I am trying to figure out how to look at the volume ID (label) on a
> cdrom. How is this done?
> Thanks!
> Randy
There might be an "officially sanctioned" way to do it, but if so I
have no clue.
However, below is a quick hack of a kludge I wrote a few years ago that
seems to work, at least it does on all the (few) CDs I've tried it with.
good luck. Note that I make no warranties, and will accept no liability
based on what you may do (or not do) with this thing.
Fred
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
int main (int argc, char ** argv)
{
int fd;
char buf[12];
if (argc != 2)
{
printf ("Usage: %s <cdrom devicename>\n", argv[0]);
exit (0);
}
fd = open (argv[1], O_RDONLY);
if (fd < 0)
{
printf ("oops! Error opening device %s\n", argv[1]);
exit (1);
}
if (lseek (fd, (long) 0x8028, SEEK_SET) != (long) 0x8028)
{
printf ("oops! Error seeking device %s\n", argv[1]);
exit (1);
}
if (read (fd, buf, 11) != 11)
{
printf ("oops! Error reading device %s\n", argv[1]);
exit (1);
}
close (fd);
printf ("Volume name in device %s: %s\n", argv[1], buf);
return (0);
}
--
-------------------------------------------------------------------------------
.---- Fred Smith /
( /__ ,__. __ __ / __ : /
/ / / /__) / / /__) .+' Home: fredex@fcshome.stoneham.ma.us
/ / (__ (___ (__(_ (___ / :__ 781-438-5471
-------------------------------- Jude 1:24,25 ---------------------------------
--
PLEASE read the Red Hat FAQ, Tips, Errata and the MAILING LIST ARCHIVES!
http://www.redhat.com http://archive.redhat.com
To unsubscribe: mail redhat-list-request@redhat.com with
"unsubscribe" as the Subject.