From c62d0ec04c429ec1dfecec4947a3de91ec86e5b7 Mon Sep 17 00:00:00 2001 From: Artem Gavrilov Date: Tue, 29 Oct 2024 18:50:35 +0200 Subject: [PATCH] PG-1095 More manual code formatting --- src/access/pg_tde_ddl.c | 2 +- src/access/pg_tde_slot.c | 18 ++++++++--------- src/access/pg_tde_tdemap.c | 29 ++++++++++++++-------------- src/access/pg_tde_xlog.c | 4 ++-- src/catalog/tde_global_space.c | 10 +++++----- src/catalog/tde_keyring.c | 4 ++-- src/catalog/tde_keyring_parse_opts.c | 8 ++++---- src/common/pg_tde_shmem.c | 2 +- 8 files changed, 38 insertions(+), 39 deletions(-) diff --git a/src/access/pg_tde_ddl.c b/src/access/pg_tde_ddl.c index f109b649..9abfebe5 100644 --- a/src/access/pg_tde_ddl.c +++ b/src/access/pg_tde_ddl.c @@ -33,7 +33,7 @@ static void tdeheap_object_access_hook(ObjectAccessType access, Oid classId, Oid objectId, int subId, void *arg) { - Relation rel = NULL; + Relation rel = NULL; if (prev_object_access_hook) prev_object_access_hook(access, classId, objectId, subId, arg); diff --git a/src/access/pg_tde_slot.c b/src/access/pg_tde_slot.c index 45f22e53..d99a3d59 100644 --- a/src/access/pg_tde_slot.c +++ b/src/access/pg_tde_slot.c @@ -350,16 +350,16 @@ static pg_attribute_always_inline void tdeheap_slot_deform_heap_tuple(TupleTableSlot *slot, HeapTuple tuple, uint32 *offp, int natts) { - TupleDesc tupleDesc = slot->tts_tupleDescriptor; - Datum *values = slot->tts_values; - bool *isnull = slot->tts_isnull; + TupleDesc tupleDesc = slot->tts_tupleDescriptor; + Datum *values = slot->tts_values; + bool *isnull = slot->tts_isnull; HeapTupleHeader tup = tuple->t_data; - bool hasnulls = HeapTupleHasNulls(tuple); - int attnum; - char *tp; /* ptr to tuple data */ - uint32 off; /* offset in tuple data */ - bits8 *bp = tup->t_bits; /* ptr to null bitmap in tuple */ - bool slow; /* can we use/set attcacheoff? */ + bool hasnulls = HeapTupleHasNulls(tuple); + int attnum; + char *tp; /* ptr to tuple data */ + uint32 off; /* offset in tuple data */ + bits8 *bp = tup->t_bits; /* ptr to null bitmap in tuple */ + bool slow; /* can we use/set attcacheoff? */ /* We can only fetch as many attributes as the tuple has. */ natts = Min(HeapTupleHeaderGetNatts(tuple->t_data), natts); diff --git a/src/access/pg_tde_tdemap.c b/src/access/pg_tde_tdemap.c index 9cb70699..fa348d20 100644 --- a/src/access/pg_tde_tdemap.c +++ b/src/access/pg_tde_tdemap.c @@ -66,29 +66,29 @@ typedef struct TDEFileHeader { - int32 file_version; + int32 file_version; TDEPrincipalKeyInfo principal_key_info; } TDEFileHeader; typedef struct TDEMapEntry { RelFileNumber relNumber; - uint32 flags; - int32 key_index; + uint32 flags; + int32 key_index; } TDEMapEntry; typedef struct TDEMapFilePath { - char map_path[MAXPGPATH]; - char keydata_path[MAXPGPATH]; + char map_path[MAXPGPATH]; + char keydata_path[MAXPGPATH]; } TDEMapFilePath; typedef struct RelKeyCacheRec { RelFileNumber rel_number; - uint32 key_type; - RelKeyData key; + uint32 key_type; + RelKeyData key; } RelKeyCacheRec; /* @@ -106,10 +106,9 @@ typedef struct RelKeyCacheRec */ typedef struct RelKeyCache { - RelKeyCacheRec *data; /* must be a multiple of a memory page - * (usually 4Kb) */ - int len; /* num of RelKeyCacheRecs currenty in cache */ - int cap; /* max amount of RelKeyCacheRec data can fit */ + RelKeyCacheRec *data; /* must be a multiple of a memory page (usually 4Kb) */ + int len; /* num of RelKeyCacheRecs currenty in cache */ + int cap; /* max amount of RelKeyCacheRec data can fit */ } RelKeyCache; RelKeyCache *tde_rel_key_cache = NULL; @@ -248,7 +247,7 @@ RelKeyData * tde_encrypt_rel_key(TDEPrincipalKey *principal_key, RelKeyData *rel_key_data, const RelFileLocator *rlocator) { RelKeyData *enc_rel_key_data; - size_t enc_key_bytes; + size_t enc_key_bytes; AesEncryptKey(principal_key, rlocator, rel_key_data, &enc_rel_key_data, &enc_key_bytes); @@ -1088,10 +1087,10 @@ tde_decrypt_rel_key(TDEPrincipalKey *principal_key, RelKeyData *enc_rel_key_data static int pg_tde_open_file(char *tde_filename, TDEPrincipalKeyInfo *principal_key_info, bool should_fill_info, int fileFlags, bool *is_new_file, off_t *curr_pos) { - int fd = -1; + int fd = -1; TDEFileHeader fheader; - off_t bytes_read = 0; - off_t bytes_written = 0; + off_t bytes_read = 0; + off_t bytes_written = 0; /* * Ensuring that we always open the file in binary mode. The caller must diff --git a/src/access/pg_tde_xlog.c b/src/access/pg_tde_xlog.c index 32b93a95..107f1ff2 100644 --- a/src/access/pg_tde_xlog.c +++ b/src/access/pg_tde_xlog.c @@ -33,7 +33,7 @@ void tdeheap_rmgr_redo(XLogReaderState *record) { - uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK; + uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK; if (info == XLOG_TDE_ADD_RELATION_KEY) { @@ -82,7 +82,7 @@ tdeheap_rmgr_redo(XLogReaderState *record) void tdeheap_rmgr_desc(StringInfo buf, XLogReaderState *record) { - uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK; + uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK; if (info == XLOG_TDE_ADD_RELATION_KEY) { diff --git a/src/catalog/tde_global_space.c b/src/catalog/tde_global_space.c index 3e6091a6..2bdafb61 100644 --- a/src/catalog/tde_global_space.c +++ b/src/catalog/tde_global_space.c @@ -44,14 +44,14 @@ static void init_default_keyring(void); static TDEPrincipalKey *create_principal_key(const char *key_name, GenericKeyring *keyring, Oid dbOid, Oid spcOid); -#endif /* !FRONTEND */ +#endif /* !FRONTEND */ void TDEInitGlobalKeys(const char *dir) { #ifndef FRONTEND - char db_map_path[MAXPGPATH] = {0}; + char db_map_path[MAXPGPATH] = {0}; pg_tde_set_db_file_paths(GLOBAL_DATA_TDE_OID, GLOBALTABLESPACE_OID, db_map_path, NULL); if (access(db_map_path, F_OK) == -1) @@ -177,7 +177,7 @@ create_principal_key(const char *key_name, GenericKeyring *keyring, Oid dbOid, Oid spcOid) { TDEPrincipalKey *principalKey; - keyInfo *keyInfo = NULL; + keyInfo *keyInfo = NULL; principalKey = palloc(sizeof(TDEPrincipalKey)); principalKey->keyInfo.databaseId = dbOid; @@ -203,6 +203,6 @@ create_principal_key(const char *key_name, GenericKeyring *keyring, return principalKey; } -#endif /* FRONTEND */ +#endif /* FRONTEND */ -#endif /* PERCONA_EXT */ +#endif /* PERCONA_EXT */ diff --git a/src/catalog/tde_keyring.c b/src/catalog/tde_keyring.c index 5558a3aa..dcb89613 100644 --- a/src/catalog/tde_keyring.c +++ b/src/catalog/tde_keyring.c @@ -623,7 +623,7 @@ load_vaultV2_keyring_provider_options(char *keyring_options) static void debug_print_kerying(GenericKeyring *keyring) { - int debug_level = DEBUG2; + int debug_level = DEBUG2; elog(debug_level, "Keyring type: %d", keyring->type); elog(debug_level, "Keyring name: %s", keyring->provider_name); @@ -648,7 +648,7 @@ debug_print_kerying(GenericKeyring *keyring) static char * get_keyring_infofile_path(char *resPath, Oid dbOid, Oid spcOid) { - char *db_path = pg_tde_get_tde_file_dir(dbOid, spcOid); + char *db_path = pg_tde_get_tde_file_dir(dbOid, spcOid); Assert(db_path != NULL); join_path_components(resPath, db_path, PG_TDE_KEYRING_FILENAME); diff --git a/src/catalog/tde_keyring_parse_opts.c b/src/catalog/tde_keyring_parse_opts.c index 22564f42..e9334fa8 100644 --- a/src/catalog/tde_keyring_parse_opts.c +++ b/src/catalog/tde_keyring_parse_opts.c @@ -47,7 +47,7 @@ typedef enum JsonKeringSemState { JK_EXPECT_TOP_FIELD, JK_EXPECT_EXTERN_VAL, -} JsonKeringSemState; +} JsonKeringSemState; #define KEYRING_REMOTE_FIELD_TYPE "remote" #define KEYRING_FILE_FIELD_TYPE "file" @@ -71,7 +71,7 @@ typedef enum JsonKeyringField /* must be the last */ JK_FIELDS_TOTAL -} JsonKeyringField; +} JsonKeyringField; static const char *JK_FIELD_NAMES[JK_FIELDS_TOTAL] = { [JK_FIELD_UNKNOWN] = "unknownField", @@ -444,8 +444,8 @@ get_remote_kring_value(const char *url, const char *field_name) static char * get_file_kring_value(const char *path, const char *field_name) { - int fd = -1; - char *val; + int fd = -1; + char *val; fd = BasicOpenFile(path, O_RDONLY); if (fd < 0) diff --git a/src/common/pg_tde_shmem.c b/src/common/pg_tde_shmem.c index a1ebcad1..3a0b98ed 100644 --- a/src/common/pg_tde_shmem.c +++ b/src/common/pg_tde_shmem.c @@ -137,7 +137,7 @@ TdeShmemInit(void) static void tde_shmem_shutdown(int code, Datum arg) { - ListCell *lc; + ListCell *lc; foreach(lc, registeredShmemRequests) {