iso.c revision 0b4d59de366b9d82e3c2657bf2c9fb3c990829e0
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <fcntl.h>
#include <stdio.h>
#include "iso_spec.h"
#include "iso_impl.h"
extern char *myname;
/* domkpath - creates an iso path table based on the iso directory list */
/* worg denotes big or little endian machine */
/* write the path table to lbn */
/* return the next available lbn */
int
int lbn;
int worg;
int *psize;
{
int totsize;
int size;
int daddr;
char buf[256];
totsize = 0;
size = 0;
/* obtain the offset in path table */
}
}
/* domkpath_unix - creates a path table based on the unix directory list */
/* worg denotes big or little endian machine */
/* write the path table to lbn */
/* return the next available lbn */
int
int lbn;
int worg;
int *psize;
{
int totsize;
int size;
int daddr;
char buf[256];
totsize = 0;
size = 0;
/* obtain the offset in path table */
}
}
/* mkpath - create the path table */
/* return the next lbn that can be used to store data */
int
int lbn;
int extension;
{
int nextlbn;
int lbn_iso_msb, lbn_iso_lsb;
int lbn_unix_msb, lbn_unix_lsb;
int size_iso_ptable;
int size_unix_ptable;
/* build the path table for iso lsb first */
lbn_iso_lsb = lbn;
/* build the path table for iso msb */
if (extension) {
/* build the path table for unix lsb first */
/* build the path table for iso msb */
}
/* record the information in PVD for ISO */
/* write the descriptor to disk */
if (extension) {
/* record the information is OSD for UNIX */
/* write the descriptor to disk */
}
return (nextlbn);
}
/* domkdir_iso - creates a iso directory based on the directory list */
/* write the directory table to lbn */
/* return the next available lbn */
int
int startlbn;
{
int totsize;
int size;
int daddr;
char buf[256];
int lbn;
/* create dot first */
/* then create dotdot (parent) first */
else continue;
/* directory entry cannot span across sector */
/* fill the remaining block with zeros */
totsize = 0;
}
}
/* fill remaining space in the block, if needed */
/* add additional blocks to make it a sector boundary */
/* update directory entry */
return (lbn);
}
/* domkdir_unix - creates an unix directory based on the directory list */
/* write the directory table to lbn */
/* return the next available lbn */
int
int startlbn;
{
int totsize;
int size;
int daddr;
char buf[256];
int lbn;
/* create dot first */
/* then create dotdot (parent) first */
/* directory entry cannot span across sector */
/* fill the remaining block with zeros */
totsize = 0;
}
}
/* fill remaining space in the block, if needed */
/* add additional blocks to make it a sector boundary */
/* update directory entry */
return (lbn);
}
/* mkdata - copy unix files to cdrom format */
int
int lbn;
int extension;
{
int nextlbn;
if (extension)
else
/* make sure data ends at sector boundary */
return (nextlbn);
}
/* mkdata - copy unix files to cdrom unix extension format */
int
int lbn;
{
int nextlbn;
int filesize;
char path[1024];
/* always process UNIX first */
/* create the directory for iso tree first */
/* directory also in iso tree */
/* make sure directory starts at sector boundary */
}
/* make sure directory entry starts at sector boundary */
if (!prototype) {
/* get the full path name */
/* change directory */
continue;
}
}
case S_IFDIR:
break;
case S_IFREG:
/* get the next lbn of the data file */
&filesize);
/*
* copyfile must return length
* to be updated in dir
*/
/* file also in iso directory */
break;
case S_IFLNK:
/* create symbolic link */
&filesize);
/*
* copyfile must return length
* to be updated in dir
*/
break;
default:
"%s: unknown file type\n", myname);
break;
}
}
}
/* then process ISO next */
/* already processed */
/* we only have to deal with regular files */
/* directories are handled separately */
/* get the next lbn of the data file */
/* copyfile must return length to be updated in dir */
}
}
return (nextlbn);
}
/* mkdata - copy unix files to cdrom iso 9660 format */
int
int lbn;
{
int nextlbn;
int filesize;
char path[1024];
/* create the directory */
/* make sure directory starts at sector boundary */
}
if (!prototype) {
/* get the full path name */
/* change directory */
continue;
}
}
/* we only have to deal with regular files */
/* directories are handled separately */
/* get the next lbn of the data file */
/* copyfile must return length to be updated in dir */
}
}
return (nextlbn);
}
int
char *pep;
int wordorg;
int opt;
{
int size;
char *name;
} else {
}
} else {
}
IPE_XAR_LEN(pep) = 0;
/* root, ignore path name */
if (dno == 1) {
} else {
}
/* if size is an odd number, append a null char end of name */
/* now put in the unix extension */
} else {
}
return (IPE_UNIX_FPESIZE+size);
} else {
return (IPE_FPESIZE+size);
}
}
int
char *pep;
int type;
int opt;
{
char *p;
char *name;
int size;
IDE_XAR_LEN(pep) = 0;
IDE_UNIX_RESERVED(pep) = 0;
IDE_INTRLV_SIZE(pep) = 0;
IDE_INTRLV_SKIP(pep) = 0;
switch (type) {
case CD_DOT:
size = 1;
dsize = 0;
break;
case CD_DOTDOT:
size = 1;
break;
case CD_REGULAR:
} else {
}
else
break;
default:
cleanup();
}
/* add pending bute if size is even */
size++;
}
return (IDE_DIR_LEN(pep));
}
/* magic_extlbn is used as extlbn by empty file */
/* to overcome a cdrom file system bug */
static int magic_extlbn = -1;
/* update dirctory entry */
static void
{
char *pep;
char buf[ISO_SECTOR_SIZE];
int extlbn;
int dlbn;
int doffset;
int size;
} else {
}
/* update the current one */
/* first entry (offset 0) is itself */
/* update the dotdot's directory entry */
/* rootdir does not have dotdot */
/* assume dirent is still in buf[] */
IDE_DIR_LEN(pep));
/* dotdot has a name 01, dot is 00 */
} else {
/* update parent directory's entry */
}
} else {
else
else
}
}