1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00
Commit Graph

323 Commits

Author SHA1 Message Date
Joe Thornber
5b39a977ca [REGEX] calculate dfa states on demand 2010-07-21 12:09:12 +00:00
Joe Thornber
fee2e890af [REGEX] add a fingerprinting facility to allow test code to compare dfas 2010-07-20 15:32:07 +00:00
Fabio M. Di Nitto
8c4e8a185a Add dm_create_lockfile to libdm to handle pidfiles for all daemons.
Switch dmeventd to use dm_create_lockfile and drop duplicate code.
Allow clvmd pidfile to be configurable.
Switch cmirrord and clvmd to use dm_create_lockfile.
2010-07-13 13:51:01 +00:00
Alasdair Kergon
08f1ddea6c Use __attribute__ consistently throughout. 2010-07-09 15:34:40 +00:00
Alasdair Kergon
44cd0f4780 Add parentheses to some libdevmapper.h macro arguments. 2010-07-05 22:22:43 +00:00
Alasdair Kergon
db3c1ac1c8 Add printf format attributes to yes_no_prompt & dm_{sn,as}printf and fix a calle 2010-07-02 21:16:50 +00:00
Alasdair Kergon
85691c0afb In some C++ standards, typeof is not reserved. 2010-06-23 17:03:14 +00:00
Milan Broz
c9c7d25c35 Remove C++ private keyword from headers.
Add extern C definition for libdevmapper, lvm2app and lvm2cmd.
2010-06-16 13:01:25 +00:00
Zdenek Kabelac
76d1aec8e0 Replicator: support deactivate of replicator-dev nodes
Introducing dm_tree_node_set_presuspend_node() for presuspending child
node (i.e. replicator control target) before deactivation of parent node
(i.e. replicator-dev target).

This patch presents no functional change to current dtree - only
replicator target currently sets presuspend node for dev nodes.
2010-05-21 12:27:02 +00:00
Zdenek Kabelac
b262f3e19e Replicator: libdm support
Introducing new API calls:
dm_tree_node_add_replicator_target()
dm_tree_node_add_replicator_dev_target().

Define new typedef dm_replicator_mode_t.
2010-05-21 12:24:15 +00:00
Zdenek Kabelac
3283f817eb Add dm_list_splice() to join two lists. 2010-05-06 10:10:15 +00:00
Peter Rajnoha
942d6ef29f Add support for new IMPORT{db} udev rule.
This rule appeared in udev v152 and it helps us to support spurious events
where we didn't have any flags set (events originated in udevadm trigger
or the watch rule). These flags are important to direct the rule application.
Now, with the help of this rule, we can regenerate old udev db content.
To implement this correctly, we need to flag all proper DM udev events with
DM_UDEV_PRIMARY_SOURCE_FLAG. That happens automatically for all ioctls
generating events originated in libdevmapper.
2010-04-28 13:37:36 +00:00
Alasdair Kergon
49ada7a2c3 Add dm_bitset_equal to libdevmapper. 2010-04-20 13:58:22 +00:00
Alasdair Kergon
a120520fa2 missed files from last commit 2010-04-20 10:58:18 +00:00
Peter Rajnoha
f0e073fcdc Several changes in dmsetup and libdevmapper:
- add DM_UDEV_DISABLE_LIBRARY_FALLBACK udev flag to rely on udev only

 - export dm_udev_create_cookie function to create new cookies on demand

 - add --udevcookie, udevcreatecookie and udevreleasecookie for dmsetup
   (to support "udev transactions" where one cookie value can be used for
    several dmsetup calls)

 - don't use DM_UDEV_DISABLE_CHECKING env. var. anymore and set the state
   automatically (based on udev and libdevmapper dev path comparison)
2010-02-15 16:21:33 +00:00
Zdenek Kabelac
04bde319a9 Cleanup gcc warning: cast discards qualifiers from pointer target type
API of the library should remain the same as the 'const' is not
mangled into the function name in C.
2010-01-14 10:15:23 +00:00
Zdenek Kabelac
f7b692d29f Cleanup gcc warning: cast from function call of type 'struct dm_list *'
to non-matching type 'long unsigned int'

