On Thu, Apr 28, 2011 at 10:23 AM, Sage Weil <sage@xxxxxxxxxxxx> wrote: > On Thu, 28 Apr 2011, Colin McCabe wrote: >> On Wed, Apr 27, 2011 at 12:28 PM, Tommi Virtanen >> <tommi.virtanen@xxxxxxxxxxxxx> wrote: >> > On Wed, Apr 27, 2011 at 11:49:11AM -0700, Brian Chrisman wrote: >> >> ceph_mount_t is forward declared as a struct in libceph.h. >> >> When referencing that within libceph.h, gcc barfs: >> >> client/libceph.h:32: error: expected ?)? before ?*? token >> >> >> >> Is libceph.h intended to be used in C-programs, and if so, am I using >> >> it incorrectly? >> >> ceph_mount_t is defined as a class in libceph.cc, and I'm unclear on >> >> how that would be translated into a struct for C-programs linking to >> >> libceph. >> > >> > We talked about this on IRC, replying here for others & historical >> > records. >> > >> > The problem is this: >> > >> > struct ceph_mount_t; >> > >> > int ceph_create(ceph_mount_t **cmount, const char * const id); >> > >> > There is no ceph_mount_t. Changing the prototype to >> > >> > int ceph_create(struct ceph_mount_t **cmount, const char * const id); >> > >> > should get things going nicely (as long as you fix up the >> > implementation also). >> >> Yeah, the struct keyword needs to be added for the benefit of C >> clients. Sorry for any confusion. > > I pushed a patch to master that adds this. It's now > > struct ceph_mount_t; > > which is sort of annoying: the _t suffix really shouldn't be there. But > if it's just ceph_mount it conflicts with int ceph_mount()... :/ > > sage > > Well, actually, in C and C++, variables can have the same name as types. In other words, the namespaces are separate. Taking advantage of this isn't necessarily a good idea, though... parsing in C++ is pretty ambiguous already. As far as the _t suffix goes, it's used a lot in the Ceph library bindings. For example, librados has rados_t, rados_ioctx_t, rados_list_ctx_t, and rados_snap_t. librbd has rbd_snap_t and rbd_image_t. So although we don't generally use the _t internally, the library bindings are generally a _t party (so to speak.) cheers, Colin -- To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html