Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/perfused - remove dup included files
details: https://anonhg.NetBSD.org/src/rev/9fc2669b9611
branches: trunk
changeset: 773323:9fc2669b9611
user: christos <christos%NetBSD.org@localhost>
date: Mon Jan 30 22:49:03 2012 +0000
description:
- remove dup included files
- use intptr_t instead of long where appropriate
- use perfused_ instead of perfuse_ for our own functions.
- more static
Fixes namespace collision of perfuse_mount with this and libperfuse.
diffstat:
usr.sbin/perfused/debug.c | 4 +-
usr.sbin/perfused/msg.c | 51 +++++++++++++++++++++----------------------
usr.sbin/perfused/perfused.c | 41 +++++++++++++++++------------------
usr.sbin/perfused/perfused.h | 38 ++++++++++++++++----------------
4 files changed, 66 insertions(+), 68 deletions(-)
diffs (truncated from 426 to 300 lines):
diff -r d94f17f84ea6 -r 9fc2669b9611 usr.sbin/perfused/debug.c
--- a/usr.sbin/perfused/debug.c Mon Jan 30 21:47:24 2012 +0000
+++ b/usr.sbin/perfused/debug.c Mon Jan 30 22:49:03 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: debug.c,v 1.4 2011/08/30 20:17:00 joerg Exp $ */
+/* $NetBSD: debug.c,v 1.5 2012/01/30 22:49:03 christos Exp $ */
/*-
* Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
@@ -35,7 +35,7 @@
#ifdef PERFUSE_DEBUG
void
-perfuse_hexdump(const char *addr, size_t len)
+perfused_hexdump(const char *addr, size_t len)
{
unsigned int i, j, k;
diff -r d94f17f84ea6 -r 9fc2669b9611 usr.sbin/perfused/msg.c
--- a/usr.sbin/perfused/msg.c Mon Jan 30 21:47:24 2012 +0000
+++ b/usr.sbin/perfused/msg.c Mon Jan 30 22:49:03 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: msg.c,v 1.17 2011/10/30 05:17:41 manu Exp $ */
+/* $NetBSD: msg.c,v 1.18 2012/01/30 22:49:03 christos Exp $ */
/*-
* Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
@@ -41,7 +41,6 @@
#include <sys/un.h>
#include <machine/vmparam.h>
-#include "../../lib/libperfuse/perfuse_if.h"
#include "perfused.h"
static int xchg_pb_inloop(struct puffs_usermount *a, struct puffs_framebuf *,
@@ -50,7 +49,7 @@
int, enum perfuse_xchg_pb_reply);
int
-perfuse_open_sock(void)
+perfused_open_sock(void)
{
int s;
struct sockaddr_un sun;
@@ -111,7 +110,7 @@
void *
-perfuse_recv_early(int fd, struct sockcred *sockcred, size_t sockcred_len)
+perfused_recv_early(int fd, struct sockcred *sockcred, size_t sockcred_len)
{
struct fuse_out_header foh;
size_t len;
@@ -166,7 +165,7 @@
perfuse_msg_t *
-perfuse_new_pb (struct puffs_usermount *pu, puffs_cookie_t opc, int opcode,
+perfused_new_pb (struct puffs_usermount *pu, puffs_cookie_t opc, int opcode,
size_t payload_len, const struct puffs_cred *cred)
{
struct puffs_framebuf *pb;
@@ -240,7 +239,7 @@
done = 0;
while (done == 0) {
- if ((error = perfuse_writeframe(pu, pb, fd, &done)) != 0)
+ if ((error = perfused_writeframe(pu, pb, fd, &done)) != 0)
return error;
}
@@ -253,7 +252,7 @@
done = 0;
while (done == 0) {
- if ((error = perfuse_readframe(pu, pb, fd, &done)) != 0)
+ if ((error = perfused_readframe(pu, pb, fd, &done)) != 0)
return error;
}
@@ -278,7 +277,7 @@
}
int
-perfuse_xchg_pb(struct puffs_usermount *pu, perfuse_msg_t *pm,
+perfused_xchg_pb(struct puffs_usermount *pu, perfuse_msg_t *pm,
size_t expected_len, enum perfuse_xchg_pb_reply reply)
{
struct puffs_framebuf *pb = (struct puffs_framebuf *)(void *)pm;
@@ -292,7 +291,7 @@
uint64_t unique_in;
uint64_t unique_out;
- fih = perfuse_get_inhdr(pm);
+ fih = perfused_get_inhdr(pm);
unique_in = fih->unique;
nodeid = fih->nodeid;
opcode = fih->opcode;
@@ -303,11 +302,11 @@
unique_in, nodeid, perfuse_opname(opcode), opcode);
if (perfuse_diagflags & PDF_DUMP)
- perfuse_hexdump((char *)fih, fih->len);
+ perfused_hexdump((char *)fih, fih->len);
#endif /* PERFUSE_DEBUG */
- fd = (int)(long)perfuse_getspecific(pu);
+ fd = (int)(intptr_t)perfuse_getspecific(pu);
if (perfuse_inloop(pu))
error = xchg_pb_inloop(pu, pb, fd, reply);
@@ -320,7 +319,7 @@
if (reply == no_reply)
return 0;
- foh = perfuse_get_outhdr((perfuse_msg_t *)(void *)pb);
+ foh = perfused_get_outhdr((perfuse_msg_t *)(void *)pb);
#ifdef PERFUSE_DEBUG
unique_out = foh->unique;
@@ -331,7 +330,7 @@
perfuse_opname(opcode), opcode, foh->error);
if (perfuse_diagflags & PDF_DUMP)
- perfuse_hexdump((char *)foh, foh->len);
+ perfused_hexdump((char *)foh, foh->len);
if (unique_in != unique_out) {
printf("%s: packet mismatch unique %"PRId64" vs %"PRId64"\n",
@@ -365,7 +364,7 @@
struct fuse_in_header *
-perfuse_get_inhdr(perfuse_msg_t *pm)
+perfused_get_inhdr(perfuse_msg_t *pm)
{
struct puffs_framebuf *pb;
struct fuse_in_header *fih;
@@ -385,7 +384,7 @@
}
struct fuse_out_header *
-perfuse_get_outhdr(perfuse_msg_t *pm)
+perfused_get_outhdr(perfuse_msg_t *pm)
{
struct puffs_framebuf *pb;
struct fuse_out_header *foh;
@@ -405,7 +404,7 @@
}
char *
-perfuse_get_inpayload(perfuse_msg_t *pm)
+perfused_get_inpayload(perfuse_msg_t *pm)
{
struct puffs_framebuf *pb;
struct fuse_in_header *fih;
@@ -432,7 +431,7 @@
}
char *
-perfuse_get_outpayload(perfuse_msg_t *pm)
+perfused_get_outpayload(perfuse_msg_t *pm)
{
struct puffs_framebuf *pb;
struct fuse_out_header *foh;
@@ -473,7 +472,7 @@
/* ARGSUSED0 */
int
-perfuse_readframe(struct puffs_usermount *pu, struct puffs_framebuf *pufbuf,
+perfused_readframe(struct puffs_usermount *pu, struct puffs_framebuf *pufbuf,
int fd, int *done)
{
struct fuse_out_header foh;
@@ -563,7 +562,7 @@
/* ARGSUSED0 */
int
-perfuse_writeframe(struct puffs_usermount *pu, struct puffs_framebuf *pufbuf,
+perfused_writeframe(struct puffs_usermount *pu, struct puffs_framebuf *pufbuf,
int fd, int *done)
{
size_t len;
@@ -609,7 +608,7 @@
/* ARGSUSED0 */
int
-perfuse_cmpframe(struct puffs_usermount *pu, struct puffs_framebuf *pb1,
+perfused_cmpframe(struct puffs_usermount *pu, struct puffs_framebuf *pb1,
struct puffs_framebuf *pb2, int *match)
{
struct fuse_in_header *fih;
@@ -631,7 +630,7 @@
/* ARGSUSED0 */
void
-perfuse_gotframe(struct puffs_usermount *pu, struct puffs_framebuf *pb)
+perfused_gotframe(struct puffs_usermount *pu, struct puffs_framebuf *pb)
{
struct fuse_out_header *foh;
size_t len;
@@ -642,16 +641,16 @@
DWARNX("Unexpected frame: unique = %"PRId64", error = %d",
foh->unique, foh->error);
#ifdef PERFUSE_DEBUG
- perfuse_hexdump((char *)(void *)foh, foh->len);
+ perfused_hexdump((char *)(void *)foh, foh->len);
#endif
return;
}
void
-perfuse_fdnotify(struct puffs_usermount *pu, int fd, int what)
+perfused_fdnotify(struct puffs_usermount *pu, int fd, int what)
{
- if (fd != (int)(long)perfuse_getspecific(pu))
+ if (fd != (int)(intptr_t)perfuse_getspecific(pu))
DERRX(EX_SOFTWARE, "%s: unexpected notification for fd = %d",
__func__, fd);
@@ -672,11 +671,11 @@
}
void
-perfuse_umount(struct puffs_usermount *pu)
+perfused_umount(struct puffs_usermount *pu)
{
int fd;
- fd = (int)(long)perfuse_getspecific(pu);
+ fd = (int)(intptr_t)perfuse_getspecific(pu);
if (shutdown(fd, SHUT_RDWR) != 0)
DWARN("shutdown() failed");
diff -r d94f17f84ea6 -r 9fc2669b9611 usr.sbin/perfused/perfused.c
--- a/usr.sbin/perfused/perfused.c Mon Jan 30 21:47:24 2012 +0000
+++ b/usr.sbin/perfused/perfused.c Mon Jan 30 22:49:03 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: perfused.c,v 1.19 2012/01/29 06:22:02 manu Exp $ */
+/* $NetBSD: perfused.c,v 1.20 2012/01/30 22:49:03 christos Exp $ */
/*-
* Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
@@ -47,7 +47,6 @@
#include <sys/un.h>
#include <machine/vmparam.h>
-#include "../../lib/libperfuse/perfuse_if.h"
#include "perfused.h"
/*
@@ -55,8 +54,8 @@
* we ever mount multiple filesystems in a single perfused,
* but it is not sure we will ever want to do that.
*/
-struct puffs_usermount *perfuse_mount = NULL;
-FILE *perfuse_trace = NULL;
+static struct puffs_usermount *perfused_mount = NULL;
+static FILE *perfused_trace = NULL;
static int access_mount(const char *, uid_t, int);
static void new_mount(int, int);
@@ -114,7 +113,7 @@
char *sock = NULL;
pmo = (struct perfuse_mount_out *)
- perfuse_recv_early(fd, &cred, sizeof(cred));
+ perfused_recv_early(fd, &cred, sizeof(cred));
if (pmo == NULL) {
if (shutdown(fd, SHUT_RDWR) != 0)
@@ -246,24 +245,24 @@
/*
* Initialize libperfuse, which will initialize libpuffs
*/
- pc.pc_new_msg = perfuse_new_pb;
- pc.pc_xchg_msg = perfuse_xchg_pb;
+ pc.pc_new_msg = perfused_new_pb;
+ pc.pc_xchg_msg = perfused_xchg_pb;
pc.pc_destroy_msg = (perfuse_destroy_msg_fn)puffs_framebuf_destroy;
- pc.pc_get_inhdr = perfuse_get_inhdr;
- pc.pc_get_inpayload = perfuse_get_inpayload;
- pc.pc_get_outhdr = perfuse_get_outhdr;
- pc.pc_get_outpayload = perfuse_get_outpayload;
- pc.pc_umount = perfuse_umount;
+ pc.pc_get_inhdr = perfused_get_inhdr;
+ pc.pc_get_inpayload = perfused_get_inpayload;
+ pc.pc_get_outhdr = perfused_get_outhdr;
+ pc.pc_get_outpayload = perfused_get_outpayload;
+ pc.pc_umount = perfused_umount;
pu = perfuse_init(&pc, &pmi);
- puffs_framev_init(pu, perfuse_readframe, perfuse_writeframe,
- perfuse_cmpframe, perfuse_gotframe, perfuse_fdnotify);
+ puffs_framev_init(pu, perfused_readframe, perfused_writeframe,
+ perfused_cmpframe, perfused_gotframe, perfused_fdnotify);
Home |
Main Index |
Thread Index |
Old Index