Re: [Grubby - PATCH 1/4] Add forward declarations for functions

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

 



On 06/12/2012 07:51 PM, Adrian Perez de Castro wrote:

Hi,

Peter Jones <pjones@xxxxxxxxxx> writes:

On 06/11/2012 12:29 PM, Adrian Perez wrote:

Certain compilers may spit out a huge amount of warnings about
missing prototypes, or even fail to compile grubby.c if they
default to the C99 standard. This adds the missing prototypes
at the beginning of the source file, also marking the functions
as static -- they are not going to be used anywhere else after
all.

What compiler does this?  I'd like the changelog to have /specific/
details if we're making changes to deal with compiler issues.

I have been toying a bit with this, and the issue appears using GCC
(or Clang) in C89/gnu89 mode, but only when #including grubby.c as
part of another .c file which uses GObject, when the header which
declared the GOobject is #included first... — admittedly that case
is a bit obscure.

IMHO, splittig the declarations in a separate grubby.h header file,
as suggested by Vratislav is actually more convenient for me (so
I don't need to #include grubby.c, but just the header instead),
and it is also better to try to make it easier to use the Grubby
functionality in other projects.

Opinions?

Yes, if we're going to make a library of this, making a public header is the
way to go.


-Adrian


---
  grubby.c |   89 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1 file changed, 89 insertions(+)

diff --git a/grubby.c b/grubby.c
index fe8317d..71edce7 100644
--- a/grubby.c
+++ b/grubby.c
@@ -124,11 +124,100 @@ struct keywordTypes {
  };

  struct configFileInfo;
+struct grubConfig;

  typedef const char *(*findConfigFunc)(struct configFileInfo *);
  typedef const int (*writeLineFunc)(struct configFileInfo *,
  				struct singleLine *line);

+static const char *grubFindConfig(struct configFileInfo *cfi);
+static const char *grub2FindConfig(struct configFileInfo *cfi);
+static char *grub2ExtractTitle(struct singleLine * line);
+static int argMatch(const char * one, const char * two);
+static int sizeOfSingleLine(struct singleLine * line);
+static void removeLine(struct singleEntry * entry, struct singleLine * line);
+static void printEntry(struct singleEntry * entry);
+static void notSuitablePrintf(struct singleEntry * entry, const char *fmt, ...);
+static char * findBootPrefix(void);
+
+static int suitableImage(struct singleEntry * entry,
+                         const char * bootPrefix,
+                         int skipRemoved,
+                         int flags);
+
+static void markRemovedImage(struct grubConfig * cfg,
+                             const char * image,
+                             const char * prefix);
+
+static void setFallbackImage(struct grubConfig * config,
+                             int hasNew);
+
+static void setDefaultImage(struct grubConfig * config,
+                            int hasNew,
+                            const char * defaultKernelPath,
+                            int newIsDefault,
+                            const char * prefix,
+                            int flags);
+
+static int updateActualImage(struct grubConfig * cfg,
+                             const char * image,
+                             const char * prefix,
+                             const char * addArgs,
+                             const char * removeArgs,
+                             int multibootArgs);
+
+static int updateImage(struct grubConfig * cfg,
+                       const char * image,
+                       const char * prefix,
+                       const char * addArgs,
+                       const char * removeArgs,
+                       const char * addMBArgs,
+                       const char * removeMBArgs);
+
+static int updateInitrd(struct grubConfig * cfg,
+                        const char * image,
+                        const char * prefix,
+                        const char * initrd);
+
+static struct singleEntry * findTemplate(struct grubConfig * cfg,
+                                         const char * prefix,
+                                         int * indexPtr,
+                                         int skipRemoved,
+                                         int flags);
+
+static int addNewKernel(struct grubConfig * config,
+                        struct singleEntry * template,
+                        const char * prefix,
+                        char * newKernelPath,
+                        char * newKernelTitle,
+                        char * newKernelArgs,
+                        char * newKernelInitrd,
+                        char ** extraInitrds,
+                        int extraInitrdCount,
+                        char * newMBKernel,
+                        char * newMBKernelArgs);
+
+static int checkDeviceBootloader(const char * device,
+                                 const unsigned char * boot);
+
+static int checkForLilo(struct grubConfig * config);
+static int checkForGrub(struct grubConfig * config);
+static int checkForGrub2(struct grubConfig * config);
+static int checkLiloOnRaid(char * mdDev,
+                           const unsigned char * boot);
+
+static void displayEntry(struct singleEntry * entry,
+                         const char * prefix,
+                         int index);
+
+static int displayInfo(struct grubConfig * config,
+                       char * kernel,
+                       const char * prefix);
+
+static void dumpSysconfigGrub(void);
+static int parseSysconfigGrub(int * lbaPtr,
+                              char ** bootPtr);
+
  struct configFileInfo {
      char * defaultConfig;
      findConfigFunc findConfig;




--
        Peter

Computers don't make errors.  What they do, they do on purpose.
		-- Dale

01234567890123456789012345678901234567890123456789012345678901234567890123456789


_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list



[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux