From bf2d66357b9135442f9dec277678b0597abc1d15 Mon Sep 17 00:00:00 2001 From: sinanmohd Date: Sat, 29 Jun 2024 07:21:15 +0530 Subject: solver_util: init --- include/jobs.h | 11 +++++++---- include/queue.h | 2 ++ include/solver_util.h | 11 +++++++++++ 3 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 include/solver_util.h (limited to 'include') diff --git a/include/jobs.h b/include/jobs.h index 7390306..54152cf 100644 --- a/include/jobs.h +++ b/include/jobs.h @@ -9,20 +9,23 @@ struct output { }; struct job { - char *name, *drv_path, *attr; + char *name, *drv_path, *nix_attr_name; bool scheduled; bool insubstituters; - size_t outputs_size, outputs_filled; struct output **outputs; + /* DAG */ size_t deps_size, deps_filled; struct job **deps; - size_t parents_size, parents_filled; struct job **parents; + /* queue */ CIRCLEQ_ENTRY(job) clist; + + /* solver */ + ssize_t id; }; CIRCLEQ_HEAD(job_clist, job); @@ -37,7 +40,7 @@ typedef enum { int job_read(FILE *stream, struct job **jobs); /* Spawns nix-eval-jobs and connects its stdout to stream */ -int jobs_init(FILE **stream, const char *expr); +int jobs_init(FILE **stream, char *expr); void job_free(struct job *j); int job_parents_list_insert(struct job *job, struct job *parent); void job_deps_list_rm(struct job *job, struct job *dep); diff --git a/include/queue.h b/include/queue.h index 4aca54b..fee5bb3 100644 --- a/include/queue.h +++ b/include/queue.h @@ -5,6 +5,7 @@ #include "htab.h" #include "jobs.h" +#include "solver_util.h" #ifndef QUEUE_H @@ -16,6 +17,7 @@ typedef enum { struct queue { struct job_clist jobs; struct htab *htab; + struct job_ids *job_ids; sem_t sem; queue_state_t state; pthread_mutex_t mutex; diff --git a/include/solver_util.h b/include/solver_util.h new file mode 100644 index 0000000..99d5fcd --- /dev/null +++ b/include/solver_util.h @@ -0,0 +1,11 @@ +#include "jobs.h" + +#ifndef SOLVER_UTIL_H + +struct job_ids { + struct job **jobs; + ssize_t filled, size; +}; + +#define SOLVER_UTIL_H +#endif -- cgit v1.2.3