Casting pointer to long and back to pointer could be easily
handled with just pointer arithmetic.
2010-01-14 10:12:44 +00:00
Mike Snitzer
aa6f4e51a7 Add support for "snapshot-merge" target.
Introduces new libdevmapper function dm_tree_node_add_snapshot_merge_target

Verifies that the kernel (dm-snapshot) provides the 'snapshot-merge'
target.

Activate origin LV as snapshot-merge target.  Using snapshot-origin
target would be pointless because the origin contains volatile data
while a merge is in progress.

Because snapshot-merge target is activated in place of the
snapshot-origin target it must be resumed after all other snapshots
(just like snapshot-origin does) --- otherwise small window for data
corruption would exist.

Ideally the merging snapshot would not be activated at all but if it is
to be activated (because snapshot was already active) it _must_ be done
after the snapshot-merge.  This insures that DM's snapshot-merge target
will perform exception handover in the proper order (new->resume before
old->resume).  DM's snapshot-merge does support handover if the reverse
sequence is used (old->resume before new->resume) but DM will fail to
resume the old snapshot; leaving it suspended.

To insure the proper activation sequence dm_tree_activate_children() was
updated to accommodate an additional 'activation_priority' level.  All
regular snapshots are 0, snapshot-merge is 1, and merging snapshot is 2.
2010-01-13 01:39:44 +00:00
Peter Rajnoha
d2b43c4b34 Add support to disable udev checking: DM_UDEV_DISABLE_CHECKING=1 env. variable.
Sometimes it is really needed to switch off udev checking and the warnings we show when
we detect that udev has not done its job right - the messages like "Udev should have done
this and that. Falling back to direct node creation/removal. " etc.

This would be especially handy while setting DM_DEV_DIR env var that could be set to a
different location than standard /dev (udev can't create nodes/symlinks out of that one
directory that is configured into udevd). The exact same situation happens while we're
running our tests.
2010-01-11 15:36:24 +00:00
Peter Rajnoha
cda69e17ef Add activation/udev_rules config option in lvm.conf.
Add dm_tree_add_dev_with_udev_flags to provide wider support for udev flags.
2010-01-07 19:54:21 +00:00
Peter Rajnoha
584d1fb7d1 Support udev flags even when udev_sync is disabled or not compiled in.
This provides better support for environments where udev rules are installed
but udev_sync is not compiled in (however, using udev_sync is highly
recommended). It also provides consistent and expected functionality even
when '--noudevsync' option is used.

There is still requirement for kernel >= 2.6.31 for the flags to work though
(it uses DM cookies to pass the flags into the kernel and set them in udev
event environment that we can read in udev rules).
2009-11-13 12:43:21 +00:00
Peter Rajnoha
9c20c7af59 Remove 'last_rule' from udev rules.
'last_rule' option has been removed from udev (version >= 147).

From now on, we require foreign rules to check and honor
ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG} instead. Foreign
rules should be skipped totally when this flag is set.
2009-11-13 12:33:27 +00:00
Alasdair Kergon
9abf5e70be Add support for querying a device's inactive table.
Currently this data is invisible to userspace.
Requires dm >= 4.16 (likely to be in linux 2.6.33).
2009-11-06 00:43:08 +00:00
Peter Rajnoha
421671b1c2 Several changes to udev support code:
- we have these levels when the udev rules are processed:
   10-dm.rules --> [11-dm-<subsystem>.rules] --> [12-dm-permissions.rules] -->
   13-dm-disk.rules --> [...all the other foreign rules...] --> 95-dm-notify.rules

 - each level can be disabled now by
   DM_UDEV_DISABLE_{DM, SUBSYSTEM, DISK, OTHER}_RULES_FLAG

 - add DM_UDEV_DISABLE_DM_RULES_FLAG to disable 10-dm.rules

 - add DM_UDEV_DISABLE_OTHER_RULES_FLAG to disable all the other (non-dm) rules.
   We cutoff these rules by using the 'last_rule', so this one should really be
   used with great care and in well-founded situations. We use this for lvm's
   hidden and layer devices now.

 - add a parameter for add_dev_node, rm_dev_node and rename_dev_node so it's
   possible to switch on/off udev checks

 - use DM_UDEV_DISABLE_DM_RULES_FLAG and DM_UDEV_DISABLE_SUBSYSTEM_RULES_FLAG
   if there's no cookie set and we have resume, remove and rename ioctl.
   This could happen when someone uses the libdevmapper that is compiled with
   udev_sync but the software does not make use of it. This way we can switch
   off the rules and fallback to libdevmapper node creation so there's no
   udev/libdevmapper race.
2009-10-26 14:29:33 +00:00
Peter Rajnoha
f16aea9ebd Use udev flags support in LVM and provide dm_tree_add_new_dev_with_udev_flags wrapper for dm_tree_add_new_dev. 2009-10-22 13:00:07 +00:00
Peter Rajnoha
5f1f31f942 Add udev flags support in libdevmapper and provide 'dmsetup udevflags' command to decode them. 2009-10-22 12:55:47 +00:00
Peter Rajnoha
96e46b8edb Use the same default umask for /dev dirs (DM_DEV_DIR_UMASK). 2009-09-25 11:58:00 +00:00
Peter Rajnoha
f9ff23dffe Add 'udevcomplete_all' command for dmsetup. Export DM_COOKIE_MAGIC in libdevmapper.h. 2009-08-06 15:04:30 +00:00
Alasdair Kergon
a74be32bf6 Manage without dm_udev_cleanup? 2009-08-03 18:01:45 +00:00
Alasdair Kergon
bd90c6b2c2 Set cookies in activation code and wait for udev to complete processing. 2009-07-31 18:30:31 +00:00
Alasdair Kergon
2c0dfdf839 Add udevcomplete and --noudevwait to dmsetup. 2009-07-31 17:51:45 +00:00
Alasdair Kergon
4d8c4ea7e6 Add libdevmapper functions to support synchronisation with udev. 2009-07-31 15:53:11 +00:00
Alasdair Kergon
a9cb6969b0 Add dm_log_with_errno and dm_log_with_errno_init, deprecating the old
Change plog to use dm_log_with_errno unless deprecated dm_log_init was used.
Rename plog macro to LOG_LINE and use in dm_dump_memory_debug.
2009-07-10 09:59:37 +00:00
Milan Broz
6391d03f54 Fix backward compatibility for major:minor query.
Is an application uses query and set major:minor
to device, it should not fallback to default major by default.

Add new function whoich allows that (and use it in lvm2).
2009-06-17 20:55:24 +00:00
Milan Broz
12ca060e9f Support crypt segment in libdevmapper tree.
- it can support multiple segments, but note that
to work properly, correct IV (initialization vector)
offset parameter must be set properly.

Because most usage of IV start offset is when we join
several crypto segments together (so iv_offset is the segment
start offset), DM_CRYPT_IV_DEFAULT is defined to simplify
the process.

Function accepts the string in cipher agrument (already
including chainmode and iv type; chainmode and iv parameters are NULL
in this case) or user can provide split parameters which will
join into dm-crypt cipher specification "cipher-chainmode-iv".

All these parameters must be supplied in correct dm-crypt format.
2009-06-09 16:10:20 +00:00
Alasdair Kergon
c9ee46569c Make mempool optional in dm_split_lvm_name() 2009-06-03 11:40:23 +00:00
Milan Broz
eb91c4eee3 Use suspend with flush when device size was changed during table preload.
This allows online mirror resize, also removes condition to preventing
code to do this.
2009-05-20 09:52:37 +00:00
Alasdair Kergon
56d8844068 more fixes 2008-11-04 15:07:45 +00:00
Alasdair Kergon
e50d0e97b1 more missing bits 2008-11-04 14:57:06 +00:00
Alasdair Kergon
7d7d93ac6c Extend deptree buffers so the largest possible device numbers fit. 2008-09-02 12:16:07 +00:00
Alasdair Kergon
ca8d363d2c Add --rows to dmsetup. 2008-06-24 22:53:48 +00:00
Alasdair Kergon
f1839ac87c dmsetup --unquoted 2008-06-24 20:16:47 +00:00
Alasdair Kergon
c791f186ce Add field name prefix option to reporting functions. 2008-04-20 00:11:08 +00:00
Alasdair Kergon
f44e3ff46a Calculate string size within dm_pool_grow_object. 2008-04-19 15:50:18 +00:00
Alasdair Kergon
a8524c3942 clarify when read_ahead may be set 2007-12-05 16:28:19 +00:00
Alasdair Kergon
2d1eead2e8 read_ahead node ops 2007-11-30 14:59:57 +00:00
Alasdair Kergon
52b8440916 add read_ahead functions to library and dmsetup --readahead
(Not live yet.)
2007-11-27 20:57:05 +00:00
Alasdair Kergon
6dd60469ba Add DM_READ_AHEAD_MINIMUM_FLAG 2007-11-12 20:47:18 +00:00
Alasdair Kergon
14772580cd Define DM_READ_AHEAD_AUTO and DM_READ_AHEAD_NONE. 2007-11-09 16:52:36 +00:00
Alasdair Kergon
147d5faccf Fix inconsistent licence notices: executables are GPLv2; libraries LGPLv2.1. 2007-08-21 16:26:07 +00:00
Alasdair Kergon
ee80c0f0e3 improve changelog 2007-08-06 13:09:46 +00:00
Jim Meyering
3f311f1daa Export dm_create_dir (was create_dir) to help fix LVM2 link error
* lib/libdm-file.c (dm_create_dir): Rename from create_dir.
* lib/libdevmapper.h (dm_create_dir): Declare.
* lib/.exported_symbols: Add dm_create_dir.
* lib/ioctl/libdm-iface.c (_create_control): Update sole use.
Patch by Jun'ichi Nomura.  Details in
http://www.redhat.com/archives/lvm-devel/2007-July/msg00040.html
2007-07-28 10:48:36 +00:00
Jim Meyering
0c3cd7e292 dm_fclose: new function
* lib/libdevmapper.h: Declare it.
* lib/libdm-file.c (dm_fclose): Define it.
* lib/.exported_symbols: Add dm_fclose.
2007-07-24 14:15:45 +00:00
Alasdair Kergon
38862fcd3f Add regex functions to library. 2007-04-27 18:40:23 +00:00
Alasdair Kergon
8d2b0f24d3 Deal with some more compiler warnings. Hope this doesn't break anything... 2007-04-27 14:52:41 +00:00
Alasdair Kergon
9f069f7bef Use fixed-size fields in report interface. 2007-01-29 17:23:54 +00:00
Alasdair Kergon
85feafd996 Add descriptions to reporting field definitions. 2007-01-23 19:18:52 +00:00
Alasdair Kergon
4dcaa2300c Add dm_event_handler_[gs]et_timeout functions.
Streamline dm_report_field_* interface.
2007-01-22 15:03:57 +00:00
Alasdair Kergon
03c6979264 Some internal renaming.
Add --separator and --sort to dmsetup (unused as yet).
Make alignment flag optional when specifying report fields.
2007-01-18 17:47:58 +00:00
Alasdair Kergon
61997bb9bb Add basic reporting functions to libdevmapper. 2007-01-16 18:04:15 +00:00
Alasdair Kergon
931d24a4b1 More libdevmapper-event interface changes and fixes.
Rename dm_saprintf() to dm_asprintf().
2007-01-15 18:21:01 +00:00
Alasdair Kergon
3165248642 Lots of dmeventd-related changes. 2007-01-11 21:54:53 +00:00
Alasdair Kergon
b9ffd32cd3 Add dm_tree_use_no_flush_suspend(). 2007-01-09 19:44:07 +00:00
Alasdair Kergon
5b95f17814 Lots of dmevent changes.
Export dm_basename().
Cope with a trailing space when comparing tables prior to possible reload.
2007-01-08 15:18:52 +00:00
Alasdair Kergon
f916f0a7b7 Add suspend noflush support.
Add basic dmsetup loop support.
2006-10-12 15:42:25 +00:00
Alasdair Kergon
9e063b223e Add dm_snprintf 2006-08-21 12:52:39 +00:00
Alasdair Kergon
7d7736b7b4 Add dm_split_words() and dm_split_lvm_name() to libdevmapper. 2006-08-21 12:07:03 +00:00
Alasdair Kergon
9723090c92 Add DM_CORELOG flag to dm_tree_node_add_mirror_target(). 2006-05-11 19:10:55 +00:00
Alasdair Kergon
f4db3724f9 Add file & line to dm_strdup_aux(). 2006-02-23 19:11:51 +00:00
Alasdair Kergon
6ef080af04 A setgeometry implementation. [untested] 2006-02-20 23:55:58 +00:00
Alasdair Kergon
b5d8ff1014 Add exported functions to set uid, gid and mode. [Bastian Blank] 2006-02-03 14:23:22 +00:00
Alasdair Kergon
5e3bd86778 Rename _log to dm_log and export.
Fix misc compile-time warnings.
2006-01-31 14:50:38 +00:00
Alasdair Kergon
c55b141005 Add dm_tree_skip_lockfs. 2006-01-30 23:36:04 +00:00
Alasdair Kergon
fe94f9f170 Fix dm_strdup debug definition. 2006-01-10 22:19:41 +00:00
Alasdair Kergon
1c9b9a5ecf Fix libdevmapper.h #endif 2006-01-04 16:05:44 +00:00
Alasdair Kergon
ce7ed2c0a9 Change dm_tree_node_add_mirror_target_log parm order 2005-12-19 21:03:17 +00:00
Alasdair Kergon
dbcb64b80f Add sync, nosync and block_on_error mirror log parameters.
Add hweight32.
2005-12-13 15:49:27 +00:00
Alasdair Kergon
774ed5fc39 Export dm_task_update_nodes.
Use names instead of numbers in messages when ioctls fail.
2005-12-01 23:11:41 +00:00
Alasdair Kergon
ec289b64b9 Drop leading zeros from dm_format_dev.
Suppress attempt to reload identical table.
2005-11-22 18:43:12 +00:00
Alasdair Kergon
5dd9b4656f more debug fixes 2005-11-11 16:16:37 +00:00
Alasdair Kergon
91a7cf559d fix debug linking 2005-11-10 16:33:04 +00:00
Alasdair Kergon
e6a6954ef1 revert - alternative pvmove fix, disabling preloading completely for now 2005-11-09 23:57:40 +00:00
Alasdair Kergon
24b026e333 some fixes for mirrors 2005-11-09 17:32:31 +00:00
Alasdair Kergon
b4f1578fc2 rename deptree 2005-11-09 14:10:50 +00:00
Alasdair Kergon
165e4a112b New activation code. [Not ready to be used yet.] 2005-11-08 22:50:11 +00:00
Alasdair Kergon
db208f51fd unfinished suspend functions 2005-10-25 19:09:41 +00:00
Alasdair Kergon
3aeb569036 Export dm_set_selinux_context. 2005-10-25 17:30:00 +00:00
Alasdair Kergon
a6d97ede7b cope with null uuid_prefix 2005-10-18 13:57:11 +00:00
Alasdair Kergon
3e8c6b731a Add deactivation functions 2005-10-18 12:37:53 +00:00
Alasdair Kergon
ffc88f2eeb dm_driver_version 2005-10-17 18:05:39 +00:00
Alasdair Kergon
a3f6b2ce79 export bitset, pool, hash, malloc 2005-10-16 22:57:20 +00:00
Alasdair Kergon
3d0480ed27 Code to build and display device dependency tree. 2005-10-16 14:33:22 +00:00
Alasdair Kergon
72a444276f Add dmsetup --nolockfs support for suspend/reload.
Requires kernel patches to have any effect.
Library version incremented.
2005-10-04 20:12:32 +00:00
Alasdair Kergon
ebf21d3f93 Call dm_lib_exit() and dm_lib_release() automatically now. 2005-05-16 15:15:34 +00:00
Alasdair Kergon
8e2dd0dfb2 Add dm_task_no_open_count() to skip getting open_count. 2005-01-12 22:10:14 +00:00
Alasdair Kergon
62cec9b225 Support new target message ioctl. 2004-06-08 20:34:40 +00:00
Alasdair Kergon
8b67f40de2 Update copyright messages. 2004-03-30 19:08:57 +00:00
Alasdair Kergon
cf37d5c7ab Userspace support for LIST_VERSIONS ioctl. 2004-01-23 14:37:47 +00:00
Alasdair Kergon
1f86c3397e Option to revert to default logging function after using a custom one. 2003-12-21 16:08:20 +00:00
Alasdair Kergon
2864846d91 dmsetup mknodes 2003-11-13 13:14:28 +00:00
Alasdair Kergon
b8a20fc82a Accept tables from stdin with dmsetup.
Update autoconf.
2003-11-12 17:30:32 +00:00
Alasdair Kergon
d71bfabe39 Support for v4 interface 2003-07-01 21:20:58 +00:00
Alasdair Kergon
8563ab0304 Event number support. 2003-04-29 11:34:23 +00:00
Alasdair Kergon
12428fceee Allow device major to be set too. 2003-04-02 19:03:00 +00:00
Alasdair Kergon
8aa577ad34 Proposed changes to the ioctl interface to fix alignment issues on some
architectures and specify an explicit width for every numeric field.
2003-03-28 18:58:59 +00:00
Alasdair Kergon
39662e362a Allow optional verbose logging 2003-01-21 21:25:11 +00:00
Alasdair Kergon
92ad2d555b Import snapshot status & persistence + indent etc. 2002-05-10 15:25:38 +00:00
Patrick Caulfield
f6524657fa Add features to get table/status & wait for next event. 2002-05-03 11:55:58 +00:00
Alasdair Kergon
b2de0b7d44 dmsetup display uuid 2002-03-13 16:19:17 +00:00
Alasdair Kergon
ad21a5585c Let dmsetup store the uuid on device creation. 2002-03-11 22:44:36 +00:00
Alasdair Kergon
e09a7b5787 o dm_destroy_all() called on exit - but doesn't touch suspended devices yet.
o 'dmsetup remove_all' calls dm_destroy_all() to provide a quick way to
  prepare for unloading the module
