Commit 9787e415 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Namespace cleanup: vpf_* VPF_*

parent 0bf86e4b
......@@ -354,7 +354,7 @@ main(int argc, char * const *argv)
const char *T_arg = NULL;
char *p, *vcl = NULL;
struct cli cli[1];
struct pidfh *pfh = NULL;
struct vpf_fh *pfh = NULL;
char *dirname;
/*
......@@ -590,7 +590,7 @@ main(int argc, char * const *argv)
}
/* XXX: should this be relative to the -n arg ? */
if (P_arg && (pfh = vpf_open(P_arg, 0644, NULL)) == NULL) {
if (P_arg && (pfh = VPF_Open(P_arg, 0644, NULL)) == NULL) {
perror(P_arg);
exit(1);
}
......@@ -620,7 +620,7 @@ main(int argc, char * const *argv)
mgt_SHM_Pid();
if (pfh != NULL && vpf_write(pfh))
if (pfh != NULL && VPF_Write(pfh))
fprintf(stderr, "NOTE: Could not write PID file\n");
if (d_flag)
......@@ -647,6 +647,6 @@ main(int argc, char * const *argv)
MGT_Run();
if (pfh != NULL)
(void)vpf_remove(pfh);
(void)VPF_Remove(pfh);
exit(exit_status);
}
......@@ -277,7 +277,7 @@ main(int argc, char * const *argv)
int a_flag = 0, D_flag = 0, O_flag = 0, u_flag = 0, m_flag = 0;
const char *P_arg = NULL;
const char *w_arg = NULL;
struct pidfh *pfh = NULL;
struct vpf_fh *pfh = NULL;
struct VSM_data *vd;
vd = VSM_New();
......@@ -334,7 +334,7 @@ main(int argc, char * const *argv)
if (VSL_Open(vd, 1))
exit(1);
if (P_arg && (pfh = vpf_open(P_arg, 0644, NULL)) == NULL) {
if (P_arg && (pfh = VPF_Open(P_arg, 0644, NULL)) == NULL) {
perror(P_arg);
exit(1);
}
......@@ -342,12 +342,12 @@ main(int argc, char * const *argv)
if (D_flag && varnish_daemon(0, 0) == -1) {
perror("daemon()");
if (pfh != NULL)
vpf_remove(pfh);
VPF_Remove(pfh);
exit(1);
}
if (pfh != NULL)
vpf_write(pfh);
VPF_Write(pfh);
if (w_arg != NULL)
do_write(vd, w_arg, a_flag);
......@@ -366,6 +366,6 @@ main(int argc, char * const *argv)
}
if (pfh != NULL)
vpf_remove(pfh);
VPF_Remove(pfh);
exit(0);
}
......@@ -722,7 +722,7 @@ main(int argc, char *argv[])
int a_flag = 0, D_flag = 0, format_flag = 0;
const char *P_arg = NULL;
const char *w_arg = NULL;
struct pidfh *pfh = NULL;
struct vpf_fh *pfh = NULL;
FILE *of;
format = "%h %l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-agent}i\"";
......@@ -791,7 +791,7 @@ main(int argc, char *argv[])
if (VSL_Open(vd, 1))
exit(1);
if (P_arg && (pfh = vpf_open(P_arg, 0644, NULL)) == NULL) {
if (P_arg && (pfh = VPF_Open(P_arg, 0644, NULL)) == NULL) {
perror(P_arg);
exit(1);
}
......@@ -799,12 +799,12 @@ main(int argc, char *argv[])
if (D_flag && varnish_daemon(0, 0) == -1) {
perror("daemon()");
if (pfh != NULL)
vpf_remove(pfh);
VPF_Remove(pfh);
exit(1);
}
if (pfh != NULL)
vpf_write(pfh);
VPF_Write(pfh);
if (w_arg) {
of = open_log(w_arg, a_flag);
......
......@@ -30,11 +30,11 @@
#ifndef VPF_H_INCLUDED
#define VPF_H_INCLUDED
struct pidfh;
struct vpf_fh;
struct pidfh *vpf_open(const char *path, mode_t mode, pid_t *pidptr);
int vpf_write(struct pidfh *pfh);
int vpf_close(struct pidfh *pfh);
int vpf_remove(struct pidfh *pfh);
struct vpf_fh *VPF_Open(const char *path, mode_t mode, pid_t *pidptr);
int VPF_Write(struct vpf_fh *pfh);
int VPF_Close(struct vpf_fh *pfh);
int VPF_Remove(struct vpf_fh *pfh);
#endif
......@@ -43,17 +43,17 @@
#include "flopen.h"
#include "vpf.h"
struct pidfh {
struct vpf_fh {
int pf_fd;
char pf_path[MAXPATHLEN + 1];
dev_t pf_dev;
ino_t pf_ino;
};
static int _vpf_remove(struct pidfh *pfh, int freeit);
static int _VPF_Remove(struct vpf_fh *pfh, int freeit);
static int
vpf_verify(const struct pidfh *pfh)
vpf_verify(const struct vpf_fh *pfh)
{
struct stat sb;
......@@ -93,10 +93,10 @@ vpf_read(const char *path, pid_t *pidptr)
return (0);
}
struct pidfh *
vpf_open(const char *path, mode_t mode, pid_t *pidptr)
struct vpf_fh *
VPF_Open(const char *path, mode_t mode, pid_t *pidptr)
{
struct pidfh *pfh;
struct vpf_fh *pfh;
struct stat sb;
int error, fd, len;
......@@ -124,8 +124,8 @@ vpf_open(const char *path, mode_t mode, pid_t *pidptr)
/*
* Open the PID file and obtain exclusive lock.
* We truncate PID file here only to remove old PID immediatelly,
* PID file will be truncated again in vpf_write(), so
* vpf_write() can be called multiple times.
* PID file will be truncated again in VPF_Write(), so
* VPF_Write() can be called multiple times.
*/
fd = flopen(pfh->pf_path,
O_WRONLY | O_CREAT | O_TRUNC | O_NONBLOCK, mode);
......@@ -139,7 +139,7 @@ vpf_open(const char *path, mode_t mode, pid_t *pidptr)
return (NULL);
}
/*
* Remember file information, so in vpf_write() we are sure we write
* Remember file information, so in VPF_Write() we are sure we write
* to the proper descriptor.
*/
if (fstat(fd, &sb) == -1) {
......@@ -159,7 +159,7 @@ vpf_open(const char *path, mode_t mode, pid_t *pidptr)
}
int
vpf_write(struct pidfh *pfh)
VPF_Write(struct vpf_fh *pfh)
{
char pidstr[16];
int error, fd;
......@@ -178,11 +178,11 @@ vpf_write(struct pidfh *pfh)
fd = pfh->pf_fd;
/*
* Truncate PID file, so multiple calls of vpf_write() are allowed.
* Truncate PID file, so multiple calls of VPF_Write() are allowed.
*/
if (ftruncate(fd, 0) == -1) {
error = errno;
(void)_vpf_remove(pfh, 0);
(void)_VPF_Remove(pfh, 0);
errno = error;
return (-1);
}
......@@ -191,7 +191,7 @@ vpf_write(struct pidfh *pfh)
assert(error < sizeof pidstr);
if (pwrite(fd, pidstr, strlen(pidstr), 0) != (ssize_t)strlen(pidstr)) {
error = errno;
(void)_vpf_remove(pfh, 0);
(void)_VPF_Remove(pfh, 0);
errno = error;
return (-1);
}
......@@ -200,7 +200,7 @@ vpf_write(struct pidfh *pfh)
}
int
vpf_close(struct pidfh *pfh)
VPF_Close(struct vpf_fh *pfh)
{
int error;
......@@ -221,7 +221,7 @@ vpf_close(struct pidfh *pfh)
}
static int
_vpf_remove(struct pidfh *pfh, int freeit)
_VPF_Remove(struct vpf_fh *pfh, int freeit)
{
int error;
......@@ -249,8 +249,8 @@ _vpf_remove(struct pidfh *pfh, int freeit)
}
int
vpf_remove(struct pidfh *pfh)
VPF_Remove(struct vpf_fh *pfh)
{
return (_vpf_remove(pfh, 1));
return (_VPF_Remove(pfh, 1));
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment