All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philipp Reisner <philipp.reisner@linbit.com>
To: Bart Van Assche <bart.vanassche@gmail.com>
Cc: linux-kernel@vger.kernel.org, Jens Axboe <jens.axboe@oracle.com>,
	Greg KH <gregkh@suse.de>, Neil Brown <neilb@suse.de>,
	James Bottomley <James.Bottomley@hansenpartnership.com>,
	Andi Kleen <andi@firstfloor.org>, Sam Ravnborg <sam@ravnborg.org>,
	Dave Jones <davej@redhat.com>,
	Nikanth Karthikesan <knikanth@suse.de>,
	"Lars Marowsky-Bree" <lmb@suse.de>,
	"Nicholas A. Bellinger" <nab@linux-iscsi.org>,
	Lars Ellenberg <lars.ellenberg@linbit.com>
Subject: Re: [PATCH 06/14] DRBD: userspace_interface
Date: Fri, 17 Apr 2009 15:24:27 +0200	[thread overview]
Message-ID: <200904171524.28960.philipp.reisner@linbit.com> (raw)
In-Reply-To: <e2e108260904120923q639d036drb04b55b1e653ebf1@mail.gmail.com>

On Sunday 12 April 2009 18:23:43 Bart Van Assche wrote:
> On Fri, Apr 10, 2009 at 2:12 PM, Philipp Reisner
>
> <philipp.reisner@linbit.com> wrote:
> > diff -uNrp linux-2.6.30-rc1/include/linux/drbd.h
> > linux-2.6.30-rc1-drbd/include/linux/drbd.h ---
> > linux-2.6.30-rc1/include/linux/drbd.h       1970-01-01 01:00:00.000000000
> > +0100 +++ linux-2.6.30-rc1-drbd/include/linux/drbd.h  2009-03-26
> > 15:53:46.520275000 +0100
>
> ...
>
> > +#include <linux/drbd_config.h>
>
> By including drbd_config.h in drbd.h all definitions in the former
> header file become visible in user space. Several definitions in
> drbd_config.h only make sense inside the kernel. Either the above
> #include directive should be removed or drbd_config.h should be
> cleaned up.

Without comments and boilerplate, drbd_config.h has 7 defines. 
REL_VERSION and API_VERSION are used by the kernel code and drbdsetup,
the others are used only by the kernel.

Ack, I have removed it from drbd.h

>
> > +/* Altough the Linux source code makes a difference between
> > +   generic endiness and the bitfields' endianess, there is no
> > +   architecture as of Linux-2.6.24-rc4 where the bitfileds' endianess
> > +   does not match the generic endianess. */
>
> I assume this should have been four times "endianness", just like below ?

Right. Changed.

