libcdio  2.1.0
About: GNU libcdio is a library for CD-ROM and CD image access.
  Fossies Dox: libcdio-2.1.0.tar.bz2  ("inofficial" and yet experimental doxygen-generated source code documentation)  

cdinfo-linux.c File Reference
#include "config.h"
#include <cdio/cdio.h>
#include <cdio/logging.h>
#include <cdio/util.h>
#include <cdio/cd_types.h>
#include <cdio/sector.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <errno.h>
#include <argp.h>
Include dependency graph for cdinfo-linux.c:

Go to the source code of this file.

Data Structures

struct  arguments
 
struct  signature
 

Macros

#define PROGRAM_NAME   "CD Info"
 
#define CDINFO_VERSION   "2.0"
 
#define _(String)   (String)
 
#define EXIT_FAILURE   1
 
#define EXIT_SUCCESS   0
 
#define DEBUG   1
 
#define dbg_print(level, s, args...)
 
#define err_exit(fmt, args...)
 
#define FS_NO_DATA   0 /* audio only */
 
#define FS_HIGH_SIERRA   1
 
#define FS_ISO_9660   2
 
#define FS_INTERACTIVE   3
 
#define FS_HFS   4
 
#define FS_UFS   5
 
#define FS_EXT2   6
 
#define FS_ISO_HFS   7 /* both hfs & isofs filesystem */
 
#define FS_ISO_9660_INTERACTIVE   8 /* both CD-RTOS and isofs filesystem */
 
#define FS_3DO   9
 
#define FS_UNKNOWN   15
 
#define FS_MASK   15
 
#define XA   16
 
#define MULTISESSION   32
 
#define PHOTO_CD   64
 
#define HIDDEN_TRACK   128
 
#define CDTV   256
 
#define BOOTABLE   512
 
#define VIDEOCDI   1024
 
#define ROCKRIDGE   2048
 
#define JOLIET   4096
 
#define ISO_SUPERBLOCK_SECTOR   16
 
#define UFS_SUPERBLOCK_SECTOR   4
 
#define BOOT_SECTOR   17
 
#define VCD_INFO_SECTOR   150
 
#define STRONG   "__________________________________\n"
 
#define NORMAL   ""
 
#define IS_ISOFS   0
 
#define IS_CD_I   1
 
#define IS_CDTV   2
 
#define IS_CD_RTOS   3
 
#define IS_HS   4
 
#define IS_BRIDGE   5
 
#define IS_XA   6
 
#define IS_PHOTO_CD   7
 
#define IS_EXT2   8
 
#define IS_UFS   9
 
#define IS_BOOTABLE   10
 
#define IS_VIDEO_CD   11
 

Typedefs

typedef struct signature signature_t
 

Functions

static error_t parse_opt (int key, char *arg, struct argp_state *state)
 
static void print_version (void)
 

Variables

struct arguments opts
 
static signature_t sigs []
 
int filehandle
 
int rc
 
int i
 
int j
 
int isofs_size = 0
 
int start_track
 
int ms_offset
 
int data_start
 
int joliet_level = 0
 
char buffer [6][CDIO_CD_FRAMESIZE_RAW]
 
CdIoimg
 
track_t num_tracks
 
track_t first_track_num
 
struct cdrom_tocentry * toc [CDIO_CDROM_LEADOUT_TRACK+1]
 
struct cdrom_mcn mcn
 
struct cdrom_multisession ms
 
struct cdrom_subchnl sub
 
int first_data = -1
 
int num_data = 0
 
int first_audio = -1
 
int num_audio = 0
 
char * devname = NULL
 
char * program_name
 
const char * argp_program_version = "CD Info" "2.0"
 
const char * argp_program_bug_address = "rocky@gnu.org"
 
const char doc []
 
const char args_doc [] = "[DEVICE or DISK-IMAGE]"
 
static struct argp_option options []
 

Macro Definition Documentation

◆ _

#define _ (   String)    (String)

Definition at line 62 of file cdinfo-linux.c.

◆ BOOT_SECTOR

#define BOOT_SECTOR   17

Definition at line 142 of file cdinfo-linux.c.

◆ BOOTABLE

#define BOOTABLE   512

Definition at line 134 of file cdinfo-linux.c.

◆ CDINFO_VERSION

#define CDINFO_VERSION   "2.0"

Definition at line 29 of file cdinfo-linux.c.

◆ CDTV

#define CDTV   256

Definition at line 133 of file cdinfo-linux.c.

◆ dbg_print

