mirror of
git://sourceware.org/git/lvm2.git
synced 2025-12-01 08:23:49 +03:00
Compare commits
9 Commits
dev-mcsont
...
dev-mornfa
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fd174b2d85 | ||
|
|
207e8ba2c9 | ||
|
|
689fe11956 | ||
|
|
275de6a215 | ||
|
|
de9184f977 | ||
|
|
2845ebc074 | ||
|
|
d1aa1dcbe7 | ||
|
|
b45a3b4162 | ||
|
|
14febc0efb |
13
Makefile.in
13
Makefile.in
@@ -16,7 +16,7 @@ srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
top_builddir = @top_builddir@
|
||||
|
||||
SUBDIRS = conf daemons include lib libdaemon libdm man scripts tools
|
||||
SUBDIRS = doc include man
|
||||
|
||||
ifeq ("@UDEV_RULES@", "yes")
|
||||
SUBDIRS += udev
|
||||
@@ -26,6 +26,8 @@ ifeq ("@INTL@", "yes")
|
||||
SUBDIRS += po
|
||||
endif
|
||||
|
||||
SUBDIRS += lib tools daemons libdm libdaemon
|
||||
|
||||
ifeq ("@APPLIB@", "yes")
|
||||
SUBDIRS += liblvm
|
||||
endif
|
||||
@@ -34,12 +36,14 @@ ifeq ("@PYTHON_BINDINGS@", "yes")
|
||||
SUBDIRS += python
|
||||
endif
|
||||
|
||||
SUBDIRS += scripts
|
||||
|
||||
ifeq ($(MAKECMDGOALS),clean)
|
||||
SUBDIRS += test
|
||||
endif
|
||||
# FIXME Should use intermediate Makefiles here!
|
||||
ifeq ($(MAKECMDGOALS),distclean)
|
||||
SUBDIRS = conf include man test scripts \
|
||||
SUBDIRS = doc include man test scripts \
|
||||
libdaemon lib tools daemons libdm \
|
||||
udev po liblvm python \
|
||||
unit-tests/datastruct unit-tests/mm unit-tests/regex
|
||||
@@ -51,7 +55,6 @@ DISTCLEAN_TARGETS += config.cache config.log config.status make.tmpl
|
||||
include make.tmpl
|
||||
|
||||
libdm: include
|
||||
libdaemon: include
|
||||
lib: libdm libdaemon
|
||||
liblvm: lib
|
||||
daemons: lib libdaemon tools
|
||||
@@ -64,7 +67,6 @@ libdm.device-mapper: include.device-mapper
|
||||
liblvm.device-mapper: include.device-mapper
|
||||
daemons.device-mapper: libdm.device-mapper
|
||||
tools.device-mapper: libdm.device-mapper
|
||||
scripts.device-mapper: include.device-mapper
|
||||
device-mapper: tools.device-mapper daemons.device-mapper man.device-mapper
|
||||
|
||||
ifeq ("@INTL@", "yes")
|
||||
@@ -92,7 +94,7 @@ all: cscope.out
|
||||
endif
|
||||
DISTCLEAN_TARGETS += cscope.out
|
||||
|
||||
check check_system check_cluster check_local check_lvmetad unit: all
|
||||
check check_cluster check_local check_lvmetad unit: all
|
||||
$(MAKE) -C test $(@)
|
||||
|
||||
install_system_dirs:
|
||||
@@ -109,7 +111,6 @@ install_initscripts:
|
||||
|
||||
install_systemd_generators:
|
||||
$(MAKE) -C scripts install_systemd_generators
|
||||
$(MAKE) -C man install_systemd_generators
|
||||
|
||||
install_systemd_units:
|
||||
$(MAKE) -C scripts install_systemd_units
|
||||
|
||||
@@ -1 +1 @@
|
||||
1.02.91-git (2014-09-01)
|
||||
1.02.78-git (2012-10-22)
|
||||
|
||||
539
WHATS_NEW
539
WHATS_NEW
@@ -1,522 +1,5 @@
|
||||
Version 2.02.112 -
|
||||
=====================================
|
||||
Disable vgchange of clustered attribute with any active LV in VG.
|
||||
Use va_copy to properly pass va_list through functions.
|
||||
Add function to detect rotational devices.
|
||||
Review internal checks for mirror/raid/pvmove volumes.
|
||||
Track mirror segment type with separate MIRROR flag.
|
||||
Fix cmirror endian conversions.
|
||||
Introduce lv_is_pvmove/locked/converting/merging macros.
|
||||
Avoid leaving linear logical volume when thin pool creation fails.
|
||||
Demote an error to a warning when devices known to lvmetad are filtered out.
|
||||
Re-order filter evaluation, making component filters global.
|
||||
Don't leak alloc_handle on raid target error path.
|
||||
Properly validate raid leg names.
|
||||
Archive metadata before starting their modification in raid target.
|
||||
Add missing vg_revert in suspend_lv() error path in raid target.
|
||||
Add missing backup of lvm2 metadata after some raid modifications.
|
||||
Use vg memory pool for extent allocation.
|
||||
Add allocation/physical_extent_size config option for default PE size of VGs.
|
||||
Introduce common code to modify metadate and reload updated LV.
|
||||
Fix rename of active snapshot volume in cluster.
|
||||
Make sure shared libraries are built with RELRO option.
|
||||
|
||||
Version 2.02.111 - 1st September 2014
|
||||
=====================================
|
||||
Pass properly sized char buffers for sscanf when initializing clvmd.
|
||||
Reinstate nosync logic when extending mirror. (2.02.110)
|
||||
Fix total area extent calculation when allocating cache pool. (2.02.110)
|
||||
|
||||
Version 2.02.110 - 26th August 2014
|
||||
Version 2.02.99 -
|
||||
===================================
|
||||
Fix manipulation with thin-pools which are excluded via volume_list.
|
||||
Support lv/vgremove -ff to remove thin vols from broken/inactive thin pools.
|
||||
Fix typo breaking configure --with-lvm1=shared.
|
||||
Modify lvresize code to handle raid/mirrors and physical extents.
|
||||
Don't allow pvcreate to proceed if scanning or filtering fails.
|
||||
Cleanly error when creating RAID with stripe size < PAGE_SIZE.
|
||||
Print name of LV which on activation triggers delayed snapshot merge.
|
||||
Add lv_layout and lv_role LV reporting fields.
|
||||
Properly display lvs lv_attr volume type and target type bit for cache origin.
|
||||
Fix pvcreate_check() to update cache correctly after signature wiping.
|
||||
Fix primary device lookup failure for partition when processing mpath filter.
|
||||
If LV inactive and non-clustered, do not issue "Cannot deactivate" on -aln.
|
||||
Remove spurious "Skipping mirror LV" message on pvmove of clustered mirror.
|
||||
|
||||
Version 2.02.109 - 5th August 2014
|
||||
==================================
|
||||
Remove lv_volume_type field from reports. (2.02.108)
|
||||
Fix a segfault in lvscan --cache when devices were already missing. (2.02.108)
|
||||
Fix incorrect persistent .cache after vgcreate with PV creation. (2.02.108)
|
||||
Display actual size changed when resizing LV.
|
||||
Allow approximate allocation with +%FREE in lvextend.
|
||||
Remove possible spurious "not found" message on PV create before wiping.
|
||||
Handle upgrade from 2.02.105 when an LV now gaining a uuid suffix is active.
|
||||
|
||||
Version 2.02.108 - 23rd July 2014
|
||||
=================================
|
||||
Add lvscan --cache which re-scans constituents of a particular LV.
|
||||
Make dmeventd's RAID plugin re-scan failed PVs when lvmetad is in use.
|
||||
Improve code sharing for lvconvert and lvcreate and pools (cache & thin).
|
||||
Improve lvconvert --merge validation.
|
||||
Improve lvconvert --splitsnapshot validation.
|
||||
Add report/list_item_separator lvm.conf option.
|
||||
Add lv_active_{locally,remotely,exclusively} LV reporting fields.
|
||||
Comment out devices/{preferred_names,filter} in default lvm.conf file.
|
||||
Enhance lvconvert thin, thinpool, cache and cachepool command line support.
|
||||
Display 'C' only for cache and cache-pool target types in lvs.
|
||||
Prompt for confirmation before change LV into a snapshot exception store.
|
||||
Return proper error codes for some failing lvconvert funtions.
|
||||
Add initial code to use cache tools (cache_check|dump|repair|restore).
|
||||
Support lvdisplay --maps for raid.
|
||||
Add --activationmode degraded to activate degraded raid volumes by default.
|
||||
Add separate lv_active_{locally,remotely,exclusively} LV reporting fields.
|
||||
Recognize "auto"/"unmanaged" values in selection for appropriate fields only.
|
||||
Add report/binary_values_as_numeric lvm.conf option for binary values as 0/1.
|
||||
Add --binary arg to pvs,vgs,lvs and {pv,vg,lv}display -C for 0/1 on reports.
|
||||
Add separate reporting fields for each each {pv,vg,lv}_attr bit.
|
||||
Separate LV device status reporting fields out of LV fields.
|
||||
Fix regression causing PVs not in VGs to be marked as allocatable (2.02.59).
|
||||
Fix VG component of lvid in vgsplit/vgmerge and check in vg_validate.
|
||||
Add lv_full_name, lv_parent and lv_dm_path fields to reports.
|
||||
Change lv_path field to suppress devices that never appear in /dev/vg.
|
||||
Postpone thin pool lvconvert prompts (2.02.107).
|
||||
Require --yes option to skip prompt to lvconvert thin pool chunksize.
|
||||
Support lvremove -ff to remove thin volumes from broken thin pools.
|
||||
Require --yes to skip raid repair prompt.
|
||||
Change makefile %.d generation to handle filename changes without make clean.
|
||||
Fix use of buildir in make pofile.
|
||||
Enhance private volumes UUIDs with suffixed for easier detection.
|
||||
Do not use reserved _[tc]meta volumes for temporary LVs.
|
||||
Leave backup pool metadata with _meta%d suffix instead of reserved _tmeta%d.
|
||||
Allow RAID repair to reuse PVs from same image that suffered a failure.
|
||||
New RAID images now avoid allocation on any PVs in the same parent RAID LV.
|
||||
Always reevaluate filters just before creating PV.
|
||||
|
||||
Version 2.02.107 - 23rd June 2014
|
||||
=================================
|
||||
Introduce LCK_ACTIVATION to avoid concurrent activation of basic LV types.
|
||||
Fix open_count test for lvchange --refresh or mirrors and raids.
|
||||
Update pvs,vgs,lvs and lvm man page for selection support.
|
||||
Add -S/--select to lvm devtypes for report selection.
|
||||
Add -S/--select to pvs,vgs,lvs and {pv,vg,lv}display -C for report selection.
|
||||
Use dm_report_init_with_selection now, implicit "selected" field appears.
|
||||
Make use of libdm's DM_REPORT_FIELD_TYPE{SIZE,PERCENT,STRING_LIST} for fields.
|
||||
Support all-or-nothing pvmove --atomic.
|
||||
Automatically add snapshot metadata size for -l %ORIGIN calculation.
|
||||
When converting RAID origin to cache LV, properly rename sub-LVs.
|
||||
Use RemoveOnStop for lvm2-lvmetad.socket systemd unit.
|
||||
Add thin-generic configuration profile for generic thin settings.
|
||||
Fix crash when reporting empty labels on pvs.
|
||||
Use retry_deactivation also when cleaning orphan devices.
|
||||
Wait for client threads when shutting down lvmetad.
|
||||
Remove PV from cache on pvremove.
|
||||
Avoid repeatedly reporting of failure to connect to lvmetad.
|
||||
Introduce MDA_FAILED to permit metadata updates even if some mdas are missing.
|
||||
Prompt when setting the VG cluster attr if the cluster is not setup.
|
||||
Allow --yes to skip prompt in vgextend (worked only with -f).
|
||||
Don't use name mangling for LVM - it never uses dm names with wrong char set.
|
||||
Remove default.profile and add {command,metadata}_profile_template.profile.
|
||||
Use proper umask for systemd units generated by lvm2-activation-generator.
|
||||
Check for failing mirror_remove_missing() function.
|
||||
Prompt before converting volumes to thin pool and thin pool metadata.
|
||||
Add dumpconfig --type profilable-{metadata,command} to select profile type.
|
||||
Exit immediately with error if command profile is found invalid.
|
||||
Separate --profile cmd line arg into --commandprofile and --metadataprofile.
|
||||
Strictly separate command profiles and per-VG/LV profiles referenced in mda.
|
||||
Fix dumpconfig --type diff when run as second and later cmd in lvm shell.
|
||||
Fix wrong profile reuse from previous run if another cmd is run in lvm shell.
|
||||
Move cache description from lvm(8) to new lvmcache(7) man page.
|
||||
Display skipped prompt in silent mode.
|
||||
Make reporting commands show help about possible sort keys on '-O help'.
|
||||
Add metadata_percent to lvs_cols.
|
||||
Take account of parity areas with alloc anywhere in _calc_required_extents.
|
||||
Use proper uint64 casting for calculation of cache metadata size.
|
||||
Better support for nesting of blocking signals.
|
||||
Use only sigaction handler and drop duplicate signal handler.
|
||||
Separate signal handling and flock code out into lib/misc.
|
||||
Don't start dmeventd checking seg_monitor and monitoring is disabled.
|
||||
Catch CTRL-c during pvremove prompts.
|
||||
Show correct availability status for snapshot origin in lvscan.
|
||||
Move segment thin pool/volume info into segment display 'lvdisplay --maps'.
|
||||
Display thin pool usage even when just thin volume is available.
|
||||
Display monitoring status for monitorable segments in 'lvdisplay --maps'.
|
||||
Display virtual extents for virtual LVs in 'lvdisplay --maps'.
|
||||
Make vgsplit fail cleanly when not all PVs are specified for RAID 4/5/6.
|
||||
Make vgsplit work on mirrors with logs that share PVs with images.
|
||||
Use devices/ignore_suspended_devices=0 by default if not defined in lvm.conf.
|
||||
Use proper libmem mempool for allocation of unknown segment name.
|
||||
Add --readonly to reporting and display tools for lock-free metadata access.
|
||||
Add locking_type 5 for dummy locking for tools that do not need any locks.
|
||||
Fix _recover_vg() error path when lock conversion fails.
|
||||
Use X for LV attributes that are unknown when activation disabled.
|
||||
Only output lvdisplay 'LV Status' field when activation is enabled.
|
||||
Use lvmetad_used() in pvscan instead of config_tree.
|
||||
Configure --enable-udev-systemd-background-jobs if not disabled explicitly.
|
||||
Add lvmdump -s to collect system info and context (currently systemd only).
|
||||
Refactor allocation code to make A_POSITIONAL_FILL explicit.
|
||||
Use thread-safe ctime_r() for clvmd debug logging.
|
||||
Skip adding replies to already finished reply thread.
|
||||
Use mutex to check number of replies in request_timed_out() in clvmd.
|
||||
Drop usage of extra reply_mutex for localsock in clvmd.
|
||||
Protect manipulation with finished flag with mutex in clvmd.
|
||||
Shift mutex creation and destroy for localsock in clvmd to correct place.
|
||||
Fix usage of --test option in clvmd.
|
||||
Skip more libraries to be mlocked in memory.
|
||||
Remove LOCKED flag for pvmove replaced with error target.
|
||||
Return invalid command when specifying negative polling interval.
|
||||
|
||||
Version 2.02.106 - 10th April 2014
|
||||
==================================
|
||||
Fix ignored --dataalignment/dataalignment offset for pvcreate --restorefile.
|
||||
Fix lost information about bootloader area when using lvmetad.
|
||||
Don't require --major to be specified when using -My option on kernels > 2.4.
|
||||
Add configure --disable-thin_check_needs_check to support old thin_check.
|
||||
Use thin_check --clear-needs-check-flag by default.
|
||||
Export lvm_even_rand() for controlled provision of random numbers.
|
||||
Add lvmthin man page to section 7.
|
||||
Ensure mapped device names are not too long in vg_validate and lvrename.
|
||||
Ensure resume failure in lvrename results in command failure.
|
||||
Add explicit error message when using lvdisplay -c -m.
|
||||
Report error if superfluous argument (e.g. PV name) supplied to pvscan.
|
||||
Fix error message for pvdisplay -c -m and add one for pvdisplay -c -s.
|
||||
Use EINVALID_CMD_LINE correctly instead of ECMD_FAILED in vgimport/export.
|
||||
Obtain list of known VGs from lvmetad for pvchange --all.
|
||||
Add man page for lvm-dumpconfig to section 8.
|
||||
Drop unused cmd pointer for internal function for_each_sub_lv().
|
||||
Validate name for renamed sub LVs.
|
||||
When lvrename fails on argument parsing return EINVALID_CMD_LINE.
|
||||
Fix exit code regression in failing pvchange command (2.02.66).
|
||||
Include 'lvm dumpconfig --type missing' and '--type diff' output to lvmdump.
|
||||
Return failure when specifying negative size for pvresize.
|
||||
Fix memory corruption in cmd context refresh if clvmd leaks opened device.
|
||||
Reinitialise lvmcache properly on fork to fix premature polldaemon exit.
|
||||
Add 'lvm dumpconfig --type diff' to show differences from defaults.
|
||||
Fix swap signature detection for devices smaller then 2MB.
|
||||
Use dm_malloc function in clvmd.c.
|
||||
Resolve memory release order for clvmd shutdown.
|
||||
Report error when lvm2 activation is released in critical_section.
|
||||
Fix memory corruption when pvscan reports long pv names.
|
||||
Do not report internal orphan VG names when reporting pvdisplay/pvscan.
|
||||
Fix pvdisplay -c man page referencing KB instead of sectors.
|
||||
Skip redundant synchronization calls on local clvmd.
|
||||
Use correct PATH_MAX for locking dir path.
|
||||
Do not check for backups when when its creation is disabled.
|
||||
Don't allow --mergedconfig without --type current in dumpconfig. Fix memleak.
|
||||
Make global/lvdisplay_shows_full_device_path lvm.conf setting profilable.
|
||||
Make global/{units|si_unit_consistency|suffix} lvm.conf setting profilable.
|
||||
Validate minimal chunk size for snapshot COW volume in lvconvert.
|
||||
Disallow lvconvert of origin to snapshot COW volume.
|
||||
Make report lvm.conf settings profilable.
|
||||
Add existing report settings to lvm.conf.
|
||||
Use VG read lock during 'pvscan --cache -aay' autoactivation.
|
||||
Issue a VG refresh before autoactivation only if the PV has changed/is new.
|
||||
Add flag to lvmetad protocol to indicate the PV scanned has changed/is new.
|
||||
Also add vgname to lvmetad protocol when referencing VGs for PVs scanned.
|
||||
Add man page for lvm2-activation-generator.
|
||||
Don't print an error and accept empty value for global/thin_disabled_features.
|
||||
Update API for internal function build_dm_uuid().
|
||||
Do not try to check empty pool with scheduled messages.
|
||||
Fix return value in pool_has_message() when quering for any message.
|
||||
Cleanup all client resources on clvmd exit.
|
||||
Use dm_zalloc to clear members of clvmd client struct.
|
||||
Use BLKID_CFLAGS when compiling with blkid support.
|
||||
Use correct rl_completion_func_t typedef for new readline.
|
||||
Make lvm 'dumpconfig --type default' complete for it to be consumed by lvm.
|
||||
Run pvscan --cache via systemd-run in udev if the PV label is detected lost.
|
||||
Fix memleak when lvmetad discovers PV to appear on another device.
|
||||
Fix calculation of maximum size of COW device for snapshot (2.02.99).
|
||||
Do not allow stripe size to be bigger then extent size for lvresize.
|
||||
Zero snapshot COW header when creating read-only snapshot.
|
||||
Comment out config lines in dumpconfig output without default values defined.
|
||||
Improve detection of clustered mirror support.
|
||||
Enhance raid code with feature flags, for now checks for raid10.
|
||||
Move parsing of VG metadata from vg_commit() back to vg_write() (2.02.99)
|
||||
Avoid a PV label scan while in a critical section.
|
||||
Remove (always 0) skip argument from lv_activation_skip().
|
||||
Create /dev/disk/by-id/lvm-pv-uuid-<PV_UUID> symlink for each PV via udev.
|
||||
lvcreate computes RAID4/5/6 stripes if not given from # of allocatable PVs.
|
||||
Fix merging of old snapshot into thin volume origin.
|
||||
Use --ignoreskippedcluster in lvm2-monitor initscript/systemd unit.
|
||||
Do not use VG read/write state for LV read/write state.
|
||||
Use --ignoreskippedcluster in activation systemd units if use_lvmetad=0.
|
||||
Allow approximate allocation when specifying size in percentage terms.
|
||||
Add basic LVM support for cache[pool] segment types.
|
||||
Use local exclusive activation for creation of raid in cluster.
|
||||
Use correctly signed 64b constant when selecting raid volumes.
|
||||
Add systemd native service for clvmd, cmirrord and clustered LV activation.
|
||||
Remove ExecReload from lvmetad systemd unit: lvmetad -R undefined. (2.02.98)
|
||||
Do not fork lvmetad if running under systemd.
|
||||
Wipe DM_snapshot_cow signature without prompt in new LVs with blkid wiping.
|
||||
Avoid exposing temporary devices when initializing raid metadata volumes.
|
||||
Add internal tags command to display any tags defined on the host.
|
||||
Prohibit use of external origin with size incompatible with thin pool.
|
||||
Avoid trying to convert single to thin pool and volume at the same time.
|
||||
Add support for partitions on ZFS zvol.
|
||||
Fix unwanted drop of hold flocks on forked children.
|
||||
Respect LVM_LVMETAD_PIDFILE env var for lvm command.
|
||||
Avoid exposing temporary devices when initializing thin pool volume.
|
||||
Fix test when checking target version for available thin features.
|
||||
Detect thin feature external_origin_extend and limit extend when missing.
|
||||
Rename internal pool_can_resize_metadata() to thin_pool_feature_supported().
|
||||
Issue error if libbblkid detects signature and fails to return offset/length.
|
||||
Update autoconf config.guess/sub to 2014-01-01.
|
||||
Online thin pool metadata resize requires 1.10 kernel thin pool target.
|
||||
|
||||
Version 2.02.105 - 20th January 2014
|
||||
====================================
|
||||
Fix thin LV flagging for udev to skip scanning only if the LV is wiped.
|
||||
Replace use of xfs_check with xfs_repair in fsadm.
|
||||
Mark lvm1 format metadata as FMT_OBSOLETE. Do not use it with lvmetad.
|
||||
Invalidate cached VG struct after a PV in it gets orphaned. (2.02.87)
|
||||
Mark pool format metadata as FMT_OBSOLETE.
|
||||
Use major:minor in lvm2-pvscan@.service for proper global_filter application.
|
||||
Syntax and spelling fixes in some man pages.
|
||||
Dependency scan counts with snapshots and external origins.
|
||||
Make sure VG extent size is always greater or equal to PV phys. block size.
|
||||
Optimize double call of stat() for cached devices.
|
||||
Enable support for thin provisioning for default configuration.
|
||||
Improve process_each_lv_in_vg() tag processing.
|
||||
Reordered and simplified logging code.
|
||||
Fix SYSTEMD_READY assignment for foreign devices in lvmetad udev rules.
|
||||
Disable online thin pool metadata resize for 1.9 kernel thin target.
|
||||
Shortened code for initialization of raid segment types.
|
||||
Cache global library dir in command context.
|
||||
Return success when inserting dirs and links into device cache.
|
||||
Test for remote exclusive activation after activation fails.
|
||||
Support lvconvert --merge for thin snapshots.
|
||||
Add support to read thin device id from table line entry.
|
||||
Drop extra test for origin when testing merging origin in lv_refresh().
|
||||
Extend lv_remove_single() to not print info about removed LV.
|
||||
Replace open_count check with lv_check_not_in_use() for snapshot open test.
|
||||
Add error messages with LV names for failing lv refresh.
|
||||
Compile/link executables with new RELRO and PIE options (non-static builds).
|
||||
Support per-object compilation cflags via CFLAGS_object.o.
|
||||
Automatically detect support for compiler/linker options to use RELRO and PIE.
|
||||
Add --splitsnapshot to lvconvert to separate out cow LV.
|
||||
Reinstate origin reload to complete lvconvert -s with active LVs. (2.02.98)
|
||||
Select only active volume groups if vgdisplay -A is used.
|
||||
Add -p and LVM_LVMETAD_PIDFILE env var to lvmetad to change pid file.
|
||||
Allow lvmetad to reuse stale socket.
|
||||
Only unlink lvmetad socket on error if created by the same process.
|
||||
Append missing newline to lvmetad missing socket path error message.
|
||||
Check for non-zero aligment in _text_pv_add_metadata_area() to not div by 0.
|
||||
Add allocation/use_blkid_wiping to lvm.conf to enable blkid wiping.
|
||||
Enable blkid_wiping by default if the blkid library is present.
|
||||
Add configure --disable-blkid_wiping to disable libblkid signature detection.
|
||||
Add -W/--wipesignatures lvcreate option to support wiping on new LVs.
|
||||
Add allocation/wipe_signatures_when_zeroing_new_lvs to lvm.conf.
|
||||
Do not fail the whole autoactivation if the VG refresh done before fails.
|
||||
Do not connect to lvmetad on vg/lvchange --sysinit -aay and socket absent.
|
||||
Use lv_check_not_in_use() when testing device in use before merging.
|
||||
Move test for target present from init_snapshot_merge() to lvconvert.
|
||||
Check for failure of lvmcache_add_mda() when writing pv.
|
||||
Check for failure of dev_get_size() when reporting device size.
|
||||
Drop extra unneeded '/' when scanning sysfs directory.
|
||||
Fix undef value if skipped clustered VG ignored for toollib PV seg. (2.02.103)
|
||||
Support validation of VG/LV names in liblvm/python.
|
||||
Allow creation of PVs with arguments to liblvm/python.
|
||||
Ensure sufficient metadata copies retained in liblvm/python vgreduce.
|
||||
Fix installation of profiles from conf subdir when not building in srcdir.
|
||||
Show UUIDs for missing PVs in reports.
|
||||
Change dev_size/name, pv_fmt/mda_free/mda_size/uuid fields from pv to label.
|
||||
Add struct device *dev to struct label.
|
||||
Introduce process_each_label.
|
||||
Change void *private to struct format_type *fmt in struct labeller.
|
||||
Remove pv_read.
|
||||
Add reporting of thin_id device id for thin volumes.
|
||||
Fix reporting of empty numerical values for recently-added fields.
|
||||
Use _field_set_percent/value in reporting code.
|
||||
|
||||
Version 2.02.104 - 13th November 2013
|
||||
=====================================
|
||||
Workaround VG refresh race during autoactivation by retrying the refresh.
|
||||
Handle failures in temporary mirror used when adding images to mirrors.
|
||||
Fix and improve logic for implicitely exclusive activations.
|
||||
Return success when LV cannot be activated because of volume_list filter.
|
||||
Return proper error state for remote exclusive activation.
|
||||
Fix missing lvmetad scan for PVs found on MD partitions.
|
||||
Respect DM_UDEV_DISABLE_OTHER_RULES_FLAG in lvmetad udev rules.
|
||||
Fix clvmd message verification to not reject REMOTE flag. (2.02.100)
|
||||
Compare equality of double values with DBL_EPSILON predefined constant.
|
||||
Use additional gcc warning flags by default.
|
||||
Add ignore_lvm_mirrors to config file to read/ignore labels on mirrors.
|
||||
Add internal flag for temporary LVs to properly direct udev to not interfere.
|
||||
Fix endless loop in blkdeactivate <device>... if unable to umount/deactivate.
|
||||
Add dev-block-<major>:<minor>.device systemd alias for complete PV tracking.
|
||||
Use major:minor as short form of --major and --minor arg for pvscan --cache.
|
||||
Remove 2>/dev/null from three lvm commands executed by vgimportclone.
|
||||
Add configure --enable-udev-systemd-background-jobs.
|
||||
Add lvm2-pvscan@.service to run pvscan as a service for lvmetad/autoactivation.
|
||||
Use #ifdef __linux__ instead of linux throughout.
|
||||
Fix lvconvert swap of poolmetadata volume for active thin pool.
|
||||
Check for open count with a timeout before removal/deactivation of an LV.
|
||||
Report RAID images split with tracking as out-of-sync ("I").
|
||||
Improve parsing of snapshot lv segment.
|
||||
Add workaround for deactivation problem of opened virtual snapshot.
|
||||
Disable unsupported merge for virtual snapshot.
|
||||
Move code to remove virtual snapshot from tools to lib for lvm2app.
|
||||
Fix possible race during daemon worker thread creation (lvmetad).
|
||||
Fix possible deadlock while clearing lvmetad cache for full rescan.
|
||||
Recognise NVM Express devices in filter.
|
||||
Fix failing metadata repair when lvmetad is used.
|
||||
Fix incorrect memory handling when reading messages from lvmetad.
|
||||
Fix locking in lvmetad when handling the PV which is gone.
|
||||
Recognize new flag to skip udev scanning in udev rules and act appropriately.
|
||||
Add support for flagging an LV to skip udev scanning during activation.
|
||||
Improve message when unable to change discards setting on active thin pool.
|
||||
Run full scan before vgrename operation to avoid any cache name collision.
|
||||
Fix lvconvert when converting to a thin pool and thin LV at once. (2.02.99)
|
||||
|
||||
Version 2.02.103 - 4th October 2013
|
||||
===================================
|
||||
Ensure vgid matches before removing vgname entry from lvmetad cache.
|
||||
Add --ignoreskippedcluster for exit status success when clustered VGs skipped.
|
||||
Fix 3 minute udev timeout so that it is applied for all LVM volumes.
|
||||
Fix thin/raid & activation config defaults with configure --disable-devmapper.
|
||||
Fix RAID calculation for sufficient allocatable space.
|
||||
lvconvert from linear to mirror or RAID1 now honors mirror_segtype_default.
|
||||
Add thin-performance configuration profile.
|
||||
Add lvm.conf allocation/thin_pool_chunk_size_policy option.
|
||||
Fix contiguous & cling allocation policies for parity RAID. (2.02.100)
|
||||
Have lvmconf --enable/disable-cluster reset/set use_lvmetad.
|
||||
Don't install separate command symlink for 'lvm devtypes'. (2.02.101)
|
||||
Add seg_size_pe field to reports.
|
||||
Support start+length notation with command line PE ranges.
|
||||
Exit cleanly with message when pvmove cannot restart because LV is inactive.
|
||||
|
||||
Version 2.02.102 - 23rd September 2013
|
||||
======================================
|
||||
Fix missing build dependency for scripts subdir in Makefile.
|
||||
Extend lv_info() for more efficient lv_is_active_locally() check.
|
||||
Fix node up/down handling in clvmd corosync module.
|
||||
|
||||
Version 2.02.101 - 20th September 2013
|
||||
======================================
|
||||
Fix 3-thread clvmd deadlock triggered by cleanup on EOF from client.
|
||||
Remove VG from lvmetad before restoring it with vgcfgrestore.
|
||||
Use strtoull instead of strtol in _get_int_arg.
|
||||
Add devtypes report command to display built-in recognised block device types.
|
||||
Fix CC Makefile override which had reverted to using built-in value. (2.02.75)
|
||||
Recognise bcache block devices in filter (experimental).
|
||||
Run lvm2-activation-net after lvm2-activation service to prevent parallel run.
|
||||
Add man page entries for lvmdump's -u and -l options.
|
||||
Fix lvm2app segfault while using lvm_list_pvs_free fn if there are no PVs.
|
||||
Improve of clvmd singlenode locking simulation.
|
||||
lvconvert no longer converts LVs of "mirror" segment type to thinpool.
|
||||
lvconvert no longer converts thinpool sub-LVs to "mirror" segment type.
|
||||
Direct udev to use 3min timeout for LVM devices. Recent udev has default 30s.
|
||||
Do not scan multipath or RAID components and avoid incorrect autoactivation.
|
||||
Fix MD/loop udev handling to fire autoactivation after setup or coldplug only.
|
||||
Make RAID capable of single-machine exclusive operations in a cluster.
|
||||
Drop calculation of read ahead for deactivated volume.
|
||||
Check for exactly one lv segment in validation of thin pools and volumes.
|
||||
Fix dmeventd unmonitoring of thin pools.
|
||||
Fix lvresize for stacked thin pool volumes (i.e. mirrors).
|
||||
Write Completed debug message before reinstating log defaults after command.
|
||||
Refresh existing VG before autoactivation (event retrigger/device reappeared).
|
||||
Use pvscan -b in udev rules to avoid a deadlock on udev process count limit.
|
||||
Add pvscan -b/--background for the command to be processed in the background.
|
||||
Don't assume stdin file descriptor is readable.
|
||||
Avoid unlimited recursion when creating dtree containing inactive pvmove LV.
|
||||
Require exactly 3 arguments for lvm2-activation-generator. Remove defaults.
|
||||
Inform lvmetad about any lost PV label to make it in sync with system state.
|
||||
Support most of lvchange operations on stacked thin pool meta/data LVs.
|
||||
Enable non-clustered pvmove of snapshots and snapshot origins.
|
||||
Add ability to pvmove non-clustered RAID, mirror, and thin volumes.
|
||||
Make lvm2-activation-generator silent unless it's in error state.
|
||||
Remove "mpath major is not dm major" msg for mpath component scan (2.02.94).
|
||||
Prevent cluster mirror logs from being corrupted by redundant checkpoints.
|
||||
Fix ignored lvmetad update on loop device configuration (2.02.99).
|
||||
Use LVM_PATH instead of hardcoded value in lvm2 activation systemd generator.
|
||||
Fix vgck to notice on-disk corruption even if lvmetad is used.
|
||||
Move mpath device filter before partitioned filter (which opens devices).
|
||||
Split partitioned filter out of lvm_type filter.
|
||||
Merge filter*.h into a single filter.h.
|
||||
Require confirmation for vgchange -c when no VGs listed explicitly.
|
||||
Also skip /var and /var/log by default in blkdeactivate when unmounting.
|
||||
Add support for bind mounts in blkdeactivate.
|
||||
Add blkdeactivate -v/--verbose for debug output from external tools used.
|
||||
Add blkdeactivate -e/--errors for error messages from external tools used.
|
||||
Suppress messages from external tools called in blkdeactivate by default.
|
||||
|
||||
Version 2.02.100 - 13th August 2013
|
||||
===================================
|
||||
Fix inability to remove a VG's cluster flag if it contains a mirror.
|
||||
Suppress arg: prefix in log_sys_error macro when arg is empty string.
|
||||
Fix bug making lvchange unable to change recovery rate for RAID.
|
||||
Prohibit conversion of thin pool to external origin.
|
||||
Workaround gcc v4.8 -O2 bug causing failures if config/checks=1 (32bit arch).
|
||||
Verify clvmd message validity before processing and log error if incorrect.
|
||||
When creating PV on existing LV don't forbid reserved LV names on LVs below.
|
||||
Split out device_is_suspended_or_blocking from device_is_usable.
|
||||
When converting mirrors, default segtype should be the same unless specified.
|
||||
Make "raid1" the default mirror segment type.
|
||||
Fix clogd descriptor leak when daemonizing.
|
||||
Fix clvmd descriptor leak on restart.
|
||||
Add pipe_open/close() to use instead of less efficient/secure popen().
|
||||
Fix metadata area offset/size overflow if it's >= 4g and while using lvmetad.
|
||||
Inherit and apply any profile attached to a VG if creating new thin pool.
|
||||
Add initial support thin pool lvconvert --repair.
|
||||
Add --with-thin-repair and --with-thin-dump configure options.
|
||||
Add lvm.conf thin_repair/dump_executable and thin_repair_options.
|
||||
Require 1.9 thin pool target version for online thin pool metadata resize.
|
||||
Ignore previous LV seg with alloc contiguous & cling when num stripes varies.
|
||||
Fix segfault if devices/global_filter is not specified correctly.
|
||||
|
||||
Version 2.02.99 - 24th July 2013
|
||||
================================
|
||||
Do not zero init 4KB of thin snapshot for non-zeroing thin pool (2.02.94).
|
||||
Issue an error msg if lvconvert --type used incorrectly with other options.
|
||||
Use LOG_DEBUG/ERR msg severity instead default for lvm2-activation-generator.
|
||||
Support ARG_GROUPABLE with merge_synonym (for --raidwritemostly).
|
||||
Fix segfault when reporting raid_syncaction for older kernels.
|
||||
Add LV report fields: raid_mismatch_count/raid_sync_action/raid_write_behind.
|
||||
Add LV reporting fields raid_min_recovery_rate, raid_max_recovery_rate.
|
||||
Add sync_percent as alias for copy_percent LV reporting field.
|
||||
Add lv_ prefix to modules reporting field.
|
||||
Use units B or b (never E) with no decimal places when displaying sizes < 1k.
|
||||
Add support for poolmetadataspare LV, that will be used for pool recovery.
|
||||
Improve activation order when creating thin pools in non-clustered VG.
|
||||
List thin-pool and thin modules for thin volumes.
|
||||
Correct thin creation error paths.
|
||||
Use local activation for clearing snapshot COW device.
|
||||
Add lvm2-activation-net systemd unit to activate LVs on net-attached storage.
|
||||
Release memory allocated with _cached_info().
|
||||
Add whole log_lv and metadata_lv sub volumes when creating partial tree.
|
||||
Properly use snapshot layer for origin which is also thin volume.
|
||||
Avoid generating metadata backup when calling update_pool_lv().
|
||||
Send thin messages also for active thin pool and inactive thin volume.
|
||||
Add activation/auto_set_activation_skip to control activation skip flagging.
|
||||
Add 's(k)ip activation' bit to lvs -o lv_attr to indicate skip flag attached.
|
||||
Add --ignoreactivationskip to lvcreate/vgchange/lvchange to ignore skip flag.
|
||||
Add --setactivationskip to lvcreate/lvchange to set activation skip flag.
|
||||
Automatically flag thin snapshots to be skipped during activation.
|
||||
Add support for persistent flagging of LVs to be skipped during activation.
|
||||
Add --type profilable to lvm dumpconfig to show profilable config settings.
|
||||
Add --mergedconfig to lvm dumpconfig for merged --config/--profile/lvm.conf.
|
||||
Relase memory and unblock signals in lock_vol error path.
|
||||
Define LVM2_* command errors in lvm2cmd.h and use in dmeventd plugins.
|
||||
Move errors.h to tools dir.
|
||||
Add man page entries for profile configuration and related options.
|
||||
Improve error loging when user tries to interrupt commands.
|
||||
Rename _swap_lv to _swap_lv_identifiers and move to allow an additional user.
|
||||
Rename snapshot segment returning methods from find_*_cow to find_*_snapshot.
|
||||
liblvm/python API: Additions: PV create/removal/resize/listing
|
||||
liblvm/python API: Additions: LV attr/origin/Thin pool/Thin LV creation
|
||||
Add vgs/lvs -o vg_profile/lv_profile to report profiles attached to VG/LV.
|
||||
Add default.profile configuration profile and install it on make install.
|
||||
Create a new 'conf' subdir for configuration files including profiles.
|
||||
Make selected thinp settings customizable by a profile.
|
||||
Support changing VG/LV profiles: vgchange/lvchange --profile/--detachprofile.
|
||||
Support storing profile name in metadata for both VGs and LVs.
|
||||
Add new --profile command line arg to select a configuration profile for use.
|
||||
Add config/profile_dir to set working directory to load profiles from.
|
||||
Add configure --with-default-profile-subdir to select dir to keep profiles in.
|
||||
Add support for configuration profiles.
|
||||
Introduce config_source wrapper for identification of configuration sources.
|
||||
Avoid creation of multiple archives for one command.
|
||||
Use mirror_segtype_default if type not specified for linear->mirror upconvert.
|
||||
Fix use of too big chunks of memory when communication with lvmetad.
|
||||
Fix vgcfgrestore crash when specified incorrect vg name.
|
||||
Refine lvm.conf and man page documentation for autoactivation feature.
|
||||
@@ -529,8 +12,6 @@ Version 2.02.99 - 24th July 2013
|
||||
Report lvs volume type 'o' also for external origin volumes.
|
||||
Report lvs target type 't' only for thin pools and thin volumes.
|
||||
Fix test for active snapshot in cluster before resizing it.
|
||||
Allow local activation to receive a locally-supplied LV struct.
|
||||
Add vg->vg_ondisk / lv_ondisk() holding committed metadata.
|
||||
Report backtrace from dump filter error path.
|
||||
Do not use persistent filter with lvmetad.
|
||||
Composable persistent filter functionality for global filter.
|
||||
@@ -564,10 +45,10 @@ Version 2.02.99 - 24th July 2013
|
||||
Add explicit message about unsupported pvmove for thin/thinpool volumes.
|
||||
Fix lvmetad error path in lvmetad_vg_lookup() for null vgname.
|
||||
Fix clvmd _cluster_request() return code in memory fail path.
|
||||
Add lvcreate/lvchange --[raid]{min|max}recoveryrate for raid LVs.
|
||||
Add lvchange --[raid]writemostly/writebehind support for RAID1
|
||||
Add writemostly/writebehind support for RAID1
|
||||
Add lv_change_activate() for common activation code in vg/lvchange.
|
||||
Add lvchange --[raid]syncaction for scrubbing of RAID LVs.
|
||||
Revert change that allowed identical table reload for RAID.
|
||||
New lvchange arg, '--syncaction' allows scrubbing of RAID LVs.
|
||||
Improve RAID kernel status retrieval to include sync_action/mismatch_cnt.
|
||||
Add external origin support for lvcreate.
|
||||
Improve lvcreate, lvconvert and lvm man pages.
|
||||
@@ -580,20 +61,20 @@ Version 2.02.99 - 24th July 2013
|
||||
Add --withcomments and --withversions switch to lvm dumpconfig.
|
||||
Add --type {current|default|missing|new} and --atversion to lvm dumpconfig.
|
||||
Support automatic config validation and add 'config' section to lvm.conf.
|
||||
Add pvs -o pv_ba_start,pv_ba_size to report bootloader area start and size.
|
||||
Add --bootloaderareasize to pvcreate and vgconvert to create bootloader area.
|
||||
Add pvs -o ba_start,ba_size to report bootloader area start and size.
|
||||
Add --bootloaderareasize to pvcreate and vgconvert to create a bootloader area.
|
||||
Add PV header extension: extension version, flags and bootloader areas.
|
||||
Initial support for lvconvert of thin external origin.
|
||||
Add _lv_remove_segs_using_this_lv() for removal of dependent lvs.
|
||||
Improve activation code for better support of stacked devices.
|
||||
Add _add_layer_target_to_dtree() for adding linear layer into dtree.
|
||||
Extend _cached_info() to accept layer string.
|
||||
vgimport '--force' now allows import of VGs with missing PVs.
|
||||
Allow identical table reload for RAID to restore transiently failed PVs.
|
||||
vgimport '--force' now allows users to import VGs with missing PVs.
|
||||
Fix PV alignment to incorporate alignment offset if the PV has zero MDAs.
|
||||
Add global/raid10_segtype_default to lvm.conf.
|
||||
Allow removal or replacement of RAID LV components that are error segments.
|
||||
Allow remove/replace of RAID sub-LVs that are composed of error targets.
|
||||
Make 'vgreduce --removemissing' able to handle RAID LVs with missing PVs.
|
||||
Accept activation/raid_region_size in preference to mirror_region_size config.
|
||||
Rename lvm.conf setting 'mirror_region_size' to 'raid_region_size'.
|
||||
Fix pvs -o pv_free reporting for PVs with zero PE count.
|
||||
Fix missing cleanup of flags when the LV is detached from pool.
|
||||
Fix check for some forbidden discards conversion of thin pools.
|
||||
|
||||
119
WHATS_NEW_DM
119
WHATS_NEW_DM
@@ -1,122 +1,5 @@
|
||||
Version 1.02.91 -
|
||||
====================================
|
||||
Fix dm_is_dm_major to not issue error about missing /proc lines for dm module.
|
||||
|
||||
Version 1.02.90 - 1st September 2014
|
||||
====================================
|
||||
Restore proper buffer size for parsing mountinfo line (1.02.89)
|
||||
|
||||
Version 1.02.89 - 26th August 2014
|
||||
==================================
|
||||
Improve libdevmapper-event select() error handling.
|
||||
Add extra check for matching transation_id after message submitting.
|
||||
Add dm_report_field_string_list_unsorted for str. list report without sorting.
|
||||
Support --deferred with dmsetup remove to defer removal of open devices.
|
||||
Update dm-ioctl.h to include DM_DEFERRED_REMOVE flag.
|
||||
Add support for selection to match string list subset, recognize { } operator.
|
||||
Fix string list selection with '[value]' to not match list that's superset.
|
||||
Fix string list selection to match whole words only, not prefixes.
|
||||
|
||||
Version 1.02.88 - 5th August 2014
|
||||
=================================
|
||||
Add dm_tree_set_optional_uuid_suffixes to handle upgrades.
|
||||
|
||||
Version 1.02.87 - 23rd July 2014
|
||||
================================
|
||||
Fix dm_report_field_string_list to handle delimiter with multiple chars.
|
||||
Add dm_report_field_reserved_value for per-field reserved value definition.
|
||||
|
||||
Version 1.02.86 - 23rd June 2014
|
||||
================================
|
||||
Make "help" and "?" reporting fields implicit.
|
||||
Recognize implicit "selected" field if using dm_report_init_with_selection.
|
||||
Add support for implicit reporting fields which are predefined in libdm.
|
||||
Add DM_REPORT_FIELD_TYPE_PERCENT: separate number and percent fields.
|
||||
Add dm_percent_range_t,dm_percent_to_float,dm_make_percent to libdm for reuse.
|
||||
Add dm_report_reserved_value to libdevmapper for reserved value definition.
|
||||
Also display field types when listing all fields in selection help.
|
||||
Recognize "help" keyword in selection string to show brief help for selection.
|
||||
Always order items reported as string list field lexicographically.
|
||||
Add dm_report_field_string_list to libdevmapper for direct string list report.
|
||||
Add DM_REPORT_FIELD_TYPE_STRING_LIST: separate string and string list fields.
|
||||
Add dm_str_list to libdevmapper for string list type definition and its reuse.
|
||||
Add dmsetup -S/--select to define selection criteria for dmsetup reports.
|
||||
Add dm_report_init_with_selection to intialize report with selection criteria.
|
||||
Add DM_REPORT_FIELD_TYPE_SIZE: separate number and size reporting fields.
|
||||
Use RemoveOnStop for dm-event.socket systemd unit.
|
||||
Document env var 'DM_DEFAULT_NAME_MANGLING_MODE' in dmsetup man page.
|
||||
Warn user about incorrect use of cookie with 'dmsetup remove --force'.
|
||||
Also recognize 'help'/'?' as reserved sort key name to show help.
|
||||
Add dm_units_to_factor for size unit parsing.
|
||||
Increase bitset size for minors for thin dmeventd plugin.
|
||||
|
||||
Version 1.02.85 - 10th April 2014
|
||||
=================================
|
||||
Check for sprintf error when building internal device path.
|
||||
Check for sprintf error when creating path for dm control node.
|
||||
When buffer for dm_get_library_version() is too small, return error code.
|
||||
Always reinitialize _name_mangling_mode in dm_lib_init().
|
||||
Add tracking flag about implicitly added devices into dm_tree.
|
||||
Stop timeout thread immediately when the last worker thread is finished.
|
||||
Fix dmeventd logging with parallel wait event processing.
|
||||
Reuse _node_send_messages() for validation of transaction_id in preload.
|
||||
Transaction_id could be lower by one only when messages are prepared.
|
||||
Do not call callback when preload fails.
|
||||
Wrap is_selinux_enabled() to be called just once.
|
||||
Use correctly signed 64b constant when working with raid volumes.
|
||||
Exit dmeventd with pidfile cleanup instead of raising SIGKILL on DIE request.
|
||||
Add new DM_EVENT_GET_PARAMETERS request to dmeventd protocol.
|
||||
Do not use systemd's reload for dmeventd restart, use dmeventd -R instead.
|
||||
Drop cryptsetup rules from 10-dm.rules - cryptsetup >= 1.1.3 sets them.
|
||||
|
||||
Version 1.02.84 - 20th January 2014
|
||||
Version 1.02.78 -
|
||||
===================================
|
||||
Revert activation of activated nodes if a node preload callback fails.
|
||||
Avoid busy looping on CPU when dmeventd reads event DM_WAIT_RETRY.
|
||||
Ensure global mutex is held when working with dmeventd thread.
|
||||
Drop taking timeout mutex for un/registering dmeventd monitor.
|
||||
Allow section names in config file data to be quoted strings.
|
||||
Close fifos before exiting in dmeventd restart() error path.
|
||||
Move printf format string directly into dm_asprintf args list.
|
||||
Catch invalid use of string sort values when reporting numerical fields.
|
||||
|
||||
Version 1.02.83 - 13th November 2013
|
||||
====================================
|
||||
Consistently report on stderr when device is not found for dmsetup info.
|
||||
Skip race errors when non-udev dmsetup build runs on udev-enabled system.
|
||||
Skip error message when holders are not present in sysfs.
|
||||
Use __linux__ instead of linux define to make libdevmapper.h C compliant.
|
||||
Use mutex to avoid possible race while creating/destroying memory pools.
|
||||
Require libpthread to build now.
|
||||
|
||||
Version 1.02.82 - 4th October 2013
|
||||
==================================
|
||||
Define symbolic names for subsystem udev flags in libdevmapper for easier use.
|
||||
Make subsystem udev rules responsible for importing DM_SUBSYSTEM_UDEV_FLAG*.
|
||||
|
||||
Version 1.02.81 - 23rd September 2013
|
||||
=====================================
|
||||
Tidy dmeventd fifo initialisation.
|
||||
|
||||
Version 1.02.80 - 20th September 2013
|
||||
=====================================
|
||||
Detect invalid sector supplied to 'dmsetup message'.
|
||||
Free any previously-set string if a dm_task_set_* function is called again.
|
||||
Do not allow passing empty new name for dmsetup rename.
|
||||
Display any output returned by 'dmsetup message'.
|
||||
Add dm_task_get_message_response to libdevmapper.
|
||||
|
||||
Version 1.02.79 - 13th August 2013
|
||||
==================================
|
||||
Create dmeventd timeout threads as "detached" so exit status is freed.
|
||||
Add DM_ABORT_ON_INTERNAL_ERRORS env var support to abort on internal errors.
|
||||
|
||||
Version 1.02.78 - 24th July 2013
|
||||
================================
|
||||
Process thin messages once to active thin pool target for dm_tree.
|
||||
Optimize out setting the same value or read_ahead.
|
||||
Add DM_ARRAY_SIZE public macro.
|
||||
Move syslog code out of signal handle in dmeventd.
|
||||
Add DM_TO_STRING public macro.
|
||||
Always return success on dmeventd -V command call.
|
||||
Fix parsing of 64bit snapshot status in dmeventd snapshot plugin.
|
||||
|
||||
59
acinclude.m4
59
acinclude.m4
@@ -1,59 +0,0 @@
|
||||
dnl AC_GCC_VERSION
|
||||
dnl check for compiler version
|
||||
dnl sets COMPILER_VERSION and GCC_VERSION
|
||||
|
||||
AC_DEFUN([AC_CC_VERSION],
|
||||
[
|
||||
AC_MSG_CHECKING([C compiler version])
|
||||
COMPILER_VERSION=`$CC -v 2>&1 | grep version`
|
||||
case "$COMPILER_VERSION" in
|
||||
*gcc*)
|
||||
dnl Ok, how to turn $3 into the real $3
|
||||
GCC_VERSION=`echo $COMPILER_VERSION | \
|
||||
sed -e 's/[[^ ]]*\ [[^ ]]*\ \([[^ ]]*\)\ .*/\1/'` ;;
|
||||
*) GCC_VERSION=unknown ;;
|
||||
esac
|
||||
AC_MSG_RESULT($GCC_VERSION)
|
||||
])
|
||||
|
||||
dnl AC_TRY_CCFLAG([CCFLAG], [VAR], [ACTION-IF-WORKS], [ACTION-IF-FAILS])
|
||||
dnl check if $CC supports a given flag
|
||||
|
||||
AC_DEFUN([AC_TRY_CCFLAG],
|
||||
[
|
||||
AC_REQUIRE([AC_PROG_CC])
|
||||
ac_save_CFLAGS=$CFLAGS
|
||||
CFLAGS=$1
|
||||
AC_CACHE_CHECK([whether $CC accepts $1 flag], [ac_cv_flag_$2],
|
||||
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
|
||||
[AS_VAR_SET([ac_cv_flag_$2], [yes])],
|
||||
[AS_VAR_SET([ac_cv_flag_$2], [no])])])
|
||||
CFLAGS=$ac_save_CFLAGS
|
||||
$2=AS_VAR_GET([ac_cv_flag_$2])
|
||||
if test "$2" = yes; then
|
||||
ifelse([$3], [], [:], [$3])
|
||||
else
|
||||
ifelse([$4], [], [:], [$4])
|
||||
fi
|
||||
])
|
||||
|
||||
dnl AC_TRY_LDFLAGS([LDFLAGS], [VAR], [ACTION-IF-WORKS], [ACTION-IF-FAILS])
|
||||
dnl check if $CC supports given ld flags
|
||||
|
||||
AC_DEFUN([AC_TRY_LDFLAGS],
|
||||
[
|
||||
AC_REQUIRE([AC_PROG_CC])
|
||||
ac_save_LDFLAGS=$LDFLAGS
|
||||
LDFLAGS=$1
|
||||
AC_CACHE_CHECK([whether $CC accepts $1 ld flags], [ac_cv_flag_$2],
|
||||
[AC_LINK_IFELSE([AC_LANG_PROGRAM()],
|
||||
[AS_VAR_SET([ac_cv_flag_$2], [yes])],
|
||||
[AS_VAR_SET([ac_cv_flag_$2], [no])])])
|
||||
LDFLAGS=$ac_save_LDFLAGS
|
||||
$2=AS_VAR_GET([ac_cv_flag_$2])
|
||||
if test "$2" = yes; then
|
||||
ifelse([$3], [], [:], [$3])
|
||||
else
|
||||
ifelse([$4], [], [:], [$4])
|
||||
fi
|
||||
])
|
||||
77
aclocal.m4
vendored
77
aclocal.m4
vendored
@@ -1,7 +1,7 @@
|
||||
# generated automatically by aclocal 1.13.4 -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996-2013 Free Software Foundation, Inc.
|
||||
# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
|
||||
# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
@@ -11,7 +11,6 @@
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
|
||||
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
|
||||
# serial 1 (pkg-config-0.24)
|
||||
#
|
||||
@@ -40,8 +39,7 @@ m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun
|
||||
# ----------------------------------
|
||||
AC_DEFUN([PKG_PROG_PKG_CONFIG],
|
||||
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
|
||||
m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
|
||||
m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
|
||||
m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
|
||||
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
|
||||
AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
|
||||
AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
|
||||
@@ -87,8 +85,7 @@ m4_define([_PKG_CONFIG],
|
||||
pkg_cv_[]$1="$$1"
|
||||
elif test -n "$PKG_CONFIG"; then
|
||||
PKG_CHECK_EXISTS([$3],
|
||||
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
|
||||
test "x$?" != "x0" && pkg_failed=yes ],
|
||||
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
|
||||
[pkg_failed=yes])
|
||||
else
|
||||
pkg_failed=untried
|
||||
@@ -136,9 +133,9 @@ if test $pkg_failed = yes; then
|
||||
AC_MSG_RESULT([no])
|
||||
_PKG_SHORT_ERRORS_SUPPORTED
|
||||
if test $_pkg_short_errors_supported = yes; then
|
||||
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
|
||||
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
|
||||
else
|
||||
$1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
|
||||
$1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
|
||||
fi
|
||||
# Put the nasty error message in config.log where it belongs
|
||||
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
|
||||
@@ -151,7 +148,7 @@ $$1_PKG_ERRORS
|
||||
Consider adjusting the PKG_CONFIG_PATH environment variable if you
|
||||
installed software in a non-standard prefix.
|
||||
|
||||
_PKG_TEXT])[]dnl
|
||||
_PKG_TEXT])
|
||||
])
|
||||
elif test $pkg_failed = untried; then
|
||||
AC_MSG_RESULT([no])
|
||||
@@ -162,7 +159,7 @@ path to pkg-config.
|
||||
|
||||
_PKG_TEXT
|
||||
|
||||
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
|
||||
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])
|
||||
])
|
||||
else
|
||||
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
|
||||
@@ -172,59 +169,3 @@ else
|
||||
fi[]dnl
|
||||
])# PKG_CHECK_MODULES
|
||||
|
||||
|
||||
# PKG_INSTALLDIR(DIRECTORY)
|
||||
# -------------------------
|
||||
# Substitutes the variable pkgconfigdir as the location where a module
|
||||
# should install pkg-config .pc files. By default the directory is
|
||||
# $libdir/pkgconfig, but the default can be changed by passing
|
||||
# DIRECTORY. The user can override through the --with-pkgconfigdir
|
||||
# parameter.
|
||||
AC_DEFUN([PKG_INSTALLDIR],
|
||||
[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
|
||||
m4_pushdef([pkg_description],
|
||||
[pkg-config installation directory @<:@]pkg_default[@:>@])
|
||||
AC_ARG_WITH([pkgconfigdir],
|
||||
[AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
|
||||
[with_pkgconfigdir=]pkg_default)
|
||||
AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
|
||||
m4_popdef([pkg_default])
|
||||
m4_popdef([pkg_description])
|
||||
]) dnl PKG_INSTALLDIR
|
||||
|
||||
|
||||
# PKG_NOARCH_INSTALLDIR(DIRECTORY)
|
||||
# -------------------------
|
||||
# Substitutes the variable noarch_pkgconfigdir as the location where a
|
||||
# module should install arch-independent pkg-config .pc files. By
|
||||
# default the directory is $datadir/pkgconfig, but the default can be
|
||||
# changed by passing DIRECTORY. The user can override through the
|
||||
# --with-noarch-pkgconfigdir parameter.
|
||||
AC_DEFUN([PKG_NOARCH_INSTALLDIR],
|
||||
[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
|
||||
m4_pushdef([pkg_description],
|
||||
[pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
|
||||
AC_ARG_WITH([noarch-pkgconfigdir],
|
||||
[AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
|
||||
[with_noarch_pkgconfigdir=]pkg_default)
|
||||
AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
|
||||
m4_popdef([pkg_default])
|
||||
m4_popdef([pkg_description])
|
||||
]) dnl PKG_NOARCH_INSTALLDIR
|
||||
|
||||
|
||||
# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
|
||||
# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
|
||||
# -------------------------------------------
|
||||
# Retrieves the value of the pkg-config variable for the given module.
|
||||
AC_DEFUN([PKG_CHECK_VAR],
|
||||
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
|
||||
AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
|
||||
|
||||
_PKG_CONFIG([$1], [variable="][$3]["], [$2])
|
||||
AS_VAR_COPY([$1], [pkg_cv_][$1])
|
||||
|
||||
AS_VAR_IF([$1], [""], [$5], [$4])dnl
|
||||
])# PKG_CHECK_VAR
|
||||
|
||||
m4_include([acinclude.m4])
|
||||
|
||||
415
autoconf/config.guess
vendored
415
autoconf/config.guess
vendored
@@ -1,12 +1,14 @@
|
||||
#! /bin/sh
|
||||
# Attempt to guess a canonical system name.
|
||||
# Copyright 1992-2014 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
|
||||
# Free Software Foundation, Inc.
|
||||
|
||||
timestamp='2014-01-01'
|
||||
timestamp='2009-11-20'
|
||||
|
||||
# This file is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
@@ -15,22 +17,26 @@ timestamp='2014-01-01'
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
|
||||
# 02110-1301, USA.
|
||||
#
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that
|
||||
# program. This Exception is an additional permission under section 7
|
||||
# of the GNU General Public License, version 3 ("GPLv3").
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
|
||||
# Originally written by Per Bothner. Please send patches (context
|
||||
# diff format) to <config-patches@gnu.org> and include a ChangeLog
|
||||
# entry.
|
||||
#
|
||||
# Originally written by Per Bothner.
|
||||
# This script attempts to guess a canonical system name similar to
|
||||
# config.sub. If it succeeds, it prints the system name on stdout, and
|
||||
# exits with 0. Otherwise, it exits with 1.
|
||||
#
|
||||
# You can get the latest version of this script from:
|
||||
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
|
||||
#
|
||||
# Please send patches with a ChangeLog entry to config-patches@gnu.org.
|
||||
|
||||
|
||||
me=`echo "$0" | sed -e 's,.*/,,'`
|
||||
|
||||
@@ -50,7 +56,8 @@ version="\
|
||||
GNU config.guess ($timestamp)
|
||||
|
||||
Originally written by Per Bothner.
|
||||
Copyright 1992-2014 Free Software Foundation, Inc.
|
||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
|
||||
2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
||||
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||
@@ -132,33 +139,12 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
|
||||
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
|
||||
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
|
||||
|
||||
case "${UNAME_SYSTEM}" in
|
||||
Linux|GNU|GNU/*)
|
||||
# If the system lacks a compiler, then just pick glibc.
|
||||
# We could probably try harder.
|
||||
LIBC=gnu
|
||||
|
||||
eval $set_cc_for_build
|
||||
cat <<-EOF > $dummy.c
|
||||
#include <features.h>
|
||||
#if defined(__UCLIBC__)
|
||||
LIBC=uclibc
|
||||
#elif defined(__dietlibc__)
|
||||
LIBC=dietlibc
|
||||
#else
|
||||
LIBC=gnu
|
||||
#endif
|
||||
EOF
|
||||
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
|
||||
;;
|
||||
esac
|
||||
|
||||
# Note: order is significant - the case branches are not exclusive.
|
||||
|
||||
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
*:NetBSD:*:*)
|
||||
# NetBSD (nbsd) targets should (where applicable) match one or
|
||||
# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
|
||||
# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
|
||||
# *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
|
||||
# switched to ELF, *-*-netbsd* would select the old
|
||||
# object file format. This provides both forward
|
||||
@@ -194,7 +180,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
os=netbsd
|
||||
os=netbsd
|
||||
;;
|
||||
esac
|
||||
# The OS release
|
||||
@@ -215,10 +201,6 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
|
||||
echo "${machine}-${os}${release}"
|
||||
exit ;;
|
||||
*:Bitrig:*:*)
|
||||
UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
|
||||
echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
|
||||
exit ;;
|
||||
*:OpenBSD:*:*)
|
||||
UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
|
||||
echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
|
||||
@@ -241,7 +223,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
|
||||
;;
|
||||
*5.*)
|
||||
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
|
||||
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
|
||||
;;
|
||||
esac
|
||||
# According to Compaq, /usr/sbin/psrinfo has been available on
|
||||
@@ -287,10 +269,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
# A Xn.n version is an unreleased experimental baselevel.
|
||||
# 1.2 uses "1.2" for uname -r.
|
||||
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
||||
# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
|
||||
exitcode=$?
|
||||
trap '' 0
|
||||
exit $exitcode ;;
|
||||
exit ;;
|
||||
Alpha\ *:Windows_NT*:*)
|
||||
# How do we know it's Interix rather than the generic POSIX subsystem?
|
||||
# Should we change UNAME_MACHINE based on the output of uname instead
|
||||
@@ -316,12 +295,12 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
echo s390-ibm-zvmoe
|
||||
exit ;;
|
||||
*:OS400:*:*)
|
||||
echo powerpc-ibm-os400
|
||||
echo powerpc-ibm-os400
|
||||
exit ;;
|
||||
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
|
||||
echo arm-acorn-riscix${UNAME_RELEASE}
|
||||
exit ;;
|
||||
arm*:riscos:*:*|arm*:RISCOS:*:*)
|
||||
arm:riscos:*:*|arm:RISCOS:*:*)
|
||||
echo arm-unknown-riscos
|
||||
exit ;;
|
||||
SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
|
||||
@@ -415,23 +394,23 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
# MiNT. But MiNT is downward compatible to TOS, so this should
|
||||
# be no problem.
|
||||
atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
|
||||
echo m68k-atari-mint${UNAME_RELEASE}
|
||||
echo m68k-atari-mint${UNAME_RELEASE}
|
||||
exit ;;
|
||||
atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
|
||||
echo m68k-atari-mint${UNAME_RELEASE}
|
||||
exit ;;
|
||||
exit ;;
|
||||
*falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
|
||||
echo m68k-atari-mint${UNAME_RELEASE}
|
||||
echo m68k-atari-mint${UNAME_RELEASE}
|
||||
exit ;;
|
||||
milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
|
||||
echo m68k-milan-mint${UNAME_RELEASE}
|
||||
exit ;;
|
||||
echo m68k-milan-mint${UNAME_RELEASE}
|
||||
exit ;;
|
||||
hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
|
||||
echo m68k-hades-mint${UNAME_RELEASE}
|
||||
exit ;;
|
||||
echo m68k-hades-mint${UNAME_RELEASE}
|
||||
exit ;;
|
||||
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
|
||||
echo m68k-unknown-mint${UNAME_RELEASE}
|
||||
exit ;;
|
||||
echo m68k-unknown-mint${UNAME_RELEASE}
|
||||
exit ;;
|
||||
m68k:machten:*:*)
|
||||
echo m68k-apple-machten${UNAME_RELEASE}
|
||||
exit ;;
|
||||
@@ -501,8 +480,8 @@ EOF
|
||||
echo m88k-motorola-sysv3
|
||||
exit ;;
|
||||
AViiON:dgux:*:*)
|
||||
# DG/UX returns AViiON for all architectures
|
||||
UNAME_PROCESSOR=`/usr/bin/uname -p`
|
||||
# DG/UX returns AViiON for all architectures
|
||||
UNAME_PROCESSOR=`/usr/bin/uname -p`
|
||||
if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
|
||||
then
|
||||
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
|
||||
@@ -515,7 +494,7 @@ EOF
|
||||
else
|
||||
echo i586-dg-dgux${UNAME_RELEASE}
|
||||
fi
|
||||
exit ;;
|
||||
exit ;;
|
||||
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
|
||||
echo m88k-dolphin-sysv3
|
||||
exit ;;
|
||||
@@ -572,7 +551,7 @@ EOF
|
||||
echo rs6000-ibm-aix3.2
|
||||
fi
|
||||
exit ;;
|
||||
*:AIX:*:[4567])
|
||||
*:AIX:*:[456])
|
||||
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
|
||||
if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
|
||||
IBM_ARCH=rs6000
|
||||
@@ -615,52 +594,52 @@ EOF
|
||||
9000/[678][0-9][0-9])
|
||||
if [ -x /usr/bin/getconf ]; then
|
||||
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
|
||||
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
|
||||
case "${sc_cpu_version}" in
|
||||
523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
|
||||
528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
|
||||
532) # CPU_PA_RISC2_0
|
||||
case "${sc_kernel_bits}" in
|
||||
32) HP_ARCH="hppa2.0n" ;;
|
||||
64) HP_ARCH="hppa2.0w" ;;
|
||||
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
|
||||
case "${sc_cpu_version}" in
|
||||
523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
|
||||
528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
|
||||
532) # CPU_PA_RISC2_0
|
||||
case "${sc_kernel_bits}" in
|
||||
32) HP_ARCH="hppa2.0n" ;;
|
||||
64) HP_ARCH="hppa2.0w" ;;
|
||||
'') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
|
||||
esac ;;
|
||||
esac
|
||||
esac ;;
|
||||
esac
|
||||
fi
|
||||
if [ "${HP_ARCH}" = "" ]; then
|
||||
eval $set_cc_for_build
|
||||
sed 's/^ //' << EOF >$dummy.c
|
||||
sed 's/^ //' << EOF >$dummy.c
|
||||
|
||||
#define _HPUX_SOURCE
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#define _HPUX_SOURCE
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main ()
|
||||
{
|
||||
#if defined(_SC_KERNEL_BITS)
|
||||
long bits = sysconf(_SC_KERNEL_BITS);
|
||||
#endif
|
||||
long cpu = sysconf (_SC_CPU_VERSION);
|
||||
int main ()
|
||||
{
|
||||
#if defined(_SC_KERNEL_BITS)
|
||||
long bits = sysconf(_SC_KERNEL_BITS);
|
||||
#endif
|
||||
long cpu = sysconf (_SC_CPU_VERSION);
|
||||
|
||||
switch (cpu)
|
||||
{
|
||||
case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
|
||||
case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
|
||||
case CPU_PA_RISC2_0:
|
||||
#if defined(_SC_KERNEL_BITS)
|
||||
switch (bits)
|
||||
{
|
||||
case 64: puts ("hppa2.0w"); break;
|
||||
case 32: puts ("hppa2.0n"); break;
|
||||
default: puts ("hppa2.0"); break;
|
||||
} break;
|
||||
#else /* !defined(_SC_KERNEL_BITS) */
|
||||
puts ("hppa2.0"); break;
|
||||
#endif
|
||||
default: puts ("hppa1.0"); break;
|
||||
}
|
||||
exit (0);
|
||||
}
|
||||
switch (cpu)
|
||||
{
|
||||
case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
|
||||
case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
|
||||
case CPU_PA_RISC2_0:
|
||||
#if defined(_SC_KERNEL_BITS)
|
||||
switch (bits)
|
||||
{
|
||||
case 64: puts ("hppa2.0w"); break;
|
||||
case 32: puts ("hppa2.0n"); break;
|
||||
default: puts ("hppa2.0"); break;
|
||||
} break;
|
||||
#else /* !defined(_SC_KERNEL_BITS) */
|
||||
puts ("hppa2.0"); break;
|
||||
#endif
|
||||
default: puts ("hppa1.0"); break;
|
||||
}
|
||||
exit (0);
|
||||
}
|
||||
EOF
|
||||
(CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
|
||||
test -z "$HP_ARCH" && HP_ARCH=hppa
|
||||
@@ -751,22 +730,22 @@ EOF
|
||||
exit ;;
|
||||
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
|
||||
echo c1-convex-bsd
|
||||
exit ;;
|
||||
exit ;;
|
||||
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
|
||||
if getsysinfo -f scalar_acc
|
||||
then echo c32-convex-bsd
|
||||
else echo c2-convex-bsd
|
||||
fi
|
||||
exit ;;
|
||||
exit ;;
|
||||
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
|
||||
echo c34-convex-bsd
|
||||
exit ;;
|
||||
exit ;;
|
||||
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
|
||||
echo c38-convex-bsd
|
||||
exit ;;
|
||||
exit ;;
|
||||
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
|
||||
echo c4-convex-bsd
|
||||
exit ;;
|
||||
exit ;;
|
||||
CRAY*Y-MP:*:*:*)
|
||||
echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
|
||||
exit ;;
|
||||
@@ -790,14 +769,14 @@ EOF
|
||||
exit ;;
|
||||
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
|
||||
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
||||
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
|
||||
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
|
||||
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
|
||||
exit ;;
|
||||
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
|
||||
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
|
||||
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
|
||||
exit ;;
|
||||
5000:UNIX_System_V:4.*:*)
|
||||
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
|
||||
FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
|
||||
echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
|
||||
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
|
||||
FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
|
||||
echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
|
||||
exit ;;
|
||||
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
|
||||
@@ -809,35 +788,30 @@ EOF
|
||||
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
|
||||
exit ;;
|
||||
*:FreeBSD:*:*)
|
||||
UNAME_PROCESSOR=`/usr/bin/uname -p`
|
||||
case ${UNAME_PROCESSOR} in
|
||||
case ${UNAME_MACHINE} in
|
||||
pc98)
|
||||
echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
|
||||
amd64)
|
||||
echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
|
||||
*)
|
||||
echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
|
||||
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
|
||||
esac
|
||||
exit ;;
|
||||
i*:CYGWIN*:*)
|
||||
echo ${UNAME_MACHINE}-pc-cygwin
|
||||
exit ;;
|
||||
*:MINGW64*:*)
|
||||
echo ${UNAME_MACHINE}-pc-mingw64
|
||||
exit ;;
|
||||
*:MINGW*:*)
|
||||
echo ${UNAME_MACHINE}-pc-mingw32
|
||||
exit ;;
|
||||
i*:MSYS*:*)
|
||||
echo ${UNAME_MACHINE}-pc-msys
|
||||
exit ;;
|
||||
i*:windows32*:*)
|
||||
# uname -m includes "-pc" on this system.
|
||||
echo ${UNAME_MACHINE}-mingw32
|
||||
# uname -m includes "-pc" on this system.
|
||||
echo ${UNAME_MACHINE}-mingw32
|
||||
exit ;;
|
||||
i*:PW*:*)
|
||||
echo ${UNAME_MACHINE}-pc-pw32
|
||||
exit ;;
|
||||
*:Interix*:*)
|
||||
case ${UNAME_MACHINE} in
|
||||
case ${UNAME_MACHINE} in
|
||||
x86)
|
||||
echo i586-pc-interix${UNAME_RELEASE}
|
||||
exit ;;
|
||||
@@ -874,22 +848,15 @@ EOF
|
||||
exit ;;
|
||||
*:GNU:*:*)
|
||||
# the GNU system
|
||||
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
|
||||
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
|
||||
exit ;;
|
||||
*:GNU/*:*:*)
|
||||
# other systems with GNU libc and userland
|
||||
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
|
||||
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
|
||||
exit ;;
|
||||
i*86:Minix:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-minix
|
||||
exit ;;
|
||||
aarch64:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
aarch64_be:Linux:*:*)
|
||||
UNAME_MACHINE=aarch64_be
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
alpha:Linux:*:*)
|
||||
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
|
||||
EV5) UNAME_MACHINE=alphaev5 ;;
|
||||
@@ -899,56 +866,52 @@ EOF
|
||||
EV6) UNAME_MACHINE=alphaev6 ;;
|
||||
EV67) UNAME_MACHINE=alphaev67 ;;
|
||||
EV68*) UNAME_MACHINE=alphaev68 ;;
|
||||
esac
|
||||
esac
|
||||
objdump --private-headers /bin/sh | grep -q ld.so.1
|
||||
if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
arc:Linux:*:* | arceb:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
|
||||
exit ;;
|
||||
arm*:Linux:*:*)
|
||||
eval $set_cc_for_build
|
||||
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
|
||||
| grep -q __ARM_EABI__
|
||||
then
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
else
|
||||
if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
|
||||
| grep -q __ARM_PCS_VFP
|
||||
then
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
|
||||
else
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
|
||||
fi
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnueabi
|
||||
fi
|
||||
exit ;;
|
||||
avr32*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
cris:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-axis-linux-${LIBC}
|
||||
echo cris-axis-linux-gnu
|
||||
exit ;;
|
||||
crisv32:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-axis-linux-${LIBC}
|
||||
echo crisv32-axis-linux-gnu
|
||||
exit ;;
|
||||
frv:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
hexagon:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
echo frv-unknown-linux-gnu
|
||||
exit ;;
|
||||
i*86:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-linux-${LIBC}
|
||||
LIBC=gnu
|
||||
eval $set_cc_for_build
|
||||
sed 's/^ //' << EOF >$dummy.c
|
||||
#ifdef __dietlibc__
|
||||
LIBC=dietlibc
|
||||
#endif
|
||||
EOF
|
||||
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
|
||||
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
|
||||
exit ;;
|
||||
ia64:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
m32r*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
m68*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
mips:Linux:*:* | mips64:Linux:*:*)
|
||||
eval $set_cc_for_build
|
||||
@@ -967,63 +930,51 @@ EOF
|
||||
#endif
|
||||
EOF
|
||||
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
|
||||
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
|
||||
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
|
||||
;;
|
||||
or1k:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
or32:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
echo or32-unknown-linux-gnu
|
||||
exit ;;
|
||||
padre:Linux:*:*)
|
||||
echo sparc-unknown-linux-${LIBC}
|
||||
echo sparc-unknown-linux-gnu
|
||||
exit ;;
|
||||
parisc64:Linux:*:* | hppa64:Linux:*:*)
|
||||
echo hppa64-unknown-linux-${LIBC}
|
||||
echo hppa64-unknown-linux-gnu
|
||||
exit ;;
|
||||
parisc:Linux:*:* | hppa:Linux:*:*)
|
||||
# Look for CPU level
|
||||
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
|
||||
PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
|
||||
PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
|
||||
*) echo hppa-unknown-linux-${LIBC} ;;
|
||||
PA7*) echo hppa1.1-unknown-linux-gnu ;;
|
||||
PA8*) echo hppa2.0-unknown-linux-gnu ;;
|
||||
*) echo hppa-unknown-linux-gnu ;;
|
||||
esac
|
||||
exit ;;
|
||||
ppc64:Linux:*:*)
|
||||
echo powerpc64-unknown-linux-${LIBC}
|
||||
echo powerpc64-unknown-linux-gnu
|
||||
exit ;;
|
||||
ppc:Linux:*:*)
|
||||
echo powerpc-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
ppc64le:Linux:*:*)
|
||||
echo powerpc64le-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
ppcle:Linux:*:*)
|
||||
echo powerpcle-unknown-linux-${LIBC}
|
||||
echo powerpc-unknown-linux-gnu
|
||||
exit ;;
|
||||
s390:Linux:*:* | s390x:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
|
||||
echo ${UNAME_MACHINE}-ibm-linux
|
||||
exit ;;
|
||||
sh64*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
sh*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
sparc:Linux:*:* | sparc64:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
tile*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
vax:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-dec-linux-${LIBC}
|
||||
echo ${UNAME_MACHINE}-dec-linux-gnu
|
||||
exit ;;
|
||||
x86_64:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
echo x86_64-unknown-linux-gnu
|
||||
exit ;;
|
||||
xtensa*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
exit ;;
|
||||
i*86:DYNIX/ptx:4*:*)
|
||||
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
|
||||
@@ -1032,11 +983,11 @@ EOF
|
||||
echo i386-sequent-sysv4
|
||||
exit ;;
|
||||
i*86:UNIX_SV:4.2MP:2.*)
|
||||
# Unixware is an offshoot of SVR4, but it has its own version
|
||||
# number series starting with 2...
|
||||
# I am not positive that other SVR4 systems won't match this,
|
||||
# Unixware is an offshoot of SVR4, but it has its own version
|
||||
# number series starting with 2...
|
||||
# I am not positive that other SVR4 systems won't match this,
|
||||
# I just have to hope. -- rms.
|
||||
# Use sysv4.2uw... so that sysv4* matches it.
|
||||
# Use sysv4.2uw... so that sysv4* matches it.
|
||||
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
|
||||
exit ;;
|
||||
i*86:OS/2:*:*)
|
||||
@@ -1068,7 +1019,7 @@ EOF
|
||||
fi
|
||||
exit ;;
|
||||
i*86:*:5:[678]*)
|
||||
# UnixWare 7.x, OpenUNIX and OpenServer 6.
|
||||
# UnixWare 7.x, OpenUNIX and OpenServer 6.
|
||||
case `/bin/uname -X | grep "^Machine"` in
|
||||
*486*) UNAME_MACHINE=i486 ;;
|
||||
*Pentium) UNAME_MACHINE=i586 ;;
|
||||
@@ -1096,13 +1047,13 @@ EOF
|
||||
exit ;;
|
||||
pc:*:*:*)
|
||||
# Left here for compatibility:
|
||||
# uname -m prints for DJGPP always 'pc', but it prints nothing about
|
||||
# the processor, so we play safe by assuming i586.
|
||||
# uname -m prints for DJGPP always 'pc', but it prints nothing about
|
||||
# the processor, so we play safe by assuming i586.
|
||||
# Note: whatever this is, it MUST be the same as what config.sub
|
||||
# prints for the "djgpp" host, or else GDB configury will decide that
|
||||
# this is a cross-build.
|
||||
echo i586-pc-msdosdjgpp
|
||||
exit ;;
|
||||
exit ;;
|
||||
Intel:Mach:3*:*)
|
||||
echo i386-pc-mach3
|
||||
exit ;;
|
||||
@@ -1137,8 +1088,8 @@ EOF
|
||||
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
|
||||
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
|
||||
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
|
||||
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
|
||||
&& { echo i486-ncr-sysv4; exit; } ;;
|
||||
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
|
||||
&& { echo i486-ncr-sysv4; exit; } ;;
|
||||
NCR*:*:4.2:* | MPRAS*:*:4.2:*)
|
||||
OS_REL='.3'
|
||||
test -r /etc/.relid \
|
||||
@@ -1181,10 +1132,10 @@ EOF
|
||||
echo ns32k-sni-sysv
|
||||
fi
|
||||
exit ;;
|
||||
PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
|
||||
# says <Richard.M.Bartel@ccMail.Census.GOV>
|
||||
echo i586-unisys-sysv4
|
||||
exit ;;
|
||||
PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
|
||||
# says <Richard.M.Bartel@ccMail.Census.GOV>
|
||||
echo i586-unisys-sysv4
|
||||
exit ;;
|
||||
*:UNIX_System_V:4*:FTX*)
|
||||
# From Gerald Hewes <hewes@openmarket.com>.
|
||||
# How about differentiating between stratus architectures? -djm
|
||||
@@ -1210,11 +1161,11 @@ EOF
|
||||
exit ;;
|
||||
R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
|
||||
if [ -d /usr/nec ]; then
|
||||
echo mips-nec-sysv${UNAME_RELEASE}
|
||||
echo mips-nec-sysv${UNAME_RELEASE}
|
||||
else
|
||||
echo mips-unknown-sysv${UNAME_RELEASE}
|
||||
echo mips-unknown-sysv${UNAME_RELEASE}
|
||||
fi
|
||||
exit ;;
|
||||
exit ;;
|
||||
BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
|
||||
echo powerpc-be-beos
|
||||
exit ;;
|
||||
@@ -1227,9 +1178,6 @@ EOF
|
||||
BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
|
||||
echo i586-pc-haiku
|
||||
exit ;;
|
||||
x86_64:Haiku:*:*)
|
||||
echo x86_64-unknown-haiku
|
||||
exit ;;
|
||||
SX-4:SUPER-UX:*:*)
|
||||
echo sx4-nec-superux${UNAME_RELEASE}
|
||||
exit ;;
|
||||
@@ -1256,31 +1204,19 @@ EOF
|
||||
exit ;;
|
||||
*:Darwin:*:*)
|
||||
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
|
||||
eval $set_cc_for_build
|
||||
if test "$UNAME_PROCESSOR" = unknown ; then
|
||||
UNAME_PROCESSOR=powerpc
|
||||
fi
|
||||
if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
|
||||
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
|
||||
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
|
||||
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
|
||||
grep IS_64BIT_ARCH >/dev/null
|
||||
then
|
||||
case $UNAME_PROCESSOR in
|
||||
i386) UNAME_PROCESSOR=x86_64 ;;
|
||||
powerpc) UNAME_PROCESSOR=powerpc64 ;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
elif test "$UNAME_PROCESSOR" = i386 ; then
|
||||
# Avoid executing cc on OS X 10.9, as it ships with a stub
|
||||
# that puts up a graphical alert prompting to install
|
||||
# developer tools. Any system running Mac OS X 10.7 or
|
||||
# later (Darwin 11 and later) is required to have a 64-bit
|
||||
# processor. This is not true of the ARM version of Darwin
|
||||
# that Apple uses in portable devices.
|
||||
UNAME_PROCESSOR=x86_64
|
||||
fi
|
||||
case $UNAME_PROCESSOR in
|
||||
i386)
|
||||
eval $set_cc_for_build
|
||||
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
|
||||
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
|
||||
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
|
||||
grep IS_64BIT_ARCH >/dev/null
|
||||
then
|
||||
UNAME_PROCESSOR="x86_64"
|
||||
fi
|
||||
fi ;;
|
||||
unknown) UNAME_PROCESSOR=powerpc ;;
|
||||
esac
|
||||
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
|
||||
exit ;;
|
||||
*:procnto*:*:* | *:QNX:[0123456789]*:*)
|
||||
@@ -1294,10 +1230,7 @@ EOF
|
||||
*:QNX:*:4*)
|
||||
echo i386-pc-qnx
|
||||
exit ;;
|
||||
NEO-?:NONSTOP_KERNEL:*:*)
|
||||
echo neo-tandem-nsk${UNAME_RELEASE}
|
||||
exit ;;
|
||||
NSE-*:NONSTOP_KERNEL:*:*)
|
||||
NSE-?:NONSTOP_KERNEL:*:*)
|
||||
echo nse-tandem-nsk${UNAME_RELEASE}
|
||||
exit ;;
|
||||
NSR-?:NONSTOP_KERNEL:*:*)
|
||||
@@ -1342,13 +1275,13 @@ EOF
|
||||
echo pdp10-unknown-its
|
||||
exit ;;
|
||||
SEI:*:*:SEIUX)
|
||||
echo mips-sei-seiux${UNAME_RELEASE}
|
||||
echo mips-sei-seiux${UNAME_RELEASE}
|
||||
exit ;;
|
||||
*:DragonFly:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
|
||||
exit ;;
|
||||
*:*VMS:*:*)
|
||||
UNAME_MACHINE=`(uname -p) 2>/dev/null`
|
||||
UNAME_MACHINE=`(uname -p) 2>/dev/null`
|
||||
case "${UNAME_MACHINE}" in
|
||||
A*) echo alpha-dec-vms ; exit ;;
|
||||
I*) echo ia64-dec-vms ; exit ;;
|
||||
@@ -1366,11 +1299,11 @@ EOF
|
||||
i*86:AROS:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-aros
|
||||
exit ;;
|
||||
x86_64:VMkernel:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-esx
|
||||
exit ;;
|
||||
esac
|
||||
|
||||
#echo '(No uname command or uname output not recognized.)' 1>&2
|
||||
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
|
||||
|
||||
eval $set_cc_for_build
|
||||
cat >$dummy.c <<EOF
|
||||
#ifdef _SEQUENT_
|
||||
@@ -1388,11 +1321,11 @@ main ()
|
||||
#include <sys/param.h>
|
||||
printf ("m68k-sony-newsos%s\n",
|
||||
#ifdef NEWSOS4
|
||||
"4"
|
||||
"4"
|
||||
#else
|
||||
""
|
||||
""
|
||||
#endif
|
||||
); exit (0);
|
||||
); exit (0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
288
autoconf/config.sub
vendored
288
autoconf/config.sub
vendored
@@ -1,31 +1,38 @@
|
||||
#! /bin/sh
|
||||
# Configuration validation subroutine script.
|
||||
# Copyright 1992-2014 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
|
||||
# Free Software Foundation, Inc.
|
||||
|
||||
timestamp='2014-01-01'
|
||||
timestamp='2009-11-20'
|
||||
|
||||
# This file is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# This file is (in principle) common to ALL GNU software.
|
||||
# The presence of a machine in this file suggests that SOME GNU software
|
||||
# can handle that machine. It does not imply ALL GNU software can.
|
||||
#
|
||||
# This file is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program 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
|
||||
# General Public License for more details.
|
||||
# This program 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 General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
|
||||
# 02110-1301, USA.
|
||||
#
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that
|
||||
# program. This Exception is an additional permission under section 7
|
||||
# of the GNU General Public License, version 3 ("GPLv3").
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
|
||||
# Please send patches with a ChangeLog entry to config-patches@gnu.org.
|
||||
# Please send patches to <config-patches@gnu.org>. Submit a context
|
||||
# diff and a properly formatted GNU ChangeLog entry.
|
||||
#
|
||||
# Configuration subroutine to validate and canonicalize a configuration type.
|
||||
# Supply the specified configuration type as an argument.
|
||||
@@ -68,7 +75,8 @@ Report bugs and patches to <config-patches@gnu.org>."
|
||||
version="\
|
||||
GNU config.sub ($timestamp)
|
||||
|
||||
Copyright 1992-2014 Free Software Foundation, Inc.
|
||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
|
||||
2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
||||
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||
@@ -115,18 +123,13 @@ esac
|
||||
# Here we must recognize all the valid KERNEL-OS combinations.
|
||||
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
|
||||
case $maybe_os in
|
||||
nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
|
||||
linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
|
||||
knetbsd*-gnu* | netbsd*-gnu* | \
|
||||
nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
|
||||
uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
|
||||
kopensolaris*-gnu* | \
|
||||
storm-chaos* | os2-emx* | rtmk-nova*)
|
||||
os=-$maybe_os
|
||||
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
|
||||
;;
|
||||
android-linux)
|
||||
os=-linux-android
|
||||
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
|
||||
;;
|
||||
*)
|
||||
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
|
||||
if [ $basic_machine != $1 ]
|
||||
@@ -149,12 +152,12 @@ case $os in
|
||||
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
|
||||
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
|
||||
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
|
||||
-apple | -axis | -knuth | -cray | -microblaze*)
|
||||
-apple | -axis | -knuth | -cray | -microblaze)
|
||||
os=
|
||||
basic_machine=$1
|
||||
;;
|
||||
-bluegene*)
|
||||
os=-cnk
|
||||
-bluegene*)
|
||||
os=-cnk
|
||||
;;
|
||||
-sim | -cisco | -oki | -wec | -winbond)
|
||||
os=
|
||||
@@ -170,10 +173,10 @@ case $os in
|
||||
os=-chorusos
|
||||
basic_machine=$1
|
||||
;;
|
||||
-chorusrdb)
|
||||
os=-chorusrdb
|
||||
-chorusrdb)
|
||||
os=-chorusrdb
|
||||
basic_machine=$1
|
||||
;;
|
||||
;;
|
||||
-hiux*)
|
||||
os=-hiuxwe2
|
||||
;;
|
||||
@@ -218,12 +221,6 @@ case $os in
|
||||
-isc*)
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-lynx*178)
|
||||
os=-lynxos178
|
||||
;;
|
||||
-lynx*5)
|
||||
os=-lynxos5
|
||||
;;
|
||||
-lynx*)
|
||||
os=-lynxos
|
||||
;;
|
||||
@@ -248,28 +245,20 @@ case $basic_machine in
|
||||
# Some are omitted here because they have special meanings below.
|
||||
1750a | 580 \
|
||||
| a29k \
|
||||
| aarch64 | aarch64_be \
|
||||
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
|
||||
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
|
||||
| am33_2.0 \
|
||||
| arc | arceb \
|
||||
| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
|
||||
| avr | avr32 \
|
||||
| be32 | be64 \
|
||||
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
|
||||
| bfin \
|
||||
| c4x | c8051 | clipper \
|
||||
| c4x | clipper \
|
||||
| d10v | d30v | dlx | dsp16xx \
|
||||
| epiphany \
|
||||
| fido | fr30 | frv \
|
||||
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
|
||||
| hexagon \
|
||||
| i370 | i860 | i960 | ia64 \
|
||||
| ip2k | iq2000 \
|
||||
| k1om \
|
||||
| le32 | le64 \
|
||||
| lm32 \
|
||||
| m32c | m32r | m32rle | m68000 | m68k | m88k \
|
||||
| maxq | mb | microblaze | microblazeel | mcore | mep | metag \
|
||||
| maxq | mb | microblaze | mcore | mep | metag \
|
||||
| mips | mipsbe | mipseb | mipsel | mipsle \
|
||||
| mips16 \
|
||||
| mips64 | mips64el \
|
||||
@@ -287,45 +276,34 @@ case $basic_machine in
|
||||
| mipsisa64r2 | mipsisa64r2el \
|
||||
| mipsisa64sb1 | mipsisa64sb1el \
|
||||
| mipsisa64sr71k | mipsisa64sr71kel \
|
||||
| mipsr5900 | mipsr5900el \
|
||||
| mipstx39 | mipstx39el \
|
||||
| mn10200 | mn10300 \
|
||||
| moxie \
|
||||
| mt \
|
||||
| msp430 \
|
||||
| nds32 | nds32le | nds32be \
|
||||
| nios | nios2 | nios2eb | nios2el \
|
||||
| nios | nios2 \
|
||||
| ns16k | ns32k \
|
||||
| open8 \
|
||||
| or1k | or32 \
|
||||
| or32 \
|
||||
| pdp10 | pdp11 | pj | pjl \
|
||||
| powerpc | powerpc64 | powerpc64le | powerpcle \
|
||||
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
|
||||
| pyramid \
|
||||
| rl78 | rx \
|
||||
| rx \
|
||||
| score \
|
||||
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
|
||||
| sh64 | sh64le \
|
||||
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
|
||||
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
|
||||
| spu \
|
||||
| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
|
||||
| spu | strongarm \
|
||||
| tahoe | thumb | tic4x | tic80 | tron \
|
||||
| ubicom32 \
|
||||
| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
|
||||
| v850 | v850e \
|
||||
| we32k \
|
||||
| x86 | xc16x | xstormy16 | xtensa \
|
||||
| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
|
||||
| z8k | z80)
|
||||
basic_machine=$basic_machine-unknown
|
||||
;;
|
||||
c54x)
|
||||
basic_machine=tic54x-unknown
|
||||
;;
|
||||
c55x)
|
||||
basic_machine=tic55x-unknown
|
||||
;;
|
||||
c6x)
|
||||
basic_machine=tic6x-unknown
|
||||
;;
|
||||
m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
|
||||
m6811 | m68hc11 | m6812 | m68hc12 | picochip)
|
||||
# Motorola 68HC11/12.
|
||||
basic_machine=$basic_machine-unknown
|
||||
os=-none
|
||||
;;
|
||||
@@ -335,21 +313,6 @@ case $basic_machine in
|
||||
basic_machine=mt-unknown
|
||||
;;
|
||||
|
||||
strongarm | thumb | xscale)
|
||||
basic_machine=arm-unknown
|
||||
;;
|
||||
xgate)
|
||||
basic_machine=$basic_machine-unknown
|
||||
os=-none
|
||||
;;
|
||||
xscaleeb)
|
||||
basic_machine=armeb-unknown
|
||||
;;
|
||||
|
||||
xscaleel)
|
||||
basic_machine=armel-unknown
|
||||
;;
|
||||
|
||||
# We use `pc' rather than `unknown'
|
||||
# because (1) that's what they normally are, and
|
||||
# (2) the word "unknown" tends to confuse beginning users.
|
||||
@@ -364,31 +327,25 @@ case $basic_machine in
|
||||
# Recognize the basic CPU types with company name.
|
||||
580-* \
|
||||
| a29k-* \
|
||||
| aarch64-* | aarch64_be-* \
|
||||
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
|
||||
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
|
||||
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
|
||||
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
|
||||
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
|
||||
| avr-* | avr32-* \
|
||||
| be32-* | be64-* \
|
||||
| bfin-* | bs2000-* \
|
||||
| c[123]* | c30-* | [cjt]90-* | c4x-* \
|
||||
| c8051-* | clipper-* | craynv-* | cydra-* \
|
||||
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
|
||||
| clipper-* | craynv-* | cydra-* \
|
||||
| d10v-* | d30v-* | dlx-* \
|
||||
| elxsi-* \
|
||||
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
|
||||
| h8300-* | h8500-* \
|
||||
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
|
||||
| hexagon-* \
|
||||
| i*86-* | i860-* | i960-* | ia64-* \
|
||||
| ip2k-* | iq2000-* \
|
||||
| k1om-* \
|
||||
| le32-* | le64-* \
|
||||
| lm32-* \
|
||||
| m32c-* | m32r-* | m32rle-* \
|
||||
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
|
||||
| m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
|
||||
| microblaze-* | microblazeel-* \
|
||||
| m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
|
||||
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
|
||||
| mips16-* \
|
||||
| mips64-* | mips64el-* \
|
||||
@@ -406,34 +363,29 @@ case $basic_machine in
|
||||
| mipsisa64r2-* | mipsisa64r2el-* \
|
||||
| mipsisa64sb1-* | mipsisa64sb1el-* \
|
||||
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
|
||||
| mipsr5900-* | mipsr5900el-* \
|
||||
| mipstx39-* | mipstx39el-* \
|
||||
| mmix-* \
|
||||
| mt-* \
|
||||
| msp430-* \
|
||||
| nds32-* | nds32le-* | nds32be-* \
|
||||
| nios-* | nios2-* | nios2eb-* | nios2el-* \
|
||||
| nios-* | nios2-* \
|
||||
| none-* | np1-* | ns16k-* | ns32k-* \
|
||||
| open8-* \
|
||||
| orion-* \
|
||||
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
|
||||
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
|
||||
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
|
||||
| pyramid-* \
|
||||
| rl78-* | romp-* | rs6000-* | rx-* \
|
||||
| romp-* | rs6000-* | rx-* \
|
||||
| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
|
||||
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
|
||||
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
|
||||
| sparclite-* \
|
||||
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
|
||||
| tahoe-* \
|
||||
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
|
||||
| tile*-* \
|
||||
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
|
||||
| tahoe-* | thumb-* \
|
||||
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
|
||||
| tron-* \
|
||||
| ubicom32-* \
|
||||
| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
|
||||
| vax-* \
|
||||
| v850-* | v850e-* | vax-* \
|
||||
| we32k-* \
|
||||
| x86-* | x86_64-* | xc16x-* | xps100-* \
|
||||
| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
|
||||
| xstormy16-* | xtensa*-* \
|
||||
| ymp-* \
|
||||
| z8k-* | z80-*)
|
||||
@@ -458,7 +410,7 @@ case $basic_machine in
|
||||
basic_machine=a29k-amd
|
||||
os=-udi
|
||||
;;
|
||||
abacus)
|
||||
abacus)
|
||||
basic_machine=abacus-unknown
|
||||
;;
|
||||
adobe68k)
|
||||
@@ -528,20 +480,11 @@ case $basic_machine in
|
||||
basic_machine=powerpc-ibm
|
||||
os=-cnk
|
||||
;;
|
||||
c54x-*)
|
||||
basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
c55x-*)
|
||||
basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
c6x-*)
|
||||
basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
c90)
|
||||
basic_machine=c90-cray
|
||||
os=-unicos
|
||||
;;
|
||||
cegcc)
|
||||
cegcc)
|
||||
basic_machine=arm-unknown
|
||||
os=-cegcc
|
||||
;;
|
||||
@@ -573,7 +516,7 @@ case $basic_machine in
|
||||
basic_machine=craynv-cray
|
||||
os=-unicosmp
|
||||
;;
|
||||
cr16 | cr16-*)
|
||||
cr16)
|
||||
basic_machine=cr16-unknown
|
||||
os=-elf
|
||||
;;
|
||||
@@ -731,6 +674,7 @@ case $basic_machine in
|
||||
i370-ibm* | ibm*)
|
||||
basic_machine=i370-ibm
|
||||
;;
|
||||
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
|
||||
i*86v32)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-sysv32
|
||||
@@ -788,15 +732,11 @@ case $basic_machine in
|
||||
basic_machine=ns32k-utek
|
||||
os=-sysv
|
||||
;;
|
||||
microblaze*)
|
||||
microblaze)
|
||||
basic_machine=microblaze-xilinx
|
||||
;;
|
||||
mingw64)
|
||||
basic_machine=x86_64-pc
|
||||
os=-mingw64
|
||||
;;
|
||||
mingw32)
|
||||
basic_machine=i686-pc
|
||||
basic_machine=i386-pc
|
||||
os=-mingw32
|
||||
;;
|
||||
mingw32ce)
|
||||
@@ -831,18 +771,10 @@ case $basic_machine in
|
||||
ms1-*)
|
||||
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
|
||||
;;
|
||||
msys)
|
||||
basic_machine=i686-pc
|
||||
os=-msys
|
||||
;;
|
||||
mvs)
|
||||
basic_machine=i370-ibm
|
||||
os=-mvs
|
||||
;;
|
||||
nacl)
|
||||
basic_machine=le32-unknown
|
||||
os=-nacl
|
||||
;;
|
||||
ncr3000)
|
||||
basic_machine=i486-ncr
|
||||
os=-sysv4
|
||||
@@ -907,12 +839,6 @@ case $basic_machine in
|
||||
np1)
|
||||
basic_machine=np1-gould
|
||||
;;
|
||||
neo-tandem)
|
||||
basic_machine=neo-tandem
|
||||
;;
|
||||
nse-tandem)
|
||||
basic_machine=nse-tandem
|
||||
;;
|
||||
nsr-tandem)
|
||||
basic_machine=nsr-tandem
|
||||
;;
|
||||
@@ -995,10 +921,9 @@ case $basic_machine in
|
||||
;;
|
||||
power) basic_machine=power-ibm
|
||||
;;
|
||||
ppc | ppcbe) basic_machine=powerpc-unknown
|
||||
ppc) basic_machine=powerpc-unknown
|
||||
;;
|
||||
ppc-* | ppcbe-*)
|
||||
basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
ppcle | powerpclittle | ppc-le | powerpc-little)
|
||||
basic_machine=powerpcle-unknown
|
||||
@@ -1023,11 +948,7 @@ case $basic_machine in
|
||||
basic_machine=i586-unknown
|
||||
os=-pw32
|
||||
;;
|
||||
rdos | rdos64)
|
||||
basic_machine=x86_64-pc
|
||||
os=-rdos
|
||||
;;
|
||||
rdos32)
|
||||
rdos)
|
||||
basic_machine=i386-pc
|
||||
os=-rdos
|
||||
;;
|
||||
@@ -1096,9 +1017,6 @@ case $basic_machine in
|
||||
basic_machine=i860-stratus
|
||||
os=-sysv4
|
||||
;;
|
||||
strongarm-* | thumb-*)
|
||||
basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
sun2)
|
||||
basic_machine=m68000-sun
|
||||
;;
|
||||
@@ -1155,8 +1073,20 @@ case $basic_machine in
|
||||
basic_machine=t90-cray
|
||||
os=-unicos
|
||||
;;
|
||||
tic54x | c54x*)
|
||||
basic_machine=tic54x-unknown
|
||||
os=-coff
|
||||
;;
|
||||
tic55x | c55x*)
|
||||
basic_machine=tic55x-unknown
|
||||
os=-coff
|
||||
;;
|
||||
tic6x | c6x*)
|
||||
basic_machine=tic6x-unknown
|
||||
os=-coff
|
||||
;;
|
||||
tile*)
|
||||
basic_machine=$basic_machine-unknown
|
||||
basic_machine=tile-unknown
|
||||
os=-linux-gnu
|
||||
;;
|
||||
tx39)
|
||||
@@ -1226,9 +1156,6 @@ case $basic_machine in
|
||||
xps | xps100)
|
||||
basic_machine=xps100-honeywell
|
||||
;;
|
||||
xscale-* | xscalee[bl]-*)
|
||||
basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
|
||||
;;
|
||||
ymp)
|
||||
basic_machine=ymp-cray
|
||||
os=-unicos
|
||||
@@ -1326,11 +1253,11 @@ esac
|
||||
if [ x"$os" != x"" ]
|
||||
then
|
||||
case $os in
|
||||
# First match some system type aliases
|
||||
# that might get confused with valid system types.
|
||||
# First match some system type aliases
|
||||
# that might get confused with valid system types.
|
||||
# -solaris* is a basic system type, with this one exception.
|
||||
-auroraux)
|
||||
os=-auroraux
|
||||
-auroraux)
|
||||
os=-auroraux
|
||||
;;
|
||||
-solaris1 | -solaris1.*)
|
||||
os=`echo $os | sed -e 's|solaris1|sunos4|'`
|
||||
@@ -1354,21 +1281,20 @@ case $os in
|
||||
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
|
||||
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
|
||||
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
|
||||
| -sym* | -kopensolaris* | -plan9* \
|
||||
| -sym* | -kopensolaris* \
|
||||
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
|
||||
| -aos* | -aros* \
|
||||
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
|
||||
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
|
||||
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
|
||||
| -bitrig* | -openbsd* | -solidbsd* \
|
||||
| -openbsd* | -solidbsd* \
|
||||
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
|
||||
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
|
||||
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
||||
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
||||
| -chorusos* | -chorusrdb* | -cegcc* \
|
||||
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||
| -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
|
||||
| -linux-newlib* | -linux-musl* | -linux-uclibc* \
|
||||
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||
| -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
|
||||
| -uxpv* | -beos* | -mpeix* | -udk* \
|
||||
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
|
||||
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
|
||||
@@ -1415,7 +1341,7 @@ case $os in
|
||||
-opened*)
|
||||
os=-openedition
|
||||
;;
|
||||
-os400*)
|
||||
-os400*)
|
||||
os=-os400
|
||||
;;
|
||||
-wince*)
|
||||
@@ -1464,7 +1390,7 @@ case $os in
|
||||
-sinix*)
|
||||
os=-sysv4
|
||||
;;
|
||||
-tpf*)
|
||||
-tpf*)
|
||||
os=-tpf
|
||||
;;
|
||||
-triton*)
|
||||
@@ -1500,14 +1426,15 @@ case $os in
|
||||
-aros*)
|
||||
os=-aros
|
||||
;;
|
||||
-kaos*)
|
||||
os=-kaos
|
||||
;;
|
||||
-zvmoe)
|
||||
os=-zvmoe
|
||||
;;
|
||||
-dicos*)
|
||||
os=-dicos
|
||||
;;
|
||||
-nacl*)
|
||||
;;
|
||||
-none)
|
||||
;;
|
||||
*)
|
||||
@@ -1530,10 +1457,10 @@ else
|
||||
# system, and we'll never get to this point.
|
||||
|
||||
case $basic_machine in
|
||||
score-*)
|
||||
score-*)
|
||||
os=-elf
|
||||
;;
|
||||
spu-*)
|
||||
spu-*)
|
||||
os=-elf
|
||||
;;
|
||||
*-acorn)
|
||||
@@ -1545,23 +1472,8 @@ case $basic_machine in
|
||||
arm*-semi)
|
||||
os=-aout
|
||||
;;
|
||||
c4x-* | tic4x-*)
|
||||
os=-coff
|
||||
;;
|
||||
c8051-*)
|
||||
os=-elf
|
||||
;;
|
||||
hexagon-*)
|
||||
os=-elf
|
||||
;;
|
||||
tic54x-*)
|
||||
os=-coff
|
||||
;;
|
||||
tic55x-*)
|
||||
os=-coff
|
||||
;;
|
||||
tic6x-*)
|
||||
os=-coff
|
||||
c4x-* | tic4x-*)
|
||||
os=-coff
|
||||
;;
|
||||
# This must come before the *-dec entry.
|
||||
pdp10-*)
|
||||
@@ -1581,11 +1493,14 @@ case $basic_machine in
|
||||
;;
|
||||
m68000-sun)
|
||||
os=-sunos3
|
||||
# This also exists in the configure program, but was not the
|
||||
# default.
|
||||
# os=-sunos4
|
||||
;;
|
||||
m68*-cisco)
|
||||
os=-aout
|
||||
;;
|
||||
mep-*)
|
||||
mep-*)
|
||||
os=-elf
|
||||
;;
|
||||
mips*-cisco)
|
||||
@@ -1594,9 +1509,6 @@ case $basic_machine in
|
||||
mips*-*)
|
||||
os=-elf
|
||||
;;
|
||||
or1k-*)
|
||||
os=-elf
|
||||
;;
|
||||
or32-*)
|
||||
os=-coff
|
||||
;;
|
||||
@@ -1615,7 +1527,7 @@ case $basic_machine in
|
||||
*-ibm)
|
||||
os=-aix
|
||||
;;
|
||||
*-knuth)
|
||||
*-knuth)
|
||||
os=-mmixware
|
||||
;;
|
||||
*-wec)
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
# This is a command profile template for the LVM2 system.
|
||||
#
|
||||
# It contains all configuration settings that are customizable by command
|
||||
# profiles. To create a new command profile, select the settings you want
|
||||
# to customize and add them in a new file named <profile_name>.profile.
|
||||
# Then install the new profile in a directory as defined by config/profile_dir
|
||||
# setting found in @DEFAULT_SYS_DIR@/lvm.conf file.
|
||||
#
|
||||
# Command profiles can be referenced by using the --commandprofile option then.
|
||||
#
|
||||
# Refer to 'man lvm.conf' for further information about profiles and
|
||||
# general configuration file layout.
|
||||
#
|
||||
global {
|
||||
units="h"
|
||||
si_unit_consistency=1
|
||||
suffix=1
|
||||
lvdisplay_shows_full_device_path=0
|
||||
}
|
||||
report {
|
||||
aligned=1
|
||||
buffered=1
|
||||
headings=1
|
||||
separator=" "
|
||||
list_item_separator=","
|
||||
prefixes=0
|
||||
quoted=1
|
||||
colums_as_rows=0
|
||||
binary_values_as_numeric=0
|
||||
devtypes_sort="devtype_name"
|
||||
devtypes_cols="devtype_name,devtype_max_partitions,devtype_description"
|
||||
devtypes_cols_verbose="devtype_name,devtype_max_partitions,devtype_description"
|
||||
lvs_sort="vg_name,lv_name"
|
||||
lvs_cols="lv_name,vg_name,lv_attr,lv_size,pool_lv,origin,data_percent,metadata_percent,move_pv,mirror_log,copy_percent,convert_lv"
|
||||
lvs_cols_verbose="lv_name,vg_name,seg_count,lv_attr,lv_size,lv_major,lv_minor,lv_kernel_major,lv_kernel_minor,pool_lv,origin,data_percent,metadata_percent,move_pv,copy_percent,mirror_log,convert_lv,lv_uuid,lv_profile"
|
||||
vgs_sort="vg_name"
|
||||
vgs_cols="vg_name,pv_count,lv_count,snap_count,vg_attr,vg_size,vg_free"
|
||||
vgs_cols_verbose="vg_name,vg_attr,vg_extent_size,pv_count,lv_count,snap_count,vg_size,vg_free,vg_uuid,vg_profile"
|
||||
pvs_sort="pv_name"
|
||||
pvs_cols="pv_name,vg_name,pv_fmt,pv_attr,pv_size,pv_free"
|
||||
pvs_cols_verbose="pv_name,vg_name,pv_fmt,pv_attr,pv_size,pv_free,dev_size,pv_uuid"
|
||||
segs_sort="vg_name,lv_name,seg_start"
|
||||
segs_cols="lv_name,vg_name,lv_attr,stripes,segtype,seg_size"
|
||||
segs_cols_verbose="lv_name,vg_name,lv_attr,seg_start,seg_size,stripes,segtype,stripesize,chunksize"
|
||||
pvsegs_sort="pv_name,pvseg_start"
|
||||
pvsegs_cols="pv_name,vg_name,pv_fmt,pv_attr,pv_size,pv_free,pvseg_start,pvseg_size"
|
||||
pvsegs_cols_verbose="pv_name,vg_name,pv_fmt,pv_attr,pv_size,pv_free,pvseg_start,pvseg_size,lv_name,seg_start_pe,segtype,seg_pe_ranges"
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
# This is a metadata profile template for the LVM2 system.
|
||||
#
|
||||
# It contains all configuration settings that are customizable by metadata
|
||||
# profiles. To create a new metadata profile, select the settings you want
|
||||
# to customize and add them in a new file named <profile_name>.profile.
|
||||
# Then install the new profile in a directory as defined by config/profile_dir
|
||||
# setting found in @DEFAULT_SYS_DIR@/lvm.conf file.
|
||||
#
|
||||
# Metadata profiles can be referenced by using the --metadataprofile LVM2
|
||||
# command line option.
|
||||
#
|
||||
# Refer to 'man lvm.conf' for further information about profiles and
|
||||
# general configuration file layout.
|
||||
#
|
||||
allocation {
|
||||
thin_pool_zero=1
|
||||
thin_pool_discards="passdown"
|
||||
thin_pool_chunk_size_policy="generic"
|
||||
# thin_pool_chunk_size=64
|
||||
}
|
||||
activation {
|
||||
thin_pool_autoextend_threshold=100
|
||||
thin_pool_autoextend_percent=20
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
allocation {
|
||||
thin_pool_chunk_size_policy = "generic"
|
||||
thin_pool_zero = 1
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
allocation {
|
||||
thin_pool_chunk_size_policy = "performance"
|
||||
thin_pool_zero = 0
|
||||
}
|
||||
787
configure.in
787
configure.in
File diff suppressed because it is too large
Load Diff
@@ -15,6 +15,10 @@ srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
top_builddir = @top_builddir@
|
||||
|
||||
ifeq ("@BUILD_LVMETAD@", "yes")
|
||||
SUBDIRS += lvmetad
|
||||
endif
|
||||
|
||||
.PHONY: dmeventd clvmd cmirrord lvmetad
|
||||
|
||||
ifneq ("@CLVMD@", "none")
|
||||
@@ -32,10 +36,6 @@ daemons.cflow: dmeventd.cflow
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ("@BUILD_LVMETAD@", "yes")
|
||||
SUBDIRS += lvmetad
|
||||
endif
|
||||
|
||||
ifeq ($(MAKECMDGOALS),distclean)
|
||||
SUBDIRS = clvmd cmirrord dmeventd lvmetad
|
||||
endif
|
||||
|
||||
@@ -87,8 +87,8 @@ include $(top_builddir)/make.tmpl
|
||||
LVMLIBS += -ldevmapper
|
||||
LIBS += $(PTHREAD_LIBS)
|
||||
|
||||
CFLAGS += -fno-strict-aliasing $(EXTRA_EXEC_CFLAGS)
|
||||
LDFLAGS += $(EXTRA_EXEC_LDFLAGS)
|
||||
DEFS += -D_REENTRANT
|
||||
CFLAGS += -fno-strict-aliasing
|
||||
|
||||
INSTALL_TARGETS = \
|
||||
install_clvmd
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#define _CLVM_H
|
||||
|
||||
#include "configure.h"
|
||||
#include <inttypes.h>
|
||||
|
||||
struct clvm_header {
|
||||
uint8_t cmd; /* See below */
|
||||
|
||||
@@ -110,12 +110,12 @@ static void _cluster_init_completed(void)
|
||||
clvmd_cluster_init_completed();
|
||||
}
|
||||
|
||||
static int _get_main_cluster_fd(void)
|
||||
static int _get_main_cluster_fd()
|
||||
{
|
||||
return cman_get_fd(c_handle);
|
||||
}
|
||||
|
||||
static int _get_num_nodes(void)
|
||||
static int _get_num_nodes()
|
||||
{
|
||||
int i;
|
||||
int nnodes = 0;
|
||||
@@ -243,8 +243,9 @@ static void _add_up_node(const char *csid)
|
||||
DEBUGLOG("Added new node %d to updown list\n", nodeid);
|
||||
}
|
||||
|
||||
static void _cluster_closedown(void)
|
||||
static void _cluster_closedown()
|
||||
{
|
||||
destroy_lvhash();
|
||||
dlm_release_lockspace(LOCKSPACE_NAME, lockspace, 1);
|
||||
cman_finish(c_handle);
|
||||
}
|
||||
@@ -282,7 +283,7 @@ static void count_clvmds_running(void)
|
||||
}
|
||||
|
||||
/* Get a list of active cluster members */
|
||||
static void get_members(void)
|
||||
static void get_members()
|
||||
{
|
||||
int retnodes;
|
||||
int status;
|
||||
@@ -380,7 +381,7 @@ static int nodeid_from_csid(const char *csid)
|
||||
return nodeid;
|
||||
}
|
||||
|
||||
static int _is_quorate(void)
|
||||
static int _is_quorate()
|
||||
{
|
||||
return cman_is_quorate(c_handle);
|
||||
}
|
||||
|
||||
@@ -78,6 +78,9 @@ int do_command(struct local_client *client, struct clvm_header *msg, int msglen,
|
||||
unsigned char lock_cmd;
|
||||
unsigned char lock_flags;
|
||||
|
||||
/* Reset test mode before we start */
|
||||
init_test(0);
|
||||
|
||||
/* Do the command */
|
||||
switch (msg->cmd) {
|
||||
/* Just a test message */
|
||||
@@ -109,6 +112,8 @@ int do_command(struct local_client *client, struct clvm_header *msg, int msglen,
|
||||
lockname = &args[2];
|
||||
/* Check to see if the VG is in use by LVM1 */
|
||||
status = do_check_lvm1(lockname);
|
||||
if (lock_flags & LCK_TEST_MODE)
|
||||
init_test(1);
|
||||
do_lock_vg(lock_cmd, lock_flags, lockname);
|
||||
break;
|
||||
|
||||
@@ -117,6 +122,8 @@ int do_command(struct local_client *client, struct clvm_header *msg, int msglen,
|
||||
lock_cmd = args[0];
|
||||
lock_flags = args[1];
|
||||
lockname = &args[2];
|
||||
if (lock_flags & LCK_TEST_MODE)
|
||||
init_test(1);
|
||||
status = do_lock_lv(lock_cmd, lock_flags, lockname);
|
||||
/* Replace EIO with something less scary */
|
||||
if (status == EIO) {
|
||||
@@ -176,58 +183,65 @@ int do_command(struct local_client *client, struct clvm_header *msg, int msglen,
|
||||
}
|
||||
|
||||
return status;
|
||||
|
||||
}
|
||||
|
||||
static int lock_vg(struct local_client *client)
|
||||
{
|
||||
struct dm_hash_table *lock_hash;
|
||||
struct clvm_header *header =
|
||||
(struct clvm_header *) client->bits.localsock.cmd;
|
||||
unsigned char lock_cmd;
|
||||
int lock_mode;
|
||||
char *args = header->node + strlen(header->node) + 1;
|
||||
int lkid;
|
||||
int status;
|
||||
char *lockname;
|
||||
struct dm_hash_table *lock_hash;
|
||||
struct clvm_header *header =
|
||||
(struct clvm_header *) client->bits.localsock.cmd;
|
||||
unsigned char lock_cmd;
|
||||
int lock_mode;
|
||||
char *args = header->node + strlen(header->node) + 1;
|
||||
int lkid;
|
||||
int status = 0;
|
||||
char *lockname;
|
||||
|
||||
/*
|
||||
* Keep a track of VG locks in our own hash table. In current
|
||||
* practice there should only ever be more than two VGs locked
|
||||
* if a user tries to merge lots of them at once
|
||||
*/
|
||||
if (!client->bits.localsock.private) {
|
||||
if (!(lock_hash = dm_hash_create(3)))
|
||||
return ENOMEM;
|
||||
client->bits.localsock.private = (void *) lock_hash;
|
||||
} else
|
||||
lock_hash = (struct dm_hash_table *) client->bits.localsock.private;
|
||||
/* Keep a track of VG locks in our own hash table. In current
|
||||
practice there should only ever be more than two VGs locked
|
||||
if a user tries to merge lots of them at once */
|
||||
if (client->bits.localsock.private) {
|
||||
lock_hash = (struct dm_hash_table *)client->bits.localsock.private;
|
||||
}
|
||||
else {
|
||||
lock_hash = dm_hash_create(3);
|
||||
if (!lock_hash)
|
||||
return ENOMEM;
|
||||
client->bits.localsock.private = (void *)lock_hash;
|
||||
}
|
||||
|
||||
lock_cmd = args[0] & (LCK_NONBLOCK | LCK_HOLD | LCK_SCOPE_MASK | LCK_TYPE_MASK);
|
||||
lock_mode = ((int) lock_cmd & LCK_TYPE_MASK);
|
||||
/* lock_flags = args[1]; */
|
||||
lockname = &args[2];
|
||||
DEBUGLOG("doing PRE command LOCK_VG '%s' at %x (client=%p)\n", lockname, lock_cmd, client);
|
||||
lock_cmd = args[0] & (LCK_NONBLOCK | LCK_HOLD | LCK_SCOPE_MASK | LCK_TYPE_MASK);
|
||||
lock_mode = ((int)lock_cmd & LCK_TYPE_MASK);
|
||||
/* lock_flags = args[1]; */
|
||||
lockname = &args[2];
|
||||
DEBUGLOG("doing PRE command LOCK_VG '%s' at %x (client=%p)\n", lockname, lock_cmd, client);
|
||||
|
||||
if (lock_mode == LCK_UNLOCK) {
|
||||
if (!(lkid = (int) (long) dm_hash_lookup(lock_hash, lockname)))
|
||||
return EINVAL;
|
||||
if (lock_mode == LCK_UNLOCK) {
|
||||
|
||||
if ((status = sync_unlock(lockname, lkid)))
|
||||
status = errno;
|
||||
else
|
||||
dm_hash_remove(lock_hash, lockname);
|
||||
} else {
|
||||
/* Read locks need to be PR; other modes get passed through */
|
||||
if (lock_mode == LCK_READ)
|
||||
lock_mode = LCK_PREAD;
|
||||
lkid = (int)(long)dm_hash_lookup(lock_hash, lockname);
|
||||
if (lkid == 0)
|
||||
return EINVAL;
|
||||
|
||||
if ((status = sync_lock(lockname, lock_mode, (lock_cmd & LCK_NONBLOCK) ? LCKF_NOQUEUE : 0, &lkid)))
|
||||
status = errno;
|
||||
else if (!dm_hash_insert(lock_hash, lockname, (void *) (long) lkid))
|
||||
return ENOMEM;
|
||||
}
|
||||
status = sync_unlock(lockname, lkid);
|
||||
if (status)
|
||||
status = errno;
|
||||
else
|
||||
dm_hash_remove(lock_hash, lockname);
|
||||
}
|
||||
else {
|
||||
/* Read locks need to be PR; other modes get passed through */
|
||||
if (lock_mode == LCK_READ)
|
||||
lock_mode = LCK_PREAD;
|
||||
status = sync_lock(lockname, lock_mode, (lock_cmd & LCK_NONBLOCK) ? LCKF_NOQUEUE : 0, &lkid);
|
||||
if (status)
|
||||
status = errno;
|
||||
else
|
||||
if (!dm_hash_insert(lock_hash, lockname, (void *)(long)lkid))
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
return status;
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
@@ -245,6 +259,7 @@ int do_pre_command(struct local_client *client)
|
||||
int status = 0;
|
||||
char *lockname;
|
||||
|
||||
init_test(0);
|
||||
switch (header->cmd) {
|
||||
case CLVMD_CMD_TEST:
|
||||
status = sync_lock("CLVMD_TEST", LCK_EXCL, 0, &lockid);
|
||||
@@ -263,6 +278,8 @@ int do_pre_command(struct local_client *client)
|
||||
lock_cmd = args[0];
|
||||
lock_flags = args[1];
|
||||
lockname = &args[2];
|
||||
if (lock_flags & LCK_TEST_MODE)
|
||||
init_test(1);
|
||||
status = pre_lock_lv(lock_cmd, lock_flags, lockname);
|
||||
break;
|
||||
|
||||
@@ -294,16 +311,20 @@ int do_post_command(struct local_client *client)
|
||||
char *args = header->node + strlen(header->node) + 1;
|
||||
char *lockname;
|
||||
|
||||
init_test(0);
|
||||
switch (header->cmd) {
|
||||
case CLVMD_CMD_TEST:
|
||||
status = sync_unlock("CLVMD_TEST", (int) (long) client->bits.localsock.private);
|
||||
client->bits.localsock.private = NULL;
|
||||
status =
|
||||
sync_unlock("CLVMD_TEST", (int) (long) client->bits.localsock.private);
|
||||
client->bits.localsock.private = 0;
|
||||
break;
|
||||
|
||||
case CLVMD_CMD_LOCK_LV:
|
||||
lock_cmd = args[0];
|
||||
lock_flags = args[1];
|
||||
lockname = &args[2];
|
||||
if (lock_flags & LCK_TEST_MODE)
|
||||
init_test(1);
|
||||
status = post_lock_lv(lock_cmd, lock_flags, lockname);
|
||||
break;
|
||||
|
||||
@@ -336,7 +357,7 @@ void cmd_client_cleanup(struct local_client *client)
|
||||
}
|
||||
|
||||
dm_hash_destroy(lock_hash);
|
||||
client->bits.localsock.private = NULL;
|
||||
client->bits.localsock.private = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -20,13 +20,14 @@
|
||||
|
||||
#include "configure.h"
|
||||
|
||||
#define _REENTRANT
|
||||
#define _GNU_SOURCE
|
||||
#define _FILE_OFFSET_BITS 64
|
||||
|
||||
#include "libdevmapper.h"
|
||||
|
||||
#include "lvm-logging.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#endif
|
||||
|
||||
@@ -89,7 +89,7 @@ quorum_callbacks_t quorum_callbacks = {
|
||||
|
||||
struct node_info
|
||||
{
|
||||
enum {NODE_DOWN, NODE_CLVMD} state;
|
||||
enum {NODE_UNKNOWN, NODE_DOWN, NODE_UP, NODE_CLVMD} state;
|
||||
int nodeid;
|
||||
};
|
||||
|
||||
@@ -255,6 +255,26 @@ static void corosync_cpg_confchg_callback(cpg_handle_t handle,
|
||||
ninfo->state = NODE_DOWN;
|
||||
}
|
||||
|
||||
for (i=0; i<member_list_entries; i++) {
|
||||
if (member_list[i].nodeid == 0) continue;
|
||||
ninfo = dm_hash_lookup_binary(node_hash,
|
||||
(char *)&member_list[i].nodeid,
|
||||
COROSYNC_CSID_LEN);
|
||||
if (!ninfo) {
|
||||
ninfo = malloc(sizeof(struct node_info));
|
||||
if (!ninfo) {
|
||||
break;
|
||||
}
|
||||
else {
|
||||
ninfo->nodeid = member_list[i].nodeid;
|
||||
dm_hash_insert_binary(node_hash,
|
||||
(char *)&ninfo->nodeid,
|
||||
COROSYNC_CSID_LEN, ninfo);
|
||||
}
|
||||
}
|
||||
ninfo->state = NODE_CLVMD;
|
||||
}
|
||||
|
||||
num_nodes = member_list_entries;
|
||||
}
|
||||
|
||||
@@ -345,6 +365,9 @@ static int _init_cluster(void)
|
||||
|
||||
static void _cluster_closedown(void)
|
||||
{
|
||||
DEBUGLOG("cluster_closedown\n");
|
||||
destroy_lvhash();
|
||||
|
||||
dlm_release_lockspace(LOCKSPACE_NAME, lockspace, 1);
|
||||
cpg_finalize(cpg_handle);
|
||||
quorum_finalize(quorum_handle);
|
||||
@@ -385,7 +408,7 @@ static int _name_from_csid(const char *csid, char *name)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int _get_num_nodes(void)
|
||||
static int _get_num_nodes()
|
||||
{
|
||||
DEBUGLOG("num_nodes = %d\n", num_nodes);
|
||||
return num_nodes;
|
||||
@@ -417,6 +440,7 @@ static int _cluster_do_node_callback(struct local_client *master_client,
|
||||
{
|
||||
struct dm_hash_node *hn;
|
||||
struct node_info *ninfo;
|
||||
int somedown = 0;
|
||||
|
||||
dm_hash_iterate(hn, node_hash)
|
||||
{
|
||||
@@ -428,10 +452,12 @@ static int _cluster_do_node_callback(struct local_client *master_client,
|
||||
DEBUGLOG("down_callback. node %d, state = %d\n", ninfo->nodeid,
|
||||
ninfo->state);
|
||||
|
||||
if (ninfo->state == NODE_CLVMD)
|
||||
callback(master_client, csid, 1);
|
||||
if (ninfo->state != NODE_DOWN)
|
||||
callback(master_client, csid, ninfo->state == NODE_CLVMD);
|
||||
if (ninfo->state != NODE_CLVMD)
|
||||
somedown = -1;
|
||||
}
|
||||
return 0;
|
||||
return somedown;
|
||||
}
|
||||
|
||||
/* Real locking */
|
||||
@@ -502,7 +528,7 @@ static int _unlock_resource(const char *resource, int lockid)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int _is_quorate(void)
|
||||
static int _is_quorate()
|
||||
{
|
||||
int quorate;
|
||||
if (quorum_getquorate(quorum_handle, &quorate) == CS_OK)
|
||||
|
||||
@@ -197,7 +197,9 @@ static int add_internal_client(int fd, fd_callback_t callback)
|
||||
|
||||
DEBUGLOG("Add_internal_client, fd = %d\n", fd);
|
||||
|
||||
if (!(client = dm_zalloc(sizeof(*client)))) {
|
||||
client = calloc(1, sizeof(struct local_client));
|
||||
if (!client)
|
||||
{
|
||||
DEBUGLOG("malloc failed\n");
|
||||
return -1;
|
||||
}
|
||||
@@ -365,6 +367,9 @@ static int _init_cluster(void)
|
||||
|
||||
static void _cluster_closedown(void)
|
||||
{
|
||||
DEBUGLOG("cluster_closedown\n");
|
||||
destroy_lvhash();
|
||||
|
||||
saLckFinalize(lck_handle);
|
||||
cpg_finalize(cpg_handle);
|
||||
}
|
||||
@@ -684,6 +689,6 @@ struct cluster_ops *init_openais_cluster(void)
|
||||
{
|
||||
if (!_init_cluster())
|
||||
return &_cluster_openais_ops;
|
||||
|
||||
return NULL;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2009-2013 Red Hat, Inc. All rights reserved.
|
||||
* Copyright (C) 2009 Red Hat, Inc. All rights reserved.
|
||||
*
|
||||
* This file is part of LVM2.
|
||||
*
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "locking.h"
|
||||
#include "clvm.h"
|
||||
#include "clvmd-comms.h"
|
||||
#include "lvm-functions.h"
|
||||
#include "clvmd.h"
|
||||
|
||||
#include <sys/un.h>
|
||||
@@ -31,14 +32,10 @@ static int listen_fd = -1;
|
||||
static struct dm_hash_table *_locks;
|
||||
static int _lockid;
|
||||
|
||||
static pthread_mutex_t _lock_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
/* Using one common condition for all locks for simplicity */
|
||||
static pthread_cond_t _lock_cond = PTHREAD_COND_INITIALIZER;
|
||||
|
||||
struct lock {
|
||||
struct dm_list list;
|
||||
int lockid;
|
||||
int mode;
|
||||
int excl;
|
||||
};
|
||||
|
||||
static void close_comms(void)
|
||||
@@ -108,7 +105,6 @@ static int _init_cluster(void)
|
||||
r = init_comms();
|
||||
if (r) {
|
||||
dm_hash_destroy(_locks);
|
||||
_locks = NULL;
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -120,13 +116,11 @@ static void _cluster_closedown(void)
|
||||
{
|
||||
close_comms();
|
||||
|
||||
/* If there is any awaited resource, kill it softly */
|
||||
pthread_mutex_lock(&_lock_mutex);
|
||||
DEBUGLOG("cluster_closedown\n");
|
||||
destroy_lvhash();
|
||||
dm_hash_destroy(_locks);
|
||||
_locks = NULL;
|
||||
_lockid = 0;
|
||||
pthread_cond_broadcast(&_lock_cond); /* wakeup waiters */
|
||||
pthread_mutex_unlock(&_lock_mutex);
|
||||
}
|
||||
|
||||
static void _get_our_csid(char *csid)
|
||||
@@ -166,114 +160,63 @@ static int _cluster_do_node_callback(struct local_client *master_client,
|
||||
|
||||
int _lock_file(const char *file, uint32_t flags);
|
||||
|
||||
static const char *_get_mode(int mode)
|
||||
{
|
||||
switch (mode) {
|
||||
case LCK_NULL: return "NULL";
|
||||
case LCK_READ: return "READ";
|
||||
case LCK_PREAD: return "PREAD";
|
||||
case LCK_WRITE: return "WRITE";
|
||||
case LCK_EXCL: return "EXCLUSIVE";
|
||||
case LCK_UNLOCK: return "UNLOCK";
|
||||
default: return "????";
|
||||
}
|
||||
}
|
||||
static pthread_mutex_t _lock_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
/* Using one common condition for all locks for simplicity */
|
||||
static pthread_cond_t _lock_cond = PTHREAD_COND_INITIALIZER;
|
||||
|
||||
/* Real locking */
|
||||
static int _lock_resource(const char *resource, int mode, int flags, int *lockid)
|
||||
{
|
||||
/* DLM table of allowed transition states */
|
||||
static const int _dlm_table[6][6] = {
|
||||
/* Mode NL CR CW PR PW EX */
|
||||
/* NL */ { 1, 1, 1, 1, 1, 1},
|
||||
/* CR */ { 1, 1, 1, 1, 1, 0},
|
||||
/* CW */ { 1, 1, 1, 0, 0, 0},
|
||||
/* PR */ { 1, 1, 0, 1, 0, 0},
|
||||
/* PW */ { 1, 1, 0, 0, 0, 0},
|
||||
/* EX */ { 1, 0, 0, 0, 0, 0}
|
||||
};
|
||||
struct lock *lck;
|
||||
|
||||
struct lock *lck = NULL, *lckt;
|
||||
struct dm_list *head;
|
||||
|
||||
DEBUGLOG("Locking resource %s, flags=0x%02x (%s%s%s), mode=%s (%d)\n",
|
||||
resource, flags,
|
||||
(flags & LCKF_NOQUEUE) ? "NOQUEUE" : "",
|
||||
((flags & (LCKF_NOQUEUE | LCKF_CONVERT)) ==
|
||||
(LCKF_NOQUEUE | LCKF_CONVERT)) ? "|" : "",
|
||||
(flags & LCKF_CONVERT) ? "CONVERT" : "",
|
||||
_get_mode(mode), mode);
|
||||
DEBUGLOG("Locking resource %s, flags=%d, mode=%d\n",
|
||||
resource, flags, mode);
|
||||
|
||||
mode &= LCK_TYPE_MASK;
|
||||
pthread_mutex_lock(&_lock_mutex);
|
||||
|
||||
retry:
|
||||
pthread_cond_broadcast(&_lock_cond); /* to wakeup waiters */
|
||||
|
||||
if (!(head = dm_hash_lookup(_locks, resource))) {
|
||||
if (flags & LCKF_CONVERT) {
|
||||
/* In real DLM, lock is identified only by lockid, resource is not used */
|
||||
DEBUGLOG("Unlocked resource %s cannot be converted\n", resource);
|
||||
goto_bad;
|
||||
}
|
||||
if (!(lck = dm_hash_lookup(_locks, resource))) {
|
||||
/* Add new locked resource */
|
||||
if (!(head = dm_malloc(sizeof(struct dm_list))) ||
|
||||
!dm_hash_insert(_locks, resource, head)) {
|
||||
dm_free(head);
|
||||
goto_bad;
|
||||
}
|
||||
if (!(lck = dm_zalloc(sizeof(struct lock))) ||
|
||||
!dm_hash_insert(_locks, resource, lck))
|
||||
goto bad;
|
||||
|
||||
dm_list_init(head);
|
||||
} else /* Update/convert locked resource */
|
||||
dm_list_iterate_items(lck, head) {
|
||||
/* Check is all locks are compatible with requested lock */
|
||||
if (flags & LCKF_CONVERT) {
|
||||
if (lck->lockid != *lockid)
|
||||
continue;
|
||||
|
||||
DEBUGLOG("Converting resource %s lockid=%d mode:%s -> %s...\n",
|
||||
resource, lck->lockid, _get_mode(lck->mode), _get_mode(mode));
|
||||
dm_list_iterate_items(lckt, head) {
|
||||
if ((lckt->lockid != *lockid) &&
|
||||
!_dlm_table[mode][lckt->mode]) {
|
||||
if (!(flags & LCKF_NOQUEUE) &&
|
||||
/* TODO: Real dlm uses here conversion queues */
|
||||
!pthread_cond_wait(&_lock_cond, &_lock_mutex) &&
|
||||
_locks) /* End of the game? */
|
||||
goto retry;
|
||||
goto bad;
|
||||
}
|
||||
}
|
||||
lck->mode = mode; /* Lock is now converted */
|
||||
goto out;
|
||||
} else if (!_dlm_table[mode][lck->mode]) {
|
||||
DEBUGLOG("Resource %s already locked lockid=%d, mode:%s\n",
|
||||
resource, lck->lockid, _get_mode(lck->mode));
|
||||
if (!(flags & LCKF_NOQUEUE) &&
|
||||
!pthread_cond_wait(&_lock_cond, &_lock_mutex) &&
|
||||
_locks) { /* End of the game? */
|
||||
DEBUGLOG("Resource %s retrying lock in mode:%s...\n",
|
||||
resource, _get_mode(mode));
|
||||
goto retry;
|
||||
}
|
||||
goto bad;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(flags & LCKF_CONVERT)) {
|
||||
if (!(lck = dm_malloc(sizeof(struct lock))))
|
||||
goto_bad;
|
||||
|
||||
*lockid = lck->lockid = ++_lockid;
|
||||
lck->mode = mode;
|
||||
dm_list_add(head, &lck->list);
|
||||
lck->lockid = ++_lockid;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Update/convert lock */
|
||||
if (flags == LCKF_CONVERT) {
|
||||
if (lck->excl)
|
||||
mode = LCK_EXCL;
|
||||
} else if ((lck->mode == LCK_WRITE) || (lck->mode == LCK_EXCL)) {
|
||||
DEBUGLOG("Resource %s already %s locked (%d)...\n", resource,
|
||||
(lck->mode == LCK_WRITE) ? "write" : "exclusively", lck->lockid);
|
||||
goto maybe_retry;
|
||||
} else if (lck->mode > mode) {
|
||||
DEBUGLOG("Resource %s already locked and %s lock requested...\n",
|
||||
resource,
|
||||
(mode == LCK_READ) ? "READ" :
|
||||
(mode == LCK_WRITE) ? "WRITE" : "EXCLUSIVE");
|
||||
goto maybe_retry;
|
||||
}
|
||||
|
||||
out:
|
||||
*lockid = lck->lockid;
|
||||
lck->mode = mode;
|
||||
lck->excl |= (mode == LCK_EXCL);
|
||||
DEBUGLOG("Locked resource %s, lockid=%d, mode=%d\n", resource, lck->lockid, mode);
|
||||
pthread_cond_broadcast(&_lock_cond); /* wakeup waiters */
|
||||
pthread_mutex_unlock(&_lock_mutex);
|
||||
DEBUGLOG("Locked resource %s, lockid=%d, mode=%s\n",
|
||||
resource, lck->lockid, _get_mode(lck->mode));
|
||||
|
||||
return 0;
|
||||
|
||||
maybe_retry:
|
||||
if (!(flags & LCK_NONBLOCK)) {
|
||||
pthread_cond_wait(&_lock_cond, &_lock_mutex);
|
||||
DEBUGLOG("Resource %s RETRYING lock...\n", resource);
|
||||
goto retry;
|
||||
}
|
||||
bad:
|
||||
pthread_mutex_unlock(&_lock_mutex);
|
||||
DEBUGLOG("Failed to lock resource %s\n", resource);
|
||||
@@ -284,44 +227,35 @@ bad:
|
||||
static int _unlock_resource(const char *resource, int lockid)
|
||||
{
|
||||
struct lock *lck;
|
||||
struct dm_list *head;
|
||||
int r = 1;
|
||||
|
||||
if (lockid < 0) {
|
||||
DEBUGLOG("Not tracking unlock of lockid -1: %s, lockid=%d\n",
|
||||
resource, lockid);
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEBUGLOG("Unlocking resource %s, lockid=%d\n", resource, lockid);
|
||||
pthread_mutex_lock(&_lock_mutex);
|
||||
pthread_cond_broadcast(&_lock_cond); /* wakeup waiters */
|
||||
|
||||
if (!(head = dm_hash_lookup(_locks, resource))) {
|
||||
if (!(lck = dm_hash_lookup(_locks, resource))) {
|
||||
pthread_mutex_unlock(&_lock_mutex);
|
||||
DEBUGLOG("Resource %s is not locked.\n", resource);
|
||||
DEBUGLOG("Resource %s, lockid=%d is not locked.\n", resource, lockid);
|
||||
return 1;
|
||||
}
|
||||
|
||||
dm_list_iterate_items(lck, head)
|
||||
if (lck->lockid == lockid) {
|
||||
dm_list_del(&lck->list);
|
||||
dm_free(lck);
|
||||
r = 0;
|
||||
goto out;
|
||||
}
|
||||
|
||||
DEBUGLOG("Resource %s has wrong lockid %d.\n", resource, lockid);
|
||||
out:
|
||||
if (dm_list_empty(head)) {
|
||||
//DEBUGLOG("Resource %s is no longer hashed (lockid=%d).\n", resource, lockid);
|
||||
dm_hash_remove(_locks, resource);
|
||||
dm_free(head);
|
||||
if (lck->lockid != lockid) {
|
||||
pthread_mutex_unlock(&_lock_mutex);
|
||||
DEBUGLOG("Resource %s has wrong lockid %d, expected %d.\n",
|
||||
resource, lck->lockid, lockid);
|
||||
return 1;
|
||||
}
|
||||
|
||||
dm_hash_remove(_locks, resource);
|
||||
pthread_cond_broadcast(&_lock_cond); /* wakeup waiters */
|
||||
pthread_mutex_unlock(&_lock_mutex);
|
||||
dm_free(lck);
|
||||
|
||||
return r;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int _is_quorate(void)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -53,12 +53,13 @@ struct localsock_bits {
|
||||
int finished; /* Flag to tell subthread to exit */
|
||||
int all_success; /* Set to 0 if any node (or the pre_command)
|
||||
failed */
|
||||
int cleanup_needed; /* helper for cleanup_zombie */
|
||||
struct local_client *pipe_client;
|
||||
pthread_t threadid;
|
||||
enum { PRE_COMMAND, POST_COMMAND } state;
|
||||
enum { PRE_COMMAND, POST_COMMAND, QUIT } state;
|
||||
pthread_mutex_t mutex; /* Main thread and worker synchronisation */
|
||||
pthread_cond_t cond;
|
||||
|
||||
pthread_mutex_t reply_mutex; /* Protect reply structure */
|
||||
};
|
||||
|
||||
/* Entries for PIPE clients */
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#include "lvm-types.h"
|
||||
#include "clvm.h"
|
||||
#include "clvmd-comms.h"
|
||||
#include "clvmd.h"
|
||||
@@ -130,15 +131,14 @@ static const char *decode_flags(unsigned char flags)
|
||||
static char buf[128];
|
||||
int len;
|
||||
|
||||
len = sprintf(buf, "0x%x ( %s%s%s%s%s%s%s%s)", flags,
|
||||
len = sprintf(buf, "0x%x ( %s%s%s%s%s%s%s)", flags,
|
||||
flags & LCK_PARTIAL_MODE ? "PARTIAL_MODE|" : "",
|
||||
flags & LCK_MIRROR_NOSYNC_MODE ? "MIRROR_NOSYNC|" : "",
|
||||
flags & LCK_DMEVENTD_MONITOR_MODE ? "DMEVENTD_MONITOR|" : "",
|
||||
flags & LCK_ORIGIN_ONLY_MODE ? "ORIGIN_ONLY|" : "",
|
||||
flags & LCK_TEST_MODE ? "TEST|" : "",
|
||||
flags & LCK_CONVERT ? "CONVERT|" : "",
|
||||
flags & LCK_DMEVENTD_MONITOR_IGNORE ? "DMEVENTD_MONITOR_IGNORE|" : "",
|
||||
flags & LCK_REVERT_MODE ? "REVERT|" : "");
|
||||
flags & LCK_DMEVENTD_MONITOR_IGNORE ? "DMEVENTD_MONITOR_IGNORE|" : "");
|
||||
|
||||
if (len > 1)
|
||||
buf[len - 2] = ' ';
|
||||
@@ -180,19 +180,8 @@ static int insert_info(const char *resource, struct lv_info *lvi)
|
||||
|
||||
static void remove_info(const char *resource)
|
||||
{
|
||||
int num_open;
|
||||
|
||||
pthread_mutex_lock(&lv_hash_lock);
|
||||
dm_hash_remove(lv_hash, resource);
|
||||
|
||||
/* When last lock is remove, validate there are not left opened devices */
|
||||
if (!dm_hash_get_first(lv_hash)) {
|
||||
if (critical_section())
|
||||
log_error(INTERNAL_ERROR "No volumes are locked however clvmd is in activation mode critical section.");
|
||||
if ((num_open = dev_cache_check_for_open_devices()))
|
||||
log_error(INTERNAL_ERROR "No volumes are locked however %d devices are still open.", num_open);
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&lv_hash_lock);
|
||||
}
|
||||
|
||||
@@ -235,7 +224,7 @@ void destroy_lvhash(void)
|
||||
if ((status = sync_unlock(resource, lvi->lock_id)))
|
||||
DEBUGLOG("unlock_all. unlock failed(%d): %s\n",
|
||||
status, strerror(errno));
|
||||
dm_free(lvi);
|
||||
free(lvi);
|
||||
}
|
||||
|
||||
dm_hash_destroy(lv_hash);
|
||||
@@ -251,6 +240,9 @@ static int hold_lock(char *resource, int mode, int flags)
|
||||
int saved_errno;
|
||||
struct lv_info *lvi;
|
||||
|
||||
if (test_mode())
|
||||
return 0;
|
||||
|
||||
/* Mask off invalid options */
|
||||
flags &= LCKF_NOQUEUE | LCKF_CONVERT;
|
||||
|
||||
@@ -264,7 +256,7 @@ static int hold_lock(char *resource, int mode, int flags)
|
||||
}
|
||||
if ((lvi->lock_mode == LCK_EXCL) && (mode == LCK_WRITE)) {
|
||||
DEBUGLOG("hold_lock, lock already held LCK_EXCL, "
|
||||
"ignoring LCK_WRITE request\n");
|
||||
"ignoring LCK_WRITE request");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -276,16 +268,20 @@ static int hold_lock(char *resource, int mode, int flags)
|
||||
}
|
||||
if (lvi) {
|
||||
/* Already exists - convert it */
|
||||
status = sync_lock(resource, mode, flags, &lvi->lock_id);
|
||||
status =
|
||||
sync_lock(resource, mode, flags, &lvi->lock_id);
|
||||
saved_errno = errno;
|
||||
if (!status)
|
||||
lvi->lock_mode = mode;
|
||||
else
|
||||
|
||||
if (status) {
|
||||
DEBUGLOG("hold_lock. convert to %d failed: %s\n", mode,
|
||||
strerror(errno));
|
||||
}
|
||||
errno = saved_errno;
|
||||
} else {
|
||||
if (!(lvi = dm_malloc(sizeof(struct lv_info)))) {
|
||||
lvi = malloc(sizeof(struct lv_info));
|
||||
if (!lvi) {
|
||||
errno = ENOMEM;
|
||||
return -1;
|
||||
}
|
||||
@@ -294,7 +290,7 @@ static int hold_lock(char *resource, int mode, int flags)
|
||||
status = sync_lock(resource, mode, flags & ~LCKF_CONVERT, &lvi->lock_id);
|
||||
saved_errno = errno;
|
||||
if (status) {
|
||||
dm_free(lvi);
|
||||
free(lvi);
|
||||
DEBUGLOG("hold_lock. lock at %d failed: %s\n", mode,
|
||||
strerror(errno));
|
||||
} else
|
||||
@@ -315,6 +311,9 @@ static int hold_unlock(char *resource)
|
||||
int status;
|
||||
int saved_errno;
|
||||
|
||||
if (test_mode())
|
||||
return 0;
|
||||
|
||||
if (!(lvi = lookup_info(resource))) {
|
||||
DEBUGLOG("hold_unlock, lock not already held\n");
|
||||
return 0;
|
||||
@@ -324,7 +323,7 @@ static int hold_unlock(char *resource)
|
||||
saved_errno = errno;
|
||||
if (!status) {
|
||||
remove_info(resource);
|
||||
dm_free(lvi);
|
||||
free(lvi);
|
||||
} else {
|
||||
DEBUGLOG("hold_unlock. unlock failed(%d): %s\n", status,
|
||||
strerror(errno));
|
||||
@@ -374,7 +373,7 @@ static int do_activate_lv(char *resource, unsigned char command, unsigned char l
|
||||
* Use lock conversion only if requested, to prevent implicit conversion
|
||||
* of exclusive lock to shared one during activation.
|
||||
*/
|
||||
if (!test_mode() && command & LCK_CLUSTER_VG) {
|
||||
if (command & LCK_CLUSTER_VG) {
|
||||
status = hold_lock(resource, mode, LCKF_NOQUEUE | (lock_flags & LCK_CONVERT ? LCKF_CONVERT:0));
|
||||
if (status) {
|
||||
/* Return an LVM-sensible error for this.
|
||||
@@ -402,13 +401,13 @@ static int do_activate_lv(char *resource, unsigned char command, unsigned char l
|
||||
}
|
||||
|
||||
/* Now activate it */
|
||||
if (!lv_activate(cmd, resource, exclusive, 0, 0, NULL))
|
||||
if (!lv_activate(cmd, resource, exclusive, NULL))
|
||||
goto error;
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
if (!test_mode() && (oldmode == -1 || oldmode != mode))
|
||||
if (oldmode == -1 || oldmode != mode)
|
||||
(void)hold_unlock(resource);
|
||||
return EIO;
|
||||
}
|
||||
@@ -472,7 +471,7 @@ static int do_deactivate_lv(char *resource, unsigned char command, unsigned char
|
||||
if (!lv_deactivate(cmd, resource, NULL))
|
||||
return EIO;
|
||||
|
||||
if (!test_mode() && command & LCK_CLUSTER_VG) {
|
||||
if (command & LCK_CLUSTER_VG) {
|
||||
status = hold_unlock(resource);
|
||||
if (status)
|
||||
return errno;
|
||||
@@ -484,19 +483,18 @@ static int do_deactivate_lv(char *resource, unsigned char command, unsigned char
|
||||
const char *do_lock_query(char *resource)
|
||||
{
|
||||
int mode;
|
||||
const char *type;
|
||||
const char *type = NULL;
|
||||
|
||||
mode = get_current_lock(resource);
|
||||
switch (mode) {
|
||||
case LCK_NULL: type = "NL"; break;
|
||||
case LCK_READ: type = "CR"; break;
|
||||
case LCK_PREAD:type = "PR"; break;
|
||||
case LCK_WRITE:type = "PW"; break;
|
||||
case LCK_EXCL: type = "EX"; break;
|
||||
default: type = NULL;
|
||||
case LCK_NULL: type = "NL"; break;
|
||||
case LCK_READ: type = "CR"; break;
|
||||
case LCK_PREAD:type = "PR"; break;
|
||||
case LCK_WRITE:type = "PW"; break;
|
||||
case LCK_EXCL: type = "EX"; break;
|
||||
}
|
||||
|
||||
DEBUGLOG("do_lock_query: resource '%s', mode %i (%s)\n", resource, mode, type ?: "--");
|
||||
DEBUGLOG("do_lock_query: resource '%s', mode %i (%s)\n", resource, mode, type ?: "?");
|
||||
|
||||
return type;
|
||||
}
|
||||
@@ -510,7 +508,7 @@ int do_lock_lv(unsigned char command, unsigned char lock_flags, char *resource)
|
||||
DEBUGLOG("do_lock_lv: resource '%s', cmd = %s, flags = %s, critical_section = %d\n",
|
||||
resource, decode_locking_cmd(command), decode_flags(lock_flags), critical_section());
|
||||
|
||||
if (!cmd->config_initialized || config_files_changed(cmd)) {
|
||||
if (!cmd->config_valid || config_files_changed(cmd)) {
|
||||
/* Reinitialise various settings inc. logging, filters */
|
||||
if (do_refresh_cache()) {
|
||||
log_error("Updated config file invalid. Aborting.");
|
||||
@@ -519,8 +517,6 @@ int do_lock_lv(unsigned char command, unsigned char lock_flags, char *resource)
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&lvm_lock);
|
||||
init_test((lock_flags & LCK_TEST_MODE) ? 1 : 0);
|
||||
|
||||
if (lock_flags & LCK_MIRROR_NOSYNC_MODE)
|
||||
init_mirror_in_sync(1);
|
||||
|
||||
@@ -573,7 +569,6 @@ int do_lock_lv(unsigned char command, unsigned char lock_flags, char *resource)
|
||||
|
||||
/* clean the pool for another command */
|
||||
dm_pool_empty(cmd->mem);
|
||||
init_test(0);
|
||||
pthread_mutex_unlock(&lvm_lock);
|
||||
|
||||
DEBUGLOG("Command return is %d, critical_section is %d\n", status, critical_section());
|
||||
@@ -593,8 +588,7 @@ int pre_lock_lv(unsigned char command, unsigned char lock_flags, char *resource)
|
||||
DEBUGLOG("pre_lock_lv: resource '%s', cmd = %s, flags = %s\n",
|
||||
resource, decode_locking_cmd(command), decode_flags(lock_flags));
|
||||
|
||||
if (!(lock_flags & LCK_TEST_MODE) &&
|
||||
hold_lock(resource, LCK_WRITE, LCKF_NOQUEUE | LCKF_CONVERT))
|
||||
if (hold_lock(resource, LCK_WRITE, LCKF_NOQUEUE | LCKF_CONVERT))
|
||||
return errno;
|
||||
}
|
||||
return 0;
|
||||
@@ -612,8 +606,9 @@ int post_lock_lv(unsigned char command, unsigned char lock_flags,
|
||||
(command & LCK_CLUSTER_VG)) {
|
||||
int oldmode;
|
||||
|
||||
DEBUGLOG("post_lock_lv: resource '%s', cmd = %s, flags = %s\n",
|
||||
resource, decode_locking_cmd(command), decode_flags(lock_flags));
|
||||
DEBUGLOG
|
||||
("post_lock_lv: resource '%s', cmd = %s, flags = %s\n",
|
||||
resource, decode_locking_cmd(command), decode_flags(lock_flags));
|
||||
|
||||
/* If the lock state is PW then restore it to what it was */
|
||||
oldmode = get_current_lock(resource);
|
||||
@@ -626,13 +621,11 @@ int post_lock_lv(unsigned char command, unsigned char lock_flags,
|
||||
if (!status)
|
||||
return EIO;
|
||||
|
||||
if (!(lock_flags & LCK_TEST_MODE)) {
|
||||
if (lvi.exists) {
|
||||
if (hold_lock(resource, LCK_READ, LCKF_CONVERT))
|
||||
return errno;
|
||||
} else if (hold_unlock(resource))
|
||||
if (lvi.exists) {
|
||||
if (hold_lock(resource, LCK_READ, LCKF_CONVERT))
|
||||
return errno;
|
||||
}
|
||||
} else if (hold_unlock(resource))
|
||||
return errno;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@@ -696,8 +689,6 @@ void do_lock_vg(unsigned char command, unsigned char lock_flags, char *resource)
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&lvm_lock);
|
||||
init_test((lock_flags & LCK_TEST_MODE) ? 1 : 0);
|
||||
|
||||
switch (lock_cmd) {
|
||||
case LCK_VG_COMMIT:
|
||||
DEBUGLOG("vg_commit notification for VG %s\n", vgname);
|
||||
@@ -712,8 +703,6 @@ void do_lock_vg(unsigned char command, unsigned char lock_flags, char *resource)
|
||||
DEBUGLOG("Invalidating cached metadata for VG %s\n", vgname);
|
||||
lvmcache_drop_metadata(vgname, 0);
|
||||
}
|
||||
|
||||
init_test(0);
|
||||
pthread_mutex_unlock(&lvm_lock);
|
||||
}
|
||||
|
||||
@@ -725,7 +714,7 @@ void do_lock_vg(unsigned char command, unsigned char lock_flags, char *resource)
|
||||
static int get_initial_state(struct dm_hash_table *excl_uuid)
|
||||
{
|
||||
int lock_mode;
|
||||
char lv[65], vg[65], flags[26], vg_flags[26]; /* with space for '\0' */
|
||||
char lv[64], vg[64], flags[25], vg_flags[25];
|
||||
char uuid[65];
|
||||
char line[255];
|
||||
char *lvs_cmd;
|
||||
@@ -814,7 +803,7 @@ static void check_config(void)
|
||||
{
|
||||
int locking_type;
|
||||
|
||||
locking_type = find_config_tree_int(cmd, global_locking_type_CFG, NULL);
|
||||
locking_type = find_config_tree_int(cmd, global_locking_type_CFG);
|
||||
|
||||
if (locking_type == 3) /* compiled-in cluster support */
|
||||
return;
|
||||
@@ -822,7 +811,7 @@ static void check_config(void)
|
||||
if (locking_type == 2) { /* External library, check name */
|
||||
const char *libname;
|
||||
|
||||
libname = find_config_tree_str(cmd, global_locking_library_CFG, NULL);
|
||||
libname = find_config_tree_str(cmd, global_locking_library_CFG);
|
||||
if (libname && strstr(libname, "liblvm2clusterlock.so"))
|
||||
return;
|
||||
|
||||
@@ -927,6 +916,6 @@ void destroy_lvm(void)
|
||||
if (cmd) {
|
||||
memlock_dec_daemon(cmd);
|
||||
destroy_toolcontext(cmd);
|
||||
cmd = NULL;
|
||||
}
|
||||
cmd = NULL;
|
||||
}
|
||||
|
||||
@@ -28,8 +28,7 @@ include $(top_builddir)/make.tmpl
|
||||
|
||||
LIBS += -ldevmapper
|
||||
LMLIBS += $(CPG_LIBS) $(SACKPT_LIBS)
|
||||
CFLAGS += $(CPG_CFLAGS) $(SACKPT_CFLAGS) $(EXTRA_EXEC_CFLAGS)
|
||||
LDFLAGS += $(EXTRA_EXEC_LDFLAGS)
|
||||
CFLAGS += $(CPG_CFLAGS) $(SACKPT_CFLAGS)
|
||||
|
||||
cmirrord: $(OBJECTS) $(top_builddir)/lib/liblvm-internal.a
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJECTS) \
|
||||
|
||||
@@ -202,12 +202,6 @@ static void daemonize(void)
|
||||
(dup2(devnull, 2) < 0)) /* reopen stderr */
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
if ((devnull > STDERR_FILENO) && close(devnull)) {
|
||||
LOG_ERROR("Failed to close descriptor %d: %s",
|
||||
devnull, strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
LOG_OPEN("cmirrord", LOG_PID, LOG_DAEMON);
|
||||
|
||||
(void) dm_prepare_selinux_context(CMIRRORD_PIDFILE, S_IFREG);
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#if CMIRROR_HAS_CHECKPOINT
|
||||
#include <openais/saAis.h>
|
||||
#include <openais/saCkpt.h>
|
||||
#endif
|
||||
|
||||
/* Open AIS error codes */
|
||||
#define str_ais_error(x) \
|
||||
@@ -56,40 +57,6 @@
|
||||
((x) == SA_AIS_ERR_TOO_BIG) ? "SA_AIS_ERR_TOO_BIG" : \
|
||||
((x) == SA_AIS_ERR_NO_SECTIONS) ? "SA_AIS_ERR_NO_SECTIONS" : \
|
||||
"ais_error_unknown"
|
||||
#else
|
||||
#define str_ais_error(x) \
|
||||
((x) == CS_OK) ? "CS_OK" : \
|
||||
((x) == CS_ERR_LIBRARY) ? "CS_ERR_LIBRARY" : \
|
||||
((x) == CS_ERR_VERSION) ? "CS_ERR_VERSION" : \
|
||||
((x) == CS_ERR_INIT) ? "CS_ERR_INIT" : \
|
||||
((x) == CS_ERR_TIMEOUT) ? "CS_ERR_TIMEOUT" : \
|
||||
((x) == CS_ERR_TRY_AGAIN) ? "CS_ERR_TRY_AGAIN" : \
|
||||
((x) == CS_ERR_INVALID_PARAM) ? "CS_ERR_INVALID_PARAM" : \
|
||||
((x) == CS_ERR_NO_MEMORY) ? "CS_ERR_NO_MEMORY" : \
|
||||
((x) == CS_ERR_BAD_HANDLE) ? "CS_ERR_BAD_HANDLE" : \
|
||||
((x) == CS_ERR_BUSY) ? "CS_ERR_BUSY" : \
|
||||
((x) == CS_ERR_ACCESS) ? "CS_ERR_ACCESS" : \
|
||||
((x) == CS_ERR_NOT_EXIST) ? "CS_ERR_NOT_EXIST" : \
|
||||
((x) == CS_ERR_NAME_TOO_LONG) ? "CS_ERR_NAME_TOO_LONG" : \
|
||||
((x) == CS_ERR_EXIST) ? "CS_ERR_EXIST" : \
|
||||
((x) == CS_ERR_NO_SPACE) ? "CS_ERR_NO_SPACE" : \
|
||||
((x) == CS_ERR_INTERRUPT) ? "CS_ERR_INTERRUPT" : \
|
||||
((x) == CS_ERR_NAME_NOT_FOUND) ? "CS_ERR_NAME_NOT_FOUND" : \
|
||||
((x) == CS_ERR_NO_RESOURCES) ? "CS_ERR_NO_RESOURCES" : \
|
||||
((x) == CS_ERR_NOT_SUPPORTED) ? "CS_ERR_NOT_SUPPORTED" : \
|
||||
((x) == CS_ERR_BAD_OPERATION) ? "CS_ERR_BAD_OPERATION" : \
|
||||
((x) == CS_ERR_FAILED_OPERATION) ? "CS_ERR_FAILED_OPERATION" : \
|
||||
((x) == CS_ERR_MESSAGE_ERROR) ? "CS_ERR_MESSAGE_ERROR" : \
|
||||
((x) == CS_ERR_QUEUE_FULL) ? "CS_ERR_QUEUE_FULL" : \
|
||||
((x) == CS_ERR_QUEUE_NOT_AVAILABLE) ? "CS_ERR_QUEUE_NOT_AVAILABLE" : \
|
||||
((x) == CS_ERR_BAD_FLAGS) ? "CS_ERR_BAD_FLAGS" : \
|
||||
((x) == CS_ERR_TOO_BIG) ? "CS_ERR_TOO_BIG" : \
|
||||
((x) == CS_ERR_NO_SECTIONS) ? "CS_ERR_NO_SECTIONS" : \
|
||||
((x) == CS_ERR_CONTEXT_NOT_FOUND) ? "CS_ERR_CONTEXT_NOT_FOUND" : \
|
||||
((x) == CS_ERR_TOO_MANY_GROUPS) ? "CS_ERR_TOO_MANY_GROUPS" : \
|
||||
((x) == CS_ERR_SECURITY) ? "CS_ERR_SECURITY" : \
|
||||
"cs_error_unknown"
|
||||
#endif
|
||||
|
||||
#define _RQ_TYPE(x) \
|
||||
((x) == DM_ULOG_CHECKPOINT_READY) ? "DM_ULOG_CHECKPOINT_READY": \
|
||||
@@ -836,11 +803,6 @@ static int import_checkpoint(struct clog_cpg *entry, int no_read,
|
||||
{
|
||||
int bitmap_size;
|
||||
|
||||
if (no_read) {
|
||||
LOG_DBG("Checkpoint for this log already received");
|
||||
return 0;
|
||||
}
|
||||
|
||||
bitmap_size = (rq->u_rq.data_size - RECOVERING_REGION_SECTION_SIZE) / 2;
|
||||
if (bitmap_size < 0) {
|
||||
LOG_ERROR("Checkpoint has invalid payload size.");
|
||||
@@ -984,16 +946,8 @@ static int do_cluster_work(void *data __attribute__((unused)))
|
||||
|
||||
dm_list_iterate_items_safe(entry, tmp, &clog_cpg_list) {
|
||||
r = cpg_dispatch(entry->handle, CS_DISPATCH_ALL);
|
||||
if (r != CS_OK) {
|
||||
if ((r == CS_ERR_BAD_HANDLE) &&
|
||||
((entry->state == INVALID) ||
|
||||
(entry->state == LEAVING)))
|
||||
/* It's ok if we've left the cluster */
|
||||
r = CS_OK;
|
||||
else
|
||||
LOG_ERROR("cpg_dispatch failed: %s",
|
||||
str_ais_error(r));
|
||||
}
|
||||
if (r != CS_OK)
|
||||
LOG_ERROR("cpg_dispatch failed: %d", r);
|
||||
|
||||
if (entry->free_me) {
|
||||
free(entry);
|
||||
|
||||
@@ -126,14 +126,13 @@ static int v5_endian_to_network(struct clog_request *rq)
|
||||
|
||||
u_rq->error = xlate32(u_rq->error);
|
||||
u_rq->seq = xlate32(u_rq->seq);
|
||||
u_rq->request_type = xlate32(u_rq->request_type);
|
||||
u_rq->data_size = xlate64(u_rq->data_size);
|
||||
|
||||
rq->originator = xlate32(rq->originator);
|
||||
|
||||
v5_data_endian_switch(rq, 1);
|
||||
|
||||
u_rq->request_type = xlate32(u_rq->request_type);
|
||||
u_rq->data_size = xlate32(u_rq->data_size);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
@@ -168,7 +167,7 @@ static int v5_endian_from_network(struct clog_request *rq)
|
||||
u_rq->error = xlate32(u_rq->error);
|
||||
u_rq->seq = xlate32(u_rq->seq);
|
||||
u_rq->request_type = xlate32(u_rq->request_type);
|
||||
u_rq->data_size = xlate32(u_rq->data_size);
|
||||
u_rq->data_size = xlate64(u_rq->data_size);
|
||||
|
||||
rq->originator = xlate32(rq->originator);
|
||||
|
||||
@@ -188,7 +187,7 @@ int clog_request_from_network(void *data, size_t data_len)
|
||||
|
||||
switch (version) {
|
||||
case 5: /* Upstream */
|
||||
if (version == vp[0])
|
||||
if (version == unconverted_version)
|
||||
return 0;
|
||||
break;
|
||||
case 4: /* RHEL 5.[45] */
|
||||
|
||||
@@ -63,7 +63,7 @@ extern int log_resend_requests;
|
||||
#ifdef DEBUG
|
||||
#define LOG_DBG(f, arg...) LOG_OUTPUT(LOG_DEBUG, f, ## arg)
|
||||
#else /* DEBUG */
|
||||
#define LOG_DBG(f, arg...) do {} while (0)
|
||||
#define LOG_DBG(f, arg...)
|
||||
#endif /* DEBUG */
|
||||
|
||||
#define LOG_COND(__X, f, arg...) do {\
|
||||
|
||||
@@ -59,10 +59,8 @@ device-mapper: $(TARGETS)
|
||||
LIBS += -ldevmapper
|
||||
LVMLIBS += -ldevmapper-event $(PTHREAD_LIBS)
|
||||
|
||||
CFLAGS_dmeventd.o += $(EXTRA_EXEC_CFLAGS)
|
||||
|
||||
dmeventd: $(LIB_SHARED) dmeventd.o
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) $(EXTRA_EXEC_LDFLAGS) $(ELDFLAGS) -L. -o $@ dmeventd.o \
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) $(ELDFLAGS) -L. -o $@ dmeventd.o \
|
||||
$(DL_LIBS) $(LVMLIBS) $(LIBS) -rdynamic
|
||||
|
||||
dmeventd.static: $(LIB_STATIC) dmeventd.o $(interfacebuilddir)/libdevmapper.a
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -34,7 +34,6 @@ enum dm_event_command {
|
||||
DM_EVENT_CMD_HELLO,
|
||||
DM_EVENT_CMD_DIE,
|
||||
DM_EVENT_CMD_GET_STATUS,
|
||||
DM_EVENT_CMD_GET_PARAMETERS,
|
||||
};
|
||||
|
||||
/* Message passed between client and daemon. */
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/file.h>
|
||||
@@ -56,7 +57,7 @@ static void _dm_event_handler_clear_dev_info(struct dm_event_handler *dmevh)
|
||||
|
||||
struct dm_event_handler *dm_event_handler_create(void)
|
||||
{
|
||||
struct dm_event_handler *dmevh;
|
||||
struct dm_event_handler *dmevh = NULL;
|
||||
|
||||
if (!(dmevh = dm_zalloc(sizeof(*dmevh)))) {
|
||||
log_error("Failed to allocate event handler.");
|
||||
@@ -81,7 +82,8 @@ int dm_event_handler_set_dmeventd_path(struct dm_event_handler *dmevh, const cha
|
||||
|
||||
dm_free(dmevh->dmeventd_path);
|
||||
|
||||
if (!(dmevh->dmeventd_path = dm_strdup(dmeventd_path)))
|
||||
dmevh->dmeventd_path = dm_strdup(dmeventd_path);
|
||||
if (!dmevh->dmeventd_path)
|
||||
return -ENOMEM;
|
||||
|
||||
return 0;
|
||||
@@ -91,10 +93,10 @@ int dm_event_handler_set_dso(struct dm_event_handler *dmevh, const char *path)
|
||||
{
|
||||
if (!path) /* noop */
|
||||
return 0;
|
||||
|
||||
dm_free(dmevh->dso);
|
||||
|
||||
if (!(dmevh->dso = dm_strdup(path)))
|
||||
dmevh->dso = dm_strdup(path);
|
||||
if (!dmevh->dso)
|
||||
return -ENOMEM;
|
||||
|
||||
return 0;
|
||||
@@ -107,9 +109,9 @@ int dm_event_handler_set_dev_name(struct dm_event_handler *dmevh, const char *de
|
||||
|
||||
_dm_event_handler_clear_dev_info(dmevh);
|
||||
|
||||
if (!(dmevh->dev_name = dm_strdup(dev_name)))
|
||||
dmevh->dev_name = dm_strdup(dev_name);
|
||||
if (!dmevh->dev_name)
|
||||
return -ENOMEM;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -120,9 +122,9 @@ int dm_event_handler_set_uuid(struct dm_event_handler *dmevh, const char *uuid)
|
||||
|
||||
_dm_event_handler_clear_dev_info(dmevh);
|
||||
|
||||
if (!(dmevh->uuid = dm_strdup(uuid)))
|
||||
dmevh->uuid = dm_strdup(uuid);
|
||||
if (!dmevh->uuid)
|
||||
return -ENOMEM;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -222,6 +224,7 @@ static int _daemon_read(struct dm_event_fifos *fifos,
|
||||
unsigned bytes = 0;
|
||||
int ret, i;
|
||||
fd_set fds;
|
||||
struct timeval tval = { 0, 0 };
|
||||
size_t size = 2 * sizeof(uint32_t); /* status + size */
|
||||
uint32_t *header = alloca(size);
|
||||
char *buf = (char *)header;
|
||||
@@ -229,10 +232,11 @@ static int _daemon_read(struct dm_event_fifos *fifos,
|
||||
while (bytes < size) {
|
||||
for (i = 0, ret = 0; (i < 20) && (ret < 1); i++) {
|
||||
/* Watch daemon read FIFO for input. */
|
||||
struct timeval tval = { .tv_sec = 1 };
|
||||
FD_ZERO(&fds);
|
||||
FD_SET(fifos->server, &fds);
|
||||
ret = select(fifos->server + 1, &fds, NULL, NULL, &tval);
|
||||
tval.tv_sec = 1;
|
||||
ret = select(fifos->server + 1, &fds, NULL, NULL,
|
||||
&tval);
|
||||
if (ret < 0 && errno != EINTR) {
|
||||
log_error("Unable to read from event server");
|
||||
return 0;
|
||||
@@ -279,13 +283,15 @@ static int _daemon_read(struct dm_event_fifos *fifos,
|
||||
static int _daemon_write(struct dm_event_fifos *fifos,
|
||||
struct dm_event_daemon_message *msg)
|
||||
{
|
||||
int ret;
|
||||
unsigned bytes = 0;
|
||||
int ret = 0;
|
||||
fd_set fds;
|
||||
size_t bytes = 0;
|
||||
|
||||
size_t size = 2 * sizeof(uint32_t) + msg->size;
|
||||
uint32_t *header = alloca(size);
|
||||
char *buf = (char *)header;
|
||||
char drainbuf[128];
|
||||
struct timeval tval = { 0, 0 };
|
||||
|
||||
header[0] = htonl(msg->cmd);
|
||||
header[1] = htonl(msg->size);
|
||||
@@ -293,25 +299,17 @@ static int _daemon_write(struct dm_event_fifos *fifos,
|
||||
|
||||
/* drain the answer fifo */
|
||||
while (1) {
|
||||
struct timeval tval = { .tv_usec = 100 };
|
||||
FD_ZERO(&fds);
|
||||
FD_SET(fifos->server, &fds);
|
||||
tval.tv_usec = 100;
|
||||
ret = select(fifos->server + 1, &fds, NULL, NULL, &tval);
|
||||
if (ret < 0) {
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
if ((ret < 0) && (errno != EINTR)) {
|
||||
log_error("Unable to talk to event daemon");
|
||||
return 0;
|
||||
}
|
||||
if (ret == 0)
|
||||
break;
|
||||
ret = read(fifos->server, drainbuf, sizeof(drainbuf));
|
||||
if (ret < 0) {
|
||||
if ((errno == EINTR) || (errno == EAGAIN))
|
||||
continue;
|
||||
log_error("Unable to talk to event daemon");
|
||||
return 0;
|
||||
}
|
||||
ret = read(fifos->server, drainbuf, 127);
|
||||
}
|
||||
|
||||
while (bytes < size) {
|
||||
@@ -347,6 +345,9 @@ int daemon_talk(struct dm_event_fifos *fifos,
|
||||
const char *dso_name, const char *dev_name,
|
||||
enum dm_event_mask evmask, uint32_t timeout)
|
||||
{
|
||||
const char *dso = dso_name ? dso_name : "-";
|
||||
const char *dev = dev_name ? dev_name : "-";
|
||||
const char *fmt = "%d:%d %s %s %u %" PRIu32;
|
||||
int msg_size;
|
||||
memset(msg, 0, sizeof(*msg));
|
||||
|
||||
@@ -354,17 +355,14 @@ int daemon_talk(struct dm_event_fifos *fifos,
|
||||
* Set command and pack the arguments
|
||||
* into ASCII message string.
|
||||
*/
|
||||
if ((msg_size =
|
||||
((cmd == DM_EVENT_CMD_HELLO) ?
|
||||
dm_asprintf(&(msg->data), "%d:%d HELLO", getpid(), _sequence_nr) :
|
||||
dm_asprintf(&(msg->data), "%d:%d %s %s %u %" PRIu32,
|
||||
getpid(), _sequence_nr,
|
||||
dso_name ? : "-", dev_name ? : "-", evmask, timeout)))
|
||||
< 0) {
|
||||
msg->cmd = cmd;
|
||||
if (cmd == DM_EVENT_CMD_HELLO)
|
||||
fmt = "%d:%d HELLO";
|
||||
if ((msg_size = dm_asprintf(&(msg->data), fmt, getpid(), _sequence_nr,
|
||||
dso, dev, evmask, timeout)) < 0) {
|
||||
log_error("_daemon_talk: message allocation failed");
|
||||
return -ENOMEM;
|
||||
}
|
||||
msg->cmd = cmd;
|
||||
msg->size = msg_size;
|
||||
|
||||
/*
|
||||
@@ -374,13 +372,14 @@ int daemon_talk(struct dm_event_fifos *fifos,
|
||||
if (!_daemon_write(fifos, msg)) {
|
||||
stack;
|
||||
dm_free(msg->data);
|
||||
msg->data = NULL;
|
||||
msg->data = 0;
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
do {
|
||||
|
||||
dm_free(msg->data);
|
||||
msg->data = NULL;
|
||||
msg->data = 0;
|
||||
|
||||
if (!_daemon_read(fifos, msg)) {
|
||||
stack;
|
||||
@@ -426,7 +425,7 @@ static int _start_daemon(char *dmeventd_path, struct dm_event_fifos *fifos)
|
||||
if (fifos->client >= 0) {
|
||||
/* server is running and listening */
|
||||
if (close(fifos->client))
|
||||
log_sys_debug("close", fifos->client_path);
|
||||
log_sys_error("close", fifos->client_path);
|
||||
return 1;
|
||||
} else if (errno != ENXIO) {
|
||||
/* problem */
|
||||
@@ -469,6 +468,10 @@ int init_fifos(struct dm_event_fifos *fifos)
|
||||
/* FIXME? Is fifo the most suitable method? Why not share
|
||||
comms/daemon code with something else e.g. multipath? */
|
||||
|
||||
/* FIXME Make these either configurable or depend directly on dmeventd_path */
|
||||
fifos->client_path = DM_EVENT_FIFO_CLIENT;
|
||||
fifos->server_path = DM_EVENT_FIFO_SERVER;
|
||||
|
||||
/* Open the fifo used to read from the daemon. */
|
||||
if ((fifos->server = open(fifos->server_path, O_RDWR)) < 0) {
|
||||
log_sys_error("open", fifos->server_path);
|
||||
@@ -478,27 +481,32 @@ int init_fifos(struct dm_event_fifos *fifos)
|
||||
/* Lock out anyone else trying to do communication with the daemon. */
|
||||
if (flock(fifos->server, LOCK_EX) < 0) {
|
||||
log_sys_error("flock", fifos->server_path);
|
||||
goto bad;
|
||||
if (close(fifos->server))
|
||||
log_sys_error("close", fifos->server_path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* if ((fifos->client = open(fifos->client_path, O_WRONLY | O_NONBLOCK)) < 0) {*/
|
||||
if ((fifos->client = open(fifos->client_path, O_RDWR | O_NONBLOCK)) < 0) {
|
||||
log_sys_error("open", fifos->client_path);
|
||||
goto bad;
|
||||
if (close(fifos->server))
|
||||
log_sys_error("close", fifos->server_path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
bad:
|
||||
if (close(fifos->server))
|
||||
log_sys_debug("close", fifos->server_path);
|
||||
fifos->server = -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Initialize client. */
|
||||
static int _init_client(char *dmeventd_path, struct dm_event_fifos *fifos)
|
||||
{
|
||||
/* init fifos */
|
||||
memset(fifos, 0, sizeof(*fifos));
|
||||
|
||||
/* FIXME Make these either configurable or depend directly on dmeventd_path */
|
||||
fifos->client_path = DM_EVENT_FIFO_CLIENT;
|
||||
fifos->server_path = DM_EVENT_FIFO_SERVER;
|
||||
|
||||
if (!_start_daemon(dmeventd_path, fifos))
|
||||
return_0;
|
||||
|
||||
@@ -507,16 +515,13 @@ static int _init_client(char *dmeventd_path, struct dm_event_fifos *fifos)
|
||||
|
||||
void fini_fifos(struct dm_event_fifos *fifos)
|
||||
{
|
||||
if (fifos->client >= 0 && close(fifos->client))
|
||||
log_sys_debug("close", fifos->client_path);
|
||||
if (flock(fifos->server, LOCK_UN))
|
||||
log_error("flock unlock %s", fifos->server_path);
|
||||
|
||||
if (fifos->server >= 0) {
|
||||
if (flock(fifos->server, LOCK_UN))
|
||||
log_sys_debug("flock unlock", fifos->server_path);
|
||||
|
||||
if (close(fifos->server))
|
||||
log_sys_debug("close", fifos->server_path);
|
||||
}
|
||||
if (close(fifos->client))
|
||||
log_sys_error("close", fifos->client_path);
|
||||
if (close(fifos->server))
|
||||
log_sys_error("close", fifos->server_path);
|
||||
}
|
||||
|
||||
/* Get uuid of a device */
|
||||
@@ -555,8 +560,8 @@ static struct dm_task *_get_device_info(const struct dm_event_handler *dmevh)
|
||||
|
||||
if (!info.exists) {
|
||||
log_error("_get_device_info: %s%s%s%.0d%s%.0d%s%s: device not found",
|
||||
dmevh->uuid ? : "",
|
||||
(!dmevh->uuid && dmevh->dev_name) ? dmevh->dev_name : "",
|
||||
dmevh->uuid ? : "",
|
||||
(!dmevh->uuid && dmevh->dev_name) ? dmevh->dev_name : "",
|
||||
(!dmevh->uuid && !dmevh->dev_name && dmevh->major > 0) ? "(" : "",
|
||||
(!dmevh->uuid && !dmevh->dev_name && dmevh->major > 0) ? dmevh->major : 0,
|
||||
(!dmevh->uuid && !dmevh->dev_name && dmevh->major > 0) ? ":" : "",
|
||||
@@ -566,6 +571,7 @@ static struct dm_task *_get_device_info(const struct dm_event_handler *dmevh)
|
||||
goto bad;
|
||||
}
|
||||
|
||||
|
||||
return dmt;
|
||||
|
||||
bad:
|
||||
@@ -579,13 +585,7 @@ static int _do_event(int cmd, char *dmeventd_path, struct dm_event_daemon_messag
|
||||
enum dm_event_mask evmask, uint32_t timeout)
|
||||
{
|
||||
int ret;
|
||||
struct dm_event_fifos fifos = {
|
||||
.server = -1,
|
||||
.client = -1,
|
||||
/* FIXME Make these either configurable or depend directly on dmeventd_path */
|
||||
.client_path = DM_EVENT_FIFO_CLIENT,
|
||||
.server_path = DM_EVENT_FIFO_SERVER
|
||||
};
|
||||
struct dm_event_fifos fifos;
|
||||
|
||||
if (!_init_client(dmeventd_path, &fifos)) {
|
||||
stack;
|
||||
@@ -612,20 +612,15 @@ int dm_event_register_handler(const struct dm_event_handler *dmevh)
|
||||
int ret = 1, err;
|
||||
const char *uuid;
|
||||
struct dm_task *dmt;
|
||||
struct dm_event_daemon_message msg = { 0 };
|
||||
struct dm_event_daemon_message msg = { 0, 0, NULL };
|
||||
|
||||
if (!(dmt = _get_device_info(dmevh)))
|
||||
return_0;
|
||||
if (!(dmt = _get_device_info(dmevh))) {
|
||||
stack;
|
||||
return 0;
|
||||
}
|
||||
|
||||
uuid = dm_task_get_uuid(dmt);
|
||||
|
||||
if (!strstr(dmevh->dso, "libdevmapper-event-lvm2thin.so") &&
|
||||
!strstr(dmevh->dso, "libdevmapper-event-lvm2snapshot.so") &&
|
||||
!strstr(dmevh->dso, "libdevmapper-event-lvm2mirror.so") &&
|
||||
!strstr(dmevh->dso, "libdevmapper-event-lvm2raid.so"))
|
||||
log_warn("WARNING: %s: dmeventd plugins are deprecated", dmevh->dso);
|
||||
|
||||
|
||||
if ((err = _do_event(DM_EVENT_CMD_REGISTER_FOR_EVENT, dmevh->dmeventd_path, &msg,
|
||||
dmevh->dso, uuid, dmevh->mask, dmevh->timeout)) < 0) {
|
||||
log_error("%s: event registration failed: %s",
|
||||
@@ -646,10 +641,12 @@ int dm_event_unregister_handler(const struct dm_event_handler *dmevh)
|
||||
int ret = 1, err;
|
||||
const char *uuid;
|
||||
struct dm_task *dmt;
|
||||
struct dm_event_daemon_message msg = { 0 };
|
||||
struct dm_event_daemon_message msg = { 0, 0, NULL };
|
||||
|
||||
if (!(dmt = _get_device_info(dmevh)))
|
||||
return_0;
|
||||
if (!(dmt = _get_device_info(dmevh))) {
|
||||
stack;
|
||||
return 0;
|
||||
}
|
||||
|
||||
uuid = dm_task_get_uuid(dmt);
|
||||
|
||||
@@ -690,18 +687,20 @@ static char *_fetch_string(char **src, const int delimiter)
|
||||
static int _parse_message(struct dm_event_daemon_message *msg, char **dso_name,
|
||||
char **uuid, enum dm_event_mask *evmask)
|
||||
{
|
||||
char *id;
|
||||
char *id = NULL;
|
||||
char *p = msg->data;
|
||||
|
||||
if ((id = _fetch_string(&p, ' ')) &&
|
||||
(*dso_name = _fetch_string(&p, ' ')) &&
|
||||
(*uuid = _fetch_string(&p, ' '))) {
|
||||
*evmask = atoi(p);
|
||||
|
||||
dm_free(id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
dm_free(id);
|
||||
if (id)
|
||||
dm_free(id);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@@ -751,8 +750,8 @@ int dm_event_get_registered_device(struct dm_event_handler *dmevh, int next)
|
||||
ret = -ENXIO; /* dmeventd probably gave us bogus uuid back */
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!(dmevh->uuid = dm_strdup(reply_uuid))) {
|
||||
dmevh->uuid = dm_strdup(reply_uuid);
|
||||
if (!dmevh->uuid) {
|
||||
ret = -ENOMEM;
|
||||
goto fail;
|
||||
}
|
||||
@@ -771,7 +770,8 @@ int dm_event_get_registered_device(struct dm_event_handler *dmevh, int next)
|
||||
dm_free(reply_uuid);
|
||||
reply_uuid = NULL;
|
||||
|
||||
if (!(dmevh->dev_name = dm_strdup(dm_task_get_name(dmt)))) {
|
||||
dmevh->dev_name = dm_strdup(dm_task_get_name(dmt));
|
||||
if (!dmevh->dev_name) {
|
||||
ret = -ENOMEM;
|
||||
goto fail;
|
||||
}
|
||||
@@ -811,7 +811,7 @@ int dm_event_get_registered_device(struct dm_event_handler *dmevh, int next)
|
||||
|
||||
int dm_event_get_version(struct dm_event_fifos *fifos, int *version) {
|
||||
char *p;
|
||||
struct dm_event_daemon_message msg = { 0 };
|
||||
struct dm_event_daemon_message msg = { 0, 0, NULL };
|
||||
|
||||
if (daemon_talk(fifos, &msg, DM_EVENT_CMD_HELLO, NULL, NULL, 0, 0))
|
||||
return 0;
|
||||
@@ -840,7 +840,7 @@ static char *_skip_string(char *src, const int delimiter)
|
||||
|
||||
int dm_event_set_timeout(const char *device_path, uint32_t timeout)
|
||||
{
|
||||
struct dm_event_daemon_message msg = { 0 };
|
||||
struct dm_event_daemon_message msg = { 0, 0, NULL };
|
||||
|
||||
if (!device_exists(device_path))
|
||||
return -ENODEV;
|
||||
@@ -852,24 +852,22 @@ int dm_event_set_timeout(const char *device_path, uint32_t timeout)
|
||||
int dm_event_get_timeout(const char *device_path, uint32_t *timeout)
|
||||
{
|
||||
int ret;
|
||||
struct dm_event_daemon_message msg = { 0 };
|
||||
struct dm_event_daemon_message msg = { 0, 0, NULL };
|
||||
|
||||
if (!device_exists(device_path))
|
||||
return -ENODEV;
|
||||
|
||||
if (!(ret = _do_event(DM_EVENT_CMD_GET_TIMEOUT, &msg, NULL, device_path,
|
||||
0, 0))) {
|
||||
char *p = _skip_string(msg.data, ' ');
|
||||
if (!p) {
|
||||
log_error("malformed reply from dmeventd '%s'\n",
|
||||
msg.data);
|
||||
dm_free(msg.data);
|
||||
return -EIO;
|
||||
}
|
||||
*timeout = atoi(p);
|
||||
}
|
||||
dm_free(msg.data);
|
||||
|
||||
if (msg.data)
|
||||
dm_free(msg.data);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -46,9 +46,8 @@ enum dm_event_mask {
|
||||
};
|
||||
|
||||
#define DM_EVENT_ALL_ERRORS DM_EVENT_ERROR_MASK
|
||||
#define DM_EVENT_PROTOCOL_VERSION 2
|
||||
#define DM_EVENT_PROTOCOL_VERSION 1
|
||||
|
||||
struct dm_task;
|
||||
struct dm_event_handler;
|
||||
|
||||
struct dm_event_handler *dm_event_handler_create(void);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (C) 2010-2014 Red Hat, Inc. All rights reserved.
|
||||
# Copyright (C) 2010-2011 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
# This file is part of LVM2.
|
||||
#
|
||||
@@ -24,7 +24,7 @@ LIB_VERSION = $(LIB_VERSION_LVM)
|
||||
|
||||
include $(top_builddir)/make.tmpl
|
||||
|
||||
LIBS += @LVM2CMD_LIB@ -ldevmapper $(PTHREAD_LIBS)
|
||||
LIBS += @LVM2CMD_LIB@ -ldevmapper $(PTHREAD_LIBS) $(DAEMON_LIBS)
|
||||
|
||||
install_lvm2: install_lib_shared
|
||||
|
||||
|
||||
@@ -143,7 +143,7 @@ struct dm_pool *dmeventd_lvm2_pool(void)
|
||||
|
||||
int dmeventd_lvm2_run(const char *cmdline)
|
||||
{
|
||||
return (lvm2_run(_lvm_handle, cmdline) == LVM2_COMMAND_SUCCEEDED);
|
||||
return lvm2_run(_lvm_handle, cmdline);
|
||||
}
|
||||
|
||||
int dmeventd_lvm2_command(struct dm_pool *mem, char *buffer, size_t size,
|
||||
@@ -159,8 +159,8 @@ int dmeventd_lvm2_command(struct dm_pool *mem, char *buffer, size_t size,
|
||||
}
|
||||
|
||||
/* strip off the mirror component designations */
|
||||
if ((layer = strstr(lv, "_mimagetmp")) ||
|
||||
(layer = strstr(lv, "_mlog")))
|
||||
layer = strstr(lv, "_mlog");
|
||||
if (layer)
|
||||
*layer = '\0';
|
||||
|
||||
r = dm_snprintf(buffer, size, "%s %s/%s", cmd, vg, lv);
|
||||
|
||||
@@ -22,11 +22,11 @@
|
||||
* liblvm2cmd thread-safe so this can go away.
|
||||
*/
|
||||
|
||||
#include "libdevmapper.h"
|
||||
|
||||
#ifndef _DMEVENTD_LVMWRAP_H
|
||||
#define _DMEVENTD_LVMWRAP_H
|
||||
|
||||
struct dm_pool;
|
||||
|
||||
int dmeventd_lvm2_init(void);
|
||||
void dmeventd_lvm2_exit(void);
|
||||
int dmeventd_lvm2_run(const char *cmdline);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#
|
||||
# Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
# Copyright (C) 2004-2005, 2008-2014 Red Hat, Inc. All rights reserved.
|
||||
# Copyright (C) 2004-2005, 2008-2011 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
# This file is part of LVM2.
|
||||
#
|
||||
@@ -16,8 +16,8 @@ srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
top_builddir = @top_builddir@
|
||||
|
||||
INCLUDES += -I$(top_srcdir)/daemons/dmeventd/plugins/lvm2
|
||||
CLDFLAGS += -L$(top_builddir)/daemons/dmeventd/plugins/lvm2
|
||||
INCLUDES += -I$(top_srcdir)/tools -I$(top_srcdir)/daemons/dmeventd/plugins/lvm2
|
||||
CLDFLAGS += -L$(top_builddir)/tools -L$(top_builddir)/daemons/dmeventd/plugins/lvm2
|
||||
|
||||
SOURCES = dmeventd_mirror.c
|
||||
|
||||
@@ -30,7 +30,7 @@ CFLOW_LIST_TARGET = $(LIB_NAME).cflow
|
||||
|
||||
include $(top_builddir)/make.tmpl
|
||||
|
||||
LIBS += -ldevmapper-event-lvm2 -ldevmapper
|
||||
LIBS += -ldevmapper-event-lvm2 -ldevmapper $(DAEMON_LIBS)
|
||||
|
||||
install_lvm2: install_dm_plugin
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
|
||||
#include "lib.h"
|
||||
|
||||
#include "lvm2cmd.h"
|
||||
#include "errors.h"
|
||||
#include "libdevmapper-event.h"
|
||||
#include "dmeventd_lvm.h"
|
||||
#include "defaults.h"
|
||||
@@ -143,9 +145,9 @@ static int _remove_failed_devices(const char *device)
|
||||
r = dmeventd_lvm2_run(cmd_str);
|
||||
|
||||
syslog(LOG_INFO, "Repair of mirrored device %s %s.", device,
|
||||
(r) ? "finished successfully" : "failed");
|
||||
(r == ECMD_PROCESSED) ? "finished successfully" : "failed");
|
||||
|
||||
return (r) ? 0 : -1;
|
||||
return (r == ECMD_PROCESSED) ? 0 : -1;
|
||||
}
|
||||
|
||||
void process_event(struct dm_task *dmt,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (C) 2011-2014 Red Hat, Inc. All rights reserved.
|
||||
# Copyright (C) 2011 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
# This file is part of LVM2.
|
||||
#
|
||||
@@ -15,8 +15,8 @@ srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
top_builddir = @top_builddir@
|
||||
|
||||
INCLUDES += -I$(top_srcdir)/daemons/dmeventd/plugins/lvm2
|
||||
CLDFLAGS += -L$(top_builddir)/daemons/dmeventd/plugins/lvm2
|
||||
INCLUDES += -I$(top_srcdir)/tools -I$(top_srcdir)/daemons/dmeventd/plugins/lvm2
|
||||
CLDFLAGS += -L$(top_builddir)/tools -L$(top_builddir)/daemons/dmeventd/plugins/lvm2
|
||||
|
||||
SOURCES = dmeventd_raid.c
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
|
||||
#include "lib.h"
|
||||
|
||||
#include "lvm2cmd.h"
|
||||
#include "errors.h"
|
||||
#include "libdevmapper-event.h"
|
||||
#include "dmeventd_lvm.h"
|
||||
|
||||
@@ -32,27 +34,17 @@ static int run_repair(const char *device)
|
||||
#define CMD_SIZE 256 /* FIXME Use system restriction */
|
||||
char cmd_str[CMD_SIZE];
|
||||
|
||||
if (!dmeventd_lvm2_command(dmeventd_lvm2_pool(), cmd_str, sizeof(cmd_str),
|
||||
"lvscan --cache", device))
|
||||
return -1;
|
||||
|
||||
r = dmeventd_lvm2_run(cmd_str);
|
||||
|
||||
if (!r)
|
||||
syslog(LOG_INFO, "Re-scan of RAID device %s failed.", device);
|
||||
|
||||
if (!dmeventd_lvm2_command(dmeventd_lvm2_pool(), cmd_str, sizeof(cmd_str),
|
||||
"lvconvert --config devices{ignore_suspended_devices=1} "
|
||||
"--repair --use-policies", device))
|
||||
return -1;
|
||||
|
||||
/* if repair goes OK, report success even if lvscan has failed */
|
||||
r = dmeventd_lvm2_run(cmd_str);
|
||||
|
||||
if (!r)
|
||||
if (r != ECMD_PROCESSED)
|
||||
syslog(LOG_INFO, "Repair of RAID device %s failed.", device);
|
||||
|
||||
return (r) ? 0 : -1;
|
||||
return (r == ECMD_PROCESSED) ? 0 : -1;
|
||||
}
|
||||
|
||||
static int _process_raid_event(char *params, const char *device)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#
|
||||
# Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
# Copyright (C) 2004-2014 Red Hat, Inc. All rights reserved.
|
||||
# Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
# This file is part of the LVM2.
|
||||
#
|
||||
@@ -16,8 +16,8 @@ srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
top_builddir = @top_builddir@
|
||||
|
||||
INCLUDES += -I$(top_srcdir)/daemons/dmeventd/plugins/lvm2
|
||||
CLDFLAGS += -L$(top_builddir)/daemons/dmeventd/plugins/lvm2
|
||||
INCLUDES += -I$(top_srcdir)/tools -I$(top_srcdir)/daemons/dmeventd/plugins/lvm2
|
||||
CLDFLAGS += -L$(top_builddir)/tools -L$(top_builddir)/daemons/dmeventd/plugins/lvm2
|
||||
|
||||
SOURCES = dmeventd_snapshot.c
|
||||
|
||||
@@ -26,7 +26,7 @@ LIB_VERSION = $(LIB_VERSION_LVM)
|
||||
|
||||
include $(top_builddir)/make.tmpl
|
||||
|
||||
LIBS += -ldevmapper-event-lvm2 -ldevmapper
|
||||
LIBS += -ldevmapper-event-lvm2 -ldevmapper $(DAEMON_LIBS)
|
||||
|
||||
install_lvm2: install_dm_plugin
|
||||
|
||||
|
||||
@@ -14,12 +14,13 @@
|
||||
|
||||
#include "lib.h"
|
||||
|
||||
#include "lvm2cmd.h"
|
||||
#include "errors.h"
|
||||
#include "libdevmapper-event.h"
|
||||
#include "dmeventd_lvm.h"
|
||||
|
||||
#include <sys/wait.h>
|
||||
#include <syslog.h> /* FIXME Replace syslog with multilog */
|
||||
#include <stdarg.h>
|
||||
/* FIXME Missing openlog? */
|
||||
|
||||
/* First warning when snapshot is 80% full. */
|
||||
@@ -81,7 +82,7 @@ static int _run(const char *cmd, ...)
|
||||
|
||||
static int _extend(const char *cmd)
|
||||
{
|
||||
return dmeventd_lvm2_run(cmd);
|
||||
return dmeventd_lvm2_run(cmd) == ECMD_PROCESSED;
|
||||
}
|
||||
|
||||
static void _umount(const char *device, int major, int minor)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (C) 2011-2014 Red Hat, Inc. All rights reserved.
|
||||
# Copyright (C) 2011 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
# This file is part of LVM2.
|
||||
#
|
||||
@@ -15,8 +15,8 @@ srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
top_builddir = @top_builddir@
|
||||
|
||||
INCLUDES += -I$(top_srcdir)/daemons/dmeventd/plugins/lvm2
|
||||
CLDFLAGS += -L$(top_builddir)/daemons/dmeventd/plugins/lvm2
|
||||
INCLUDES += -I$(top_srcdir)/tools -I$(top_srcdir)/daemons/dmeventd/plugins/lvm2
|
||||
CLDFLAGS += -L$(top_builddir)/tools -L$(top_builddir)/daemons/dmeventd/plugins/lvm2
|
||||
|
||||
SOURCES = dmeventd_thin.c
|
||||
|
||||
|
||||
@@ -14,12 +14,13 @@
|
||||
|
||||
#include "lib.h"
|
||||
|
||||
#include "lvm2cmd.h"
|
||||
#include "errors.h"
|
||||
#include "libdevmapper-event.h"
|
||||
#include "dmeventd_lvm.h"
|
||||
|
||||
#include <sys/wait.h>
|
||||
#include <syslog.h> /* FIXME Replace syslog with multilog */
|
||||
#include <stdarg.h>
|
||||
/* FIXME Missing openlog? */
|
||||
|
||||
/* First warning when thin is 80% full. */
|
||||
@@ -44,7 +45,7 @@ struct dso_state {
|
||||
|
||||
|
||||
/* TODO - move this mountinfo code into library to be reusable */
|
||||
#ifdef __linux__
|
||||
#ifdef linux
|
||||
# include "kdev_t.h"
|
||||
#else
|
||||
# define MAJOR(x) major((x))
|
||||
@@ -146,7 +147,7 @@ static int _extend(struct dso_state *state)
|
||||
#if THIN_DEBUG
|
||||
syslog(LOG_INFO, "dmeventd executes: %s.\n", state->cmd_str);
|
||||
#endif
|
||||
return dmeventd_lvm2_run(state->cmd_str);
|
||||
return (dmeventd_lvm2_run(state->cmd_str) == ECMD_PROCESSED);
|
||||
}
|
||||
|
||||
static int _run(const char *cmd, ...)
|
||||
@@ -218,8 +219,7 @@ static int _umount_device(char *buffer, unsigned major, unsigned minor,
|
||||
*/
|
||||
static void _umount(struct dm_task *dmt, const char *device)
|
||||
{
|
||||
/* TODO: Convert to use hash to reduce memory usage */
|
||||
static const size_t MINORS = (1U << 20); /* 20 bit */
|
||||
static const size_t MINORS = 4096;
|
||||
struct mountinfo_s data = {
|
||||
.device = device,
|
||||
};
|
||||
|
||||
@@ -33,9 +33,8 @@ LVMLIBS = -ldaemonserver $(LVMINTERNAL_LIBS) -ldevmapper
|
||||
|
||||
LIBS += $(PTHREAD_LIBS)
|
||||
|
||||
LDFLAGS += -L$(top_builddir)/libdaemon/server $(EXTRA_EXEC_LDFLAGS)
|
||||
LDFLAGS += -L$(top_builddir)/libdaemon/server
|
||||
CLDFLAGS += -L$(top_builddir)/libdaemon/server
|
||||
CFLAGS += $(EXTRA_EXEC_CFLAGS)
|
||||
|
||||
lvmetad: $(OBJECTS) $(top_builddir)/libdaemon/client/libdaemonclient.a \
|
||||
$(top_builddir)/libdaemon/server/libdaemonserver.a
|
||||
|
||||
@@ -17,8 +17,6 @@
|
||||
|
||||
#include "daemon-client.h"
|
||||
|
||||
#define LVMETAD_SOCKET DEFAULT_RUN_DIR "/lvmetad.socket"
|
||||
|
||||
struct volume_group;
|
||||
|
||||
/* Different types of replies we may get from lvmetad. */
|
||||
@@ -66,7 +64,7 @@ static inline daemon_handle lvmetad_open(const char *socket)
|
||||
{
|
||||
daemon_info lvmetad_info = {
|
||||
.path = "lvmetad",
|
||||
.socket = socket ?: LVMETAD_SOCKET,
|
||||
.socket = socket ?: DEFAULT_RUN_DIR "/lvmetad.socket",
|
||||
.protocol = "lvmetad",
|
||||
.protocol_version = 1,
|
||||
.autostart = 0
|
||||
|
||||
@@ -26,11 +26,6 @@
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <math.h> /* fabs() */
|
||||
#include <float.h> /* DBL_EPSILON */
|
||||
|
||||
#define LVMETAD_SOCKET DEFAULT_RUN_DIR "/lvmetad.socket"
|
||||
|
||||
typedef struct {
|
||||
log_state *log; /* convenience */
|
||||
const char *log_config;
|
||||
@@ -57,19 +52,27 @@ static void destroy_metadata_hashes(lvmetad_state *s)
|
||||
{
|
||||
struct dm_hash_node *n = NULL;
|
||||
|
||||
dm_hash_iterate(n, s->vgid_to_metadata)
|
||||
n = dm_hash_get_first(s->vgid_to_metadata);
|
||||
while (n) {
|
||||
dm_config_destroy(dm_hash_get_data(s->vgid_to_metadata, n));
|
||||
n = dm_hash_get_next(s->vgid_to_metadata, n);
|
||||
}
|
||||
|
||||
dm_hash_iterate(n, s->pvid_to_pvmeta)
|
||||
n = dm_hash_get_first(s->pvid_to_pvmeta);
|
||||
while (n) {
|
||||
dm_config_destroy(dm_hash_get_data(s->pvid_to_pvmeta, n));
|
||||
|
||||
n = dm_hash_get_next(s->pvid_to_pvmeta, n);
|
||||
}
|
||||
dm_hash_destroy(s->pvid_to_pvmeta);
|
||||
dm_hash_destroy(s->vgid_to_metadata);
|
||||
dm_hash_destroy(s->vgid_to_vgname);
|
||||
dm_hash_destroy(s->vgname_to_vgid);
|
||||
|
||||
dm_hash_iterate(n, s->device_to_pvid)
|
||||
n = dm_hash_get_first(s->device_to_pvid);
|
||||
while (n) {
|
||||
dm_free(dm_hash_get_data(s->device_to_pvid, n));
|
||||
n = dm_hash_get_next(s->device_to_pvid, n);
|
||||
}
|
||||
|
||||
dm_hash_destroy(s->device_to_pvid);
|
||||
dm_hash_destroy(s->pvid_to_vgid);
|
||||
@@ -302,7 +305,8 @@ static response pv_list(lvmetad_state *s, request r)
|
||||
|
||||
lock_pvid_to_pvmeta(s);
|
||||
|
||||
dm_hash_iterate(n, s->pvid_to_pvmeta) {
|
||||
for (n = dm_hash_get_first(s->pvid_to_pvmeta); n;
|
||||
n = dm_hash_get_next(s->pvid_to_pvmeta, n)) {
|
||||
id = dm_hash_get_key(s->pvid_to_pvmeta, n);
|
||||
cn = make_pv_node(s, id, res.cft, cn_pvs, cn);
|
||||
}
|
||||
@@ -335,8 +339,8 @@ static response pv_lookup(lvmetad_state *s, request r)
|
||||
pvid = dm_hash_lookup_binary(s->device_to_pvid, &devt, sizeof(devt));
|
||||
|
||||
if (!pvid) {
|
||||
unlock_pvid_to_pvmeta(s);
|
||||
WARN(s, "pv_lookup: could not find device %" PRIu64, devt);
|
||||
unlock_pvid_to_pvmeta(s);
|
||||
dm_config_destroy(res.cft);
|
||||
return reply_unknown("device not found");
|
||||
}
|
||||
@@ -388,7 +392,8 @@ static response vg_list(lvmetad_state *s, request r)
|
||||
|
||||
lock_vgid_to_metadata(s);
|
||||
|
||||
dm_hash_iterate(n, s->vgid_to_vgname) {
|
||||
n = dm_hash_get_first(s->vgid_to_vgname);
|
||||
while (n) {
|
||||
id = dm_hash_get_key(s->vgid_to_vgname, n),
|
||||
name = dm_hash_get_data(s->vgid_to_vgname, n);
|
||||
|
||||
@@ -416,6 +421,8 @@ static response vg_list(lvmetad_state *s, request r)
|
||||
if (!cn_vgs->child)
|
||||
cn_vgs->child = cn;
|
||||
cn_last = cn;
|
||||
|
||||
n = dm_hash_get_next(s->vgid_to_vgname, n);
|
||||
}
|
||||
|
||||
unlock_vgid_to_metadata(s);
|
||||
@@ -496,12 +503,6 @@ bad:
|
||||
return reply_fail("out of memory");
|
||||
}
|
||||
|
||||
/* Test if the doubles are close enough to be considered equal */
|
||||
static int close_enough(double d1, double d2)
|
||||
{
|
||||
return fabs(d1 - d2) < DBL_EPSILON;
|
||||
}
|
||||
|
||||
static int compare_value(struct dm_config_value *a, struct dm_config_value *b)
|
||||
{
|
||||
int r = 0;
|
||||
@@ -513,7 +514,7 @@ static int compare_value(struct dm_config_value *a, struct dm_config_value *b)
|
||||
|
||||
switch (a->type) {
|
||||
case DM_CFG_STRING: r = strcmp(a->v.str, b->v.str); break;
|
||||
case DM_CFG_FLOAT: r = close_enough(a->v.f, b->v.f) ? 0 : (a->v.f > b->v.f) ? 1 : -1; break;
|
||||
case DM_CFG_FLOAT: r = (a->v.f == b->v.f) ? 0 : (a->v.f > b->v.f) ? 1 : -1; break;
|
||||
case DM_CFG_INT: r = (a->v.i == b->v.i) ? 0 : (a->v.i > b->v.i) ? 1 : -1; break;
|
||||
case DM_CFG_EMPTY_ARRAY: return 0;
|
||||
}
|
||||
@@ -550,7 +551,7 @@ static int compare_config(struct dm_config_node *a, struct dm_config_node *b)
|
||||
return result;
|
||||
}
|
||||
|
||||
static int vg_remove_if_missing(lvmetad_state *s, const char *vgid, int update_pvids);
|
||||
static int vg_remove_if_missing(lvmetad_state *s, const char *vgid);
|
||||
|
||||
/* You need to be holding the pvid_to_vgid lock already to call this. */
|
||||
static int update_pvid_to_vgid(lvmetad_state *s, struct dm_config_tree *vg,
|
||||
@@ -585,10 +586,11 @@ static int update_pvid_to_vgid(lvmetad_state *s, struct dm_config_tree *vg,
|
||||
DEBUGLOG(s, "moving PV %s to VG %s", pvid, vgid);
|
||||
}
|
||||
|
||||
dm_hash_iterate(n, to_check) {
|
||||
for (n = dm_hash_get_first(to_check); n;
|
||||
n = dm_hash_get_next(to_check, n)) {
|
||||
check_vgid = dm_hash_get_key(to_check, n);
|
||||
lock_vg(s, check_vgid);
|
||||
vg_remove_if_missing(s, check_vgid, 0);
|
||||
vg_remove_if_missing(s, check_vgid);
|
||||
unlock_vg(s, check_vgid);
|
||||
}
|
||||
|
||||
@@ -629,7 +631,7 @@ static int remove_metadata(lvmetad_state *s, const char *vgid, int update_pvids)
|
||||
}
|
||||
|
||||
/* The VG must be locked. */
|
||||
static int vg_remove_if_missing(lvmetad_state *s, const char *vgid, int update_pvids)
|
||||
static int vg_remove_if_missing(lvmetad_state *s, const char *vgid)
|
||||
{
|
||||
struct dm_config_tree *vg;
|
||||
struct dm_config_node *pv;
|
||||
@@ -656,7 +658,7 @@ static int vg_remove_if_missing(lvmetad_state *s, const char *vgid, int update_p
|
||||
|
||||
if (missing) {
|
||||
DEBUGLOG(s, "removing empty VG %s", vgid);
|
||||
remove_metadata(s, vgid, update_pvids);
|
||||
remove_metadata(s, vgid, 0);
|
||||
}
|
||||
|
||||
unlock_pvid_to_pvmeta(s);
|
||||
@@ -751,11 +753,8 @@ static int update_metadata(lvmetad_state *s, const char *name, const char *_vgid
|
||||
dm_hash_insert(s->vgid_to_vgname, vgid, cfgname) &&
|
||||
dm_hash_insert(s->vgname_to_vgid, name, (void*) vgid)) ? 1 : 0;
|
||||
|
||||
if (retval && oldname && strcmp(name, oldname)) {
|
||||
const char *vgid_prev = dm_hash_lookup(s->vgname_to_vgid, oldname);
|
||||
if (vgid_prev && !strcmp(vgid_prev, vgid))
|
||||
dm_hash_remove(s->vgname_to_vgid, oldname);
|
||||
}
|
||||
if (retval && oldname && strcmp(name, oldname))
|
||||
dm_hash_remove(s->vgname_to_vgid, oldname);
|
||||
|
||||
if (haveseq >= 0 && haveseq < seq)
|
||||
dm_config_destroy(old);
|
||||
@@ -778,7 +777,7 @@ static response pv_gone(lvmetad_state *s, request r)
|
||||
const char *pvid = daemon_request_str(r, "uuid", NULL);
|
||||
int64_t device = daemon_request_int(r, "device", 0);
|
||||
struct dm_config_tree *pvmeta;
|
||||
char *pvid_old, *vgid;
|
||||
char *pvid_old;
|
||||
|
||||
DEBUGLOG(s, "pv_gone: %s / %" PRIu64, pvid, device);
|
||||
|
||||
@@ -794,30 +793,19 @@ static response pv_gone(lvmetad_state *s, request r)
|
||||
|
||||
pvmeta = dm_hash_lookup(s->pvid_to_pvmeta, pvid);
|
||||
pvid_old = dm_hash_lookup_binary(s->device_to_pvid, &device, sizeof(device));
|
||||
vgid = dm_hash_lookup(s->pvid_to_vgid, pvid);
|
||||
|
||||
dm_hash_remove_binary(s->device_to_pvid, &device, sizeof(device));
|
||||
dm_hash_remove(s->pvid_to_pvmeta, pvid);
|
||||
vg_remove_if_missing(s, dm_hash_lookup(s->pvid_to_vgid, pvid));
|
||||
unlock_pvid_to_pvmeta(s);
|
||||
|
||||
dm_free(pvid_old);
|
||||
if (pvid_old)
|
||||
dm_free(pvid_old);
|
||||
|
||||
if (vgid) {
|
||||
if (!(vgid = dm_strdup(vgid)))
|
||||
return reply_fail("out of memory");
|
||||
|
||||
lock_vg(s, vgid);
|
||||
vg_remove_if_missing(s, vgid, 1);
|
||||
unlock_vg(s, vgid);
|
||||
dm_free(vgid);
|
||||
}
|
||||
|
||||
if (!pvmeta)
|
||||
if (pvmeta) {
|
||||
dm_config_destroy(pvmeta);
|
||||
return daemon_reply_simple("OK", NULL);
|
||||
} else
|
||||
return reply_unknown("PVID does not exist");
|
||||
|
||||
dm_config_destroy(pvmeta);
|
||||
|
||||
return daemon_reply_simple("OK", NULL);
|
||||
}
|
||||
|
||||
static response pv_clear_all(lvmetad_state *s, request r)
|
||||
@@ -825,8 +813,8 @@ static response pv_clear_all(lvmetad_state *s, request r)
|
||||
DEBUGLOG(s, "pv_clear_all");
|
||||
|
||||
lock_pvid_to_pvmeta(s);
|
||||
lock_pvid_to_vgid(s);
|
||||
lock_vgid_to_metadata(s);
|
||||
lock_pvid_to_vgid(s);
|
||||
|
||||
destroy_metadata_hashes(s);
|
||||
create_metadata_hashes(s);
|
||||
@@ -844,14 +832,13 @@ static response pv_found(lvmetad_state *s, request r)
|
||||
const char *pvid = daemon_request_str(r, "pvmeta/id", NULL);
|
||||
const char *vgname = daemon_request_str(r, "vgname", NULL);
|
||||
const char *vgid = daemon_request_str(r, "metadata/id", NULL);
|
||||
const char *vgid_old = NULL;
|
||||
struct dm_config_node *pvmeta = dm_config_find_node(r.cft->root, "pvmeta");
|
||||
uint64_t device, device_old_pvid = 0;
|
||||
uint64_t device;
|
||||
struct dm_config_tree *cft, *pvmeta_old_dev = NULL, *pvmeta_old_pvid = NULL;
|
||||
char *old;
|
||||
char *pvid_dup;
|
||||
int complete = 0, orphan = 0;
|
||||
int64_t seqno = -1, seqno_old = -1, changed = 0;
|
||||
int64_t seqno = -1, seqno_old = -1;
|
||||
|
||||
if (!pvid)
|
||||
return reply_fail("need PV UUID");
|
||||
@@ -861,60 +848,47 @@ static response pv_found(lvmetad_state *s, request r)
|
||||
if (!dm_config_get_uint64(pvmeta, "pvmeta/device", &device))
|
||||
return reply_fail("need PV device number");
|
||||
|
||||
lock_pvid_to_pvmeta(s);
|
||||
|
||||
if ((old = dm_hash_lookup_binary(s->device_to_pvid, &device, sizeof(device)))) {
|
||||
pvmeta_old_dev = dm_hash_lookup(s->pvid_to_pvmeta, old);
|
||||
dm_hash_remove(s->pvid_to_pvmeta, old);
|
||||
}
|
||||
pvmeta_old_pvid = dm_hash_lookup(s->pvid_to_pvmeta, pvid);
|
||||
|
||||
DEBUGLOG(s, "pv_found %s, vgid = %s, device = %" PRIu64 ", old = %s", pvid, vgid, device, old);
|
||||
|
||||
dm_free(old);
|
||||
|
||||
if (!(cft = dm_config_create()) ||
|
||||
(!(pvid_dup = dm_strdup(pvid)))) {
|
||||
!(cft->root = dm_config_clone_node(cft, pvmeta, 0))) {
|
||||
unlock_pvid_to_pvmeta(s);
|
||||
if (cft)
|
||||
dm_config_destroy(cft);
|
||||
return reply_fail("out of memory");
|
||||
}
|
||||
|
||||
lock_pvid_to_pvmeta(s);
|
||||
|
||||
if ((pvmeta_old_pvid = dm_hash_lookup(s->pvid_to_pvmeta, pvid)))
|
||||
dm_config_get_uint64(pvmeta_old_pvid->root, "pvmeta/device", &device_old_pvid);
|
||||
|
||||
if ((old = dm_hash_lookup_binary(s->device_to_pvid, &device, sizeof(device)))) {
|
||||
pvmeta_old_dev = dm_hash_lookup(s->pvid_to_pvmeta, old);
|
||||
dm_hash_remove(s->pvid_to_pvmeta, old);
|
||||
vgid_old = dm_hash_lookup(s->pvid_to_vgid, old);
|
||||
}
|
||||
|
||||
DEBUGLOG(s, "pv_found %s, vgid = %s, device = %" PRIu64 " (previously %" PRIu64 "), old = %s",
|
||||
pvid, vgid, device, device_old_pvid, old);
|
||||
|
||||
if (!(cft->root = dm_config_clone_node(cft, pvmeta, 0)))
|
||||
goto out_of_mem;
|
||||
|
||||
if (!pvmeta_old_pvid || compare_config(pvmeta_old_pvid->root, cft->root))
|
||||
changed |= 1;
|
||||
|
||||
if (pvmeta_old_pvid && device != device_old_pvid) {
|
||||
DEBUGLOG(s, "pv %s no longer on device %" PRIu64, pvid, device_old_pvid);
|
||||
dm_free(dm_hash_lookup_binary(s->device_to_pvid, &device_old_pvid, sizeof(device_old_pvid)));
|
||||
dm_hash_remove_binary(s->device_to_pvid, &device_old_pvid, sizeof(device_old_pvid));
|
||||
changed |= 1;
|
||||
if (!(pvid_dup = dm_strdup(pvid))) {
|
||||
unlock_pvid_to_pvmeta(s);
|
||||
dm_config_destroy(cft);
|
||||
return reply_fail("out of memory");
|
||||
}
|
||||
|
||||
if (!dm_hash_insert(s->pvid_to_pvmeta, pvid, cft) ||
|
||||
!dm_hash_insert_binary(s->device_to_pvid, &device, sizeof(device), (void*)pvid_dup)) {
|
||||
dm_hash_remove(s->pvid_to_pvmeta, pvid);
|
||||
out_of_mem:
|
||||
unlock_pvid_to_pvmeta(s);
|
||||
dm_hash_remove(s->pvid_to_pvmeta, pvid);
|
||||
dm_config_destroy(cft);
|
||||
dm_free(pvid_dup);
|
||||
dm_free(old);
|
||||
return reply_fail("out of memory");
|
||||
}
|
||||
|
||||
unlock_pvid_to_pvmeta(s);
|
||||
|
||||
dm_free(old);
|
||||
|
||||
if (pvmeta_old_pvid)
|
||||
dm_config_destroy(pvmeta_old_pvid);
|
||||
if (pvmeta_old_dev && pvmeta_old_dev != pvmeta_old_pvid)
|
||||
dm_config_destroy(pvmeta_old_dev);
|
||||
|
||||
unlock_pvid_to_pvmeta(s);
|
||||
|
||||
if (metadata) {
|
||||
if (!vgid)
|
||||
return reply_fail("need VG UUID");
|
||||
@@ -926,7 +900,6 @@ out_of_mem:
|
||||
|
||||
if (!update_metadata(s, vgname, vgid, metadata, &seqno_old))
|
||||
return reply_fail("metadata update failed");
|
||||
changed |= (seqno_old != dm_config_find_int(metadata, "metadata/seqno", -1));
|
||||
} else {
|
||||
lock_pvid_to_vgid(s);
|
||||
vgid = dm_hash_lookup(s->pvid_to_vgid, pvid);
|
||||
@@ -944,29 +917,12 @@ out_of_mem:
|
||||
return reply_fail("non-orphan VG without metadata encountered");
|
||||
}
|
||||
unlock_vg(s, vgid);
|
||||
|
||||
// TODO: separate vgid->vgname lock
|
||||
lock_vgid_to_metadata(s);
|
||||
vgname = dm_hash_lookup(s->vgid_to_vgname, vgid);
|
||||
unlock_vgid_to_metadata(s);
|
||||
}
|
||||
|
||||
if (vgid_old && (!vgid || strcmp(vgid, vgid_old))) {
|
||||
/* make a copy, because vg_remove_if_missing will deallocate the
|
||||
* storage behind vgid_old */
|
||||
vgid_old = dm_strdup(vgid_old);
|
||||
lock_vg(s, vgid_old);
|
||||
vg_remove_if_missing(s, vgid_old, 1);
|
||||
unlock_vg(s, vgid_old);
|
||||
dm_free((char*)vgid_old);
|
||||
}
|
||||
|
||||
return daemon_reply_simple("OK",
|
||||
"status = %s", orphan ? "orphan" :
|
||||
(complete ? "complete" : "partial"),
|
||||
"changed = %d", changed,
|
||||
"vgid = %s", vgid ? vgid : "#orphan",
|
||||
"vgname = %s", vgname ? vgname : "#orphan",
|
||||
"seqno_before = %"PRId64, seqno_old,
|
||||
"seqno_after = %"PRId64, seqno,
|
||||
NULL);
|
||||
@@ -1011,26 +967,26 @@ static response vg_remove(lvmetad_state *s, request r)
|
||||
|
||||
static void _dump_cft(struct buffer *buf, struct dm_hash_table *ht, const char *key_addr)
|
||||
{
|
||||
struct dm_hash_node *n;
|
||||
|
||||
dm_hash_iterate(n, ht) {
|
||||
struct dm_hash_node *n = dm_hash_get_first(ht);
|
||||
while (n) {
|
||||
struct dm_config_tree *cft = dm_hash_get_data(ht, n);
|
||||
const char *key_backup = cft->root->key;
|
||||
cft->root->key = dm_config_find_str(cft->root, key_addr, "unknown");
|
||||
(void) dm_config_write_node(cft->root, buffer_line, buf);
|
||||
cft->root->key = key_backup;
|
||||
n = dm_hash_get_next(ht, n);
|
||||
}
|
||||
}
|
||||
|
||||
static void _dump_pairs(struct buffer *buf, struct dm_hash_table *ht, const char *name, int int_key)
|
||||
{
|
||||
char *append;
|
||||
struct dm_hash_node *n;
|
||||
struct dm_hash_node *n = dm_hash_get_first(ht);
|
||||
|
||||
buffer_append(buf, name);
|
||||
buffer_append(buf, " {\n");
|
||||
|
||||
dm_hash_iterate(n, ht) {
|
||||
while (n) {
|
||||
const char *key = dm_hash_get_key(ht, n),
|
||||
*val = dm_hash_get_data(ht, n);
|
||||
buffer_append(buf, " ");
|
||||
@@ -1042,6 +998,7 @@ static void _dump_pairs(struct buffer *buf, struct dm_hash_table *ht, const char
|
||||
buffer_append(buf, append);
|
||||
buffer_append(buf, "\n");
|
||||
dm_free(append);
|
||||
n = dm_hash_get_next(ht, n);
|
||||
}
|
||||
buffer_append(buf, "}\n");
|
||||
}
|
||||
@@ -1103,8 +1060,7 @@ static response handler(daemon_state s, client_handle h, request r)
|
||||
return daemon_reply_simple("token_mismatch",
|
||||
"expected = %s", state->token,
|
||||
"received = %s", token,
|
||||
"reason = %s",
|
||||
"lvmetad cache is invalid due to a global_filter change or due to a running rescan", NULL);
|
||||
"reason = %s", "token mismatch", NULL);
|
||||
}
|
||||
pthread_mutex_unlock(&state->token_lock);
|
||||
|
||||
@@ -1187,16 +1143,18 @@ static int fini(daemon_state *s)
|
||||
destroy_metadata_hashes(ls);
|
||||
|
||||
/* Destroy the lock hashes now. */
|
||||
dm_hash_iterate(n, ls->lock.vg) {
|
||||
n = dm_hash_get_first(ls->lock.vg);
|
||||
while (n) {
|
||||
pthread_mutex_destroy(dm_hash_get_data(ls->lock.vg, n));
|
||||
free(dm_hash_get_data(ls->lock.vg, n));
|
||||
n = dm_hash_get_next(ls->lock.vg, n);
|
||||
}
|
||||
|
||||
dm_hash_destroy(ls->lock.vg);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void usage(const char *prog, FILE *file)
|
||||
static void usage(char *prog, FILE *file)
|
||||
{
|
||||
fprintf(file, "Usage:\n"
|
||||
"%s [-V] [-h] [-f] [-l {all|wire|debug}] [-s path]\n\n"
|
||||
@@ -1204,28 +1162,34 @@ static void usage(const char *prog, FILE *file)
|
||||
" -h Show this help information\n"
|
||||
" -f Don't fork, run in the foreground\n"
|
||||
" -l Logging message level (-l {all|wire|debug})\n"
|
||||
" -p Set path to the pidfile\n"
|
||||
" -s Set path to the socket to listen on\n\n", prog);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
signed char opt;
|
||||
lvmetad_state ls = { .log_config = "" };
|
||||
lvmetad_state ls;
|
||||
int _socket_override = 1;
|
||||
daemon_state s = {
|
||||
.daemon_fini = fini,
|
||||
.daemon_init = init,
|
||||
.handler = handler,
|
||||
.name = "lvmetad",
|
||||
.pidfile = getenv("LVM_LVMETAD_PIDFILE") ? : LVMETAD_PIDFILE,
|
||||
.pidfile = LVMETAD_PIDFILE,
|
||||
.private = &ls,
|
||||
.protocol = "lvmetad",
|
||||
.protocol_version = 1,
|
||||
.socket_path = getenv("LVM_LVMETAD_SOCKET") ? : LVMETAD_SOCKET,
|
||||
.socket_path = getenv("LVM_LVMETAD_SOCKET"),
|
||||
};
|
||||
|
||||
if (!s.socket_path) {
|
||||
_socket_override = 0;
|
||||
s.socket_path = DEFAULT_RUN_DIR "/lvmetad.socket";
|
||||
}
|
||||
ls.log_config = "";
|
||||
|
||||
// use getopt_long
|
||||
while ((opt = getopt(argc, argv, "?fhVl:p:s:")) != EOF) {
|
||||
while ((opt = getopt(argc, argv, "?fhVl:s:")) != EOF) {
|
||||
switch (opt) {
|
||||
case 'h':
|
||||
usage(argv[0], stdout);
|
||||
@@ -1239,11 +1203,9 @@ int main(int argc, char *argv[])
|
||||
case 'l':
|
||||
ls.log_config = optarg;
|
||||
break;
|
||||
case 'p':
|
||||
s.pidfile = optarg;
|
||||
break;
|
||||
case 's': // --socket
|
||||
s.socket_path = optarg;
|
||||
_socket_override = 1;
|
||||
break;
|
||||
case 'V':
|
||||
printf("lvmetad version: " LVM_VERSION "\n");
|
||||
@@ -1251,7 +1213,15 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
daemon_start(s);
|
||||
if (s.foreground) {
|
||||
if (!_socket_override) {
|
||||
fprintf(stderr, "A socket path (-s) is required in foreground mode.");
|
||||
exit(2);
|
||||
}
|
||||
|
||||
s.pidfile = NULL;
|
||||
}
|
||||
|
||||
daemon_start(s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -18,23 +18,14 @@ top_builddir = @top_builddir@
|
||||
CONFSRC=example.conf
|
||||
CONFDEST=lvm.conf
|
||||
|
||||
PROFILE_TEMPLATES=command_profile_template.profile metadata_profile_template.profile
|
||||
PROFILES=$(PROFILE_TEMPLATES) $(srcdir)/thin-generic.profile $(srcdir)/thin-performance.profile
|
||||
|
||||
include $(top_builddir)/make.tmpl
|
||||
|
||||
install_conf: $(CONFSRC)
|
||||
install_lvm2: $(CONFSRC)
|
||||
@if [ ! -e $(confdir)/$(CONFDEST) ]; then \
|
||||
echo "$(INSTALL_WDATA) -D $< $(confdir)/$(CONFDEST)"; \
|
||||
$(INSTALL_WDATA) -D $< $(confdir)/$(CONFDEST); \
|
||||
fi
|
||||
|
||||
install_profiles: $(PROFILES)
|
||||
$(INSTALL_DIR) $(DESTDIR)$(DEFAULT_PROFILE_DIR)
|
||||
$(INSTALL_DATA) $(PROFILES) $(DESTDIR)$(DEFAULT_PROFILE_DIR)/
|
||||
|
||||
install_lvm2: install_conf install_profiles
|
||||
|
||||
install: install_lvm2
|
||||
|
||||
DISTCLEAN_TARGETS += $(CONFSRC) $(PROFILE_TEMPLATES)
|
||||
DISTCLEAN_TARGETS += $(CONFSRC)
|
||||
@@ -23,9 +23,6 @@ config {
|
||||
|
||||
# If enabled, any configuration mismatch aborts the LVM2 process.
|
||||
abort_on_errors = 0
|
||||
|
||||
# Directory where LVM looks for configuration profiles.
|
||||
profile_dir = "@DEFAULT_SYS_DIR@/@DEFAULT_PROFILE_SUBDIR@"
|
||||
}
|
||||
|
||||
# This section allows you to configure which block devices should
|
||||
@@ -53,30 +50,11 @@ devices {
|
||||
# same block device and the tools need to display a name for device,
|
||||
# all the pathnames are matched against each item in the following
|
||||
# list of regular expressions in turn and the first match is used.
|
||||
|
||||
# By default no preferred names are defined.
|
||||
# preferred_names = [ ]
|
||||
preferred_names = [ ]
|
||||
|
||||
# Try to avoid using undescriptive /dev/dm-N names, if present.
|
||||
# preferred_names = [ "^/dev/mpath/", "^/dev/mapper/mpath", "^/dev/[hs]d" ]
|
||||
|
||||
# In case no prefererred name matches or if preferred_names are not
|
||||
# defined at all, builtin rules are used to determine the preference.
|
||||
#
|
||||
# The first builtin rule checks path prefixes and it gives preference
|
||||
# based on this ordering (where "dev" depends on devices/dev setting):
|
||||
# /dev/mapper > /dev/disk > /dev/dm-* > /dev/block
|
||||
#
|
||||
# If the ordering above cannot be applied, the path with fewer slashes
|
||||
# gets preference then.
|
||||
#
|
||||
# If the number of slashes is the same, a symlink gets preference.
|
||||
#
|
||||
# Finally, if all the rules mentioned above are not applicable,
|
||||
# lexicographical order is used over paths and the smallest one
|
||||
# of all gets preference.
|
||||
|
||||
|
||||
# A filter that tells LVM2 to only use a restricted set of devices.
|
||||
# The filter consists of an array of regular expressions. These
|
||||
# expressions can be delimited by a character of your choice, and
|
||||
@@ -99,11 +77,9 @@ devices {
|
||||
# the cache file gets regenerated (see below).
|
||||
# If it doesn't do what you expect, check the output of 'vgscan -vvvv'.
|
||||
|
||||
# If lvmetad is used, then see "A note about device filtering while
|
||||
# lvmetad is used" comment that is attached to global/use_lvmetad setting.
|
||||
|
||||
# By default we accept every block device:
|
||||
# filter = [ "a/.*/" ]
|
||||
filter = [ "a/.*/" ]
|
||||
|
||||
# Exclude the cdrom drive
|
||||
# filter = [ "r|/dev/cdrom|" ]
|
||||
@@ -205,35 +181,6 @@ devices {
|
||||
# in recovery situations.
|
||||
ignore_suspended_devices = 0
|
||||
|
||||
# ignore_lvm_mirrors: Introduced in version 2.02.104
|
||||
# This setting determines whether logical volumes of "mirror" segment
|
||||
# type are scanned for LVM labels. This affects the ability of
|
||||
# mirrors to be used as physical volumes. If 'ignore_lvm_mirrors'
|
||||
# is set to '1', it becomes impossible to create volume groups on top
|
||||
# of mirror logical volumes - i.e. to stack volume groups on mirrors.
|
||||
#
|
||||
# Allowing mirror logical volumes to be scanned (setting the value to '0')
|
||||
# can potentially cause LVM processes and I/O to the mirror to become
|
||||
# blocked. This is due to the way that the "mirror" segment type handles
|
||||
# failures. In order for the hang to manifest itself, an LVM command must
|
||||
# be run just after a failure and before the automatic LVM repair process
|
||||
# takes place OR there must be failures in multiple mirrors in the same
|
||||
# volume group at the same time with write failures occurring moments
|
||||
# before a scan of the mirror's labels.
|
||||
#
|
||||
# Note that these scanning limitations do not apply to the LVM RAID
|
||||
# types, like "raid1". The RAID segment types handle failures in a
|
||||
# different way and are not subject to possible process or I/O blocking.
|
||||
#
|
||||
# It is encouraged that users set 'ignore_lvm_mirrors' to 1 if they
|
||||
# are using the "mirror" segment type. Users that require volume group
|
||||
# stacking on mirrored logical volumes should consider using the "raid1"
|
||||
# segment type. The "raid1" segment type is not available for
|
||||
# active/active clustered volume groups.
|
||||
#
|
||||
# Set to 1 to disallow stacking and thereby avoid a possible deadlock.
|
||||
ignore_lvm_mirrors = 1
|
||||
|
||||
# During each LVM operation errors received from each device are counted.
|
||||
# If the counter of a particular device exceeds the limit set here, no
|
||||
# further I/O is sent to that device for the remainder of the respective
|
||||
@@ -291,78 +238,24 @@ allocation {
|
||||
# algorithm.
|
||||
maximise_cling = 1
|
||||
|
||||
# Whether to use blkid library instead of native LVM2 code to detect
|
||||
# any existing signatures while creating new Physical Volumes and
|
||||
# Logical Volumes. LVM2 needs to be compiled with blkid wiping support
|
||||
# for this setting to take effect.
|
||||
#
|
||||
# LVM2 native detection code is currently able to recognize these signatures:
|
||||
# - MD device signature
|
||||
# - swap signature
|
||||
# - LUKS signature
|
||||
# To see the list of signatures recognized by blkid, check the output
|
||||
# of 'blkid -k' command. The blkid can recognize more signatures than
|
||||
# LVM2 native detection code, but due to this higher number of signatures
|
||||
# to be recognized, it can take more time to complete the signature scan.
|
||||
use_blkid_wiping = 1
|
||||
|
||||
# Set to 1 to wipe any signatures found on newly-created Logical Volumes
|
||||
# automatically in addition to zeroing of the first KB on the LV
|
||||
# (controlled by the -Z/--zero y option).
|
||||
# The command line option -W/--wipesignatures takes precedence over this
|
||||
# setting.
|
||||
# The default is to wipe signatures when zeroing.
|
||||
#
|
||||
wipe_signatures_when_zeroing_new_lvs = 1
|
||||
|
||||
# Set to 1 to guarantee that mirror logs will always be placed on
|
||||
# different PVs from the mirror images. This was the default
|
||||
# until version 2.02.85.
|
||||
mirror_logs_require_separate_pvs = 0
|
||||
|
||||
# Set to 1 to guarantee that cache_pool metadata will always be
|
||||
# placed on different PVs from the cache_pool data.
|
||||
cache_pool_metadata_require_separate_pvs = 0
|
||||
|
||||
# Specify the minimal chunk size (in kiB) for cache pool volumes.
|
||||
# Using a chunk_size that is too large can result in wasteful use of
|
||||
# the cache, where small reads and writes can cause large sections of
|
||||
# an LV to be mapped into the cache. However, choosing a chunk_size
|
||||
# that is too small can result in more overhead trying to manage the
|
||||
# numerous chunks that become mapped into the cache. The former is
|
||||
# more of a problem than the latter in most cases, so we default to
|
||||
# a value that is on the smaller end of the spectrum. Supported values
|
||||
# range from 32(kiB) to 1048576 in multiples of 32.
|
||||
# cache_pool_chunk_size = 64
|
||||
|
||||
# Set to 1 to guarantee that thin pool metadata will always
|
||||
# be placed on different PVs from the pool data.
|
||||
thin_pool_metadata_require_separate_pvs = 0
|
||||
|
||||
# Specify chunk size calculation policy for thin pool volumes.
|
||||
# Possible options are:
|
||||
# "generic" - if thin_pool_chunk_size is defined, use it.
|
||||
# Otherwise, calculate the chunk size based on
|
||||
# estimation and device hints exposed in sysfs:
|
||||
# the minimum_io_size. The chunk size is always
|
||||
# at least 64KiB.
|
||||
#
|
||||
# "performance" - if thin_pool_chunk_size is defined, use it.
|
||||
# Otherwise, calculate the chunk size for
|
||||
# performance based on device hints exposed in
|
||||
# sysfs: the optimal_io_size. The chunk size is
|
||||
# always at least 512KiB.
|
||||
# thin_pool_chunk_size_policy = "generic"
|
||||
|
||||
# Specify the minimal chunk size (in KB) for thin pool volumes.
|
||||
# Use of the larger chunk size may improve performance for plain
|
||||
# Use of the larger chunk size may improve perfomance for plain
|
||||
# thin volumes, however using them for snapshot volumes is less efficient,
|
||||
# as it consumes more space and takes extra time for copying.
|
||||
# When unset, lvm tries to estimate chunk size starting from 64KB
|
||||
# Supported values are in range from 64 to 1048576.
|
||||
# thin_pool_chunk_size = 64
|
||||
|
||||
# Specify discards behaviour of the thin pool volume.
|
||||
# Specify discards behavior of the thin pool volume.
|
||||
# Select one of "ignore", "nopassdown", "passdown"
|
||||
# thin_pool_discards = "passdown"
|
||||
|
||||
@@ -370,9 +263,6 @@ allocation {
|
||||
# first use.
|
||||
# N.B. zeroing larger thin pool chunk size degrades performance.
|
||||
# thin_pool_zero = 1
|
||||
|
||||
# Default physical extent size to use for newly created VGs (in KB).
|
||||
# physical_extent_size = 4096
|
||||
}
|
||||
|
||||
# This section that allows you to configure the nature of the
|
||||
@@ -445,7 +335,7 @@ log {
|
||||
# Configuration of metadata backups and archiving. In LVM2 when we
|
||||
# talk about a 'backup' we mean making a copy of the metadata for the
|
||||
# *current* system. The 'archive' contains old metadata configurations.
|
||||
# Backups are stored in a human readable text format.
|
||||
# Backups are stored in a human readeable text format.
|
||||
backup {
|
||||
|
||||
# Should we maintain a backup of the current metadata configuration ?
|
||||
@@ -505,11 +395,6 @@ global {
|
||||
# temporarily until you update them.
|
||||
si_unit_consistency = 1
|
||||
|
||||
# Whether or not to display unit suffix for sizes. This setting has
|
||||
# no effect if the units are in human-readable form (global/units="h")
|
||||
# in which case the suffix is always displayed.
|
||||
suffix = 1
|
||||
|
||||
# Whether or not to communicate with the kernel device-mapper.
|
||||
# Set to 0 if you want to use the tools to manipulate LVM metadata
|
||||
# without activating any logical volumes.
|
||||
@@ -542,19 +427,6 @@ global {
|
||||
# Type 3 uses built-in clustered locking.
|
||||
# Type 4 uses read-only locking which forbids any operations that might
|
||||
# change metadata.
|
||||
# Type 5 offers dummy locking for tools that do not need any locks.
|
||||
# You should not need to set this directly: the tools will select when
|
||||
# to use it instead of the configured locking_type. Do not use lvmetad or
|
||||
# the kernel device-mapper driver with this locking type.
|
||||
# It is used by the --readonly option that offers read-only access to
|
||||
# Volume Group metadata that cannot be locked safely because it belongs to
|
||||
# an inaccessible domain and might be in use, for example a virtual machine
|
||||
# image or a disk that is shared by a clustered machine.
|
||||
#
|
||||
# N.B. Don't use lvmetad with locking type 3 as lvmetad is not yet
|
||||
# supported in clustered environment. If use_lvmetad=1 and locking_type=3
|
||||
# is set at the same time, LVM always issues a warning message about this
|
||||
# and then it automatically disables lvmetad use.
|
||||
locking_type = 1
|
||||
|
||||
# Set to 0 to fail when a lock request cannot be satisfied immediately.
|
||||
@@ -637,7 +509,7 @@ global {
|
||||
#
|
||||
# Specify the '--type <mirror|raid1>' option to override this default
|
||||
# setting.
|
||||
mirror_segtype_default = "raid1"
|
||||
mirror_segtype_default = "mirror"
|
||||
|
||||
# 'raid10_segtype_default' determines the segment types used by default
|
||||
# when the '--stripes/-i' and '--mirrors/-m' arguments are both specified
|
||||
@@ -650,11 +522,11 @@ global {
|
||||
# "mirror" - LVM will layer the 'mirror' and 'stripe' segment types. It
|
||||
# will do this by creating a mirror on top of striped sub-LVs;
|
||||
# effectively creating a RAID 0+1 array. This is suboptimal
|
||||
# in terms of providing redundancy and performance. Changing to
|
||||
# in terms of providing redunancy and performance. Changing to
|
||||
# this setting is not advised.
|
||||
# Specify the '--type <raid10|mirror>' option to override this default
|
||||
# setting.
|
||||
raid10_segtype_default = "raid10"
|
||||
raid10_segtype_default = "mirror"
|
||||
|
||||
# The default format for displaying LV names in lvdisplay was changed
|
||||
# in version 2.02.89 to show the LV name and path separately.
|
||||
@@ -666,38 +538,15 @@ global {
|
||||
|
||||
# Whether to use (trust) a running instance of lvmetad. If this is set to
|
||||
# 0, all commands fall back to the usual scanning mechanisms. When set to 1
|
||||
# *and* when lvmetad is running (automatically instantiated by making use of
|
||||
# systemd's socket-based service activation or run as an initscripts service
|
||||
# or run manually), the volume group metadata and PV state flags are obtained
|
||||
# from the lvmetad instance and no scanning is done by the individual
|
||||
# commands. In a setup with lvmetad, lvmetad udev rules *must* be set up for
|
||||
# LVM to work correctly. Without proper udev rules, all changes in block
|
||||
# device configuration will be *ignored* until a manual 'pvscan --cache'
|
||||
# is performed. These rules are installed by default.
|
||||
# *and* when lvmetad is running (it is not auto-started), the volume group
|
||||
# metadata and PV state flags are obtained from the lvmetad instance and no
|
||||
# scanning is done by the individual commands. In a setup with lvmetad,
|
||||
# lvmetad udev rules *must* be set up for LVM to work correctly. Without
|
||||
# proper udev rules, all changes in block device configuration will be
|
||||
# *ignored* until a manual 'pvscan --cache' is performed.
|
||||
#
|
||||
# If lvmetad has been running while use_lvmetad was 0, it MUST be stopped
|
||||
# before changing use_lvmetad to 1 and started again afterwards.
|
||||
#
|
||||
# If using lvmetad, the volume activation is also switched to automatic
|
||||
# event-based mode. In this mode, the volumes are activated based on
|
||||
# incoming udev events that automatically inform lvmetad about new PVs
|
||||
# that appear in the system. Once the VG is complete (all the PVs are
|
||||
# present), it is auto-activated. The activation/auto_activation_volume_list
|
||||
# setting controls which volumes are auto-activated (all by default).
|
||||
#
|
||||
# A note about device filtering while lvmetad is used:
|
||||
# When lvmetad is updated (either automatically based on udev events
|
||||
# or directly by pvscan --cache <device> call), the devices/filter
|
||||
# is ignored and all devices are scanned by default. The lvmetad always
|
||||
# keeps unfiltered information which is then provided to LVM commands
|
||||
# and then each LVM command does the filtering based on devices/filter
|
||||
# setting itself.
|
||||
# To prevent scanning devices completely, even when using lvmetad,
|
||||
# the devices/global_filter must be used.
|
||||
# N.B. Don't use lvmetad with locking type 3 as lvmetad is not yet
|
||||
# supported in clustered environment. If use_lvmetad=1 and locking_type=3
|
||||
# is set at the same time, LVM always issues a warning message about this
|
||||
# and then it automatically disables lvmetad use.
|
||||
use_lvmetad = 0
|
||||
|
||||
# Full path of the utility called to check that a thin metadata device
|
||||
@@ -709,31 +558,11 @@ global {
|
||||
# The thin tools are available as part of the device-mapper-persistent-data
|
||||
# package from https://github.com/jthornber/thin-provisioning-tools.
|
||||
#
|
||||
# thin_check_executable = "@THIN_CHECK_CMD@"
|
||||
thin_check_executable = "@THIN_CHECK_CMD@"
|
||||
|
||||
# Array of string options passed with thin_check command. By default,
|
||||
# option "-q" is for quiet output.
|
||||
# With thin_check version 2.1 or newer you can add "--ignore-non-fatal-errors"
|
||||
# to let it pass through ignorable errors and fix them later.
|
||||
# With thin_check version 3.2 or newer you should add
|
||||
# "--clear-needs-check-flag".
|
||||
#
|
||||
# thin_check_options = [ "-q", "--clear-needs-check-flag" ]
|
||||
|
||||
# Full path of the utility called to repair a thin metadata device
|
||||
# is in a state that allows it to be used.
|
||||
# Each time a thin pool needs repair this utility is executed.
|
||||
# See thin_check_executable how to obtain binaries.
|
||||
#
|
||||
# thin_repair_executable = "@THIN_REPAIR_CMD@"
|
||||
|
||||
# Array of extra string options passed with thin_repair command.
|
||||
# thin_repair_options = [ "" ]
|
||||
|
||||
# Full path of the utility called to dump thin metadata content.
|
||||
# See thin_check_executable how to obtain binaries.
|
||||
#
|
||||
# thin_dump_executable = "@THIN_DUMP_CMD@"
|
||||
# String with options passed with thin_check command. By default,
|
||||
# option '-q' is for quiet output.
|
||||
thin_check_options = [ "-q" ]
|
||||
|
||||
# If set, given features are not used by thin driver.
|
||||
# This can be helpful not just for testing, but i.e. allows to avoid
|
||||
@@ -742,41 +571,8 @@ global {
|
||||
# block_size
|
||||
# discards
|
||||
# discards_non_power_2
|
||||
# external_origin
|
||||
# metadata_resize
|
||||
# external_origin_extend
|
||||
#
|
||||
# thin_disabled_features = [ "discards", "block_size" ]
|
||||
|
||||
# Full path of the utility called to check that a cache metadata device
|
||||
# is in a state that allows it to be used.
|
||||
# Each time a cached LV needs to be used or after it is deactivated
|
||||
# this utility is executed. The activation will only proceed if the utility
|
||||
# has an exit status of 0.
|
||||
# Set to "" to skip this check. (Not recommended.)
|
||||
# The cache tools are available as part of the device-mapper-persistent-data
|
||||
# package from https://github.com/jthornber/thin-provisioning-tools.
|
||||
#
|
||||
# cache_check_executable = "@CACHE_CHECK_CMD@"
|
||||
|
||||
# Array of string options passed with cache_check command. By default,
|
||||
# option "-q" is for quiet output.
|
||||
#
|
||||
# cache_check_options = [ "-q" ]
|
||||
|
||||
# Full path of the utility called to repair a cache metadata device.
|
||||
# Each time a cache metadata needs repair this utility is executed.
|
||||
# See cache_check_executable how to obtain binaries.
|
||||
#
|
||||
# cache_repair_executable = "@CACHE_REPAIR_CMD@"
|
||||
|
||||
# Array of extra string options passed with cache_repair command.
|
||||
# cache_repair_options = [ "" ]
|
||||
|
||||
# Full path of the utility called to dump cache metadata content.
|
||||
# See cache_check_executable how to obtain binaries.
|
||||
#
|
||||
# cache_dump_executable = "@CACHE_DUMP_CMD@"
|
||||
}
|
||||
|
||||
activation {
|
||||
@@ -898,15 +694,8 @@ activation {
|
||||
#
|
||||
# read_only_volume_list = [ "vg1", "vg2/lvol1", "@tag1", "@*" ]
|
||||
|
||||
# Each LV can have an 'activation skip' flag stored persistently against it.
|
||||
# During activation, this flag is used to decide whether such an LV is skipped.
|
||||
# The 'activation skip' flag can be set during LV creation and by default it
|
||||
# is automatically set for thin snapshot LVs. The 'auto_set_activation_skip'
|
||||
# enables or disables this automatic setting of the flag while LVs are created.
|
||||
# auto_set_activation_skip = 1
|
||||
|
||||
# For RAID or 'mirror' segment types, 'raid_region_size' is the
|
||||
# size (in KiB) of each:
|
||||
# size (in kiB) of each:
|
||||
# - synchronization operation when initializing
|
||||
# - each copy operation when performing a 'pvmove' (using 'mirror' segtype)
|
||||
# This setting has replaced 'mirror_region_size' since version 2.02.99
|
||||
@@ -1044,140 +833,8 @@ activation {
|
||||
# are no progress reports, but the process is awoken immediately the
|
||||
# operation is complete.
|
||||
polling_interval = 15
|
||||
|
||||
# 'activation_mode' determines how Logical Volumes are activated if
|
||||
# any devices are missing. Possible settings are:
|
||||
#
|
||||
# "complete" - Only allow activation of an LV if all of the Physical
|
||||
# Volumes it uses are present. Other PVs in the Volume
|
||||
# Group may be missing.
|
||||
#
|
||||
# "degraded" - Like "complete", but additionally RAID Logical Volumes of
|
||||
# segment type raid1, raid4, raid5, radid6 and raid10 will
|
||||
# be activated if there is no data loss, i.e. they have
|
||||
# sufficient redundancy to present the entire addressable
|
||||
# range of the Logical Volume.
|
||||
#
|
||||
# "partial" - Allows the activation of any Logical Volume even if
|
||||
# a missing or failed PV could cause data loss with a
|
||||
# portion of the Logical Volume inaccessible.
|
||||
# This setting should not normally be used, but may
|
||||
# sometimes assist with data recovery.
|
||||
#
|
||||
# This setting was introduced in LVM version 2.02.108. It corresponds
|
||||
# with the '--activationmode' option for lvchange and vgchange.
|
||||
activation_mode = "degraded"
|
||||
}
|
||||
|
||||
# Report settings.
|
||||
#
|
||||
# report {
|
||||
# Align columns on report output.
|
||||
# aligned=1
|
||||
|
||||
# When buffered reporting is used, the report's content is appended
|
||||
# incrementally to include each object being reported until the report
|
||||
# is flushed to output which normally happens at the end of command
|
||||
# execution. Otherwise, if buffering is not used, each object is
|
||||
# reported as soon as its processing is finished.
|
||||
# buffered=1
|
||||
|
||||
# Show headings for columns on report.
|
||||
# headings=1
|
||||
|
||||
# A separator to use on report after each field.
|
||||
# separator=" "
|
||||
|
||||
# A separator to use for list items when reported.
|
||||
# list_item_separator=","
|
||||
|
||||
# Use a field name prefix for each field reported.
|
||||
# prefixes=0
|
||||
|
||||
# Quote field values when using field name prefixes.
|
||||
# quoted=1
|
||||
|
||||
# Output each column as a row. If set, this also implies report/prefixes=1.
|
||||
# colums_as_rows=0
|
||||
|
||||
# Use binary values "0" or "1" instead of descriptive literal values for
|
||||
# columns that have exactly two valid values to report (not counting the
|
||||
# "unknown" value which denotes that the value could not be determined).
|
||||
#
|
||||
# binary_values_as_numeric = 0
|
||||
|
||||
# Comma separated list of columns to sort by when reporting 'lvm devtypes' command.
|
||||
# See 'lvm devtypes -o help' for the list of possible fields.
|
||||
# devtypes_sort="devtype_name"
|
||||
|
||||
# Comma separated list of columns to report for 'lvm devtypes' command.
|
||||
# See 'lvm devtypes -o help' for the list of possible fields.
|
||||
# devtypes_cols="devtype_name,devtype_max_partitions,devtype_description"
|
||||
|
||||
# Comma separated list of columns to report for 'lvm devtypes' command in verbose mode.
|
||||
# See 'lvm devtypes -o help' for the list of possible fields.
|
||||
# devtypes_cols_verbose="devtype_name,devtype_max_partitions,devtype_description"
|
||||
|
||||
# Comma separated list of columns to sort by when reporting 'lvs' command.
|
||||
# See 'lvs -o help' for the list of possible fields.
|
||||
# lvs_sort="vg_name,lv_name"
|
||||
|
||||
# Comma separated list of columns to report for 'lvs' command.
|
||||
# See 'lvs -o help' for the list of possible fields.
|
||||
# lvs_cols="lv_name,vg_name,lv_attr,lv_size,pool_lv,origin,data_percent,metadata_percent,move_pv,mirror_log,copy_percent,convert_lv"
|
||||
|
||||
# Comma separated list of columns to report for 'lvs' command in verbose mode.
|
||||
# See 'lvs -o help' for the list of possible fields.
|
||||
# lvs_cols_verbose="lv_name,vg_name,seg_count,lv_attr,lv_size,lv_major,lv_minor,lv_kernel_major,lv_kernel_minor,pool_lv,origin,data_percent,metadata_percent,move_pv,copy_percent,mirror_log,convert
|
||||
|
||||
# Comma separated list of columns to sort by when reporting 'vgs' command.
|
||||
# See 'vgs -o help' for the list of possible fields.
|
||||
# vgs_sort="vg_name"
|
||||
|
||||
# Comma separated list of columns to report for 'vgs' command.
|
||||
# See 'vgs -o help' for the list of possible fields.
|
||||
# vgs_cols="vg_name,pv_count,lv_count,snap_count,vg_attr,vg_size,vg_free"
|
||||
|
||||
# Comma separated list of columns to report for 'vgs' command in verbose mode.
|
||||
# See 'vgs -o help' for the list of possible fields.
|
||||
# vgs_cols_verbose="vg_name,vg_attr,vg_extent_size,pv_count,lv_count,snap_count,vg_size,vg_free,vg_uuid,vg_profile"
|
||||
|
||||
# Comma separated list of columns to sort by when reporting 'pvs' command.
|
||||
# See 'pvs -o help' for the list of possible fields.
|
||||
# pvs_sort="pv_name"
|
||||
|
||||
# Comma separated list of columns to report for 'pvs' command.
|
||||
# See 'pvs -o help' for the list of possible fields.
|
||||
# pvs_cols="pv_name,vg_name,pv_fmt,pv_attr,pv_size,pv_free"
|
||||
|
||||
# Comma separated list of columns to report for 'pvs' command in verbose mode.
|
||||
# See 'pvs -o help' for the list of possible fields.
|
||||
# pvs_cols_verbose="pv_name,vg_name,pv_fmt,pv_attr,pv_size,pv_free,dev_size,pv_uuid"
|
||||
|
||||
# Comma separated list of columns to sort by when reporting 'lvs --segments' command.
|
||||
# See 'lvs --segments -o help' for the list of possible fields.
|
||||
# segs_sort="vg_name,lv_name,seg_start"
|
||||
|
||||
# Comma separated list of columns to report for 'lvs --segments' command.
|
||||
# See 'lvs --segments -o help' for the list of possible fields.
|
||||
# segs_cols="lv_name,vg_name,lv_attr,stripes,segtype,seg_size"
|
||||
|
||||
# Comma separated list of columns to report for 'lvs --segments' command in verbose mode.
|
||||
# See 'lvs --segments -o help' for the list of possible fields.
|
||||
# segs_cols_verbose="lv_name,vg_name,lv_attr,seg_start,seg_size,stripes,segtype,stripesize,chunksize"
|
||||
|
||||
# Comma separated list of columns to sort by when reporting 'pvs --segments' command.
|
||||
# See 'pvs --segments -o help' for the list of possible fields.
|
||||
# pvsegs_sort="pv_name,pvseg_start"
|
||||
|
||||
# Comma separated list of columns to sort by when reporting 'pvs --segments' command.
|
||||
# See 'pvs --segments -o help' for the list of possible fields.
|
||||
# pvsegs_cols="pv_name,vg_name,pv_fmt,pv_attr,pv_size,pv_free,pvseg_start,pvseg_size"
|
||||
|
||||
# Comma separated list of columns to sort by when reporting 'pvs --segments' command in verbose mode.
|
||||
# See 'pvs --segments -o help' for the list of possible fields.
|
||||
# pvsegs_cols_verbose="pv_name,vg_name,pv_fmt,pv_attr,pv_size,pv_free,pvseg_start,pvseg_size,lv_name,seg_start_pe,segtype,seg_pe_ranges"
|
||||
#}
|
||||
|
||||
####################
|
||||
# Advanced section #
|
||||
@@ -6,17 +6,24 @@
|
||||
@top_srcdir@/lib/activate/targets.h
|
||||
@top_srcdir@/lib/cache/lvmcache.h
|
||||
@top_srcdir@/lib/cache/lvmetad.h
|
||||
@top_srcdir@/lib/commands/errors.h
|
||||
@top_srcdir@/lib/commands/toolcontext.h
|
||||
@top_srcdir@/lib/config/config.h
|
||||
@top_srcdir@/lib/config/config_settings.h
|
||||
@top_srcdir@/lib/config/defaults.h
|
||||
@top_srcdir@/lib/datastruct/btree.h
|
||||
@top_srcdir@/lib/datastruct/lvm-types.h
|
||||
@top_srcdir@/lib/datastruct/str_list.h
|
||||
@top_srcdir@/lib/device/dev-cache.h
|
||||
@top_srcdir@/lib/device/dev-type.h
|
||||
@top_srcdir@/lib/device/device.h
|
||||
@top_srcdir@/lib/device/device-types.h
|
||||
@top_srcdir@/lib/display/display.h
|
||||
@top_srcdir@/lib/filters/filter-composite.h
|
||||
@top_srcdir@/lib/filters/filter-md.h
|
||||
@top_srcdir@/lib/filters/filter-mpath.h
|
||||
@top_srcdir@/lib/filters/filter-persistent.h
|
||||
@top_srcdir@/lib/filters/filter-regex.h
|
||||
@top_srcdir@/lib/filters/filter-sysfs.h
|
||||
@top_srcdir@/lib/filters/filter.h
|
||||
@top_srcdir@/lib/format1/format1.h
|
||||
@top_srcdir@/lib/format_pool/format_pool.h
|
||||
@@ -41,20 +48,17 @@
|
||||
@top_builddir@/lib/misc/configure.h
|
||||
@top_srcdir@/lib/misc/crc.h
|
||||
@top_srcdir@/lib/misc/intl.h
|
||||
@top_srcdir@/lib/misc/util.h
|
||||
@top_srcdir@/lib/misc/last-path-component.h
|
||||
@top_srcdir@/lib/misc/lib.h
|
||||
@top_srcdir@/lib/misc/lvm-exec.h
|
||||
@top_srcdir@/lib/misc/lvm-file.h
|
||||
@top_srcdir@/lib/misc/lvm-flock.h
|
||||
@top_srcdir@/lib/misc/lvm-globals.h
|
||||
@top_srcdir@/lib/misc/lvm-signal.h
|
||||
@top_srcdir@/lib/misc/lvm-string.h
|
||||
@top_builddir@/lib/misc/lvm-version.h
|
||||
@top_srcdir@/lib/misc/lvm-percent.h
|
||||
@top_srcdir@/lib/misc/lvm-wrappers.h
|
||||
@top_srcdir@/lib/misc/lvm-percent.h
|
||||
@top_srcdir@/lib/misc/sharedlib.h
|
||||
@top_srcdir@/lib/misc/util.h
|
||||
@top_srcdir@/lib/properties/prop_common.h
|
||||
@top_srcdir@/lib/report/properties.h
|
||||
@top_srcdir@/lib/report/report.h
|
||||
@top_srcdir@/lib/uuid/uuid.h
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#
|
||||
# Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
# Copyright (C) 2004-2014 Red Hat, Inc. All rights reserved.
|
||||
# Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
# This file is part of LVM2.
|
||||
#
|
||||
@@ -44,10 +44,6 @@ ifeq ("@THIN@", "shared")
|
||||
SUBDIRS += thin
|
||||
endif
|
||||
|
||||
ifeq ("@CACHE@", "shared")
|
||||
SUBDIRS += cache_segtype
|
||||
endif
|
||||
|
||||
SOURCES =\
|
||||
activate/activate.c \
|
||||
cache/lvmcache.c \
|
||||
@@ -70,8 +66,7 @@ SOURCES =\
|
||||
filters/filter-sysfs.c \
|
||||
filters/filter-md.c \
|
||||
filters/filter-mpath.c \
|
||||
filters/filter-partitioned.c \
|
||||
filters/filter-type.c \
|
||||
filters/filter.c \
|
||||
format_text/archive.c \
|
||||
format_text/archiver.c \
|
||||
format_text/export.c \
|
||||
@@ -87,13 +82,11 @@ SOURCES =\
|
||||
locking/locking.c \
|
||||
locking/no_locking.c \
|
||||
log/log.c \
|
||||
metadata/cache_manip.c \
|
||||
metadata/lv.c \
|
||||
metadata/lv_manip.c \
|
||||
metadata/merge.c \
|
||||
metadata/metadata.c \
|
||||
metadata/mirror.c \
|
||||
metadata/pool_manip.c \
|
||||
metadata/pv.c \
|
||||
metadata/pv_manip.c \
|
||||
metadata/pv_map.c \
|
||||
@@ -106,14 +99,11 @@ SOURCES =\
|
||||
misc/crc.c \
|
||||
misc/lvm-exec.c \
|
||||
misc/lvm-file.c \
|
||||
misc/lvm-flock.c \
|
||||
misc/lvm-globals.c \
|
||||
misc/lvm-signal.c \
|
||||
misc/lvm-string.c \
|
||||
misc/lvm-wrappers.c \
|
||||
misc/lvm-percent.c \
|
||||
mm/memlock.c \
|
||||
properties/prop_common.c \
|
||||
report/properties.c \
|
||||
report/report.c \
|
||||
striped/striped.c \
|
||||
@@ -172,10 +162,6 @@ ifeq ("@THIN@", "internal")
|
||||
SOURCES += thin/thin.c
|
||||
endif
|
||||
|
||||
ifeq ("@CACHE@", "internal")
|
||||
SOURCES += cache_segtype/cache.c
|
||||
endif
|
||||
|
||||
ifeq ("@DEVMAPPER@", "yes")
|
||||
SOURCES +=\
|
||||
activate/dev_manager.c \
|
||||
@@ -210,7 +196,6 @@ ifeq ($(MAKECMDGOALS),distclean)
|
||||
raid \
|
||||
replicator \
|
||||
thin \
|
||||
cache_segtype \
|
||||
locking
|
||||
endif
|
||||
|
||||
@@ -219,8 +204,6 @@ CFLOW_LIST_TARGET = $(LIB_NAME).cflow
|
||||
|
||||
include $(top_builddir)/make.tmpl
|
||||
|
||||
CFLAGS += $(BLKID_CFLAGS) $(UDEV_CFLAGS)
|
||||
|
||||
$(SUBDIRS): $(LIB_STATIC)
|
||||
|
||||
DISTCLEAN_TARGETS += misc/configure.h misc/lvm-version.h
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -38,21 +38,23 @@ struct lv_activate_opts {
|
||||
int skip_in_use;
|
||||
unsigned revert;
|
||||
unsigned read_only;
|
||||
unsigned noscan; /* Mark this LV to avoid its scanning. This also
|
||||
directs udev to use proper udev flag to avoid
|
||||
any scanning in udev. This udev flag is automatically
|
||||
dropped in udev db on any spurious event that follows. */
|
||||
unsigned temporary; /* Mark this LV as temporary. It means, the LV
|
||||
* is created, used and deactivated within single
|
||||
* LVM command execution. Such LVs are mostly helper
|
||||
* LVs to do some action or cleanup before the proper
|
||||
* LV is created. This also directs udev to use proper
|
||||
* set of flags to avoid any scanning in udev. These udev
|
||||
* flags are persistent in udev db for any spurious event
|
||||
* that follows. */
|
||||
};
|
||||
|
||||
void set_activation(int activation, int silent);
|
||||
/* target attribute flags */
|
||||
#define MIRROR_LOG_CLUSTERED 0x00000001U
|
||||
|
||||
/* thin target attribute flags */
|
||||
enum {
|
||||
/* bitfields - new features from 1.1 version */
|
||||
THIN_FEATURE_DISCARDS = (1 << 0),
|
||||
THIN_FEATURE_EXTERNAL_ORIGIN = (1 << 1),
|
||||
THIN_FEATURE_HELD_ROOT = (1 << 2),
|
||||
THIN_FEATURE_BLOCK_SIZE = (1 << 3),
|
||||
THIN_FEATURE_DISCARDS_NON_POWER_2 = (1 << 4),
|
||||
THIN_FEATURE_METADATA_RESIZE = (1 << 5),
|
||||
};
|
||||
|
||||
void set_activation(int activation);
|
||||
int activation(void);
|
||||
|
||||
int driver_version(char *version, size_t size);
|
||||
@@ -78,10 +80,9 @@ int lv_suspend_if_active(struct cmd_context *cmd, const char *lvid_s, unsigned o
|
||||
int lv_resume(struct cmd_context *cmd, const char *lvid_s, unsigned origin_only, struct logical_volume *lv);
|
||||
int lv_resume_if_active(struct cmd_context *cmd, const char *lvid_s,
|
||||
unsigned origin_only, unsigned exclusive, unsigned revert, struct logical_volume *lv);
|
||||
int lv_activate(struct cmd_context *cmd, const char *lvid_s, int exclusive,
|
||||
int noscan, int temporary, struct logical_volume *lv);
|
||||
int lv_activate_with_filter(struct cmd_context *cmd, const char *lvid_s, int exclusive,
|
||||
int noscan, int temporary, struct logical_volume *lv);
|
||||
int lv_activate(struct cmd_context *cmd, const char *lvid_s, int exclusive, struct logical_volume *lv);
|
||||
int lv_activate_with_filter(struct cmd_context *cmd, const char *lvid_s,
|
||||
int exclusive, struct logical_volume *lv);
|
||||
int lv_deactivate(struct cmd_context *cmd, const char *lvid_s, struct logical_volume *lv);
|
||||
|
||||
int lv_mknodes(struct cmd_context *cmd, const struct logical_volume *lv);
|
||||
@@ -112,27 +113,20 @@ int lv_check_transient(struct logical_volume *lv);
|
||||
/*
|
||||
* Returns 1 if percent has been set, else 0.
|
||||
*/
|
||||
int lv_snapshot_percent(const struct logical_volume *lv, dm_percent_t *percent);
|
||||
int lv_snapshot_percent(const struct logical_volume *lv, percent_t *percent);
|
||||
int lv_mirror_percent(struct cmd_context *cmd, const struct logical_volume *lv,
|
||||
int wait, dm_percent_t *percent, uint32_t *event_nr);
|
||||
int lv_raid_percent(const struct logical_volume *lv, dm_percent_t *percent);
|
||||
int wait, percent_t *percent, uint32_t *event_nr);
|
||||
int lv_raid_percent(const struct logical_volume *lv, percent_t *percent);
|
||||
int lv_raid_dev_health(const struct logical_volume *lv, char **dev_health);
|
||||
int lv_raid_mismatch_count(const struct logical_volume *lv, uint64_t *cnt);
|
||||
int lv_raid_sync_action(const struct logical_volume *lv, char **sync_action);
|
||||
int lv_raid_message(const struct logical_volume *lv, const char *msg);
|
||||
int lv_cache_block_info(struct logical_volume *lv,
|
||||
uint32_t *chunk_size, uint64_t *dirty_count,
|
||||
uint64_t *used_count, uint64_t *total_count);
|
||||
int lv_cache_policy_info(struct logical_volume *lv,
|
||||
const char **policy_name, int *policy_argc,
|
||||
const char ***policy_argv);
|
||||
int lv_thin_pool_percent(const struct logical_volume *lv, int metadata,
|
||||
dm_percent_t *percent);
|
||||
percent_t *percent);
|
||||
int lv_thin_percent(const struct logical_volume *lv, int mapped,
|
||||
dm_percent_t *percent);
|
||||
percent_t *percent);
|
||||
int lv_thin_pool_transaction_id(const struct logical_volume *lv,
|
||||
uint64_t *transaction_id);
|
||||
int lv_thin_device_id(const struct logical_volume *lv, uint32_t *device_id);
|
||||
|
||||
/*
|
||||
* Return number of LVs in the VG that are active.
|
||||
@@ -173,18 +167,10 @@ int pv_uses_vg(struct physical_volume *pv,
|
||||
struct volume_group *vg);
|
||||
|
||||
/*
|
||||
* Returns 1 if mapped device is not suspended, blocked or
|
||||
* is using a reserved name.
|
||||
* Returns 1 if mapped device is not suspended.
|
||||
*/
|
||||
int device_is_usable(struct device *dev);
|
||||
|
||||
/*
|
||||
* Returns 1 if the device is suspended or blocking.
|
||||
* (Does not perform check on the LV name of the device.)
|
||||
* N.B. This is !device_is_usable() without the name check.
|
||||
*/
|
||||
int device_is_suspended_or_blocking(struct device *dev);
|
||||
|
||||
/*
|
||||
* Declaration moved here from fs.h to keep header fs.h hidden
|
||||
*/
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -50,32 +50,26 @@ int dev_manager_info(struct dm_pool *mem, const struct logical_volume *lv,
|
||||
struct dm_info *info, uint32_t *read_ahead);
|
||||
int dev_manager_snapshot_percent(struct dev_manager *dm,
|
||||
const struct logical_volume *lv,
|
||||
dm_percent_t *percent);
|
||||
percent_t *percent);
|
||||
int dev_manager_mirror_percent(struct dev_manager *dm,
|
||||
const struct logical_volume *lv, int wait,
|
||||
dm_percent_t *percent, uint32_t *event_nr);
|
||||
percent_t *percent, uint32_t *event_nr);
|
||||
int dev_manager_raid_status(struct dev_manager *dm,
|
||||
const struct logical_volume *lv,
|
||||
struct dm_status_raid **status);
|
||||
int dev_manager_raid_message(struct dev_manager *dm,
|
||||
const struct logical_volume *lv,
|
||||
const char *msg);
|
||||
int dev_manager_cache_status(struct dev_manager *dm,
|
||||
const struct logical_volume *lv,
|
||||
struct dm_status_cache **status);
|
||||
int dev_manager_thin_pool_status(struct dev_manager *dm,
|
||||
const struct logical_volume *lv,
|
||||
struct dm_status_thin_pool **status,
|
||||
int noflush);
|
||||
int dev_manager_thin_pool_percent(struct dev_manager *dm,
|
||||
const struct logical_volume *lv,
|
||||
int metadata, dm_percent_t *percent);
|
||||
int metadata, percent_t *percent);
|
||||
int dev_manager_thin_percent(struct dev_manager *dm,
|
||||
const struct logical_volume *lv,
|
||||
int mapped, dm_percent_t *percent);
|
||||
int dev_manager_thin_device_id(struct dev_manager *dm,
|
||||
const struct logical_volume *lv,
|
||||
uint32_t *device_id);
|
||||
int mapped, percent_t *percent);
|
||||
int dev_manager_suspend(struct dev_manager *dm, struct logical_volume *lv,
|
||||
struct lv_activate_opts *laopts, int lockfs, int flush_required);
|
||||
int dev_manager_activate(struct dev_manager *dm, struct logical_volume *lv,
|
||||
|
||||
61
lib/cache/lvmcache.c
vendored
61
lib/cache/lvmcache.c
vendored
@@ -64,7 +64,6 @@ struct lvmcache_vginfo {
|
||||
unsigned holders;
|
||||
unsigned vg_use_count; /* Counter of vg reusage */
|
||||
unsigned precommitted; /* Is vgmetadata live or precommitted? */
|
||||
unsigned cached_vg_invalidated; /* Signal to regenerate cached_vg */
|
||||
};
|
||||
|
||||
static struct dm_hash_table *_pvid_hash = NULL;
|
||||
@@ -264,9 +263,9 @@ static void _drop_metadata(const char *vgname, int drop_precommitted)
|
||||
}
|
||||
|
||||
/*
|
||||
* Remote node uses this to upgrade precommitted metadata to commited state
|
||||
* Remote node uses this to upgrade precommited metadata to commited state
|
||||
* when receives vg_commit notification.
|
||||
* (Note that devices can be suspended here, if so, precommitted metadata are already read.)
|
||||
* (Note that devices can be suspended here, if so, precommited metadata are already read.)
|
||||
*/
|
||||
void lvmcache_commit_metadata(const char *vgname)
|
||||
{
|
||||
@@ -429,15 +428,11 @@ struct lvmcache_vginfo *lvmcache_vginfo_from_vgname(const char *vgname, const ch
|
||||
if (!vgname)
|
||||
return lvmcache_vginfo_from_vgid(vgid);
|
||||
|
||||
if (!_vgname_hash) {
|
||||
log_debug_cache(INTERNAL_ERROR "Internal cache is no yet initialized.");
|
||||
if (!_vgname_hash)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!(vginfo = dm_hash_lookup(_vgname_hash, vgname))) {
|
||||
log_debug_cache("Metadata cache has no info for vgname: \"%s\"", vgname);
|
||||
if (!(vginfo = dm_hash_lookup(_vgname_hash, vgname)))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (vgid)
|
||||
do
|
||||
@@ -445,10 +440,6 @@ struct lvmcache_vginfo *lvmcache_vginfo_from_vgname(const char *vgname, const ch
|
||||
return vginfo;
|
||||
while ((vginfo = vginfo->next));
|
||||
|
||||
if (!vginfo)
|
||||
log_debug_cache("Metadata cache has not found vgname \"%s\" with vgid \"%."
|
||||
DM_TO_STRING(ID_LEN) "s\".", vgname, vgid ? : "");
|
||||
|
||||
return vginfo;
|
||||
}
|
||||
|
||||
@@ -522,19 +513,15 @@ struct lvmcache_vginfo *lvmcache_vginfo_from_vgid(const char *vgid)
|
||||
struct lvmcache_vginfo *vginfo;
|
||||
char id[ID_LEN + 1] __attribute__((aligned(8)));
|
||||
|
||||
if (!_vgid_hash || !vgid) {
|
||||
log_debug_cache(INTERNAL_ERROR "Internal cache cannot lookup vgid.");
|
||||
if (!_vgid_hash || !vgid)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* vgid not necessarily NULL-terminated */
|
||||
strncpy(&id[0], vgid, ID_LEN);
|
||||
id[ID_LEN] = '\0';
|
||||
|
||||
if (!(vginfo = dm_hash_lookup(_vgid_hash, id))) {
|
||||
log_debug_cache("Metadata cache has no info for vgid \"%s\"", id);
|
||||
if (!(vginfo = dm_hash_lookup(_vgid_hash, id)))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return vginfo;
|
||||
}
|
||||
@@ -776,11 +763,9 @@ struct volume_group *lvmcache_get_vg(struct cmd_context *cmd, const char *vgname
|
||||
return NULL;
|
||||
|
||||
/* Use already-cached VG struct when available */
|
||||
if ((vg = vginfo->cached_vg) && !vginfo->cached_vg_invalidated)
|
||||
if ((vg = vginfo->cached_vg))
|
||||
goto out;
|
||||
|
||||
release_vg(vginfo->cached_vg);
|
||||
|
||||
fic.type = FMT_INSTANCE_MDAS | FMT_INSTANCE_AUX_MDAS;
|
||||
fic.context.vg_ref.vg_name = vginfo->vgname;
|
||||
fic.context.vg_ref.vg_id = vgid;
|
||||
@@ -800,7 +785,6 @@ struct volume_group *lvmcache_get_vg(struct cmd_context *cmd, const char *vgname
|
||||
vginfo->cached_vg = vg;
|
||||
vginfo->holders = 1;
|
||||
vginfo->vg_use_count = 0;
|
||||
vginfo->cached_vg_invalidated = 0;
|
||||
vg->vginfo = vginfo;
|
||||
|
||||
if (!dm_pool_lock(vg->vgmem, detect_internal_vg_cache_corruption()))
|
||||
@@ -1062,6 +1046,7 @@ static int _drop_vginfo(struct lvmcache_info *info, struct lvmcache_vginfo *vgin
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Unused
|
||||
void lvmcache_del(struct lvmcache_info *info)
|
||||
{
|
||||
if (info->dev->pvid[0] && _pvid_hash)
|
||||
@@ -1070,11 +1055,11 @@ void lvmcache_del(struct lvmcache_info *info)
|
||||
_drop_vginfo(info, info->vginfo);
|
||||
|
||||
info->label->labeller->ops->destroy_label(info->label->labeller,
|
||||
info->label);
|
||||
info->label);
|
||||
dm_free(info);
|
||||
|
||||
return;
|
||||
}
|
||||
} */
|
||||
|
||||
static int _lvmcache_update_pvid(struct lvmcache_info *info, const char *pvid)
|
||||
{
|
||||
@@ -1422,12 +1407,6 @@ int lvmcache_update_vgname_and_id(struct lvmcache_info *info,
|
||||
!is_orphan_vg(info->vginfo->vgname) && critical_section())
|
||||
return 1;
|
||||
|
||||
/* If making a PV into an orphan, any cached VG metadata may become
|
||||
* invalid, incorrectly still referencing device structs.
|
||||
* (Example: pvcreate -ff) */
|
||||
if (is_orphan_vg(vgname) && info->vginfo && !is_orphan_vg(info->vginfo->vgname))
|
||||
info->vginfo->cached_vg_invalidated = 1;
|
||||
|
||||
/* If moving PV from orphan to real VG, always mark it valid */
|
||||
if (!is_orphan_vg(vgname))
|
||||
info->status &= ~CACHE_INVALID;
|
||||
@@ -1471,7 +1450,7 @@ struct lvmcache_info *lvmcache_add(struct labeller *labeller, const char *pvid,
|
||||
const char *vgname, const char *vgid,
|
||||
uint32_t vgstatus)
|
||||
{
|
||||
const struct format_type *fmt = labeller->fmt;
|
||||
const struct format_type *fmt = (const struct format_type *) labeller->private;
|
||||
struct dev_types *dt = fmt->cmd->dev_types;
|
||||
struct label *label;
|
||||
struct lvmcache_info *existing, *info;
|
||||
@@ -1561,7 +1540,7 @@ struct lvmcache_info *lvmcache_add(struct labeller *labeller, const char *pvid,
|
||||
label = info->label;
|
||||
}
|
||||
|
||||
info->fmt = labeller->fmt;
|
||||
info->fmt = (const struct format_type *) labeller->private;
|
||||
info->status |= CACHE_INVALID;
|
||||
|
||||
if (!_lvmcache_update_pvid(info, pvid_s)) {
|
||||
@@ -1588,7 +1567,7 @@ struct lvmcache_info *lvmcache_add(struct labeller *labeller, const char *pvid,
|
||||
static void _lvmcache_destroy_entry(struct lvmcache_info *info)
|
||||
{
|
||||
_vginfo_detach_info(info);
|
||||
info->dev->pvid[0] = 0;
|
||||
strcpy(info->dev->pvid, "");
|
||||
label_destroy(info->label);
|
||||
dm_free(info);
|
||||
}
|
||||
@@ -1620,7 +1599,7 @@ static void _lvmcache_destroy_lockname(struct dm_hash_node *n)
|
||||
dm_hash_get_key(_lock_hash, n));
|
||||
}
|
||||
|
||||
void lvmcache_destroy(struct cmd_context *cmd, int retain_orphans, int reset)
|
||||
void lvmcache_destroy(struct cmd_context *cmd, int retain_orphans)
|
||||
{
|
||||
struct dm_hash_node *n;
|
||||
log_verbose("Wiping internal VG cache");
|
||||
@@ -1646,11 +1625,8 @@ void lvmcache_destroy(struct cmd_context *cmd, int retain_orphans, int reset)
|
||||
}
|
||||
|
||||
if (_lock_hash) {
|
||||
if (reset)
|
||||
_vg_global_lock_held = 0;
|
||||
else
|
||||
dm_hash_iterate(n, _lock_hash)
|
||||
_lvmcache_destroy_lockname(n);
|
||||
dm_hash_iterate(n, _lock_hash)
|
||||
_lvmcache_destroy_lockname(n);
|
||||
dm_hash_destroy(_lock_hash);
|
||||
_lock_hash = NULL;
|
||||
}
|
||||
@@ -1707,7 +1683,7 @@ static int _get_pv_if_in_vg(struct lvmcache_info *info,
|
||||
* lvmcache_label_scan() and drop cached
|
||||
* vginfo so make a local copy of string.
|
||||
*/
|
||||
(void) dm_strncpy(vgname, info->vginfo->vgname, sizeof(vgname));
|
||||
strcpy(vgname, info->vginfo->vgname);
|
||||
memcpy(vgid, info->vginfo->vgid, sizeof(vgid));
|
||||
|
||||
if (get_pv_from_vg_by_id(info->fmt, vgname, vgid,
|
||||
@@ -1972,9 +1948,6 @@ int lvmcache_uncertain_ownership(struct lvmcache_info *info) {
|
||||
|
||||
uint64_t lvmcache_smallest_mda_size(struct lvmcache_info *info)
|
||||
{
|
||||
if (!info)
|
||||
return UINT64_C(0);
|
||||
|
||||
return find_min_mda_size(&info->mdas);
|
||||
}
|
||||
|
||||
|
||||
8
lib/cache/lvmcache.h
vendored
8
lib/cache/lvmcache.h
vendored
@@ -42,7 +42,7 @@ struct lvmcache_vginfo;
|
||||
int lvmcache_init(void);
|
||||
void lvmcache_allow_reads_with_lvmetad(void);
|
||||
|
||||
void lvmcache_destroy(struct cmd_context *cmd, int retain_orphans, int reset);
|
||||
void lvmcache_destroy(struct cmd_context *cmd, int retain_orphans);
|
||||
|
||||
/* Set full_scan to 1 to reread every filtered device label or
|
||||
* 2 to rescan /dev for new devices */
|
||||
@@ -88,17 +88,17 @@ int lvmcache_vgname_is_locked(const char *vgname);
|
||||
|
||||
void lvmcache_seed_infos_from_lvmetad(struct cmd_context *cmd);
|
||||
|
||||
/* Returns list of struct dm_str_list containing pool-allocated copy of vgnames */
|
||||
/* Returns list of struct str_lists containing pool-allocated copy of vgnames */
|
||||
/* If include_internal is not set, return only proper vg names. */
|
||||
struct dm_list *lvmcache_get_vgnames(struct cmd_context *cmd,
|
||||
int include_internal);
|
||||
|
||||
/* Returns list of struct dm_str_list containing pool-allocated copy of vgids */
|
||||
/* Returns list of struct str_lists containing pool-allocated copy of vgids */
|
||||
/* If include_internal is not set, return only proper vg ids. */
|
||||
struct dm_list *lvmcache_get_vgids(struct cmd_context *cmd,
|
||||
int include_internal);
|
||||
|
||||
/* Returns list of struct dm_str_list containing pool-allocated copy of pvids */
|
||||
/* Returns list of struct str_lists containing pool-allocated copy of pvids */
|
||||
struct dm_list *lvmcache_get_pvids(struct cmd_context *cmd, const char *vgname,
|
||||
const char *vgid);
|
||||
|
||||
|
||||
155
lib/cache/lvmetad.c
vendored
155
lib/cache/lvmetad.c
vendored
@@ -21,12 +21,8 @@
|
||||
#include "lvmetad-client.h"
|
||||
#include "format-text.h" // TODO for disk_locn, used as a DA representation
|
||||
#include "crc.h"
|
||||
#include "lvm-signal.h"
|
||||
|
||||
#define SCAN_TIMEOUT_SECONDS 80
|
||||
#define MAX_RESCANS 10 /* Maximum number of times to scan all PVs and retry if the daemon returns a token mismatch error */
|
||||
|
||||
static daemon_handle _lvmetad = { .error = 0 };
|
||||
static daemon_handle _lvmetad;
|
||||
static int _lvmetad_use = 0;
|
||||
static int _lvmetad_connected = 0;
|
||||
|
||||
@@ -44,7 +40,7 @@ void lvmetad_disconnect(void)
|
||||
|
||||
void lvmetad_init(struct cmd_context *cmd)
|
||||
{
|
||||
if (!_lvmetad_use && !access(getenv("LVM_LVMETAD_PIDFILE") ? : LVMETAD_PIDFILE, F_OK))
|
||||
if (!_lvmetad_use && !access(LVMETAD_PIDFILE, F_OK))
|
||||
log_warn("WARNING: lvmetad is running but disabled."
|
||||
" Restart lvmetad before enabling it!");
|
||||
_lvmetad_cmd = cmd;
|
||||
@@ -68,41 +64,31 @@ void lvmetad_connect_or_warn(void)
|
||||
if (!_lvmetad_use)
|
||||
return;
|
||||
|
||||
if (!_lvmetad_connected && !_lvmetad.error) {
|
||||
if (!_lvmetad_connected)
|
||||
_lvmetad_connect();
|
||||
|
||||
if ((_lvmetad.socket_fd < 0 || _lvmetad.error))
|
||||
log_warn("WARNING: Failed to connect to lvmetad. Falling back to internal scanning.");
|
||||
}
|
||||
}
|
||||
|
||||
int lvmetad_used(void)
|
||||
{
|
||||
return _lvmetad_use;
|
||||
}
|
||||
|
||||
int lvmetad_socket_present(void)
|
||||
{
|
||||
const char *socket = _lvmetad_socket ?: LVMETAD_SOCKET;
|
||||
int r;
|
||||
|
||||
if ((r = access(socket, F_OK)) && errno != ENOENT)
|
||||
log_sys_error("lvmetad_socket_present", "");
|
||||
|
||||
return !r;
|
||||
if ((_lvmetad.socket_fd < 0 || _lvmetad.error))
|
||||
log_warn("WARNING: Failed to connect to lvmetad: %s. Falling back to internal scanning.",
|
||||
strerror(_lvmetad.error));
|
||||
}
|
||||
|
||||
int lvmetad_active(void)
|
||||
{
|
||||
lvmetad_connect_or_warn();
|
||||
if (!_lvmetad_use)
|
||||
return 0;
|
||||
|
||||
if (!_lvmetad_connected)
|
||||
_lvmetad_connect();
|
||||
|
||||
if ((_lvmetad.socket_fd < 0 || _lvmetad.error))
|
||||
log_debug_lvmetad("Failed to connect to lvmetad: %s.", strerror(_lvmetad.error));
|
||||
|
||||
return _lvmetad_connected;
|
||||
}
|
||||
|
||||
void lvmetad_set_active(int active)
|
||||
{
|
||||
_lvmetad_use = active;
|
||||
if (!active && lvmetad_active())
|
||||
lvmetad_disconnect();
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -112,14 +98,15 @@ void lvmetad_set_token(const struct dm_config_value *filter)
|
||||
{
|
||||
int ft = 0;
|
||||
|
||||
dm_free(_lvmetad_token);
|
||||
if (_lvmetad_token)
|
||||
dm_free(_lvmetad_token);
|
||||
|
||||
while (filter && filter->type == DM_CFG_STRING) {
|
||||
ft = calc_crc(ft, (const uint8_t *) filter->v.str, strlen(filter->v.str));
|
||||
filter = filter->next;
|
||||
}
|
||||
|
||||
if (dm_asprintf(&_lvmetad_token, "filter:%u", ft) < 0)
|
||||
if (!dm_asprintf(&_lvmetad_token, "filter:%u", ft))
|
||||
log_warn("WARNING: Failed to set lvmetad token. Out of memory?");
|
||||
}
|
||||
|
||||
@@ -139,10 +126,7 @@ static daemon_reply _lvmetad_send(const char *id, ...)
|
||||
va_list ap;
|
||||
daemon_reply repl;
|
||||
daemon_request req;
|
||||
unsigned num_rescans = 0;
|
||||
unsigned total_usecs_waited = 0;
|
||||
unsigned max_remaining_sleep_times = 1;
|
||||
unsigned wait_usecs;
|
||||
int try = 0;
|
||||
|
||||
retry:
|
||||
req = daemon_request_make(id);
|
||||
@@ -158,35 +142,13 @@ retry:
|
||||
|
||||
daemon_request_destroy(req);
|
||||
|
||||
/*
|
||||
* If another process is trying to scan, it might have the
|
||||
* same future token id and it's better to wait and avoid doing
|
||||
* the work multiple times. For the case where the future token is
|
||||
* different, the wait is randomized so that multiple waiting
|
||||
* processes do not start scanning all at once.
|
||||
*
|
||||
* If the token is mismatched because of global_filter changes,
|
||||
* we re-scan immediately, but if we lose the potential race for
|
||||
* the update, we back off for a short while (0.05-0.5 seconds) and
|
||||
* try again.
|
||||
*/
|
||||
if (!repl.error && !strcmp(daemon_reply_str(repl, "response", ""), "token_mismatch") &&
|
||||
num_rescans < MAX_RESCANS && total_usecs_waited < (SCAN_TIMEOUT_SECONDS * 1000000) && !test_mode()) {
|
||||
if (!strcmp(daemon_reply_str(repl, "expected", ""), "update in progress") ||
|
||||
max_remaining_sleep_times) {
|
||||
wait_usecs = 50000 + lvm_even_rand(&_lvmetad_cmd->rand_seed, 450000); /* between 0.05s and 0.5s */
|
||||
(void) usleep(wait_usecs);
|
||||
total_usecs_waited += wait_usecs;
|
||||
if (max_remaining_sleep_times)
|
||||
max_remaining_sleep_times--; /* Sleep once before rescanning the first time, then 5 times each time after that. */
|
||||
} else {
|
||||
/* If the re-scan fails here, we try again later. */
|
||||
(void) lvmetad_pvscan_all_devs(_lvmetad_cmd, NULL);
|
||||
num_rescans++;
|
||||
max_remaining_sleep_times = 5;
|
||||
try < 2 && !test_mode()) {
|
||||
if (lvmetad_pvscan_all_devs(_lvmetad_cmd, NULL)) {
|
||||
++ try;
|
||||
daemon_reply_destroy(repl);
|
||||
goto retry;
|
||||
}
|
||||
daemon_reply_destroy(repl);
|
||||
goto retry;
|
||||
}
|
||||
|
||||
return repl;
|
||||
@@ -260,9 +222,8 @@ static int _read_mda(struct lvmcache_info *info,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct lvmcache_info *_pv_populate_lvmcache(struct cmd_context *cmd,
|
||||
struct dm_config_node *cn,
|
||||
dev_t fallback)
|
||||
static struct lvmcache_info *_pv_populate_lvmcache(
|
||||
struct cmd_context *cmd, struct dm_config_node *cn, dev_t fallback)
|
||||
{
|
||||
struct device *dev;
|
||||
struct id pvid, vgid;
|
||||
@@ -293,11 +254,7 @@ static struct lvmcache_info *_pv_populate_lvmcache(struct cmd_context *cmd,
|
||||
dev = dev_cache_get_by_devt(fallback, cmd->filter);
|
||||
|
||||
if (!dev) {
|
||||
dev = dev_cache_get_by_devt(devt, cmd->lvmetad_filter);
|
||||
if (!dev)
|
||||
log_error("No device found for PV %s.", pvid_txt);
|
||||
else
|
||||
log_warn("WARNING: Device %s for PV %s rejected by a filter.", dev_name(dev), pvid_txt);
|
||||
log_error("No device found for PV %s.", pvid_txt);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -320,7 +277,6 @@ static struct lvmcache_info *_pv_populate_lvmcache(struct cmd_context *cmd,
|
||||
return_NULL;
|
||||
|
||||
lvmcache_get_label(info)->sector = label_sector;
|
||||
lvmcache_get_label(info)->dev = dev;
|
||||
lvmcache_set_device_size(info, devsize);
|
||||
lvmcache_del_das(info);
|
||||
lvmcache_del_mdas(info);
|
||||
@@ -348,7 +304,7 @@ static struct lvmcache_info *_pv_populate_lvmcache(struct cmd_context *cmd,
|
||||
|
||||
i = 0;
|
||||
do {
|
||||
sprintf(da_id, "ba%d", i);
|
||||
sprintf(da_id, "ea%d", i);
|
||||
da = dm_config_find_node(cn->child, da_id);
|
||||
if (da) {
|
||||
if (!dm_config_get_uint64(da->child, "offset", &offset)) return_0;
|
||||
@@ -367,7 +323,7 @@ struct volume_group *lvmetad_vg_lookup(struct cmd_context *cmd, const char *vgna
|
||||
daemon_reply reply;
|
||||
int found;
|
||||
char uuid[64];
|
||||
struct format_instance *fid = NULL;
|
||||
struct format_instance *fid;
|
||||
struct format_instance_ctx fic;
|
||||
struct dm_config_node *top;
|
||||
const char *name, *diag_name;
|
||||
@@ -436,6 +392,8 @@ struct volume_group *lvmetad_vg_lookup(struct cmd_context *cmd, const char *vgna
|
||||
pvl->pv->dev = lvmcache_device(info);
|
||||
if (!pvl->pv->dev)
|
||||
pvl->pv->status |= MISSING_PV;
|
||||
else
|
||||
check_reappeared_pv(vg, pvl->pv);
|
||||
if (!lvmcache_fid_add_mdas_pv(info, fid)) {
|
||||
vg = NULL;
|
||||
goto_out; /* FIXME error path */
|
||||
@@ -449,8 +407,6 @@ struct volume_group *lvmetad_vg_lookup(struct cmd_context *cmd, const char *vgna
|
||||
}
|
||||
|
||||
out:
|
||||
if (!vg && fid)
|
||||
fid->fmt->ops->destroy_instance(fid);
|
||||
daemon_reply_destroy(reply);
|
||||
|
||||
return vg;
|
||||
@@ -479,6 +435,7 @@ int lvmetad_vg_update(struct volume_group *vg)
|
||||
struct pv_list *pvl;
|
||||
struct lvmcache_info *info;
|
||||
struct _fixup_baton baton;
|
||||
struct dm_config_tree *vgmeta;
|
||||
|
||||
if (!vg)
|
||||
return 0;
|
||||
@@ -486,14 +443,13 @@ int lvmetad_vg_update(struct volume_group *vg)
|
||||
if (!lvmetad_active() || test_mode())
|
||||
return 1; /* fake it */
|
||||
|
||||
if (!vg->cft_precommitted) {
|
||||
log_error(INTERNAL_ERROR "VG update without precommited");
|
||||
return 0;
|
||||
}
|
||||
if (!(vgmeta = export_vg_to_config_tree(vg)))
|
||||
return_0;
|
||||
|
||||
log_debug_lvmetad("Sending lvmetad updated metadata for VG %s (seqno %" PRIu32 ")", vg->name, vg->seqno);
|
||||
reply = _lvmetad_send("vg_update", "vgname = %s", vg->name,
|
||||
"metadata = %t", vg->cft_precommitted, NULL);
|
||||
"metadata = %t", vgmeta, NULL);
|
||||
dm_config_destroy(vgmeta);
|
||||
|
||||
if (!_lvmetad_handle_reply(reply, "update VG", vg->name, NULL)) {
|
||||
daemon_reply_destroy(reply);
|
||||
@@ -760,8 +716,7 @@ int lvmetad_pv_found(const struct id *pvid, struct device *dev, const struct for
|
||||
daemon_reply reply;
|
||||
struct lvmcache_info *info;
|
||||
struct dm_config_tree *pvmeta, *vgmeta;
|
||||
const char *status, *vgname, *vgid;
|
||||
int64_t changed;
|
||||
const char *status, *vgid;
|
||||
int result;
|
||||
|
||||
if (!lvmetad_active() || test_mode())
|
||||
@@ -830,13 +785,11 @@ int lvmetad_pv_found(const struct id *pvid, struct device *dev, const struct for
|
||||
|
||||
if (result && handler) {
|
||||
status = daemon_reply_str(reply, "status", "<missing>");
|
||||
vgname = daemon_reply_str(reply, "vgname", "<missing>");
|
||||
vgid = daemon_reply_str(reply, "vgid", "<missing>");
|
||||
changed = daemon_reply_int(reply, "changed", 0);
|
||||
if (!strcmp(status, "partial"))
|
||||
handler(_lvmetad_cmd, vgname, vgid, 1, changed, CHANGE_AAY);
|
||||
handler(_lvmetad_cmd, vgid, 1, CHANGE_AAY);
|
||||
else if (!strcmp(status, "complete"))
|
||||
handler(_lvmetad_cmd, vgname, vgid, 0, changed, CHANGE_AAY);
|
||||
handler(_lvmetad_cmd, vgid, 0, CHANGE_AAY);
|
||||
else if (!strcmp(status, "orphan"))
|
||||
;
|
||||
else
|
||||
@@ -928,28 +881,18 @@ int lvmetad_pvscan_single(struct cmd_context *cmd, struct device *dev,
|
||||
info = (struct lvmcache_info *) label->info;
|
||||
|
||||
baton.vg = NULL;
|
||||
baton.fid = lvmcache_fmt(info)->ops->create_instance(lvmcache_fmt(info), &fic);
|
||||
baton.fid = lvmcache_fmt(info)->ops->create_instance(lvmcache_fmt(info),
|
||||
&fic);
|
||||
|
||||
if (!baton.fid)
|
||||
goto_bad;
|
||||
|
||||
if (baton.fid->fmt->features & FMT_OBSOLETE) {
|
||||
log_error("WARNING: Ignoring obsolete format of metadata (%s) on device %s when using lvmetad",
|
||||
baton.fid->fmt->name, dev_name(dev));
|
||||
lvmcache_fmt(info)->ops->destroy_instance(baton.fid);
|
||||
return 0;
|
||||
}
|
||||
|
||||
lvmcache_foreach_mda(info, _lvmetad_pvscan_single, &baton);
|
||||
|
||||
/*
|
||||
* LVM1 VGs have no MDAs and lvmcache_foreach_mda isn't worth fixing
|
||||
* to use pseudo-mdas for PVs.
|
||||
* Note that the single_device parameter also gets ignored and this code
|
||||
* can scan further devices.
|
||||
*/
|
||||
if (!baton.vg && !(baton.fid->fmt->features & FMT_MDAS))
|
||||
baton.vg = ((struct metadata_area *) dm_list_first(&baton.fid->metadata_areas_in_use))->ops->vg_read(baton.fid, lvmcache_vgname_from_info(info), NULL, 1);
|
||||
/* LVM1 VGs have no MDAs. */
|
||||
if (!baton.vg && lvmcache_fmt(info) == get_format_by_name(cmd, "lvm1"))
|
||||
baton.vg = ((struct metadata_area *) dm_list_first(&baton.fid->metadata_areas_in_use))->
|
||||
ops->vg_read(baton.fid, lvmcache_vgname_from_info(info), NULL, 0);
|
||||
|
||||
if (!baton.vg)
|
||||
lvmcache_fmt(info)->ops->destroy_instance(baton.fid);
|
||||
@@ -1012,13 +955,11 @@ int lvmetad_pvscan_all_devs(struct cmd_context *cmd, activation_handler handler)
|
||||
init_silent(1);
|
||||
|
||||
while ((dev = dev_iter_get(iter))) {
|
||||
if (sigint_caught()) {
|
||||
r = 0;
|
||||
stack;
|
||||
break;
|
||||
}
|
||||
if (!lvmetad_pvscan_single(cmd, dev, handler))
|
||||
r = 0;
|
||||
|
||||
if (sigint_caught())
|
||||
break;
|
||||
}
|
||||
|
||||
init_silent(was_silent);
|
||||
|
||||
18
lib/cache/lvmetad.h
vendored
18
lib/cache/lvmetad.h
vendored
@@ -23,8 +23,7 @@ struct dm_config_tree;
|
||||
enum activation_change;
|
||||
|
||||
typedef int (*activation_handler) (struct cmd_context *cmd,
|
||||
const char *vgname, const char *vgid,
|
||||
int partial, int changed,
|
||||
const char *vgid, int partial,
|
||||
enum activation_change activate);
|
||||
|
||||
#ifdef LVMETAD_SUPPORT
|
||||
@@ -44,19 +43,6 @@ void lvmetad_set_active(int);
|
||||
*/
|
||||
void lvmetad_set_socket(const char *);
|
||||
|
||||
/*
|
||||
* Check whether lvmetad is used.
|
||||
*/
|
||||
int lvmetad_used(void);
|
||||
|
||||
/*
|
||||
* Check if lvmetad socket is present (either the one set by lvmetad_set_socket
|
||||
* or the default one if not set). For example, this may be used before calling
|
||||
* lvmetad_active() check that does connect to the socket - this would produce
|
||||
* various connection errors if the socket is not present.
|
||||
*/
|
||||
int lvmetad_socket_present(void);
|
||||
|
||||
/*
|
||||
* Check whether lvmetad is active (where active means both that it is running
|
||||
* and that we have a working connection with it).
|
||||
@@ -163,8 +149,6 @@ int lvmetad_pvscan_all_devs(struct cmd_context *cmd, activation_handler handler)
|
||||
# define lvmetad_disconnect() do { } while (0)
|
||||
# define lvmetad_set_active(a) do { } while (0)
|
||||
# define lvmetad_set_socket(a) do { } while (0)
|
||||
# define lvmetad_used() (0)
|
||||
# define lvmetad_socket_present() (0)
|
||||
# define lvmetad_active() (0)
|
||||
# define lvmetad_connect_or_warn() do { } while (0)
|
||||
# define lvmetad_set_token(a) do { } while (0)
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
init_cache_segtypes
|
||||
@@ -1,24 +0,0 @@
|
||||
# Copyright (C) 2013-2014 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
# This file is part of LVM2.
|
||||
#
|
||||
# This copyrighted material is made available to anyone wishing to use,
|
||||
# modify, copy, or redistribute it subject to the terms and conditions
|
||||
# of the GNU General Public License v.2.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
top_builddir = @top_builddir@
|
||||
|
||||
SOURCES = cache.c
|
||||
|
||||
LIB_SHARED = liblvm2cache.$(LIB_SUFFIX)
|
||||
LIB_VERSION = $(LIB_VERSION_LVM)
|
||||
|
||||
include $(top_builddir)/make.tmpl
|
||||
|
||||
install: install_lvm2_plugin
|
||||
@@ -1,426 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2013-2014 Red Hat, Inc. All rights reserved.
|
||||
*
|
||||
* This file is part of LVM2.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use,
|
||||
* modify, copy, or redistribute it subject to the terms and conditions
|
||||
* of the GNU Lesser General Public License v.2.1.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "lib.h"
|
||||
#include "toolcontext.h"
|
||||
#include "segtype.h"
|
||||
#include "display.h"
|
||||
#include "text_export.h"
|
||||
#include "config.h"
|
||||
#include "str_list.h"
|
||||
#include "targets.h"
|
||||
#include "lvm-string.h"
|
||||
#include "activate.h"
|
||||
#include "metadata.h"
|
||||
#include "lv_alloc.h"
|
||||
#include "defaults.h"
|
||||
|
||||
#define SEG_LOG_ERROR(t, p...) \
|
||||
log_error(t " segment %s of logical volume %s.", ## p, \
|
||||
dm_config_parent_name(sn), seg->lv->name), 0;
|
||||
|
||||
|
||||
static const char *_name(const struct lv_segment *seg)
|
||||
{
|
||||
return seg->segtype->name;
|
||||
}
|
||||
|
||||
static int _cache_pool_text_import(struct lv_segment *seg,
|
||||
const struct dm_config_node *sn,
|
||||
struct dm_hash_table *pv_hash __attribute__((unused)))
|
||||
{
|
||||
uint32_t chunk_size;
|
||||
struct logical_volume *data_lv, *meta_lv;
|
||||
const char *str = NULL;
|
||||
char *argv_str;
|
||||
struct dm_pool *mem = seg->lv->vg->vgmem; //FIXME: what mempool should be used?
|
||||
|
||||
if (!dm_config_has_node(sn, "data"))
|
||||
return SEG_LOG_ERROR("Cache data not specified in");
|
||||
if (!(str = dm_config_find_str(sn, "data", NULL)))
|
||||
return SEG_LOG_ERROR("Cache data must be a string in");
|
||||
if (!(data_lv = find_lv(seg->lv->vg, str)))
|
||||
return SEG_LOG_ERROR("Unknown logical volume %s specified for "
|
||||
"cache data in", str);
|
||||
|
||||
if (!dm_config_has_node(sn, "metadata"))
|
||||
return SEG_LOG_ERROR("Cache metadata not specified in");
|
||||
if (!(str = dm_config_find_str(sn, "metadata", NULL)))
|
||||
return SEG_LOG_ERROR("Cache metadata must be a string in");
|
||||
if (!(meta_lv = find_lv(seg->lv->vg, str)))
|
||||
return SEG_LOG_ERROR("Unknown logical volume %s specified for "
|
||||
"cache metadata in", str);
|
||||
|
||||
if (!dm_config_get_uint32(sn, "chunk_size", &chunk_size))
|
||||
return SEG_LOG_ERROR("Couldn't read cache chunk_size in");
|
||||
|
||||
/*
|
||||
* Read in features:
|
||||
* cache_mode = {writethrough|writeback}
|
||||
*
|
||||
* 'cache_mode' does not have to be present.
|
||||
*/
|
||||
if (dm_config_has_node(sn, "cache_mode")) {
|
||||
if (!(str = dm_config_find_str(sn, "cache_mode", NULL)))
|
||||
return SEG_LOG_ERROR("cache_mode must be a string in");
|
||||
if (!get_cache_mode(str, &seg->feature_flags))
|
||||
return SEG_LOG_ERROR("Unknown cache_mode in");
|
||||
}
|
||||
|
||||
/*
|
||||
* Read in core arguments (these are key/value pairs)
|
||||
* core_argc = <# args>
|
||||
* core_argv = "[<key> <value>]..."
|
||||
*
|
||||
* 'core_argc' does not have to be present. If it is not present,
|
||||
* any other core_* fields are ignored. If it is present, then
|
||||
* 'core_argv' must be present - even if they are
|
||||
* 'core_argc = 0' and 'core_argv = ""'.
|
||||
*/
|
||||
if (dm_config_has_node(sn, "core_argc")) {
|
||||
if (!dm_config_has_node(sn, "core_argv"))
|
||||
return SEG_LOG_ERROR("not all core arguments defined in");
|
||||
|
||||
if (!dm_config_get_uint32(sn, "core_argc", &seg->core_argc))
|
||||
return SEG_LOG_ERROR("Unable to read core_argc in");
|
||||
|
||||
str = dm_config_find_str(sn, "core_argv", NULL);
|
||||
if ((str && !seg->core_argc) || (!str && seg->core_argc))
|
||||
return SEG_LOG_ERROR("core_argc and core_argv do"
|
||||
" not match in");
|
||||
|
||||
if (!(seg->core_argv =
|
||||
dm_pool_alloc(mem, sizeof(char *) * seg->core_argc)))
|
||||
return_0;
|
||||
if (str &&
|
||||
(!(argv_str = dm_pool_strdup(mem, str)) ||
|
||||
((int)seg->core_argc != dm_split_words(argv_str, seg->core_argc,
|
||||
0, (char **) seg->core_argv))))
|
||||
return SEG_LOG_ERROR("core_argc and core_argv do"
|
||||
" not match in");
|
||||
}
|
||||
|
||||
/*
|
||||
* Read in policy:
|
||||
* policy_name = "<policy_name>"
|
||||
* policy_argc = <# args>
|
||||
* policy_argv = "[<key> <value>]..."
|
||||
*
|
||||
* 'policy_name' does not have to be present. If it is not present,
|
||||
* any other policy_* fields are ignored. If it is present, then
|
||||
* the other policy_* fields must be present - even if they are
|
||||
* 'policy_argc = 0' and 'policy_argv = ""'.
|
||||
*/
|
||||
if (dm_config_has_node(sn, "policy_name")) {
|
||||
if (!dm_config_has_node(sn, "policy_argc") ||
|
||||
!dm_config_has_node(sn, "policy_argv"))
|
||||
return SEG_LOG_ERROR("not all policy arguments defined in");
|
||||
if (!(str = dm_config_find_str(sn, "policy_name", NULL)))
|
||||
return SEG_LOG_ERROR("policy_name must be a string in");
|
||||
seg->policy_name = dm_pool_strdup(mem, str);
|
||||
|
||||
if (!dm_config_get_uint32(sn, "policy_argc", &seg->policy_argc))
|
||||
return SEG_LOG_ERROR("Unable to read policy_argc in");
|
||||
|
||||
str = dm_config_find_str(sn, "policy_argv", NULL);
|
||||
if ((str && !seg->policy_argc) || (!str && seg->policy_argc))
|
||||
return SEG_LOG_ERROR("policy_argc and policy_argv do"
|
||||
" not match in");
|
||||
|
||||
if (!(seg->policy_argv =
|
||||
dm_pool_alloc(mem, sizeof(char *) * seg->policy_argc)))
|
||||
return_0;
|
||||
if (str &&
|
||||
(!(argv_str = dm_pool_strdup(mem, str)) ||
|
||||
((int)seg->policy_argc != dm_split_words(argv_str,
|
||||
seg->policy_argc,
|
||||
0, (char **) seg->policy_argv))))
|
||||
return SEG_LOG_ERROR("policy_argc and policy_argv do"
|
||||
" not match in");
|
||||
}
|
||||
|
||||
if (!attach_pool_data_lv(seg, data_lv))
|
||||
return_0;
|
||||
if (!attach_pool_metadata_lv(seg, meta_lv))
|
||||
return_0;
|
||||
seg->chunk_size = chunk_size;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int _cache_pool_text_import_area_count(const struct dm_config_node *sn,
|
||||
uint32_t *area_count)
|
||||
{
|
||||
*area_count = 1;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int _cache_pool_text_export(const struct lv_segment *seg,
|
||||
struct formatter *f)
|
||||
{
|
||||
unsigned i;
|
||||
char buf[256]; //FIXME: IS THERE AN 'outf' THAT DOESN'T DO NEWLINE?!?
|
||||
uint32_t feature_flags = seg->feature_flags;
|
||||
|
||||
outf(f, "data = \"%s\"", seg_lv(seg, 0)->name);
|
||||
outf(f, "metadata = \"%s\"", seg->metadata_lv->name);
|
||||
outf(f, "chunk_size = %" PRIu32, seg->chunk_size);
|
||||
|
||||
if (feature_flags) {
|
||||
if (feature_flags & DM_CACHE_FEATURE_WRITETHROUGH) {
|
||||
outf(f, "cache_mode = \"writethrough\"");
|
||||
feature_flags &= ~DM_CACHE_FEATURE_WRITETHROUGH;
|
||||
} else if (feature_flags & DM_CACHE_FEATURE_WRITEBACK) {
|
||||
outf(f, "cache_mode = \"writeback\"");
|
||||
feature_flags &= ~DM_CACHE_FEATURE_WRITEBACK;
|
||||
} else {
|
||||
log_error(INTERNAL_ERROR "Unknown feature flags "
|
||||
"in cache_pool segment for %s", seg->lv->name);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (seg->core_argc) {
|
||||
outf(f, "core_argc = %u", seg->core_argc);
|
||||
outf(f, "core_argv = \"");
|
||||
for (i = 0; i < seg->core_argc; i++)
|
||||
outf(f, "%s%s", i ? " " : "", seg->core_argv[i]);
|
||||
outf(f, "\"");
|
||||
}
|
||||
|
||||
if (seg->policy_name) {
|
||||
outf(f, "policy_name = \"%s\"", seg->policy_name);
|
||||
outf(f, "policy_argc = %u", seg->policy_argc);
|
||||
buf[0] = '\0';
|
||||
for (i = 0; i < seg->policy_argc; i++)
|
||||
sprintf(buf, "%s%s", i ? " " : "", seg->policy_argv[i]);
|
||||
outf(f, "policy_argv = \"%s\"", buf);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void _destroy(struct segment_type *segtype)
|
||||
{
|
||||
dm_free((void *) segtype);
|
||||
}
|
||||
|
||||
#ifdef DEVMAPPER_SUPPORT
|
||||
static int _target_present(struct cmd_context *cmd,
|
||||
const struct lv_segment *seg __attribute__((unused)),
|
||||
unsigned *attributes __attribute__((unused)))
|
||||
{
|
||||
uint32_t maj, min, patchlevel;
|
||||
static int _cache_checked = 0;
|
||||
static int _cache_present = 0;
|
||||
|
||||
if (!_cache_checked) {
|
||||
_cache_present = target_present(cmd, "cache", 1);
|
||||
|
||||
if (!target_version("cache", &maj, &min, &patchlevel)) {
|
||||
log_error("Failed to determine version of cache kernel module");
|
||||
return 0;
|
||||
}
|
||||
|
||||
_cache_checked = 1;
|
||||
|
||||
if ((maj < 1) ||
|
||||
((maj == 1) && (min < 3))) {
|
||||
log_error("The cache kernel module is version %u.%u.%u."
|
||||
" Version 1.3.0+ is required.",
|
||||
maj, min, patchlevel);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return _cache_present;
|
||||
}
|
||||
|
||||
static int _modules_needed(struct dm_pool *mem,
|
||||
const struct lv_segment *seg __attribute__((unused)),
|
||||
struct dm_list *modules)
|
||||
{
|
||||
if (!str_list_add(mem, modules, "cache")) {
|
||||
log_error("String list allocation failed for cache module.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
#endif /* DEVMAPPER_SUPPORT */
|
||||
|
||||
static struct segtype_handler _cache_pool_ops = {
|
||||
.name = _name,
|
||||
.text_import = _cache_pool_text_import,
|
||||
.text_import_area_count = _cache_pool_text_import_area_count,
|
||||
.text_export = _cache_pool_text_export,
|
||||
#ifdef DEVMAPPER_SUPPORT
|
||||
.target_present = _target_present,
|
||||
.modules_needed = _modules_needed,
|
||||
# ifdef DMEVENTD
|
||||
# endif /* DMEVENTD */
|
||||
#endif
|
||||
.destroy = _destroy,
|
||||
};
|
||||
|
||||
static int _cache_text_import(struct lv_segment *seg,
|
||||
const struct dm_config_node *sn,
|
||||
struct dm_hash_table *pv_hash __attribute__((unused)))
|
||||
{
|
||||
struct logical_volume *pool_lv, *origin_lv;
|
||||
const char *name = NULL;
|
||||
|
||||
if (!dm_config_has_node(sn, "cache_pool"))
|
||||
return SEG_LOG_ERROR("cache_pool not specified in");
|
||||
if (!(name = dm_config_find_str(sn, "cache_pool", NULL)))
|
||||
return SEG_LOG_ERROR("cache_pool must be a string in");
|
||||
if (!(pool_lv = find_lv(seg->lv->vg, name)))
|
||||
return SEG_LOG_ERROR("Unknown logical volume %s specified for "
|
||||
"cache_pool in", name);
|
||||
|
||||
if (!dm_config_has_node(sn, "origin"))
|
||||
return SEG_LOG_ERROR("Cache origin not specified in");
|
||||
if (!(name = dm_config_find_str(sn, "origin", NULL)))
|
||||
return SEG_LOG_ERROR("Cache origin must be a string in");
|
||||
if (!(origin_lv = find_lv(seg->lv->vg, name)))
|
||||
return SEG_LOG_ERROR("Unknown logical volume %s specified for "
|
||||
"cache origin in", name);
|
||||
|
||||
if (!set_lv_segment_area_lv(seg, 0, origin_lv, 0, 0))
|
||||
return_0;
|
||||
if (!attach_pool_lv(seg, pool_lv, NULL, NULL))
|
||||
return_0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int _cache_text_import_area_count(const struct dm_config_node *sn,
|
||||
uint32_t *area_count)
|
||||
{
|
||||
*area_count = 1;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int _cache_text_export(const struct lv_segment *seg, struct formatter *f)
|
||||
{
|
||||
if (!seg_lv(seg, 0))
|
||||
return_0;
|
||||
|
||||
outf(f, "cache_pool = \"%s\"", seg->pool_lv->name);
|
||||
outf(f, "origin = \"%s\"", seg_lv(seg, 0)->name);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifdef DEVMAPPER_SUPPORT
|
||||
static int _cache_add_target_line(struct dev_manager *dm,
|
||||
struct dm_pool *mem,
|
||||
struct cmd_context *cmd __attribute__((unused)),
|
||||
void **target_state __attribute__((unused)),
|
||||
struct lv_segment *seg,
|
||||
const struct lv_activate_opts *laopts __attribute__((unused)),
|
||||
struct dm_tree_node *node, uint64_t len,
|
||||
uint32_t *pvmove_mirror_count __attribute__((unused)))
|
||||
{
|
||||
struct lv_segment *cache_pool_seg = first_seg(seg->pool_lv);
|
||||
char *metadata_uuid, *data_uuid, *origin_uuid;
|
||||
|
||||
if (!(metadata_uuid = build_dm_uuid(mem, cache_pool_seg->metadata_lv, NULL)))
|
||||
return_0;
|
||||
|
||||
if (!(data_uuid = build_dm_uuid(mem, seg_lv(cache_pool_seg, 0), NULL)))
|
||||
return_0;
|
||||
|
||||
if (!(origin_uuid = build_dm_uuid(mem, seg_lv(seg, 0), NULL)))
|
||||
return_0;
|
||||
|
||||
if (!dm_tree_node_add_cache_target(node, len,
|
||||
metadata_uuid,
|
||||
data_uuid,
|
||||
origin_uuid,
|
||||
cache_pool_seg->chunk_size,
|
||||
cache_pool_seg->feature_flags,
|
||||
cache_pool_seg->core_argc,
|
||||
cache_pool_seg->core_argv,
|
||||
cache_pool_seg->policy_name,
|
||||
cache_pool_seg->policy_argc,
|
||||
cache_pool_seg->policy_argv))
|
||||
return_0;
|
||||
|
||||
return add_areas_line(dm, seg, node, 0u, seg->area_count);
|
||||
}
|
||||
#endif /* DEVMAPPER_SUPPORT */
|
||||
|
||||
static struct segtype_handler _cache_ops = {
|
||||
.name = _name,
|
||||
.text_import = _cache_text_import,
|
||||
.text_import_area_count = _cache_text_import_area_count,
|
||||
.text_export = _cache_text_export,
|
||||
#ifdef DEVMAPPER_SUPPORT
|
||||
.add_target_line = _cache_add_target_line,
|
||||
.target_present = _target_present,
|
||||
.modules_needed = _modules_needed,
|
||||
# ifdef DMEVENTD
|
||||
# endif /* DMEVENTD */
|
||||
#endif
|
||||
.destroy = _destroy,
|
||||
};
|
||||
|
||||
#ifdef CACHE_INTERNAL /* Shared */
|
||||
int init_cache_segtypes(struct cmd_context *cmd,
|
||||
struct segtype_library *seglib)
|
||||
#else
|
||||
int init_cache_segtypes(struct cmd_context *cmd,
|
||||
struct segtype_library *seglib);
|
||||
int init_cache_segtypes(struct cmd_context *cmd,
|
||||
struct segtype_library *seglib)
|
||||
#endif
|
||||
{
|
||||
struct segment_type *segtype = dm_zalloc(sizeof(*segtype));
|
||||
|
||||
if (!segtype) {
|
||||
log_error("Failed to allocate memory for cache_pool segtype");
|
||||
return 0;
|
||||
}
|
||||
segtype->cmd = cmd;
|
||||
|
||||
segtype->name = "cache-pool";
|
||||
segtype->flags = SEG_CACHE_POOL;
|
||||
segtype->ops = &_cache_pool_ops;
|
||||
segtype->private = NULL;
|
||||
|
||||
if (!lvm_register_segtype(seglib, segtype))
|
||||
return_0;
|
||||
log_very_verbose("Initialised segtype: %s", segtype->name);
|
||||
|
||||
segtype = dm_zalloc(sizeof(*segtype));
|
||||
if (!segtype) {
|
||||
log_error("Failed to allocate memory for cache segtype");
|
||||
return 0;
|
||||
}
|
||||
segtype->cmd = cmd;
|
||||
|
||||
segtype->name = "cache";
|
||||
segtype->flags = SEG_CACHE;
|
||||
segtype->ops = &_cache_ops;
|
||||
segtype->private = NULL;
|
||||
|
||||
if (!lvm_register_segtype(seglib, segtype))
|
||||
return_0;
|
||||
log_very_verbose("Initialised segtype: %s", segtype->name);
|
||||
|
||||
return 1;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -19,6 +19,7 @@
|
||||
#include "dev-cache.h"
|
||||
#include "dev-type.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
|
||||
/*
|
||||
@@ -50,7 +51,6 @@ struct config_info {
|
||||
};
|
||||
|
||||
struct dm_config_tree;
|
||||
struct profile_params;
|
||||
struct archive_params;
|
||||
struct backup_params;
|
||||
struct arg_values;
|
||||
@@ -86,12 +86,8 @@ struct cmd_context {
|
||||
unsigned handles_unknown_segments:1;
|
||||
unsigned use_linear_target:1;
|
||||
unsigned partial_activation:1;
|
||||
unsigned degraded_activation:1;
|
||||
unsigned auto_set_activation_skip:1;
|
||||
unsigned si_unit_consistency:1;
|
||||
unsigned report_binary_values_as_numeric:1;
|
||||
unsigned metadata_read_only:1;
|
||||
unsigned ignore_clustered_vgs:1;
|
||||
unsigned threaded:1; /* Set if running within a thread e.g. clvmd */
|
||||
|
||||
unsigned independent_metadata_areas:1; /* Active formats have MDAs outside PVs */
|
||||
@@ -101,17 +97,12 @@ struct cmd_context {
|
||||
struct dev_filter *lvmetad_filter;
|
||||
int dump_filter; /* Dump filter when exiting? */
|
||||
|
||||
struct dm_list config_files; /* master lvm config + any existing tag configs */
|
||||
struct profile_params *profile_params; /* profile handling params including loaded profile configs */
|
||||
struct dm_config_tree *cft; /* the whole cascade: CONFIG_STRING -> CONFIG_PROFILE -> CONFIG_FILE/CONFIG_MERGED_FILES */
|
||||
int config_initialized; /* used to reinitialize config if previous init was not successful */
|
||||
|
||||
struct dm_hash_table *cft_def_hash; /* config definition hash used for validity check (item type + item recognized) */
|
||||
|
||||
/* selected settings with original default/configured value which can be changed during cmd processing */
|
||||
struct dm_list config_files;
|
||||
int config_valid;
|
||||
struct dm_config_tree *cft;
|
||||
struct config_info default_settings;
|
||||
/* may contain changed values compared to default_settings */
|
||||
struct config_info current_settings;
|
||||
struct dm_hash_table *cft_def_hash; /* cft definition hash used for validity check */
|
||||
|
||||
struct archive_params *archive_params;
|
||||
struct backup_params *backup_params;
|
||||
@@ -119,10 +110,8 @@ struct cmd_context {
|
||||
|
||||
/* List of defined tags */
|
||||
struct dm_list tags;
|
||||
const char *report_list_item_separator;
|
||||
int hosttags;
|
||||
|
||||
const char *lib_dir; /* Cache value global/library_dir */
|
||||
char system_dir[PATH_MAX];
|
||||
char dev_dir[PATH_MAX];
|
||||
char proc_dir[PATH_MAX];
|
||||
@@ -139,7 +128,6 @@ struct cmd_context *create_toolcontext(unsigned is_long_lived,
|
||||
void destroy_toolcontext(struct cmd_context *cmd);
|
||||
int refresh_toolcontext(struct cmd_context *cmd);
|
||||
int refresh_filters(struct cmd_context *cmd);
|
||||
int process_profilable_config(struct cmd_context *cmd);
|
||||
int config_files_changed(struct cmd_context *cmd);
|
||||
int init_lvmcache_orphans(struct cmd_context *cmd);
|
||||
|
||||
|
||||
2066
lib/config/config.c
2066
lib/config/config.c
File diff suppressed because it is too large
Load Diff
@@ -16,40 +16,16 @@
|
||||
#ifndef _LVM_CONFIG_H
|
||||
#define _LVM_CONFIG_H
|
||||
|
||||
#include "libdevmapper.h"
|
||||
#include "lvm-types.h"
|
||||
#include "defaults.h"
|
||||
|
||||
/* 16 bits: 3 bits for major, 4 bits for minor, 9 bits for patchlevel */
|
||||
/* FIXME Max LVM version supported: 7.15.511. Extend bits when needed. */
|
||||
/* Max LVM version supported: 7.15.511. Just extend bits if ever needed. */
|
||||
#define vsn(major, minor, patchlevel) (major << 13 | minor << 9 | patchlevel)
|
||||
|
||||
struct device;
|
||||
struct cmd_context;
|
||||
|
||||
typedef enum {
|
||||
CONFIG_UNDEFINED, /* undefined/uninitialized config */
|
||||
CONFIG_FILE, /* one file config */
|
||||
CONFIG_MERGED_FILES, /* config that is a result of merging more config files */
|
||||
CONFIG_STRING, /* config string typed on cmdline using '--config' arg */
|
||||
CONFIG_PROFILE_COMMAND, /* command profile config */
|
||||
CONFIG_PROFILE_METADATA,/* metadata profile config */
|
||||
CONFIG_FILE_SPECIAL /* special purpose file config (e.g. metadata, persistent filter...) */
|
||||
} config_source_t;
|
||||
|
||||
struct profile {
|
||||
struct dm_list list;
|
||||
config_source_t source; /* either CONFIG_PROFILE_COMMAND or CONFIG_PROFILE_METADATA */
|
||||
const char *name;
|
||||
struct dm_config_tree *cft;
|
||||
};
|
||||
|
||||
struct profile_params {
|
||||
char dir[PATH_MAX]; /* subdir in LVM_SYSTEM_DIR where LVM looks for profiles */
|
||||
struct profile *global_command_profile; /* profile (as given by --commandprofile cmd arg) used as global command profile */
|
||||
struct profile *global_metadata_profile; /* profile (as given by --metadataprofile cmd arg) that overrides any other VG/LV-based profile */
|
||||
struct dm_list profiles_to_load; /* list of profiles which are only added, but still need to be loaded for any use */
|
||||
struct dm_list profiles; /* list of profiles which are loaded already and which are ready for use */
|
||||
};
|
||||
|
||||
#define CFG_PATH_MAX_LEN 64
|
||||
|
||||
/*
|
||||
@@ -66,26 +42,11 @@ typedef enum {
|
||||
CFG_TYPE_STRING = 1 << 5, /* setting */
|
||||
} cfg_def_type_t;
|
||||
|
||||
/* function types to evaluate default value at runtime */
|
||||
typedef int (*t_fn_CFG_TYPE_BOOL) (struct cmd_context *cmd, struct profile *profile);
|
||||
typedef int (*t_fn_CFG_TYPE_INT) (struct cmd_context *cmd, struct profile *profile);
|
||||
typedef float (*t_fn_CFG_TYPE_FLOAT) (struct cmd_context *cmd, struct profile *profile);
|
||||
typedef const char* (*t_fn_CFG_TYPE_STRING) (struct cmd_context *cmd, struct profile *profile);
|
||||
typedef const char* (*t_fn_CFG_TYPE_ARRAY) (struct cmd_context *cmd, struct profile *profile);
|
||||
|
||||
/* configuration definition item value (for item's default value) */
|
||||
typedef union {
|
||||
/* static value - returns a variable */
|
||||
const int v_CFG_TYPE_BOOL, v_CFG_TYPE_INT;
|
||||
const float v_CFG_TYPE_FLOAT;
|
||||
const char *v_CFG_TYPE_STRING, *v_CFG_TYPE_ARRAY;
|
||||
|
||||
/* run-time value - evaluates a function */
|
||||
t_fn_CFG_TYPE_BOOL fn_CFG_TYPE_BOOL;
|
||||
t_fn_CFG_TYPE_INT fn_CFG_TYPE_INT;
|
||||
t_fn_CFG_TYPE_FLOAT fn_CFG_TYPE_FLOAT;
|
||||
t_fn_CFG_TYPE_STRING fn_CFG_TYPE_STRING;
|
||||
t_fn_CFG_TYPE_ARRAY fn_CFG_TYPE_ARRAY;
|
||||
} cfg_def_value_t;
|
||||
|
||||
/* configuration definition item flags: */
|
||||
@@ -96,25 +57,19 @@ typedef union {
|
||||
#define CFG_ALLOW_EMPTY 0x02
|
||||
/* whether the configuration item is for advanced use only */
|
||||
#define CFG_ADVANCED 0x04
|
||||
/* whether the configuration item is not officially supported */
|
||||
/* whether the configuraton item is not officially supported */
|
||||
#define CFG_UNSUPPORTED 0x08
|
||||
/* whether the configuration item is customizable by a profile */
|
||||
#define CFG_PROFILABLE 0x10
|
||||
/* whether the configuration item is customizable by a profile */
|
||||
/* and whether it can be attached to VG/LV metadata at the same time
|
||||
* The CFG_PROFILABLE_METADATA flag incorporates CFG_PROFILABLE flag!!! */
|
||||
#define CFG_PROFILABLE_METADATA 0x30
|
||||
/* whether the default value is undefned */
|
||||
#define CFG_DEFAULT_UNDEFINED 0x40
|
||||
/* whether the defualt value is calculated during run time */
|
||||
#define CFG_DEFAULT_RUN_TIME 0x80
|
||||
/* helper flag to mark the item as used in a config tree instance */
|
||||
#define CFG_USED 0x10
|
||||
/* helper flag to mark the item as valid in a config tree instance */
|
||||
#define CFG_VALID 0x20
|
||||
|
||||
/* configuration definition item structure */
|
||||
typedef struct cfg_def_item {
|
||||
int id; /* ID of this item */
|
||||
int parent; /* ID of parent item */
|
||||
const char *name; /* name of the item in configuration tree */
|
||||
int type; /* configuration item type (bits of cfg_def_type_t) */
|
||||
cfg_def_type_t type; /* configuration item type */
|
||||
cfg_def_value_t default_value; /* default value (only for settings) */
|
||||
uint16_t flags; /* configuration item definition flags */
|
||||
uint16_t since_version; /* version this item appeared in */
|
||||
@@ -127,131 +82,67 @@ typedef enum {
|
||||
CFG_DEF_TREE_MISSING, /* tree of nodes missing in current config using default values */
|
||||
CFG_DEF_TREE_COMPLETE, /* CURRENT + MISSING, the tree actually used within execution, not implemented yet */
|
||||
CFG_DEF_TREE_DEFAULT, /* tree of all possible config nodes with default values */
|
||||
CFG_DEF_TREE_NEW, /* tree of all new nodes that appeared in given version */
|
||||
CFG_DEF_TREE_PROFILABLE, /* tree of all nodes that are customizable by profiles */
|
||||
CFG_DEF_TREE_PROFILABLE_CMD, /* tree of all nodes that are customizable by command profiles (subset of PROFILABLE) */
|
||||
CFG_DEF_TREE_PROFILABLE_MDA, /* tree of all nodes that are customizable by metadata profiles (subset of PROFILABLE) */
|
||||
CFG_DEF_TREE_DIFF, /* tree of all nodes that differ from defaults */
|
||||
CFG_DEF_TREE_NEW /* tree of all new nodes that appeared in given version */
|
||||
} cfg_def_tree_t;
|
||||
|
||||
/* configuration definition tree specification */
|
||||
struct config_def_tree_spec {
|
||||
struct cmd_context *cmd; /* command context (for run-time defaults */
|
||||
cfg_def_tree_t type; /* tree type */
|
||||
uint16_t version; /* tree at this LVM2 version */
|
||||
unsigned ignoreadvanced:1; /* do not include advanced configs */
|
||||
unsigned ignoreunsupported:1; /* do not include unsupported configs */
|
||||
unsigned withcomments:1; /* include comments */
|
||||
unsigned withversions:1; /* include versions */
|
||||
uint8_t *check_status; /* status of last tree check (currently needed for CFG_DEF_TREE_MISSING only) */
|
||||
int ignoreadvanced; /* do not include advanced configs */
|
||||
int ignoreunsupported; /* do not include unsupported configs */
|
||||
};
|
||||
|
||||
|
||||
/* flag to mark the item as used in a config tree instance during validation */
|
||||
#define CFG_USED 0x01
|
||||
/* flag to mark the item as valid in a config tree instance during validation */
|
||||
#define CFG_VALID 0x02
|
||||
/* flag to mark the item as having the value different from default one */
|
||||
#define CFG_DIFF 0x04
|
||||
|
||||
/*
|
||||
* Register ID for each possible item in the configuration tree.
|
||||
*/
|
||||
enum {
|
||||
#define cfg_section(id, name, parent, flags, since_version, comment) id,
|
||||
#define cfg(id, name, parent, flags, type, default_value, since_version, comment) id,
|
||||
#define cfg_runtime(id, name, parent, flags, type, since_version, comment) id,
|
||||
#define cfg_array(id, name, parent, flags, types, default_value, since_version, comment) id,
|
||||
#define cfg_array_runtime(id, name, parent, flags, types, since_version, comment) id,
|
||||
#include "config_settings.h"
|
||||
#undef cfg_section
|
||||
#undef cfg
|
||||
#undef cfg_runtime
|
||||
#undef cfg_array
|
||||
#undef cfg_array_runtime
|
||||
};
|
||||
|
||||
struct profile *add_profile(struct cmd_context *cmd, const char *profile_name, config_source_t source);
|
||||
int load_profile(struct cmd_context *cmd, struct profile *profile);
|
||||
int load_pending_profiles(struct cmd_context *cmd);
|
||||
|
||||
/* configuration check handle for each instance of the validation check */
|
||||
struct cft_check_handle {
|
||||
struct cmd_context *cmd; /* command context */
|
||||
struct dm_config_tree *cft; /* the tree for which the check is done */
|
||||
config_source_t source; /* configuration source */
|
||||
unsigned force_check:1; /* force check even if disabled by config/checks setting */
|
||||
unsigned skip_if_checked:1; /* skip the check if already done before - return last state */
|
||||
unsigned suppress_messages:1; /* suppress messages during the check if config item is found invalid */
|
||||
unsigned check_diff:1; /* check if the value used differs from default one */
|
||||
uint8_t status[CFG_COUNT]; /* flags for each configuration item - the result of the check */
|
||||
};
|
||||
|
||||
int config_def_get_path(char *buf, size_t buf_size, int id);
|
||||
int config_def_check(struct cft_check_handle *handle);
|
||||
int config_def_check(struct cmd_context *cmd, int force, int skip, int suppress_messages);
|
||||
|
||||
int override_config_tree_from_string(struct cmd_context *cmd, const char *config_settings);
|
||||
int override_config_tree_from_profile(struct cmd_context *cmd, struct profile *profile);
|
||||
struct dm_config_tree *get_config_tree_by_source(struct cmd_context *, config_source_t source);
|
||||
struct dm_config_tree *remove_config_tree_by_source(struct cmd_context *cmd, config_source_t source);
|
||||
struct cft_check_handle *get_config_tree_check_handle(struct cmd_context *cmd, struct dm_config_tree *cft);
|
||||
config_source_t config_get_source_type(struct dm_config_tree *cft);
|
||||
int override_config_tree_from_string(struct cmd_context *cmd,
|
||||
const char *config_settings);
|
||||
struct dm_config_tree *remove_overridden_config_tree(struct cmd_context *cmd);
|
||||
|
||||
typedef uint32_t (*checksum_fn_t) (uint32_t initial, const uint8_t *buf, uint32_t size);
|
||||
|
||||
struct dm_config_tree *config_open(config_source_t source, const char *filename, int keep_open);
|
||||
struct dm_config_tree *config_file_open(const char *filename, int keep_open);
|
||||
int config_file_read_fd(struct dm_config_tree *cft, struct device *dev,
|
||||
off_t offset, size_t size, off_t offset2, size_t size2,
|
||||
checksum_fn_t checksum_fn, uint32_t checksum);
|
||||
int config_file_read(struct dm_config_tree *cft);
|
||||
struct dm_config_tree *config_file_open_and_read(const char *config_file, config_source_t source,
|
||||
struct cmd_context *cmd);
|
||||
int config_write(struct dm_config_tree *cft, struct config_def_tree_spec *tree_spec,
|
||||
int config_write(struct dm_config_tree *cft,
|
||||
int withcomment, int withversion,
|
||||
const char *file, int argc, char **argv);
|
||||
struct dm_config_tree *config_def_create_tree(struct config_def_tree_spec *spec);
|
||||
void config_destroy(struct dm_config_tree *cft);
|
||||
void config_file_destroy(struct dm_config_tree *cft);
|
||||
|
||||
time_t config_file_timestamp(struct dm_config_tree *cft);
|
||||
int config_file_changed(struct dm_config_tree *cft);
|
||||
int config_file_check(struct dm_config_tree *cft, const char **filename, struct stat *info);
|
||||
|
||||
|
||||
typedef enum {
|
||||
CONFIG_MERGE_TYPE_RAW, /* always replace old config values with new config values when merging */
|
||||
CONFIG_MERGE_TYPE_TAGS /* apply some exceptions when merging tag configs:
|
||||
- skip tags section
|
||||
- do not replace, but merge values of these settings:
|
||||
activation/volume_list
|
||||
devices/filter
|
||||
devices/types
|
||||
*/
|
||||
} config_merge_t;
|
||||
|
||||
int merge_config_tree(struct cmd_context *cmd, struct dm_config_tree *cft,
|
||||
struct dm_config_tree *newdata, config_merge_t);
|
||||
struct dm_config_tree *newdata);
|
||||
|
||||
/*
|
||||
* These versions check an override tree, if present, first.
|
||||
*/
|
||||
const struct dm_config_node *find_config_tree_node(struct cmd_context *cmd, int id, struct profile *profile);
|
||||
const char *find_config_tree_str(struct cmd_context *cmd, int id, struct profile *profile);
|
||||
const char *find_config_tree_str_allow_empty(struct cmd_context *cmd, int id, struct profile *profile);
|
||||
int find_config_tree_int(struct cmd_context *cmd, int id, struct profile *profile);
|
||||
int64_t find_config_tree_int64(struct cmd_context *cmd, int id, struct profile *profile);
|
||||
float find_config_tree_float(struct cmd_context *cmd, int id, struct profile *profile);
|
||||
int find_config_tree_bool(struct cmd_context *cmd, int id, struct profile *profile);
|
||||
|
||||
/*
|
||||
* Functions for configuration settings for which the default
|
||||
* value is evaluated at runtime based on command context.
|
||||
*/
|
||||
const char *get_default_devices_cache_dir_CFG(struct cmd_context *cmd, struct profile *profile);
|
||||
const char *get_default_devices_cache_CFG(struct cmd_context *cmd, struct profile *profile);
|
||||
const char *get_default_backup_backup_dir_CFG(struct cmd_context *cmd, struct profile *profile);
|
||||
const char *get_default_backup_archive_dir_CFG(struct cmd_context *cmd, struct profile *profile);
|
||||
const char *get_default_config_profile_dir_CFG(struct cmd_context *cmd, struct profile *profile);
|
||||
const char *get_default_activation_mirror_image_fault_policy_CFG(struct cmd_context *cmd, struct profile *profile);
|
||||
int get_default_allocation_thin_pool_chunk_size_CFG(struct cmd_context *cmd, struct profile *profile);
|
||||
int get_default_allocation_cache_pool_chunk_size_CFG(struct cmd_context *cmd, struct profile *profile);
|
||||
const struct dm_config_node *find_config_tree_node(struct cmd_context *cmd, int id);
|
||||
const char *find_config_tree_str(struct cmd_context *cmd, int id);
|
||||
const char *find_config_tree_str_allow_empty(struct cmd_context *cmd, int id);
|
||||
int find_config_tree_int(struct cmd_context *cmd, int id);
|
||||
int64_t find_config_tree_int64(struct cmd_context *cmd, int id);
|
||||
float find_config_tree_float(struct cmd_context *cmd, int id);
|
||||
int find_config_tree_bool(struct cmd_context *cmd, int id);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -14,24 +14,15 @@
|
||||
|
||||
/*
|
||||
* MACROS:
|
||||
* - define a configuration section:
|
||||
* cfg_section(id, name, parent, flags, since_version, comment)
|
||||
*
|
||||
* - define a configuration setting of simple type:
|
||||
* cfg(id, name, parent, flags, type, default_value, since_version, comment)
|
||||
*
|
||||
* - define a configuration array of one or more types:
|
||||
* cfg_array(id, name, parent, flags, types, default_value, since_version, comment)
|
||||
*
|
||||
* If default value can't be assigned statically because it depends on some
|
||||
* run-time checks or if it depends on other settings already defined,
|
||||
* the configuration setting or array can be defined with the
|
||||
* "{cfg|cfg_array}_runtime" macro. In this case the default value
|
||||
* is evaluated by automatically calling "get_default_<id>" function.
|
||||
* See config.h and "function types to evaluate default value at runtime".
|
||||
*
|
||||
* cfg_section(id, name, parent, flags, since_version, comment)
|
||||
* cfg(id, name, parent, flags, type, default_value, since_version, comment)
|
||||
* cfg_array(id, name, parent, flags, types, default_value, since_version, comment)
|
||||
*
|
||||
* VARIABLES:
|
||||
* cfg_section: define a new configuration section
|
||||
* cfg: define a new configuration setting of a simple type
|
||||
* cfg_array: define a new configuration setting of array type
|
||||
*
|
||||
* id: unique identifier
|
||||
* name: configuration node name
|
||||
* parent: id of parent configuration node
|
||||
@@ -40,14 +31,7 @@
|
||||
* CFG_ALLOW_EMPTY - node value can be emtpy
|
||||
* CFG_ADVANCED - this node belongs to advanced config set
|
||||
* CFG_UNSUPPORTED - this node belongs to unsupported config set
|
||||
* CFG_PROFILABLE - this node is customizable by a profile
|
||||
* CFG_PROFILABLE_METADATA - profilable and attachable to VG/LV metadata
|
||||
* CFG_DEFAULT_UNDEFINED - node's default value is undefined
|
||||
* type: allowed type for the value of simple configuation setting, one of:
|
||||
* CFG_TYPE_BOOL
|
||||
* CFG_TYPE_INT
|
||||
* CFG_TYPE_FLOAT
|
||||
* CFG_TYPE_STRING
|
||||
* type: allowed type for the value of simple configuation setting
|
||||
* types: allowed types for the values of array configuration setting
|
||||
* (use logical "OR" to define more than one allowed type,
|
||||
* e.g. CFG_TYPE_STRING | CFG_TYPE_INT)
|
||||
@@ -66,39 +50,37 @@
|
||||
* that parent nodes are consistent with versioning, no check done
|
||||
* if parent node is older or the same age as any child node!)
|
||||
*/
|
||||
#include "defaults.h"
|
||||
|
||||
cfg_section(root_CFG_SECTION, "(root)", root_CFG_SECTION, 0, vsn(0, 0, 0), NULL)
|
||||
|
||||
cfg_section(config_CFG_SECTION, "config", root_CFG_SECTION, 0, vsn(2, 2, 99), "Configuration handling.")
|
||||
cfg_section(devices_CFG_SECTION, "devices", root_CFG_SECTION, 0, vsn(1, 0, 0), NULL)
|
||||
cfg_section(allocation_CFG_SECTION, "allocation", root_CFG_SECTION, CFG_PROFILABLE, vsn(2, 2, 77), NULL)
|
||||
cfg_section(allocation_CFG_SECTION, "allocation", root_CFG_SECTION, 0, vsn(2, 2, 77), NULL)
|
||||
cfg_section(log_CFG_SECTION, "log", root_CFG_SECTION, 0, vsn(1, 0, 0), NULL)
|
||||
cfg_section(backup_CFG_SECTION, "backup", root_CFG_SECTION, 0, vsn(1, 0, 0), NULL)
|
||||
cfg_section(shell_CFG_SECTION, "shell", root_CFG_SECTION, 0, vsn(1, 0, 0), NULL)
|
||||
cfg_section(global_CFG_SECTION, "global", root_CFG_SECTION, CFG_PROFILABLE, vsn(1, 0, 0), NULL)
|
||||
cfg_section(activation_CFG_SECTION, "activation", root_CFG_SECTION, CFG_PROFILABLE, vsn(1, 0, 0), NULL)
|
||||
cfg_section(global_CFG_SECTION, "global", root_CFG_SECTION, 0, vsn(1, 0, 0), NULL)
|
||||
cfg_section(activation_CFG_SECTION, "activation", root_CFG_SECTION, 0, vsn(1, 0, 0), NULL)
|
||||
cfg_section(metadata_CFG_SECTION, "metadata", root_CFG_SECTION, CFG_ADVANCED, vsn(1, 0, 0), NULL)
|
||||
cfg_section(report_CFG_SECTION, "report", root_CFG_SECTION, CFG_ADVANCED | CFG_PROFILABLE, vsn(1, 0, 0), NULL)
|
||||
cfg_section(report_CFG_SECTION, "report", root_CFG_SECTION, CFG_ADVANCED, vsn(1, 0, 0), NULL)
|
||||
cfg_section(dmeventd_CFG_SECTION, "dmeventd", root_CFG_SECTION, 0, vsn(1, 2, 3), NULL)
|
||||
cfg_section(tags_CFG_SECTION, "tags", root_CFG_SECTION, 0, vsn(1, 0, 18), NULL)
|
||||
|
||||
cfg(config_checks_CFG, "checks", config_CFG_SECTION, 0, CFG_TYPE_BOOL, 1, vsn(2, 2, 99), "Configuration tree check on each LVM command execution.")
|
||||
cfg(config_abort_on_errors_CFG, "abort_on_errors", config_CFG_SECTION, 0, CFG_TYPE_BOOL, 0, vsn(2,2,99), "Abort LVM command execution if configuration is invalid.")
|
||||
cfg_runtime(config_profile_dir_CFG, "profile_dir", config_CFG_SECTION, 0, CFG_TYPE_STRING, vsn(2, 2, 99), "Directory with configuration profiles.")
|
||||
|
||||
cfg(devices_dir_CFG, "dir", devices_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_DEV_DIR, vsn(1, 0, 0), NULL)
|
||||
cfg_array(devices_scan_CFG, "scan", devices_CFG_SECTION, 0, CFG_TYPE_STRING, "#S/dev", vsn(1, 0, 0), NULL)
|
||||
cfg_array(devices_loopfiles_CFG, "loopfiles", devices_CFG_SECTION, CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(1, 2, 0), NULL)
|
||||
cfg_array(devices_loopfiles_CFG, "loopfiles", devices_CFG_SECTION, 0, CFG_TYPE_STRING, NULL, vsn(1, 2, 0), NULL)
|
||||
cfg(devices_obtain_device_list_from_udev_CFG, "obtain_device_list_from_udev", devices_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_OBTAIN_DEVICE_LIST_FROM_UDEV, vsn(2, 2, 85), NULL)
|
||||
cfg_array(devices_preferred_names_CFG, "preferred_names", devices_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(1, 2, 19), NULL)
|
||||
cfg_array(devices_filter_CFG, "filter", devices_CFG_SECTION, CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL)
|
||||
cfg_array(devices_global_filter_CFG, "global_filter", devices_CFG_SECTION, CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(2, 2, 98), NULL)
|
||||
cfg_runtime(devices_cache_CFG, "cache", devices_CFG_SECTION, 0, CFG_TYPE_STRING, vsn(1, 0, 0), NULL)
|
||||
cfg_runtime(devices_cache_dir_CFG, "cache_dir", devices_CFG_SECTION, 0, CFG_TYPE_STRING, vsn(1, 2, 19), NULL)
|
||||
cfg(devices_cache_file_prefix_CFG, "cache_file_prefix", devices_CFG_SECTION, CFG_ALLOW_EMPTY, CFG_TYPE_STRING, DEFAULT_CACHE_FILE_PREFIX, vsn(1, 2, 19), NULL)
|
||||
cfg_array(devices_preferred_names_CFG, "preferred_names", devices_CFG_SECTION, CFG_ALLOW_EMPTY, CFG_TYPE_STRING, NULL, vsn(1, 2, 19), NULL)
|
||||
cfg_array(devices_filter_CFG, "filter", devices_CFG_SECTION, 0, CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL)
|
||||
cfg_array(devices_global_filter_CFG, "global_filter", devices_CFG_SECTION, 0, CFG_TYPE_STRING, NULL, vsn(2, 2, 98), NULL)
|
||||
cfg(devices_cache_CFG, "cache", devices_CFG_SECTION, 0, CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL)
|
||||
cfg(devices_cache_dir_CFG, "cache_dir", devices_CFG_SECTION, 0, CFG_TYPE_STRING, NULL, vsn(1, 2, 19), NULL)
|
||||
cfg(devices_cache_file_prefix_CFG, "cache_file_prefix", devices_CFG_SECTION, 0, CFG_TYPE_STRING, NULL, vsn(1, 2, 19), NULL)
|
||||
cfg(devices_write_cache_state_CFG, "write_cache_state", devices_CFG_SECTION, 0, CFG_TYPE_BOOL, 1, vsn(1, 0, 0), NULL)
|
||||
cfg_array(devices_types_CFG, "types", devices_CFG_SECTION, CFG_DEFAULT_UNDEFINED, CFG_TYPE_INT | CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL)
|
||||
cfg_array(devices_types_CFG, "types", devices_CFG_SECTION, 0, CFG_TYPE_INT | CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL)
|
||||
cfg(devices_sysfs_scan_CFG, "sysfs_scan", devices_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_SYSFS_SCAN, vsn(1, 0, 8), NULL)
|
||||
cfg(devices_multipath_component_detection_CFG, "multipath_component_detection", devices_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_MULTIPATH_COMPONENT_DETECTION, vsn(2, 2, 89), NULL)
|
||||
cfg(devices_md_component_detection_CFG, "md_component_detection", devices_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_MD_COMPONENT_DETECTION, vsn(1, 0, 18), NULL)
|
||||
@@ -108,43 +90,36 @@ cfg(devices_data_alignment_detection_CFG, "data_alignment_detection", devices_CF
|
||||
cfg(devices_data_alignment_CFG, "data_alignment", devices_CFG_SECTION, 0, CFG_TYPE_INT, 0, vsn(2, 2, 45), NULL)
|
||||
cfg(devices_data_alignment_offset_detection_CFG, "data_alignment_offset_detection", devices_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_DATA_ALIGNMENT_OFFSET_DETECTION, vsn(2, 2, 50), NULL)
|
||||
cfg(devices_ignore_suspended_devices_CFG, "ignore_suspended_devices", devices_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_IGNORE_SUSPENDED_DEVICES, vsn(1, 2, 19), NULL)
|
||||
cfg(devices_ignore_lvm_mirrors_CFG, "ignore_lvm_mirrors", devices_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_IGNORE_LVM_MIRRORS, vsn(2, 2, 104), NULL)
|
||||
cfg(devices_disable_after_error_count_CFG, "disable_after_error_count", devices_CFG_SECTION, 0, CFG_TYPE_INT, DEFAULT_DISABLE_AFTER_ERROR_COUNT, vsn(2, 2, 75), NULL)
|
||||
cfg(devices_require_restorefile_with_uuid_CFG, "require_restorefile_with_uuid", devices_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_REQUIRE_RESTOREFILE_WITH_UUID, vsn(2, 2, 73), NULL)
|
||||
cfg(devices_pv_min_size_CFG, "pv_min_size", devices_CFG_SECTION, 0, CFG_TYPE_INT, DEFAULT_PV_MIN_SIZE_KB, vsn(2, 2, 85), NULL)
|
||||
cfg(devices_issue_discards_CFG, "issue_discards", devices_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_ISSUE_DISCARDS, vsn(2, 2, 85), NULL)
|
||||
|
||||
cfg_array(allocation_cling_tag_list_CFG, "cling_tag_list", allocation_CFG_SECTION, CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(2, 2, 77), NULL)
|
||||
cfg_array(allocation_cling_tag_list_CFG, "cling_tag_list", allocation_CFG_SECTION, 0, CFG_TYPE_STRING, NULL, vsn(2, 2, 77), NULL)
|
||||
cfg(allocation_maximise_cling_CFG, "maximise_cling", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_MAXIMISE_CLING, vsn(2, 2, 85), NULL)
|
||||
cfg(allocation_use_blkid_wiping_CFG, "use_blkid_wiping", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, 1, vsn(2, 2, 105), NULL)
|
||||
cfg(allocation_wipe_signatures_when_zeroing_new_lvs_CFG, "wipe_signatures_when_zeroing_new_lvs", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, 1, vsn(2, 2, 105), NULL)
|
||||
cfg(allocation_mirror_logs_require_separate_pvs_CFG, "mirror_logs_require_separate_pvs", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_MIRROR_LOGS_REQUIRE_SEPARATE_PVS, vsn(2, 2, 85), NULL)
|
||||
cfg(allocation_cache_pool_metadata_require_separate_pvs_CFG, "cache_pool_metadata_require_separate_pvs", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_CACHE_POOL_METADATA_REQUIRE_SEPARATE_PVS, vsn(2, 2, 106), NULL)
|
||||
cfg_runtime(allocation_cache_pool_chunk_size_CFG, "cache_pool_chunk_size", allocation_CFG_SECTION, CFG_DEFAULT_UNDEFINED, CFG_TYPE_INT, vsn(2, 2, 106), NULL)
|
||||
cfg(allocation_thin_pool_metadata_require_separate_pvs_CFG, "thin_pool_metadata_require_separate_pvs", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_THIN_POOL_METADATA_REQUIRE_SEPARATE_PVS, vsn(2, 2, 89), NULL)
|
||||
cfg(allocation_thin_pool_zero_CFG, "thin_pool_zero", allocation_CFG_SECTION, CFG_PROFILABLE | CFG_PROFILABLE_METADATA, CFG_TYPE_BOOL, DEFAULT_THIN_POOL_ZERO, vsn(2, 2, 99), NULL)
|
||||
cfg(allocation_thin_pool_discards_CFG, "thin_pool_discards", allocation_CFG_SECTION, CFG_PROFILABLE | CFG_PROFILABLE_METADATA, CFG_TYPE_STRING, DEFAULT_THIN_POOL_DISCARDS, vsn(2, 2, 99), NULL)
|
||||
cfg(allocation_thin_pool_chunk_size_policy_CFG, "thin_pool_chunk_size_policy", allocation_CFG_SECTION, CFG_PROFILABLE | CFG_PROFILABLE_METADATA, CFG_TYPE_STRING, DEFAULT_THIN_POOL_CHUNK_SIZE_POLICY, vsn(2, 2, 101), NULL)
|
||||
cfg_runtime(allocation_thin_pool_chunk_size_CFG, "thin_pool_chunk_size", allocation_CFG_SECTION, CFG_PROFILABLE | CFG_PROFILABLE_METADATA | CFG_DEFAULT_UNDEFINED, CFG_TYPE_INT, vsn(2, 2, 99), NULL)
|
||||
cfg(allocation_physical_extent_size_CFG, "physical_extent_size", allocation_CFG_SECTION, 0, CFG_TYPE_INT, DEFAULT_EXTENT_SIZE, vsn(2, 2, 112), NULL)
|
||||
cfg(allocation_thin_pool_zero_CFG, "thin_pool_zero", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_THIN_POOL_ZERO, vsn(2, 2, 99), NULL)
|
||||
cfg(allocation_thin_pool_discards_CFG, "thin_pool_discards", allocation_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_THIN_POOL_DISCARDS, vsn(2, 2, 99), NULL)
|
||||
cfg(allocation_thin_pool_chunk_size_CFG, "thin_pool_chunk_size", allocation_CFG_SECTION, 0, CFG_TYPE_INT, DEFAULT_THIN_POOL_CHUNK_SIZE, vsn(2, 2, 99), NULL)
|
||||
|
||||
cfg(log_verbose_CFG, "verbose", log_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_VERBOSE, vsn(1, 0, 0), NULL)
|
||||
cfg(log_silent_CFG, "silent", log_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_SILENT, vsn(2, 2, 98), NULL)
|
||||
cfg(log_syslog_CFG, "syslog", log_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_SYSLOG, vsn(1, 0, 0), NULL)
|
||||
cfg(log_file_CFG, "file", log_CFG_SECTION, CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL)
|
||||
cfg(log_file_CFG, "file", log_CFG_SECTION, 0, CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL)
|
||||
cfg(log_overwrite_CFG, "overwrite", log_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_OVERWRITE, vsn(1, 0, 0), NULL)
|
||||
cfg(log_level_CFG, "level", log_CFG_SECTION, 0, CFG_TYPE_INT, DEFAULT_LOGLEVEL, vsn(1, 0, 0), NULL)
|
||||
cfg(log_indent_CFG, "indent", log_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_INDENT, vsn(1, 0, 0), NULL)
|
||||
cfg(log_command_names_CFG, "command_names", log_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_CMD_NAME, vsn(1, 0, 0), NULL)
|
||||
cfg(log_prefix_CFG, "prefix", log_CFG_SECTION, CFG_ALLOW_EMPTY, CFG_TYPE_STRING, DEFAULT_MSG_PREFIX, vsn(1, 0, 0), NULL)
|
||||
cfg(log_activation_CFG, "activation", log_CFG_SECTION, 0, CFG_TYPE_BOOL, 0, vsn(1, 0, 0), NULL)
|
||||
cfg(log_activate_file_CFG, "activate_file", log_CFG_SECTION, CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL)
|
||||
cfg(log_activate_file_CFG, "activate_file", log_CFG_SECTION, 0, CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL)
|
||||
cfg_array(log_debug_classes_CFG, "debug_classes", log_CFG_SECTION, CFG_ALLOW_EMPTY, CFG_TYPE_STRING, "#Smemory#Sdevices#Sactivation#Sallocation#Slvmetad#Smetadata#Scache#Slocking", vsn(2, 2, 99), NULL)
|
||||
|
||||
cfg(backup_backup_CFG, "backup", backup_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_BACKUP_ENABLED, vsn(1, 0, 0), NULL)
|
||||
cfg_runtime(backup_backup_dir_CFG, "backup_dir", backup_CFG_SECTION, 0, CFG_TYPE_STRING, vsn(1, 0, 0), NULL)
|
||||
cfg(backup_backup_dir_CFG, "backup_dir", backup_CFG_SECTION, 0, CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL)
|
||||
cfg(backup_archive_CFG, "archive", backup_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_ARCHIVE_ENABLED, vsn(1, 0, 0), NULL)
|
||||
cfg_runtime(backup_archive_dir_CFG, "archive_dir", backup_CFG_SECTION, 0, CFG_TYPE_STRING, vsn(1, 0, 0), NULL)
|
||||
cfg(backup_archive_dir_CFG, "archive_dir", backup_CFG_SECTION, 0, CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL)
|
||||
cfg(backup_retain_min_CFG, "retain_min", backup_CFG_SECTION, 0, CFG_TYPE_INT, DEFAULT_ARCHIVE_NUMBER, vsn(1, 0, 0), NULL)
|
||||
cfg(backup_retain_days_CFG, "retain_days", backup_CFG_SECTION, 0, CFG_TYPE_INT, DEFAULT_ARCHIVE_DAYS, vsn(1, 0, 0), NULL)
|
||||
|
||||
@@ -152,14 +127,14 @@ cfg(shell_history_size_CFG, "history_size", shell_CFG_SECTION, 0, CFG_TYPE_INT,
|
||||
|
||||
cfg(global_umask_CFG, "umask", global_CFG_SECTION, 0, CFG_TYPE_INT, DEFAULT_UMASK, vsn(1, 0, 0), NULL)
|
||||
cfg(global_test_CFG, "test", global_CFG_SECTION, 0, CFG_TYPE_BOOL, 0, vsn(1, 0, 0), NULL)
|
||||
cfg(global_units_CFG, "units", global_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_STRING, DEFAULT_UNITS, vsn(1, 0, 0), NULL)
|
||||
cfg(global_si_unit_consistency_CFG, "si_unit_consistency", global_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_BOOL, DEFAULT_SI_UNIT_CONSISTENCY, vsn(2, 2, 54), NULL)
|
||||
cfg(global_units_CFG, "units", global_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_UNITS, vsn(1, 0, 0), NULL)
|
||||
cfg(global_si_unit_consistency_CFG, "si_unit_consistency", global_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_SI_UNIT_CONSISTENCY, vsn(2, 2, 54), NULL)
|
||||
cfg(global_activation_CFG, "activation", global_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_ACTIVATION, vsn(1, 0, 0), NULL)
|
||||
cfg(global_suffix_CFG, "suffix", global_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_BOOL, DEFAULT_SUFFIX, vsn(1, 0, 0), NULL)
|
||||
cfg(global_suffix_CFG, "suffix", global_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_SUFFIX, vsn(1, 0, 0), NULL)
|
||||
cfg(global_fallback_to_lvm1_CFG, "fallback_to_lvm1", global_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_FALLBACK_TO_LVM1, vsn(1, 0, 18), NULL)
|
||||
cfg(global_format_CFG, "format", global_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_FORMAT, vsn(1, 0, 0), NULL)
|
||||
cfg_array(global_format_libraries_CFG, "format_libraries", global_CFG_SECTION, CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL)
|
||||
cfg_array(global_segment_libraries_CFG, "segment_libraries", global_CFG_SECTION, CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(1, 0, 18), NULL)
|
||||
cfg_array(global_format_libraries_CFG, "format_libraries", global_CFG_SECTION, 0, CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL)
|
||||
cfg_array(global_segment_libraries_CFG, "segment_libraries", global_CFG_SECTION, 0, CFG_TYPE_STRING, NULL, vsn(1, 0, 18), NULL)
|
||||
cfg(global_proc_CFG, "proc", global_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_PROC_DIR, vsn(1, 0, 0), NULL)
|
||||
cfg(global_locking_type_CFG, "locking_type", global_CFG_SECTION, 0, CFG_TYPE_INT, 1, vsn(1, 0, 0), NULL)
|
||||
cfg(global_wait_for_locks_CFG, "wait_for_locks", global_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_WAIT_FOR_LOCKS, vsn(2, 2, 50), NULL)
|
||||
@@ -167,26 +142,18 @@ cfg(global_fallback_to_clustered_locking_CFG, "fallback_to_clustered_locking", g
|
||||
cfg(global_fallback_to_local_locking_CFG, "fallback_to_local_locking", global_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_FALLBACK_TO_LOCAL_LOCKING, vsn(2, 2, 42), NULL)
|
||||
cfg(global_locking_dir_CFG, "locking_dir", global_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_LOCK_DIR, vsn(1, 0, 0), NULL)
|
||||
cfg(global_prioritise_write_locks_CFG, "prioritise_write_locks", global_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_PRIORITISE_WRITE_LOCKS, vsn(2, 2, 52), NULL)
|
||||
cfg(global_library_dir_CFG, "library_dir", global_CFG_SECTION, CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL)
|
||||
cfg(global_locking_library_CFG, "locking_library", global_CFG_SECTION, CFG_ALLOW_EMPTY, CFG_TYPE_STRING, DEFAULT_LOCKING_LIB, vsn(1, 0, 0), NULL)
|
||||
cfg(global_library_dir_CFG, "library_dir", global_CFG_SECTION, 0, CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL)
|
||||
cfg(global_locking_library_CFG, "locking_library", global_CFG_SECTION, CFG_ALLOW_EMPTY, CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL)
|
||||
cfg(global_abort_on_internal_errors_CFG, "abort_on_internal_errors", global_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_ABORT_ON_INTERNAL_ERRORS, vsn(2, 2, 57), NULL)
|
||||
cfg(global_detect_internal_vg_cache_corruption_CFG, "detect_internal_vg_cache_corruption", global_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_DETECT_INTERNAL_VG_CACHE_CORRUPTION, vsn(2, 2, 96), NULL)
|
||||
cfg(global_metadata_read_only_CFG, "metadata_read_only", global_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_METADATA_READ_ONLY, vsn(2, 2, 75), NULL)
|
||||
cfg(global_mirror_segtype_default_CFG, "mirror_segtype_default", global_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_MIRROR_SEGTYPE, vsn(2, 2, 87), NULL)
|
||||
cfg(global_raid10_segtype_default_CFG, "raid10_segtype_default", global_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_RAID10_SEGTYPE, vsn(2, 2, 99), NULL)
|
||||
cfg(global_lvdisplay_shows_full_device_path_CFG, "lvdisplay_shows_full_device_path", global_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_BOOL, DEFAULT_LVDISPLAY_SHOWS_FULL_DEVICE_PATH, vsn(2, 2, 89), NULL)
|
||||
cfg(global_lvdisplay_shows_full_device_path_CFG, "lvdisplay_shows_full_device_path", global_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_LVDISPLAY_SHOWS_FULL_DEVICE_PATH, vsn(2, 2, 89), NULL)
|
||||
cfg(global_use_lvmetad_CFG, "use_lvmetad", global_CFG_SECTION, 0, CFG_TYPE_BOOL, 0, vsn(2, 2, 93), NULL)
|
||||
cfg(global_thin_check_executable_CFG, "thin_check_executable", global_CFG_SECTION, CFG_ALLOW_EMPTY, CFG_TYPE_STRING, THIN_CHECK_CMD, vsn(2, 2, 94), NULL)
|
||||
cfg_array(global_thin_check_options_CFG, "thin_check_options", global_CFG_SECTION, 0, CFG_TYPE_STRING, "#S" DEFAULT_THIN_CHECK_OPTIONS, vsn(2, 2, 96), NULL)
|
||||
cfg_array(global_thin_disabled_features_CFG, "thin_disabled_features", global_CFG_SECTION, CFG_ALLOW_EMPTY, CFG_TYPE_STRING, NULL, vsn(2, 2, 99), NULL)
|
||||
cfg(global_thin_dump_executable_CFG, "thin_dump_executable", global_CFG_SECTION, CFG_ALLOW_EMPTY, CFG_TYPE_STRING, THIN_DUMP_CMD, vsn(2, 2, 100), NULL)
|
||||
cfg(global_thin_repair_executable_CFG, "thin_repair_executable", global_CFG_SECTION, CFG_ALLOW_EMPTY, CFG_TYPE_STRING, THIN_REPAIR_CMD, vsn(2, 2, 100), NULL)
|
||||
cfg_array(global_thin_repair_options_CFG, "thin_repair_options", global_CFG_SECTION, 0, CFG_TYPE_STRING, "#S" DEFAULT_THIN_REPAIR_OPTIONS, vsn(2, 2, 100), NULL)
|
||||
cfg(global_cache_check_executable_CFG, "cache_check_executable", global_CFG_SECTION, CFG_ALLOW_EMPTY, CFG_TYPE_STRING, CACHE_CHECK_CMD, vsn(2, 2, 108), NULL)
|
||||
cfg_array(global_cache_check_options_CFG, "cache_check_options", global_CFG_SECTION, 0, CFG_TYPE_STRING, "#S" DEFAULT_CACHE_CHECK_OPTIONS, vsn(2, 2, 108), NULL)
|
||||
cfg(global_cache_dump_executable_CFG, "cache_dump_executable", global_CFG_SECTION, CFG_ALLOW_EMPTY, CFG_TYPE_STRING, CACHE_DUMP_CMD, vsn(2, 2, 108), NULL)
|
||||
cfg(global_cache_repair_executable_CFG, "cache_repair_executable", global_CFG_SECTION, CFG_ALLOW_EMPTY, CFG_TYPE_STRING, CACHE_REPAIR_CMD, vsn(2, 2, 108), NULL)
|
||||
cfg_array(global_cache_repair_options_CFG, "cache_repair_options", global_CFG_SECTION, 0, CFG_TYPE_STRING, "#S" DEFAULT_CACHE_REPAIR_OPTIONS, vsn(2, 2, 108), NULL)
|
||||
cfg_array(global_thin_disabled_features_CFG, "thin_disabled_features", global_CFG_SECTION, 0, CFG_TYPE_STRING, "#S", vsn(2, 2, 99), NULL)
|
||||
|
||||
cfg(activation_checks_CFG, "checks", activation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_ACTIVATION_CHECKS, vsn(2, 2, 86), NULL)
|
||||
cfg(activation_udev_sync_CFG, "udev_sync", activation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_UDEV_SYNC, vsn(2, 2, 51), NULL)
|
||||
@@ -198,77 +165,65 @@ cfg(activation_use_linear_target_CFG, "use_linear_target", activation_CFG_SECTIO
|
||||
cfg(activation_reserved_stack_CFG, "reserved_stack", activation_CFG_SECTION, 0, CFG_TYPE_INT, DEFAULT_RESERVED_STACK, vsn(1, 0, 0), NULL)
|
||||
cfg(activation_reserved_memory_CFG, "reserved_memory", activation_CFG_SECTION, 0, CFG_TYPE_INT, DEFAULT_RESERVED_MEMORY, vsn(1, 0, 0), NULL)
|
||||
cfg(activation_process_priority_CFG, "process_priority", activation_CFG_SECTION, 0, CFG_TYPE_INT, DEFAULT_PROCESS_PRIORITY, vsn(1, 0, 0), NULL)
|
||||
cfg_array(activation_volume_list_CFG, "volume_list", activation_CFG_SECTION, CFG_ALLOW_EMPTY|CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(1, 0, 18), NULL)
|
||||
cfg_array(activation_auto_activation_volume_list_CFG, "auto_activation_volume_list", activation_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(2, 2, 97), NULL)
|
||||
cfg_array(activation_read_only_volume_list_CFG, "read_only_volume_list", activation_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(2, 2, 89), NULL)
|
||||
cfg_array(activation_volume_list_CFG, "volume_list", activation_CFG_SECTION, CFG_ALLOW_EMPTY, CFG_TYPE_STRING, NULL, vsn(1, 0, 18), NULL)
|
||||
cfg_array(activation_auto_activation_volume_list_CFG, "auto_activation_volume_list", activation_CFG_SECTION, CFG_ALLOW_EMPTY, CFG_TYPE_STRING, NULL, vsn(2, 2, 97), NULL)
|
||||
cfg_array(activation_read_only_volume_list_CFG, "read_only_volume_list", activation_CFG_SECTION, CFG_ALLOW_EMPTY, CFG_TYPE_STRING, NULL, vsn(2, 2, 89), NULL)
|
||||
cfg(activation_mirror_region_size_CFG, "mirror_region_size", activation_CFG_SECTION, 0, CFG_TYPE_INT, DEFAULT_RAID_REGION_SIZE, vsn(1, 0, 0), NULL)
|
||||
cfg(activation_raid_region_size_CFG, "raid_region_size", activation_CFG_SECTION, 0, CFG_TYPE_INT, DEFAULT_RAID_REGION_SIZE, vsn(2, 2, 99), NULL)
|
||||
cfg(activation_readahead_CFG, "readahead", activation_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_READ_AHEAD, vsn(1, 0, 23), NULL)
|
||||
cfg(activation_raid_fault_policy_CFG, "raid_fault_policy", activation_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_RAID_FAULT_POLICY, vsn(2, 2, 89), NULL)
|
||||
cfg(activation_mirror_device_fault_policy_CFG, "mirror_device_fault_policy", activation_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_MIRROR_DEVICE_FAULT_POLICY, vsn(1, 2, 10), NULL)
|
||||
cfg(activation_mirror_log_fault_policy_CFG, "mirror_log_fault_policy", activation_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_MIRROR_LOG_FAULT_POLICY, vsn(1, 2, 18), NULL)
|
||||
cfg_runtime(activation_mirror_image_fault_policy_CFG, "mirror_image_fault_policy", activation_CFG_SECTION, 0, CFG_TYPE_STRING, vsn(2, 2, 57), NULL)
|
||||
cfg(activation_mirror_image_fault_policy_CFG, "mirror_image_fault_policy", activation_CFG_SECTION, 0, CFG_TYPE_STRING, NULL, vsn(2, 2, 57), NULL)
|
||||
cfg(activation_snapshot_autoextend_threshold_CFG, "snapshot_autoextend_threshold", activation_CFG_SECTION, 0, CFG_TYPE_INT, DEFAULT_SNAPSHOT_AUTOEXTEND_THRESHOLD, vsn(2, 2, 75), NULL)
|
||||
cfg(activation_snapshot_autoextend_percent_CFG, "snapshot_autoextend_percent", activation_CFG_SECTION, 0, CFG_TYPE_INT, DEFAULT_SNAPSHOT_AUTOEXTEND_PERCENT, vsn(2, 2, 75), NULL)
|
||||
cfg(activation_thin_pool_autoextend_threshold_CFG, "thin_pool_autoextend_threshold", activation_CFG_SECTION, CFG_PROFILABLE | CFG_PROFILABLE_METADATA, CFG_TYPE_INT, DEFAULT_THIN_POOL_AUTOEXTEND_THRESHOLD, vsn(2, 2, 89), NULL)
|
||||
cfg(activation_thin_pool_autoextend_percent_CFG, "thin_pool_autoextend_percent", activation_CFG_SECTION, CFG_PROFILABLE | CFG_PROFILABLE_METADATA, CFG_TYPE_INT, DEFAULT_THIN_POOL_AUTOEXTEND_PERCENT, vsn(2, 2, 89), NULL)
|
||||
cfg_array(activation_mlock_filter_CFG, "mlock_filter", activation_CFG_SECTION, CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(2, 2, 62), NULL)
|
||||
cfg(activation_thin_pool_autoextend_threshold_CFG, "thin_pool_autoextend_threshold", activation_CFG_SECTION, 0, CFG_TYPE_INT, DEFAULT_THIN_POOL_AUTOEXTEND_THRESHOLD, vsn(2, 2, 89), NULL)
|
||||
cfg(activation_thin_pool_autoextend_percent_CFG, "thin_pool_autoextend_percent", activation_CFG_SECTION, 0, CFG_TYPE_INT, DEFAULT_THIN_POOL_AUTOEXTEND_PERCENT, vsn(2, 2, 89), NULL)
|
||||
cfg_array(activation_mlock_filter_CFG, "mlock_filter", activation_CFG_SECTION, 0, CFG_TYPE_STRING, NULL, vsn(2, 2, 62), NULL)
|
||||
cfg(activation_use_mlockall_CFG, "use_mlockall", activation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_USE_MLOCKALL, vsn(2, 2, 62), NULL)
|
||||
cfg(activation_monitoring_CFG, "monitoring", activation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_DMEVENTD_MONITOR, vsn(2, 2, 63), NULL)
|
||||
cfg(activation_polling_interval_CFG, "polling_interval", activation_CFG_SECTION, 0, CFG_TYPE_INT, DEFAULT_INTERVAL, vsn(2, 2, 63), NULL)
|
||||
cfg(activation_auto_set_activation_skip_CFG, "auto_set_activation_skip", activation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_AUTO_SET_ACTIVATION_SKIP, vsn(2,2,99), NULL)
|
||||
cfg(activation_mode_CFG, "activation_mode", activation_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_ACTIVATION_MODE, vsn(2,2,108), NULL)
|
||||
|
||||
cfg(metadata_pvmetadatacopies_CFG, "pvmetadatacopies", metadata_CFG_SECTION, CFG_ADVANCED, CFG_TYPE_INT, DEFAULT_PVMETADATACOPIES, vsn(1, 0, 0), NULL)
|
||||
cfg(metadata_vgmetadatacopies_CFG, "vgmetadatacopies", metadata_CFG_SECTION, CFG_ADVANCED, CFG_TYPE_INT, DEFAULT_VGMETADATACOPIES, vsn(2, 2, 69), NULL)
|
||||
cfg(metadata_pvmetadatasize_CFG, "pvmetadatasize", metadata_CFG_SECTION, CFG_ADVANCED, CFG_TYPE_INT, DEFAULT_PVMETADATASIZE, vsn(1, 0, 0), NULL)
|
||||
cfg(metadata_pvmetadataignore_CFG, "pvmetadataignore", metadata_CFG_SECTION, CFG_ADVANCED, CFG_TYPE_BOOL, DEFAULT_PVMETADATAIGNORE, vsn(2, 2, 69), NULL)
|
||||
cfg(metadata_stripesize_CFG, "stripesize", metadata_CFG_SECTION, CFG_ADVANCED, CFG_TYPE_INT, DEFAULT_STRIPESIZE, vsn(1, 0, 0), NULL)
|
||||
cfg_array(metadata_dirs_CFG, "dirs", metadata_CFG_SECTION, CFG_ADVANCED | CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL)
|
||||
cfg_array(metadata_dirs_CFG, "dirs", metadata_CFG_SECTION, CFG_ADVANCED, CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL)
|
||||
cfg(metadata_disk_areas_CFG, "disk_areas", metadata_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_ADVANCED | CFG_UNSUPPORTED, CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL)
|
||||
|
||||
cfg_section(metadata_disk_areas_CFG_SUBSECTION, "disk_areas", metadata_CFG_SECTION, CFG_ADVANCED | CFG_UNSUPPORTED | CFG_DEFAULT_UNDEFINED, vsn(1, 0, 0), NULL)
|
||||
cfg_section(disk_area_CFG_SUBSECTION, "disk_area", metadata_disk_areas_CFG_SUBSECTION, CFG_NAME_VARIABLE | CFG_ADVANCED | CFG_UNSUPPORTED | CFG_DEFAULT_UNDEFINED, vsn(1, 0, 0), NULL)
|
||||
cfg(disk_area_start_sector_CFG, "start_sector", disk_area_CFG_SUBSECTION, CFG_ADVANCED | CFG_UNSUPPORTED | CFG_DEFAULT_UNDEFINED, CFG_TYPE_INT, 0, vsn(1, 0, 0), NULL)
|
||||
cfg(disk_area_size_CFG, "size", disk_area_CFG_SUBSECTION, CFG_ADVANCED | CFG_UNSUPPORTED | CFG_DEFAULT_UNDEFINED, CFG_TYPE_INT, 0, vsn(1, 0, 0), NULL)
|
||||
cfg(disk_area_id_CFG, "id", disk_area_CFG_SUBSECTION, CFG_ADVANCED | CFG_UNSUPPORTED | CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL)
|
||||
|
||||
cfg(report_aligned_CFG, "aligned", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_BOOL, DEFAULT_REP_ALIGNED, vsn(1, 0, 0), NULL)
|
||||
cfg(report_buffered_CFG, "buffered", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_BOOL, DEFAULT_REP_BUFFERED, vsn(1, 0, 0), NULL)
|
||||
cfg(report_headings_CFG, "headings", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_BOOL, DEFAULT_REP_HEADINGS, vsn(1, 0, 0), NULL)
|
||||
cfg(report_separator_CFG, "separator", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_STRING, DEFAULT_REP_SEPARATOR, vsn(1, 0, 0), NULL)
|
||||
cfg(report_list_item_separator_CFG, "list_item_separator", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_STRING, DEFAULT_REP_LIST_ITEM_SEPARATOR, vsn(2, 2, 108), NULL)
|
||||
cfg(report_prefixes_CFG, "prefixes", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_BOOL, DEFAULT_REP_PREFIXES, vsn(2, 2, 36), NULL)
|
||||
cfg(report_quoted_CFG, "quoted", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_BOOL, DEFAULT_REP_QUOTED, vsn(2, 2, 39), NULL)
|
||||
cfg(report_colums_as_rows_CFG, "colums_as_rows", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_BOOL, DEFAULT_REP_COLUMNS_AS_ROWS, vsn(1, 0, 0), NULL)
|
||||
cfg(report_binary_values_as_numeric_CFG, "binary_values_as_numeric", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_BOOL, 0, vsn(2, 2, 108), NULL)
|
||||
cfg(report_devtypes_sort_CFG, "devtypes_sort", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_STRING, DEFAULT_DEVTYPES_SORT, vsn(2, 2, 101), NULL)
|
||||
cfg(report_devtypes_cols_CFG, "devtypes_cols", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_STRING, DEFAULT_DEVTYPES_COLS, vsn(2, 2, 101), NULL)
|
||||
cfg(report_devtypes_cols_verbose_CFG, "devtypes_cols_verbose", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_STRING, DEFAULT_DEVTYPES_COLS_VERB, vsn(2, 2, 101), NULL)
|
||||
cfg(report_lvs_sort_CFG, "lvs_sort", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_STRING, DEFAULT_LVS_SORT, vsn(1, 0, 0), NULL)
|
||||
cfg(report_lvs_cols_CFG, "lvs_cols", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_STRING, DEFAULT_LVS_COLS, vsn(1, 0, 0), NULL)
|
||||
cfg(report_lvs_cols_verbose_CFG, "lvs_cols_verbose", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_STRING, DEFAULT_LVS_COLS_VERB, vsn(1, 0, 0), NULL)
|
||||
cfg(report_vgs_sort_CFG, "vgs_sort", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_STRING, DEFAULT_VGS_SORT, vsn(1, 0, 0), NULL)
|
||||
cfg(report_vgs_cols_CFG, "vgs_cols", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_STRING, DEFAULT_VGS_COLS, vsn(1, 0, 0), NULL)
|
||||
cfg(report_vgs_cols_verbose_CFG, "vgs_cols_verbose", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_STRING, DEFAULT_VGS_COLS_VERB, vsn(1, 0, 0), NULL)
|
||||
cfg(report_pvs_sort_CFG, "pvs_sort", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_STRING, DEFAULT_PVS_SORT, vsn(1, 0, 0), NULL)
|
||||
cfg(report_pvs_cols_CFG, "pvs_cols", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_STRING, DEFAULT_PVS_COLS, vsn(1, 0, 0), NULL)
|
||||
cfg(report_pvs_cols_verbose_CFG, "pvs_cols_verbose", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_STRING, DEFAULT_PVS_COLS_VERB, vsn(1, 0, 0), NULL)
|
||||
cfg(report_segs_sort_CFG, "segs_sort", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_STRING, DEFAULT_SEGS_SORT, vsn(1, 0, 0), NULL)
|
||||
cfg(report_segs_cols_CFG, "segs_cols", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_STRING, DEFAULT_SEGS_COLS, vsn(1, 0, 0), NULL)
|
||||
cfg(report_segs_cols_verbose_CFG, "segs_cols_verbose", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_STRING, DEFAULT_SEGS_COLS_VERB, vsn(1, 0, 0), NULL)
|
||||
cfg(report_pvsegs_sort_CFG, "pvsegs_sort", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_STRING, DEFAULT_PVSEGS_SORT, vsn(1, 1, 3), NULL)
|
||||
cfg(report_pvsegs_cols_CFG, "pvsegs_cols", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_STRING, DEFAULT_PVSEGS_COLS, vsn(1, 1, 3), NULL)
|
||||
cfg(report_pvsegs_cols_verbose_CFG, "pvsegs_cols_verbose", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_STRING, DEFAULT_PVSEGS_COLS_VERB, vsn(1, 1, 3), NULL)
|
||||
cfg(report_aligned_CFG, "aligned", report_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_REP_ALIGNED, vsn(1, 0, 0), NULL)
|
||||
cfg(report_buffered_CFG, "buffered", report_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_REP_BUFFERED, vsn(1, 0, 0), NULL)
|
||||
cfg(report_headings_CFG, "headings", report_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_REP_HEADINGS, vsn(1, 0, 0), NULL)
|
||||
cfg(report_separator_CFG, "separator", report_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_REP_SEPARATOR, vsn(1, 0, 0), NULL)
|
||||
cfg(report_prefixes_CFG, "prefixes", report_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_REP_PREFIXES, vsn(2, 2, 36), NULL)
|
||||
cfg(report_quoted_CFG, "quoted", report_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_REP_QUOTED, vsn(2, 2, 39), NULL)
|
||||
cfg(report_colums_as_rows_CFG, "colums_as_rows", report_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_REP_COLUMNS_AS_ROWS, vsn(1, 0, 0), NULL)
|
||||
cfg(report_lvs_sort_CFG, "lvs_sort", report_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_LVS_SORT, vsn(1, 0, 0), NULL)
|
||||
cfg(report_lvs_cols_CFG, "lvs_cols", report_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_LVS_COLS, vsn(1, 0, 0), NULL)
|
||||
cfg(report_lvs_cols_verbose_CFG, "lvs_cols_verbose", report_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_LVS_COLS_VERB, vsn(1, 0, 0), NULL)
|
||||
cfg(report_vgs_sort_CFG, "vgs_sort", report_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_VGS_SORT, vsn(1, 0, 0), NULL)
|
||||
cfg(report_vgs_cols_CFG, "vgs_cols", report_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_VGS_COLS, vsn(1, 0, 0), NULL)
|
||||
cfg(report_vgs_cols_verbose_CFG, "vgs_cols_verbose", report_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_VGS_COLS_VERB, vsn(1, 0, 0), NULL)
|
||||
cfg(report_pvs_sort_CFG, "pvs_sort", report_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_PVS_SORT, vsn(1, 0, 0), NULL)
|
||||
cfg(report_pvs_cols_CFG, "pvs_cols", report_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_PVS_COLS, vsn(1, 0, 0), NULL)
|
||||
cfg(report_pvs_cols_verbose_CFG, "pvs_cols_verbose", report_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_PVS_COLS_VERB, vsn(1, 0, 0), NULL)
|
||||
cfg(report_segs_sort_CFG, "segs_sort", report_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_SEGS_SORT, vsn(1, 0, 0), NULL)
|
||||
cfg(report_segs_cols_CFG, "segs_cols", report_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_SEGS_COLS, vsn(1, 0, 0), NULL)
|
||||
cfg(report_segs_cols_verbose_CFG, "segs_cols_verbose", report_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_SEGS_COLS_VERB, vsn(1, 0, 0), NULL)
|
||||
cfg(report_pvsegs_sort_CFG, "pvsegs_sort", report_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_PVSEGS_SORT, vsn(1, 1, 3), NULL)
|
||||
cfg(report_pvsegs_cols_CFG, "pvsegs_cols", report_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_PVSEGS_COLS, vsn(1, 1, 3), NULL)
|
||||
cfg(report_pvsegs_cols_verbose_CFG, "pvsegs_cols_verbose", report_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_PVSEGS_COLS_VERB, vsn(1, 1, 3), NULL)
|
||||
|
||||
cfg(dmeventd_mirror_library_CFG, "mirror_library", dmeventd_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_DMEVENTD_MIRROR_LIB, vsn(1, 2, 3), NULL)
|
||||
cfg(dmeventd_raid_library_CFG, "raid_library", dmeventd_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_DMEVENTD_RAID_LIB, vsn(2, 2, 87), NULL)
|
||||
cfg(dmeventd_snapshot_library_CFG, "snapshot_library", dmeventd_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_DMEVENTD_SNAPSHOT_LIB, vsn(1, 2, 26), NULL)
|
||||
cfg(dmeventd_thin_library_CFG, "thin_library", dmeventd_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_DMEVENTD_THIN_LIB, vsn(2, 2, 89), NULL)
|
||||
cfg(dmeventd_executable_CFG, "executable", dmeventd_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_DMEVENTD_PATH, vsn(2, 2, 73), NULL)
|
||||
cfg(dmeventd_executable_CFG, "executable", dmeventd_CFG_SECTION, 0, CFG_TYPE_STRING, NULL, vsn(2, 2, 73), NULL)
|
||||
|
||||
cfg(tags_hosttags_CFG, "hosttags", tags_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_HOSTTAGS, vsn(1, 0, 18), NULL)
|
||||
|
||||
cfg_section(tag_CFG_SUBSECTION, "tag", tags_CFG_SECTION, CFG_NAME_VARIABLE | CFG_DEFAULT_UNDEFINED, vsn(1, 0, 18), NULL)
|
||||
cfg(tag_host_list_CFG, "host_list", tag_CFG_SUBSECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(1, 0, 18), NULL)
|
||||
cfg_section(tag_CFG_SUBSECTION, "tag", tags_CFG_SECTION, CFG_NAME_VARIABLE, vsn(1, 0, 18), NULL)
|
||||
cfg(tag_host_list_CFG, "host_list", tag_CFG_SUBSECTION, CFG_ALLOW_EMPTY, CFG_TYPE_STRING, NULL, vsn(1, 0, 18), NULL)
|
||||
|
||||
cfg(CFG_COUNT, NULL, root_CFG_SECTION, 0, CFG_TYPE_INT, 0, vsn(0, 0, 0), NULL)
|
||||
|
||||
@@ -33,9 +33,8 @@
|
||||
#define DEFAULT_SYSFS_SCAN 1
|
||||
#define DEFAULT_MD_COMPONENT_DETECTION 1
|
||||
#define DEFAULT_MD_CHUNK_ALIGNMENT 1
|
||||
#define DEFAULT_IGNORE_LVM_MIRRORS 1
|
||||
#define DEFAULT_MULTIPATH_COMPONENT_DETECTION 1
|
||||
#define DEFAULT_IGNORE_SUSPENDED_DEVICES 0
|
||||
#define DEFAULT_IGNORE_SUSPENDED_DEVICES 1
|
||||
#define DEFAULT_DISABLE_AFTER_ERROR_COUNT 0
|
||||
#define DEFAULT_REQUIRE_RESTOREFILE_WITH_UUID 1
|
||||
#define DEFAULT_DATA_ALIGNMENT_OFFSET_DETECTION 1
|
||||
@@ -52,12 +51,12 @@
|
||||
#define DEFAULT_METADATA_READ_ONLY 0
|
||||
#define DEFAULT_LVDISPLAY_SHOWS_FULL_DEVICE_PATH 0
|
||||
|
||||
#define DEFAULT_MIRROR_SEGTYPE "raid1"
|
||||
#define DEFAULT_MIRROR_SEGTYPE "mirror"
|
||||
#define DEFAULT_MIRRORLOG "disk"
|
||||
#define DEFAULT_MIRROR_LOG_FAULT_POLICY "allocate"
|
||||
#define DEFAULT_MIRROR_IMAGE_FAULT_POLICY "remove"
|
||||
#define DEFAULT_MIRROR_MAX_IMAGES 8 /* limited by kernel DM_KCOPYD_MAX_REGIONS */
|
||||
#define DEFAULT_RAID10_SEGTYPE "raid10"
|
||||
#define DEFAULT_RAID10_SEGTYPE "mirror"
|
||||
#define DEFAULT_RAID_FAULT_POLICY "warn"
|
||||
#define DEFAULT_DMEVENTD_RAID_LIB "libdevmapper-event-lvm2raid.so"
|
||||
#define DEFAULT_DMEVENTD_MIRROR_LIB "libdevmapper-event-lvm2mirror.so"
|
||||
@@ -66,36 +65,14 @@
|
||||
#define DEFAULT_DMEVENTD_MONITOR 1
|
||||
#define DEFAULT_BACKGROUND_POLLING 1
|
||||
|
||||
#ifndef DMEVENTD_PATH
|
||||
# define DEFAULT_DMEVENTD_PATH ""
|
||||
#else
|
||||
# define DEFAULT_DMEVENTD_PATH DMEVENTD_PATH
|
||||
#endif
|
||||
|
||||
#ifdef THIN_CHECK_NEEDS_CHECK
|
||||
# define DEFAULT_THIN_CHECK_OPTIONS "-q --clear-needs-check-flag"
|
||||
#else
|
||||
# define DEFAULT_THIN_CHECK_OPTIONS "-q"
|
||||
#endif
|
||||
|
||||
#define DEFAULT_THIN_REPAIR_OPTIONS ""
|
||||
#define DEFAULT_THIN_CHECK_OPTIONS "-q"
|
||||
#define DEFAULT_THIN_POOL_METADATA_REQUIRE_SEPARATE_PVS 0
|
||||
#define DEFAULT_THIN_POOL_MAX_METADATA_SIZE (16 * 1024 * 1024) /* KB */
|
||||
#define DEFAULT_THIN_POOL_MIN_METADATA_SIZE 2048 /* KB */
|
||||
#define DEFAULT_THIN_POOL_OPTIMAL_SIZE (128 * 1024 * 1024) /* KB */
|
||||
#define DEFAULT_THIN_POOL_CHUNK_SIZE_POLICY "generic"
|
||||
#define DEFAULT_THIN_POOL_CHUNK_SIZE 64 /* KB */
|
||||
#define DEFAULT_THIN_POOL_CHUNK_SIZE_PERFORMANCE 512 /* KB */
|
||||
#define DEFAULT_THIN_POOL_DISCARDS "passdown"
|
||||
#define DEFAULT_THIN_POOL_ZERO 1
|
||||
#define DEFAULT_POOL_METADATA_SPARE 1 /* thin + cache */
|
||||
|
||||
#define DEFAULT_CACHE_CHECK_OPTIONS "-q"
|
||||
#define DEFAULT_CACHE_REPAIR_OPTIONS ""
|
||||
#define DEFAULT_CACHE_POOL_METADATA_REQUIRE_SEPARATE_PVS 0
|
||||
#define DEFAULT_CACHE_POOL_CHUNK_SIZE 64 /* KB */
|
||||
#define DEFAULT_CACHE_POOL_MIN_METADATA_SIZE 2048 /* KB */
|
||||
#define DEFAULT_CACHE_POOL_MAX_METADATA_SIZE (16 * 1024 * 1024) /* KB */
|
||||
|
||||
#define DEFAULT_UMASK 0077
|
||||
|
||||
@@ -156,16 +133,13 @@
|
||||
|
||||
#ifdef DEVMAPPER_SUPPORT
|
||||
# define DEFAULT_ACTIVATION 1
|
||||
# define DEFAULT_RESERVED_MEMORY 8192
|
||||
# define DEFAULT_RESERVED_STACK 64 /* KB */
|
||||
# define DEFAULT_PROCESS_PRIORITY -18
|
||||
#else
|
||||
# define DEFAULT_ACTIVATION 0
|
||||
#endif
|
||||
|
||||
#define DEFAULT_RESERVED_MEMORY 8192
|
||||
#define DEFAULT_RESERVED_STACK 64 /* KB */
|
||||
#define DEFAULT_PROCESS_PRIORITY -18
|
||||
|
||||
#define DEFAULT_AUTO_SET_ACTIVATION_SKIP 1
|
||||
#define DEFAULT_ACTIVATION_MODE "degraded"
|
||||
#define DEFAULT_USE_LINEAR_TARGET 1
|
||||
#define DEFAULT_STRIPE_FILLER "error"
|
||||
#define DEFAULT_RAID_REGION_SIZE 512 /* KB */
|
||||
@@ -182,28 +156,24 @@
|
||||
#define DEFAULT_REP_PREFIXES 0
|
||||
#define DEFAULT_REP_QUOTED 1
|
||||
#define DEFAULT_REP_SEPARATOR " "
|
||||
#define DEFAULT_REP_LIST_ITEM_SEPARATOR ","
|
||||
|
||||
#define DEFAULT_LVS_COLS "lv_name,vg_name,lv_attr,lv_size,pool_lv,origin,data_percent,metadata_percent,move_pv,mirror_log,copy_percent,convert_lv"
|
||||
#define DEFAULT_LVS_COLS "lv_name,vg_name,lv_attr,lv_size,pool_lv,origin,data_percent,move_pv,mirror_log,copy_percent,convert_lv"
|
||||
#define DEFAULT_VGS_COLS "vg_name,pv_count,lv_count,snap_count,vg_attr,vg_size,vg_free"
|
||||
#define DEFAULT_PVS_COLS "pv_name,vg_name,pv_fmt,pv_attr,pv_size,pv_free"
|
||||
#define DEFAULT_SEGS_COLS "lv_name,vg_name,lv_attr,stripes,segtype,seg_size"
|
||||
#define DEFAULT_PVSEGS_COLS "pv_name,vg_name,pv_fmt,pv_attr,pv_size,pv_free,pvseg_start,pvseg_size"
|
||||
#define DEFAULT_DEVTYPES_COLS "devtype_name,devtype_max_partitions,devtype_description"
|
||||
|
||||
#define DEFAULT_LVS_COLS_VERB "lv_name,vg_name,seg_count,lv_attr,lv_size,lv_major,lv_minor,lv_kernel_major,lv_kernel_minor,pool_lv,origin,data_percent,metadata_percent,move_pv,copy_percent,mirror_log,convert_lv,lv_uuid,lv_profile"
|
||||
#define DEFAULT_VGS_COLS_VERB "vg_name,vg_attr,vg_extent_size,pv_count,lv_count,snap_count,vg_size,vg_free,vg_uuid,vg_profile"
|
||||
#define DEFAULT_LVS_COLS_VERB "lv_name,vg_name,seg_count,lv_attr,lv_size,lv_major,lv_minor,lv_kernel_major,lv_kernel_minor,pool_lv,origin,data_percent,metadata_percent,move_pv,copy_percent,mirror_log,convert_lv,lv_uuid"
|
||||
#define DEFAULT_VGS_COLS_VERB "vg_name,vg_attr,vg_extent_size,pv_count,lv_count,snap_count,vg_size,vg_free,vg_uuid"
|
||||
#define DEFAULT_PVS_COLS_VERB "pv_name,vg_name,pv_fmt,pv_attr,pv_size,pv_free,dev_size,pv_uuid"
|
||||
#define DEFAULT_SEGS_COLS_VERB "lv_name,vg_name,lv_attr,seg_start,seg_size,stripes,segtype,stripesize,chunksize"
|
||||
#define DEFAULT_PVSEGS_COLS_VERB "pv_name,vg_name,pv_fmt,pv_attr,pv_size,pv_free,pvseg_start,pvseg_size,lv_name,seg_start_pe,segtype,seg_pe_ranges"
|
||||
#define DEFAULT_DEVTYPES_COLS_VERB "devtype_name,devtype_max_partitions,devtype_description"
|
||||
|
||||
#define DEFAULT_LVS_SORT "vg_name,lv_name"
|
||||
#define DEFAULT_VGS_SORT "vg_name"
|
||||
#define DEFAULT_PVS_SORT "pv_name"
|
||||
#define DEFAULT_SEGS_SORT "vg_name,lv_name,seg_start"
|
||||
#define DEFAULT_PVSEGS_SORT "pv_name,pvseg_start"
|
||||
#define DEFAULT_DEVTYPES_SORT "devtype_name"
|
||||
|
||||
#define DEFAULT_MIRROR_DEVICE_FAULT_POLICY "remove"
|
||||
#define DEFAULT_MIRROR_LOG_FAULT_POLICY "allocate"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
* Copyright (C) 2004-2014 Red Hat, Inc. All rights reserved.
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
* Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
|
||||
*
|
||||
* This file is part of LVM2.
|
||||
*
|
||||
@@ -13,19 +13,20 @@
|
||||
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef _LVM_SIGNAL_H
|
||||
#define _LVM_SIGNAL_H
|
||||
#ifndef _LVM_TYPES_H
|
||||
#define _LVM_TYPES_H
|
||||
|
||||
void remove_ctrl_c_handler(void);
|
||||
void install_ctrl_c_handler(void);
|
||||
int init_signals(int suppress_messages);
|
||||
#include <sys/types.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
void sigint_allow(void);
|
||||
int sigint_caught(void);
|
||||
void sigint_restore(void);
|
||||
void sigint_clear(void);
|
||||
/* Define some portable printing types */
|
||||
#define PRIsize_t "zu"
|
||||
#define PRIptrdiff_t "td"
|
||||
#define PRIpid_t PRId32
|
||||
|
||||
void block_signals(uint32_t flags);
|
||||
void unblock_signals(void);
|
||||
struct str_list {
|
||||
struct dm_list list;
|
||||
const char *str;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -30,37 +30,10 @@ struct dm_list *str_list_create(struct dm_pool *mem)
|
||||
return sl;
|
||||
}
|
||||
|
||||
static int _str_list_add_no_dup_check(struct dm_pool *mem, struct dm_list *sll, const char *str, int as_first)
|
||||
{
|
||||
struct dm_str_list *sln;
|
||||
|
||||
if (!str)
|
||||
return_0;
|
||||
|
||||
if (!(sln = dm_pool_alloc(mem, sizeof(*sln))))
|
||||
return_0;
|
||||
|
||||
sln->str = str;
|
||||
if (as_first)
|
||||
dm_list_add_h(sll, &sln->list);
|
||||
else
|
||||
dm_list_add(sll, &sln->list);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int str_list_add_no_dup_check(struct dm_pool *mem, struct dm_list *sll, const char *str)
|
||||
{
|
||||
return _str_list_add_no_dup_check(mem, sll, str, 0);
|
||||
}
|
||||
|
||||
int str_list_add_h_no_dup_check(struct dm_pool *mem, struct dm_list *sll, const char *str)
|
||||
{
|
||||
return _str_list_add_no_dup_check(mem, sll, str, 1);
|
||||
}
|
||||
|
||||
int str_list_add(struct dm_pool *mem, struct dm_list *sll, const char *str)
|
||||
{
|
||||
struct str_list *sln;
|
||||
|
||||
if (!str)
|
||||
return_0;
|
||||
|
||||
@@ -68,7 +41,13 @@ int str_list_add(struct dm_pool *mem, struct dm_list *sll, const char *str)
|
||||
if (str_list_match_item(sll, str))
|
||||
return 1;
|
||||
|
||||
return str_list_add_no_dup_check(mem, sll, str);
|
||||
if (!(sln = dm_pool_alloc(mem, sizeof(*sln))))
|
||||
return_0;
|
||||
|
||||
sln->str = str;
|
||||
dm_list_add(sll, &sln->list);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void str_list_del(struct dm_list *sll, const char *str)
|
||||
@@ -76,14 +55,14 @@ void str_list_del(struct dm_list *sll, const char *str)
|
||||
struct dm_list *slh, *slht;
|
||||
|
||||
dm_list_iterate_safe(slh, slht, sll)
|
||||
if (!strcmp(str, dm_list_item(slh, struct dm_str_list)->str))
|
||||
if (!strcmp(str, dm_list_item(slh, struct str_list)->str))
|
||||
dm_list_del(slh);
|
||||
}
|
||||
|
||||
int str_list_dup(struct dm_pool *mem, struct dm_list *sllnew,
|
||||
const struct dm_list *sllold)
|
||||
{
|
||||
struct dm_str_list *sl;
|
||||
struct str_list *sl;
|
||||
|
||||
dm_list_init(sllnew);
|
||||
|
||||
@@ -100,7 +79,7 @@ int str_list_dup(struct dm_pool *mem, struct dm_list *sllnew,
|
||||
*/
|
||||
int str_list_match_item(const struct dm_list *sll, const char *str)
|
||||
{
|
||||
struct dm_str_list *sl;
|
||||
struct str_list *sl;
|
||||
|
||||
dm_list_iterate_items(sl, sll)
|
||||
if (!strcmp(str, sl->str))
|
||||
@@ -115,7 +94,7 @@ int str_list_match_item(const struct dm_list *sll, const char *str)
|
||||
*/
|
||||
int str_list_match_list(const struct dm_list *sll, const struct dm_list *sll2, const char **tag_matched)
|
||||
{
|
||||
struct dm_str_list *sl;
|
||||
struct str_list *sl;
|
||||
|
||||
dm_list_iterate_items(sl, sll)
|
||||
if (str_list_match_item(sll2, sl->str)) {
|
||||
@@ -132,7 +111,7 @@ int str_list_match_list(const struct dm_list *sll, const struct dm_list *sll2, c
|
||||
*/
|
||||
int str_list_lists_equal(const struct dm_list *sll, const struct dm_list *sll2)
|
||||
{
|
||||
struct dm_str_list *sl;
|
||||
struct str_list *sl;
|
||||
|
||||
if (dm_list_size(sll) != dm_list_size(sll2))
|
||||
return 0;
|
||||
|
||||
@@ -16,13 +16,8 @@
|
||||
#ifndef _LVM_STR_LIST_H
|
||||
#define _LVM_STR_LIST_H
|
||||
|
||||
struct dm_list;
|
||||
struct dm_pool;
|
||||
|
||||
struct dm_list *str_list_create(struct dm_pool *mem);
|
||||
int str_list_add(struct dm_pool *mem, struct dm_list *sll, const char *str);
|
||||
int str_list_add_no_dup_check(struct dm_pool *mem, struct dm_list *sll, const char *str);
|
||||
int str_list_add_h_no_dup_check(struct dm_pool *mem, struct dm_list *sll, const char *str);
|
||||
void str_list_del(struct dm_list *sll, const char *str);
|
||||
int str_list_match_item(const struct dm_list *sll, const char *str);
|
||||
int str_list_match_list(const struct dm_list *sll, const struct dm_list *sll2, const char **tag_matched);
|
||||
|
||||
@@ -14,13 +14,13 @@
|
||||
*/
|
||||
|
||||
#include "lib.h"
|
||||
#include "dev-cache.h"
|
||||
#include "lvm-types.h"
|
||||
#include "btree.h"
|
||||
#include "filter.h"
|
||||
#include "config.h"
|
||||
#include "toolcontext.h"
|
||||
|
||||
#ifdef UDEV_SYNC_SUPPORT
|
||||
#include <libudev.h>
|
||||
#endif
|
||||
#include <unistd.h>
|
||||
#include <sys/param.h>
|
||||
#include <dirent.h>
|
||||
@@ -52,13 +52,11 @@ static struct {
|
||||
#define _free(x) dm_pool_free(_cache.mem, (x))
|
||||
#define _strdup(x) dm_pool_strdup(_cache.mem, (x))
|
||||
|
||||
static int _insert(const char *path, const struct stat *info,
|
||||
int rec, int check_with_udev_db);
|
||||
static int _insert(const char *path, int rec, int check_with_udev_db);
|
||||
|
||||
/* Setup non-zero members of passed zeroed 'struct device' */
|
||||
static void _dev_init(struct device *dev, int max_error_count)
|
||||
{
|
||||
dev->phys_block_size = -1;
|
||||
dev->block_size = -1;
|
||||
dev->fd = -1;
|
||||
dev->read_ahead = -1;
|
||||
@@ -69,7 +67,7 @@ static void _dev_init(struct device *dev, int max_error_count)
|
||||
}
|
||||
|
||||
struct device *dev_create_file(const char *filename, struct device *dev,
|
||||
struct dm_str_list *alias, int use_malloc)
|
||||
struct str_list *alias, int use_malloc)
|
||||
{
|
||||
int allocate = !dev;
|
||||
|
||||
@@ -80,7 +78,7 @@ struct device *dev_create_file(const char *filename, struct device *dev,
|
||||
return NULL;
|
||||
}
|
||||
if (!(alias = dm_zalloc(sizeof(*alias)))) {
|
||||
log_error("struct dm_str_list allocation failed");
|
||||
log_error("struct str_list allocation failed");
|
||||
dm_free(dev);
|
||||
return NULL;
|
||||
}
|
||||
@@ -96,7 +94,7 @@ struct device *dev_create_file(const char *filename, struct device *dev,
|
||||
return NULL;
|
||||
}
|
||||
if (!(alias = _zalloc(sizeof(*alias)))) {
|
||||
log_error("struct dm_str_list allocation failed");
|
||||
log_error("struct str_list allocation failed");
|
||||
_free(dev);
|
||||
return NULL;
|
||||
}
|
||||
@@ -132,7 +130,7 @@ static struct device *_dev_create(dev_t d)
|
||||
return dev;
|
||||
}
|
||||
|
||||
void dev_set_preferred_name(struct dm_str_list *sl, struct device *dev)
|
||||
void dev_set_preferred_name(struct str_list *sl, struct device *dev)
|
||||
{
|
||||
/*
|
||||
* Don't interfere with ordering specified in config file.
|
||||
@@ -307,8 +305,8 @@ static int _compare_paths(const char *path0, const char *path1)
|
||||
|
||||
static int _add_alias(struct device *dev, const char *path)
|
||||
{
|
||||
struct dm_str_list *sl = _zalloc(sizeof(*sl));
|
||||
struct dm_str_list *strl;
|
||||
struct str_list *sl = _zalloc(sizeof(*sl));
|
||||
struct str_list *strl;
|
||||
const char *oldpath;
|
||||
int prefer_old = 1;
|
||||
|
||||
@@ -326,7 +324,7 @@ static int _add_alias(struct device *dev, const char *path)
|
||||
sl->str = path;
|
||||
|
||||
if (!dm_list_empty(&dev->aliases)) {
|
||||
oldpath = dm_list_item(dev->aliases.n, struct dm_str_list)->str;
|
||||
oldpath = dm_list_item(dev->aliases.n, struct str_list)->str;
|
||||
prefer_old = _compare_paths(path, oldpath);
|
||||
log_debug_devs("%s: Aliased to %s in device cache%s",
|
||||
path, oldpath, prefer_old ? "" : " (preferred name)");
|
||||
@@ -446,7 +444,7 @@ static int _insert_dir(const char *dir)
|
||||
return_0;
|
||||
|
||||
_collapse_slashes(path);
|
||||
r &= _insert(path, NULL, 1, 0);
|
||||
r &= _insert(path, 1, 0);
|
||||
dm_free(path);
|
||||
|
||||
free(dirent[n]);
|
||||
@@ -532,14 +530,14 @@ static int _insert_udev_dir(struct udev *udev, const char *dir)
|
||||
log_very_verbose("udev failed to return a device node for entry %s.",
|
||||
entry_name);
|
||||
else
|
||||
r &= _insert(node_name, NULL, 0, 0);
|
||||
r &= _insert(node_name, 0, 0);
|
||||
|
||||
udev_list_entry_foreach(symlink_entry, udev_device_get_devlinks_list_entry(device)) {
|
||||
if (!(symlink_name = udev_list_entry_get_name(symlink_entry)))
|
||||
log_very_verbose("udev failed to return a symlink name for entry %s.",
|
||||
entry_name);
|
||||
else
|
||||
r &= _insert(symlink_name, NULL, 0, 0);
|
||||
r &= _insert(symlink_name, 0, 0);
|
||||
}
|
||||
|
||||
udev_device_unref(device);
|
||||
@@ -593,49 +591,49 @@ static void _insert_dirs(struct dm_list *dirs)
|
||||
|
||||
#endif /* UDEV_SYNC_SUPPORT */
|
||||
|
||||
static int _insert(const char *path, const struct stat *info,
|
||||
int rec, int check_with_udev_db)
|
||||
static int _insert(const char *path, int rec, int check_with_udev_db)
|
||||
{
|
||||
struct stat tinfo;
|
||||
struct stat info;
|
||||
int r = 0;
|
||||
|
||||
if (!info) {
|
||||
if (stat(path, &tinfo) < 0) {
|
||||
log_sys_very_verbose("stat", path);
|
||||
return 0;
|
||||
}
|
||||
info = &tinfo;
|
||||
if (stat(path, &info) < 0) {
|
||||
log_sys_very_verbose("stat", path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (check_with_udev_db && !_device_in_udev_db(info->st_rdev)) {
|
||||
if (check_with_udev_db && !_device_in_udev_db(info.st_rdev)) {
|
||||
log_very_verbose("%s: Not in udev db", path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (S_ISDIR(info->st_mode)) { /* add a directory */
|
||||
if (S_ISDIR(info.st_mode)) { /* add a directory */
|
||||
/* check it's not a symbolic link */
|
||||
if (lstat(path, &tinfo) < 0) {
|
||||
if (lstat(path, &info) < 0) {
|
||||
log_sys_very_verbose("lstat", path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (S_ISLNK(tinfo.st_mode)) {
|
||||
if (S_ISLNK(info.st_mode)) {
|
||||
log_debug_devs("%s: Symbolic link to directory", path);
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (rec && !_insert_dir(path))
|
||||
return_0;
|
||||
if (rec)
|
||||
r = _insert_dir(path);
|
||||
|
||||
} else { /* add a device */
|
||||
if (!S_ISBLK(info->st_mode)) {
|
||||
if (!S_ISBLK(info.st_mode)) {
|
||||
log_debug_devs("%s: Not a block device", path);
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!_insert_dev(path, info->st_rdev))
|
||||
if (!_insert_dev(path, info.st_rdev))
|
||||
return_0;
|
||||
|
||||
r = 1;
|
||||
}
|
||||
|
||||
return 1;
|
||||
return r;
|
||||
}
|
||||
|
||||
static void _full_scan(int dev_scan)
|
||||
@@ -678,7 +676,7 @@ static int _init_preferred_names(struct cmd_context *cmd)
|
||||
|
||||
_cache.preferred_names_matcher = NULL;
|
||||
|
||||
if (!(cn = find_config_tree_node(cmd, devices_preferred_names_CFG, NULL)) ||
|
||||
if (!(cn = find_config_tree_node(cmd, devices_preferred_names_CFG)) ||
|
||||
cn->v->type == DM_CFG_EMPTY_ARRAY) {
|
||||
log_very_verbose("devices/preferred_names not found in config file: "
|
||||
"using built-in preferences");
|
||||
@@ -762,44 +760,21 @@ int dev_cache_init(struct cmd_context *cmd)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns number of devices still open.
|
||||
*/
|
||||
static int _check_for_open_devices(int close_immediate)
|
||||
static void _check_closed(struct device *dev)
|
||||
{
|
||||
struct device *dev;
|
||||
struct dm_hash_node *n;
|
||||
int num_open = 0;
|
||||
|
||||
dm_hash_iterate(n, _cache.names) {
|
||||
dev = (struct device *) dm_hash_get_data(_cache.names, n);
|
||||
if (dev->fd >= 0) {
|
||||
log_error("Device '%s' has been left open (%d remaining references).",
|
||||
dev_name(dev), dev->open_count);
|
||||
num_open++;
|
||||
if (close_immediate)
|
||||
dev_close_immediate(dev);
|
||||
}
|
||||
}
|
||||
|
||||
return num_open;
|
||||
if (dev->fd >= 0)
|
||||
log_error("Device '%s' has been left open.", dev_name(dev));
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns number of devices left open.
|
||||
*/
|
||||
int dev_cache_check_for_open_devices(void)
|
||||
static void _check_for_open_devices(void)
|
||||
{
|
||||
return _check_for_open_devices(0);
|
||||
dm_hash_iter(_cache.names, (dm_hash_iterate_fn) _check_closed);
|
||||
}
|
||||
|
||||
int dev_cache_exit(void)
|
||||
void dev_cache_exit(void)
|
||||
{
|
||||
int num_open = 0;
|
||||
|
||||
if (_cache.names)
|
||||
if ((num_open = _check_for_open_devices(1)) > 0)
|
||||
log_error(INTERNAL_ERROR "%d device(s) were left open and have been closed.", num_open);
|
||||
_check_for_open_devices();
|
||||
|
||||
if (_cache.preferred_names_matcher)
|
||||
_cache.preferred_names_matcher = NULL;
|
||||
@@ -818,8 +793,6 @@ int dev_cache_exit(void)
|
||||
_cache.has_scanned = 0;
|
||||
dm_list_init(&_cache.dirs);
|
||||
dm_list_init(&_cache.files);
|
||||
|
||||
return (!num_open);
|
||||
}
|
||||
|
||||
int dev_cache_add_dir(const char *path)
|
||||
@@ -888,7 +861,7 @@ const char *dev_name_confirmed(struct device *dev, int quiet)
|
||||
return dev_name(dev);
|
||||
|
||||
while ((r = stat(name = dm_list_item(dev->aliases.n,
|
||||
struct dm_str_list)->str, &buf)) ||
|
||||
struct str_list)->str, &buf)) ||
|
||||
(buf.st_rdev != dev->dev)) {
|
||||
if (r < 0) {
|
||||
if (quiet)
|
||||
@@ -914,7 +887,7 @@ const char *dev_name_confirmed(struct device *dev, int quiet)
|
||||
if (dm_list_size(&dev->aliases) > 1) {
|
||||
dm_list_del(dev->aliases.n);
|
||||
if (!r)
|
||||
_insert(name, &buf, 0, obtain_device_list_from_udev());
|
||||
_insert(name, 0, obtain_device_list_from_udev());
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -936,20 +909,13 @@ struct device *dev_cache_get(const char *name, struct dev_filter *f)
|
||||
return d;
|
||||
|
||||
/* If the entry's wrong, remove it */
|
||||
if (stat(name, &buf) < 0) {
|
||||
if (d)
|
||||
dm_hash_remove(_cache.names, name);
|
||||
log_sys_very_verbose("stat", name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (d && (buf.st_rdev != d->dev)) {
|
||||
if (d && (stat(name, &buf) || (buf.st_rdev != d->dev))) {
|
||||
dm_hash_remove(_cache.names, name);
|
||||
d = NULL;
|
||||
}
|
||||
|
||||
if (!d) {
|
||||
_insert(name, &buf, 0, obtain_device_list_from_udev());
|
||||
_insert(name, 0, obtain_device_list_from_udev());
|
||||
d = (struct device *) dm_hash_lookup(_cache.names, name);
|
||||
if (!d) {
|
||||
_full_scan(0);
|
||||
@@ -957,11 +923,8 @@ struct device *dev_cache_get(const char *name, struct dev_filter *f)
|
||||
}
|
||||
}
|
||||
|
||||
if (!d || (f && !(d->flags & DEV_REGULAR) && !(f->passes_filter(f, d))))
|
||||
return NULL;
|
||||
|
||||
log_debug_devs("Using %s", dev_name(d));
|
||||
return d;
|
||||
return (d && (!f || (d->flags & DEV_REGULAR) ||
|
||||
f->passes_filter(f, d))) ? d : NULL;
|
||||
}
|
||||
|
||||
static struct device *_dev_cache_seek_devt(dev_t dev)
|
||||
@@ -1009,11 +972,9 @@ struct dev_iter *dev_iter_create(struct dev_filter *f, int dev_scan)
|
||||
if (dev_scan && !trust_cache()) {
|
||||
/* Flag gets reset between each command */
|
||||
if (!full_scan_done()) {
|
||||
if (f && f->wipe) {
|
||||
f->wipe(f); /* might call _full_scan(1) */
|
||||
if (!full_scan_done())
|
||||
_full_scan(1);
|
||||
} else
|
||||
if (f && f->wipe)
|
||||
f->wipe(f); /* Calls _full_scan(1) */
|
||||
else
|
||||
_full_scan(1);
|
||||
}
|
||||
} else
|
||||
@@ -1046,10 +1007,8 @@ struct device *dev_iter_get(struct dev_iter *iter)
|
||||
while (iter->current) {
|
||||
struct device *d = _iter_next(iter);
|
||||
if (!iter->filter || (d->flags & DEV_REGULAR) ||
|
||||
iter->filter->passes_filter(iter->filter, d)) {
|
||||
log_debug_devs("Using %s", dev_name(d));
|
||||
iter->filter->passes_filter(iter->filter, d))
|
||||
return d;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -1074,6 +1033,6 @@ int dev_fd(struct device *dev)
|
||||
|
||||
const char *dev_name(const struct device *dev)
|
||||
{
|
||||
return (dev && dev->aliases.n) ? dm_list_item(dev->aliases.n, struct dm_str_list)->str :
|
||||
return (dev) ? dm_list_item(dev->aliases.n, struct str_list)->str :
|
||||
"unknown device";
|
||||
}
|
||||
|
||||
@@ -36,11 +36,7 @@ struct dev_filter {
|
||||
*/
|
||||
struct cmd_context;
|
||||
int dev_cache_init(struct cmd_context *cmd);
|
||||
int dev_cache_exit(void);
|
||||
/*
|
||||
* Returns number of open devices.
|
||||
*/
|
||||
int dev_cache_check_for_open_devices(void);
|
||||
void dev_cache_exit(void);
|
||||
|
||||
/* Trigger(1) or avoid(0) a scan */
|
||||
void dev_cache_scan(int do_scan);
|
||||
@@ -54,7 +50,7 @@ struct device *dev_cache_get(const char *name, struct dev_filter *f);
|
||||
// TODO
|
||||
struct device *dev_cache_get_by_devt(dev_t device, struct dev_filter *f);
|
||||
|
||||
void dev_set_preferred_name(struct dm_str_list *sl, struct device *dev);
|
||||
void dev_set_preferred_name(struct str_list *sl, struct device *dev);
|
||||
|
||||
/*
|
||||
* Object for iterating through the cache.
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
*/
|
||||
|
||||
#include "lib.h"
|
||||
#include "lvm-types.h"
|
||||
#include "device.h"
|
||||
#include "metadata.h"
|
||||
#include "lvmcache.h"
|
||||
@@ -26,7 +27,7 @@
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#ifdef __linux__
|
||||
#ifdef linux
|
||||
# define u64 uint64_t /* Missing without __KERNEL__ */
|
||||
# undef WNOHANG /* Avoid redefinition */
|
||||
# undef WUNTRACED /* Avoid redefinition */
|
||||
@@ -122,65 +123,23 @@ static int _io(struct device_area *where, char *buffer, int should_write)
|
||||
*---------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* Get the physical and logical block size for a device.
|
||||
* Get the sector size from an _open_ device.
|
||||
*/
|
||||
int dev_get_block_size(struct device *dev, unsigned int *physical_block_size, unsigned int *block_size)
|
||||
static int _get_block_size(struct device *dev, unsigned int *size)
|
||||
{
|
||||
const char *name = dev_name(dev);
|
||||
int needs_open;
|
||||
int r = 1;
|
||||
|
||||
needs_open = (!dev->open_count && (dev->phys_block_size == -1 || dev->block_size == -1));
|
||||
|
||||
if (needs_open && !dev_open_readonly(dev))
|
||||
return_0;
|
||||
|
||||
if (dev->block_size == -1) {
|
||||
if (ioctl(dev_fd(dev), BLKBSZGET, &dev->block_size) < 0) {
|
||||
log_sys_error("ioctl BLKBSZGET", name);
|
||||
r = 0;
|
||||
goto out;
|
||||
return 0;
|
||||
}
|
||||
log_debug_devs("%s: block size is %u bytes", name, dev->block_size);
|
||||
}
|
||||
|
||||
#ifdef BLKPBSZGET
|
||||
/* BLKPBSZGET is available in kernel >= 2.6.32 only */
|
||||
if (dev->phys_block_size == -1) {
|
||||
if (ioctl(dev_fd(dev), BLKPBSZGET, &dev->phys_block_size) < 0) {
|
||||
log_sys_error("ioctl BLKPBSZGET", name);
|
||||
r = 0;
|
||||
goto out;
|
||||
}
|
||||
log_debug_devs("%s: physical block size is %u bytes", name, dev->phys_block_size);
|
||||
}
|
||||
#elif BLKSSZGET
|
||||
/* if we can't get physical block size, just use logical block size instead */
|
||||
if (dev->phys_block_size == -1) {
|
||||
if (ioctl(dev_fd(dev), BLKSSZGET, &dev->phys_block_size) < 0) {
|
||||
log_sys_error("ioctl BLKSSZGET", name);
|
||||
r = 0;
|
||||
goto out;
|
||||
}
|
||||
log_debug_devs("%s: physical block size can't be determined, using logical "
|
||||
"block size of %u bytes", name, dev->phys_block_size);
|
||||
}
|
||||
#else
|
||||
/* if even BLKSSZGET is not available, use default 512b */
|
||||
if (dev->phys_block_size == -1) {
|
||||
dev->phys_block_size = 512;
|
||||
log_debug_devs("%s: physical block size can't be determined, using block "
|
||||
"size of %u bytes instead", name, dev->phys_block_size);
|
||||
}
|
||||
#endif
|
||||
*size = (unsigned int) dev->block_size;
|
||||
|
||||
*physical_block_size = (unsigned int) dev->phys_block_size;
|
||||
*block_size = (unsigned int) dev->block_size;
|
||||
out:
|
||||
if (needs_open && !dev_close(dev))
|
||||
stack;
|
||||
|
||||
return r;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -209,14 +168,13 @@ static int _aligned_io(struct device_area *where, char *buffer,
|
||||
int should_write)
|
||||
{
|
||||
char *bounce, *bounce_buf;
|
||||
unsigned int physical_block_size = 0;
|
||||
unsigned int block_size = 0;
|
||||
uintptr_t mask;
|
||||
struct device_area widened;
|
||||
int r = 0;
|
||||
|
||||
if (!(where->dev->flags & DEV_REGULAR) &&
|
||||
!dev_get_block_size(where->dev, &physical_block_size, &block_size))
|
||||
!_get_block_size(where->dev, &block_size))
|
||||
return_0;
|
||||
|
||||
if (!block_size)
|
||||
@@ -412,6 +370,36 @@ int dev_discard_blocks(struct device *dev, uint64_t offset_bytes, uint64_t size_
|
||||
return _dev_discard_blocks(dev, offset_bytes, size_bytes);
|
||||
}
|
||||
|
||||
/* FIXME Unused
|
||||
int dev_get_sectsize(struct device *dev, uint32_t *size)
|
||||
{
|
||||
int fd;
|
||||
int s;
|
||||
const char *name = dev_name(dev);
|
||||
|
||||
if ((fd = open(name, O_RDONLY)) < 0) {
|
||||
log_sys_error("open", name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ioctl(fd, BLKSSZGET, &s) < 0) {
|
||||
log_sys_error("ioctl BLKSSZGET", name);
|
||||
if (close(fd))
|
||||
log_sys_error("close", name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (close(fd))
|
||||
log_sys_error("close", name);
|
||||
|
||||
*size = (uint32_t) s;
|
||||
|
||||
log_very_verbose("%s: sector size is %" PRIu32 " bytes", name, *size);
|
||||
|
||||
return 1;
|
||||
}
|
||||
*/
|
||||
|
||||
void dev_flush(struct device *dev)
|
||||
{
|
||||
if (!(dev->flags & DEV_REGULAR) && ioctl(dev->fd, BLKFLSBUF, 0) >= 0)
|
||||
@@ -458,7 +446,9 @@ int dev_open_flags(struct device *dev, int flags, int direct, int quiet)
|
||||
log_verbose("dev_open(%s) called while suspended",
|
||||
dev_name(dev));
|
||||
|
||||
if (!(name = dev_name_confirmed(dev, quiet)))
|
||||
if (dev->flags & DEV_REGULAR)
|
||||
name = dev_name(dev);
|
||||
else if (!(name = dev_name_confirmed(dev, quiet)))
|
||||
return_0;
|
||||
|
||||
#ifdef O_DIRECT_SUPPORT
|
||||
@@ -583,14 +573,13 @@ static void _close(struct device *dev)
|
||||
if (close(dev->fd))
|
||||
log_sys_error("close", dev_name(dev));
|
||||
dev->fd = -1;
|
||||
dev->phys_block_size = -1;
|
||||
dev->block_size = -1;
|
||||
dm_list_del(&dev->open_list);
|
||||
|
||||
log_debug_devs("Closed %s", dev_name(dev));
|
||||
|
||||
if (dev->flags & DEV_ALLOCED) {
|
||||
dm_free((void *) dm_list_item(dev->aliases.n, struct dm_str_list)->
|
||||
dm_free((void *) dm_list_item(dev->aliases.n, struct str_list)->
|
||||
str);
|
||||
dm_free(dev->aliases.n);
|
||||
dm_free(dev);
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#define LUKS_SIGNATURE "LUKS\xba\xbe"
|
||||
#define LUKS_SIGNATURE_SIZE 6
|
||||
|
||||
int dev_is_luks(struct device *dev, uint64_t *offset_found)
|
||||
int dev_is_luks(struct device *dev, uint64_t *signature)
|
||||
{
|
||||
char buf[LUKS_SIGNATURE_SIZE];
|
||||
int ret = -1;
|
||||
@@ -28,8 +28,7 @@ int dev_is_luks(struct device *dev, uint64_t *offset_found)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (offset_found)
|
||||
*offset_found = 0;
|
||||
*signature = 0;
|
||||
|
||||
if (!dev_read(dev, 0, LUKS_SIGNATURE_SIZE, buf))
|
||||
goto_out;
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include "metadata.h"
|
||||
#include "xlate.h"
|
||||
|
||||
#ifdef __linux__
|
||||
#ifdef linux
|
||||
|
||||
/* Lifted from <linux/raid/md_p.h> because of difficulty including it */
|
||||
|
||||
@@ -60,7 +60,7 @@ typedef enum {
|
||||
|
||||
static uint64_t _v1_sb_offset(uint64_t size, md_minor_version_t minor_version)
|
||||
{
|
||||
uint64_t sb_offset;
|
||||
uint64_t uninitialized_var(sb_offset);
|
||||
|
||||
switch(minor_version) {
|
||||
case MD_MINOR_V0:
|
||||
@@ -72,10 +72,6 @@ static uint64_t _v1_sb_offset(uint64_t size, md_minor_version_t minor_version)
|
||||
case MD_MINOR_V2:
|
||||
sb_offset = 4 * 2;
|
||||
break;
|
||||
default:
|
||||
log_warn(INTERNAL_ERROR "WARNING: Unknown minor version %d.",
|
||||
minor_version);
|
||||
return 0;
|
||||
}
|
||||
sb_offset <<= SECTOR_SHIFT;
|
||||
|
||||
@@ -85,7 +81,7 @@ static uint64_t _v1_sb_offset(uint64_t size, md_minor_version_t minor_version)
|
||||
/*
|
||||
* Returns -1 on error
|
||||
*/
|
||||
int dev_is_md(struct device *dev, uint64_t *offset_found)
|
||||
int dev_is_md(struct device *dev, uint64_t *sb)
|
||||
{
|
||||
int ret = 1;
|
||||
md_minor_version_t minor;
|
||||
@@ -124,8 +120,8 @@ out:
|
||||
if (!dev_close(dev))
|
||||
stack;
|
||||
|
||||
if (ret && offset_found)
|
||||
*offset_found = sb_offset;
|
||||
if (ret && sb)
|
||||
*sb = sb_offset;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "lib.h"
|
||||
#include "dev-type.h"
|
||||
|
||||
#ifdef __linux__
|
||||
#ifdef linux
|
||||
|
||||
#define MAX_PAGESIZE (64 * 1024)
|
||||
#define SIGNATURE_SIZE 10
|
||||
@@ -36,7 +36,7 @@ _swap_detect_signature(const char *buf)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int dev_is_swap(struct device *dev, uint64_t *offset_found)
|
||||
int dev_is_swap(struct device *dev, uint64_t *signature)
|
||||
{
|
||||
char buf[10];
|
||||
uint64_t size;
|
||||
@@ -53,13 +53,15 @@ int dev_is_swap(struct device *dev, uint64_t *offset_found)
|
||||
return -1;
|
||||
}
|
||||
|
||||
*signature = 0;
|
||||
|
||||
for (page = 0x1000; page <= MAX_PAGESIZE; page <<= 1) {
|
||||
/*
|
||||
* skip 32k pagesize since this does not seem to be supported
|
||||
*/
|
||||
if (page == 0x8000)
|
||||
continue;
|
||||
if (size < (page >> SECTOR_SHIFT))
|
||||
if (size < page)
|
||||
break;
|
||||
if (!dev_read(dev, page - SIGNATURE_SIZE,
|
||||
SIGNATURE_SIZE, buf)) {
|
||||
@@ -67,8 +69,7 @@ int dev_is_swap(struct device *dev, uint64_t *offset_found)
|
||||
break;
|
||||
}
|
||||
if (_swap_detect_signature(buf)) {
|
||||
if (offset_found)
|
||||
*offset_found = page - SIGNATURE_SIZE;
|
||||
*signature = page - SIGNATURE_SIZE;
|
||||
ret = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -21,10 +21,6 @@
|
||||
#include <libgen.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef BLKID_WIPING_SUPPORT
|
||||
#include <blkid.h>
|
||||
#endif
|
||||
|
||||
#include "device-types.h"
|
||||
|
||||
struct dev_types *create_dev_types(const char *proc_dir,
|
||||
@@ -348,12 +344,12 @@ int dev_get_primary_dev(struct dev_types *dt, struct device *dev, dev_t *result)
|
||||
const char *sysfs_dir = dm_sysfs_dir();
|
||||
int major = (int) MAJOR(dev->dev);
|
||||
int minor = (int) MINOR(dev->dev);
|
||||
char path[PATH_MAX];
|
||||
char temp_path[PATH_MAX];
|
||||
char path[PATH_MAX+1];
|
||||
char temp_path[PATH_MAX+1];
|
||||
char buffer[64];
|
||||
struct stat info;
|
||||
FILE *fp = NULL;
|
||||
int parts, residue, size, ret = 0;
|
||||
int parts, residue, size, ret = -1;
|
||||
|
||||
/*
|
||||
* Try to get the primary dev out of the
|
||||
@@ -378,7 +374,7 @@ int dev_get_primary_dev(struct dev_types *dt, struct device *dev, dev_t *result)
|
||||
*/
|
||||
|
||||
/* check if dev is a partition */
|
||||
if (dm_snprintf(path, sizeof(path), "%s/dev/block/%d:%d/partition",
|
||||
if (dm_snprintf(path, PATH_MAX, "%s/dev/block/%d:%d/partition",
|
||||
sysfs_dir, major, minor) < 0) {
|
||||
log_error("dm_snprintf partition failed");
|
||||
goto out;
|
||||
@@ -388,8 +384,7 @@ int dev_get_primary_dev(struct dev_types *dt, struct device *dev, dev_t *result)
|
||||
if (errno != ENOENT)
|
||||
log_sys_error("stat", path);
|
||||
*result = dev->dev;
|
||||
ret = 1;
|
||||
goto out; /* dev is not a partition! */
|
||||
ret = 1; goto out; /* dev is not a partition! */
|
||||
|
||||
}
|
||||
|
||||
@@ -400,14 +395,14 @@ int dev_get_primary_dev(struct dev_types *dt, struct device *dev, dev_t *result)
|
||||
* - basename ../../block/md0/md0 = md0
|
||||
* Parent's 'dev' sysfs attribute = /sys/block/md0/dev
|
||||
*/
|
||||
if ((size = readlink(dirname(path), temp_path, sizeof(temp_path) - 1)) < 0) {
|
||||
if ((size = readlink(dirname(path), temp_path, PATH_MAX)) < 0) {
|
||||
log_sys_error("readlink", path);
|
||||
goto out;
|
||||
}
|
||||
|
||||
temp_path[size] = '\0';
|
||||
|
||||
if (dm_snprintf(path, sizeof(path), "%s/block/%s/dev",
|
||||
if (dm_snprintf(path, PATH_MAX, "%s/block/%s/dev",
|
||||
sysfs_dir, basename(dirname(temp_path))) < 0) {
|
||||
log_error("dm_snprintf dev failed");
|
||||
goto out;
|
||||
@@ -439,7 +434,7 @@ int dev_get_primary_dev(struct dev_types *dt, struct device *dev, dev_t *result)
|
||||
goto out;
|
||||
}
|
||||
*result = MKDEV((dev_t)major, minor);
|
||||
ret = 2;
|
||||
ret = 1;
|
||||
out:
|
||||
if (fp && fclose(fp))
|
||||
log_sys_error("fclose", path);
|
||||
@@ -447,233 +442,32 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef BLKID_WIPING_SUPPORT
|
||||
|
||||
static inline int _type_in_flag_list(const char *type, uint32_t flag_list)
|
||||
{
|
||||
return (((flag_list & TYPE_LVM2_MEMBER) && !strcmp(type, "LVM2_member")) ||
|
||||
((flag_list & TYPE_LVM1_MEMBER) && !strcmp(type, "LVM1_member")) ||
|
||||
((flag_list & TYPE_DM_SNAPSHOT_COW) && !strcmp(type, "DM_snapshot_cow")));
|
||||
}
|
||||
|
||||
static int _blkid_wipe(blkid_probe probe, struct device *dev, const char *name,
|
||||
uint32_t types_to_exclude, uint32_t types_no_prompt,
|
||||
int yes, force_t force)
|
||||
{
|
||||
static const char const _msg_failed_offset[] = "Failed to get offset of the %s signature on %s.";
|
||||
static const char const _msg_failed_length[] = "Failed to get length of the %s signature on %s.";
|
||||
static const char const _msg_wiping[] = "Wiping %s signature on %s.";
|
||||
const char *offset = NULL, *type = NULL, *magic = NULL,
|
||||
*usage = NULL, *label = NULL, *uuid = NULL;
|
||||
loff_t offset_value;
|
||||
size_t len;
|
||||
|
||||
if (!blkid_probe_lookup_value(probe, "TYPE", &type, NULL)) {
|
||||
if (_type_in_flag_list(type, types_to_exclude))
|
||||
return 1;
|
||||
if (blkid_probe_lookup_value(probe, "SBMAGIC_OFFSET", &offset, NULL)) {
|
||||
log_error(_msg_failed_offset, type, name);
|
||||
return 0;
|
||||
}
|
||||
if (blkid_probe_lookup_value(probe, "SBMAGIC", &magic, &len)) {
|
||||
log_error(_msg_failed_length, type, name);
|
||||
return 0;
|
||||
}
|
||||
} else if (!blkid_probe_lookup_value(probe, "PTTYPE", &type, NULL)) {
|
||||
if (blkid_probe_lookup_value(probe, "PTMAGIC_OFFSET", &offset, NULL)) {
|
||||
log_error(_msg_failed_offset, type, name);
|
||||
return 0;
|
||||
}
|
||||
if (blkid_probe_lookup_value(probe, "PTMAGIC", &magic, &len)) {
|
||||
log_error(_msg_failed_length, type, name);
|
||||
return 0;
|
||||
}
|
||||
usage = "partition table";
|
||||
} else
|
||||
return_0;
|
||||
|
||||
offset_value = strtoll(offset, NULL, 10);
|
||||
|
||||
if (!usage)
|
||||
(void) blkid_probe_lookup_value(probe, "USAGE", &usage, NULL);
|
||||
(void) blkid_probe_lookup_value(probe, "LABEL", &label, NULL);
|
||||
(void) blkid_probe_lookup_value(probe, "UUID", &uuid, NULL);
|
||||
/* Return values ignored here, in the worst case we print NULL */
|
||||
|
||||
log_verbose("Found existing signature on %s at offset %s: LABEL=\"%s\" "
|
||||
"UUID=\"%s\" TYPE=\"%s\" USAGE=\"%s\"",
|
||||
name, offset, label, uuid, type, usage);
|
||||
|
||||
if (!_type_in_flag_list(type, types_no_prompt)) {
|
||||
if (!yes && (force == PROMPT) &&
|
||||
yes_no_prompt("WARNING: %s signature detected on %s at offset %s. "
|
||||
"Wipe it? [y/n]: ", type, name, offset) == 'n') {
|
||||
log_error("Aborted wiping of %s.", type);
|
||||
return 0;
|
||||
}
|
||||
log_print_unless_silent(_msg_wiping, type, name);
|
||||
} else
|
||||
log_verbose(_msg_wiping, type, name);
|
||||
|
||||
if (!dev_set(dev, offset_value, len, 0)) {
|
||||
log_error("Failed to wipe %s signature on %s.", type, name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int _wipe_known_signatures_with_blkid(struct device *dev, const char *name,
|
||||
uint32_t types_to_exclude,
|
||||
uint32_t types_no_prompt,
|
||||
int yes, force_t force)
|
||||
{
|
||||
blkid_probe probe = NULL;
|
||||
int found = 0, wiped = 0, left = 0;
|
||||
int r = 0;
|
||||
|
||||
/* TODO: Should we check for valid dev - _dev_is_valid(dev)? */
|
||||
|
||||
if (!(probe = blkid_new_probe_from_filename(dev_name(dev)))) {
|
||||
log_error("Failed to create a new blkid probe for device %s.", dev_name(dev));
|
||||
goto out;
|
||||
}
|
||||
|
||||
blkid_probe_enable_partitions(probe, 1);
|
||||
blkid_probe_set_partitions_flags(probe, BLKID_PARTS_MAGIC);
|
||||
|
||||
blkid_probe_enable_superblocks(probe, 1);
|
||||
blkid_probe_set_superblocks_flags(probe, BLKID_SUBLKS_LABEL |
|
||||
BLKID_SUBLKS_UUID |
|
||||
BLKID_SUBLKS_TYPE |
|
||||
BLKID_SUBLKS_USAGE |
|
||||
BLKID_SUBLKS_VERSION |
|
||||
BLKID_SUBLKS_MAGIC |
|
||||
BLKID_SUBLKS_BADCSUM);
|
||||
|
||||
while (!blkid_do_probe(probe)) {
|
||||
found++;
|
||||
if (_blkid_wipe(probe, dev, name, types_to_exclude, types_no_prompt, yes, force))
|
||||
wiped++;
|
||||
}
|
||||
|
||||
if (!found)
|
||||
r = 1;
|
||||
|
||||
left = found - wiped;
|
||||
if (!left)
|
||||
r = 1;
|
||||
else
|
||||
log_warn("%d existing signature%s left on the device.",
|
||||
left, left > 1 ? "s" : "");
|
||||
out:
|
||||
if (probe)
|
||||
blkid_free_probe(probe);
|
||||
return r;
|
||||
}
|
||||
|
||||
#endif /* BLKID_WIPING_SUPPORT */
|
||||
|
||||
static int _wipe_signature(struct device *dev, const char *type, const char *name,
|
||||
int wipe_len, int yes, force_t force,
|
||||
int (*signature_detection_fn)(struct device *dev, uint64_t *offset_found))
|
||||
{
|
||||
int wipe;
|
||||
uint64_t offset_found;
|
||||
|
||||
wipe = signature_detection_fn(dev, &offset_found);
|
||||
if (wipe == -1) {
|
||||
log_error("Fatal error while trying to detect %s on %s.",
|
||||
type, name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (wipe == 0)
|
||||
return 1;
|
||||
|
||||
/* Specifying --yes => do not ask. */
|
||||
if (!yes && (force == PROMPT) &&
|
||||
yes_no_prompt("WARNING: %s detected on %s. Wipe it? [y/n]: ",
|
||||
type, name) == 'n') {
|
||||
log_error("Aborted wiping of %s.", type);
|
||||
return 0;
|
||||
}
|
||||
|
||||
log_print_unless_silent("Wiping %s on %s.", type, name);
|
||||
if (!dev_set(dev, offset_found, wipe_len, 0)) {
|
||||
log_error("Failed to wipe %s on %s.", type, name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int _wipe_known_signatures_with_lvm(struct device *dev, const char *name,
|
||||
uint32_t types_to_exclude __attribute__((unused)),
|
||||
uint32_t types_no_prompt __attribute__((unused)),
|
||||
int yes, force_t force)
|
||||
{
|
||||
if (!_wipe_signature(dev, "software RAID md superblock", name, 4, yes, force, dev_is_md) ||
|
||||
!_wipe_signature(dev, "swap signature", name, 10, yes, force, dev_is_swap) ||
|
||||
!_wipe_signature(dev, "LUKS signature", name, 8, yes, force, dev_is_luks))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int wipe_known_signatures(struct cmd_context *cmd, struct device *dev,
|
||||
const char *name, uint32_t types_to_exclude,
|
||||
uint32_t types_no_prompt, int yes, force_t force)
|
||||
{
|
||||
#ifdef BLKID_WIPING_SUPPORT
|
||||
if (find_config_tree_bool(cmd, allocation_use_blkid_wiping_CFG, NULL))
|
||||
return _wipe_known_signatures_with_blkid(dev, name,
|
||||
types_to_exclude,
|
||||
types_no_prompt,
|
||||
yes, force);
|
||||
#endif
|
||||
return _wipe_known_signatures_with_lvm(dev, name,
|
||||
types_to_exclude,
|
||||
types_no_prompt,
|
||||
yes, force);
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
|
||||
static int _snprintf_attr(char *buf, size_t buf_size, const char *sysfs_dir,
|
||||
const char *attribute, dev_t dev)
|
||||
{
|
||||
if (dm_snprintf(buf, buf_size, "%s/dev/block/%d:%d/%s", sysfs_dir,
|
||||
(int)MAJOR(dev), (int)MINOR(dev),
|
||||
attribute) < 0) {
|
||||
log_warn("dm_snprintf %s failed.", attribute);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
#ifdef linux
|
||||
|
||||
static unsigned long _dev_topology_attribute(struct dev_types *dt,
|
||||
const char *attribute,
|
||||
struct device *dev,
|
||||
unsigned long default_value)
|
||||
struct device *dev)
|
||||
{
|
||||
const char *sysfs_dir = dm_sysfs_dir();
|
||||
char path[PATH_MAX], buffer[64];
|
||||
static const char sysfs_fmt_str[] = "%s/dev/block/%d:%d/%s";
|
||||
char path[PATH_MAX+1], buffer[64];
|
||||
FILE *fp;
|
||||
struct stat info;
|
||||
dev_t uninitialized_var(primary);
|
||||
unsigned long result = default_value;
|
||||
unsigned long value = 0UL;
|
||||
unsigned long result = 0UL;
|
||||
|
||||
if (!attribute || !*attribute)
|
||||
goto_out;
|
||||
return_0;
|
||||
|
||||
if (!sysfs_dir || !*sysfs_dir)
|
||||
goto_out;
|
||||
return_0;
|
||||
|
||||
if (!_snprintf_attr(path, sizeof(path), sysfs_dir, attribute, dev->dev))
|
||||
goto_out;
|
||||
if (dm_snprintf(path, PATH_MAX, sysfs_fmt_str, sysfs_dir,
|
||||
(int)MAJOR(dev->dev), (int)MINOR(dev->dev),
|
||||
attribute) < 0) {
|
||||
log_error("dm_snprintf %s failed", attribute);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* check if the desired sysfs attribute exists
|
||||
@@ -682,80 +476,77 @@ static unsigned long _dev_topology_attribute(struct dev_types *dt,
|
||||
*/
|
||||
if (stat(path, &info) == -1) {
|
||||
if (errno != ENOENT) {
|
||||
log_sys_debug("stat", path);
|
||||
goto out;
|
||||
log_sys_error("stat", path);
|
||||
return 0;
|
||||
}
|
||||
if (!dev_get_primary_dev(dt, dev, &primary))
|
||||
goto out;
|
||||
return 0;
|
||||
|
||||
/* get attribute from partition's primary device */
|
||||
if (!_snprintf_attr(path, sizeof(path), sysfs_dir, attribute, primary))
|
||||
goto_out;
|
||||
|
||||
if (dm_snprintf(path, PATH_MAX, sysfs_fmt_str, sysfs_dir,
|
||||
(int)MAJOR(primary), (int)MINOR(primary),
|
||||
attribute) < 0) {
|
||||
log_error("primary dm_snprintf %s failed", attribute);
|
||||
return 0;
|
||||
}
|
||||
if (stat(path, &info) == -1) {
|
||||
if (errno != ENOENT)
|
||||
log_sys_debug("stat", path);
|
||||
goto out;
|
||||
log_sys_error("stat", path);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(fp = fopen(path, "r"))) {
|
||||
log_sys_debug("fopen", path);
|
||||
goto out;
|
||||
log_sys_error("fopen", path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!fgets(buffer, sizeof(buffer), fp)) {
|
||||
log_sys_debug("fgets", path);
|
||||
goto out_close;
|
||||
log_sys_error("fgets", path);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (sscanf(buffer, "%lu", &value) != 1) {
|
||||
log_warn("sysfs file %s not in expected format: %s", path, buffer);
|
||||
goto out_close;
|
||||
if (sscanf(buffer, "%lu", &result) != 1) {
|
||||
log_error("sysfs file %s not in expected format: %s", path,
|
||||
buffer);
|
||||
goto out;
|
||||
}
|
||||
|
||||
log_very_verbose("Device %s: %s is %lu%s.",
|
||||
dev_name(dev), attribute, result, default_value ? "" : " bytes");
|
||||
|
||||
result = value >> SECTOR_SHIFT;
|
||||
|
||||
out_close:
|
||||
if (fclose(fp))
|
||||
log_sys_debug("fclose", path);
|
||||
log_very_verbose("Device %s %s is %lu bytes.",
|
||||
dev_name(dev), attribute, result);
|
||||
|
||||
out:
|
||||
return result;
|
||||
if (fclose(fp))
|
||||
log_sys_error("fclose", path);
|
||||
|
||||
return result >> SECTOR_SHIFT;
|
||||
}
|
||||
|
||||
unsigned long dev_alignment_offset(struct dev_types *dt, struct device *dev)
|
||||
{
|
||||
return _dev_topology_attribute(dt, "alignment_offset", dev, 0UL);
|
||||
return _dev_topology_attribute(dt, "alignment_offset", dev);
|
||||
}
|
||||
|
||||
unsigned long dev_minimum_io_size(struct dev_types *dt, struct device *dev)
|
||||
{
|
||||
return _dev_topology_attribute(dt, "queue/minimum_io_size", dev, 0UL);
|
||||
return _dev_topology_attribute(dt, "queue/minimum_io_size", dev);
|
||||
}
|
||||
|
||||
unsigned long dev_optimal_io_size(struct dev_types *dt, struct device *dev)
|
||||
{
|
||||
return _dev_topology_attribute(dt, "queue/optimal_io_size", dev, 0UL);
|
||||
return _dev_topology_attribute(dt, "queue/optimal_io_size", dev);
|
||||
}
|
||||
|
||||
unsigned long dev_discard_max_bytes(struct dev_types *dt, struct device *dev)
|
||||
{
|
||||
return _dev_topology_attribute(dt, "queue/discard_max_bytes", dev, 0UL);
|
||||
return _dev_topology_attribute(dt, "queue/discard_max_bytes", dev);
|
||||
}
|
||||
|
||||
unsigned long dev_discard_granularity(struct dev_types *dt, struct device *dev)
|
||||
{
|
||||
return _dev_topology_attribute(dt, "queue/discard_granularity", dev, 0UL);
|
||||
return _dev_topology_attribute(dt, "queue/discard_granularity", dev);
|
||||
}
|
||||
|
||||
int dev_is_rotational(struct dev_types *dt, struct device *dev)
|
||||
{
|
||||
return (int) _dev_topology_attribute(dt, "queue/rotational", dev, 1UL);
|
||||
}
|
||||
#else
|
||||
|
||||
int dev_get_primary_dev(struct dev_types *dt, struct device *dev, dev_t *result)
|
||||
@@ -788,8 +579,4 @@ unsigned long dev_discard_granularity(struct dev_types *dt, struct device *dev)
|
||||
return 0UL;
|
||||
}
|
||||
|
||||
int dev_is_rotational(struct dev_types *dt, struct device *dev)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -16,11 +16,10 @@
|
||||
#define _LVM_DEV_TYPE_H
|
||||
|
||||
#include "device.h"
|
||||
#include "display.h"
|
||||
|
||||
#define NUMBER_OF_MAJORS 4096
|
||||
|
||||
#ifdef __linux__
|
||||
#ifdef linux
|
||||
# define MAJOR(dev) ((dev & 0xfff00) >> 8)
|
||||
# define MINOR(dev) ((dev & 0xff) | ((dev >> 12) & 0xfff00))
|
||||
# define MKDEV(ma,mi) ((mi & 0xff) | (ma << 8) | ((mi & ~0xff) << 12))
|
||||
@@ -59,14 +58,6 @@ int dev_is_md(struct device *dev, uint64_t *sb);
|
||||
int dev_is_swap(struct device *dev, uint64_t *signature);
|
||||
int dev_is_luks(struct device *dev, uint64_t *signature);
|
||||
|
||||
/* Signature wiping. */
|
||||
#define TYPE_LVM1_MEMBER 0x001
|
||||
#define TYPE_LVM2_MEMBER 0x002
|
||||
#define TYPE_DM_SNAPSHOT_COW 0x004
|
||||
int wipe_known_signatures(struct cmd_context *cmd, struct device *dev, const char *name,
|
||||
uint32_t types_to_exclude, uint32_t types_no_prompt,
|
||||
int yes, force_t force);
|
||||
|
||||
/* Type-specific device properties */
|
||||
unsigned long dev_md_stripe_width(struct dev_types *dt, struct device *dev);
|
||||
|
||||
@@ -82,6 +73,4 @@ unsigned long dev_optimal_io_size(struct dev_types *dt, struct device *dev);
|
||||
unsigned long dev_discard_max_bytes(struct dev_types *dt, struct device *dev);
|
||||
unsigned long dev_discard_granularity(struct dev_types *dt, struct device *dev);
|
||||
|
||||
int dev_is_rotational(struct dev_types *dt, struct device *dev);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -28,13 +28,11 @@ typedef struct {
|
||||
* The list can be supplemented with devices/types in the config file.
|
||||
*/
|
||||
static const dev_known_type_t _dev_known_types[] = {
|
||||
{"sd", 16, "SCSI disk"},
|
||||
{"ide", 64, "IDE disk"},
|
||||
{"sd", 16, "SCSI disk"},
|
||||
{"md", 1, "Multiple Disk (MD/SoftRAID)"},
|
||||
{"loop", 1, "Loop device"},
|
||||
{"ramdisk", 1, "RAM disk"},
|
||||
{"device-mapper", 1, "Mapped device"},
|
||||
{"mdp", 1, "Partitionable MD"},
|
||||
{"loop", 1, "Loop device"},
|
||||
{"dasd", 4, "DASD disk (IBM S/390, zSeries)"},
|
||||
{"dac960", 8, "DAC960"},
|
||||
{"nbd", 16, "Network Block Device"},
|
||||
@@ -48,7 +46,9 @@ static const dev_known_type_t _dev_known_types[] = {
|
||||
{"i2o_block", 16, "i2o Block Disk"},
|
||||
{"iseries/vd", 8, "iSeries disks"},
|
||||
{"gnbd", 1, "Network block device"},
|
||||
{"ramdisk", 1, "RAM disk"},
|
||||
{"aoe", 16, "ATA over Ethernet"},
|
||||
{"device-mapper", 1, "Mapped device"},
|
||||
{"xvd", 16, "Xen virtual block device"},
|
||||
{"vdisk", 8, "SUN's LDOM virtual block device"},
|
||||
{"ps3disk", 16, "PlayStation 3 internal disk"},
|
||||
@@ -60,8 +60,5 @@ static const dev_known_type_t _dev_known_types[] = {
|
||||
{"vtms", 16, "Violin Memory"},
|
||||
{"skd", 16, "STEC"},
|
||||
{"scm", 8, "Storage Class Memory (IBM S/390)"},
|
||||
{"bcache", 1, "bcache block device cache"},
|
||||
{"nvme", 64, "NVM Express"},
|
||||
{"zvol", 16, "ZFS Zvols"},
|
||||
{"", 0, ""}
|
||||
};
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
* pointer comparisons are valid.
|
||||
*/
|
||||
struct device {
|
||||
struct dm_list aliases; /* struct dm_str_list */
|
||||
struct dm_list aliases; /* struct str_list from lvm-types.h */
|
||||
dev_t dev;
|
||||
|
||||
/* private */
|
||||
@@ -41,7 +41,6 @@ struct device {
|
||||
int open_count;
|
||||
int error_count;
|
||||
int max_error_count;
|
||||
int phys_block_size;
|
||||
int block_size;
|
||||
int read_ahead;
|
||||
uint32_t flags;
|
||||
@@ -66,8 +65,8 @@ struct device_area {
|
||||
/*
|
||||
* All io should use these routines.
|
||||
*/
|
||||
int dev_get_block_size(struct device *dev, unsigned int *phys_block_size, unsigned int *block_size);
|
||||
int dev_get_size(const struct device *dev, uint64_t *size);
|
||||
int dev_get_sectsize(struct device *dev, uint32_t *size);
|
||||
int dev_get_read_ahead(struct device *dev, uint32_t *read_ahead);
|
||||
int dev_discard_blocks(struct device *dev, uint64_t offset_bytes, uint64_t size_bytes);
|
||||
|
||||
@@ -95,7 +94,7 @@ int dev_set(struct device *dev, uint64_t offset, size_t len, int value);
|
||||
void dev_flush(struct device *dev);
|
||||
|
||||
struct device *dev_create_file(const char *filename, struct device *dev,
|
||||
struct dm_str_list *alias, int use_malloc);
|
||||
struct str_list *alias, int use_malloc);
|
||||
|
||||
/* Return a valid device name from the alias list; NULL otherwise */
|
||||
const char *dev_name_confirmed(struct device *dev, int quiet);
|
||||
|
||||
@@ -20,9 +20,6 @@
|
||||
#include "toolcontext.h"
|
||||
#include "segtype.h"
|
||||
#include "defaults.h"
|
||||
#include "lvm-signal.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#define SIZE_BUF 128
|
||||
|
||||
@@ -42,7 +39,98 @@ static const struct {
|
||||
ALLOC_INHERIT, "inherit", 'i'}
|
||||
};
|
||||
|
||||
static const int _num_policies = DM_ARRAY_SIZE(_policies);
|
||||
static const int _num_policies = sizeof(_policies) / sizeof(*_policies);
|
||||
|
||||
uint64_t units_to_bytes(const char *units, char *unit_type)
|
||||
{
|
||||
char *ptr = NULL;
|
||||
uint64_t v;
|
||||
double custom_value = 0;
|
||||
uint64_t multiplier;
|
||||
|
||||
if (isdigit(*units)) {
|
||||
custom_value = strtod(units, &ptr);
|
||||
if (ptr == units)
|
||||
return 0;
|
||||
v = (uint64_t) strtoull(units, NULL, 10);
|
||||
if ((double) v == custom_value)
|
||||
custom_value = 0; /* Use integer arithmetic */
|
||||
units = ptr;
|
||||
} else
|
||||
v = 1;
|
||||
|
||||
/* Only one units char permitted. */
|
||||
if (units[0] && units[1])
|
||||
return 0;
|
||||
|
||||
if (v == 1)
|
||||
*unit_type = *units;
|
||||
else
|
||||
*unit_type = 'U';
|
||||
|
||||
switch (*units) {
|
||||
case 'h':
|
||||
case 'H':
|
||||
multiplier = v = UINT64_C(1);
|
||||
*unit_type = *units;
|
||||
break;
|
||||
case 'b':
|
||||
case 'B':
|
||||
multiplier = UINT64_C(1);
|
||||
break;
|
||||
#define KILO UINT64_C(1024)
|
||||
case 's':
|
||||
case 'S':
|
||||
multiplier = (KILO/2);
|
||||
break;
|
||||
case 'k':
|
||||
multiplier = KILO;
|
||||
break;
|
||||
case 'm':
|
||||
multiplier = KILO * KILO;
|
||||
break;
|
||||
case 'g':
|
||||
multiplier = KILO * KILO * KILO;
|
||||
break;
|
||||
case 't':
|
||||
multiplier = KILO * KILO * KILO * KILO;
|
||||
break;
|
||||
case 'p':
|
||||
multiplier = KILO * KILO * KILO * KILO * KILO;
|
||||
break;
|
||||
case 'e':
|
||||
multiplier = KILO * KILO * KILO * KILO * KILO * KILO;
|
||||
break;
|
||||
#undef KILO
|
||||
#define KILO UINT64_C(1000)
|
||||
case 'K':
|
||||
multiplier = KILO;
|
||||
break;
|
||||
case 'M':
|
||||
multiplier = KILO * KILO;
|
||||
break;
|
||||
case 'G':
|
||||
multiplier = KILO * KILO * KILO;
|
||||
break;
|
||||
case 'T':
|
||||
multiplier = KILO * KILO * KILO * KILO;
|
||||
break;
|
||||
case 'P':
|
||||
multiplier = KILO * KILO * KILO * KILO * KILO;
|
||||
break;
|
||||
case 'E':
|
||||
multiplier = KILO * KILO * KILO * KILO * KILO * KILO;
|
||||
break;
|
||||
#undef KILO
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (custom_value)
|
||||
return (uint64_t) (custom_value * multiplier);
|
||||
else
|
||||
return v * multiplier;
|
||||
}
|
||||
|
||||
char alloc_policy_char(alloc_policy_t alloc)
|
||||
{
|
||||
@@ -86,24 +174,11 @@ alloc_policy_t get_alloc_from_string(const char *str)
|
||||
return ALLOC_INVALID;
|
||||
}
|
||||
|
||||
static const char *_percent_types[7] = { "NONE", "VG", "FREE", "LV", "PVS", "ORIGIN" };
|
||||
|
||||
const char *get_percent_string(percent_type_t def)
|
||||
{
|
||||
return _percent_types[def];
|
||||
}
|
||||
|
||||
const char *display_lvname(const struct logical_volume *lv)
|
||||
{
|
||||
/* On allocation failure, just return the LV name. */
|
||||
return lv_fullname_dup(lv->vg->cmd->mem, lv) ? : lv->name;
|
||||
}
|
||||
|
||||
#define BASE_UNKNOWN 0
|
||||
#define BASE_SHARED 1
|
||||
#define BASE_1024 8
|
||||
#define BASE_1000 15
|
||||
#define BASE_SPECIAL 21
|
||||
#define BASE_1024 7
|
||||
#define BASE_1000 13
|
||||
#define BASE_SPECIAL 19
|
||||
#define NUM_UNIT_PREFIXES 6
|
||||
#define NUM_SPECIAL 3
|
||||
|
||||
@@ -113,7 +188,7 @@ static const char *_display_size(const struct cmd_context *cmd,
|
||||
{
|
||||
unsigned base = BASE_UNKNOWN;
|
||||
unsigned s;
|
||||
int suffix, precision;
|
||||
int suffix = 1, precision;
|
||||
uint64_t byte = UINT64_C(0);
|
||||
uint64_t units = UINT64_C(1024);
|
||||
char *size_buf = NULL;
|
||||
@@ -128,29 +203,27 @@ static const char *_display_size(const struct cmd_context *cmd,
|
||||
{" Gigabyte", " GB", "G"}, /* [4] */
|
||||
{" Megabyte", " MB", "M"}, /* [5] */
|
||||
{" Kilobyte", " KB", "K"}, /* [6] */
|
||||
{" Byte ", " B", "B"}, /* [7] */
|
||||
|
||||
/* BASE_1024 - Used if cmd->si_unit_consistency = 1 */
|
||||
{" Exbibyte", " EiB", "e"}, /* [8] */
|
||||
{" Pebibyte", " PiB", "p"}, /* [9] */
|
||||
{" Tebibyte", " TiB", "t"}, /* [10] */
|
||||
{" Gibibyte", " GiB", "g"}, /* [11] */
|
||||
{" Mebibyte", " MiB", "m"}, /* [12] */
|
||||
{" Kibibyte", " KiB", "k"}, /* [13] */
|
||||
{" Byte ", " B", "b"}, /* [14] */
|
||||
{" Exbibyte", " EiB", "e"}, /* [7] */
|
||||
{" Pebibyte", " PiB", "p"}, /* [8] */
|
||||
{" Tebibyte", " TiB", "t"}, /* [9] */
|
||||
{" Gibibyte", " GiB", "g"}, /* [10] */
|
||||
{" Mebibyte", " MiB", "m"}, /* [11] */
|
||||
{" Kibibyte", " KiB", "k"}, /* [12] */
|
||||
|
||||
/* BASE_1000 - Used if cmd->si_unit_consistency = 1 */
|
||||
{" Exabyte", " EB", "E"}, /* [15] */
|
||||
{" Petabyte", " PB", "P"}, /* [16] */
|
||||
{" Terabyte", " TB", "T"}, /* [17] */
|
||||
{" Gigabyte", " GB", "G"}, /* [18] */
|
||||
{" Megabyte", " MB", "M"}, /* [19] */
|
||||
{" Kilobyte", " kB", "K"}, /* [20] */
|
||||
{" Exabyte", " EB", "E"}, /* [13] */
|
||||
{" Petabyte", " PB", "P"}, /* [14] */
|
||||
{" Terabyte", " TB", "T"}, /* [15] */
|
||||
{" Gigabyte", " GB", "G"}, /* [16] */
|
||||
{" Megabyte", " MB", "M"}, /* [17] */
|
||||
{" Kilobyte", " kB", "K"}, /* [18] */
|
||||
|
||||
/* BASE_SPECIAL */
|
||||
{" Byte ", " B ", "B"}, /* [21] (shared with BASE_1000) */
|
||||
{" Units ", " Un", "U"}, /* [22] */
|
||||
{" Sectors ", " Se", "S"}, /* [23] */
|
||||
{" Byte ", " B ", "B"}, /* [19] */
|
||||
{" Units ", " Un", "U"}, /* [20] */
|
||||
{" Sectors ", " Se", "S"}, /* [21] */
|
||||
};
|
||||
|
||||
if (!(size_buf = dm_pool_alloc(cmd->mem, SIZE_BUF))) {
|
||||
@@ -229,7 +302,7 @@ static const char *_display_size(const struct cmd_context *cmd,
|
||||
}
|
||||
|
||||
/* FIXME Make precision configurable */
|
||||
switch (toupper(*size_str[base + s][SIZE_UNIT])) {
|
||||
switch(toupper((int) cmd->current_settings.unit_type)) {
|
||||
case 'B':
|
||||
case 'S':
|
||||
precision = 0;
|
||||
@@ -272,7 +345,7 @@ void pvdisplay_colons(const struct physical_volume *pv)
|
||||
}
|
||||
|
||||
log_print("%s:%s:%" PRIu64 ":-1:%" PRIu64 ":%" PRIu64 ":-1:%" PRIu32 ":%u:%u:%u:%s",
|
||||
pv_dev_name(pv), pv_vg_name(pv), pv->size,
|
||||
pv_dev_name(pv), pv->vg_name, pv->size,
|
||||
/* FIXME pv->pv_number, Derive or remove? */
|
||||
pv->status, /* FIXME Support old or new format here? */
|
||||
pv->status & ALLOCATABLE_PV, /* FIXME remove? */
|
||||
@@ -433,11 +506,11 @@ int lvdisplay_full(struct cmd_context *cmd,
|
||||
struct lv_segment *snap_seg = NULL, *mirror_seg = NULL;
|
||||
struct lv_segment *seg = NULL;
|
||||
int lvm1compat;
|
||||
dm_percent_t snap_percent;
|
||||
percent_t snap_percent;
|
||||
int thin_data_active = 0, thin_metadata_active = 0;
|
||||
dm_percent_t thin_data_percent, thin_metadata_percent;
|
||||
percent_t thin_data_percent, thin_metadata_percent;
|
||||
int thin_active = 0;
|
||||
dm_percent_t thin_percent;
|
||||
percent_t thin_percent;
|
||||
|
||||
if (!id_write_format(&lv->lvid.id[1], uuid, sizeof(uuid)))
|
||||
return_0;
|
||||
@@ -453,7 +526,7 @@ int lvdisplay_full(struct cmd_context *cmd,
|
||||
|
||||
log_print("--- Logical volume ---");
|
||||
|
||||
lvm1compat = find_config_tree_bool(cmd, global_lvdisplay_shows_full_device_path_CFG, NULL);
|
||||
lvm1compat = find_config_tree_bool(cmd, global_lvdisplay_shows_full_device_path_CFG);
|
||||
|
||||
if (lvm1compat)
|
||||
/* /dev/vgname/lvname doen't actually exist for internal devices */
|
||||
@@ -483,7 +556,7 @@ int lvdisplay_full(struct cmd_context *cmd,
|
||||
if (inkernel &&
|
||||
(snap_active = lv_snapshot_percent(snap_seg->cow,
|
||||
&snap_percent)))
|
||||
if (snap_percent == DM_PERCENT_INVALID)
|
||||
if (snap_percent == PERCENT_INVALID)
|
||||
snap_active = 0;
|
||||
if (lvm1compat)
|
||||
log_print(" %s%s/%s [%s]",
|
||||
@@ -496,11 +569,11 @@ int lvdisplay_full(struct cmd_context *cmd,
|
||||
snap_active ? "active" : "INACTIVE");
|
||||
}
|
||||
snap_seg = NULL;
|
||||
} else if ((snap_seg = find_snapshot(lv))) {
|
||||
} else if ((snap_seg = find_cow(lv))) {
|
||||
if (inkernel &&
|
||||
(snap_active = lv_snapshot_percent(snap_seg->cow,
|
||||
&snap_percent)))
|
||||
if (snap_percent == DM_PERCENT_INVALID)
|
||||
if (snap_percent == PERCENT_INVALID)
|
||||
snap_active = 0;
|
||||
|
||||
if (lvm1compat)
|
||||
@@ -523,28 +596,27 @@ int lvdisplay_full(struct cmd_context *cmd,
|
||||
if (seg->external_lv)
|
||||
log_print("LV External origin name %s",
|
||||
seg->external_lv->name);
|
||||
if (seg->merge_lv)
|
||||
log_print("LV merging to %s",
|
||||
seg->merge_lv->name);
|
||||
if (inkernel)
|
||||
thin_active = lv_thin_percent(lv, 0, &thin_percent);
|
||||
if (lv_is_merging_origin(lv))
|
||||
log_print("LV merged with %s",
|
||||
find_snapshot(lv)->lv->name);
|
||||
} else if (lv_is_thin_pool(lv)) {
|
||||
if (lv_info(cmd, lv, 1, &info, 1, 1) && info.exists) {
|
||||
if (inkernel) {
|
||||
thin_data_active = lv_thin_pool_percent(lv, 0, &thin_data_percent);
|
||||
thin_metadata_active = lv_thin_pool_percent(lv, 1, &thin_metadata_percent);
|
||||
}
|
||||
/* FIXME: display thin_pool targets transid for activated LV as well */
|
||||
seg = first_seg(lv);
|
||||
log_print("LV Pool transaction ID %" PRIu64, seg->transaction_id);
|
||||
log_print("LV Pool metadata %s", seg->metadata_lv->name);
|
||||
log_print("LV Pool data %s", seg_lv(seg, 0)->name);
|
||||
log_print("LV Pool chunk size %s",
|
||||
display_size(cmd, seg->chunk_size));
|
||||
log_print("LV Zero new blocks %s",
|
||||
seg->zero_new_blocks ? "yes" : "no");
|
||||
}
|
||||
|
||||
if (inkernel && info.suspended)
|
||||
log_print("LV Status suspended");
|
||||
else if (activation())
|
||||
else
|
||||
log_print("LV Status %savailable",
|
||||
inkernel ? "" : "NOT ");
|
||||
|
||||
@@ -561,15 +633,15 @@ int lvdisplay_full(struct cmd_context *cmd,
|
||||
|
||||
if (thin_data_active)
|
||||
log_print("Allocated pool data %.2f%%",
|
||||
dm_percent_to_float(thin_data_percent));
|
||||
percent_to_float(thin_data_percent));
|
||||
|
||||
if (thin_metadata_active)
|
||||
log_print("Allocated metadata %.2f%%",
|
||||
dm_percent_to_float(thin_metadata_percent));
|
||||
percent_to_float(thin_metadata_percent));
|
||||
|
||||
if (thin_active)
|
||||
log_print("Mapped size %.2f%%",
|
||||
dm_percent_to_float(thin_percent));
|
||||
percent_to_float(thin_percent));
|
||||
|
||||
log_print("Current LE %u",
|
||||
snap_seg ? snap_seg->origin->le_count : lv->le_count);
|
||||
@@ -581,16 +653,16 @@ int lvdisplay_full(struct cmd_context *cmd,
|
||||
|
||||
if (snap_active)
|
||||
log_print("Allocated to snapshot %.2f%%",
|
||||
dm_percent_to_float(snap_percent));
|
||||
percent_to_float(snap_percent));
|
||||
|
||||
log_print("Snapshot chunk size %s",
|
||||
display_size(cmd, (uint64_t) snap_seg->chunk_size));
|
||||
}
|
||||
|
||||
if (lv_is_mirrored(lv)) {
|
||||
if (lv->status & MIRRORED) {
|
||||
mirror_seg = first_seg(lv);
|
||||
log_print("Mirrored volumes %" PRIu32, mirror_seg->area_count);
|
||||
if (lv_is_converting(lv))
|
||||
if (lv->status & CONVERTING)
|
||||
log_print("LV type Mirror undergoing conversion");
|
||||
}
|
||||
|
||||
@@ -663,16 +735,11 @@ int lvdisplay_segments(const struct logical_volume *lv)
|
||||
log_print("--- Segments ---");
|
||||
|
||||
dm_list_iterate_items(seg, &lv->segments) {
|
||||
log_print("%s extents %u to %u:",
|
||||
lv_is_virtual(lv) ? "Virtual" : "Logical",
|
||||
log_print("Logical extent %u to %u:",
|
||||
seg->le, seg->le + seg->len - 1);
|
||||
|
||||
log_print(" Type\t\t%s", seg->segtype->ops->name(seg));
|
||||
|
||||
if (seg->segtype->ops->target_monitored)
|
||||
log_print(" Monitoring\t\t%s",
|
||||
lvseg_monitor_dup(lv->vg->cmd->mem, seg));
|
||||
|
||||
if (seg->segtype->ops->display)
|
||||
seg->segtype->ops->display(seg);
|
||||
}
|
||||
@@ -737,14 +804,14 @@ void vgdisplay_full(const struct volume_group *vg)
|
||||
(uint64_t) vg->extent_count * vg->extent_size));
|
||||
|
||||
log_print("PE Size %s",
|
||||
display_size(vg->cmd, vg->extent_size));
|
||||
display_size(vg->cmd, (uint64_t) vg->extent_size));
|
||||
|
||||
log_print("Total PE %u", vg->extent_count);
|
||||
|
||||
log_print("Alloc PE / Size %u / %s",
|
||||
vg->extent_count - vg->free_count,
|
||||
display_size(vg->cmd,
|
||||
(uint64_t) (vg->extent_count - vg->free_count) *
|
||||
((uint64_t) vg->extent_count - vg->free_count) *
|
||||
vg->extent_size));
|
||||
|
||||
log_print("Free PE / Size %u / %s", vg->free_count,
|
||||
@@ -837,45 +904,6 @@ void display_segtypes(const struct cmd_context *cmd)
|
||||
}
|
||||
}
|
||||
|
||||
void display_tags(const struct cmd_context *cmd)
|
||||
{
|
||||
const struct dm_str_list *sl;
|
||||
|
||||
dm_list_iterate_items(sl, &cmd->tags) {
|
||||
log_print("%s", sl->str);
|
||||
}
|
||||
}
|
||||
|
||||
void display_name_error(name_error_t name_error)
|
||||
{
|
||||
switch(name_error) {
|
||||
case NAME_VALID:
|
||||
/* Valid name */
|
||||
break;
|
||||
case NAME_INVALID_EMPTY:
|
||||
log_error("Name is zero length.");
|
||||
break;
|
||||
case NAME_INVALID_HYPEN:
|
||||
log_error("Name cannot start with hyphen.");
|
||||
break;
|
||||
case NAME_INVALID_DOTS:
|
||||
log_error("Name starts with . or .. and has no "
|
||||
"following character(s).");
|
||||
break;
|
||||
case NAME_INVALID_CHARSET:
|
||||
log_error("Name contains invalid character, valid set includes: "
|
||||
"[a-zA-Z0-9.-_+].");
|
||||
break;
|
||||
case NAME_INVALID_LENGTH:
|
||||
/* Report that name length - 1 to accommodate nul*/
|
||||
log_error("Name length exceeds maximum limit of %d.", (NAME_LEN - 1));
|
||||
break;
|
||||
default:
|
||||
log_error(INTERNAL_ERROR "Unknown error %d on name validation.", name_error);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Prompt for y or n from stdin.
|
||||
* Defaults to 'no' in silent mode.
|
||||
@@ -883,9 +911,12 @@ void display_name_error(name_error_t name_error)
|
||||
*/
|
||||
char yes_no_prompt(const char *prompt, ...)
|
||||
{
|
||||
int c = 0, ret = 0, cb = 0;
|
||||
int c = 0, ret = 0;
|
||||
va_list ap;
|
||||
|
||||
if (silent_mode())
|
||||
return 'n';
|
||||
|
||||
sigint_allow();
|
||||
do {
|
||||
if (c == '\n' || !c) {
|
||||
@@ -893,17 +924,11 @@ char yes_no_prompt(const char *prompt, ...)
|
||||
vfprintf(stderr, prompt, ap);
|
||||
va_end(ap);
|
||||
fflush(stderr);
|
||||
if (silent_mode()) {
|
||||
fputc('n', stderr);
|
||||
ret = 'n';
|
||||
break;
|
||||
}
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
if ((c = getchar()) == EOF) {
|
||||
ret = 'n'; /* SIGINT */
|
||||
cb = 1;
|
||||
ret = 'n';
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -919,11 +944,8 @@ char yes_no_prompt(const char *prompt, ...)
|
||||
|
||||
sigint_restore();
|
||||
|
||||
if (cb && !sigint_caught())
|
||||
fputc(ret, stderr);
|
||||
|
||||
if (c != '\n')
|
||||
fputc('\n', stderr);
|
||||
fprintf(stderr, "\n");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -18,11 +18,10 @@
|
||||
|
||||
#include "metadata-exported.h"
|
||||
#include "locking.h"
|
||||
#include "lvm-string.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
const char *display_lvname(const struct logical_volume *lv);
|
||||
uint64_t units_to_bytes(const char *units, char *unit_type);
|
||||
|
||||
/* Specify size in KB */
|
||||
const char *display_size(const struct cmd_context *cmd, uint64_t size);
|
||||
@@ -53,9 +52,6 @@ void vgdisplay_short(const struct volume_group *vg);
|
||||
|
||||
void display_formats(const struct cmd_context *cmd);
|
||||
void display_segtypes(const struct cmd_context *cmd);
|
||||
void display_tags(const struct cmd_context *cmd);
|
||||
|
||||
void display_name_error(name_error_t name_error);
|
||||
|
||||
/*
|
||||
* Allocation policy display conversion routines.
|
||||
@@ -64,8 +60,6 @@ const char *get_alloc_string(alloc_policy_t alloc);
|
||||
char alloc_policy_char(alloc_policy_t alloc);
|
||||
alloc_policy_t get_alloc_from_string(const char *str);
|
||||
|
||||
const char *get_percent_string(percent_type_t def);
|
||||
|
||||
char yes_no_prompt(const char *prompt, ...) __attribute__ ((format(printf, 1, 2)));
|
||||
|
||||
#endif
|
||||
|
||||
@@ -63,6 +63,7 @@ static int _errseg_target_present(struct cmd_context *cmd,
|
||||
_errseg_checked = 1;
|
||||
return _errseg_present;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int _errseg_modules_needed(struct dm_pool *mem,
|
||||
const struct lv_segment *seg __attribute__((unused)),
|
||||
@@ -75,7 +76,6 @@ static int _errseg_modules_needed(struct dm_pool *mem,
|
||||
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void _errseg_destroy(struct segment_type *segtype)
|
||||
{
|
||||
@@ -88,8 +88,8 @@ static struct segtype_handler _error_ops = {
|
||||
#ifdef DEVMAPPER_SUPPORT
|
||||
.add_target_line = _errseg_add_target_line,
|
||||
.target_present = _errseg_target_present,
|
||||
.modules_needed = _errseg_modules_needed,
|
||||
#endif
|
||||
.modules_needed = _errseg_modules_needed,
|
||||
.destroy = _errseg_destroy,
|
||||
};
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
*/
|
||||
|
||||
#include "lib.h"
|
||||
#include "filter.h"
|
||||
#include "filter-composite.h"
|
||||
|
||||
static int _and_p(struct dev_filter *f, struct device *dev)
|
||||
{
|
||||
@@ -22,7 +22,9 @@ static int _and_p(struct dev_filter *f, struct device *dev)
|
||||
|
||||
for (filters = (struct dev_filter **) f->private; *filters; ++filters)
|
||||
if (!(*filters)->passes_filter(*filters, dev))
|
||||
return 0; /* No 'stack': a filter, not an error. */
|
||||
return_0;
|
||||
|
||||
log_debug_devs("Using %s", dev_name(dev));
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -90,7 +92,5 @@ struct dev_filter *composite_filter_create(int n, struct dev_filter **filters)
|
||||
cft->use_count = 0;
|
||||
cft->private = filters_copy;
|
||||
|
||||
log_debug_devs("Composite filter initialised.");
|
||||
|
||||
return cft;
|
||||
}
|
||||
|
||||
23
lib/filters/filter-composite.h
Normal file
23
lib/filters/filter-composite.h
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
* Copyright (C) 2004 Red Hat, Inc. All rights reserved.
|
||||
*
|
||||
* This file is part of LVM2.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use,
|
||||
* modify, copy, or redistribute it subject to the terms and conditions
|
||||
* of the GNU Lesser General Public License v.2.1.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef _LVM_FILTER_COMPOSITE_H
|
||||
#define _LVM_FILTER_COMPOSITE_H
|
||||
|
||||
#include "dev-cache.h"
|
||||
|
||||
struct dev_filter *composite_filter_create(int n, struct dev_filter **filters);
|
||||
|
||||
#endif
|
||||
@@ -14,9 +14,9 @@
|
||||
*/
|
||||
|
||||
#include "lib.h"
|
||||
#include "filter.h"
|
||||
#include "filter-md.h"
|
||||
|
||||
#ifdef __linux__
|
||||
#ifdef linux
|
||||
|
||||
static int _ignore_md(struct dev_filter *f __attribute__((unused)),
|
||||
struct device *dev)
|
||||
@@ -64,8 +64,6 @@ struct dev_filter *md_filter_create(struct dev_types *dt)
|
||||
f->use_count = 0;
|
||||
f->private = dt;
|
||||
|
||||
log_debug_devs("MD filter initialised.");
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Red Hat, Inc. All rights reserved.
|
||||
* Copyright (C) 2004 Luca Berra
|
||||
*
|
||||
* This file is part of LVM2.
|
||||
*
|
||||
@@ -12,12 +12,13 @@
|
||||
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "tools.h"
|
||||
#ifndef _LVM_FILTER_MD_H
|
||||
#define _LVM_FILTER_MD_H
|
||||
|
||||
int tags(struct cmd_context *cmd, int argc __attribute__((unused)),
|
||||
char **argv __attribute__((unused)))
|
||||
{
|
||||
display_tags(cmd);
|
||||
#include "dev-cache.h"
|
||||
#include "dev-type.h"
|
||||
|
||||
struct dev_filter *md_filter_create(struct dev_types *dt);
|
||||
|
||||
#endif
|
||||
|
||||
return ECMD_PROCESSED;
|
||||
}
|
||||
@@ -13,16 +13,16 @@
|
||||
*/
|
||||
|
||||
#include "lib.h"
|
||||
#include "filter.h"
|
||||
#include "filter-mpath.h"
|
||||
#include "activate.h"
|
||||
|
||||
#ifdef __linux__
|
||||
#ifdef linux
|
||||
|
||||
#include <dirent.h>
|
||||
|
||||
#define MPATH_PREFIX "mpath-"
|
||||
|
||||
static const char *_get_sysfs_name(struct device *dev)
|
||||
static const char *get_sysfs_name(struct device *dev)
|
||||
{
|
||||
const char *name;
|
||||
|
||||
@@ -40,35 +40,7 @@ static const char *_get_sysfs_name(struct device *dev)
|
||||
return name;
|
||||
}
|
||||
|
||||
static const char *_get_sysfs_name_by_devt(const char *sysfs_dir, dev_t devno,
|
||||
char *buf, size_t buf_size)
|
||||
{
|
||||
const char *name;
|
||||
char path[PATH_MAX];
|
||||
int size;
|
||||
|
||||
if (dm_snprintf(path, sizeof(path), "%s/dev/block/%d:%d", sysfs_dir,
|
||||
(int) MAJOR(devno), (int) MINOR(devno)) < 0) {
|
||||
log_error("Sysfs path string is too long.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((size = readlink(path, buf, buf_size - 1)) < 0) {
|
||||
log_sys_error("readlink", path);
|
||||
return NULL;
|
||||
}
|
||||
buf[size] = '\0';
|
||||
|
||||
if (!(name = strrchr(buf, '/'))) {
|
||||
log_error("Cannot find device name in sysfs path.");
|
||||
return NULL;
|
||||
}
|
||||
name++;
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
static int _get_sysfs_string(const char *path, char *buffer, int max_size)
|
||||
static int get_sysfs_string(const char *path, char *buffer, int max_size)
|
||||
{
|
||||
FILE *fp;
|
||||
int r = 0;
|
||||
@@ -89,7 +61,7 @@ static int _get_sysfs_string(const char *path, char *buffer, int max_size)
|
||||
return r;
|
||||
}
|
||||
|
||||
static int _get_sysfs_get_major_minor(const char *sysfs_dir, const char *kname, int *major, int *minor)
|
||||
static int get_sysfs_get_major_minor(const char *sysfs_dir, const char *kname, int *major, int *minor)
|
||||
{
|
||||
char path[PATH_MAX], buffer[64];
|
||||
|
||||
@@ -98,7 +70,7 @@ static int _get_sysfs_get_major_minor(const char *sysfs_dir, const char *kname,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!_get_sysfs_string(path, buffer, sizeof(buffer)))
|
||||
if (!get_sysfs_string(path, buffer, sizeof(buffer)))
|
||||
return_0;
|
||||
|
||||
if (sscanf(buffer, "%d:%d", major, minor) != 2) {
|
||||
@@ -109,7 +81,7 @@ static int _get_sysfs_get_major_minor(const char *sysfs_dir, const char *kname,
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int _get_parent_mpath(const char *dir, char *name, int max_size)
|
||||
static int get_parent_mpath(const char *dir, char *name, int max_size)
|
||||
{
|
||||
struct dirent *d;
|
||||
DIR *dr;
|
||||
@@ -141,12 +113,13 @@ static int _get_parent_mpath(const char *dir, char *name, int max_size)
|
||||
return r;
|
||||
}
|
||||
|
||||
static int _dev_is_mpath(struct dev_filter *f, struct device *dev)
|
||||
static int dev_is_mpath(struct dev_filter *f, struct device *dev)
|
||||
{
|
||||
struct dev_types *dt = (struct dev_types *) f->private;
|
||||
const char *part_name, *name;
|
||||
const char *name;
|
||||
char path[PATH_MAX+1];
|
||||
char parent_name[PATH_MAX+1];
|
||||
struct stat info;
|
||||
char path[PATH_MAX], parent_name[PATH_MAX];
|
||||
const char *sysfs_dir = dm_sysfs_dir();
|
||||
int major = MAJOR(dev->dev);
|
||||
int minor = MINOR(dev->dev);
|
||||
@@ -157,24 +130,38 @@ static int _dev_is_mpath(struct dev_filter *f, struct device *dev)
|
||||
return 0;
|
||||
|
||||
switch (dev_get_primary_dev(dt, dev, &primary_dev)) {
|
||||
case 2: /* The dev is partition. */
|
||||
part_name = dev_name(dev); /* name of original dev for log_debug msg */
|
||||
if (!(name = _get_sysfs_name_by_devt(sysfs_dir, primary_dev, parent_name, sizeof(parent_name))))
|
||||
return_0;
|
||||
log_debug_devs("%s: Device is a partition, using primary "
|
||||
"device %s for mpath component detection",
|
||||
part_name, name);
|
||||
break;
|
||||
case 1: /* The dev is already a primary dev. Just continue with the dev. */
|
||||
if (!(name = _get_sysfs_name(dev)))
|
||||
return_0;
|
||||
break;
|
||||
default: /* 0, error. */
|
||||
log_error("Failed to get primary device for %d:%d.", major, minor);
|
||||
return 0;
|
||||
case 0:
|
||||
/* Error. */
|
||||
log_error("Failed to get primary device for %d:%d.", major, minor);
|
||||
return 0;
|
||||
case 1:
|
||||
/* The dev is already a primary dev. Just continue with the dev. */
|
||||
break;
|
||||
case 2:
|
||||
/* The dev is partition. */
|
||||
name = dev_name(dev); /* name of original dev for log_debug msg */
|
||||
|
||||
/* Get primary dev from cache. */
|
||||
if (!(dev = dev_cache_get_by_devt(primary_dev, NULL))) {
|
||||
log_error("dev_is_mpath: failed to get device for %d:%d",
|
||||
major, minor);
|
||||
return 0;
|
||||
}
|
||||
|
||||
major = (int) MAJOR(primary_dev);
|
||||
minor = (int) MINOR(primary_dev);
|
||||
|
||||
log_debug_devs("%s: Device is a partition, using primary "
|
||||
"device %s for mpath component detection",
|
||||
name, dev_name(dev));
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (dm_snprintf(path, sizeof(path), "%s/block/%s/holders", sysfs_dir, name) < 0) {
|
||||
if (!(name = get_sysfs_name(dev)))
|
||||
return_0;
|
||||
|
||||
if (dm_snprintf(path, PATH_MAX, "%s/block/%s/holders", sysfs_dir, name) < 0) {
|
||||
log_error("Sysfs path to check mpath is too long.");
|
||||
return 0;
|
||||
}
|
||||
@@ -188,21 +175,24 @@ static int _dev_is_mpath(struct dev_filter *f, struct device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!_get_parent_mpath(path, parent_name, sizeof(parent_name)))
|
||||
if (!get_parent_mpath(path, parent_name, PATH_MAX))
|
||||
return 0;
|
||||
|
||||
if (!_get_sysfs_get_major_minor(sysfs_dir, parent_name, &major, &minor))
|
||||
if (!get_sysfs_get_major_minor(sysfs_dir, parent_name, &major, &minor))
|
||||
return_0;
|
||||
|
||||
if (major != dt->device_mapper_major)
|
||||
if (major != dt->device_mapper_major) {
|
||||
log_error("mpath major %d is not dm major %d.", major,
|
||||
dt->device_mapper_major);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return lvm_dm_prefix_check(major, minor, MPATH_PREFIX);
|
||||
}
|
||||
|
||||
static int _ignore_mpath(struct dev_filter *f, struct device *dev)
|
||||
{
|
||||
if (_dev_is_mpath(f, dev) == 1) {
|
||||
if (dev_is_mpath(f, dev) == 1) {
|
||||
log_debug_devs("%s: Skipping mpath component device", dev_name(dev));
|
||||
return 0;
|
||||
}
|
||||
@@ -238,8 +228,6 @@ struct dev_filter *mpath_filter_create(struct dev_types *dt)
|
||||
f->use_count = 0;
|
||||
f->private = dt;
|
||||
|
||||
log_debug_devs("mpath filter initialised.");
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Red Hat, Inc. All rights reserved.
|
||||
* Copyright (C) 2011 Red Hat, Inc. All rights reserved.
|
||||
*
|
||||
* This file is part of LVM2.
|
||||
*
|
||||
@@ -12,11 +12,13 @@
|
||||
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef _LVM_FLOCK_H
|
||||
#define _LVM_FLOCK_H
|
||||
#ifndef _LVM_FILTER_MPATH_H
|
||||
#define _LVM_FILTER_MPATH_H
|
||||
|
||||
void init_flock(struct cmd_context *cmd);
|
||||
int lock_file(const char *file, uint32_t flags);
|
||||
void release_flocks(int unlock);
|
||||
#include "dev-cache.h"
|
||||
#include "dev-type.h"
|
||||
|
||||
struct dev_filter *mpath_filter_create(struct dev_types *dt);
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _LVM_FLOCK_H */
|
||||
@@ -1,83 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
* Copyright (C) 2004-2012 Red Hat, Inc. All rights reserved.
|
||||
*
|
||||
* This file is part of LVM2.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use,
|
||||
* modify, copy, or redistribute it subject to the terms and conditions
|
||||
* of the GNU Lesser General Public License v.2.1.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "lib.h"
|
||||
#include "filter.h"
|
||||
|
||||
static int _passes_partitioned_filter(struct dev_filter *f, struct device *dev)
|
||||
{
|
||||
struct dev_types *dt = (struct dev_types *) f->private;
|
||||
const char *name = dev_name(dev);
|
||||
int ret = 0;
|
||||
uint64_t size;
|
||||
|
||||
/* Check it's accessible */
|
||||
if (!dev_open_readonly_quiet(dev)) {
|
||||
log_debug_devs("%s: Skipping: open failed", name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Check it's not too small */
|
||||
if (!dev_get_size(dev, &size)) {
|
||||
log_debug_devs("%s: Skipping: dev_get_size failed", name);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (size < pv_min_size()) {
|
||||
log_debug_devs("%s: Skipping: Too small to hold a PV", name);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (dev_is_partitioned(dt, dev)) {
|
||||
log_debug_devs("%s: Skipping: Partition table signature found",
|
||||
name);
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = 1;
|
||||
|
||||
out:
|
||||
if (!dev_close(dev))
|
||||
stack;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void _partitioned_filter_destroy(struct dev_filter *f)
|
||||
{
|
||||
if (f->use_count)
|
||||
log_error(INTERNAL_ERROR "Destroying partitioned filter while in use %u times.", f->use_count);
|
||||
|
||||
dm_free(f);
|
||||
}
|
||||
|
||||
struct dev_filter *partitioned_filter_create(struct dev_types *dt)
|
||||
{
|
||||
struct dev_filter *f;
|
||||
|
||||
if (!(f = dm_zalloc(sizeof(struct dev_filter)))) {
|
||||
log_error("Partitioned filter allocation failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
f->passes_filter = _passes_partitioned_filter;
|
||||
f->destroy = _partitioned_filter_destroy;
|
||||
f->use_count = 0;
|
||||
f->private = dt;
|
||||
|
||||
log_debug_devs("Partitioned filter initialised.");
|
||||
|
||||
return f;
|
||||
}
|
||||
@@ -14,7 +14,7 @@
|
||||
*/
|
||||
|
||||
#include "lib.h"
|
||||
#include "filter.h"
|
||||
#include "filter-persistent.h"
|
||||
#include "config.h"
|
||||
#include "lvm-file.h"
|
||||
#include "activate.h"
|
||||
@@ -114,7 +114,7 @@ int persistent_filter_load(struct dev_filter *f, struct dm_config_tree **cft_out
|
||||
return_0;
|
||||
}
|
||||
|
||||
if (!(cft = config_open(CONFIG_FILE_SPECIAL, pf->file, 1)))
|
||||
if (!(cft = config_file_open(pf->file, 1)))
|
||||
return_0;
|
||||
|
||||
if (!config_file_read(cft))
|
||||
@@ -139,7 +139,7 @@ int persistent_filter_load(struct dev_filter *f, struct dm_config_tree **cft_out
|
||||
if (r && cft_out)
|
||||
*cft_out = cft;
|
||||
else
|
||||
config_destroy(cft);
|
||||
config_file_destroy(cft);
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -263,7 +263,7 @@ out:
|
||||
fcntl_unlock_file(lockfd);
|
||||
|
||||
if (cft)
|
||||
config_destroy(cft);
|
||||
config_file_destroy(cft);
|
||||
|
||||
return r;
|
||||
}
|
||||
@@ -272,7 +272,7 @@ static int _lookup_p(struct dev_filter *f, struct device *dev)
|
||||
{
|
||||
struct pfilter *pf = (struct pfilter *) f->private;
|
||||
void *l = dm_hash_lookup(pf->devices, dev_name(dev));
|
||||
struct dm_str_list *sl;
|
||||
struct str_list *sl;
|
||||
|
||||
/* Cached BAD? */
|
||||
if (l == PF_BAD_DEVICE) {
|
||||
@@ -366,8 +366,6 @@ struct dev_filter *persistent_filter_create(struct dev_types *dt,
|
||||
f->wipe = _persistent_filter_wipe;
|
||||
f->dump = _persistent_filter_dump;
|
||||
|
||||
log_debug_devs("Persistent filter initialised.");
|
||||
|
||||
return f;
|
||||
|
||||
bad:
|
||||
|
||||
28
lib/filters/filter-persistent.h
Normal file
28
lib/filters/filter-persistent.h
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
* Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
|
||||
*
|
||||
* This file is part of LVM2.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use,
|
||||
* modify, copy, or redistribute it subject to the terms and conditions
|
||||
* of the GNU Lesser General Public License v.2.1.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef _LVM_FILTER_PERSISTENT_H
|
||||
#define _LVM_FILTER_PERSISTENT_H
|
||||
|
||||
#include "dev-cache.h"
|
||||
#include "dev-type.h"
|
||||
|
||||
struct dev_filter *persistent_filter_create(struct dev_types *dt,
|
||||
struct dev_filter *f,
|
||||
const char *file);
|
||||
|
||||
int persistent_filter_load(struct dev_filter *f, struct dm_config_tree **cft_out);
|
||||
|
||||
#endif
|
||||
@@ -14,7 +14,7 @@
|
||||
*/
|
||||
|
||||
#include "lib.h"
|
||||
#include "filter.h"
|
||||
#include "filter-regex.h"
|
||||
|
||||
struct rfilter {
|
||||
struct dm_pool *mem;
|
||||
@@ -149,7 +149,7 @@ static int _accept_p(struct dev_filter *f, struct device *dev)
|
||||
{
|
||||
int m, first = 1, rejected = 0;
|
||||
struct rfilter *rf = (struct rfilter *) f->private;
|
||||
struct dm_str_list *sl;
|
||||
struct str_list *sl;
|
||||
|
||||
dm_list_iterate_items(sl, &dev->aliases) {
|
||||
m = dm_regex_match(rf->engine, sl->str);
|
||||
@@ -212,9 +212,6 @@ struct dev_filter *regex_filter_create(const struct dm_config_value *patterns)
|
||||
f->destroy = _regex_destroy;
|
||||
f->use_count = 0;
|
||||
f->private = rf;
|
||||
|
||||
log_debug_devs("Regex filter initialised.");
|
||||
|
||||
return f;
|
||||
|
||||
bad:
|
||||
|
||||
31
lib/filters/filter-regex.h
Normal file
31
lib/filters/filter-regex.h
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
* Copyright (C) 2004 Red Hat, Inc. All rights reserved.
|
||||
*
|
||||
* This file is part of LVM2.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use,
|
||||
* modify, copy, or redistribute it subject to the terms and conditions
|
||||
* of the GNU Lesser General Public License v.2.1.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef _LVM_FILTER_REGEX_H
|
||||
#define _LVM_FILTER_REGEX_H
|
||||
|
||||
#include "dev-cache.h"
|
||||
|
||||
/*
|
||||
* patterns must be an array of strings of the form:
|
||||
* [ra]<sep><regex><sep>, eg,
|
||||
* r/cdrom/ - reject cdroms
|
||||
* a|loop/[0-4]| - accept loops 0 to 4
|
||||
* r|.*| - reject everything else
|
||||
*/
|
||||
|
||||
struct dev_filter *regex_filter_create(const struct dm_config_value *patterns);
|
||||
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user