dlm: master - dlm_controld: clean up default defines and their usage
by David Teigland
Gitweb: http://git.fedorahosted.org/git/dlm.git?p=dlm.git;a=commitdiff;h=bc70e884...
Commit: bc70e884fdfdbed3cf51091f506be415716982da
Parent: 3ee4f78d0039e1dc67382cfc4a2ada0ae2c1851f
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Oct 5 15:33:02 2011 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Oct 5 16:27:47 2011 -0500
dlm_controld: clean up default defines and their usage
Signed-off-by: David Teigland <teigland(a)redhat.com>
---
dlm_controld/config.c | 8 ++--
dlm_controld/dlm_daemon.h | 35 ++++++++++++--------
dlm_controld/logging.c | 3 +-
dlm_controld/main.c | 76 +++++++++++++++++++++++++++++++-------------
4 files changed, 80 insertions(+), 42 deletions(-)
diff --git a/dlm_controld/config.c b/dlm_controld/config.c
index 40b0c87..6c94fca 100644
--- a/dlm_controld/config.c
+++ b/dlm_controld/config.c
@@ -46,18 +46,18 @@ void setup_config(int update)
xmlNode *root;
xmlChar *str;
- if (!path_exists(DLM_CONFIG_FILE))
+ if (!path_exists(CONF_FILE_PATH))
return;
- doc = xmlParseFile(DLM_CONFIG_FILE);
+ doc = xmlParseFile(CONF_FILE_PATH);
if (!doc) {
- log_error("xml parse error %d %s", errno, DLM_CONFIG_FILE);
+ log_error("xml parse error %d %s", errno, CONF_FILE_PATH);
return;
}
root = xmlDocGetRootElement(doc);
if (!root) {
- log_error("xml root error %d %s", errno, DLM_CONFIG_FILE);
+ log_error("xml root error %d %s", errno, CONF_FILE_PATH);
xmlFreeDoc(doc);
return;
}
diff --git a/dlm_controld/dlm_daemon.h b/dlm_controld/dlm_daemon.h
index 9627118..9c180d7 100644
--- a/dlm_controld/dlm_daemon.h
+++ b/dlm_controld/dlm_daemon.h
@@ -43,20 +43,27 @@
#include "rbtree.h"
#include "linux_endian.h"
-/* TODO: cleanup */
-#define CLUSTERVARLIB "/var/lib/cluster"
-#define CLUSTERVARRUN "/var/run/cluster"
-#define LOGDIR "/var/log/cluster"
-#define SYSLOGFACILITY LOG_LOCAL4
-#define SYSLOGLEVEL LOG_INFO
-#define LOCKFILE_NAME CLUSTERVARRUN "/dlm_controld.pid"
-#define DAEMON_NAME "dlm_controld"
-#define DEFAULT_LOG_MODE LOG_MODE_OUTPUT_FILE|LOG_MODE_OUTPUT_SYSLOG
-#define DEFAULT_SYSLOG_FACILITY SYSLOGFACILITY
-#define DEFAULT_SYSLOG_PRIORITY SYSLOGLEVEL
-#define DEFAULT_LOGFILE_PRIORITY LOG_INFO /* ? */
-#define DEFAULT_LOGFILE LOGDIR "/" DAEMON_NAME ".log"
-#define DLM_CONFIG_FILE "/etc/dlm.conf"
+/* TODO: get CONFDIR, LOGDIR, RUNDIR from build */
+
+#define RUNDIR "/var/run/cluster"
+#define LOGDIR "/var/log/cluster"
+#define CONFDIR "/etc"
+
+#define RUN_FILE_NAME "dlm_controld.pid"
+#define LOG_FILE_NAME "dlm_controld.log"
+#define CONF_FILE_NAME "dlm.conf"
+
+#define RUN_FILE_PATH RUNDIR "/" RUN_FILE_NAME
+#define LOG_FILE_PATH LOGDIR "/" LOG_FILE_NAME
+#define CONF_FILE_PATH CONFDIR "/" CONF_FILE_NAME
+
+#define DEFAULT_LOG_MODE LOG_MODE_OUTPUT_FILE | LOG_MODE_OUTPUT_SYSLOG
+#define DEFAULT_SYSLOG_FACILITY LOG_LOCAL4
+#define DEFAULT_SYSLOG_PRIORITY LOG_INFO
+#define DEFAULT_LOGFILE_PRIORITY LOG_INFO
+#define DEFAULT_LOGFILE LOG_FILE_PATH
+
+#define DAEMON_NAME "dlm_controld"
/* DLM_LOCKSPACE_LEN: maximum lockspace name length, from linux/dlmconstants.h.
diff --git a/dlm_controld/logging.c b/dlm_controld/logging.c
index e6e82b7..cb3c7fb 100644
--- a/dlm_controld/logging.c
+++ b/dlm_controld/logging.c
@@ -30,7 +30,8 @@ void init_logging(void)
void setup_logging(void)
{
- /* TODO */
+
+ /* TODO: look for settings for each of these in dlm.conf */
/*
ccs_read_logging(ccs_handle, DAEMON_NAME,
&cfgd_debug_logfile, &log_mode,
diff --git a/dlm_controld/main.c b/dlm_controld/main.c
index 0fa10fb..2be088a 100644
--- a/dlm_controld/main.c
+++ b/dlm_controld/main.c
@@ -989,20 +989,29 @@ static void loop(void)
log_error("abandoned lockspace %s", ls->name);
}
-static void lockfile(void)
+static int lockfile(const char *dir, const char *name)
{
- int fd, error;
+ char path[PATH_MAX];
+ char buf[16];
struct flock lock;
- char buf[33];
+ mode_t old_umask;
+ int fd, rv;
- memset(buf, 0, 33);
+ old_umask = umask(0022);
+ rv = mkdir(dir, 0777);
+ if (rv < 0 && errno != EEXIST) {
+ umask(old_umask);
+ return rv;
+ }
+ umask(old_umask);
- fd = open(LOCKFILE_NAME, O_CREAT|O_WRONLY,
- S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
+ snprintf(path, PATH_MAX, "%s/%s", dir, name);
+
+ fd = open(path, O_CREAT|O_WRONLY|O_CLOEXEC, 0666);
if (fd < 0) {
- fprintf(stderr, "cannot open/create lock file %s\n",
- LOCKFILE_NAME);
- exit(EXIT_FAILURE);
+ log_error("lockfile open error %s: %s",
+ path, strerror(errno));
+ return -1;
}
lock.l_type = F_WRLCK;
@@ -1010,25 +1019,43 @@ static void lockfile(void)
lock.l_whence = SEEK_SET;
lock.l_len = 0;
- error = fcntl(fd, F_SETLK, &lock);
- if (error) {
- fprintf(stderr, "dlm_controld is already running\n");
- exit(EXIT_FAILURE);
+ rv = fcntl(fd, F_SETLK, &lock);
+ if (rv < 0) {
+ log_error("lockfile setlk error %s: %s",
+ path, strerror(errno));
+ goto fail;
}
- error = ftruncate(fd, 0);
- if (error) {
- fprintf(stderr, "cannot clear lock file %s\n", LOCKFILE_NAME);
- exit(EXIT_FAILURE);
+ rv = ftruncate(fd, 0);
+ if (rv < 0) {
+ log_error("lockfile truncate error %s: %s",
+ path, strerror(errno));
+ goto fail;
}
- sprintf(buf, "%d\n", getpid());
+ memset(buf, 0, sizeof(buf));
+ snprintf(buf, sizeof(buf), "%d\n", getpid());
- error = write(fd, buf, strlen(buf));
- if (error <= 0) {
- fprintf(stderr, "cannot write lock file %s\n", LOCKFILE_NAME);
- exit(EXIT_FAILURE);
+ rv = write(fd, buf, strlen(buf));
+ if (rv <= 0) {
+ log_error("lockfile write error %s: %s",
+ path, strerror(errno));
+ goto fail;
}
+
+ return fd;
+ fail:
+ close(fd);
+ return -1;
+}
+
+static void unlink_lockfile(int fd, const char *dir, const char *name)
+{
+ char path[PATH_MAX];
+
+ snprintf(path, PATH_MAX, "%s/%s", dir, name);
+ unlink(path);
+ close(fd);
}
static void print_usage(void)
@@ -1200,6 +1227,8 @@ static void set_scheduler(void)
int main(int argc, char **argv)
{
+ int fd;
+
INIT_LIST_HEAD(&lockspaces);
INIT_LIST_HEAD(&fs_register_list);
@@ -1211,7 +1240,7 @@ int main(int argc, char **argv)
exit(EXIT_FAILURE);
}
}
- lockfile();
+ fd = lockfile(RUNDIR, RUN_FILE_NAME);
init_logging();
log_level(NULL, LOG_INFO, "dlm_controld %s started", RELEASE_VERSION);
signal(SIGTERM, sigterm_handler);
@@ -1219,6 +1248,7 @@ int main(int argc, char **argv)
loop();
+ unlink_lockfile(fd, RUNDIR, RUN_FILE_NAME);
return 0;
}
12 years, 7 months
dlm: master - version.cf: define RELEASE_VERSION
by David Teigland
Gitweb: http://git.fedorahosted.org/git/dlm.git?p=dlm.git;a=commitdiff;h=3ee4f78d...
Commit: 3ee4f78d0039e1dc67382cfc4a2ada0ae2c1851f
Parent: 0ffe7415f206a9a874fe853b519e9f2a1d4c39e8
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Oct 4 14:23:48 2011 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Oct 5 15:15:25 2011 -0500
version.cf: define RELEASE_VERSION
Signed-off-by: David Teigland <teigland(a)redhat.com>
---
.gitignore | 42 ------------------------------------------
Makefile | 15 +++++++++++++++
dlm_controld/Makefile | 2 +-
dlm_controld/dlm_daemon.h | 2 --
dlm_controld/main.c | 7 +++++--
dlm_tool/main.c | 3 ++-
include/version.cf | 6 ++++++
7 files changed, 29 insertions(+), 48 deletions(-)
diff --git a/.gitignore b/.gitignore
index 9b3b81a..e69de29 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,42 +0,0 @@
-*.swp
-Makefile.in
-aclocal.m4
-autoconf
-autoheader
-autom4te.cache
-automake
-compile
-configure
-config.guess
-config.log
-config.sub
-config.status
-Makefile
-depcomp
-install-sh
-libtoolize
-ltmain.sh
-libtool
-make/stamp-h1
-m4
-make/clusterautoconfig.h*
-missing
-*.pc
-.deps
-.libs
-*.o
-*.la
-*.lo
-dlm/tests/usertest/alternate-lvb
-dlm/tests/usertest/asttest
-dlm/tests/usertest/dlmtest
-dlm/tests/usertest/dlmtest2
-dlm/tests/usertest/flood
-dlm/tests/usertest/joinleave
-dlm/tests/usertest/lstest
-dlm/tests/usertest/lvb
-dlm/tests/usertest/pingtest
-dlm/tests/usertest/threads
-dlm/tool/dlm_tool
-group/dlm_controld/dlm_controld
-group/dlm_controld/dlm_controld.pcmk
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..0b6ec6a
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,15 @@
+all:
+ make -C libdlm $@
+ make -C dlm_controld $@
+ make -C dlm_tool $@
+
+install:
+ make -C libdlm $@
+ make -C dlm_controld $@
+ make -C dlm_tool $@
+
+clean:
+ make -C libdlm $@
+ make -C dlm_controld $@
+ make -C dlm_tool $@
+
diff --git a/dlm_controld/Makefile b/dlm_controld/Makefile
index 722d8c2..e846b05 100644
--- a/dlm_controld/Makefile
+++ b/dlm_controld/Makefile
@@ -45,7 +45,7 @@ BIN_CFLAGS += -D_GNU_SOURCE -g \
BIN_CFLAGS += -fPIE -DPIE
BIN_CFLAGS += `xml2-config --cflags`
-BIN_CFLAGS += -I../libdlm
+BIN_CFLAGS += -I../include -I../libdlm
BIN_LDFLAGS += -Wl,-z,now -Wl,-z,relro -pie
BIN_LDFLAGS += `xml2-config --libs`
diff --git a/dlm_controld/dlm_daemon.h b/dlm_controld/dlm_daemon.h
index 0c89f67..9627118 100644
--- a/dlm_controld/dlm_daemon.h
+++ b/dlm_controld/dlm_daemon.h
@@ -47,10 +47,8 @@
#define CLUSTERVARLIB "/var/lib/cluster"
#define CLUSTERVARRUN "/var/run/cluster"
#define LOGDIR "/var/log/cluster"
-#define VERSION "master"
#define SYSLOGFACILITY LOG_LOCAL4
#define SYSLOGLEVEL LOG_INFO
-#define REDHAT_COPYRIGHT "Copyright (C) Red Hat, Inc. 2004-2011 All rights reserved."
#define LOCKFILE_NAME CLUSTERVARRUN "/dlm_controld.pid"
#define DAEMON_NAME "dlm_controld"
#define DEFAULT_LOG_MODE LOG_MODE_OUTPUT_FILE|LOG_MODE_OUTPUT_SYSLOG
diff --git a/dlm_controld/main.c b/dlm_controld/main.c
index b0d9b03..0fa10fb 100644
--- a/dlm_controld/main.c
+++ b/dlm_controld/main.c
@@ -4,6 +4,9 @@
#include <linux/genetlink.h>
#include <linux/dlm_netlink.h>
+#include "copyright.cf"
+#include "version.cf"
+
#define CLIENT_NALLOC 32
static int client_maxi;
static int client_size = 0;
@@ -1149,7 +1152,7 @@ static void read_arguments(int argc, char **argv)
case 'V':
printf("dlm_controld %s (built %s %s)\n",
- VERSION, __DATE__, __TIME__);
+ RELEASE_VERSION, __DATE__, __TIME__);
printf("%s\n", REDHAT_COPYRIGHT);
exit(EXIT_SUCCESS);
break;
@@ -1210,7 +1213,7 @@ int main(int argc, char **argv)
}
lockfile();
init_logging();
- log_level(NULL, LOG_INFO, "dlm_controld %s started", VERSION);
+ log_level(NULL, LOG_INFO, "dlm_controld %s started", RELEASE_VERSION);
signal(SIGTERM, sigterm_handler);
set_scheduler();
diff --git a/dlm_tool/main.c b/dlm_tool/main.c
index 4df930a..55593c0 100644
--- a/dlm_tool/main.c
+++ b/dlm_tool/main.c
@@ -16,6 +16,7 @@
#include "libdlm.h"
#include "libdlmcontrol.h"
#include "copyright.cf"
+#include "version.cf"
#define LKM_IVMODE -1
@@ -252,7 +253,7 @@ static void decode_arguments(int argc, char **argv)
case 'V':
printf("%s %s (built %s %s)\n",
- prog_name, VERSION, __DATE__, __TIME__);
+ prog_name, RELEASE_VERSION, __DATE__, __TIME__);
printf("%s\n", REDHAT_COPYRIGHT);
exit(EXIT_SUCCESS);
break;
diff --git a/include/version.cf b/include/version.cf
new file mode 100644
index 0000000..80e8f4a
--- /dev/null
+++ b/include/version.cf
@@ -0,0 +1,6 @@
+#ifndef _RELEASE_VERSION_CF_
+#define _RELEASE_VERSION_CF_
+
+#define RELEASE_VERSION "master"
+
+#endif
12 years, 7 months
gfs2-utils: master - libgfs2: Don't count sentinel dirent as an entry
by Andrew Price
Gitweb: http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitd...
Commit: 5b2c8e2e8bd72d54da60f84bfc3e119826e0e610
Parent: b9236511fd2d579f89cb6eca3f8a556d86c739ae
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Wed Oct 5 00:18:17 2011 +0100
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Wed Oct 5 14:56:26 2011 +0100
libgfs2: Don't count sentinel dirent as an entry
dir_split_leaf() adds a sentinel dirent using dirent_alloc() which
increments di_entries in the directory dinode. Since sentinel dirents
aren't real directory entries, di_entries becomes too high in some
situations. This patch decrements di_entries after the sentinel dirent
is created to fix the discrepancy.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/libgfs2/fs_ops.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/gfs2/libgfs2/fs_ops.c b/gfs2/libgfs2/fs_ops.c
index ecd54ca..fe7fce6 100644
--- a/gfs2/libgfs2/fs_ops.c
+++ b/gfs2/libgfs2/fs_ops.c
@@ -953,6 +953,8 @@ static void dir_split_leaf(struct gfs2_inode *dip, uint32_t lindex,
if (dirent_alloc(dip, nbh, 0, &new))
die("dir_split_leaf (4)\n");
new->de_inum.no_formal_ino = 0;
+ /* Don't count the sentinel dirent as an entry */
+ dip->i_di.di_entries--;
}
oleaf->lf_depth = be16_to_cpu(oleaf->lf_depth) + 1;
12 years, 7 months
gfs2-utils: master - gfs2_jadd: Fix error handlers
by cmaiolino
Gitweb: http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitd...
Commit: b9236511fd2d579f89cb6eca3f8a556d86c739ae
Parent: 02a6d06f271a90a0457b30005bc221e46b6f0efe
Author: Carlos Maiolino <cmaiolino(a)redhat.com>
AuthorDate: Tue Oct 4 15:14:52 2011 -0300
Committer: Carlos Maiolino <cmaiolino(a)redhat.com>
CommitterDate: Tue Oct 4 15:14:52 2011 -0300
gfs2_jadd: Fix error handlers
This patch fixes some error handlers, taking
advantage of glic on most places where an error
check is needed.
Also, it adds some exit() calls missing in mkfs
and gfs2_grow
---
gfs2/mkfs/main_grow.c | 8 ++-
gfs2/mkfs/main_jadd.c | 149 ++++++++++++++++++++++--------------------------
gfs2/mkfs/main_mkfs.c | 8 ++-
3 files changed, 80 insertions(+), 85 deletions(-)
diff --git a/gfs2/mkfs/main_grow.c b/gfs2/mkfs/main_grow.c
index c48497f..f6d7bf0 100644
--- a/gfs2/mkfs/main_grow.c
+++ b/gfs2/mkfs/main_grow.c
@@ -310,8 +310,10 @@ main_grow(int argc, char *argv[])
sdp->path_name = argv[optind++];
sdp->path_fd = open(sdp->path_name, O_RDONLY | O_CLOEXEC);
- if (sdp->path_fd < 0)
+ if (sdp->path_fd < 0){
perror(sdp->path_name);
+ exit(EXIT_FAILURE);
+ }
if (check_for_gfs2(sdp)) {
perror(sdp->path_name);
@@ -319,8 +321,10 @@ main_grow(int argc, char *argv[])
}
sdp->device_fd = open(sdp->device_name,
(test ? O_RDONLY : O_RDWR) | O_CLOEXEC);
- if (sdp->device_fd < 0)
+ if (sdp->device_fd < 0){
perror(sdp->device_name);
+ exit(EXIT_FAILURE);
+ }
if (device_geometry(sdp)) {
perror(_("Device geometry error"));
diff --git a/gfs2/mkfs/main_jadd.c b/gfs2/mkfs/main_jadd.c
index d722d52..e060cc2 100644
--- a/gfs2/mkfs/main_jadd.c
+++ b/gfs2/mkfs/main_jadd.c
@@ -34,15 +34,21 @@ make_jdata(int fd, const char *value)
uint32_t val;
err = ioctl(fd, FS_IOC_GETFLAGS, &val);
- if (err)
- die( _("error doing get flags (%d): %s\n"), err, strerror(errno));
+ if (err){
+ perror("GETFLAGS");
+ exit(EXIT_FAILURE);
+ }
+
if (strcmp(value, "set") == 0)
val |= FS_JOURNAL_DATA_FL;
if (strcmp(value, "clear") == 0)
val &= ~FS_JOURNAL_DATA_FL;
err = ioctl(fd, FS_IOC_SETFLAGS, &val);
- if (err)
- die( _("error doing set flags (%d): %s\n"), err, strerror(errno));
+
+ if (err){
+ perror("SETFLAGS");
+ exit(EXIT_FAILURE);
+ }
}
static int
@@ -211,11 +217,14 @@ create_new_inode(struct gfs2_sbd *sdp)
break;
if (errno == EEXIST) {
error = unlink(name);
- if (error)
- die( _("can't unlink %s: %s\n"),
- name, strerror(errno));
- } else
- die( _("can't create %s: %s\n"), name, strerror(errno));
+ if (error){
+ perror("unlink");
+ exit(EXIT_FAILURE);
+ }
+ } else{
+ perror("create");
+ exit(EXIT_FAILURE);
+ }
}
return fd;
@@ -236,10 +245,8 @@ add_ir(struct gfs2_sbd *sdp)
memset(&ir, 0, sizeof(struct gfs2_inum_range));
if (write(fd, (void*)&ir, sizeof(struct gfs2_inum_range)) !=
sizeof(struct gfs2_inum_range)) {
- fprintf(stderr, _( "write error: %s from %s:%d: "
- "offset 0\n"), strerror(errno),
- __FUNCTION__, __LINE__);
- exit(-1);
+ perror("add_ir");
+ exit(EXIT_FAILURE);
}
}
@@ -247,9 +254,10 @@ add_ir(struct gfs2_sbd *sdp)
sprintf(new_name, "inum_range%u", sdp->md.journals);
error = rename2system(sdp, "per_node", new_name);
- if (error < 0 && errno != EEXIST)
- die( _("can't rename2system %s (%d): %s\n"),
- new_name, error, strerror(errno));
+ if (error < 0 && errno != EEXIST){
+ perror("add_ir rename2system");
+ exit(EXIT_FAILURE);
+ }
}
static void
@@ -268,10 +276,8 @@ add_sc(struct gfs2_sbd *sdp)
memset(&sc, 0, sizeof(struct gfs2_statfs_change));
if (write(fd, (void*)&sc, sizeof(struct gfs2_statfs_change)) !=
sizeof(struct gfs2_statfs_change)) {
- fprintf(stderr, _("write error: %s from %s:%d: "
- "offset 0\n"), strerror(errno),
- __FUNCTION__, __LINE__);
- exit(-1);
+ perror("add_sc");
+ exit(EXIT_FAILURE);
}
}
@@ -279,9 +285,10 @@ add_sc(struct gfs2_sbd *sdp)
sprintf(new_name, "statfs_change%u", sdp->md.journals);
error = rename2system(sdp, "per_node", new_name);
- if (error < 0 && errno != EEXIST)
- die( _("can't rename2system %s (%d): %s\n"),
- new_name, error, strerror(errno));
+ if (error < 0 && errno != EEXIST){
+ perror("add_sc rename2system");
+ exit(EXIT_FAILURE);
+ }
}
static void
@@ -307,13 +314,8 @@ add_qc(struct gfs2_sbd *sdp)
for (x=0; x<blocks; x++) {
if (write(fd, buf, sdp->bsize) != sdp->bsize) {
- fprintf(stderr, _("write error: %s from %s:%d: "
- "block %lld (0x%llx)\n"),
- strerror(errno),
- __FUNCTION__, __LINE__,
- (unsigned long long)x,
- (unsigned long long)x);
- exit(-1);
+ perror("add_qc");
+ exit(EXIT_FAILURE);
}
}
@@ -327,29 +329,26 @@ add_qc(struct gfs2_sbd *sdp)
for (x=0; x<blocks; x++) {
if (write(fd, buf, sdp->bsize) != sdp->bsize) {
- fprintf(stderr, _("write error: %s from %s:%d: "
- "block %lld (0x%llx)\n"),
- strerror(errno),
- __FUNCTION__, __LINE__,
- (unsigned long long)x,
- (unsigned long long)x);
- exit(-1);
+ perror("add_qc");
+ exit(EXIT_FAILURE);
}
}
error = fsync(fd);
- if (error)
- die( _("can't fsync: %s\n"),
- strerror(errno));
+ if (error){
+ perror("add_qc fsync");
+ exit(EXIT_FAILURE);
+ }
}
close(fd);
sprintf(new_name, "quota_change%u", sdp->md.journals);
error = rename2system(sdp, "per_node", new_name);
- if (error < 0 && errno != EEXIST)
- die( _("can't rename2system %s (%d): %s\n"),
- new_name, error, strerror(errno));
+ if (error < 0 && errno != EEXIST){
+ perror("add_qc rename2system");
+ exit(EXIT_FAILURE);
+ }
}
static void
@@ -357,8 +356,8 @@ gather_info(struct gfs2_sbd *sdp)
{
struct statfs statbuf;
if (statfs(sdp->path_name, &statbuf) < 0) {
- die( _("Could not statfs the filesystem %s: %s\n"),
- sdp->path_name, strerror(errno));
+ perror(sdp->path_name);
+ exit(EXIT_FAILURE);
}
sdp->bsize = statbuf.f_bsize;
}
@@ -374,8 +373,8 @@ find_current_journals(struct gfs2_sbd *sdp)
sprintf(jindex, "%s/jindex", sdp->metafs_path);
dirp = opendir(jindex);
if (!dirp) {
- die( _("Could not find the jindex directory "
- "in gfs2meta mount! error: %s\n"), strerror(errno));
+ perror("jindex");
+ exit(EXIT_FAILURE);
}
while (dirp) {
if ((dp = readdir(dirp)) != NULL) {
@@ -415,13 +414,8 @@ add_j(struct gfs2_sbd *sdp)
memset(buf, 0, sdp->bsize);
for (x=0; x<blocks; x++) {
if (write(fd, buf, sdp->bsize) != sdp->bsize) {
- fprintf(stderr, _("write error: %s from %s:%d: "
- "block %lld (0x%llx)\n"),
- strerror(errno),
- __FUNCTION__, __LINE__,
- (unsigned long long)x,
- (unsigned long long)x);
- exit(-1);
+ perror("add_j");
+ exit(EXIT_FAILURE);
}
}
@@ -445,13 +439,8 @@ add_j(struct gfs2_sbd *sdp)
((struct gfs2_log_header *)buf)->lh_hash = cpu_to_be32(hash);
if (write(fd, buf, sdp->bsize) != sdp->bsize) {
- fprintf(stderr, _("write error: %s from %s:%d: "
- "block %lld (0x%llx)\n"),
- strerror(errno),
- __FUNCTION__, __LINE__,
- (unsigned long long)x,
- (unsigned long long)x);
- exit(-1);
+ perror("add_j");
+ exit(EXIT_FAILURE);
}
if (++seq == blocks)
@@ -459,18 +448,20 @@ add_j(struct gfs2_sbd *sdp)
}
error = fsync(fd);
- if (error)
- die( _("can't fsync: %s\n"),
- strerror(errno));
+ if (error){
+ perror("add_j fsync");
+ exit(EXIT_FAILURE);
+ }
}
close(fd);
sprintf(new_name, "journal%u", sdp->md.journals);
error = rename2system(sdp, "jindex", new_name);
- if (error < 0 && errno != EEXIST)
- die( _("can't rename2system %s (%d): %s\n"),
- new_name, error, strerror(errno));
+ if (error < 0 && errno != EEXIST){
+ perror("add_j rename2system");
+ exit(EXIT_FAILURE);
+ }
}
/**
@@ -494,30 +485,26 @@ void main_jadd(int argc, char *argv[])
verify_arguments(sdp);
sdp->path_fd = open(sdp->path_name, O_RDONLY | O_CLOEXEC);
- if (sdp->path_fd < 0)
- die( _("can't open root directory %s: %s\n"),
- sdp->path_name, strerror(errno));
+ if (sdp->path_fd < 0){
+ perror(sdp->path_name);
+ exit(EXIT_FAILURE);
+ }
if (check_for_gfs2(sdp)) {
- if (errno == EINVAL)
- fprintf(stderr, _("Not a valid GFS2 mount point: %s\n"),
- sdp->path_name);
- else
- fprintf(stderr, "%s\n", strerror(errno));
- exit(-1);
+ perror(sdp->path_name);
+ exit(EXIT_FAILURE);
}
gather_info(sdp);
if (mount_gfs2_meta(sdp)) {
- fprintf(stderr, _("Error mounting GFS2 metafs: %s\n"),
- strerror(errno));
- exit(-1);
+ perror("GFS2 metafs");
+ exit(EXIT_FAILURE);
}
if (compute_constants(sdp)) {
- fprintf(stderr, _("Bad constants (1)\n"));
- exit(-1);
+ perror(_("Bad constants (1)"));
+ exit(EXIT_FAILURE);
}
find_current_journals(sdp);
diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
index 771feba..6de1d12 100644
--- a/gfs2/mkfs/main_mkfs.c
+++ b/gfs2/mkfs/main_mkfs.c
@@ -683,13 +683,17 @@ void main_mkfs(int argc, char *argv[])
gfs2_rgrp_free(&sdp->rgtree);
error = fsync(sdp->device_fd);
- if (error)
+ if (error){
perror(sdp->device_name);
+ exit(EXIT_FAILURE);
+ }
error = close(sdp->device_fd);
- if (error)
+ if (error){
perror(sdp->device_name);
+ exit(EXIT_FAILURE);
+ }
print_results(sdp, real_device_size, uuid);
}
12 years, 7 months
gfs2-utils: master - gfs2_grow: fix error handling, i18n strings
by cmaiolino
Gitweb: http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitd...
Commit: 02a6d06f271a90a0457b30005bc221e46b6f0efe
Parent: 114ca2dfa825a313561c9c82e52b4c052b1d2cd4
Author: Carlos Maiolino <cmaiolino(a)redhat.com>
AuthorDate: Tue Oct 4 11:46:55 2011 -0300
Committer: Carlos Maiolino <cmaiolino(a)redhat.com>
CommitterDate: Tue Oct 4 11:46:55 2011 -0300
gfs2_grow: fix error handling, i18n strings
This patch fixes some error handling into gfs2_grow,
but also fix some strings to be complaing with i18n.
Also, it fixes 2 perror calls from mkfs, removing
new-line characters (\n) from the perror() call, since
perror() should be called without any format character
---
gfs2/mkfs/main_grow.c | 52 ++++++++++++++++++++----------------------------
gfs2/mkfs/main_mkfs.c | 4 +-
2 files changed, 24 insertions(+), 32 deletions(-)
diff --git a/gfs2/mkfs/main_grow.c b/gfs2/mkfs/main_grow.c
index 7a32d7e..c48497f 100644
--- a/gfs2/mkfs/main_grow.c
+++ b/gfs2/mkfs/main_grow.c
@@ -202,7 +202,7 @@ static void fix_rindex(struct gfs2_sbd *sdp, int rindex_fd, int old_rg_count)
buf = calloc(1, writelen);
if (buf == NULL) {
perror(__FUNCTION__);
- exit(-1);
+ exit(EXIT_FAILURE);
}
/* Now add the new rg entries to the rg index. Here we */
/* need to use the gfs2 kernel code rather than the libgfs2 */
@@ -219,13 +219,13 @@ static void fix_rindex(struct gfs2_sbd *sdp, int rindex_fd, int old_rg_count)
fsync(sdp->device_fd);
if (!test) {
if (fstat(rindex_fd, &statbuf) != 0) {
- log_crit("Can't stat rindex : %s\n", strerror(errno));
+ perror("rindex");
goto out;
}
if (statbuf.st_size !=
old_rg_count * sizeof(struct gfs2_rindex)) {
- log_crit("Incorrect rindex size. want %ld(%d RGs), "
- "have %ld\n",
+ log_crit(_("Incorrect rindex size. want %ld(%d RGs), "
+ "have %ld\n"),
old_rg_count * sizeof(struct gfs2_rindex),
old_rg_count, statbuf.st_size);
goto out;
@@ -234,8 +234,8 @@ static void fix_rindex(struct gfs2_sbd *sdp, int rindex_fd, int old_rg_count)
lseek(rindex_fd, 0, SEEK_END);
count = write(rindex_fd, buf, sizeof(struct gfs2_rindex));
if (count != sizeof(struct gfs2_rindex)) {
- log_crit("Error writing first new rindex entry;"
- "aborted.\n");
+ log_crit(_("Error writing first new rindex entry;"
+ "aborted.\n"));
if (count > 0)
goto trunc;
else
@@ -244,16 +244,15 @@ static void fix_rindex(struct gfs2_sbd *sdp, int rindex_fd, int old_rg_count)
count = write(rindex_fd, buf + sizeof(struct gfs2_rindex),
writelen - sizeof(struct gfs2_rindex));
if (count != writelen - sizeof(struct gfs2_rindex)) {
- log_crit("Error writing new rindex entries;"
- "aborted.\n");
+ log_crit(_("Error writing new rindex entries;"
+ "aborted.\n"));
if (count > 0)
goto trunc;
else
goto out;
}
if (fallocate(rindex_fd, FALLOC_FL_KEEP_SIZE, statbuf.st_size + writelen, sizeof(struct gfs2_rindex)) != 0)
- log_crit("Error fallocating extra space : %s\n",
- strerror(errno));
+ perror("fallocate");
fsync(rindex_fd);
}
out:
@@ -261,7 +260,7 @@ out:
return;
trunc:
count = (count / sizeof(struct gfs2_rindex)) + old_rg_count;
- log_crit("truncating rindex to %ld\n",
+ log_crit(_("truncating rindex to %ld\n"),
(off_t)count * sizeof(struct gfs2_rindex));
ftruncate(rindex_fd, (off_t)count * sizeof(struct gfs2_rindex));
free(buf);
@@ -312,26 +311,20 @@ main_grow(int argc, char *argv[])
sdp->path_name = argv[optind++];
sdp->path_fd = open(sdp->path_name, O_RDONLY | O_CLOEXEC);
if (sdp->path_fd < 0)
- die("can't open root directory %s: %s\n",
- sdp->path_name, strerror(errno));
+ perror(sdp->path_name);
if (check_for_gfs2(sdp)) {
- if (errno == EINVAL)
- fprintf(stderr,
- _("Not a valid GFS2 mount point: %s\n"),
- sdp->path_name);
- else
- fprintf(stderr, "%s\n", strerror(errno));
- exit(-1);
+ perror(sdp->path_name);
+ exit(EXIT_FAILURE);
}
sdp->device_fd = open(sdp->device_name,
(test ? O_RDONLY : O_RDWR) | O_CLOEXEC);
if (sdp->device_fd < 0)
- die( _("can't open device %s: %s\n"),
- sdp->device_name, strerror(errno));
+ perror(sdp->device_name);
+
if (device_geometry(sdp)) {
- fprintf(stderr, _("Geometry error\n"));
- exit(-1);
+ perror(_("Device geometry error"));
+ exit(EXIT_FAILURE);
}
log_info( _("Initializing lists...\n"));
sdp->rgtree.osi_node = NULL;
@@ -340,8 +333,8 @@ main_grow(int argc, char *argv[])
sdp->sd_sb.sb_bsize = GFS2_DEFAULT_BSIZE;
sdp->bsize = sdp->sd_sb.sb_bsize;
if (compute_constants(sdp)) {
- log_crit(_("Bad constants (1)\n"));
- exit(-1);
+ perror(_("Bad constants (1)"));
+ exit(EXIT_FAILURE);
}
if (read_sb(sdp, 0) < 0)
die( _("gfs: Error reading superblock.\n"));
@@ -349,13 +342,12 @@ main_grow(int argc, char *argv[])
if (fix_device_geometry(sdp)) {
fprintf(stderr, _("Device is too small (%llu bytes)\n"),
(unsigned long long)sdp->device.length << GFS2_BASIC_BLOCK_SHIFT);
- exit(-1);
+ exit(EXIT_FAILURE);
}
if (mount_gfs2_meta(sdp)) {
- fprintf(stderr, _("Error mounting GFS2 metafs: %s\n"),
- strerror(errno));
- exit(-1);
+ perror("GFS2 metafs");
+ exit(EXIT_FAILURE);
}
sprintf(rindex_name, "%s/rindex", sdp->metafs_path);
diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
index f35f5b0..771feba 100644
--- a/gfs2/mkfs/main_mkfs.c
+++ b/gfs2/mkfs/main_mkfs.c
@@ -591,7 +591,7 @@ void main_mkfs(int argc, char *argv[])
verify_bsize(sdp);
if (compute_constants(sdp)) {
- perror(_("Bad constants (1)\n"));
+ perror(_("Bad constants (1)"));
exit(EXIT_FAILURE);
}
@@ -599,7 +599,7 @@ void main_mkfs(int argc, char *argv[])
device_size(sdp->device_fd, &real_device_size);
if (device_geometry(sdp)) {
- perror(_("Device geometry error\n"));
+ perror(_("Device geometry error"));
exit(EXIT_FAILURE);
}
/* Convert optional block-count to basic blocks */
12 years, 7 months
gfs2-utils: master - mkfs: fix error handling
by cmaiolino
Gitweb: http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitd...
Commit: 114ca2dfa825a313561c9c82e52b4c052b1d2cd4
Parent: e2e273467a776ef257e1d7e284088ae9e7cbec43
Author: Carlos Maiolino <cmaiolino(a)redhat.com>
AuthorDate: Tue Oct 4 10:20:12 2011 -0300
Committer: Carlos Maiolino <cmaiolino(a)redhat.com>
CommitterDate: Tue Oct 4 10:20:12 2011 -0300
mkfs: fix error handling
this patch replaces some error handlers by
calls to perror. Also replace calls to die()
by exit() and fixes some exit() arguments to
be compliant with C standard
---
gfs2/mkfs/main_mkfs.c | 59 +++++++++++++++++++++++++------------------------
1 files changed, 30 insertions(+), 29 deletions(-)
diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
index 0bd1410..f35f5b0 100644
--- a/gfs2/mkfs/main_mkfs.c
+++ b/gfs2/mkfs/main_mkfs.c
@@ -551,22 +551,22 @@ void main_mkfs(int argc, char *argv[])
verify_arguments(sdp);
sdp->device_fd = open(sdp->device_name, O_RDWR | O_CLOEXEC);
- if (sdp->device_fd < 0)
- die( _("can't open device %s: %s\n"),
- sdp->device_name, strerror(errno));
+ if (sdp->device_fd < 0){
+ perror(sdp->device_name);
+ exit(EXIT_FAILURE);
+ }
if (fstat(sdp->device_fd, &st_buf) < 0) {
- fprintf(stderr, _("could not fstat fd %d: %s\n"),
- sdp->device_fd, strerror(errno));
- exit(-1);
+ perror(sdp->device_name);
+ exit(EXIT_FAILURE);
}
if (!sdp->override)
are_you_sure();
if (!S_ISREG(st_buf.st_mode) && device_topology(sdp)) {
- fprintf(stderr, _("Device topology error\n"));
- exit(-1);
+ perror(_("Device topology error\n"));
+ exit(EXIT_FAILURE);
}
if (sdp->bsize == -1) {
@@ -591,16 +591,16 @@ void main_mkfs(int argc, char *argv[])
verify_bsize(sdp);
if (compute_constants(sdp)) {
- fprintf(stderr, _("Bad constants (1)\n"));
- exit(-1);
+ perror(_("Bad constants (1)\n"));
+ exit(EXIT_FAILURE);
}
/* Get the device geometry */
device_size(sdp->device_fd, &real_device_size);
if (device_geometry(sdp)) {
- fprintf(stderr, _("Geometry error\n"));
- exit(-1);
+ perror(_("Device geometry error\n"));
+ exit(EXIT_FAILURE);
}
/* Convert optional block-count to basic blocks */
if (sdp->orig_fssize) {
@@ -618,7 +618,7 @@ void main_mkfs(int argc, char *argv[])
if (fix_device_geometry(sdp)) {
fprintf(stderr, _("Device is too small (%llu bytes)\n"),
(unsigned long long)sdp->device.length << GFS2_BASIC_BLOCK_SHIFT);
- exit(-1);
+ exit(EXIT_FAILURE);
}
if (discard)
@@ -639,35 +639,35 @@ void main_mkfs(int argc, char *argv[])
build_sb(sdp, uuid);
error = build_jindex(sdp);
if (error) {
- fprintf(stderr, _("Error building jindex: %s\n"), strerror(error));
- exit(-1);
+ perror(_("Error building jindex"));
+ exit(EXIT_FAILURE);
}
error = build_per_node(sdp);
if (error) {
- fprintf(stderr, _("Error building per-node directory: %s\n"), strerror(error));
- exit(-1);
+ perror(_("Error building per-node directory"));
+ exit(EXIT_FAILURE);
}
error = build_inum(sdp);
if (error) {
- fprintf(stderr, _("Error building inum inode: %s\n"), strerror(error));
- exit(-1);
+ perror(_("Error building inum inode"));
+ exit(EXIT_FAILURE);
}
gfs2_lookupi(sdp->master_dir, "inum", 4, &sdp->md.inum);
error = build_statfs(sdp);
if (error) {
- fprintf(stderr, _("Error building statfs inode: %s\n"), strerror(error));
- exit(-1);
+ perror(_("Error building statfs inode"));
+ exit(EXIT_FAILURE);
}
gfs2_lookupi(sdp->master_dir, "statfs", 6, &sdp->md.statfs);
error = build_rindex(sdp);
if (error) {
- fprintf(stderr, _("Error building rindex inode: %s\n"), strerror(error));
- exit(-1);
+ perror(_("Error building rindex inode"));
+ exit(EXIT_FAILURE);
}
error = build_quota(sdp);
if (error) {
- fprintf(stderr, _("Error building quota inode: %s\n"), strerror(error));
- exit(-1);
+ perror(_("Error building quota inode"));
+ exit(EXIT_FAILURE);
}
do_init_inum(sdp);
@@ -682,13 +682,14 @@ void main_mkfs(int argc, char *argv[])
gfs2_rgrp_free(&sdp->rgtree);
error = fsync(sdp->device_fd);
+
if (error)
- die( _("can't fsync device (%d): %s\n"),
- error, strerror(errno));
+ perror(sdp->device_name);
+
error = close(sdp->device_fd);
+
if (error)
- die( _("error closing device (%d): %s\n"),
- error, strerror(errno));
+ perror(sdp->device_name);
print_results(sdp, real_device_size, uuid);
}
12 years, 7 months
dlm: master - libdlm: more Makefile munging
by David Teigland
Gitweb: http://git.fedorahosted.org/git/dlm.git?p=dlm.git;a=commitdiff;h=0ffe7415...
Commit: 0ffe7415f206a9a874fe853b519e9f2a1d4c39e8
Parent: 59d16cbb84bb33fe7331cdcade20f007abd26096
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Oct 3 16:55:02 2011 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Oct 3 16:55:02 2011 -0500
libdlm: more Makefile munging
Signed-off-by: David Teigland <teigland(a)redhat.com>
---
libdlm/Makefile | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/libdlm/Makefile b/libdlm/Makefile
index 7f4be49..9a8c383 100644
--- a/libdlm/Makefile
+++ b/libdlm/Makefile
@@ -1,10 +1,11 @@
DESTDIR=
PREFIX=/usr
-LIBDIR=/usr/lib64
-HDRDIR=/usr/include
-MANDIR=/usr/share/man
-PKGDIR=/usr/lib64/pkgconfig
-UDEVDIR=/etc/udev/rules.d
+LIBNUM=/lib64
+LIBDIR=$(PREFIX)/$(LIBNUM)
+HDRDIR=$(PREFIX)/include
+MANDIR=$(PREFIX)/share/man
+PKGDIR=$(PREFIX)/$(LIBNUM)/pkgconfig
+UDEVDIR=/lib/udev/rules.d
LIB_NAME = libdlm
LIB_MAJOR = 3
12 years, 7 months
dlm: master - libdlm: add pkgconfig files
by David Teigland
Gitweb: http://git.fedorahosted.org/git/dlm.git?p=dlm.git;a=commitdiff;h=59d16cbb...
Commit: 59d16cbb84bb33fe7331cdcade20f007abd26096
Parent: 3bc9b4611a837632c6bc89586c0fdce2bdb5ba4d
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Oct 3 13:21:03 2011 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Oct 3 13:21:03 2011 -0500
libdlm: add pkgconfig files
Signed-off-by: David Teigland <teigland(a)redhat.com>
---
libdlm/Makefile | 31 +++++++++++++++++++++++--------
libdlm/libdlm.pc.in | 10 ++++++++++
libdlm/libdlm_lt.pc.in | 10 ++++++++++
3 files changed, 43 insertions(+), 8 deletions(-)
diff --git a/libdlm/Makefile b/libdlm/Makefile
index 2b8b6d3..7f4be49 100644
--- a/libdlm/Makefile
+++ b/libdlm/Makefile
@@ -1,3 +1,11 @@
+DESTDIR=
+PREFIX=/usr
+LIBDIR=/usr/lib64
+HDRDIR=/usr/include
+MANDIR=/usr/share/man
+PKGDIR=/usr/lib64/pkgconfig
+UDEVDIR=/etc/udev/rules.d
+
LIB_NAME = libdlm
LIB_MAJOR = 3
LIB_MINOR = 0
@@ -5,6 +13,8 @@ LIB_O = $(LIB_NAME).o
LIB_SO = $(LIB_NAME).so
LIB_SMAJOR = $(LIB_SO).$(LIB_MAJOR)
LIB_TARGET = $(LIB_SO).$(LIB_MAJOR).$(LIB_MINOR)
+LIB_PC = $(LIB_NAME).pc
+LIB_PCIN = $(LIB_NAME).pc.in
LLT_NAME = libdlm_lt
LLT_MAJOR = 3
@@ -13,6 +23,8 @@ LLT_O = $(LLT_NAME).o
LLT_SO = $(LLT_NAME).so
LLT_SMAJOR = $(LLT_SO).$(LLT_MAJOR)
LLT_TARGET = $(LLT_SO).$(LLT_MAJOR).$(LLT_MINOR)
+LLT_PC = $(LLT_NAME).pc
+LLT_PCIN = $(LLT_NAME).pc.in
HDR_TARGET = libdlm.h
@@ -72,7 +84,7 @@ LDFLAGS += -Wl
LIB_LDFLAGS += $(LDFLAGS) -lpthread
LLT_LDFLAGS += $(LDFLAGS)
-all: $(LIB_TARGET) $(LLT_TARGET)
+all: $(LIB_TARGET) $(LLT_TARGET) $(LIB_PC) $(LLT_PC)
$(LIB_O): $(SOURCE)
$(CC) $(LIB_CFLAGS) -c -o $@ $<
@@ -90,27 +102,30 @@ $(LLT_TARGET): $(LLT_O)
ln -sf $(LLT_TARGET) $(LLT_SO)
ln -sf $(LLT_TARGET) $(LLT_SMAJOR)
+$(LIB_PC): $(LIB_PCIN)
+ cat $(LIB_PCIN) | sed -e 's#@PREFIX@#$(PREFIX)#g' > $@
+
+$(LLT_PC): $(LLT_PCIN)
+ cat $(LIB_PCIN) | sed -e 's#@PREFIX@#$(PREFIX)#g' > $@
+
clean:
- rm -f *.o *.so *.so.* *.a
+ rm -f *.o *.so *.so.* *.a *.pc
INSTALL=$(shell which install)
-DESTDIR=
-LIBDIR=/usr/lib64
-HDRDIR=/usr/include
-MANDIR=/usr/share/man
-UDEVDIR=/etc/udev/rules.d
-
.PHONY: install
install: all
$(INSTALL) -d $(DESTDIR)/$(LIBDIR)
$(INSTALL) -d $(DESTDIR)/$(HDRDIR)
$(INSTALL) -d $(DESTDIR)/$(MANDIR)/man3
+ $(INSTALL) -d $(DESTDIR)/$(PKGDIR)
$(INSTALL) -d $(DESTDIR)/$(UDEVDIR)
$(INSTALL) -c -m 755 $(LIB_TARGET) $(DESTDIR)/$(LIBDIR)
$(INSTALL) -c -m 755 $(LLT_TARGET) $(DESTDIR)/$(LIBDIR)
cp -a $(LIB_SO) $(DESTDIR)/$(LIBDIR)
cp -a $(LLT_SO) $(DESTDIR)/$(LIBDIR)
+ $(INSTALL) -m 644 $(LIB_PC) $(DESTDIR)/$(PKGDIR)
+ $(INSTALL) -m 644 $(LLT_PC) $(DESTDIR)/$(PKGDIR)
$(INSTALL) -c -m 644 $(HDR_TARGET) $(DESTDIR)/$(HDRDIR)
$(INSTALL) -m 644 $(MAN_TARGET) $(DESTDIR)/$(MANDIR)/man3/
$(INSTALL) -m 644 $(UDEV_TARGET) $(DESTDIR)/$(UDEVDIR)
diff --git a/libdlm/libdlm.pc.in b/libdlm/libdlm.pc.in
new file mode 100644
index 0000000..3a51bfc
--- /dev/null
+++ b/libdlm/libdlm.pc.in
@@ -0,0 +1,10 @@
+prefix=@PREFIX@
+exec_prefix=${prefix}
+includedir=${prefix}/include
+libdir=${exec_prefix}/lib64
+
+Name: libdlm
+Description: The dlm library
+Version: 4.0.0
+Cflags: -I${includedir}
+Libs: -L${libdir} -ldlm -lpthread
diff --git a/libdlm/libdlm_lt.pc.in b/libdlm/libdlm_lt.pc.in
new file mode 100644
index 0000000..36d3974
--- /dev/null
+++ b/libdlm/libdlm_lt.pc.in
@@ -0,0 +1,10 @@
+prefix=@PREFIX@
+exec_prefix=${prefix}
+includedir=${prefix}/include
+libdir=${exec_prefix}/lib64
+
+Name: libdlm_lt
+Description: The non-threaded dlm library
+Version: 4.0.0
+Cflags: -I${includedir}
+Libs: -L${libdir} -ldlm_lt
12 years, 7 months