From 0e3638380d195bb85cfc4199376f460a2eff62d3 Mon Sep 17 00:00:00 2001 From: Mike Yuan Date: Tue, 2 Jan 2024 20:27:02 +0800 Subject: [PATCH] various: unexport a few internal structs We don't expose destructors for these internal structs already. Let's make the struct itself implementation detail too. --- .../hibernate-resume-config.c | 19 ++++++++++++++++++ .../hibernate-resume-config.h | 20 ++----------------- src/shared/edit-util.c | 9 +++++++++ src/shared/edit-util.h | 14 ++----------- 4 files changed, 32 insertions(+), 30 deletions(-) diff --git a/src/hibernate-resume/hibernate-resume-config.c b/src/hibernate-resume/hibernate-resume-config.c index 201e14bc83b..a751a0ac4cd 100644 --- a/src/hibernate-resume/hibernate-resume-config.c +++ b/src/hibernate-resume/hibernate-resume-config.c @@ -11,6 +11,12 @@ #include "proc-cmdline.h" #include "efivars.h" +typedef struct KernelHibernateLocation { + char *device; + uint64_t offset; + bool offset_set; +} KernelHibernateLocation; + static KernelHibernateLocation* kernel_hibernate_location_free(KernelHibernateLocation *k) { if (!k) return NULL; @@ -22,6 +28,19 @@ static KernelHibernateLocation* kernel_hibernate_location_free(KernelHibernateLo DEFINE_TRIVIAL_CLEANUP_FUNC(KernelHibernateLocation*, kernel_hibernate_location_free); +typedef struct EFIHibernateLocation { + char *device; + + sd_id128_t uuid; + uint64_t offset; + + char *kernel_version; + char *id; + char *image_id; + char *version_id; + char *image_version; +} EFIHibernateLocation; + static EFIHibernateLocation* efi_hibernate_location_free(EFIHibernateLocation *e) { if (!e) return NULL; diff --git a/src/hibernate-resume/hibernate-resume-config.h b/src/hibernate-resume/hibernate-resume-config.h index be759ec5d6b..c0aa9e00ad1 100644 --- a/src/hibernate-resume/hibernate-resume-config.h +++ b/src/hibernate-resume/hibernate-resume-config.h @@ -5,24 +5,8 @@ #include "sd-id128.h" -typedef struct KernelHibernateLocation { - char *device; - uint64_t offset; - bool offset_set; -} KernelHibernateLocation; - -typedef struct EFIHibernateLocation { - char *device; - - sd_id128_t uuid; - uint64_t offset; - - char *kernel_version; - char *id; - char *image_id; - char *version_id; - char *image_version; -} EFIHibernateLocation; +typedef struct KernelHibernateLocation KernelHibernateLocation; +typedef struct EFIHibernateLocation EFIHibernateLocation; typedef struct HibernateInfo { const char *device; diff --git a/src/shared/edit-util.c b/src/shared/edit-util.c index fb9bdbc1601..cfb2828f4e3 100644 --- a/src/shared/edit-util.c +++ b/src/shared/edit-util.c @@ -16,6 +16,15 @@ #include "strv.h" #include "tmpfile-util-label.h" +typedef struct EditFile { + EditFileContext *context; + char *path; + char *original_path; + char **comment_paths; + char *temp; + unsigned line; +} EditFile; + void edit_file_context_done(EditFileContext *context) { int r; diff --git a/src/shared/edit-util.h b/src/shared/edit-util.h index 29ff81f4e74..9d9c890f2a9 100644 --- a/src/shared/edit-util.h +++ b/src/shared/edit-util.h @@ -7,18 +7,8 @@ #define DROPIN_MARKER_END "### Edits below this comment will be discarded" typedef struct EditFile EditFile; -typedef struct EditFileContext EditFileContext; -struct EditFile { - EditFileContext *context; - char *path; - char *original_path; - char **comment_paths; - char *temp; - unsigned line; -}; - -struct EditFileContext { +typedef struct EditFileContext { EditFile *files; size_t n_files; const char *marker_start; @@ -26,7 +16,7 @@ struct EditFileContext { bool remove_parent; bool overwrite_with_origin; /* Always overwrite target with original file. */ bool stdin; /* Read contents from stdin instead of launching an editor. */ -}; +} EditFileContext; void edit_file_context_done(EditFileContext *context);