Exemplo n.º 1
0
void
Cputisopvd(Cdimg *cd, Cdinfo info)
{
	char buf[130];

	Cputc(cd, 1);				/* primary volume descriptor */
	Cputs(cd, "CD001", 5);			/* standard identifier */
	Cputc(cd, 1);				/* volume descriptor version */
	Cputc(cd, 0);				/* unused */

	assert(~info.flags & (CDplan9|CDrockridge));

	/* system identifier */
	strcpy(buf, "");
	if(info.flags & CDplan9)
		strcat(buf, "plan 9 ");
	if(info.flags & CDrockridge)
		strcat(buf, "rrip ");
	if(info.flags & CDbootable)
		strcat(buf, "boot ");
	if(info.flags & CDconform)
		strcat(buf, "iso9660");
	else
		strcat(buf, "utf8");
	
	struprcpy(buf, buf);
	Cputs(cd, buf, 32);

	Cputs(cd, mkisostring(buf, 32, info.volumename), 32);			/* volume identifier */

	Crepeat(cd, 0, 8);				/* unused */
	Cputn(cd, 0, 4);				/* volume space size */
	Crepeat(cd, 0, 32);				/* unused */
	Cputn(cd, 1, 2);				/* volume set size */
	Cputn(cd, 1, 2);				/* volume sequence number */
	Cputn(cd, Blocksize, 2);			/* logical block size */
	Cputn(cd, 0, 4);				/* path table size */
	Cputnl(cd, 0, 4);				/* location of Lpath */
	Cputnl(cd, 0, 4);				/* location of optional Lpath */
	Cputnm(cd, 0, 4);				/* location of Mpath */
	Cputnm(cd, 0, 4);				/* location of optional Mpath */
	Cputisodir(cd, nil, DTroot, 1, Cwoffset(cd));			/* root directory */

	Cputs(cd, mkisostring(buf, 128, info.volumeset), 128);		/* volume set identifier */
	Cputs(cd, mkisostring(buf, 128, info.publisher), 128);			/* publisher identifier */
	Cputs(cd, mkisostring(buf, 128, info.preparer), 128);			/* data preparer identifier */
	Cputs(cd, mkisostring(buf, 128, info.application), 128);		/* application identifier */

	Cputs(cd, "", 37);			/* copyright notice */
	Cputs(cd, "", 37);			/* abstract */
	Cputs(cd, "", 37);			/* bibliographic file */
	Cputdate1(cd, now);				/* volume creation date */
	Cputdate1(cd, now);				/* volume modification date */
	Cputdate1(cd, 0);				/* volume expiration date */
	Cputdate1(cd, 0);				/* volume effective date */
	Cputc(cd, 1);				/* file structure version */
	Cpadblock(cd);
}
Exemplo n.º 2
0
void
setroot(Cdimg *cd, ulong block, ulong dloc, ulong dlen)
{
	assert(block != 0);

	Cwseek(cd, block*Blocksize+offsetof(Cvoldesc, rootdir[0])+offsetof(Cdir, dloc[0]));
	Cputn(cd, dloc, 4);
	Cputn(cd, dlen, 4);
}
Exemplo n.º 3
0
void
setvolsize(Cdimg *cd, ulong block, ulong size)
{
	assert(block != 0);

	Cwseek(cd, block*Blocksize+offsetof(Cvoldesc, volsize[0]));
	Cputn(cd, size, 4);
}
Exemplo n.º 4
0
static int
CputrripPX(Cdimg *cd, Direc *d, int dot, int dowrite)
{
	assert(cd!=0);

	if(dowrite) {
		Cputc(cd, 'P');             /* PX field marker */
		Cputc(cd, 'X');
		Cputc(cd, 36);              /* Length          */
		Cputc(cd, 1);               /* Version         */
	
		Cputn(cd, mode(d, dot), 4); /* POSIX File mode */
		Cputn(cd, nlink(d), 4);     /* POSIX st_nlink  */
		Cputn(cd, d?d->uidno:0, 4);  /* POSIX st_uid    */
		Cputn(cd, d?d->gidno:0, 4);  /* POSIX st_gid    */
	}

	return 36;
}
Exemplo n.º 5
0
/*
 * Patch the length field in a CE record.
 */
