Skip to content

Commit

Permalink
Run autoformatter
Browse files Browse the repository at this point in the history
  • Loading branch information
JBenda committed Jun 9, 2022
1 parent 0cc67c6 commit 308b5bb
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 43 deletions.
7 changes: 3 additions & 4 deletions include/core/jconfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,14 @@ struct JConfiguration;

typedef struct JConfiguration JConfiguration;

struct JStorageTier {
struct JStorageTier
{
guint64 bandwidth; ///< bandwidth in byte ber second
guint64 latency; ///< latency in ns
guint64 capacity; ///< capacity in byte
};
typedef struct JStorageTier JStorageTier;



/**
* Returns the configuration.
*
Expand Down Expand Up @@ -127,7 +126,7 @@ guint64 j_configuration_get_stripe_size(JConfiguration*);
gchar const* j_configuration_get_object_policy_kv_backend(JConfiguration*);
gchar const* j_configuration_get_object_policy_kv_path(JConfiguration*);
gchar const* j_configuration_get_object_policy(JConfiguration*);
gchar const*const* j_configuration_get_object_policy_args(JConfiguration*);
gchar const* const* j_configuration_get_object_policy_args(JConfiguration*);
G_END_DECLS

/**
Expand Down
25 changes: 12 additions & 13 deletions include/core/jmanagedbackends.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,23 +58,23 @@ typedef struct JBackend JBackend;
* \defgroup JStorageTier
*
* \todo evaluate characteristics
* Collection of characteristics about a storage media, used for distribution
* decisions by the policy.
* decisions by the policy.
*
* \attention all values contained in this may only fixed values
* and as this not measured!
*
*
* @{
**/

struct JStorageTier;
typedef struct JStorageTier JStorageTier;

/**
/**
* get estimated storage tier bandwidth in bytes per second
*
* \param[in] this a storage tier
* \param[in] this a storage tier
*
* \return mean of bandwidth in bytes per second
**/
Expand Down Expand Up @@ -104,7 +104,7 @@ struct JManagedBackends;
typedef struct JManagedBackends JManagedBackends;

/**
* Contains data about an ongoing access to a object.
* Contains data about an ongoing access to a object.
**/
struct JManagedBackendScope;
typedef struct JManagedBackendScope JManagedBackendScope;
Expand Down Expand Up @@ -146,7 +146,7 @@ typedef struct
* The list is like the strings NULL terminated
* \param[in] backends access to the object backend instances.
**/
gboolean (*init)(gpointer* policy_data, gchar const*const* args, JManagedBackends* backends);
gboolean (*init)(gpointer* policy_data, gchar const* const* args, JManagedBackends* backends);

/**
* \param[in] policy_data data at address assigned in init
Expand All @@ -169,7 +169,7 @@ typedef struct
* the object is currently stored on
* \param[in] access type of access performed \sa JObjectBackendAccessType
* \param[in] data corresponding to the access type.
* For more details see \ref JObjectBackendAccessDetails
* For more details see \ref JObjectBackendAccessDetails
**/
gboolean (*process_access)(gpointer policy_data, const gchar* namespace, const gchar* path, guint obj_id, guint tier, JObjectBackendAccessTypes access, gconstpointer data);

Expand Down Expand Up @@ -211,7 +211,7 @@ typedef struct
JObjectBackendPolicy* backend_policy_info(void);

/**
* \defgroup JObjectBackendAccessDetails
* \defgroup JObjectBackendAccessDetails
*
* Structs used to pass additional data on a
* JObjectBackendPolicy.process_access call
Expand Down Expand Up @@ -244,7 +244,7 @@ gboolean j_backend_managed_fini(JManagedBackends* this);

/**
* Hands current thread to policy as processing resource
* \sa JObjectBackendPolicy
* \sa JObjectBackendPolicy
*
* \param[in] this JManagedBackends instance
* \param[out] keep_running signals if the policy processing function should be called again after return
Expand Down Expand Up @@ -283,7 +283,7 @@ gboolean j_backend_managed_object_close(JManagedBackendScope* scope);

/**
* Sends a message to the policy.
* \todo add reply channel
* \todo add reply channel
*
* \param[in] this JManagedBackends instance
* \param[in] type message type encoded as 0-terminated string
Expand Down Expand Up @@ -368,7 +368,6 @@ gboolean j_backend_managed_unlock(JManagedBackends* this);
**/
gboolean j_backend_managed_get_all(JManagedBackends* this, gchar const* namespace, gpointer* iterator);


/**
* Iterate all object paths in a namespace with a given prefix
*
Expand All @@ -387,7 +386,7 @@ gboolean j_backend_managed_get_by_prefix(JManagedBackends* this, gchar const* na
* \attention Objects added or removed while iterating may invalidates the iterator. This depends on the used kv-store-backend for the JManagedBackends
*
* \param[in] this JManagedBackends instance
* \param[inout] iterator
* \param[inout] iterator
* \param[out] path of next object
*
* \sa j_backend_managed_get_all(), j_backend_managed_get_by_prefix()
Expand Down
50 changes: 26 additions & 24 deletions lib/core/jmanagedbackends.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@
typedef struct
{
gint read_access_count; ///< number of read access
guint generation; ///< generation count, incremented after each write_access
gint write_access; ///< true if a write operation is scheduled or running
guint generation; ///< generation count, incremented after each write_access
gint write_access; ///< true if a write operation is scheduled or running
} RWSpinLock;

/// acquired a read lock
/** \public \memberof RWSpinLock
* \return data gegenartion when clock is acquired
* \return data gegenartion when clock is acquired
* \sa read_unlock */
guint read_lock(RWSpinLock* this);

Expand All @@ -47,7 +47,7 @@ void read_unlock(RWSpinLock* this);

/// acquire a write lock
/** \public \memberof RWSpinLock
* this will increase the generation count
* this will increase the generation count
* \return generation before
* \sa write_unlock*/
guint write_lock(RWSpinLock* this);
Expand Down Expand Up @@ -275,22 +275,24 @@ write_unlock(RWSpinLock* this)
}

