File: bkInternal.h

package info (click to toggle)
isomaster 1.3.9-2
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,024 kB
  • ctags: 844
  • sloc: ansic: 11,224; makefile: 235; sh: 109; python: 11
file content (107 lines) | stat: -rw-r--r-- 3,457 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/******************************* LICENCE **************************************
* Any code in this file may be redistributed or modified under the terms of
* the GNU General Public Licence as published by the Free Software 
* Foundation; version 2 of the licence.
****************************** END LICENCE ***********************************/

/******************************************************************************
* Author:
* Andrew Smith, http://littlesvr.ca/misc/contactandrew.php
*
* Contributors:
* 
******************************************************************************/

/********************************* PURPOSE ************************************
* bkInternal.h
* This header file is for #defines and structures only used by bkisofs
******************************** END PURPOSE *********************************/

#ifndef bkInternal_h
#define bkInternal_h

#include "bk.h"

/* number of logical sectors in system area (in practice always 16) */
#define NLS_SYSTEM_AREA 16
/* number of bytes in a logical block (in practice always 2048) */
#define NBYTES_LOGICAL_BLOCK 2048
/* for el torito boot images */
#define NBYTES_VIRTUAL_SECTOR 512

/*******************************************************************************
* Joliet allows max 128 bytes
*     + 2 separator1 (9660, just in case)
*     + 2 separator2 (9660, just in case)
*     + 10 version (9660, just in case)
*     = 142 bytes (71 characters)
* Only a max of 64 characters of this will be stored. (plus '\0') */
#define NCHARS_FILE_ID_MAX_JOLIET 65

#define NBYTES_FILE_ID_MAX_9660 15 /* 8.3 + ";1" */

#define BASETW_PTR(item) ((BaseToWrite*)(item))
#define DIRTW_PTR(item) ((DirToWrite*)(item))
#define FILETW_PTR(item) ((FileToWrite*)(item))
#define SYMLINKTW_PTR(item) ((SymLinkToWrite*)(item))

#define WRITE_CACHE_SIZE 1048576

typedef struct
{
    unsigned numChildren;
    char** children;
    
} NewPath;

typedef struct BaseToWrite
{
    char name9660[NBYTES_FILE_ID_MAX_9660]; /* 8.3 + ";1" max */
    char nameRock[NCHARS_FILE_ID_MAX_STORE];
    char nameJoliet[NCHARS_FILE_ID_MAX_JOLIET];
    unsigned posixFileMode;
    bk_off_t extentLocationOffset; /* where on image to write location of extent */
    unsigned extentNumber; /* extent number */
    bk_off_t extentLocationOffset2; /* for svd (joliet) */
    bk_off_t offsetForCE; /* if the name won't fit inside the directory record */
    
    struct BaseToWrite* next;
    
} BaseToWrite;

typedef struct DirToWrite
{
    BaseToWrite base;
    
    unsigned extentNumber2; /* for svd (joliet) */
    unsigned dataLength; /* bytes, including blank */
    unsigned dataLength2; /* for svd (joliet) */
    struct BaseToWrite* children;
    
} DirToWrite;

typedef struct FileToWrite
{
    BaseToWrite base;
    
    unsigned size; /* in bytes */
    BkHardLink* location; /* basically a copy of the following variables */
    bool onImage;
    unsigned offset; /* if on image, in bytes */
    char* pathAndName; /* if on filesystem, full path + filename
                       * is to be freed by whenever the File is freed */
    BkFile* origFile; /* this pointer only has one purpose: to potentially 
                      * identify this file as the boot record. it will never
                      * be dereferenced, just compared to. */
    
} FileToWrite;

typedef struct SymLinkToWrite
{
    BaseToWrite base;
    
    char target[NCHARS_SYMLINK_TARGET_MAX];
    
} SymLinkToWrite;

#endif