]> granicus.if.org Git - postgresql/commitdiff
Rename pg_upgrade 'log' to 'log_opts', to avoid platform naming conflict.
authorBruce Momjian <bruce@momjian.us>
Wed, 20 Oct 2010 02:31:17 +0000 (02:31 +0000)
committerBruce Momjian <bruce@momjian.us>
Wed, 20 Oct 2010 02:31:17 +0000 (02:31 +0000)
contrib/pg_upgrade/check.c
contrib/pg_upgrade/controldata.c
contrib/pg_upgrade/info.c
contrib/pg_upgrade/option.c
contrib/pg_upgrade/pg_upgrade.c
contrib/pg_upgrade/pg_upgrade.h
contrib/pg_upgrade/server.c
contrib/pg_upgrade/util.c

index 3bae3d5aa083ec29734b7870c8373325a01a43a4..cb4d17635ea984df0958dcfa137dce96c21cf8b7 100644 (file)
@@ -160,7 +160,7 @@ issue_warnings(char *sequence_script_file_name)
                                          "--no-psqlrc --port %d --username \"%s\" "
                                          "-f \"%s\" --dbname template1 >> \"%s\"" SYSTEMQUOTE,
                                          new_cluster.bindir, new_cluster.port, os_info.user,
-                                         sequence_script_file_name, log.filename);
+                                         sequence_script_file_name, log_opts.filename);
                        unlink(sequence_script_file_name);
                        check_ok();
                }