#define dbg_print (   level,
  s,
  args... 
)
Value:
if (opts.debug_level >= level) \
fprintf(stderr, "%s: "s, __func__ , ##args)

Definition at line 90 of file cdinfo-linux.c.

◆ DEBUG

#define DEBUG   1

Definition at line 88 of file cdinfo-linux.c.

◆ err_exit

#define err_exit (   fmt,
  args... 
)
Value:
fprintf(stderr, "%s: "fmt, program_name, ##args); \
myexit(EXIT_FAILURE)

Definition at line 97 of file cdinfo-linux.c.

◆ EXIT_FAILURE

#define EXIT_FAILURE   1

Definition at line 70 of file cdinfo-linux.c.

◆ EXIT_SUCCESS

#define EXIT_SUCCESS   0

Definition at line 74 of file cdinfo-linux.c.

◆ FS_3DO

#define FS_3DO   9

Definition at line 125 of file cdinfo-linux.c.

◆ FS_EXT2

#define FS_EXT2   6

Definition at line 122 of file cdinfo-linux.c.

◆ FS_HFS

#define FS_HFS   4

Definition at line 120 of file cdinfo-linux.c.

◆ FS_HIGH_SIERRA

#define FS_HIGH_SIERRA   1

Definition at line 117 of file cdinfo-linux.c.

◆ FS_INTERACTIVE

#define FS_INTERACTIVE   3

Definition at line 119 of file cdinfo-linux.c.

◆ FS_ISO_9660

#define FS_ISO_9660   2

Definition at line 118 of file cdinfo-linux.c.

◆ FS_ISO_9660_INTERACTIVE

#define FS_ISO_9660_INTERACTIVE   8 /* both CD-RTOS and isofs filesystem */

Definition at line 124 of file cdinfo-linux.c.

◆ FS_ISO_HFS

#define FS_ISO_HFS   7 /* both hfs & isofs filesystem */

Definition at line 123 of file cdinfo-linux.c.

◆ FS_MASK

#define FS_MASK   15

Definition at line 127 of file cdinfo-linux.c.

◆ FS_NO_DATA

#define FS_NO_DATA   0 /* audio only */

Definition at line 116 of file cdinfo-linux.c.

◆ FS_UFS

#define FS_UFS   5

Definition at line 121 of file cdinfo-linux.c.

◆ FS_UNKNOWN

#define FS_UNKNOWN   15

Definition at line 126 of file cdinfo-linux.c.

◆ HIDDEN_TRACK

#define HIDDEN_TRACK   128

Definition at line 132 of file cdinfo-linux.c.

◆ IS_BOOTABLE

#define IS_BOOTABLE   10

Definition at line 171 of file cdinfo-linux.c.

◆ IS_BRIDGE

#define IS_BRIDGE   5

Definition at line 166 of file cdinfo-linux.c.

◆ IS_CD_I

#define IS_CD_I   1

Definition at line 162 of file cdinfo-linux.c.

◆ IS_CD_RTOS

#define IS_CD_RTOS   3

Definition at line 164 of file cdinfo-linux.c.

◆ IS_CDTV

#define IS_CDTV   2

Definition at line 163 of file cdinfo-linux.c.

◆ IS_EXT2

#define IS_EXT2   8

Definition at line 169 of file cdinfo-linux.c.

◆ IS_HS

#define IS_HS   4

Definition at line 165 of file cdinfo-linux.c.

◆ IS_ISOFS

#define IS_ISOFS   0

Definition at line 161 of file cdinfo-linux.c.

◆ IS_PHOTO_CD

#define IS_PHOTO_CD   7

Definition at line 168 of file cdinfo-linux.c.

◆ IS_UFS

#define IS_UFS   9

Definition at line 170 of file cdinfo-linux.c.

◆ IS_VIDEO_CD

#define IS_VIDEO_CD   11

Definition at line 172 of file cdinfo-linux.c.

◆ IS_XA

#define IS_XA   6

Definition at line 167 of file cdinfo-linux.c.

◆ ISO_SUPERBLOCK_SECTOR

#define ISO_SUPERBLOCK_SECTOR   16

Definition at line 140 of file cdinfo-linux.c.

◆ JOLIET

#define JOLIET   4096

Definition at line 137 of file cdinfo-linux.c.

◆ MULTISESSION

#define MULTISESSION   32

Definition at line 130 of file cdinfo-linux.c.

◆ NORMAL

#define NORMAL   ""

Definition at line 150 of file cdinfo-linux.c.

◆ PHOTO_CD

#define PHOTO_CD   64

Definition at line 131 of file cdinfo-linux.c.

◆ PROGRAM_NAME

#define PROGRAM_NAME   "CD Info"

Definition at line 28 of file cdinfo-linux.c.

◆ ROCKRIDGE

#define ROCKRIDGE   2048

Definition at line 136 of file cdinfo-linux.c.

◆ STRONG

#define STRONG   "__________________________________\n"

Definition at line 149 of file cdinfo-linux.c.

◆ UFS_SUPERBLOCK_SECTOR

#define UFS_SUPERBLOCK_SECTOR   4

Definition at line 141 of file cdinfo-linux.c.

◆ VCD_INFO_SECTOR

#define VCD_INFO_SECTOR   150

Definition at line 143 of file cdinfo-linux.c.

◆ VIDEOCDI

#define VIDEOCDI   1024

Definition at line 135 of file cdinfo-linux.c.

◆ XA

#define XA   16

Definition at line 129 of file cdinfo-linux.c.

Typedef Documentation

◆ signature_t

typedef struct signature signature_t

Function Documentation

◆ parse_opt()

static error_t parse_opt ( int  key,
char *  arg,
struct argp_state *  state 
)
static

◆ print_version()

static void print_version ( void  )
static

Definition at line 296 of file cdinfo-linux.c.

References _, and CDINFO_VERSION.

Referenced by main(), and parse_options().

Variable Documentation

◆ argp_program_bug_address

const char* argp_program_bug_address = "rocky@gnu.org"

Definition at line 221 of file cdinfo-linux.c.

◆ argp_program_version

const char* argp_program_version = "CD Info" "2.0"

Definition at line 220 of file cdinfo-linux.c.

◆ args_doc

const char args_doc[] = "[DEVICE or DISK-IMAGE]"

Definition at line 228 of file cdinfo-linux.c.

◆ buffer

◆ data_start

int data_start

Definition at line 198 of file cdinfo-linux.c.

Referenced by main().

◆ devname

char* devname = NULL

Definition at line 217 of file cdinfo-linux.c.

Referenced by parse_opt().

◆ doc

const char doc[]
Initial value:
=
"CD Info" " -- Get information about a Compact Disk or CD image."

Definition at line 224 of file cdinfo-linux.c.

◆ filehandle

int filehandle

Definition at line 192 of file cdinfo-linux.c.

◆ first_audio

int first_audio = -1

Definition at line 213 of file cdinfo-linux.c.

Referenced by main().

◆ first_data

int first_data = -1

Definition at line 211 of file cdinfo-linux.c.

Referenced by main(), and print_analysis().

◆ first_track_num

track_t first_track_num

Definition at line 205 of file cdinfo-linux.c.

◆ i

◆ img

CdIo* img

Definition at line 203 of file cdinfo-linux.c.

◆ isofs_size

int isofs_size = 0

Definition at line 195 of file cdinfo-linux.c.

◆ j

◆ joliet_level

int joliet_level = 0

Definition at line 199 of file cdinfo-linux.c.

◆ mcn

struct cdrom_mcn mcn

Definition at line 208 of file cdinfo-linux.c.

◆ ms

struct cdrom_multisession ms

Definition at line 209 of file cdinfo-linux.c.

◆ ms_offset

int ms_offset

Definition at line 197 of file cdinfo-linux.c.

Referenced by main(), and print_analysis().

◆ num_audio

int num_audio = 0

Definition at line 214 of file cdinfo-linux.c.

Referenced by main(), and print_analysis().

◆ num_data

int num_data = 0

Definition at line 212 of file cdinfo-linux.c.

Referenced by main(), and mmc_get_mcn_isrc_private().

◆ num_tracks

track_t num_tracks

Definition at line 204 of file cdinfo-linux.c.

◆ options

struct argp_option options[]
static
Initial value:
=
{
{"debug", 'd', "LEVEL", 0, "Set debugging to LEVEL"},
{"quiet", 'q', 0, 0, "Don't produce any output" },
{"silent", 's', 0, OPTION_ALIAS },
{"notracks", 'T', 0, 0, "Don't show track information"},
{"noanalyze",'A', 0, 0, "Don't filesystem analysis"},
{"noioctl", 'I', 0, 0, "Don't show ioctl() information"},
{ 0 }
}

Definition at line 230 of file cdinfo-linux.c.

Referenced by _getopt_long_only_r(), _getopt_long_r(), getopt_long(), and getopt_long_only().

◆ opts

struct arguments opts

◆ program_name

char* program_name

Definition at line 218 of file cdinfo-linux.c.

Referenced by init(), main(), parse_options(), parse_source(), and read_iso_file().

◆ rc

◆ sigs

signature_t sigs[]
static
Initial value:
=
{
{0, 1, "CD001", "ISO 9660"},
{0, 1, "CD-I", "CD-I"},
{0, 8, "CDTV", "CDTV"},
{0, 8, "CD-RTOS", "CD-RTOS"},
{0, 9, "CDROM", "HIGH SIERRA"},
{0, 16, "CD-BRIDGE", "BRIDGE"},
{0, 1024, "CD-XA001", "XA"},
{1, 64, "PPPPHHHHOOOOTTTTOOOO____CCCCDDDD", "PHOTO CD"},
{1, 0x438, "\x53\xef", "EXT2 FS"},
{2, 1372, "\x54\x19\x01\x0", "UFS"},
{3, 7, "EL TORITO", "BOOTABLE"},
{4, 0, "VIDEO_CD", "VIDEO CD"},
{ 0 }
}

Definition at line 174 of file cdinfo-linux.c.

◆ start_track

int start_track

Definition at line 196 of file cdinfo-linux.c.

◆ sub

struct cdrom_subchnl sub

Definition at line 210 of file cdinfo-linux.c.

◆ toc

struct cdrom_tocentry* toc[CDIO_CDROM_LEADOUT_TRACK+1]

Definition at line 207 of file cdinfo-linux.c.

EXIT_FAILURE
#define EXIT_FAILURE
Definition: cdinfo-linux.c:70
opts
struct arguments opts
program_name
char * program_name
Definition: cdinfo-linux.c:218
arguments::debug_level
uint32_t debug_level
Definition: cd-drive.c:35