This is a conceptual patch relative to cdrtools-1.10 which makes it
possible to use cdrecord together with Solaris 8 Volume Manager. There
is one unresolved issue though. Namely I expected vold to resense the
media and (re)mount newly burned filesystem after DKIOCSGEOM, but it
doesn't do that with CD-ROMs:-( So that at this point you have to issue
'eject cdrom' after you burned it and push the tray back in order to
get it mounted. "At this point" in the last sentence means that I
intend to file a bug report to Sun.
All warranties are disclaimed, use it on your own risk.
Andy Polyakov <[EMAIL PROTECTED]>
*** ./RULES/sun4-sunos5-cc.rul.orig Sun Feb 4 22:29:58 2001
--- ./RULES/sun4-sunos5-cc.rul Fri Oct 26 14:14:58 2001
***************
*** 28,34 ****
LINTFLAGS= -Nlevel=4
! OSDEFS= -D__SVR4 -DSVR4
CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS)
COPTS= -Xa
CWOPTS= -v
--- 28,34 ----
LINTFLAGS= -Nlevel=4
! OSDEFS= -D__SVR4 -DSVR4 -DSOLARIS_VOLMGT
CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS)
COPTS= -Xa
CWOPTS= -v
***************
*** 48,54 ****
LIBS_PATH= -L$(OLIBSDIR)
LDFLAGS= $(LDOPTS) $(LDOPTX)
! LDLIBS= $(LIBS) $(LIBX)
LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH)
LDOPTDYN= -dy -G -ztext -h $(TARGET) -ldl
--- 48,54 ----
LIBS_PATH= -L$(OLIBSDIR)
LDFLAGS= $(LDOPTS) $(LDOPTX)
! LDLIBS= $(LIBS) $(LIBX) -lvolmgt
LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH)
LDOPTDYN= -dy -G -ztext -h $(TARGET) -ldl
*** ./RULES/sun4-sunos5-gcc.rul.orig Sun Jan 23 13:36:10 2000
--- ./RULES/sun4-sunos5-gcc.rul Fri Oct 26 14:14:56 2001
***************
*** 26,32 ****
CPPFLAGS= $(CPPOPTS) $(CPPOPTX)
CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(COPTX)
! OSDEFS= -D__SVR4 -DSVR4
CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS)
COPTS=
CWOPTS= -Wall -Wtraditional \
--- 26,32 ----
CPPFLAGS= $(CPPOPTS) $(CPPOPTX)
CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(COPTX)
! OSDEFS= -D__SVR4 -DSVR4 -DSOLARIS_VOLMGT
CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS)
COPTS=
CWOPTS= -Wall -Wtraditional \
***************
*** 47,53 ****
LIBS_PATH= -L$(OLIBSDIR)
LDFLAGS= $(LDOPTS) $(LDOPTX)
! LDLIBS= $(LIBS) $(LIBX)
LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH)
LDOPTDYN= -dy -G -ztext -h $(TARGET) -ldl
--- 47,53 ----
LIBS_PATH= -L$(OLIBSDIR)
LDFLAGS= $(LDOPTS) $(LDOPTX)
! LDLIBS= $(LIBS) $(LIBX) -lvolmgt
LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH)
LDOPTDYN= -dy -G -ztext -h $(TARGET) -ldl
*** ./cdrecord/cdrecord.c.orig Thu Apr 19 20:51:29 2001
--- ./cdrecord/cdrecord.c Fri Oct 26 14:16:46 2001
***************
*** 47,52 ****
--- 47,62 ----
#include <signal.h>
#include <schily.h>
+ #ifdef SOLARIS_VOLMGT
+ #ifdef HAVE_SYS_DKIO_H
+ # include <sys/dkio.h>
+ #endif
+ #include <unistd.h>
+ #include <volmgt.h>
+ #include <sys/wait.h>
+ #include <sys/mnttab.h>
+ #endif
+
#include <scg/scsireg.h> /* XXX wegen SC_NOT_READY */
#include <scg/scsitransp.h>
#include <scg/scgcmd.h> /* XXX fuer read_buffer */
***************
*** 201,206 ****
--- 211,277 ----
int exflags;
} exargs;
+ #ifdef SOLARIS_VOLMGT
+ /*
+ * mimics umount(2) system call, except that it returns 0 (success) if the
+ * file descriptor doesn't appear to be mounted.
+ */
+ static int fumount (int fd)
+ { struct stat fsb,msb;
+ struct mnttab mb;
+ FILE *fp;
+ pid_t pid,rpid;
+ int ret=0,i,rval;
+ int _dev_unmount(char *); /* VolMgt ON Consolidation Private API */
+
+ if (fstat (fd,&fsb) < 0) return -1;
+ if ((fp=fopen (MNTTAB,"r")) == NULL) return -1;
+
+ while ((i=getmntent (fp,&mb)) != -1) {
+ if (i != 0) continue; /* ignore corrupted
+lines */
+ if (stat (mb.mnt_special,&msb) < 0) continue; /* corrupted too? */
+ if (msb.st_rdev == fsb.st_rdev) {
+ if (_dev_unmount (mb.mnt_special)) break;
+ #if 1
+ ret = -1;
+
+ if ((pid = fork()) == (pid_t)-1) break;
+
+ if (pid == 0) execl
+("/usr/sbin/umount","cdrecord-umount",mb.mnt_mountp);
+
+ while (1) {
+ rpid = waitpid (pid,&rval,0);
+ if (rpid == (pid_t)-1) {
+ if (errno==EINTR) continue;
+ else break;
+ }
+ else if (rpid != pid) {
+ errno = ECHILD;
+ break;
+ }
+ if (WIFEXITED(rval)) {
+ if (WEXITSTATUS(rval) == 0) ret = 0;
+ else errno = EBUSY; /*
+most likely */
+ break;
+ }
+ else if (WIFSTOPPED(rval) || WIFCONTINUED(rval))
+ continue;
+ else {
+ errno = ENOLINK; /* some phony errno */
+ break;
+ }
+ }
+ #else
+ ret = umount (mb.mnt_special);
+ #endif
+ break;
+ }
+ }
+ fclose (fp);
+ return ret;
+ }
+ #endif
+
EXPORT int
main(ac, av)
int ac;
***************
*** 598,603 ****
--- 669,693 ----
excdr(EX_BAD, &exargs);
exit(EX_BAD);
}
+
+ #ifdef SOLARIS_VOLMGT
+ {
+ struct dk_cinfo ci;
+ struct dk_geom geom;
+ int fd = scgp->fd;
+
+ if (ioctl(fd, DKIOCINFO, &ci)==0 && volmgt_running ()) {
+ if (fumount (fd) != 0) {
+ comerr ("fumount() failed.\n");
+ exit (0);
+ }
+ /* this should tell vold to remount newly burned disk */
+ memset (&geom,0,sizeof(geom));
+ ioctl (fd,DKIOCSGEOM,&geom);
+ }
+ }
+ #endif
+
if ((flags & (F_BLANK|F_FORCE)) == (F_BLANK|F_FORCE)) {
wait_unit_ready(scgp, 120);
scsi_blank(scgp, 0L, blanktype, FALSE);
*** ./libscg/scsi-sun.c.orig Sun Mar 18 15:10:23 2001
--- ./libscg/scsi-sun.c Thu Oct 25 22:46:49 2001
***************
*** 61,66 ****
--- 61,71 ----
LOCAL char _scg_utrans_version[] = "uscsi-1.69"; /* The version for USCSI
*/
#ifdef USE_USCSI
+
+ #ifdef SOLARIS_VOLMGT
+ #include <volmgt.h>
+ #endif
+
LOCAL int scgo_uopen __PR((SCSI *scgp, char *device));
LOCAL int scgo_uclose __PR((SCSI *scgp));
LOCAL int scgo_ucinfo __PR((int f, struct dk_cinfo *cp, int debug));
***************
*** 435,441 ****
register int t;
register int l;
register int nopen = 0;
! char devname[32];
if (scgp->overbose)
error("Warning: Using USCSI interface.\n");
--- 440,446 ----
register int t;
register int l;
register int nopen = 0;
! char devname[128];
if (scgp->overbose)
error("Warning: Using USCSI interface.\n");
***************
*** 479,484 ****
--- 484,504 ----
js_snprintf(devname, sizeof(devname), "/dev/rdsk/c%dt%dd%ds2",
busno, tgt, tlun);
+
+ #ifdef SOLARIS_VOLMGT
+ {
+ char * volname;
+
+ if (volname = volmgt_symname (devname)) {
+ if (volname = media_findname (volname)) {
+ /* we just leaked few bytes, don't care! */
+ js_snprintf (devname,sizeof(devname),
+ "%s",volname);
+ }
+ }
+ }
+ #endif
+
f = open(devname, O_RDONLY | O_NDELAY);
if (f < 0) {
js_snprintf(scgp->errstr,
***************
*** 490,495 ****
--- 510,521 ----
return 1;
} else {
+ #ifdef SOLARIS_VOLMGT
+ if (volmgt_running ())
+ error ("Warning: Volume Manager is running! Make sure you
+have\n"
+ " some media in your CD drive(s)!\n");
+ #endif
+
for (b=0; b < MAX_SCG; b++) {
for (t=0; t < MAX_TGT; t++) {
for (l=0; l < MAX_LUN ; l++) {
***************
*** 496,501 ****
--- 522,540 ----
js_snprintf(devname, sizeof(devname),
"/dev/rdsk/c%dt%dd%ds2",
b, t, l);
+ #ifdef SOLARIS_VOLMGT
+ {
+ char * volname;
+
+ if (volname = volmgt_symname (devname)) {
+ if (volname = media_findname
+(volname)) {
+ /* we just leaked few bytes,
+don't care! */
+ js_snprintf
+(devname,sizeof(devname),
+ "%s",volname);
+ }
+ }
+ }
+ #endif
f = open(devname, O_RDONLY | O_NDELAY);
if (f < 0 && errno != ENOENT
&& errno != ENXIO
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]