From: Michael Haggerty Date: Tue, 01 Apr 2014 15:58:16 GMT Subject: [PATCH 08/22] struct lock_file: replace on_list field with flags field Message-ID: <1396367910-7299-9-git-send-email-mhagger@alum.mit.edu> In-Reply-To: <1396367910-7299-1-git-send-email-mhagger@alum.mit.edu> This makes space for other bits. Signed-off-by: Michael Haggerty --- cache.h | 2 +- lockfile.c | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/cache.h b/cache.h index 107ac61..08d0e48 100644 --- a/cache.h +++ b/cache.h @@ -537,7 +537,7 @@ struct lock_file { struct lock_file *next; int fd; pid_t owner; - char on_list; + unsigned char flags; char filename[PATH_MAX]; }; #define LOCK_DIE_ON_ERROR 1 diff --git a/lockfile.c b/lockfile.c index c989f6c..33325a4 100644 --- a/lockfile.c +++ b/lockfile.c @@ -4,6 +4,11 @@ #include "cache.h" #include "sigchain.h" +/* Values for lock_file::flags: */ + +/* This lock_file instance is in the lock_file_list */ +#define LOCK_FLAGS_ON_LIST 0x01 + static struct lock_file *lock_file_list; static const char *alternate_index_output; @@ -137,10 +142,10 @@ static int lock_file(struct lock_file *lk, const char *path, int flags) } lk->owner = getpid(); - if (!lk->on_list) { + if (!(lk->flags & LOCK_FLAGS_ON_LIST)) { /* Initialize *lk and add it to lock_file_list: */ lk->fd = -1; - lk->on_list = 1; + lk->flags |= LOCK_FLAGS_ON_LIST; lk->filename[0] = 0; lk->next = lock_file_list; lock_file_list = lk; -- 1.9.0