All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Allow use headers in C++.
@ 2010-06-14 16:20 Milan Broz
  2010-06-14 19:27 ` ben scott
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Milan Broz @ 2010-06-14 16:20 UTC (permalink / raw)
  To: lvm-devel

Remove C++ private keyword from header.
Add extern C definition for libdevmapper and lvm2app.
---
 libdm/libdevmapper.h |   13 ++++++++++---
 libdm/libdm-report.c |    4 ++--
 liblvm/lvm2app.h     |    6 ++++++
 3 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h
index 0b67a0f..7c72cf7 100644
--- a/libdm/libdevmapper.h
+++ b/libdm/libdevmapper.h
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
- * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2004-2010 Red Hat, Inc. All rights reserved.
  *
  * This file is part of the device-mapper userspace tools.
  *
@@ -29,6 +29,10 @@
 #include <stdlib.h>
 #include <stdio.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /*****************************************************************
  * The first section of this file provides direct access to the
  * individual device-mapper ioctls.  Since it is quite laborious to
@@ -1022,7 +1026,7 @@ struct dm_report_field_type {
 	const char heading[32];	/* string printed in header */
 	int (*report_fn)(struct dm_report *rh, struct dm_pool *mem,
 			 struct dm_report_field *field, const void *data,
-			 void *private);
+			 void *private_data);
 	const char *desc;	/* description of the field */
 };
 
@@ -1044,7 +1048,7 @@ struct dm_report *dm_report_init(uint32_t *report_types,
 				 const char *output_separator,
 				 uint32_t output_flags,
 				 const char *sort_keys,
-				 void *private);
+				 void *private_data);
 int dm_report_object(struct dm_report *rh, void *object);
 int dm_report_output(struct dm_report *rh);
 void dm_report_free(struct dm_report *rh);
@@ -1163,4 +1167,7 @@ int dm_udev_wait(uint32_t cookie);
 
 #define DM_DEV_DIR_UMASK 0022
 
+#ifdef __cplusplus
+}
+#endif
 #endif				/* LIB_DEVICE_MAPPER_H */
diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c
index e13115a..2b044b5 100644
--- a/libdm/libdm-report.c
+++ b/libdm/libdm-report.c
@@ -566,7 +566,7 @@ struct dm_report *dm_report_init(uint32_t *report_types,
 				 const char *output_separator,
 				 uint32_t output_flags,
 				 const char *sort_keys,
-				 void *private)
+				 void *private_data)
 {
 	struct dm_report *rh;
 	const struct dm_report_object_type *type;
@@ -588,7 +588,7 @@ struct dm_report *dm_report_init(uint32_t *report_types,
 	rh->separator = output_separator;
 	rh->fields = fields;
 	rh->types = types;
-	rh->private = private;
+	rh->private = private_data;
 
 	rh->flags |= output_flags & DM_REPORT_OUTPUT_MASK;
 
diff --git a/liblvm/lvm2app.h b/liblvm/lvm2app.h
index 09455da..05f804f 100644
--- a/liblvm/lvm2app.h
+++ b/liblvm/lvm2app.h
@@ -18,6 +18,9 @@
 
 #include <stdint.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /******************************** WARNING ***********************************
  *
@@ -1194,4 +1197,7 @@ uint64_t lvm_pv_get_free(const pv_t pv);
  */
 int lvm_pv_resize(const pv_t pv, uint64_t new_size);
 
+#ifdef __cplusplus
+}
+#endif
 #endif /* _LIB_LVM2APP_H */
-- 
1.7.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH] Allow use headers in C++.
  2010-06-14 16:20 [PATCH] Allow use headers in C++ Milan Broz
@ 2010-06-14 19:27 ` ben scott
  2010-06-15 11:43 ` Mike Snitzer
  2010-06-16 12:14 ` [PATCH] " Zdenek Kabelac
  2 siblings, 0 replies; 5+ messages in thread
From: ben scott @ 2010-06-14 19:27 UTC (permalink / raw)
  To: lvm-devel

On Monday, June 14, 2010 09:20:07 am Milan Broz wrote:
> Remove C++ private keyword from header.
> Add extern C definition for libdevmapper and lvm2app.
> ---

Thank you.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Allow use headers in C++.
  2010-06-14 16:20 [PATCH] Allow use headers in C++ Milan Broz
  2010-06-14 19:27 ` ben scott
@ 2010-06-15 11:43 ` Mike Snitzer
  2010-06-15 11:50   ` Milan Broz
  2010-06-16 12:14 ` [PATCH] " Zdenek Kabelac
  2 siblings, 1 reply; 5+ messages in thread
