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;
305 s_entry = s_entry->
next;
311 s_entry = s_entry->
next;
319 s_entry = s_entry->
next;
327 if (apple_both && s_entry1->assoc &&
328 s_entry1->assoc == s_entry) {
329 s_entry = s_entry->
next;
334 if (s_entry1 == s_entry) {
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"),
457 s_entry->
isorec.length[0] = new_reclen;
466 for (s_e = s_entry->
mxroot;
469 s_e->
isorec.length[0] = new_reclen;
479 if (apple_both && s_entry->assoc) {
487 s_entry2->
isorec.name_len[0] =
488 s_entry->
isorec.name_len[0];
491 s_entry2->
isorec.length[0] = new_reclen;
513 s_entry1->
isorec.length[0] = new_reclen;
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;
553 s_entry = s_entry->
next;
559 (this_dir->
extent == 0)) {
563 for (s_entry = this_dir->
contents; s_entry;
564 s_entry = s_entry->
next) {
578 if (s_entry->
table) {
598 table->priority = 32768;
605 table->size = tablesize;
606 table->filedir = this_dir;
636 for (s_entry = this_dir->
contents; s_entry; s_entry = s_entry->
next) {
666 s_entry->
isorec.name_len[0] = new_reclen;
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"));
702 for (s_entry = this_dir->
contents; s_entry;
703 s_entry = s_entry->
next) {
704 if (s_entry ==
table)
748 if (
count != tablesize) {
750 _(
"Translation table size mismatch %d %d\n"),
763 s_entry = s_entry->
next;
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);
814 s_entry = s_entry->
next;
865 root->contents = s_entry;
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 *)
937 memcpy(s_entry->hfs_ent, dirnode->
self->hfs_ent,
943 s_entry->
isorec.name_len[0] = 1;
954 dirnode->
contents->next = orig_contents;
955 orig_contents = s_entry;
961 parent_stat, deep_flag);
972 if (dirnode->
self->hfs_ent) {
973 s_entry->hfs_ent = (hfsdirent *)
975 memcpy(s_entry->hfs_ent, dirnode->
self->hfs_ent,
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)
1049 s_entry = s_entry->
next->next;
1050 for (; s_entry; s_entry = s_entry->
next) {
1057 if (d_entry->
self == s_entry)
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)
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)) {
1200 de->
isorec.flags[0] &= ~ISO_DIRECTORY;
1213 vms_path_fixup(
path);
1231 this_dir->sort = de->sort;
1237 whole_path[0] =
'\0';
1261 d_entry =
readdir(current_dir);
1267 d_name = d_entry->
d_name;
1276 if (
strchr(d_name,
'~') ||
1278 rstr(d_name,
".bak")) {
1281 _(
"Ignoring file %s\n"),
1293 if (hfs_exclude(d_name))
1309 if (whole_path[
strlen(whole_path) - 1] !=
'/')
1312 strcat(whole_path, d_name);
1318 if (!(d_name[0] ==
'.' && (d_name[1] ==
'\0' ||
1319 (d_name[1] ==
'.' && d_name[2] ==
'\0'))) &&
1323 _(
"Excluded by match: %s\n"), whole_path);
1343 if (
strcmp(d_name,
".") == 0 &&
1347 if (
strcmp(d_name,
"..") == 0 &&
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);
1704 for (s_entry = this_dir->
contents; s_entry;
1705 s_entry = s_entry->
next) {
1710 if (s_entry !=
NULL &&
1719 for (s_entry =
reloc_dir->contents; s_entry;
1720 s_entry = s_entry->
next) {
1743 whole_path, s_entry);
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
1824 s_entry->digest_fast =
NULL;
1825 s_entry->digest_full =
NULL;
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;
1903 s_entry->sort = assign_dvd_weights(s_entry->
name, this_dir, s_entry->sort);
1907 if ((s_entry->sort != this_dir->sort) && do_sort == 0)
1917 s_entry->sort = sort_matches(whole_path, s_entry->sort);
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) {
1932 s_entry->hfs_ent =
NULL;
1933 s_entry->assoc =
NULL;
1934 s_entry->hfs_off = (
off_t)0;
1935 s_entry->hfs_type = htype;
1940 s_entry->hfs_type = have_rsrc;
1947 }
else if (s_entry->
next) {
1954 s_entry->assoc = s_entry->
next;
1958 s_entry->hfs_ent = s_entry->
next->hfs_ent;
1959 s_entry->hfs_type = s_entry->
next->hfs_type;
1967 if (!s_entry->hfs_ent) {
1971 (hfsdirent *)
e_malloc(
sizeof (hfsdirent));
1976 memset(hfs_ent, 0,
sizeof (hfsdirent));
1978 s_entry->hfs_ent = hfs_ent;
1990 s_entry->hfs_ent->u.file.rsize = lstatbuf.
st_size;
1995 s_entry->hfs_ent->crdate = lstatbuf.
st_ctime;
1996 s_entry->hfs_ent->mddate = lstatbuf.
st_mtime;
2001 s_entry->hfs_ent->u.file.dsize = lstatbuf.
st_size;
2002 s_entry->hfs_ent->crdate = lstatbuf.
st_ctime;
2003 s_entry->hfs_ent->mddate = lstatbuf.
st_mtime;
2069 if (apple_both && s_entry->hfs_ent &&
2074 get_hfs_dir(whole_path,
short_name, s_entry);
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))
2176 errmsg(
_(
"Cannot read link '%s'.\n"),
2210#ifdef USE_NO_SCANDIR
2240 if (apple_both && !have_rsrc && s_entry->hfs_ent) {
2246 get_hfs_info(whole_path,
short_name, s_entry);
2259 print_hfs_info(s_entry);
2289 if (s_entry->hfs_ent &&
2292 free(s_entry->hfs_ent);
2294 s_entry->hfs_ent =
NULL;
2301 if (s_entry->assoc && s_entry->assoc->
size == 0)
2302 delete_rsrc_ent(s_entry);
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));
2329 s_entry->mode = lstatbuf.
st_mode;
2330 s_entry->rdev = lstatbuf.
st_rdev;
2331 s_entry->uid = lstatbuf.
st_uid;
2332 s_entry->gid = lstatbuf.
st_gid;
2333 s_entry->atime.tv_sec = lstatbuf.
st_atime;
2335 s_entry->mtime.tv_sec = lstatbuf.
st_mtime;
2337 s_entry->ctime.tv_sec = lstatbuf.
st_ctime;
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) {
2376 s_entry->
mxroot = s_entry;
2380 s_entry->
next = s_entry1;
2386 if (s_entry->
size > (((
off_t)190)*0x3FFFF800)) {
2388#define EOVERFLOW EFBIG
2391 _(
"File %s is too large - hiding from UDF tree.\n"),
2402 s_entry->
size = LARGE_EXTENT;
2408 while (
size > MAX_EXTENT) {
2410 s_entry->
next = s_entry1;
2414 size -= LARGE_EXTENT;
2419 s_entry->
isorec.flags[0] &= ~ISO_MULTIEXTENT;
2490 }
else if (parent ==
root) {
2532 error(
_(
"Warning: missing whole name for: '%s'\n"), de->
name);
2550 for (s_entry =
parent->contents; s_entry;
2551 s_entry = s_entry->
next) {
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"));
char * strcat(char *DstString, const char *SrcString)
int strcmp(const char *String1, const char *String2)
ACPI_SIZE strlen(const char *String)
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
char * strcpy(char *DstString, const char *SrcString)
char * strchr(const char *String, int ch)
#define gettimeofday(tv, tz)
size_t strlcpy(char *d, const char *s, size_t bufsize)
EXPORT void comerrno(int err, char *msg, va_alist)
EXPORT int errmsgno(int err, char *msg, va_alist)
EXPORT int errmsg(char *msg, va_alist)
GLuint GLuint GLsizei count
GLuint GLint GLboolean GLint GLenum access
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
int __cdecl closedir(DIR *)
DIR *__cdecl opendir(const char *)
struct dirent *__cdecl readdir(DIR *)
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
EXPORT void set_723(void *vp, UInt32_t i)
EXPORT UInt32_t get_733(void *vp)
EXPORT void set_733(void *vp, UInt32_t i)
EXPORT int js_snprintf(char *buf, unsigned maxcnt, char *form, va_alist)
EXPORT int iso9660_date(char *result, time_t crtime)
int volume_sequence_number
unsigned int path_table_size
EXPORT void * e_malloc(size_t size)
EXPORT char * e_strdup(char *s) const
int full_iso9660_filenames
#define memcpy(s1, s2, n)
#define INHIBIT_JOLIET_ENTRY
#define memmove(s1, s2, n)
#define RELOCATED_DIRECTORY
#define INHIBIT_UDF_ENTRY
#define INHIBIT_ISO9660_ENTRY
#define sprintf(buf, format,...)
int readlink(const char *path, char *buf, size_t size)
unsigned char * parse_xa(unsigned char *pnt, int *lenp, struct directory_entry *dpnt)
void finish_cl_pl_for_prev_session()
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)
#define offsetof(TYPE, MEMBER)
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
struct directory_entry * mxroot
unsigned int rr_attr_size
unsigned char * rr_attributes
struct directory_entry * next
struct iso_directory_record isorec
struct directory_entry * parent_rec
struct directory * filedir
unsigned int total_rr_attr_size
struct directory * parent
struct directory * subdir
struct directory_entry * self
struct directory_entry * contents
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList