[systemd-devel] [PATCH 06/12] Support cancellation of fsck in progress
Didier Roche
didrocks at ubuntu.com
Thu Jan 29 09:44:47 PST 2015
Le 28/01/2015 21:25, Lennart Poettering a écrit :
> On Wed, 28.01.15 14:22, Didier Roche (didrocks at ubuntu.com) wrote:
>
>> src/fsck/fsck.c | 29 +++++++++++++++++++++--------
>> src/fsckd/fsckd.c | 43 +++++++++++++++++++++++++++++++++++++++++++
>> src/fsckd/fsckd.h | 5 +++++
>> 3 files changed, 69 insertions(+), 8 deletions(-)
>>
>> diff --git a/src/fsck/fsck.c b/src/fsck/fsck.c
>> index f5dd546..0b42e3b 100644
>> --- a/src/fsck/fsck.c
>> +++ b/src/fsck/fsck.c
>> @@ -47,6 +47,8 @@
>> static bool arg_skip = false;
>> static bool arg_force = false;
>> static const char *arg_repair = "-a";
>> +static pid_t fsck_pid;
>> +static bool cancel_requested = false;
> Please do not introduce new global variables unnecessarily. We try to
> keep variables locally, and keep the global state at a minimum. An
> exception is mostly the command line args, which by their nature are
> global anyway...
Sure, I put fsck_pid as a function parameter. For cancel_requested, I
noticed that process_progress() was already return an int that was not
read, so assigned it to a variable and check for fsck KILL status and
not process_progress returning 0.
I didn't add checks (as there were none as of today) on
process_progress() status, but can do.
Cheers,
Didier
More information about the systemd-devel
mailing list