From: Mike Snitzer @ 2010-06-15 11:43 UTC (permalink / raw)
  To: lvm-devel

On Mon, Jun 14 2010 at 12:20pm -0400,
Milan Broz <mbroz@redhat.com> wrote:

> Remove C++ private keyword from header.
...
> diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c
> index e13115a..2b044b5 100644
> --- a/libdm/libdm-report.c
> +++ b/libdm/libdm-report.c
> @@ -566,7 +566,7 @@ struct dm_report *dm_report_init(uint32_t *report_types,
>  				 const char *output_separator,
>  				 uint32_t output_flags,
>  				 const char *sort_keys,
> -				 void *private)
> +				 void *private_data)
>  {
>  	struct dm_report *rh;
>  	const struct dm_report_object_type *type;
> @@ -588,7 +588,7 @@ struct dm_report *dm_report_init(uint32_t *report_types,
>  	rh->separator = output_separator;
>  	rh->fields = fields;
>  	rh->types = types;
> -	rh->private = private;
> +	rh->private = private_data;
>  
>  	rh->flags |= output_flags & DM_REPORT_OUTPUT_MASK;

Should struct dm_report's "private" be renamed too?



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Allow use headers in C++.
  2010-06-15 11:43 ` Mike Snitzer
@ 2010-06-15 11:50   ` Milan Broz
  0 siblings, 0 replies; 5+ messages in thread
From: Milan Broz @ 2010-06-15 11:50 UTC (permalink / raw)
  To: lvm-devel

On 06/15/2010 01:43 PM, Mike Snitzer wrote:
> On Mon, Jun 14 2010 at 12:20pm -0400,
> Milan Broz <mbroz@redhat.com> wrote:
> 
>> Remove C++ private keyword from header.
> ...
>> diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c
>> index e13115a..2b044b5 100644
>> --- a/libdm/libdm-report.c
>> +++ b/libdm/libdm-report.c
>> @@ -566,7 +566,7 @@ struct dm_report *dm_report_init(uint32_t *report_types,
>>  				 const char *output_separator,
>>  				 uint32_t output_flags,
>>  				 const char *sort_keys,
>> -				 void *private)
>> +				 void *private_data)
>>  {
>>  	struct dm_report *rh;
>>  	const struct dm_report_object_type *type;
>> @@ -588,7 +588,7 @@ struct dm_report *dm_report_init(uint32_t *report_types,
>>  	rh->separator = output_separator;
>>  	rh->fields = fields;
>>  	rh->types = types;
>> -	rh->private = private;
>> +	rh->private = private_data;
>>  
>>  	rh->flags |= output_flags & DM_REPORT_OUTPUT_MASK;
> 
> Should struct dm_report's "private" be renamed too?

Not needed, that's not part of external API/ABI but internal to library.
(There are more such conflicting names, but these are not problem in compilation,
because this is always compiled in C only.)

Milan



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] Allow use headers in C++.
  2010-06-14 16:20 [PATCH] Allow use headers in C++ Milan Broz
  2010-06-14 19:27 ` ben scott
  2010-06-15 11:43 ` Mike Snitzer
@ 2010-06-16 12:14 ` Zdenek Kabelac
  2 siblings, 0 replies; 5+ messages in thread
From: Zdenek Kabelac @ 2010-06-16 12:14 UTC (permalink / raw)
  To: lvm-devel

Dne 14.6.2010 18:20, Milan Broz napsal(a):
> Remove C++ private keyword from header.
> Add extern C definition for libdevmapper and lvm2app.
> ---
>   libdm/libdevmapper.h |   13 ++++++++++---
>   libdm/libdm-report.c |    4 ++--
>   liblvm/lvm2app.h     |    6 ++++++
>   3 files changed, 18 insertions(+), 5 deletions(-)
>
> diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h
> index 0b67a0f..7c72cf7 100644
> --- a/libdm/libdevmapper.h
> +++ b/libdm/libdevmapper.h
> @@ -1,6 +1,6 @@


Ack

When we do this for libdevmapper.h and lvm2app.h, then for consistency C++ 
externs should be applied to remaing user exported headers:

libdevmapper-event.h
lvm2cmd.h

Zdenek



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-06-16 12:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-14 16:20 [PATCH] Allow use headers in C++ Milan Broz
2010-06-14 19:27 ` ben scott
2010-06-15 11:43 ` Mike Snitzer
2010-06-15 11:50   ` Milan Broz
2010-06-16 12:14 ` [PATCH] " Zdenek Kabelac

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.