LVM2 ./WHATS_NEW lib/config/config.c lib/error ...
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk at sourceware.org 2007-08-22 14:38:18
Modified files:
. : WHATS_NEW lib/config : config.c lib/error : errseg.c lib/filters : filter-sysfs.c filter.c lib/format1 : disk-rep.c format1.c import-export.c
lvm1-label.c
lib/format_pool: disk_rep.c format_pool.c pool_label.c lib/format_text: format-text.c import_vsn1.c
lib/locking : cluster_locking.c external_locking.c
file_locking.c locking.c locking.h locking_types.h no_locking.c
lib/metadata : lv_alloc.h lv_manip.c metadata-exported.h
metadata.c mirror.c
lib/misc : lvm-string.c lvm-string.h
lib/report : report.c
lib/snapshot : snapshot.c
lib/zero : zero.c
tools : lvconvert.c lvcreate.c pvck.c reporter.c
toollib.c toollib.h vgreduce.c vgsplit.c
Log message:
Clean up numerous compiler warnings that crept in recently. Remove several unused parameters from _allocate().
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.689&r2=1.690
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/config.c.diff?cvsroot=lvm2&r1=1.64&r2=1.65
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/error/errseg.c.diff?cvsroot=lvm2&r1=1.14&r2=1.15
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/filters/filter-sysfs.c.diff?cvsroot=lvm2&r1=1.16&r2=1.17
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/filters/filter.c.diff?cvsroot=lvm2&r1=1.42&r2=1.43
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format1/disk-rep.c.diff?cvsroot=lvm2&r1=1.67&r2=1.68
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format1/format1.c.diff?cvsroot=lvm2&r1=1.101&r2=1.102
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format1/import-export.c.diff?cvsroot=lvm2&r1=1.85&r2=1.86
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format1/lvm1-label.c.diff?cvsroot=lvm2&r1=1.15&r2=1.16
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_pool/disk_rep.c.diff?cvsroot=lvm2&r1=1.10&r2=1.11
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_pool/format_pool.c.diff?cvsroot=lvm2&r1=1.10&r2=1.11
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_pool/pool_label.c.diff?cvsroot=lvm2&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/format-text.c.diff?cvsroot=lvm2&r1=1.81&r2=1.82
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/import_vsn1.c.diff?cvsroot=lvm2&r1=1.40&r2=1.41
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/cluster_locking.c.diff?cvsroot=lvm2&r1=1.18&r2=1.19
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/external_locking.c.diff?cvsroot=lvm2&r1=1.12&r2=1.13
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/file_locking.c.diff?cvsroot=lvm2&r1=1.30&r2=1.31
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/locking.c.diff?cvsroot=lvm2&r1=1.39&r2=1.40
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/locking.h.diff?cvsroot=lvm2&r1=1.33&r2=1.34
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/locking_types.h.diff?cvsroot=lvm2&r1=1.14&r2=1.15
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/no_locking.c.diff?cvsroot=lvm2&r1=1.12&r2=1.13
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_alloc.h.diff?cvsroot=lvm2&r1=1.16&r2=1.17
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.126&r2=1.127
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.12&r2=1.13
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.133&r2=1.134
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/mirror.c.diff?cvsroot=lvm2&r1=1.40&r2=1.41
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/misc/lvm-string.c.diff?cvsroot=lvm2&r1=1.14&r2=1.15
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/misc/lvm-string.h.diff?cvsroot=lvm2&r1=1.16&r2=1.17
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/report/report.c.diff?cvsroot=lvm2&r1=1.60&r2=1.61
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/snapshot/snapshot.c.diff?cvsroot=lvm2&r1=1.21&r2=1.22
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/zero/zero.c.diff?cvsroot=lvm2&r1=1.13&r2=1.14
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvconvert.c.diff?cvsroot=lvm2&r1=1.35&r2=1.36
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.142&r2=1.143
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvck.c.diff?cvsroot=lvm2&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/reporter.c.diff?cvsroot=lvm2&r1=1.26&r2=1.27
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/toollib.c.diff?cvsroot=lvm2&r1=1.104&r2=1.105
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/toollib.h.diff?cvsroot=lvm2&r1=1.49&r2=1.50
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgreduce.c.diff?cvsroot=lvm2&r1=1.66&r2=1.67
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgsplit.c.diff?cvsroot=lvm2&r1=1.35&r2=1.36
WHATS_NEW +2 -5
@@ -1,10 +1,7 @@ -DO NOT RELEASE UNTIL FOLLOWING FIXED/REVIEWED: - -changed text also needs fixing - some poor English -lvcreate page needs fixing too - emphasis on best behaviour (disk log) got inverted! - Version 2.02.28 - ================================ + Clean up numerous compiler warnings that crept in recently. + Remove several unused parameters from _allocate(). Only permit --force, --verbose and --debug arguments to be repeated. Move guts of vgremove into library. Fix inconsistent licence notices: executables are GPLv2; libraries LGPLv2.1.
lib/config/config.c +4 -4
@@ -156,7 +156,7 @@return 1 ; } -struct config_tree *create_config_tree_from_string (struct cmd_context *cmd, +struct config_tree *create_config_tree_from_string (struct cmd_context *cmd __attribute((unused)),const char *config_settings) {struct cs *c;
@@ -371,7 +371,7 @@va_start (ap, fmt); n =vsnprintf (&buf[0 ],sizeof buf -1 , fmt, ap); -if (n <0 || n >sizeof buf -1 ) { +if (n <0 || n > (int )sizeof buf -1 ) {log_error ("vsnprintf failed for config line" );return 0 ; }
@@ -1248,13 +1248,13 @@* Returns: * # of 'type' tokens in 'str'. */ -static unsigned _count_tokens (const char *str,unsigned len,int type) +static unsigned _count_tokens (const char *str,unsigned len,int type) {char c; c =_token_type_to_char (type); -return (count_chars_len (str, len, c)); +return count_chars_len (str, len, c); }/*
lib/error/errseg.c +1 -1
@@ -67,7 +67,7 @@#endif static int _errseg_modules_needed (struct dm_pool *mem, -const struct lv_segment *seg, +const struct lv_segment *seg __attribute((unused)),struct list *modules) {if (!str_list_add (mem, modules,"error" )) {
lib/filters/filter-sysfs.c +1 -1
@@ -299,7 +299,7 @@#else -struct dev_filter *sysfs_filter_create (const char *proc) +struct dev_filter *sysfs_filter_create (const char *proc __attribute((unused))) {return NULL ; }
lib/filters/filter.c +1 -1
@@ -80,7 +80,7 @@ {NULL, 0} }; -static int _passes_lvm_type_device_filter (struct dev_filter *f, +static int _passes_lvm_type_device_filter (struct dev_filter *f __attribute((unused)),struct device *dev) {const char *name =dev_name (dev);
lib/format1/disk-rep.c +1 -1
@@ -653,7 +653,7 @@/* * assumes the device has been opened. */ -static int __write_all_pvd (const struct format_type *fmt, +static int __write_all_pvd (const struct format_type *fmt __attribute((unused)),struct disk_list *data) {const char *pv_name =dev_name (data->dev);
lib/format1/format1.c +12 -12
@@ -175,7 +175,7 @@static struct volume_group *_format1_vg_read (struct format_instance *fid,const char *vg_name, -struct metadata_area *mda) +struct metadata_area *mda __attribute((unused))) {struct dm_pool *mem =dm_pool_create ("lvm1 vg_read" ,1024 *10 );struct list pvs;
@@ -261,7 +261,7 @@ }static int _format1_vg_write (struct format_instance *fid,struct volume_group *vg, -struct metadata_area *mda) +struct metadata_area *mda __attribute((unused))) {struct dm_pool *mem =dm_pool_create ("lvm1 vg_write" ,1024 *10 );struct list pvds;
@@ -284,7 +284,7 @@ }static int _format1_pv_read (const struct format_type *fmt,const char *pv_name, -struct physical_volume *pv,struct list *mdas) +struct physical_volume *pv,struct list *mdas __attribute((unused))) {struct dm_pool *mem =dm_pool_create ("lvm1 pv_read" ,1024 );struct disk_list *dl;
@@ -325,9 +325,9 @@static int _format1_pv_setup (const struct format_type *fmt,uint64_t pe_start,uint32_t extent_count,uint32_t extent_size, -int pvmetadatacopies, -uint64_t pvmetadatasize,struct list *mdas, -struct physical_volume *pv,struct volume_group *vg) +int pvmetadatacopies __attribute((unused)), +uint64_t pvmetadatasize __attribute((unused)),struct list *mdas __attribute((unused)), +struct physical_volume *pv,struct volume_group *vg __attribute((unused))) {if (pv->size >MAX_PV_SIZE ) pv->size--;
@@ -381,7 +381,7 @@ }static int _format1_pv_write (const struct format_type *fmt,struct physical_volume *pv, -struct list *mdas,int64_t sector) +struct list *mdas __attribute((unused)),int64_t sector __attribute((unused))) {struct dm_pool *mem;struct disk_list *dl;
@@ -470,7 +470,7 @@return 1 ; } -static int _format1_segtype_supported (struct format_instance *fid, +static int _format1_segtype_supported (struct format_instance *fid __attribute((unused)),const struct segment_type *segtype) {if (!(segtype->flags &SEG_FORMAT1_SUPPORT )) {
@@ -487,9 +487,9 @@ };static struct format_instance *_format1_create_instance (const struct format_type *fmt, -const char *vgname, -const char *vgid, -void *private) +const char *vgname __attribute((unused)), +const char *vgid __attribute((unused)), +void *private __attribute((unused))) {struct format_instance *fid;struct metadata_area *mda;
@@ -516,7 +516,7 @@return fid; } -static void _format1_destroy_instance (struct format_instance *fid) +static void _format1_destroy_instance (struct format_instance *fid __attribute((unused))) {return ; }
lib/format1/import-export.c +3 -3
@@ -134,7 +134,7 @@return 1 ; } -int export_pv (struct cmd_context *cmd,struct dm_pool *mem, +int export_pv (struct cmd_context *cmd,struct dm_pool *mem __attribute((unused)),struct volume_group *vg,struct pv_disk *pvd,struct physical_volume *pv) {
@@ -588,7 +588,7 @@/* * FIXME: More inefficient code. */ -int import_snapshots (struct dm_pool *mem,struct volume_group *vg, +int import_snapshots (struct dm_pool *mem __attribute((unused)),struct volume_group *vg,struct list *pvds) {struct logical_volume *lvs[MAX_LV ];
@@ -679,7 +679,7 @@* This calculates the nasty pv_number field * used by LVM1. */ -void export_numbers (struct list *pvds,struct volume_group *vg) +void export_numbers (struct list *pvds,struct volume_group *vg __attribute((unused))) {struct disk_list *dl;int pv_num =1 ;
lib/format1/lvm1-label.c +4 -4
@@ -30,7 +30,7 @@ op); } -static int _lvm1_can_handle (struct labeller *l,void *buf,uint64_t sector) +static int _lvm1_can_handle (struct labeller *l __attribute((unused)),void *buf,uint64_t sector) {struct pv_disk *pvd = (struct pv_disk *) buf;uint32_t version;
@@ -48,7 +48,7 @@return 0 ; } -static int _lvm1_write (struct label *label,void *buf) +static int _lvm1_write (struct label *label __attribute((unused)),void *buf __attribute((unused))) {_not_supported ("write" );return 0 ;
@@ -85,14 +85,14 @@return 1 ; } -static int _lvm1_initialise_label (struct labeller *l,struct label *label) +static int _lvm1_initialise_label (struct labeller *l __attribute((unused)),struct label *label) {strcpy (label->type,"LVM1" );return 1 ; } -static void _lvm1_destroy_label (struct labeller *l,struct label *label) +static void _lvm1_destroy_label (struct labeller *l __attribute((unused)),struct label *label __attribute((unused))) {return ; }
lib/format_pool/disk_rep.c +2 -2
@@ -33,8 +33,8 @@#define CPOUT_64 (x, y) {(y) = xlate64_be((x));}static int __read_pool_disk (const struct format_type *fmt,struct device *dev, -struct dm_pool *mem,struct pool_list *pl, -const char *vg_name) +struct dm_pool *mem __attribute((unused)),struct pool_list *pl, +const char *vg_name __attribute((unused))) { char buf[512] __attribute((aligned(8)));
lib/format_pool/format_pool.c +16 -12
@@ -172,7 +172,7 @@static struct volume_group *_pool_vg_read (struct format_instance *fid,const char *vg_name, -struct metadata_area *mda) +struct metadata_area *mda __attribute((unused))) {struct dm_pool *mem =dm_pool_create ("pool vg_read" ,1024 );struct list pds;
@@ -207,18 +207,22 @@return vg; } -static int _pool_pv_setup (const struct format_type *fmt, -uint64_t pe_start,uint32_t extent_count, -uint32_t extent_size, -int pvmetadatacopies, -uint64_t pvmetadatasize,struct list *mdas, -struct physical_volume *pv,struct volume_group *vg) +static int _pool_pv_setup (const struct format_type *fmt __attribute((unused)), +uint64_t pe_start __attribute((unused)), +uint32_t extent_count __attribute((unused)), +uint32_t extent_size __attribute((unused)), +int pvmetadatacopies __attribute((unused)), +uint64_t pvmetadatasize __attribute((unused)), +struct list *mdas __attribute((unused)), +struct physical_volume *pv __attribute((unused)), +struct volume_group *vg __attribute((unused))) {return 1 ; }static int _pool_pv_read (const struct format_type *fmt,const char *pv_name, -struct physical_volume *pv,struct list *mdas) +struct physical_volume *pv, +struct list *mdas __attribute((unused))) {struct dm_pool *mem =dm_pool_create ("pool pv_read" ,1024 );struct pool_list *pl;
@@ -268,9 +272,9 @@/* *INDENT-ON* */ static struct format_instance *_pool_create_instance (const struct format_type *fmt, -const char *vgname, -const char *vgid, -void *private) +const char *vgname __attribute((unused)), +const char *vgid __attribute((unused)), +void *private __attribute((unused))) {struct format_instance *fid;struct metadata_area *mda;
@@ -299,7 +303,7 @@return fid; } -static void _pool_destroy_instance (struct format_instance *fid) +static void _pool_destroy_instance (struct format_instance *fid __attribute((unused))) {return ; }
lib/format_pool/pool_label.c +4 -4
@@ -29,7 +29,7 @@ op); } -static int _pool_can_handle (struct labeller *l,void *buf,uint64_t sector) +static int _pool_can_handle (struct labeller *l __attribute((unused)),void *buf,uint64_t sector) {struct pool_disk pd;
@@ -50,7 +50,7 @@return 0 ; } -static int _pool_write (struct label *label,void *buf) +static int _pool_write (struct label *label __attribute((unused)),void *buf __attribute((unused))) {_pool_not_supported ("write" );return 0 ;
@@ -64,14 +64,14 @@return read_pool_label (&pl, l, dev, buf, label); } -static int _pool_initialise_label (struct labeller *l,struct label *label) +static int _pool_initialise_label (struct labeller *l __attribute((unused)),struct label *label) {strcpy (label->type,"POOL" );return 1 ; } -static void _pool_destroy_label (struct labeller *l,struct label *label) +static void _pool_destroy_label (struct labeller *l __attribute((unused)),struct label *label __attribute((unused))) {return ; }
lib/format_text/format-text.c +14 -13
@@ -140,8 +140,8 @@int i;uint64_t offset;uint64_t offset2; -uint64_t size; -uint64_t size2; +size_t size; +size_t size2;char *buf=NULL ;struct device_area *area;struct mda_context *mdac;
@@ -149,9 +149,8 @@ mdac = (struct mda_context *) mda->metadata_locn; -log_print ("Found text metadata area, offset=%" PRIu64", size=%" PRIu64, - mdac->area.start, - mdac->area.size); +log_print ("Found text metadata area: offset=%" PRIu64", size=%" + PRIu64, mdac->area.start, mdac->area.size); area = &mdac->area;if (!dev_open (area->dev))
@@ -201,12 +200,12 @@/* * FIXME: We could add more sophisticated metadata detection */ -if (maybe_config_section (buf, size+size2)) { +if (maybe_config_section (buf, size + size2)) {/* FIXME: Validate region, pull out timestamp?, etc */ /* FIXME: Do something with this region */ log_verbose ("Found LVM2 metadata record at " -"offset=%" PRIu64", size=%" PRIu64", " -"offset2=%" PRIu64" size2=%" PRIu64, +"offset=%" PRIu64", size=%" PRIsize_t", " +"offset2=%" PRIu64" size2=%" PRIsize_t, offset, size, offset2, size2); offset = prev_sector; size =SECTOR_SIZE ;
@@ -840,8 +839,8 @@return vg; } -static int _vg_write_file (struct format_instance *fid,struct volume_group *vg, -struct metadata_area *mda) +static int _vg_write_file (struct format_instance *fid __attribute((unused)), +struct volume_group *vg,struct metadata_area *mda) {struct text_context *tc = (struct text_context *) mda->metadata_locn;
@@ -905,7 +904,7 @@return 1 ; } -static int _vg_commit_file_backup (struct format_instance *fid, +static int _vg_commit_file_backup (struct format_instance *fid __attribute((unused)),struct volume_group *vg,struct metadata_area *mda) {
@@ -972,7 +971,8 @@return 1 ; } -static int _vg_remove_file (struct format_instance *fid,struct volume_group *vg, +static int _vg_remove_file (struct format_instance *fid __attribute((unused)), +struct volume_group *vg __attribute((unused)),struct metadata_area *mda) {struct text_context *tc = (struct text_context *) mda->metadata_locn;
@@ -1164,7 +1164,8 @@ uint64_t pe_start, uint64_t pe_end, int pvmetadatacopies, uint64_t pvmetadatasize, struct list *mdas, - struct physical_volume *pv, struct volume_group *vg) + struct physical_volume *pv, + struct volume_group *vg __attribute((unused))) {uint64_t mda_adjustment, disk_size, alignment;uint64_t start1, mda_size1;/* First area - start of disk */
lib/format_text/import_vsn1.c +12 -7
@@ -111,7 +111,8 @@static int _read_pv (struct format_instance *fid,struct dm_pool *mem,struct volume_group *vg,struct config_node *pvn, -struct config_node *vgn,struct dm_hash_table *pv_hash) +struct config_node *vgn __attribute((unused)), +struct dm_hash_table *pv_hash) {struct physical_volume *pv;struct pv_list *pvl;
@@ -383,12 +384,12 @@/* FIXME Cope if LV not yet read in */ if ((pv =dm_hash_lookup (pv_hash, cv->v.str))) { -if (!set_lv_segment_area_pv (seg, s, pv, cv->next->v.i)) { +if (!set_lv_segment_area_pv (seg, s, pv, (uint32_t ) cv->next->v.i)) { stack;return 0 ; } }else if ((lv1 =find_lv (seg->lv->vg, cv->v.str))) { -set_lv_segment_area_lv (seg, s, lv1, cv->next->v.i, +set_lv_segment_area_lv (seg, s, lv1, (uint32_t ) cv->next->v.i, flags); }else { log_error("Couldn't find volume '%s' "
@@ -469,9 +470,11 @@return 1 ; } -static int _read_lvnames (struct format_instance *fid,struct dm_pool *mem, +static int _read_lvnames (struct format_instance *fid __attribute((unused)), +struct dm_pool *mem,struct volume_group *vg,struct config_node *lvn, -struct config_node *vgn,struct dm_hash_table *pv_hash) +struct config_node *vgn __attribute((unused)), +struct dm_hash_table *pv_hash __attribute((unused))) {struct logical_volume *lv;struct lv_list *lvl;
@@ -544,9 +547,11 @@return 1 ; } -static int _read_lvsegs (struct format_instance *fid,struct dm_pool *mem, +static int _read_lvsegs (struct format_instance *fid __attribute((unused)), +struct dm_pool *mem,struct volume_group *vg,struct config_node *lvn, -struct config_node *vgn,struct dm_hash_table *pv_hash) +struct config_node *vgn __attribute((unused)), +struct dm_hash_table *pv_hash) {struct logical_volume *lv;struct lv_list *lvl;
lib/locking/cluster_locking.c +4 -4
@@ -31,7 +31,7 @@#include <unistd.h> #ifndef CLUSTER_LOCKING_INTERNAL -int lock_resource (struct cmd_context *cmd,const char *resource,int flags); +int lock_resource (struct cmd_context *cmd,const char *resource,uint32_t flags);void locking_end (void );int locking_init (int type,struct config_tree *cf,uint32_t *flags);#endif
@@ -295,7 +295,7 @@return 1 ; } -static int _lock_for_cluster (unsigned char cmd,unsigned int flags,char *name) +static int _lock_for_cluster (unsigned char cmd,uint32_t flags,char *name) {int status;int i;
@@ -368,9 +368,9 @@/* API entry point for LVM */ #ifdef CLUSTER_LOCKING_INTERNAL static int _lock_resource (struct cmd_context *cmd,const char *resource, - int flags) + uint32_t flags)#else -int lock_resource(struct cmd_context *cmd, const char *resource, int flags) +int lock_resource(struct cmd_context *cmd, const char *resource, uint32_t flags)#endif {char lockname[PATH_MAX ];
lib/locking/external_locking.c +2 -2
@@ -23,12 +23,12 @@static void (*_reset_fn) (void ) =NULL ;static void (*_end_fn) (void ) =NULL ;static int (*_lock_fn) (struct cmd_context * cmd,const char *resource, -int flags) =NULL ; +uint32_t flags) =NULL ;static int (*_init_fn) (int type,struct config_tree * cft,uint32_t *flags) =NULL ;static int _lock_resource (struct cmd_context *cmd,const char *resource, -int flags) +uint32_t flags) {if (_lock_fn)return _lock_fn (cmd, resource, flags);
lib/locking/file_locking.c +2 -2
@@ -124,7 +124,7 @@siginterrupt (SIGINT ,1 ); } -static int _lock_file (const char *file,int flags) +static int _lock_file (const char *file,uint32_t flags) {int operation;int r =1 ;
@@ -204,7 +204,7 @@ }static int _file_lock_resource (struct cmd_context *cmd,const char *resource, -int flags) +uint32_t flags) {char lockfile[PATH_MAX ];
lib/locking/locking.c +6 -6
@@ -118,7 +118,7 @@sigaction (SIGINT , &_oldhandler,NULL ); } -static void _block_signals (int flags __attribute((unused))) +static void _block_signals (uint32_t flags __attribute((unused))) {sigset_t set;
@@ -156,7 +156,7 @@return ; } -static void _lock_memory (int flags) +static void _lock_memory (uint32_t flags) {if (!(_locking.flags &LCK_PRE_MEMLOCK ))return ;
@@ -165,7 +165,7 @@memlock_inc (); } -static void _unlock_memory (int flags) +static void _unlock_memory (uint32_t flags) {if (!(_locking.flags &LCK_PRE_MEMLOCK ))return ;
@@ -187,7 +187,7 @@_unblock_signals (); } -static void _update_vg_lock_count (int flags) +static void _update_vg_lock_count (uint32_t flags) {if ((flags &LCK_SCOPE_MASK ) !=LCK_VG )return ;
@@ -313,7 +313,7 @@* VG locking is by VG name. * FIXME This should become VG uuid. */ -static int _lock_vol (struct cmd_context *cmd,const char *resource,int flags) +static int _lock_vol (struct cmd_context *cmd,const char *resource,uint32_t flags) {_block_signals (flags);_lock_memory (flags);
@@ -331,7 +331,7 @@return 1 ; } -int lock_vol (struct cmd_context *cmd,const char *vol,int flags) +int lock_vol (struct cmd_context *cmd,const char *vol,uint32_t flags) { char resource[258] __attribute((aligned(8)));
lib/locking/locking.h +18 -18
@@ -35,7 +35,7 @@* Lock/unlock an individual logical volume * char *vol holds lvid */ -int lock_vol (struct cmd_context *cmd,const char *vol,int flags); +int lock_vol (struct cmd_context *cmd,const char *vol,uint32_t flags);/* * Does the LVM1 driver have this VG active?
@@ -45,37 +45,37 @@/* * Lock type - these numbers are the same as VMS and the IBM DLM */ -#define LCK_TYPE_MASK 0x00000007 +#define LCK_TYPE_MASK 0x00000007U -#define LCK_NULL 0x00000000/* LCK$_NLMODE */ -#define LCK_READ 0x00000001/* LCK$_CRMODE */ +#define LCK_NULL 0x00000000U/* LCK$_NLMODE */ +#define LCK_READ 0x00000001U/* LCK$_CRMODE */ /* LCK$_CWMODE */ -#define LCK_PREAD 0x00000003/* LCK$_PRMODE */ -#define LCK_WRITE 0x00000004/* LCK$_PWMODE */ -#define LCK_EXCL 0x00000005/* LCK$_EXMODE */ -#define LCK_UNLOCK 0x00000006/* This is ours */ +#define LCK_PREAD 0x00000003U/* LCK$_PRMODE */ +#define LCK_WRITE 0x00000004U/* LCK$_PWMODE */ +#define LCK_EXCL 0x00000005U/* LCK$_EXMODE */ +#define LCK_UNLOCK 0x00000006U/* This is ours */ /* * Lock scope */ -#define LCK_SCOPE_MASK 0x00000008 -#define LCK_VG 0x00000000 -#define LCK_LV 0x00000008 +#define LCK_SCOPE_MASK 0x00000008U +#define LCK_VG 0x00000000U +#define LCK_LV 0x00000008U/* * Lock bits */ -#define LCK_NONBLOCK 0x00000010/* Don't block waiting for lock? */ -#define LCK_HOLD 0x00000020/* Hold lock when lock_vol returns? */ -#define LCK_LOCAL 0x00000040/* Don't propagate to other nodes */ -#define LCK_CLUSTER_VG 0x00000080/* VG is clustered */ +#define LCK_NONBLOCK 0x00000010U/* Don't block waiting for lock? */ +#define LCK_HOLD 0x00000020U/* Hold lock when lock_vol returns? */ +#define LCK_LOCAL 0x00000040U/* Don't propagate to other nodes */ +#define LCK_CLUSTER_VG 0x00000080U/* VG is clustered */ /* * Additional lock bits for cluster communication */ -#define LCK_PARTIAL_MODE 0x00000001/* Running in partial mode */ -#define LCK_MIRROR_NOSYNC_MODE 0x00000002/* Mirrors don't require sync */ -#define LCK_DMEVENTD_MONITOR_MODE 0x00000004/* Register with dmeventd */ +#define LCK_PARTIAL_MODE 0x00000001U/* Running in partial mode */ +#define LCK_MIRROR_NOSYNC_MODE 0x00000002U/* Mirrors don't require sync */ +#define LCK_DMEVENTD_MONITOR_MODE 0x00000004U/* Register with dmeventd */ /*
lib/locking/locking_types.h +1 -1
@@ -17,7 +17,7 @@#include "config.h" typedef int (*lock_resource_fn ) (struct cmd_context * cmd,const char *resource, -int flags); +uint32_t flags);typedef void (*fin_lock_fn ) (void );typedef void (*reset_lock_fn ) (void );
lib/locking/no_locking.c +2 -2
@@ -37,7 +37,7 @@ }static int _no_lock_resource (struct cmd_context *cmd,const char *resource, -int flags) +uint32_t flags) {switch (flags &LCK_SCOPE_MASK ) {case LCK_VG :
@@ -76,7 +76,7 @@return 1 ; } -int init_no_locking (struct locking_type *locking,struct cmd_context *cmd) +int init_no_locking (struct locking_type *locking,struct cmd_context *cmd __attribute((unused))) { locking->lock_resource = _no_lock_resource; locking->reset_locking = _no_reset_locking;
lib/metadata/lv_alloc.h +0 -1
@@ -50,7 +50,6 @@uint32_t extents, struct physical_volume *mirrored_pv, uint32_t mirrored_pe, - uint32_t status, struct list *allocatable_pvs, alloc_policy_t alloc, struct list *parallel_areas);
lib/metadata/lv_manip.c +12 -15
@@ -735,13 +735,13 @@ (le - seg->le) / area_multiple, area_len, max_seg_len, only_single_area_segments ?0 :0 , - only_single_area_segments ?1 :0 , - top_level_area_index !=-1 ? top_level_area_index : s, + only_single_area_segments ?1U :0U , + top_level_area_index !=-1 ? top_level_area_index : (int ) s, only_single_area_segments, fn, data))) stack; }else if (seg_type (seg, s) ==AREA_PV ) -if (!(r =fn (cmd,seg_pvseg (seg, s), top_level_area_index !=-1 ? top_level_area_index : s, data))) +if (!(r =fn (cmd,seg_pvseg (seg, s), top_level_area_index !=-1 ? (uint32_t ) top_level_area_index : s, data))) stack;if (r !=1 )return r;
@@ -813,7 +813,7 @@return 1 ; } -static int _is_condition (struct cmd_context *cmd, +static int _is_condition (struct cmd_context *cmd __attribute((unused)),struct pv_segment *pvseg,uint32_t s,void *data) {
@@ -1068,11 +1068,9 @@*/ static int _allocate (struct alloc_handle *ah,struct volume_group *vg, -struct logical_volume *lv,uint32_t status, +struct logical_volume *lv,uint32_t new_extents, -struct list *allocatable_pvs, -uint32_t stripes,uint32_t mirrors, -const struct segment_type *segtype) +struct list *allocatable_pvs) {struct pv_area **areas;uint32_t allocated = lv ? lv->le_count :0 ;
@@ -1197,7 +1195,6 @@uint32_t extents, struct physical_volume *mirrored_pv, uint32_t mirrored_pe, - uint32_t status, struct list *allocatable_pvs, alloc_policy_t alloc, struct list *parallel_areas)
@@ -1230,8 +1227,8 @@ }if (!segtype_is_virtual (segtype) && - !_allocate (ah, vg, lv, status, (lv ? lv->le_count :0 ) + extents, - allocatable_pvs, stripes, mirrors, segtype)) { + !_allocate (ah, vg, lv, (lv ? lv->le_count :0 ) + extents, + allocatable_pvs)) { stack;alloc_destroy (ah);return NULL ;
@@ -1334,8 +1331,8 @@struct logical_volume *lv, struct logical_volume **sub_lvs, uint32_t mirrors, - const struct segment_type *segtype, - uint32_t status, + const struct segment_type *segtype __attribute((unused)), + uint32_t status __attribute((unused)),uint32_t region_size, struct logical_volume *log_lv) {
@@ -1431,7 +1428,7 @@return lv_add_virtual_segment (lv, status, extents, segtype);if (!(ah =allocate_extents (lv->vg, lv, segtype, stripes, mirrors,0 , - extents, mirrored_pv, mirrored_pe, status, + extents, mirrored_pv, mirrored_pe, allocatable_pvs, alloc,NULL ))) { stack;return 0 ;
@@ -1556,7 +1553,7 @@ void *data) {struct lv_segment *seg; -int s; +uint32_t s; list_iterate_items(seg, &lv->segments) {if (seg->log_lv && !func (cmd, seg->log_lv, data))
lib/metadata/metadata-exported.h +3 -3
@@ -323,7 +323,7 @@int pv_resize (struct physical_volume *pv,struct volume_group *vg,uint32_t new_pe_count);int pv_analyze (struct cmd_context *cmd,const char *pv_name, -int64_t label_sector); +uint64_t label_sector); struct volume_group *vg_create(struct cmd_context *cmd, const char *name, uint32_t extent_size, uint32_t max_pv,
@@ -430,9 +430,9 @@ struct logical_volume *log_lv);int remove_mirror_images (struct lv_segment *mirrored_seg,uint32_t num_mirrors, -struct list *removable_pvs,int remove_log); +struct list *removable_pvs,unsigned remove_log);int reconfigure_mirror_images (struct lv_segment *mirrored_seg,uint32_t num_mirrors, -struct list *removable_pvs,int remove_log); +struct list *removable_pvs,unsigned remove_log); int insert_pvmove_mirrors(struct cmd_context *cmd, struct logical_volume *lv_mirr,
lib/metadata/metadata.c +6 -6
@@ -251,7 +251,7 @@int vg_remove_single (struct cmd_context *cmd,const char *vg_name,struct volume_group *vg,int consistent, -force_t force) +force_t force __attribute((unused))) {struct physical_volume *pv;struct pv_list *pvl;
@@ -466,8 +466,8 @@return 1 ; } -int vg_change_pesize (struct cmd_context *cmd,struct volume_group *vg, -uint32_t new_size) +int vg_change_pesize (struct cmd_context *cmd __attribute((unused)), +struct volume_group *vg,uint32_t new_size) {uint32_t old_size = vg->extent_size;struct pv_list *pvl;
@@ -617,8 +617,8 @@return 1 ; } -int vg_split_mdas (struct cmd_context *cmd,struct volume_group *vg_from, -struct volume_group *vg_to) +int vg_split_mdas (struct cmd_context *cmd __attribute((unused)), +struct volume_group *vg_from,struct volume_group *vg_to) {struct metadata_area *mda, *mda2;struct list *mdas_from, *mdas_to;
@@ -1783,7 +1783,7 @@* 1 - success */ int pv_analyze (struct cmd_context *cmd,const char *pv_name, -int64_t label_sector) +uint64_t label_sector) {struct label *label;struct device *dev;
lib/metadata/mirror.c +7 -6
@@ -118,7 +118,7 @@* Reduce mirrored_seg to num_mirrors images. */ int remove_mirror_images (struct lv_segment *mirrored_seg,uint32_t num_mirrors, -struct list *removable_pvs,int remove_log) +struct list *removable_pvs,unsigned remove_log) {uint32_t m;uint32_t extents;
@@ -255,7 +255,8 @@return 1 ; } -static int get_mirror_fault_policy (struct cmd_context *cmd,int log_policy) +static int get_mirror_fault_policy (struct cmd_context *cmd __attribute((unused)), +int log_policy) {const char *policy;
@@ -347,7 +348,7 @@ }int reconfigure_mirror_images (struct lv_segment *mirrored_seg,uint32_t num_mirrors, -struct list *removable_pvs,int remove_log) +struct list *removable_pvs,unsigned remove_log) {int r;int insync =0 ;
@@ -416,7 +417,7 @@uint32_t first_area, uint32_t num_mirrors, struct logical_volume *lv, - const struct segment_type *segtype, + const struct segment_type *segtype __attribute((unused)), struct logical_volume **img_lvs) {uint32_t m;
@@ -467,7 +468,7 @@uint32_t num_mirrors, struct logical_volume *lv, const struct segment_type *segtype, - uint32_t status, + uint32_t status __attribute((unused)), uint32_t region_size, struct logical_volume *log_lv) {
@@ -508,7 +509,7 @@int add_mirror_layers (struct alloc_handle *ah,uint32_t num_mirrors, -uint32_t existing_mirrors, +uint32_t existing_mirrors __attribute((unused)),struct logical_volume *lv,const struct segment_type *segtype) {
lib/misc/lvm-string.c +9 -9
@@ -27,7 +27,7 @@ n =vsnprintf (*buffer, *size, fmt, ap);va_end (ap); -if (n <0 || (n == *size)) +if (n <0 || ((size_t )n == *size))return 0 ; *buffer += n;
@@ -40,10 +40,10 @@* * Returns: * len - incremented for each char we encounter, whether 'c' or not. -* count - number of occurences of 'c' +* count - number of occurrences of 'c' */ void count_chars (const char *str,size_t *len,int *count, -const char c) +const int c) {const char *ptr;
@@ -56,18 +56,18 @@* Count occurences of 'c' in 'str' of length 'size'. * * Returns: -* # of occurences of 'c' +* Number of occurrences of 'c' */ -unsigned count_chars_len (const char *str,size_t size,const char c) +unsigned count_chars_len (const char *str,size_t len,const int c) { -int i; -unsigned count=0 ; +size_t i; +unsigned count =0 ; -for (i=0 ; i < size; i++) +for (i =0 ; i < len; i++)if (str[i] == c) count++; -return count; +return count; }/*
lib/misc/lvm-string.h +2 -2
@@ -32,7 +32,7 @@int validate_name (const char *n);void count_chars (const char *str,size_t *len,int *count, -char c); -unsigned count_chars_len (const char *str,size_t size,char c); +const int c); +unsigned count_chars_len (const char *str,size_t len,const int c);#endif
lib/report/report.c +40 -39
219 lines not on this page · raw message
lib/snapshot/snapshot.c +1 -1
@@ -128,7 +128,7 @@#endif static int _snap_modules_needed (struct dm_pool *mem, -const struct lv_segment *seg, +const struct lv_segment *seg __attribute((unused)),struct list *modules) {if (!str_list_add (mem, modules,"snapshot" )) {
lib/zero/zero.c +1 -1
@@ -65,7 +65,7 @@#endif static int _zero_modules_needed (struct dm_pool *mem, -const struct lv_segment *seg, +const struct lv_segment *seg __attribute((unused)),struct list *modules) {if (!str_list_add (mem, modules,"zero" )) {
tools/lvconvert.c +4 -4
@@ -338,9 +338,9 @@if (!(ah =allocate_extents (lv->vg,NULL , lp->segtype,1 , lp->mirrors -1 , - corelog ?0 :1 , + corelog ?0U :1U , lv->le_count * (lp->mirrors -1 ), -NULL ,0 ,0 , lp->pvh, +NULL ,0 , lp->pvh, lp->alloc, parallel_areas))) return_0;
@@ -390,7 +390,7 @@if (!(ah =allocate_extents (lv->vg,NULL , segtype,0 ,0 ,1 ,0 , -NULL ,0 ,0 , lp->pvh, +NULL ,0 , lp->pvh, lp->alloc, parallel_areas))) { stack;
@@ -503,7 +503,7 @@if (!lp->zero || !(lv->status &LVM_WRITE ))log_warn ("WARNING: \"%s\" not zeroed" , lv->name); -else if (!set_lv (cmd, lv,0 ,0 )) { +else if (!set_lv (cmd, lv,UINT64_C (0 ),0 )) {log_error ("Aborting. Failed to wipe snapshot " "exception store." );return 0 ;
tools/lvcreate.c +4 -4
@@ -572,7 +572,7 @@log_error ("Volume too large (%s) for extent size %s. " "Upper limit is %s." ,display_size (cmd, tmp_size), -display_size (cmd, vg->extent_size), +display_size (cmd, (uint64_t ) vg->extent_size),display_size (cmd, (uint64_t )UINT32_MAX * vg->extent_size));return 0 ;
@@ -707,8 +707,8 @@/* FIXME Calculate how many extents needed for the log */ if (!(ah =allocate_extents (vg,NULL , lp->segtype, lp->stripes, - lp->mirrors, lp->corelog ?0 :1 , - lp->extents,NULL ,0 ,0 , + lp->mirrors, lp->corelog ?0U :1U , + lp->extents,NULL ,0 , pvh, lp->alloc,NULL ))) { stack;return 0 ;
@@ -804,7 +804,7 @@ }if ((lp->zero || lp->snapshot) &&activation ()) { -if (!set_lv (cmd, lv,0 ,0 ) && lp->snapshot) { +if (!set_lv (cmd, lv,UINT64_C (0 ),0 ) && lp->snapshot) {/* FIXME Remove the failed lv we just added */ log_error ("Aborting. Failed to wipe snapshot " "exception store. Remove new LV and retry." );
tools/pvck.c +1 -1
@@ -32,7 +32,7 @@log_verbose ("Scanning %s" , argv[i]);pv_analyze (cmd, argv[i], -arg_int64_value (cmd, labelsector_ARG, +arg_uint64_value (cmd, labelsector_ARG,UINT64_C (0 ))); }
tools/reporter.c +4 -2
@@ -134,7 +134,8 @@ }static int _pvs_in_vg (struct cmd_context *cmd,const char *vg_name, -struct volume_group *vg,int consistent, +struct volume_group *vg, +int consistent __attribute((unused)),void *handle) {if (!vg) {
@@ -146,7 +147,8 @@ }static int _pvsegs_in_vg (struct cmd_context *cmd,const char *vg_name, -struct volume_group *vg,int consistent, +struct volume_group *vg, +int consistent __attribute((unused)),void *handle) {if (!vg) {
tools/toollib.c +5 -5
@@ -221,7 +221,7 @@ }int process_each_lv (struct cmd_context *cmd,int argc,char **argv, -int lock_type,void *handle, +uint32_t lock_type,void *handle,int (*process_single) (struct cmd_context * cmd,struct logical_volume * lv,void *handle))
@@ -392,7 +392,7 @@list_init (&lvnames);break ; }else if (!strncmp (vg_name, vgname,strlen (vgname)) && -strlen (vgname) == lv_name - vg_name) { +strlen (vgname) == (size_t ) (lv_name - vg_name)) {if (!str_list_add (cmd->mem, &lvnames,dm_pool_strdup (cmd->mem, lv_name +1 ))) {
@@ -463,7 +463,7 @@ static int _process_one_vg(struct cmd_context *cmd, const char *vg_name, const char *vgid, struct list *tags, struct list *arg_vgnames, - int lock_type, int consistent, void *handle, + uint32_t lock_type, int consistent, void *handle, int ret_max, int (*process_single) (struct cmd_context * cmd, const char *vg_name,
@@ -513,7 +513,7 @@ } int process_each_vg(struct cmd_context *cmd, int argc, char **argv, - int lock_type, int consistent, void *handle, + uint32_t lock_type, int consistent, void *handle, int (*process_single) (struct cmd_context * cmd, const char *vg_name, struct volume_group * vg,
@@ -1133,7 +1133,7 @@* Attempt metadata recovery */ struct volume_group *recover_vg (struct cmd_context *cmd,const char *vgname, -int lock_type) +uint32_t lock_type) {int consistent =1 ;
tools/toollib.h +3 -3
@@ -24,10 +24,10 @@int autobackup (struct volume_group *vg);struct volume_group *recover_vg (struct cmd_context *cmd,const char *vgname, -int lock_type); +uint32_t lock_type); int process_each_vg(struct cmd_context *cmd, int argc, char **argv, - int lock_type, int consistent, void *handle, + uint32_t lock_type, int consistent, void *handle, int (*process_single) (struct cmd_context * cmd, const char *vg_name, struct volume_group * vg,
@@ -49,7 +49,7 @@ void *handle));int process_each_lv (struct cmd_context *cmd,int argc,char **argv, -int lock_type,void *handle, +uint32_t lock_type,void *handle,int (*process_single) (struct cmd_context * cmd,struct logical_volume * lv,void *handle));
tools/vgreduce.c +1 -1
@@ -301,7 +301,7 @@ } } -if ((mimages != mirrored_seg->area_count) || (remove_log)){ +if ((mimages != mirrored_seg->area_count) || remove_log){if (!reconfigure_mirror_images (mirrored_seg, mimages,NULL , remove_log)) { stack;
tools/vgsplit.c +3 -3
@@ -173,7 +173,7 @@struct list *lvh, *lvht;struct logical_volume *lv;struct lv_segment *seg; -int i, seg_in, log_in; +unsigned s, seg_in, log_in; list_iterate_safe(lvh, lvht, &vg_from->lvs) { lv = list_item(lvh, struct lv_list)->lv;
@@ -184,8 +184,8 @@ seg =first_seg (lv); seg_in =0 ; -for (i =0 ; i < seg->area_count; i++) -if (_lv_is_in_vg (vg_to,seg_lv (seg, i))) +for (s =0 ; s < seg->area_count; s++) +if (_lv_is_in_vg (vg_to,seg_lv (seg, s))) seg_in++; log_in = (!seg->log_lv ||_lv_is_in_vg (vg_to, seg->log_lv));