[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] libhurdutil: New library containing utils to be used by Guix.

From: Manolis Ragkousis
Subject: [PATCH] libhurdutil: New library containing utils to be used by Guix.
Date: Wed, 25 May 2016 16:44:09 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0

Hello everyone,

This is the library Justus suggested some time ago and it contains the
implementation of settrans. This patch actually does three things.

1) It creates libhurdutil/hurdutil.h which exposes the interface and a
struct called settrans_flags_t which contains all the flags to be used
by settrans.
2) It creates libhurdutil/settrans.c which includes the c implementation
of utils/settrans.c without the arguments parsing.
3) It modifies utils/settrans.c to use the new library. The arguments
parsing of the settrans binary happens here.

Whoever uses the library directly will modify the flags accordingly and
pass them to settrans() from the library.

In order to use it you first have to declare a variable settrans_flags_t
flags, initialize it with settrans_flags_create(&flags), change the
flags inside settrans_flags_t, pass it to settrans() and when you are
done call settrans_flags_cleanup(flags).

I have tested it and it works. I am currently using it in my vm. But I
have some questions.

Implementation questions:
1) How should I handle errors of settrans inside the library? Normally
utils/settrans.c used error() to report any problems. But settrans()
should return error_t codes. Should I define a list of errors for
settrans() and use them accordingly? (e.g TRANS_NOT_SET etc.)
2) Do you agree with the way I handle arguments? Should I do it in a
different way?

Code indentations questions:
1) I am using emacs and I have configured it to automatically indent
code according to the gnu style. But I noticed that this causes changes
from the original. For example in the original, some '{'  are not being
tabbed 4 spaces to the right. Why? Is this a special case?

This is my first serious c library so I am sure there will be many
things that need to be changed. settrans_flags_cleanup() needs some work
and I need to add more comments. It's still work in progress so please
feel free to correct/suggest anything. :-)

Thank you,

Attachment: 0001-libhurdutil-New-library-containing-utils-to-be-used-.patch
Description: Text Data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]