Hi,

We found out that it's not possible to create UDF images with hidden files 
using mkisofs, though UDF specification supports this feature. The patch below 
adds support into mkisofs (v3.02a09). May the patch be considered to be added 
to (hopefully) upcoming version?

>From 268973af2e3fa0f19e873ace23d5d339bd3b85ee Mon Sep 17 00:00:00 2001
From: Eugene Mironenko <mirone...@rutoken.ru>
Date: Mon, 15 Jul 2019 20:54:04 +0300
Subject: [PATCH] Support setting 'hidden' FileCharacteristic in UDF

Options '-hidden' and '-hidden-list' work for UDF images the same
way as for IS09660.
---
mkisofs/udf.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/mkisofs/udf.c b/mkisofs/udf.c
index 50587d5..b6cd9c3 100644
--- a/mkisofs/udf.c
+++ b/mkisofs/udf.c
@@ -150,7 +150,7 @@ LOCAL void        set_unallocated_space_desc __PR((unsigned 
char *buf, UInt32_t lba));
LOCAL void    set_terminating_desc __PR((unsigned char *buf, UInt32_t lba));
LOCAL void        set_logical_vol_integrity_desc __PR((unsigned char *buf, 
UInt32_t lba));
LOCAL void    set_file_set_desc __PR((unsigned char *buf, UInt32_t rba));
-LOCAL int     set_file_ident_desc __PR((unsigned char *, UInt32_t, char *, 
int, UInt32_t, unsigned));
+LOCAL int     set_file_ident_desc __PR((unsigned char *, UInt32_t, char *, 
int, int, UInt32_t, unsigned));
LOCAL void    set_file_entry __PR((unsigned char *buf, UInt32_t rba, UInt32_t 
file_rba,
                      off_t length, int is_directory,
                      unsigned link_count, unsigned unique_id, hfsdirent 
*hfs_ent,
@@ -282,7 +282,7 @@ directory_size(dpnt)
       Uchar dummy_buf[SECTOR_SIZE];
        /* parent directory */
-       size_in_bytes = set_file_ident_desc(dummy_buf, 0, 0, 0, 0, 0);
+       size_in_bytes = set_file_ident_desc(dummy_buf, 0, 0, 0, 0, 0, 0);
        /* directory contents */
       for (de = dpnt->jcontents; de; de = de->jnext) {
@@ -291,7 +291,7 @@ directory_size(dpnt)
                      /* skip . and .. */
                      if (name[0] == '.' && (name[1] == 0 || (name[1] == '.' && 
name[2] == 0)))
                              continue;
-                      size_in_bytes += set_file_ident_desc(dummy_buf, 0, name, 
0, 0, 0);
+                      size_in_bytes += set_file_ident_desc(dummy_buf, 0, name, 
0, 0, 0, 0);
              }
       }
       return (size_in_bytes);
@@ -870,11 +870,12 @@ set_file_set_desc(buf, rba)
}
 LOCAL int
-set_file_ident_desc(buf, rba, name, is_directory, file_entry_rba, unique_id)
+set_file_ident_desc(buf, rba, name, is_directory, is_hidden, file_entry_rba, 
unique_id)
       unsigned char  *buf;
       UInt32_t       rba;
       char           *name;
       int            is_directory;
+       int            is_hidden;
       UInt32_t       file_entry_rba;
       unsigned       unique_id;
{
@@ -883,7 +884,8 @@ set_file_ident_desc(buf, rba, name, is_directory, 
file_entry_rba, unique_id)
       set16(&fid->file_version_number, 1);
       set8(&fid->file_characteristics,
              (is_directory ? UDF_FILE_CHARACTERISTIC_DIRECTORY : 0)
-              + (name == 0) * UDF_FILE_CHARACTERISTIC_PARENT);
+              + (name == 0) * UDF_FILE_CHARACTERISTIC_PARENT
+              + (is_hidden ? UDF_FILE_CHARACTERISTIC_HIDDEN : 0));
       set32(&fid->icb.extent_length, SECTOR_SIZE);
       set32(&fid->icb.extent_location.logical_block_number, file_entry_rba);
       set16(&fid->icb.extent_location.partition_reference_number, 0);
@@ -1777,6 +1779,7 @@ write_one_udf_directory(dpnt, outfile)
              base_sector,
              0,
              1,
+              0,
              parent->self->udf_file_entry_sector - lba_udf_partition_start,
              (parent == root) ? 0 : parent->self->udf_file_entry_sector);
       xfwrite(buf, ident_size, 1, outfile, 0, FALSE);
@@ -1816,6 +1819,7 @@ write_one_udf_directory(dpnt, outfile)
                      base_sector + (size_in_bytes / SECTOR_SIZE),
                      name,
                      !!(de1->isorec.flags[0] & ISO_DIRECTORY),
+                      !!(de1->de_flags & HIDDEN_FILE),
                      de1->udf_file_entry_sector - lba_udf_partition_start,
                      de1->udf_file_entry_sector);
              xfwrite(buf, ident_size, 1, outfile, 0, FALSE);
--
2.21.0


С уважением,
Евгений Мироненко
Системный программист
ЗАО <Актив-софт>
mirone...@rutoken.ru<mailto:mirone...@rutoken.ru>  / 
www.aktiv-company.ru<http://www.aktiv-company.ru/>

_______________________________________________
Cdrtools-developers mailing list
Cdrtools-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdrtools-developers

Reply via email to