5 "@(#)tree.c 1.137 16/12/13 joerg";
51 #include <vms/fabdef.h> 65 struct stat *this_stat,
66 struct stat *parent_stat));
71 char *
path,
int contflag));
84 struct stat *statp,
int have_rsrc));
117 static char unkn[32];
124 return (
"multiplexed chr");
128 return (
"named file");
132 return (
"multiplexed blk");
134 return (
"regular file");
136 return (
"contiguous file");
140 return (
"Solaris shadow inode");
148 return (
"event count");
155 return (
"unallocated");
175 return ((
char *)
NULL);
178 return (&
s1[l1 - l2]);
179 return ((
char *)
NULL);
186 int adjust_modes = 0;
222 #if !defined(_WIN32) && !defined(__DJGPP__) 266 register int new_reclen;
298 #ifdef USE_LARGEFILES 327 if (apple_both && s_entry1->assoc &&
336 _(
"Fatal goof, file '%s' already in hash table.\n"),
360 strlcpy(extname,
c,
sizeof (extname));
388 new_reclen =
strlen(rootname);
395 for (d1 = 0; d1 < 36; d1++) {
396 for (d2 = 0; d2 < 36; d2++) {
397 for (d3 = 0; d3 < 36; d3++) {
398 newname[new_reclen + 0] =
399 (d1 <= 9 ?
'0' + d1 :
'A' + d1 - 10);
400 newname[new_reclen + 1] =
401 (d2 <= 9 ?
'0' + d2 :
'A' + d2 - 10);
402 newname[new_reclen + 2] =
403 (d3 <= 9 ?
'0' + d3 :
'A' + d3 - 10);
405 error(
_(
"NEW name '%s'\n"), newname);
412 while (newname[ijk]) {
413 if (newname[ijk] ==
' ')
430 _(
"Unable to generate unique name for file %s\n"),
453 new_reclen +=
s_entry->rr_attr_size;
457 s_entry->isorec.length[0] = new_reclen;
459 #ifdef USE_LARGEFILES 469 s_e->
isorec.length[0] = new_reclen;
479 if (apple_both &&
s_entry->assoc) {
487 s_entry2->
isorec.name_len[0] =
491 s_entry2->
isorec.length[0] = new_reclen;
513 s_entry1->
isorec.length[0] = new_reclen;
515 #ifdef USE_LARGEFILES 522 for (s_e = s_entry1->
mxroot;
525 s_e->
isorec.length[0] = new_reclen;
536 if (apple_both && s_entry1->assoc) {
544 s_entry2->
isorec.name_len[0] =
545 s_entry1->
isorec.name_len[0];
548 s_entry2->
isorec.length[0] = new_reclen;
559 (this_dir->
extent == 0)) {
598 table->priority = 32768;
605 table->size = tablesize;
606 table->filedir = this_dir;
666 s_entry->isorec.name_len[0] = new_reclen;
673 new_reclen +=
s_entry->rr_attr_size;
678 if (new_reclen > 0xff) {
680 _(
"Fatal error - RR overflow (reclen %d) for file %s\n"),
684 s_entry->isorec.length[0] = new_reclen;
692 _(
"If there was more than one directory type argument to mkisofs\n"));
694 _(
"use -graft-points to create different target directory names.\n"));
748 if (
count != tablesize) {
750 _(
"Translation table size mismatch %d %d\n"),
766 new_reclen =
s_entry->isorec.length[0];
772 this_dir->
size += new_reclen;
795 if (pnt[0] ==
'C' && pnt[1] ==
'E') {
796 nbytes =
get_733((
char *)pnt + 20);
869 root->contents->priority = 32768;
873 set_723(
root->contents->isorec.volume_sequence_number,
907 struct stat *this_stat;
908 struct stat *parent_stat;
917 if (parent_stat ==
NULL)
919 if (this_stat ==
NULL)
934 if (dirnode->
self->hfs_ent) {
935 s_entry->hfs_ent = (hfsdirent *)
943 s_entry->isorec.name_len[0] = 1;
954 dirnode->
contents->next = orig_contents;
961 parent_stat, deep_flag);
972 if (dirnode->
self->hfs_ent) {
973 s_entry->hfs_ent = (hfsdirent *)
981 s_entry->isorec.name_len[0] = 1;
992 dirnode->
contents->next = orig_contents;
995 if (dirnode ==
root) {
1000 this_stat, this_stat, deep_flag);
1014 if (pnt[3] != 1 && pnt[3] != 2) {
1016 _(
"**BAD RRVERSION (%d) in '%c%c' field (%2.2X %2.2X).\n"),
1017 pnt[3], pnt[0], pnt[1], pnt[0], pnt[1]);
1021 _(
"**BAD RRLEN (%d) in '%2.2s' field %2.2X %2.2X.\n"),
1022 pnt[2], pnt, pnt[0], pnt[1]);
1026 return ((
char *)pnt);
1027 else if (
strncmp((
char *)pnt,
"ST", 2) == 0)
1059 d_entry = d_entry->
next;
1063 _(
"Unable to locate directory parent\n"));
1073 s_entry1 = d_entry->
contents->next;
1088 if (rr_attr !=
NULL)
1095 s_entry1 =
s_entry->parent_rec;
1101 if (rr_attr !=
NULL)
1126 _(
"Directories too deep for '%s' (%d) max is %d%s.\n"),
1128 contflag?
_(
"; ignored - continuing"):
"");
1133 errmsgno(
EX_BAD,
_(
"or allow deep ISO9660 directory nesting via -D.\n"));
1188 d_entry =
readdir(current_dir);
1191 if (!current_dir || (!d_entry &&
errno != 0)) {
1213 vms_path_fixup(
path);
1231 this_dir->sort = de->sort;
1237 whole_path[0] =
'\0';
1261 d_entry =
readdir(current_dir);
1281 _(
"Ignoring file %s\n"),
1309 if (whole_path[
strlen(whole_path) - 1] !=
'/')
1323 _(
"Excluded by match: %s\n"), whole_path);
1366 if (this_dir->hfs_info) {
1367 del_hfs_info(this_dir->hfs_info);
1368 this_dir->hfs_info = 0;
1451 struct stat statbuf,
1458 #ifdef USE_NO_SCANDIR 1482 if ((
status == -1) && (lstatus == -1)) {
1487 errmsg(
_(
"Non-existent or inaccessible: %s\n"), whole_path);
1525 char symlinkcontents[2048];
1528 if (udf_get_symlinkcontents(whole_path,
1529 symlinkcontents, &
size) == -1) {
1548 errmsg(
_(
"Unable to stat file %s - ignoring and continuing.\n"),
1552 _(
"Symlink %s ignored - continuing.\n"),
1575 _(
"Already cached directory seen (%s)\n"),
1618 if (!
S_ISDIR(lstatbuf.
st_mode) && (statbuf.st_fab_rfm != FAB$C_FIX &&
1619 statbuf.st_fab_rfm != FAB$C_STMLF)) {
1621 _(
"Warning - file %s has an unsupported VMS record format (%d)\n"),
1622 whole_path, statbuf.st_fab_rfm);
1629 errmsg(
_(
"File %s is not readable - ignoring\n"),
1633 #ifdef USE_LARGEFILES 1647 errmsg(
_(
"File %s is too large for current mkisofs settings (-iso-level 3 or more required) - ignoring\n"),
1663 _(
"Warning: Directory loop (%s dev: %lx ino: %lu).\n"),
1664 whole_path, (
unsigned long) statbuf.
st_dev,
1674 _(
"Unknown file type (%s) %s - ignoring and continuing.\n"),
1682 errmsg(
_(
"Unable to stat file %s - ignoring and continuing.\n"),
1687 #if !defined(__MINGW32__) && !defined(_MSC_VER) 1688 #define is_archive(st) ((st).st_dev == archive_dev && (st).st_ino == archive_ino) 1691 _(
"'%s' is the archive. Not dumped.\n"), whole_path);
1758 hfs_matches(whole_path))) == 1) {
1769 if (
S_ISREG(lstatbuf.
st_mode) && !have_rsrc && apple_both && !x_hfs) {
1775 htype = get_hfs_rname(whole_path,
short_name, rsrc_path);
1780 struct stat rstatbuf,
1823 #ifdef DUPLICATES_ONCE 1839 _(
"Hidden from ISO9660 tree: %s\n"),
1847 _(
"Hidden ISO9660 attribute: %s\n"),
1861 _(
"Hidden from Joliet tree: %s\n"),
1875 _(
"Hidden from UDF tree: %s\n"),
1886 s_entry->sort = this_dir->sort;
1907 if ((
s_entry->sort != this_dir->sort) && do_sort == 0)
1925 s_entry->isorec.ext_attr_length[0] = 0;
1927 s_entry->isorec.file_unit_size[0] = 0;
1928 s_entry->isorec.interleave[0] = 0;
1931 if (apple_both && !x_hfs) {
1940 s_entry->hfs_type = have_rsrc;
1971 (hfsdirent *)
e_malloc(
sizeof (hfsdirent));
1976 memset(hfs_ent, 0,
sizeof (hfsdirent));
2040 s_entry->total_rr_attr_size = 0;
2069 if (apple_both &&
s_entry->hfs_ent &&
2138 #define major(dev) (sizeof (dev_t) <= 2 ? ((dev) >> 8) : \ 2139 (sizeof (dev_t) <= 4 ? (((dev) >> 8) >> 8) : \ 2140 (((dev) >> 16) >> 16))) 2141 #define minor(dev) (sizeof (dev_t) <= 2 ? (dev) & 0xff : \ 2142 (sizeof (dev_t) <= 4 ? (dev) & 0xffff : \ 2143 (dev) & 0xffffffff)) 2171 #ifdef HAVE_READLINK 2176 errmsg(
_(
"Cannot read link '%s'.\n"),
2210 #ifdef USE_NO_SCANDIR 2240 if (apple_both && !have_rsrc &&
s_entry->hfs_ent) {
2304 if (apple_ext &&
s_entry->assoc) {
2310 &statbuf, &lstatbuf, deep_flag | (statp?
DID_CHDIR:0));
2324 &statbuf, &lstatbuf, deep_flag | (statp?
DID_CHDIR:0));
2341 #ifdef USE_LARGEFILES 2347 #define LARGE_EXTENT ((off_t)0xFFFFF800UL) 2348 #define MAX_EXTENT ((off_t)0xFFFFFFFEUL) 2350 #define LARGE_EXTENT ((off_t)0xFFFFF800L) 2351 #define MAX_EXTENT ((off_t)0xFFFFFFFEL) 2354 #define LARGE_EXTENT MAX_EXTENT & ~(off_t)2047L 2371 if (
s_entry->size > MAX_EXTENT) {
2388 #define EOVERFLOW EFBIG 2391 _(
"File %s is too large - hiding from UDF tree.\n"),
2408 while (
size > MAX_EXTENT) {
2414 size -= LARGE_EXTENT;
2490 }
else if (parent ==
root) {
2532 error(
_(
"Warning: missing whole name for: '%s'\n"), de->
name);
2614 hfs_ent = (hfsdirent *)
e_malloc(
sizeof (hfsdirent));
2619 memset(hfs_ent, 0,
sizeof (hfsdirent));
2620 hfs_ent->crdate =
fstatbuf.st_ctime;
2621 hfs_ent->mddate =
fstatbuf.st_mtime;
2623 de->hfs_ent = hfs_ent;
2628 get_hfs_dir((
char *)
path, (
char *)pnt, de);
2656 dpnt->hfs_ent = de->hfs_ent;
2659 if (orig_de ==
NULL) {
2660 struct stat xstatbuf;
2674 error(
_(
"stat parent->whole_name: '%s' -> %d.\n"),
2675 parent->whole_name, sts);
2691 if (!
root->subdir) {
2692 root->subdir = dpnt;
2694 next_brother =
root->subdir;
2695 while (next_brother->
next)
2696 next_brother = next_brother->
next;
2697 next_brother->
next = dpnt;
2738 if ((deep_flag &
NEED_CL) == 0) {
2746 next_brother =
parent->subdir;
2747 while (next_brother->
next)
2748 next_brother = next_brother->
next;
2749 next_brother->
next = dpnt;
2778 de->atime.tv_sec =
fstatbuf.st_atime;
2780 de->mtime.tv_sec =
fstatbuf.st_mtime;
2782 de->ctime.tv_sec =
fstatbuf.st_ctime;
2819 if (apple_both &&
child->hfs_ent)
2827 tdir = tdir->
next) {
2835 _(
"Unable to locate child directory in parent list\n"));
2902 _(
"call to search_tree_file with an absolute path, stripping\n"));
2904 _(
"initial path separator. Hope this was intended...\n"));
2924 dpnt =
node->subdir;
2934 _(
"Calling next level with filename = %s\n"), rest);
2949 depnt =
node->contents;
2961 depnt = depnt->
next;
2969 fprintf(
stderr,
_(
"We cant get here in search_tree_file :-/ \n"));
int full_iso9660_filenames
#define memmove(s1, s2, n)
char * strcat(char *DstString, const char *SrcString)
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
ACPI_SIZE strlen(const char *String)
GLsizei const GLchar ** path
#define RELOCATED_DIRECTORY
GLuint GLuint GLsizei count
size_t strlcpy(char *d, const char *s, size_t bufsize)
struct directory * filedir
GLenum GLsizei GLenum GLenum const GLvoid * table
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
EXPORT char * e_strdup(char *s) const
struct directory * subdir
#define sprintf(buf, format,...)
DIR *__cdecl opendir(const char *)
#define gettimeofday(tv, tz)
struct directory * parent
EXPORT int js_snprintf(char *buf, unsigned maxcnt, char *form, va_alist)
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
struct iso_directory_record isorec
struct directory_entry * parent_rec
EXPORT UInt32_t get_733(void *vp)
#define offsetof(TYPE, MEMBER)
EXPORT int errmsg(char *msg, va_alist)
EXPORT int iso9660_date(char *result, time_t crtime)
#define INHIBIT_ISO9660_ENTRY
#define INHIBIT_JOLIET_ENTRY
struct directory_entry * contents
unsigned int total_rr_attr_size
#define INHIBIT_UDF_ENTRY
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
unsigned char * parse_xa(unsigned char *pnt, int *lenp, struct directory_entry *dpnt)
int volume_sequence_number
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean flag
#define memcpy(s1, s2, n)
struct directory_entry * next
struct directory_entry * self
int __cdecl closedir(DIR *)
struct dirent *__cdecl readdir(DIR *)
static SHChangeNotifyEntry s_entry
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
EXPORT int generate_xa_rr_attributes(char *whole_name, char *name, struct directory_entry *s_entry, struct stat *statbuf, struct stat *lstatbuf, int deep_opt)
GLuint GLint GLboolean GLint GLenum access
unsigned int rr_attr_size
struct directory_entry * mxroot
EXPORT void comerrno(int err, char *msg, va_alist)
char * strchr(const char *String, int ch)
EXPORT void * e_malloc(size_t size)
char * strcpy(char *DstString, const char *SrcString)
int strcmp(const char *String1, const char *String2)
unsigned char * rr_attributes
int readlink(const char *path, char *buf, size_t size)
static SERVICE_STATUS status
void finish_cl_pl_for_prev_session()
EXPORT void set_723(void *vp, UInt32_t i)
EXPORT void set_733(void *vp, UInt32_t i)
EXPORT int errmsgno(int err, char *msg, va_alist)