index 3dc9e64b6220432bde770773f80bbaaa99c238b6..bfb1ed0ec8c9b9d41b84fc0cb380e07f1eff929a 100644 (file)
@@ -126,8 +126,8 @@ get_control_data(ClusterInfo *cluster, bool live_check)
        /* we have the result of cmd in "output". so parse it line by line now */
        while (fgets(bufin, sizeof(bufin), output))
        {
-               if (log.debug)
-                       fputs(bufin, log.debug_fd);
+               if (log_opts.debug)
+                       fputs(bufin, log_opts.debug_fd);
 
 #ifdef WIN32
 
index 281d0a7ab4792203017189dfbee4e0c5952a8f94..257f5a8ee3f35e7b2c7f9846eb0aafc44304efb2 100644 (file)
@@ -192,7 +192,7 @@ map_rel_by_id(Oid oldid, Oid newid,
 void
 print_maps(FileNameMap *maps, int n, const char *dbName)
 {
-       if (log.debug)
+       if (log_opts.debug)
        {
                int                     mapnum;
 
@@ -277,7 +277,7 @@ get_db_and_rel_infos(DbInfoArr *db_arr, Cluster whichCluster)
                get_rel_infos(&db_arr->dbs[dbnum],
                                          &db_arr->dbs[dbnum].rel_arr, whichCluster);
 
-       if (log.debug)
+       if (log_opts.debug)
                dbarr_print(db_arr, whichCluster);
 }
 
index 1f4c55ac7a74e9221893f5f0901d676fbb09e070..cf2f0a4386fb1cf7b4c24c5c1c8aff50c5018ebb 100644 (file)
@@ -119,11 +119,11 @@ parseCommandLine(int argc, char *argv[])
 
                        case 'g':
                                pg_log(PG_REPORT, "Running in debug mode\n");
-                               log.debug = true;
+                               log_opts.debug = true;
                                break;
 
                        case 'G':
-                               if ((log.debug_fd = fopen(optarg, "w")) == NULL)
+                               if ((log_opts.debug_fd = fopen(optarg, "w")) == NULL)
                                {
                                        pg_log(PG_FATAL, "cannot open debug file\n");
                                        exit_nicely(false);
@@ -135,7 +135,7 @@ parseCommandLine(int argc, char *argv[])
                                break;
 
                        case 'l':
-                               log.filename = pg_strdup(optarg);
+                               log_opts.filename = pg_strdup(optarg);
                                break;
 
                        case 'p':
@@ -161,7 +161,7 @@ parseCommandLine(int argc, char *argv[])
 
                        case 'v':
                                pg_log(PG_REPORT, "Running in verbose mode\n");
-                               log.verbose = true;
+                               log_opts.verbose = true;
                                break;
 
                        default:
@@ -172,7 +172,7 @@ parseCommandLine(int argc, char *argv[])
                }
        }
 
-       if (log.filename != NULL)
+       if (log_opts.filename != NULL)
        {
                /*
                 * We must use append mode so output generated by child processes via
@@ -180,20 +180,20 @@ parseCommandLine(int argc, char *argv[])
                 * start.
                 */
                /* truncate */
-               if ((log.fd = fopen(log.filename, "w")) == NULL)
-                       pg_log(PG_FATAL, "Cannot write to log file %s\n", log.filename);
-               fclose(log.fd);
-               if ((log.fd = fopen(log.filename, "a")) == NULL)
-                       pg_log(PG_FATAL, "Cannot write to log file %s\n", log.filename);
+               if ((log_opts.fd = fopen(log_opts.filename, "w")) == NULL)
+                       pg_log(PG_FATAL, "Cannot write to log file %s\n", log_opts.filename);
+               fclose(log_opts.fd);
+               if ((log_opts.fd = fopen(log_opts.filename, "a")) == NULL)
+                       pg_log(PG_FATAL, "Cannot write to log file %s\n", log_opts.filename);
        }
        else
-               log.filename = strdup(DEVNULL);
+               log_opts.filename = strdup(DEVNULL);
 
        /* if no debug file name, output to the terminal */
-       if (log.debug && !log.debug_fd)
+       if (log_opts.debug && !log_opts.debug_fd)
        {
-               log.debug_fd = fopen(DEVTTY, "w");
-               if (!log.debug_fd)
+               log_opts.debug_fd = fopen(DEVTTY, "w");
+               if (!log_opts.debug_fd)
                        pg_log(PG_FATAL, "Cannot write to terminal\n");
        }
 
index c140f6521e9527624f793bf0429712c3195605d0..d706fc0b03e08f56a57036c9153c999ec09c08c6 100644 (file)
@@ -162,7 +162,7 @@ prepare_new_cluster(void)
        exec_prog(true,
                          SYSTEMQUOTE "\"%s/vacuumdb\" --port %d --username \"%s\" "
                          "--all --analyze >> %s 2>&1" SYSTEMQUOTE,
-                  new_cluster.bindir, new_cluster.port, os_info.user, log.filename);
+                  new_cluster.bindir, new_cluster.port, os_info.user, log_opts.filename);
        check_ok();
 
        /*
@@ -175,7 +175,7 @@ prepare_new_cluster(void)
        exec_prog(true,
                          SYSTEMQUOTE "\"%s/vacuumdb\" --port %d --username \"%s\" "
                          "--all --freeze >> %s 2>&1" SYSTEMQUOTE,
-                  new_cluster.bindir, new_cluster.port, os_info.user, log.filename);
+                  new_cluster.bindir, new_cluster.port, os_info.user, log_opts.filename);
        check_ok();
 
        get_pg_database_relfilenode(CLUSTER_NEW);
@@ -207,7 +207,7 @@ prepare_new_databases(void)
                          "--no-psqlrc --port %d --username \"%s\" "
                          "-f \"%s/%s\" --dbname template1 >> \"%s\"" SYSTEMQUOTE,
                          new_cluster.bindir, new_cluster.port, os_info.user, os_info.cwd,
-                         GLOBALS_DUMP_FILE, log.filename);
+                         GLOBALS_DUMP_FILE, log_opts.filename);
        check_ok();
 
        get_db_and_rel_infos(&new_cluster.dbarr, CLUSTER_NEW);
@@ -230,7 +230,7 @@ create_new_objects(void)
                          "--no-psqlrc --port %d --username \"%s\" "
                          "-f \"%s/%s\" --dbname template1 >> \"%s\"" SYSTEMQUOTE,
                          new_cluster.bindir, new_cluster.port, os_info.user, os_info.cwd,
-                         DB_DUMP_FILE, log.filename);
+                         DB_DUMP_FILE, log_opts.filename);
        check_ok();
 
        /* regenerate now that we have db schemas */
@@ -282,7 +282,7 @@ copy_clog_xlog_xid(void)
        exec_prog(true, SYSTEMQUOTE "\"%s/pg_resetxlog\" -l %u,%u,%u \"%s\" >> \"%s\" 2>&1" SYSTEMQUOTE,
                          new_cluster.bindir, old_cluster.controldata.chkpnt_tli,
                        old_cluster.controldata.logid, old_cluster.controldata.nxtlogseg,
-                         new_cluster.pgdata, log.filename);
+                         new_cluster.pgdata, log_opts.filename);
        check_ok();
 }
 
@@ -384,7 +384,7 @@ cleanup(void)
 
        dbarr_free(&old_cluster.dbarr);
        dbarr_free(&new_cluster.dbarr);
-       pg_free(log.filename);
+       pg_free(log_opts.filename);
        pg_free(os_info.user);
        pg_free(old_cluster.major_version_str);
        pg_free(new_cluster.major_version_str);
@@ -397,14 +397,14 @@ cleanup(void)
        pg_free(old_cluster.tablespace_suffix);
        pg_free(new_cluster.tablespace_suffix);
 