> > +/* KEEP the order, do not delete or insert!
> > + * Or change the API_VERSION, too. */
> > +enum ret_codes {
> > +       RetCodeBase = 100,
> > +       NoError,         /* 101 ... */
> > +       LAAlreadyInUse,
>
> How will backwards compatibility for return codes be ensured ? The
> comment before the enum probably has to be changed to "KEEP the order,
> do not delete or insert!" only ?
>

Comment adjusted. New error codes should be appended to enum. When a
old userspace programm sees an error code greater than AfterLastRetCode
it suggests the user that he should update the userspace tools.

> ...
>
> > +union drbd_state_t {
> > +/* According to gcc's docs is the ...
> > + * The order of allocation of bit-fields within a unit (C90 6.5.2.1, C99
> > 6.7.2.1). + * Determined by ABI.
> > + * pointed out by Maxim Uvarov q<muvarov@ru.mvista.com>
> > + * even though we transmit as "cpu_to_be32(state)",
> > + * the offsets of the bitfields still need to be swapped
> > + * on different endianess.
> > + */
>
> The above comment really looks strange. Is it still up to date ?
>

The comment might be strange, but the content is true.

> > +/* from drbd_strings.c */
> > +extern const char *conns_to_name(enum drbd_conns);
> > +extern const char *roles_to_name(enum drbd_role);
> > +extern const char *disks_to_name(enum drbd_disk_state);
> > +extern const char *set_st_err_name(enum set_st_err);
>
> Should declarations of kernel functions really be present in a user
> space interface header ?
>

Well, we actually compile and link the same source file (drbd_strings.c) 
into the kernel code and into unser space (drbdsetup). It just has
functions to map those numbers to strings. -- Nothing fancy.

So yes, you are right, they are not part of the interface, they are
just used in both contexts. It just seemed ridiculous to me to have 
even a dedicated header file defining those 4 external functions.

As usual, I have pushed the changes to git.drbd.org

-Phil
-- 
: Dipl-Ing Philipp Reisner
: LINBIT | Your Way to High Availability
: Tel: +43-1-8178292-50, Fax: +43-1-8178292-82
: http://www.linbit.com

DRBD(R) and LINBIT(R) are registered trademarks of LINBIT, Austria.


  reply	other threads:[~2009-04-17 13:25 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-10 12:12 [PATCH 00/14] DRBD: a block device for HA clusters Philipp Reisner
2009-04-10 12:12 ` [PATCH 01/14] DRBD: major.h Philipp Reisner
2009-04-10 12:12   ` [PATCH 02/14] DRBD: lru_cache Philipp Reisner
2009-04-10 12:12     ` [PATCH 03/14] DRBD: activity_log Philipp Reisner
2009-04-10 12:12       ` [PATCH 04/14] DRBD: bitmap Philipp Reisner
2009-04-10 12:12         ` [PATCH 05/14] DRBD: request Philipp Reisner
2009-04-10 12:12           ` [PATCH 06/14] DRBD: userspace_interface Philipp Reisner
2009-04-10 12:12             ` [PATCH 07/14] DRBD: internal_data_structures Philipp Reisner
2009-04-10 12:12               ` [PATCH 08/14] DRBD: main Philipp Reisner
2009-04-10 12:12                 ` [PATCH 09/14] DRBD: receiver Philipp Reisner
2009-04-10 12:12                   ` [PATCH 10/14] DRBD: proc Philipp Reisner
2009-04-10 12:12                     ` [PATCH 11/14] DRBD: worker Philipp Reisner
2009-04-10 12:12                       ` [PATCH 12/14] DRBD: variable_length_integer_encoding Philipp Reisner
2009-04-10 12:12                         ` [PATCH 13/14] DRBD: misc Philipp Reisner
2009-04-10 12:12                           ` [PATCH 14/14] DRBD: final Philipp Reisner
2009-04-11  7:18               ` [PATCH 07/14] DRBD: internal_data_structures Bart Van Assche
2009-04-14 13:53                 ` Philipp Reisner
2009-04-12 16:44               ` Bart Van Assche
2009-04-16 13:35                 ` Philipp Reisner
2009-04-12 16:23             ` [PATCH 06/14] DRBD: userspace_interface Bart Van Assche
2009-04-17 13:24               ` Philipp Reisner [this message]
2009-04-14  2:33             ` Kyle Moffett
2009-04-22 10:31               ` Philipp Reisner
2009-04-16  7:06           ` [PATCH 05/14] DRBD: request Bart Van Assche
2009-04-16 15:32             ` Philipp Reisner
2009-04-10 12:24     ` [PATCH 02/14] DRBD: lru_cache Bart Van Assche
2009-04-14 11:54     ` Nikanth Karthikesan
2009-04-15 15:29       ` Philipp Reisner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200904171524.28960.philipp.reisner@linbit.com \
    --to=philipp.reisner@linbit.com \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=andi@firstfloor.org \
    --cc=bart.vanassche@gmail.com \
    --cc=davej@redhat.com \
    --cc=gregkh@suse.de \
    --cc=jens.axboe@oracle.com \
    --cc=knikanth@suse.de \
    --cc=lars.ellenberg@linbit.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lmb@suse.de \
    --cc=nab@linux-iscsi.org \
    --cc=neilb@suse.de \
    --cc=sam@ravnborg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.