static void
setcelen(Cdimg *cd, vlong woffset, ulong len)
{
	vlong o;

	o = Cwoffset(cd);
	Cwseek(cd, woffset);
	Cputn(cd, len, 4);
	Cwseek(cd, o);
}
Exemplo n.º 6
0
/*
 * Patch the length field in a CE record.
 */
static void
setcelen(Cdimg *cd, int64_t woffset, uint32_t len)
{
	int64_t o;

	o = Cwoffset(cd);
	Cwseek(cd, woffset);
	Cputn(cd, len, 4);
	Cwseek(cd, o);
}
Exemplo n.º 7
0
static ulong
CputsuspCE(Cdimg *cd, vlong offset)
{
	vlong o, x;

	chat("writing SUSP CE record pointing to %ld, %ld\n",
		offset/Blocksize, offset%Blocksize);
	o = Cwoffset(cd);
	Cputc(cd, 'C');
	Cputc(cd, 'E');
	Cputc(cd, 28);
	Cputc(cd, 1);
	Cputn(cd, offset/Blocksize, 4);
	Cputn(cd, offset%Blocksize, 4);
	x = Cwoffset(cd);
	Cputn(cd, 0, 4);
	assert(Cwoffset(cd) == o+28);

	return x;
}
Exemplo n.º 8
0
/*
 * Write a Joliet secondary volume descriptor.
 */
void
Cputjolietsvd(Cdimg *cd, Cdinfo info)
{
	Cputc(cd, 2);				/* secondary volume descriptor */
	Cputs(cd, "CD001", 5);			/* standard identifier */
	Cputc(cd, 1);				/* volume descriptor version */
	Cputc(cd, 0);				/* unused */

	Cputrscvt(cd, "Joliet Plan 9", 32);			/* system identifier */
	Cputrscvt(cd, info.volumename, 32);			/* volume identifier */

	Crepeat(cd, 0, 8);				/* unused */
	Cputn(cd, 0, 4);				/* volume space size */
	Cputc(cd, 0x25);				/* escape sequences: UCS-2 Level 2 */
	Cputc(cd, 0x2F);
	Cputc(cd, 0x43);

	Crepeat(cd, 0, 29);
	Cputn(cd, 1, 2);				/* volume set size */
	Cputn(cd, 1, 2);				/* volume sequence number */
	Cputn(cd, Blocksize, 2);			/* logical block size */
	Cputn(cd, 0, 4);				/* path table size */
	Cputnl(cd, 0, 4);				/* location of Lpath */
	Cputnl(cd, 0, 4);				/* location of optional Lpath */
	Cputnm(cd, 0, 4);				/* location of Mpath */
	Cputnm(cd, 0, 4);				/* location of optional Mpath */
	Cputjolietdir(cd, nil, DTroot, 1, Cwoffset(cd));			/* root directory */
	Cputrscvt(cd, info.volumeset, 128);		/* volume set identifier */
	Cputrscvt(cd, info.publisher, 128);			/* publisher identifier */
	Cputrscvt(cd, info.preparer, 128);			/* data preparer identifier */
	Cputrscvt(cd, info.application, 128);		/* application identifier */
	Cputrscvt(cd, "", 37);			/* copyright notice */
	Cputrscvt(cd, "", 37);			/* abstract */
	Cputrscvt(cd, "", 37);			/* bibliographic file */
	Cputdate1(cd, now);				/* volume creation date */
	Cputdate1(cd, now);				/* volume modification date */
	Cputdate1(cd, 0);				/* volume expiration date */
	Cputdate1(cd, 0);				/* volume effective date */
	Cputc(cd, 1);				/* file structure version */
	Cpadblock(cd);
}
Exemplo n.º 9
0
void
setpathtable(Cdimg *cd, ulong block, ulong sz, ulong lloc, ulong bloc)
{
	assert(block != 0);

	Cwseek(cd, block*Blocksize+offsetof(Cvoldesc, pathsize[0]));
	Cputn(cd, sz, 4);
	Cputnl(cd, lloc, 4);
	Cputnl(cd, 0, 4);
	Cputnm(cd, bloc, 4);
	Cputnm(cd, 0, 4);
	assert(Cwoffset(cd) == block*Blocksize+offsetof(Cvoldesc, rootdir[0]));
}