Whamcloud - gitweb
Read in /etc/e2fsck.conf configuration file at startup
authorTheodore Ts'o <tytso@mit.edu>
Sat, 31 Dec 2005 05:00:10 +0000 (00:00 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 31 Dec 2005 05:00:10 +0000 (00:00 -0500)
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
e2fsck/ChangeLog
e2fsck/e2fsck.c
e2fsck/e2fsck.h
e2fsck/unix.c

index 3e7d76d..9b9b8be 100644 (file)
@@ -1,5 +1,9 @@
 2005-12-30  Theodore Ts'o  <tytso@mit.edu>
 
+       * e2fsck.c (e2fsck_free_context), unix.c (PRS), e2fsck.h: Use
+               the profile library to read in the /etc/e2fsck.conf file
+               at startup.     
+
        * profile.c, profile.h, prof_err.et: Add the profile library code
                to e2fsck.  The profile library was originally written by
                Theodore Ts'o in 1995 for use in the MIT Kerberos v5
index 7d2ccf6..2ba72c8 100644 (file)
@@ -165,6 +165,9 @@ void e2fsck_free_context(e2fsck_t ctx)
        e2fsck_reset_context(ctx);
        if (ctx->blkid)
                blkid_put_cache(ctx->blkid);
+
+       if (ctx->profile)
+               profile_release(ctx->profile);
                        
        ext2fs_free_mem(&ctx);
 }
index 898b9a3..be7899f 100644 (file)
@@ -33,6 +33,9 @@
 #include "blkid/blkid.h"
 #endif
 
+#include "profile.h"
+#include "prof_err.h"
+
 #ifdef ENABLE_NLS
 #include <libintl.h>
 #include <locale.h>
@@ -326,6 +329,8 @@ struct e2fsck_struct {
 
        int ext_attr_ver;
 
+       profile_t       profile;
+
        /*
         * For the use of callers of the e2fsck functions; not used by
         * e2fsck functions themselves.
index 63d355e..024e434 100644 (file)
@@ -548,6 +548,7 @@ static void parse_extended_opts(e2fsck_t ctx, const char *opts)
        }
 }      
 
+static const char *config_fn[] = { "/etc/e2fsck.conf", 0 };
 
 static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx)
 {
@@ -580,6 +581,7 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx)
        memset(bar, '=', sizeof(bar)-1);
        memset(spaces, ' ', sizeof(spaces)-1);
        initialize_ext2_error_table();
+       initialize_prof_error_table();
        blkid_get_cache(&ctx->blkid, NULL);
        
        if (argc && *argv)
@@ -731,7 +733,9 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx)
        }
        if (extended_opts)
                parse_extended_opts(ctx, extended_opts);
-       
+
+       profile_init(config_fn, &ctx->profile);
+
        if (flush) {
                fd = open(ctx->filesystem_name, O_RDONLY, 0);
                if (fd < 0) {