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

Accessor functions for PV will not modify the given PV.

So we can add 'const' to it.
Patch by Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
This commit is contained in:
Dave Wysochanski 2007-10-12 14:08:10 +00:00
parent 9ea1d647af
commit 70d9f98ed3
4 changed files with 26 additions and 24 deletions

View File

@ -1,5 +1,7 @@
Version 2.02.29 - Version 2.02.29 -
================================== ==================================
Add const attributes to pv accessor functions.
Refactor vg_add_snapshot and lv_create_empty.
Handle new sysfs subsystem/block/devices directory structure. Handle new sysfs subsystem/block/devices directory structure.
Tests are run with LVM_SYSTEM_DIR pointing to private root and /dev dirs. Tests are run with LVM_SYSTEM_DIR pointing to private root and /dev dirs.
Fix a bug in lvm_dump.sh checks for lvm/dmsetup binaries. Fix a bug in lvm_dump.sh checks for lvm/dmsetup binaries.

View File

@ -468,15 +468,15 @@ char *generate_lv_name(struct volume_group *vg, const char *format,
/* /*
* Begin skeleton for external LVM library * Begin skeleton for external LVM library
*/ */
struct device *pv_dev(pv_t *pv); struct device *pv_dev(const pv_t *pv);
const char *pv_vg_name(pv_t *pv); const char *pv_vg_name(const pv_t *pv);
uint64_t pv_size(pv_t *pv); uint64_t pv_size(const pv_t *pv);
uint32_t pv_status(pv_t *pv); uint32_t pv_status(const pv_t *pv);
uint32_t pv_pe_size(pv_t *pv); uint32_t pv_pe_size(const pv_t *pv);
uint64_t pv_pe_start(pv_t *pv); uint64_t pv_pe_start(const pv_t *pv);
uint32_t pv_pe_count(pv_t *pv); uint32_t pv_pe_count(const pv_t *pv);
uint32_t pv_pe_alloc_count(pv_t *pv); uint32_t pv_pe_alloc_count(const pv_t *pv);
uint32_t vg_status(vg_t *vg); uint32_t vg_status(const vg_t *vg);
#endif #endif

View File

@ -1927,62 +1927,62 @@ vg_t *vg_lock_and_read(struct cmd_context *cmd, const char *vg_name,
/* /*
* Gets/Sets for external LVM library * Gets/Sets for external LVM library
*/ */
struct id pv_id(pv_t *pv) struct id pv_id(const pv_t *pv)
{ {
return pv_field(pv, id); return pv_field(pv, id);
} }
const struct format_type *pv_format_type(pv_t *pv) const struct format_type *pv_format_type(const pv_t *pv)
{ {
return pv_field(pv, fmt); return pv_field(pv, fmt);
} }
struct id pv_vgid(pv_t *pv) struct id pv_vgid(const pv_t *pv)
{ {
return pv_field(pv, vgid); return pv_field(pv, vgid);
} }
struct device *pv_dev(pv_t *pv) struct device *pv_dev(const pv_t *pv)
{ {
return pv_field(pv, dev); return pv_field(pv, dev);
} }
const char *pv_vg_name(pv_t *pv) const char *pv_vg_name(const pv_t *pv)
{ {
return pv_field(pv, vg_name); return pv_field(pv, vg_name);
} }
uint64_t pv_size(pv_t *pv) uint64_t pv_size(const pv_t *pv)
{ {
return pv_field(pv, size); return pv_field(pv, size);
} }
uint32_t pv_status(pv_t *pv) uint32_t pv_status(const pv_t *pv)
{ {
return pv_field(pv, status); return pv_field(pv, status);
} }
uint32_t pv_pe_size(pv_t *pv) uint32_t pv_pe_size(const pv_t *pv)
{ {
return pv_field(pv, pe_size); return pv_field(pv, pe_size);
} }
uint64_t pv_pe_start(pv_t *pv) uint64_t pv_pe_start(const pv_t *pv)
{ {
return pv_field(pv, pe_start); return pv_field(pv, pe_start);
} }
uint32_t pv_pe_count(pv_t *pv) uint32_t pv_pe_count(const pv_t *pv)
{ {
return pv_field(pv, pe_count); return pv_field(pv, pe_count);
} }
uint32_t pv_pe_alloc_count(pv_t *pv) uint32_t pv_pe_alloc_count(const pv_t *pv)
{ {
return pv_field(pv, pe_alloc_count); return pv_field(pv, pe_alloc_count);
} }
uint32_t vg_status(vg_t *vg) uint32_t vg_status(const vg_t *vg)
{ {
return vg->status; return vg->status;
} }

View File

@ -304,9 +304,9 @@ int fixup_imported_mirrors(struct volume_group *vg);
/* /*
* Begin skeleton for external LVM library * Begin skeleton for external LVM library
*/ */
struct id pv_id(pv_t *pv); struct id pv_id(const pv_t *pv);
const struct format_type *pv_format_type(pv_t *pv); const struct format_type *pv_format_type(const pv_t *pv);
struct id pv_vgid(pv_t *pv); struct id pv_vgid(const pv_t *pv);
pv_t *pv_by_path(struct cmd_context *cmd, const char *pv_name); pv_t *pv_by_path(struct cmd_context *cmd, const char *pv_name);
int add_pv_to_vg(struct volume_group *vg, const char *pv_name, int add_pv_to_vg(struct volume_group *vg, const char *pv_name,