virtual.h
author nathan
Sat, 29 Dec 2007 15:28:06 +0100
branchtrunk
changeset 8 a306b5e43b44
parent 4 79da91042fcc
child 15 a9348bf5f6e7
permissions -rw-r--r--
release 0.7.0
nathan@4
     1
/* virtual.h
nathan@4
     2
Copyright (c) 2000-2004 Craig Condit, Stefan Hülswitt.
nathan@4
     3
nathan@4
     4
Redistribution and use in source and binary forms, with or without
nathan@4
     5
modification, are permitted provided that the following conditions are met: 
nathan@4
     6
nathan@4
     7
1. Redistributions of source code must retain the above copyright notice,
nathan@4
     8
   this list of conditions and the following disclaimer. 
nathan@4
     9
2. Redistributions in binary form must reproduce the above copyright notice,
nathan@4
    10
   this list of conditions and the following disclaimer in the documentation
nathan@4
    11
   and/or other materials provided with the distribution. 
nathan@4
    12
nathan@4
    13
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
nathan@4
    14
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
nathan@4
    15
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
nathan@4
    16
DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
nathan@4
    17
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
nathan@4
    18
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
nathan@4
    19
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
nathan@4
    20
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
nathan@4
    21
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
nathan@4
    22
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
nathan@4
    23
SUCH DAMAGE.
nathan@4
    24
*/
nathan@4
    25
nathan@4
    26
#ifndef _CDBACKUP_VIRTUAL_H
nathan@4
    27
#define _CDBACKUP_VIRTUAL_H
nathan@4
    28
nathan@4
    29
#define VIRT_VERSION    1
nathan@4
    30
#define VIRT_MAGIC      0x144391C83A78412FLL
nathan@4
    31
#define MAX_VIRT_TRACKS 96
nathan@4
    32
#define VIRT_HEADER_LEN CD_FRAMESIZE
nathan@4
    33
nathan@4
    34
struct virt_header {
nathan@4
    35
  long long magic;
nathan@4
    36
  int version;
nathan@4
    37
  int tracks;
nathan@4
    38
  int leadout;
nathan@4
    39
  int count, has_cont;
nathan@4
    40
  int reserved[25];
nathan@4
    41
  int start[MAX_VIRT_TRACKS];
nathan@4
    42
  };
nathan@4
    43
nathan@4
    44
struct toc_entry {
nathan@4
    45
  u_char track_no;	/* track number */
nathan@4
    46
  char is_data;		/* 1 = data track */
nathan@4
    47
  char is_cdbackup;	/* was it created by CD-Backup? */
nathan@4
    48
  int sec_start;	/* start sector */
nathan@4
    49
  int sec_end;		/* last sector */
nathan@4
    50
  char id_str[33];	/* recorder id string (32 chars) */
nathan@4
    51
  char vol_id[33];	/* volume label (32 characters) */
nathan@4
    52
  char t_stamp[13];	/* time stamp: yyyymmddhhmm */
nathan@4
    53
  char disk_set;	/* disk number */
nathan@4
    54
  char flags;           /* backup flags */
nathan@4
    55
  };
nathan@4
    56
nathan@4
    57
extern struct toc_entry *toc;
nathan@4
    58
extern long long cd_used, cd_avail;
nathan@4
    59
nathan@4
    60
void Vopen(int ro);
nathan@4
    61
void Vclose(void);
nathan@4
    62
int VisRegular(void);
nathan@4
    63
int VreadToc(int trackInfos);
nathan@4
    64
void VprintSpace(void);
nathan@4
    65
const char *VdevName(void);
nathan@4
    66
long long Vseek(int trackNum);
nathan@4
    67
void Vread(void *buf);
nathan@4
    68
void VnewTrack(void);
nathan@4
    69
void VcloseTrack(int cont);
nathan@4
    70
void Vwrite(const void *buf);
nathan@4
    71
void VgetAhead(void);
nathan@4
    72
void VsetAhead(int restore);
nathan@4
    73
int Vsize(void);
nathan@4
    74
int VhasCont(void);
nathan@4
    75
void VprepareDump(void);
nathan@4
    76
void VvirtRead(void *buf);
nathan@4
    77
nathan@4
    78
#endif