]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
iso9660: rename all functions so that they are prefixed by iso9660
authorLennart Poettering <lennart@amutable.com>
Thu, 2 Apr 2026 12:10:16 +0000 (14:10 +0200)
committerLennart Poettering <lennart@amutable.com>
Sat, 4 Apr 2026 06:18:10 +0000 (08:18 +0200)
src/repart/iso9660.c
src/repart/iso9660.h
src/repart/repart.c

index 5bc9588e689288c7cbd579b5dc4ac90eaafab5cc..3f200942b2d516a8196ef1a21e5e659e059279d1 100644 (file)
@@ -8,7 +8,7 @@
 #include "string-util.h"
 #include "time-util.h"
 
-void no_iso9660_datetime(struct iso9660_datetime *ret) {
+void iso9660_datetime_zero(struct iso9660_datetime *ret) {
         assert(ret);
 
         memcpy(ret->year, "0000", 4);
@@ -21,7 +21,7 @@ void no_iso9660_datetime(struct iso9660_datetime *ret) {
         ret->zone = 0;
 }
 
-int time_to_iso9660_datetime(usec_t usec, bool utc, struct iso9660_datetime *ret) {
+int iso9660_datetime_from_usec(usec_t usec, bool utc, struct iso9660_datetime *ret) {
         struct tm t;
         int r;
 
@@ -49,7 +49,7 @@ int time_to_iso9660_datetime(usec_t usec, bool utc, struct iso9660_datetime *ret
         return 0;
 }
 
-int time_to_iso9660_dir_datetime(usec_t usec, bool utc, struct iso9660_dir_time *ret) {
+int iso9660_dir_datetime_from_usec(usec_t usec, bool utc, struct iso9660_dir_time *ret) {
         struct tm t;
         int r;
 
@@ -76,15 +76,15 @@ int time_to_iso9660_dir_datetime(usec_t usec, bool utc, struct iso9660_dir_time
         return 0;
 }
 
-static bool valid_iso9660_string(const char *str, bool allow_a_chars) {
+static bool iso9660_valid_string(const char *str, bool allow_a_chars) {
         /* note that a-chars are not supposed to accept lower case letters, but it looks like common practice
          * to use them
          */
         return in_charset(str, allow_a_chars ? UPPERCASE_LETTERS LOWERCASE_LETTERS DIGITS " _!\"%&'()*+,-./:;<=>?" : UPPERCASE_LETTERS DIGITS "_");
 }
 
-int set_iso9660_string(char target[], size_t len, const char *source, bool allow_a_chars) {
-        if (source && !valid_iso9660_string(source, allow_a_chars))
+int iso9660_set_string(char target[], size_t len, const char *source, bool allow_a_chars) {
+        if (source && !iso9660_valid_string(source, allow_a_chars))
                 return -EINVAL;
 
         if (source) {
@@ -101,16 +101,16 @@ int set_iso9660_string(char target[], size_t len, const char *source, bool allow
 
 bool iso9660_volume_name_valid(const char *name) {
         /* In theory the volume identifier should be d-chars, but in practice, a-chars are allowed */
-        return valid_iso9660_string(name, /* allow_a_chars= */ true) &&
+        return iso9660_valid_string(name, /* allow_a_chars= */ true) &&
                 strlen(name) <= 32;
 }
 
 bool iso9660_system_name_valid(const char *name) {
-        return valid_iso9660_string(name, /* allow_a_chars= */ true) &&
+        return iso9660_valid_string(name, /* allow_a_chars= */ true) &&
                 strlen(name) <= 32;
 }
 
 bool iso9660_publisher_name_valid(const char *name) {
-        return valid_iso9660_string(name, /* allow_a_chars= */ true) &&
+        return iso9660_valid_string(name, /* allow_a_chars= */ true) &&
                 strlen(name) <= 128;
 }
index 23db9e919a417a015a1a7e338189fce5c802aa2e..cdb6eef22678f62136592d381d72b0458732084e 100644 (file)
@@ -158,13 +158,13 @@ struct _packed_ el_torito_section_header {
         char id_string[28];
 };
 
-void no_iso9660_datetime(struct iso9660_datetime *ret);
-int time_to_iso9660_datetime(usec_t usec, bool utc, struct iso9660_datetime *ret);
-int time_to_iso9660_dir_datetime(usec_t usec, bool utc, struct iso9660_dir_time *ret);
-int set_iso9660_string(char target[], size_t len, const char *source, bool allow_a_chars);
+void iso9660_datetime_zero(struct iso9660_datetime *ret);
+int iso9660_datetime_from_usec(usec_t usec, bool utc, struct iso9660_datetime *ret);
+int iso9660_dir_datetime_from_usec(usec_t usec, bool utc, struct iso9660_dir_time *ret);
+int iso9660_set_string(char target[], size_t len, const char *source, bool allow_a_chars);
 
-static inline void set_iso9660_const_string(char target[], size_t len, const char *source, bool allow_a_chars) {
-        assert_se(set_iso9660_string(target, len, source, allow_a_chars) == 0);
+static inline void iso9660_set_const_string(char target[], size_t len, const char *source, bool allow_a_chars) {
+        assert_se(iso9660_set_string(target, len, source, allow_a_chars) == 0);
 }
 
 bool iso9660_volume_name_valid(const char *name);
index a21ec10da86cc37129d897475e0942fa667c7fdc..121cb22193613277d555ca67beb5aee6ff4908f4 100644 (file)
@@ -7769,43 +7769,43 @@ static int write_primary_descriptor(
                 }
         };
 
-        set_iso9660_const_string(desc.header.identifier, sizeof(desc.header.identifier), "CD001", /* allow_a_chars= */ true);
+        iso9660_set_const_string(desc.header.identifier, sizeof(desc.header.identifier), "CD001", /* allow_a_chars= */ true);
 
-        r = time_to_iso9660_dir_datetime(usec, utc, &desc.root_directory_entry.time);
+        r = iso9660_dir_datetime_from_usec(usec, utc, &desc.root_directory_entry.time);
         if (r < 0)
                 return r;
 
-        r = set_iso9660_string(desc.system_identifier, sizeof(desc.system_identifier), system_id, /* allow_a_chars= */ true);
+        r = iso9660_set_string(desc.system_identifier, sizeof(desc.system_identifier), system_id, /* allow_a_chars= */ true);
         if (r < 0)
                 return r;
 
         /* In theory the volume identifier should be d-chars, but in practice, a-chars are allowed */
-        r = set_iso9660_string(desc.volume_identifier, sizeof(desc.volume_identifier), volume_id, /* allow_a_chars= */ true);
+        r = iso9660_set_string(desc.volume_identifier, sizeof(desc.volume_identifier), volume_id, /* allow_a_chars= */ true);
         if (r < 0)
                 return r;
 
-        set_iso9660_const_string(desc.volume_set_identifier, sizeof(desc.volume_set_identifier), NULL, /* allow_a_chars= */ false);
+        iso9660_set_const_string(desc.volume_set_identifier, sizeof(desc.volume_set_identifier), NULL, /* allow_a_chars= */ false);
 
-        r = set_iso9660_string(desc.publisher_identifier, sizeof(desc.publisher_identifier), publisher_id, /* allow_a_chars= */ true);
+        r = iso9660_set_string(desc.publisher_identifier, sizeof(desc.publisher_identifier), publisher_id, /* allow_a_chars= */ true);
         if (r < 0)
                 return r;
 
-        set_iso9660_const_string(desc.data_preparer_identifier, sizeof(desc.data_preparer_identifier), NULL, /* allow_a_chars= */ true);
-        set_iso9660_const_string(desc.application_identifier, sizeof(desc.application_identifier), "SYSTEMD-REPART", /* allow_a_chars= */ true);
-        set_iso9660_const_string(desc.copyright_file_identifier, sizeof(desc.copyright_file_identifier), NULL, /* allow_a_chars= */ false);
-        set_iso9660_const_string(desc.abstract_file_identifier, sizeof(desc.abstract_file_identifier), NULL, /* allow_a_chars= */ false);
-        set_iso9660_const_string(desc.bibliographic_file_identifier, sizeof(desc.bibliographic_file_identifier), NULL, /* allow_a_chars= */ false);
+        iso9660_set_const_string(desc.data_preparer_identifier, sizeof(desc.data_preparer_identifier), NULL, /* allow_a_chars= */ true);
+        iso9660_set_const_string(desc.application_identifier, sizeof(desc.application_identifier), "SYSTEMD-REPART", /* allow_a_chars= */ true);
+        iso9660_set_const_string(desc.copyright_file_identifier, sizeof(desc.copyright_file_identifier), NULL, /* allow_a_chars= */ false);
+        iso9660_set_const_string(desc.abstract_file_identifier, sizeof(desc.abstract_file_identifier), NULL, /* allow_a_chars= */ false);
+        iso9660_set_const_string(desc.bibliographic_file_identifier, sizeof(desc.bibliographic_file_identifier), NULL, /* allow_a_chars= */ false);
 
-        r = time_to_iso9660_datetime(usec, utc, &desc.volume_creation_date);
+        r = iso9660_datetime_from_usec(usec, utc, &desc.volume_creation_date);
         if (r < 0)
                 return r;
 
-        r = time_to_iso9660_datetime(usec, utc, &desc.volume_modification_date);
+        r = iso9660_datetime_from_usec(usec, utc, &desc.volume_modification_date);
         if (r < 0)
                 return r;
 
-        no_iso9660_datetime(&desc.volume_expiration_date);
-        no_iso9660_datetime(&desc.volume_effective_date);
+        iso9660_datetime_zero(&desc.volume_expiration_date);
+        iso9660_datetime_zero(&desc.volume_effective_date);
 
         ssize_t s = pwrite(fd, &desc, sizeof(desc), ISO9660_PRIMARY_DESCRIPTOR*ISO9660_BLOCK_SIZE);
         if (s < 0)
@@ -7825,7 +7825,7 @@ static int write_eltorito_descriptor(int fd, uint32_t catalog_sector) {
                 .boot_catalog_sector = htole32(catalog_sector),
         };
 
-        set_iso9660_const_string(desc.header.identifier, sizeof(desc.header.identifier), "CD001", /* allow_a_chars= */ true);
+        iso9660_set_const_string(desc.header.identifier, sizeof(desc.header.identifier), "CD001", /* allow_a_chars= */ true);
 
         strncpy(desc.boot_system_identifier, "EL TORITO SPECIFICATION", sizeof(desc.boot_system_identifier));
 
@@ -7846,7 +7846,7 @@ static int write_terminal_descriptor(int fd) {
                 },
         };
 
-        set_iso9660_const_string(desc.header.identifier, sizeof(desc.header.identifier), "CD001", /* allow_a_chars= */ true);
+        iso9660_set_const_string(desc.header.identifier, sizeof(desc.header.identifier), "CD001", /* allow_a_chars= */ true);
 
         ssize_t s = pwrite(fd, &desc, sizeof(desc), ISO9660_TERMINAL_DESCRIPTOR*ISO9660_BLOCK_SIZE);
         if (s < 0)
@@ -7929,7 +7929,7 @@ static int write_directories(int fd, usec_t usec, bool utc, uint32_t root_sector
                 .ident[0] = 0, /* special value for self */
         };
 
-        r = time_to_iso9660_dir_datetime(usec, utc, &self.time);
+        r = iso9660_dir_datetime_from_usec(usec, utc, &self.time);
         if (r < 0)
                 return r;
 
@@ -7948,7 +7948,7 @@ static int write_directories(int fd, usec_t usec, bool utc, uint32_t root_sector
 
         // TODO: we should probably add some text file explaining there is no content through ISO9660
 
-        r = time_to_iso9660_dir_datetime(usec, utc, &parent.time);
+        r = iso9660_dir_datetime_from_usec(usec, utc, &parent.time);
         if (r < 0)
                 return r;