/// proxy function
gchar const*const* j_configuration_get_object_tiers(JConfiguration* config);
gchar const*const* j_configuration_get_object_tiers(JConfiguration* config) {
(void) config;
gchar const* const* j_configuration_get_object_tiers(JConfiguration* config);
gchar const* const*
j_configuration_get_object_tiers(JConfiguration* config)
{
(void)config;
return NULL;
}

gboolean
j_backend_managed_init(JConfiguration* config, JList* object_backends, JManagedBackends** instance_ptr)
{
JListIterator* itr;
gchar const*const* tier_itr;
gchar const* const* tier_itr;
JManagedBackends* this;
struct JBackendWrapper** b_itr;
struct JStorageTier** t_itr;
const gchar* policy_name = j_configuration_get_object_policy(config);
char const*const* policy_args = j_configuration_get_object_policy_args(config);
char const* const* policy_args = j_configuration_get_object_policy_args(config);
JObjectBackendPolicy* (*module_backend_policy_info)(void) = NULL;
JObjectBackendPolicy* tmp_policy;
*instance_ptr = malloc(sizeof(JManagedBackends));
Expand Down Expand Up @@ -432,10 +434,10 @@ gboolean j_backend_managed_object_create(JManagedBackends* this, const gchar* na
/// \TODO remove scope return <- just complete virtual
gboolean
j_backend_managed_object_open(JManagedBackends* this,
const gchar* namespace,
const gchar* path,
JBackend** backend,
JManagedBackendScope** scope)
const gchar* namespace,
const gchar* path,
JBackend** backend,
JManagedBackendScope** scope)
{
struct KVEntry* entry;
struct JBackendWrapper* wrapper;
Expand Down Expand Up @@ -475,10 +477,10 @@ j_backend_managed_object_open(JManagedBackends* this,

gboolean
j_backend_managed_object_create(JManagedBackends* this,
const gchar* namespace,
const gchar* path,
JBackend** backend,
JManagedBackendScope** scope)
const gchar* namespace,
const gchar* path,
JBackend** backend,
JManagedBackendScope** scope)
{
gboolean ret = FALSE;
struct JBackendWrapper* wrapper;
Expand Down Expand Up @@ -543,7 +545,7 @@ j_backend_managed_object_close(JManagedBackendScope* this)

gboolean
j_backend_managed_policy_message(JManagedBackends* this,
const gchar* type, gpointer data, guint length)
const gchar* type, gpointer data, guint length)
{
if (this->policy->process_message)
{
Expand All @@ -565,7 +567,7 @@ j_backend_managed_get_tiers(JManagedBackends* this, JStorageTier const* const**

guint
j_backend_managed_get_tier(JManagedBackends* this,
const gchar* namespace, const gchar* path)
const gchar* namespace, const gchar* path)
{
struct KVEntry* entry;
EXE(kv_get(this, namespace, path, &entry),
Expand Down Expand Up @@ -631,8 +633,8 @@ kv_rm(JManagedBackends* this, const gchar* namespace, const gchar* key)

gboolean
j_backend_managed_lock(JManagedBackends* this,
JBackend*** backends,
guint* length)
JBackend*** backends,
guint* length)
{
write_lock(&this->global_lock);
if (backends != NULL)
Expand Down Expand Up @@ -705,9 +707,9 @@ j_backend_storage_tier_get_capacity(const JStorageTier* this)

gboolean
j_backend_managed_object_migrate(JManagedBackends* this,
const gchar* namespace,
const gchar* path,
guint dest)
const gchar* namespace,
const gchar* path,
guint dest)
{
struct KVEntry* entry;
struct KVEntry new_entry;
Expand Down
3 changes: 1 addition & 2 deletions tools/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ write_config(gchar* path)
servers_kv = string_split(opt_servers_kv);
servers_db = string_split(opt_servers_db);
object_policy_args = string_split(opt_object_policy_args);


key_file = g_key_file_new();
g_key_file_set_int64(key_file, "core", "max-operation-size", opt_max_operation_size);
Expand All @@ -133,7 +132,7 @@ write_config(gchar* path)
g_key_file_set_string(key_file, "object.hsm-policy", "kv_backend", opt_object_policy_kv_backend);
g_key_file_set_string(key_file, "object.hsm-policy", "kv_path", opt_object_policy_kv_path);
g_key_file_set_string(key_file, "object.hsm-policy", "policy", opt_object_policy);
g_key_file_set_string_list(key_file, "object.hsm-policy", "args", (gchar const*const*)object_policy_args, g_strv_length(object_policy_args));
g_key_file_set_string_list(key_file, "object.hsm-policy", "args", (gchar const* const*)object_policy_args, g_strv_length(object_policy_args));
key_file_data = g_key_file_to_data(key_file, &key_file_data_len, NULL);

if (path != NULL)
Expand Down

0 comments on commit 308b5bb

Please sign in to comment.