public inbox for util-linux@vger.kernel.org
 help / color / mirror / Atom feed
From: Sami Kerola <kerolasa@iki.fi>
To: Karel Zak <kzak@redhat.com>
Cc: util-linux@vger.kernel.org
Subject: Re: [PATCH 12/17] eject: add struct eject_control to remove global variables
Date: Tue, 16 Sep 2014 21:39:39 +0100 (BST)	[thread overview]
Message-ID: <alpine.LNX.2.03.1409162137590.3712@kerolasa-home> (raw)
In-Reply-To: <20140912092604.GV21325@x2.net.home>

On Fri, 12 Sep 2014, Karel Zak wrote:

> On Sun, Sep 07, 2014 at 01:43:00PM +0100, Sami Kerola wrote:
>> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
>> ---
>>  sys-utils/eject.c | 394 +++++++++++++++++++++++++++---------------------------
>>  1 file changed, 198 insertions(+), 196 deletions(-)
>>
>> diff --git a/sys-utils/eject.c b/sys-utils/eject.c
>> index 03744c7..767ede7 100644
>> --- a/sys-utils/eject.c
>> +++ b/sys-utils/eject.c
>> @@ -81,31 +81,34 @@ static const char * const hotplug_subsystems[] = {
>>  	"ccw"
>>  };
>>
>> -/* Global Variables */
>> -static int a_option; /* command flags and arguments */
>> -static int c_option;
>> -static int d_option;
>> -static int f_option;
>> -static int F_option;
>> -static int n_option;
>> -static int q_option;
>> -static int r_option;
>> -static int s_option;
>> -static int t_option;
>> -static int T_option;
>> -static int X_option;
>> -static int v_option;
>> -static int x_option;
>> -static int p_option;
>> -static int m_option;
>> -static int M_option;
>> -static int i_option;
>> -static int a_arg;
>> -static int i_arg;
>> -static long int c_arg;
>> -static long int x_arg;
>> -
>> -struct libmnt_table *mtab;
>> +struct eject_control {
>> +	struct libmnt_table *mtab;
>> +	char *device;			/* device or mount point to be ejected */
>> +	int fd;				/* file descriptor for device */
>> +	uint32_t 			/* command flags and arguments */
>
> Again, don't be creative, use "unsigned int". The reality is that
> you have zero control on the way how compiler pack the bits.

Corrected version is easiest to get from my github branch misc. I will 
send update to pull request shortly.

-- 
Sami Kerola
http://www.iki.fi/kerolasa/

  reply	other threads:[~2014-09-16 20:39 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-07 12:42 [PATCH 00/17] pull: miscellaneous changes Sami Kerola
2014-09-07 12:42 ` [PATCH 01/17] libuuid: add extern qualifiers to uuid/uuid.h system header Sami Kerola
2014-09-07 12:42 ` [PATCH 02/17] include: simplify fputc_careful() in carefulputc.h Sami Kerola
2014-09-07 12:42 ` [PATCH 03/17] lib: avoid use of obsolete getpass() function Sami Kerola
2014-09-12  8:31   ` Karel Zak
2014-09-07 12:42 ` [PATCH 04/17] lib: add function to remove string from memory Sami Kerola
2014-09-07 12:42 ` [PATCH 05/17] newgrp: use xgetpass() and memset_s() to group password validation Sami Kerola
2014-09-12  8:44   ` Karel Zak
2014-09-16 20:33     ` Sami Kerola
2014-09-07 12:42 ` [PATCH 06/17] last: make is_phantom() when kernel config does not include audit support Sami Kerola
2014-09-07 12:42 ` [PATCH 07/17] last: improve code readability by renaming variable names Sami Kerola
2014-09-07 12:42 ` [PATCH 08/17] zramctl: fix two format string warnings Sami Kerola
2014-09-07 12:42 ` [PATCH 09/17] mountpoint: add struct mountpoint_control Sami Kerola
2014-09-12  9:14   ` Karel Zak
2014-09-16 20:36     ` Sami Kerola
2014-09-07 12:42 ` [PATCH 10/17] mkfs.minix: fix couple compiler warnings Sami Kerola
2014-09-07 12:42 ` [PATCH 11/17] mountpoint: simplify if statement Sami Kerola
2014-09-07 12:43 ` [PATCH 12/17] eject: add struct eject_control to remove global variables Sami Kerola
2014-09-12  9:26   ` Karel Zak
2014-09-16 20:39     ` Sami Kerola [this message]
2014-09-07 12:43 ` [PATCH 13/17] eject: make open_device() and select_speed() to use struct eject_control Sami Kerola
2014-09-07 12:43 ` [PATCH 14/17] hwclock: remove referal to deprecated keyboard interface Sami Kerola
2014-09-07 12:43 ` [PATCH 15/17] setarch: reindent code Sami Kerola
2014-09-07 12:43 ` [PATCH 16/17] setarch: use personality() system call when it is available Sami Kerola
2014-09-07 12:43 ` [PATCH 17/17] setarch: remove unreachable code Sami Kerola
2014-09-12  9:50   ` Karel Zak
2014-09-16 20:50     ` Sami Kerola
2014-09-16 20:56 ` [PATCH 00/17] pull: miscellaneous changes Sami Kerola
2014-09-22 13:01 ` Karel Zak

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=alpine.LNX.2.03.1409162137590.3712@kerolasa-home \
    --to=kerolasa@iki.fi \
    --cc=kzak@redhat.com \
    --cc=util-linux@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox