summaryrefslogtreecommitdiffstats
path: root/src/account/lock.h
diff options
context:
space:
mode:
authorRobin Hack <rhack@redhat.com>2013-10-31 08:32:36 +0100
committerRobin Hack <rhack@redhat.com>2013-10-31 13:40:40 +0100
commitaac4d3a0d1dc878c1a8c11fd55e47613ec7e9050 (patch)
tree105af161789aa04f2e6b1369f766f1fbfd48e737 /src/account/lock.h
parentecab16f131a16f4c01e596f86611881d1a95638f (diff)
downloadopenlmi-providers-aac4d3a0d1dc878c1a8c11fd55e47613ec7e9050.tar.gz
openlmi-providers-aac4d3a0d1dc878c1a8c11fd55e47613ec7e9050.tar.xz
openlmi-providers-aac4d3a0d1dc878c1a8c11fd55e47613ec7e9050.zip
Account: Added 3 changes as one.
1) Account: Use new atomic libuser api. 2) Account: Added author and license to lock.c and lock.h. 3) Account: Added group locking to LMI_AccountProvider.
Diffstat (limited to 'src/account/lock.h')
-rw-r--r--src/account/lock.h36
1 files changed, 32 insertions, 4 deletions
diff --git a/src/account/lock.h b/src/account/lock.h
index 84b9b0d..036d4ab 100644
--- a/src/account/lock.h
+++ b/src/account/lock.h
@@ -1,3 +1,22 @@
+/*
+ * Copyright (C) 2012-2013 Red Hat, Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author: Robin Hack <rhack@redhat.com>
+ */
#ifndef _LOCK_H
#define _LOCK_H
@@ -18,10 +37,19 @@ typedef struct lock_pool {
pthread_mutex_t csec;
} lock_pool_t;
-int init_lock_pool (void) __attribute__((warn_unused_result));
+typedef struct lock_pools {
+ lock_pool_t user_pool;
+ lock_pool_t group_pool;
+ int initialized;
+ pthread_mutex_t csec;
+} lock_pools_t;
+
+int init_lock_pools (void) __attribute__((warn_unused_result));
+void destroy_lock_pools (void);
-void destroy_lock_pool (void);
-int get_lock (const char *const username) __attribute__((nonnull));
-int release_lock (const char *const username) __attribute__((nonnull));
+int get_user_lock (const char *const username) __attribute__((nonnull));
+int get_group_lock (const char *const groupname) __attribute__((nonnull));
+int release_user_lock (const char *const username) __attribute__((nonnull));
+int release_group_lock (const char *const username) __attribute__((nonnull));
#endif /* _LOCK_H */