o Ran through indent again.
2002-03-07 20:56:10 +00:00
Alasdair Kergon
9f7b698007 Kernel functionality that returns device dependencies (ejt). 2002-03-06 19:42:23 +00:00
Joe Thornber
761e0a63e1 o Add support for getting dependencies for a device.
o  dmsetup dependencies <dev>
2002-03-06 14:38:25 +00:00
Alasdair Kergon
444b7d2360 Add function that returns the library version. 2002-01-17 14:13:25 +00:00
Alasdair Kergon
6198a4102c Another ioctl interface update:
Supply offset to start of variable data area (so struct size can change
without breaking backward compatibility)
  Add command that just returns the driver version
2002-01-15 15:21:57 +00:00
Alasdair Kergon
1ed34e88aa o Add rename support to dmsetup.
o Add support to use specified minor number to library and dmsetup.
2002-01-11 12:12:46 +00:00
Alasdair Kergon
e3851db216 Support the renaming of active mapped devices (ioctl interface only). 2002-01-10 23:29:16 +00:00
Alasdair Kergon
eefe4b2097 stub for read-only functions with fs interface 2002-01-03 15:12:02 +00:00
Joe Thornber
f17673f1d0 o Added -r, --read-only switch to dmsetup for use with create and reload. 2002-01-03 10:39:21 +00:00
Alasdair Kergon
638754e559 Various fixes & restructure to extract common code. 2001-12-05 16:41:52 +00:00
Joe Thornber
6f842a9b05 o use the major number returned from dm_ioctl. 2001-11-21 17:57:57 +00:00
Joe Thornber
8f8cf896d6 o You can now specify the dev directory for libdm
o  dm_dir() returns the full path to the device-mapper dir (eg, /dev/device-mapper).

o  put stat in on _rm_node
2001-11-21 17:08:37 +00:00
Joe Thornber
19df7116c6 o Migration of device-mapper from LVM_WORK to it's own (public) repository.
Please use this one from now on.
2001-11-21 12:47:42 +00:00