diff options
author | Kay Sievers <kay.sievers@suse.de> | 2006-03-23 10:50:55 +0100 |
---|---|---|
committer | Kay Sievers <kay.sievers@suse.de> | 2006-03-23 10:50:55 +0100 |
commit | 2d82e6f0532295798adec25a52a7d70c85ba4bba (patch) | |
tree | dae46998c4f23ab0ad154ef677c62ca3694fead1 | |
parent | ddb5a84c349f2f5aca2387d5c3bddc684e64aa84 (diff) |
volume_id: provide library
35 files changed, 103 insertions, 49 deletions
diff --git a/extras/volume_id/Makefile b/extras/volume_id/Makefile index b72d5b11d9..88752b880e 100644 --- a/extras/volume_id/Makefile +++ b/extras/volume_id/Makefile @@ -1,12 +1,11 @@ # Makefile for udev extra invoked from the udev main Makefile # -# Copyright (C) 2004-2005 Kay Sievers <kay.sievers@vrfy.org> +# Copyright (C) 2004-2006 Kay Sievers <kay.sievers@vrfy.org> # # Released under the GNU General Public License, version 2. # PROG = vol_id -LIBVOLUME_ID = libvolume_id/libvolume_id.a GEN_HEADERS = MAN_PAGES = @@ -32,12 +31,12 @@ all: $(PROG) $(MAN_PAGES) $(E) " CC " $@ $(Q) $(CC) -c $(CFLAGS) $< -o $@ -$(LIBVOLUME_ID): +libvolume_id/libvolume_id.a: $(Q) $(MAKE) -C libvolume_id -$(PROG): %: $(HEADERS) %.o $(LIBVOLUME_ID) +$(PROG): %: $(HEADERS) %.o libvolume_id/libvolume_id.a $(E) " LD " $@ - $(Q) $(LD) $(LDFLAGS) $@.o $(LIBVOLUME_ID) -o $@ $(LIBUDEV) $(LIB_OBJS) + $(Q) $(LD) $(LDFLAGS) -o $@ $@.o $(LIBUDEV) libvolume_id/libvolume_id.a $(LIB_OBJS) ifneq ($(strip $(STRIPCMD)),) $(E) " STRIP " $@ $(Q) $(STRIPCMD) $@ @@ -56,11 +55,13 @@ clean: .PHONY: clean install-bin: all - $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG) + $(INSTALL_PROGRAM) -D $(PROG) $(DESTDIR)$(sbindir)/$(PROG) + $(MAKE) -C libvolume_id install .PHONY: install-bin uninstall-bin: - rm $(DESTDIR)$(sbindir)/$(PROG) + $(MAKE) -C libvolume_id uninstall .PHONY: uninstall-bin install-man: diff --git a/extras/volume_id/libvolume_id/Makefile b/extras/volume_id/libvolume_id/Makefile index a5f9c1a825..5d188a23d4 100644 --- a/extras/volume_id/libvolume_id/Makefile +++ b/extras/volume_id/libvolume_id/Makefile @@ -1,11 +1,21 @@ -# Makefile for udev extra invoked from the udev main Makefile +# libvolume_id - read filesystem label/uuid # -# Copyright (C) 2004-2005 Kay Sievers <kay.sievers@vrfy.org> +# Copyright (C) 2004-2006 Kay Sievers <kay.sievers@vrfy.org> # # Released under the GNU General Public License, version 2. # +includedir = ${prefix}/usr/include +libdir = ${prefix}/lib +usrlibdir = ${prefix}/usr/lib -LIBVOLUME_ID = libvolume_id.a +INSTALL = /usr/bin/install -c +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_LIB = ${INSTALL} -m 755 + +SHLIB_CUR = 0 +SHLIB_REV = 60 +SHLIB_AGE = 0 +SHLIB = libvolume_id.so.$(SHLIB_CUR).$(SHLIB_REV).$(SHLIB_AGE) OBJS= \ ext.o \ @@ -41,13 +51,13 @@ OBJS= \ util.o HEADERS= \ - volume_id.h \ + libvolume_id.h \ util.h AR = $(CROSS)ar RANLIB = $(CROSS)ranlib -all: $(LIBVOLUME_ID) +all: libvolume_id.a $(SHLIB) libvolume_id.pc .PHONY: all .DEFAULT: all @@ -55,15 +65,60 @@ all: $(LIBVOLUME_ID) $(E) " CC " $@ $(Q) $(CC) -c $(CFLAGS) $< -o $@ -$(LIBVOLUME_ID): $(HEADERS) $(OBJS) +.shlib: + $(Q) mkdir .shlib + +.shlib/%.o: %.c + $(E) " CC " $@ + $(Q) $(CC) -c $(CFLAGS) -fPIC $< -o $@ + +libvolume_id.a: $(HEADERS) $(OBJS) $(Q) rm -f $@ $(E) " AR " $@ $(Q) $(AR) cq $@ $(OBJS) $(E) " RANLIB " $@ $(Q) $(RANLIB) $@ +$(SHLIB): $(HEADERS) .shlib $(addprefix .shlib/,$(OBJS)) + $(E) " CC " $@ + $(Q) $(CC) -shared $(CFLAGS) -o $@ -Wl,-soname,libvolume_id.so.$(SHLIB_CUR) $(addprefix .shlib/,$(OBJS)) + $(Q) ln -sf $@ libvolume_id.so.$(SHLIB_CUR) + $(Q) ln -sf $@ libvolume_id.so + +libvolume_id.pc: + $(E) " GENPC " $@ + $(Q) echo "prefix=${prefix}" > $@ + $(Q) echo "libdir=${libdir}" >> $@ + $(Q) echo "includedir=${includedir}" >> $@ + $(Q) echo "" >> $@ + $(Q) echo "Name: libvolume_id" >> $@ + $(Q) echo "Description: Filesystem label and uuid access" >> $@ + $(Q) echo "Version: $(SHLIB_CUR).$(SHLIB_REV).$(SHLIB_AGE)" >> $@ + $(Q) echo "Libs: -L\$${libdir} -lvolume_id" >> $@ + $(Q) echo "Cflags: -I\$${includedir}" >> $@ + +install: all + $(INSTALL_DATA) -D libvolume_id.h $(DESTDIR)$(includedir)/libvolume_id.h + $(INSTALL_LIB) -D libvolume_id.a $(DESTDIR)$(usrlibdir)/libvolume_id.a + $(INSTALL_LIB) -D $(SHLIB) $(DESTDIR)$(libdir)/$(SHLIB) + ln -sf $(DESTDIR)$(libdir)/$(SHLIB) $(DESTDIR)$(libdir)/libvolume_id.so.$(SHLIB_CUR) + ln -sf $(DESTDIR)$(libdir)/$(SHLIB) $(DESTDIR)$(usrlibdir)/libvolume_id.so + $(INSTALL_DATA) -D libvolume_id.pc $(DESTDIR)$(usrlibdir)/pkgconfig/libvolume_id.pc +.PHONY: install + +uninstall: + rm -f $(DESTDIR)$(includedir)/libvolume_id.h + rm -f $(DESTDIR)$(usrlibdir)/libvolume_id.a + rm -f $(DESTDIR)$(libdir)/$(SHLIB) + rm -f $(DESTDIR)$(libdir)/libvolume_id.so.$(SHLIB_CUR) + rm -f $(DESTDIR)$(libdir)/libvolume_id.so +.PHONY: uninstall + clean: $(E) " CLEAN " - $(Q) rm -f $(LIBVOLUME_ID) $(OBJS) + $(Q) rm -f libvolume_id.a $(OBJS) + $(Q) rm -f $(SHLIB) libvolume_id.so.$(SHLIB_CUR) libvolume_id.so + $(Q) rm -rf .shlib + $(Q) rm -f libvolume_id.pc .PHONY: clean diff --git a/extras/volume_id/libvolume_id/cramfs.c b/extras/volume_id/libvolume_id/cramfs.c index e099c214c8..5a7c29d353 100644 --- a/extras/volume_id/libvolume_id/cramfs.c +++ b/extras/volume_id/libvolume_id/cramfs.c @@ -23,7 +23,7 @@ #include <errno.h> #include <ctype.h> -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/ext.c b/extras/volume_id/libvolume_id/ext.c index 26ac98bc37..d1c46471c6 100644 --- a/extras/volume_id/libvolume_id/ext.c +++ b/extras/volume_id/libvolume_id/ext.c @@ -23,7 +23,7 @@ #include <errno.h> #include <ctype.h> -#include "volume_id.h" +#include "libvolume_id.h" #include "util.h" #include "logging.h" diff --git a/extras/volume_id/libvolume_id/fat.c b/extras/volume_id/libvolume_id/fat.c index a72ec19f59..4b32263fd6 100644 --- a/extras/volume_id/libvolume_id/fat.c +++ b/extras/volume_id/libvolume_id/fat.c @@ -23,7 +23,7 @@ #include <errno.h> #include <ctype.h> -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/hfs.c b/extras/volume_id/libvolume_id/hfs.c index 09194d5be1..627166df98 100644 --- a/extras/volume_id/libvolume_id/hfs.c +++ b/extras/volume_id/libvolume_id/hfs.c @@ -23,7 +23,7 @@ #include <errno.h> #include <ctype.h> -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/highpoint.c b/extras/volume_id/libvolume_id/highpoint.c index 78a4ad82b4..fa580b7b8c 100644 --- a/extras/volume_id/libvolume_id/highpoint.c +++ b/extras/volume_id/libvolume_id/highpoint.c @@ -23,7 +23,7 @@ #include <errno.h> #include <ctype.h> -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/hpfs.c b/extras/volume_id/libvolume_id/hpfs.c index 452df0124d..41b8013bb1 100644 --- a/extras/volume_id/libvolume_id/hpfs.c +++ b/extras/volume_id/libvolume_id/hpfs.c @@ -23,7 +23,7 @@ #include <errno.h> #include <ctype.h> -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/iso9660.c b/extras/volume_id/libvolume_id/iso9660.c index 2e28af8d70..02575f8dc2 100644 --- a/extras/volume_id/libvolume_id/iso9660.c +++ b/extras/volume_id/libvolume_id/iso9660.c @@ -23,7 +23,7 @@ #include <errno.h> #include <ctype.h> -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/isw_raid.c b/extras/volume_id/libvolume_id/isw_raid.c index 72b2b85b12..cf7c62f817 100644 --- a/extras/volume_id/libvolume_id/isw_raid.c +++ b/extras/volume_id/libvolume_id/isw_raid.c @@ -23,7 +23,7 @@ #include <errno.h> #include <ctype.h> -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/jfs.c b/extras/volume_id/libvolume_id/jfs.c index 78b61fb30d..f8d857878d 100644 --- a/extras/volume_id/libvolume_id/jfs.c +++ b/extras/volume_id/libvolume_id/jfs.c @@ -23,7 +23,7 @@ #include <errno.h> #include <ctype.h> -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/volume_id.h b/extras/volume_id/libvolume_id/libvolume_id.h index 8ddffc96de..b08a650dc8 100644 --- a/extras/volume_id/libvolume_id/volume_id.h +++ b/extras/volume_id/libvolume_id/libvolume_id.h @@ -8,14 +8,12 @@ * Free Software Foundation version 2 of the License. */ -#ifndef _VOLUME_ID_H_ -#define _VOLUME_ID_H_ +#ifndef _LIBVOLUME_ID_H_ +#define _LIBVOLUME_ID_H_ #include <stdint.h> #include <stddef.h> -#define VOLUME_ID_VERSION 60 - #ifndef PACKED #define PACKED __attribute__((packed)) #endif diff --git a/extras/volume_id/libvolume_id/linux_raid.c b/extras/volume_id/libvolume_id/linux_raid.c index 2285e87b97..ee5ed2875d 100644 --- a/extras/volume_id/libvolume_id/linux_raid.c +++ b/extras/volume_id/libvolume_id/linux_raid.c @@ -23,7 +23,7 @@ #include <errno.h> #include <ctype.h> -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/linux_swap.c b/extras/volume_id/libvolume_id/linux_swap.c index b4828347f7..c87ef63df9 100644 --- a/extras/volume_id/libvolume_id/linux_swap.c +++ b/extras/volume_id/libvolume_id/linux_swap.c @@ -23,7 +23,7 @@ #include <errno.h> #include <ctype.h> -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/lsi_raid.c b/extras/volume_id/libvolume_id/lsi_raid.c index efa792575f..4e6c095b86 100644 --- a/extras/volume_id/libvolume_id/lsi_raid.c +++ b/extras/volume_id/libvolume_id/lsi_raid.c @@ -23,7 +23,7 @@ #include <errno.h> #include <ctype.h> -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/luks.c b/extras/volume_id/libvolume_id/luks.c index 43f326e176..5346450ecc 100644 --- a/extras/volume_id/libvolume_id/luks.c +++ b/extras/volume_id/libvolume_id/luks.c @@ -23,7 +23,7 @@ #include <errno.h> #include <ctype.h> -#include "volume_id.h" +#include "libvolume_id.h" #include "util.h" #include "logging.h" diff --git a/extras/volume_id/libvolume_id/lvm.c b/extras/volume_id/libvolume_id/lvm.c index 074660b1e4..4a1620e8a4 100644 --- a/extras/volume_id/libvolume_id/lvm.c +++ b/extras/volume_id/libvolume_id/lvm.c @@ -23,7 +23,7 @@ #include <errno.h> #include <ctype.h> -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/minix.c b/extras/volume_id/libvolume_id/minix.c index fefba8e729..957925fe1f 100644 --- a/extras/volume_id/libvolume_id/minix.c +++ b/extras/volume_id/libvolume_id/minix.c @@ -23,7 +23,7 @@ #include <errno.h> #include <ctype.h> -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/ntfs.c b/extras/volume_id/libvolume_id/ntfs.c index fe9ff8d5d6..a46359268e 100644 --- a/extras/volume_id/libvolume_id/ntfs.c +++ b/extras/volume_id/libvolume_id/ntfs.c @@ -23,7 +23,7 @@ #include <errno.h> #include <ctype.h> -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/nvidia_raid.c b/extras/volume_id/libvolume_id/nvidia_raid.c index 24717aaaec..7e1b58ba55 100644 --- a/extras/volume_id/libvolume_id/nvidia_raid.c +++ b/extras/volume_id/libvolume_id/nvidia_raid.c @@ -23,7 +23,7 @@ #include <errno.h> #include <ctype.h> -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/ocfs.c b/extras/volume_id/libvolume_id/ocfs.c index c2f8360cae..c55b7234f4 100644 --- a/extras/volume_id/libvolume_id/ocfs.c +++ b/extras/volume_id/libvolume_id/ocfs.c @@ -24,7 +24,7 @@ #include <errno.h> #include <ctype.h> -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/promise_raid.c b/extras/volume_id/libvolume_id/promise_raid.c index bdf0c7b601..f58dab28e9 100644 --- a/extras/volume_id/libvolume_id/promise_raid.c +++ b/extras/volume_id/libvolume_id/promise_raid.c @@ -23,7 +23,7 @@ #include <errno.h> #include <ctype.h> -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/reiserfs.c b/extras/volume_id/libvolume_id/reiserfs.c index 91a5bcb9b0..5a9d71b53d 100644 --- a/extras/volume_id/libvolume_id/reiserfs.c +++ b/extras/volume_id/libvolume_id/reiserfs.c @@ -24,7 +24,7 @@ #include <errno.h> #include <ctype.h> -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/romfs.c b/extras/volume_id/libvolume_id/romfs.c index 456077d1e1..171bb5a2a0 100644 --- a/extras/volume_id/libvolume_id/romfs.c +++ b/extras/volume_id/libvolume_id/romfs.c @@ -23,7 +23,7 @@ #include <errno.h> #include <ctype.h> -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/silicon_raid.c b/extras/volume_id/libvolume_id/silicon_raid.c index 27ac9591a7..e9ce4e0b78 100644 --- a/extras/volume_id/libvolume_id/silicon_raid.c +++ b/extras/volume_id/libvolume_id/silicon_raid.c @@ -23,7 +23,7 @@ #include <errno.h> #include <ctype.h> -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/squashfs.c b/extras/volume_id/libvolume_id/squashfs.c index f220721d7b..3eabce71ae 100644 --- a/extras/volume_id/libvolume_id/squashfs.c +++ b/extras/volume_id/libvolume_id/squashfs.c @@ -23,7 +23,7 @@ #include <errno.h> #include <ctype.h> -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/sysv.c b/extras/volume_id/libvolume_id/sysv.c index 4aa281e9fa..41a32bbaa2 100644 --- a/extras/volume_id/libvolume_id/sysv.c +++ b/extras/volume_id/libvolume_id/sysv.c @@ -23,7 +23,7 @@ #include <errno.h> #include <ctype.h> -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/udf.c b/extras/volume_id/libvolume_id/udf.c index f0e0d41957..54e66b4e86 100644 --- a/extras/volume_id/libvolume_id/udf.c +++ b/extras/volume_id/libvolume_id/udf.c @@ -23,7 +23,7 @@ #include <errno.h> #include <ctype.h> -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/ufs.c b/extras/volume_id/libvolume_id/ufs.c index 2351d1f926..be6fa9e9ea 100644 --- a/extras/volume_id/libvolume_id/ufs.c +++ b/extras/volume_id/libvolume_id/ufs.c @@ -23,7 +23,7 @@ #include <errno.h> #include <ctype.h> -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/util.c b/extras/volume_id/libvolume_id/util.c index 0ad8ce66b2..b49dd6dd14 100644 --- a/extras/volume_id/libvolume_id/util.c +++ b/extras/volume_id/libvolume_id/util.c @@ -25,7 +25,7 @@ #include <fcntl.h> #include <sys/stat.h> -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/via_raid.c b/extras/volume_id/libvolume_id/via_raid.c index 375a20979d..e70cfa1241 100644 --- a/extras/volume_id/libvolume_id/via_raid.c +++ b/extras/volume_id/libvolume_id/via_raid.c @@ -23,7 +23,7 @@ #include <errno.h> #include <ctype.h> -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/volume_id.c b/extras/volume_id/libvolume_id/volume_id.c index 718d74e5b6..e5f0d90ee8 100644 --- a/extras/volume_id/libvolume_id/volume_id.c +++ b/extras/volume_id/libvolume_id/volume_id.c @@ -26,7 +26,7 @@ #include <fcntl.h> #include <sys/stat.h> -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/vxfs.c b/extras/volume_id/libvolume_id/vxfs.c index 883c1266a4..406391bf0e 100644 --- a/extras/volume_id/libvolume_id/vxfs.c +++ b/extras/volume_id/libvolume_id/vxfs.c @@ -23,7 +23,7 @@ #include <errno.h> #include <ctype.h> -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/xfs.c b/extras/volume_id/libvolume_id/xfs.c index 934ed2d877..4b48ff1250 100644 --- a/extras/volume_id/libvolume_id/xfs.c +++ b/extras/volume_id/libvolume_id/xfs.c @@ -23,7 +23,7 @@ #include <errno.h> #include <ctype.h> -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index 6961969c13..518962c10b 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -31,7 +31,7 @@ #include <sys/ioctl.h> #include "../../udev.h" -#include "libvolume_id/volume_id.h" +#include "libvolume_id/libvolume_id.h" #define BLKGETSIZE64 _IOR(0x12,114,size_t) |