mirror of
https://github.com/hashcat/hashcat.git
synced 2024-12-26 16:38:35 +00:00
Prepare hwmon_ctx_t, not used yet
This commit is contained in:
parent
f8d538413e
commit
81bc9081ad
@ -40,4 +40,7 @@ int hm_set_fanspeed_with_device_id_xnvctrl (const uint device_id, const int fa
|
||||
|
||||
void hm_device_val_to_str (char *target_buf, int max_buf_size, char *suffix, int value);
|
||||
|
||||
int hwmon_ctx_init (hwmon_ctx_t *hwmon_ctx, const user_options_t *user_options);
|
||||
void hwmon_ctx_destroy (hwmon_ctx_t *hwmon_ctx);
|
||||
|
||||
#endif // _HWMON_H
|
||||
|
@ -1194,6 +1194,24 @@ typedef struct
|
||||
|
||||
} mask_ctx_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
bool enabled;
|
||||
|
||||
void *hm_adl;
|
||||
void *hm_nvml;
|
||||
void *hm_nvapi;
|
||||
void *hm_xnvctrl;
|
||||
|
||||
hm_attrs_t *hm_adapters_adl;
|
||||
hm_attrs_t *hm_adapters_nvapi;
|
||||
hm_attrs_t *hm_adapters_nvml;
|
||||
hm_attrs_t *hm_adapters_xnvctrl;
|
||||
|
||||
hm_attrs_t *hm_device;
|
||||
|
||||
} hwmon_ctx_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/**
|
||||
@ -1205,6 +1223,7 @@ typedef struct
|
||||
debugfile_ctx_t *debugfile_ctx;
|
||||
hashconfig_t *hashconfig;
|
||||
hashes_t *hashes;
|
||||
hwmon_ctx_t *hwmon_ctx;
|
||||
induct_ctx_t *induct_ctx;
|
||||
logfile_ctx_t *logfile_ctx;
|
||||
loopback_ctx_t *loopback_ctx;
|
||||
|
@ -2219,6 +2219,19 @@ int main (int argc, char **argv)
|
||||
* HM devices: init
|
||||
*/
|
||||
|
||||
hwmon_ctx_t *hwmon_ctx = (hwmon_ctx_t *) mymalloc (sizeof (hwmon_ctx_t));
|
||||
|
||||
data.hwmon_ctx = hwmon_ctx;
|
||||
|
||||
const int rc_hwmon_init = hwmon_ctx_init (hwmon_ctx, user_options);
|
||||
|
||||
if (rc_hwmon_init == -1)
|
||||
{
|
||||
log_error ("ERROR: hwmon_ctx_init() failed");
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
hm_attrs_t hm_adapters_adl[DEVICES_MAX];
|
||||
hm_attrs_t hm_adapters_nvapi[DEVICES_MAX];
|
||||
hm_attrs_t hm_adapters_nvml[DEVICES_MAX];
|
||||
@ -2952,6 +2965,8 @@ int main (int argc, char **argv)
|
||||
|
||||
opencl_ctx_devices_destroy (opencl_ctx);
|
||||
|
||||
hwmon_ctx_destroy (hwmon_ctx);
|
||||
|
||||
restore_ctx_destroy (restore_ctx);
|
||||
|
||||
time_t proc_stop;
|
||||
|
44
src/hwmon.c
44
src/hwmon.c
@ -869,3 +869,47 @@ int hm_set_fanspeed_with_device_id_xnvctrl (const uint device_id, const int fans
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int hwmon_ctx_init (hwmon_ctx_t *hwmon_ctx, const user_options_t *user_options)
|
||||
{
|
||||
hwmon_ctx->enabled = false;
|
||||
|
||||
if (user_options->gpu_temp_disable == true) return 0;
|
||||
|
||||
hwmon_ctx->hm_adapters_adl = (hm_attrs_t *) mycalloc (DEVICES_MAX, sizeof (hm_attrs_t));
|
||||
hwmon_ctx->hm_adapters_nvapi = (hm_attrs_t *) mycalloc (DEVICES_MAX, sizeof (hm_attrs_t));
|
||||
hwmon_ctx->hm_adapters_nvml = (hm_attrs_t *) mycalloc (DEVICES_MAX, sizeof (hm_attrs_t));
|
||||
hwmon_ctx->hm_adapters_xnvctrl = (hm_attrs_t *) mycalloc (DEVICES_MAX, sizeof (hm_attrs_t));
|
||||
|
||||
hwmon_ctx->hm_device = (hm_attrs_t *) mycalloc (DEVICES_MAX, sizeof (hm_attrs_t));
|
||||
|
||||
hwmon_ctx->enabled = true;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void hwmon_ctx_destroy (hwmon_ctx_t *hwmon_ctx)
|
||||
{
|
||||
if (hwmon_ctx->enabled == false) return;
|
||||
|
||||
myfree (hwmon_ctx->hm_device);
|
||||
|
||||
myfree (hwmon_ctx->hm_adapters_adl);
|
||||
myfree (hwmon_ctx->hm_adapters_nvapi);
|
||||
myfree (hwmon_ctx->hm_adapters_nvml);
|
||||
myfree (hwmon_ctx->hm_adapters_xnvctrl);
|
||||
|
||||
hwmon_ctx->hm_device = NULL;
|
||||
|
||||
hwmon_ctx->hm_adapters_adl = NULL;
|
||||
hwmon_ctx->hm_adapters_nvapi = NULL;
|
||||
hwmon_ctx->hm_adapters_nvml = NULL;
|
||||
hwmon_ctx->hm_adapters_xnvctrl = NULL;
|
||||
|
||||
hwmon_ctx->hm_adl = NULL;
|
||||
hwmon_ctx->hm_nvml = NULL;
|
||||
hwmon_ctx->hm_nvapi = NULL;
|
||||
hwmon_ctx->hm_xnvctrl = NULL;
|
||||
|
||||
myfree (hwmon_ctx);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user