-       if (log.fd != NULL)
+       if (log_opts.fd != NULL)
        {
-               fclose(log.fd);
-               log.fd = NULL;
+               fclose(log_opts.fd);
+               log_opts.fd = NULL;
        }
 
-       if (log.debug_fd)
-               fclose(log.debug_fd);
+       if (log_opts.debug_fd)
+               fclose(log_opts.debug_fd);
 
        snprintf(filename, sizeof(filename), "%s/%s", os_info.cwd, ALL_DUMP_FILE);
        unlink(filename);
index 727ee5563b56877edea2b4337361befe3559d403..e40f58d3e50574d59e8ba20742298b5a9767f213 100644 (file)
@@ -197,7 +197,7 @@ typedef struct
 
 
 /*
- *     Log
+ *     LogOpts
 */
 typedef struct
 {
@@ -206,7 +206,7 @@ typedef struct
        bool            debug;                  /* TRUE -> log more information */
        FILE       *debug_fd;           /* debug-level log FILE */
        bool            verbose;                /* TRUE -> be verbose in messages */
-} Log;
+} LogOpts;
 
 
 /*
@@ -241,7 +241,7 @@ typedef struct
 /*
  * Global variables
  */
-extern Log     log;
+extern LogOpts log_opts;
 extern UserOpts user_opts;
 extern ClusterInfo old_cluster,
                        new_cluster;
index 95c84670f89e2caf4033fac393a5cbbdfe958969..3f6cb641e7b2fb4ce76b2eeb30426d2711535b05 100644 (file)
@@ -185,7 +185,7 @@ start_postmaster(Cluster whichCluster, bool quiet)
                         "start >> \"%s\" 2>&1" SYSTEMQUOTE,
                         bindir,
 #ifndef WIN32
-                        log.filename, datadir, port, log.filename);
+                        log_opts.filename, datadir, port, log_opts.filename);
 #else
                         DEVNULL, datadir, port, DEVNULL);
 #endif
@@ -229,7 +229,7 @@ stop_postmaster(bool fast, bool quiet)
                         "\"%s\" 2>&1" SYSTEMQUOTE,
                         bindir,
 #ifndef WIN32
-                        log.filename, datadir, fast ? "-m fast" : "", log.filename);
+                        log_opts.filename, datadir, fast ? "-m fast" : "", log_opts.filename);
 #else
                         DEVNULL, datadir, fast ? "-m fast" : "", DEVNULL);
 #endif
index a5ad436ddc7a77921f817e2c1ebc7fc5a80d3b9d..da6dca0e2c8e0535a49cfd154d3c9ccaa3f050cc 100644 (file)
@@ -12,7 +12,7 @@
 #include <signal.h>
 
 
-Log                    log;
+LogOpts                        log_opts;
 
 /*
  * report_status()
@@ -75,19 +75,19 @@ pg_log(eLogType type, char *fmt,...)
        vsnprintf(message, sizeof(message), fmt, args);
        va_end(args);
 
-       if (log.fd != NULL)
+       if (log_opts.fd != NULL)
        {
-               fwrite(message, strlen(message), 1, log.fd);
+               fwrite(message, strlen(message), 1, log_opts.fd);
                /* if we are using OVERWRITE_MESSAGE, add newline */
                if (strchr(message, '\r') != NULL)
-                       fwrite("\n", 1, 1, log.fd);
-               fflush(log.fd);
+                       fwrite("\n", 1, 1, log_opts.fd);
+               fflush(log_opts.fd);
        }
 
        switch (type)
        {
                case PG_INFO:
-                       if (log.verbose)
+                       if (log_opts.verbose)
                                printf("%s", _(message));
                        break;
 
@@ -103,8 +103,8 @@ pg_log(eLogType type, char *fmt,...)
                        break;
 
                case PG_DEBUG:
-                       if (log.debug)
-                               fprintf(log.debug_fd, "%s\n", _(message));
+                       if (log_opts.debug)
+                               fprintf(log_opts.debug_fd, "%s\n", _(message));
                        break;
 
                default:
@@ -189,13 +189,13 @@ exit_nicely(bool need_cleanup)
 {
        stop_postmaster(true, true);
 
-       pg_free(log.filename);
+       pg_free(log_opts.filename);
 
-       if (log.fd)
-               fclose(log.fd);
+       if (log_opts.fd)
+               fclose(log_opts.fd);
 
-       if (log.debug_fd)
-               fclose(log.debug_fd);
+       if (log_opts.debug_fd)
+               fclose(log_opts.debug_fd);
 
        /* terminate any running instance of postmaster */
        if (os_info.postmasterPID != 0)