googlefs: fix tracing, build with userlandfs

It is currently not working because Google has changed its HTML since
this was written.

I plan to switch to using https://html.duckduckgo.com instead, which
would be a lot easier to parse. However, this requires switching to
HTTPS and I don't think doing TLS in the kernel is a sane idea.

So I suggest using userlandfs instead.

Change-Id: Iaf1f27680bbf1cd98806047122cea1a208b35bf0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5493
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
This commit is contained in:
PulkoMandy 2022-07-21 22:11:39 +02:00 committed by Adrien Destugues
parent 2c08dd5bc5
commit d669317867
11 changed files with 106 additions and 361 deletions

View File

@ -1,12 +1,14 @@
SubDir HAIKU_TOP src add-ons kernel file_systems googlefs ;
UsePrivateKernelHeaders ;
local userlandFSTop = [ FDirName $(HAIKU_TOP) src add-ons kernel file_systems
userlandfs ] ;
local userlandFSIncludes = [ PrivateHeaders userlandfs ] ;
#SubDirCcFlags -DTRACK_FILENAME ;
#SubDirCcFlags -DDEBUG_GOOGLEFS=1 ;
SubDirCcFlags -D_IMPEXP_KERNEL= ;
KernelAddon googlefs :
Addon googlefs :
attrs.c
google_request.c
googlefs.c
@ -17,4 +19,5 @@ KernelAddon googlefs :
settings.c
string_utils.c
vnidpool.c
: libuserlandfs_haiku_kernel.so network
;

View File

@ -95,7 +95,7 @@ status_t google_request_process(struct google_request *req)
goto err_cnx;
sin.sin_port = htons(google_server_port);
err = http_connect(cnx, &sin);
dprintf("google_request: http_connect: error 0x%08" B_PRIx32 "\n", err);
fprintf(stderr, "google_request: http_connect: error 0x%08" B_PRIx32 "\n", err);
if (err)
goto err_cnx;
@ -112,16 +112,16 @@ status_t google_request_process(struct google_request *req)
sprintf(url+strlen(url), FMT_NUM, (unsigned int)max_results);
sprintf(url+strlen(url), FMT_Q, p);
dprintf("google_request: final URL: %s\n", url);
fprintf(stderr, "google_request: final URL: %s\n", url);
err = http_get(cnx, url);
dprintf("google_request: http_get: error 0x%08" B_PRIx32 "\n", err);
fprintf(stderr, "google_request: http_get: error 0x%08" B_PRIx32 "\n", err);
if (err < 0)
goto err_url2;
dprintf("google_request: http_get: HEADERS %ld:%s\n", cnx->headerslen, cnx->headers);
//dprintf("DATA: %d:%s\n", cnx->datalen, cnx->data);
fprintf(stderr, "google_request: http_get: HEADERS %ld:%s\n", cnx->headerslen, cnx->headers);
//fprintf(stderr, "DATA: %d:%s\n", cnx->datalen, cnx->data);
dprintf("google_request: buffer @ %p, len %ld\n", cnx->data, cnx->datalen);
fprintf(stderr, "google_request: buffer @ %p, len %ld\n", cnx->data, cnx->datalen);
{
int fd;
// debug output

View File

@ -28,14 +28,15 @@
/* just publish fake entries; for debugging */
//#define NO_SEARCH
#define PFS "googlefs: "
#define TRACE_GOOGLEFS
#ifdef TRACE_GOOGLEFS
# define TRACE(x) dprintf x
# define TRACE(x...) fprintf(stderr, PFS x)
#else
# define TRACE(x)
#endif
#define PFS "googlefs: "
/* needed to get /bin/df tell the mountpoint... */
#define ALLOW_DIR_OPEN
@ -88,7 +89,7 @@ static int googlefs_publish_static_entries(fs_volume *_volume)
//char ename[GOOGLEFS_NAME_LEN];
//char *p;
//int i;
TRACE((PFS"googlefs_publish_static_entries(%" B_PRId32 ")\n", ns->nsid));
TRACE("googlefs_publish_static_entries(%" B_PRId32 ")\n", ns->nsid);
if (!ns || !dir)
return EINVAL;
@ -113,7 +114,7 @@ static int googlefs_publish_static_entries(fs_volume *_volume)
/*
err:
TRACE((PFS"push_result_to_query: error 0x%08"B_PRIx32"\n", err));
TRACE("push_result_to_query: error 0x%08"B_PRIx32"\n", err);
return err;
*/
}
@ -124,7 +125,7 @@ static status_t googlefs_mount(fs_volume *_vol, const char *devname, uint32 flag
fs_nspace *ns;
fs_node *root;
int err;
TRACE((PFS "mount(%p, %s, 0x%08" B_PRIx32 ", %s, , )\n", _vol, devname, flags, parms));
TRACE("mount(%p, %s, 0x%08" B_PRIx32 ", %s, , )\n", _vol, devname, flags, parms);
/* only allow a single mount */
if (atomic_add(&refcount, 1))
@ -166,7 +167,7 @@ static status_t googlefs_mount(fs_volume *_vol, const char *devname, uint32 flag
fill_default_stat(&root->st, ns->nsid, ns->rootid, 0777 | S_IFDIR);
root->attrs_indirect = root_folder_attrs;
new_lock(&(root->l), "googlefs root dir");
TRACE((PFS "mount: root->l @ %p\n", &root->l));
TRACE("mount: root->l @ %p\n", &root->l);
_vol->private_volume = ns;
_vol->ops = &sGoogleFSVolumeOps;
@ -175,7 +176,7 @@ static status_t googlefs_mount(fs_volume *_vol, const char *devname, uint32 flag
err = publish_vnode(_vol, *vnid, root, &sGoogleFSVnodeOps, S_IFDIR, 0);
if (err == B_OK) {
googlefs_publish_static_entries(_vol);
TRACE((PFS "mount() OK, nspace@ %p, id %" B_PRId32 ", root@ %p, id %" B_PRId64 "\n", ns, ns->nsid, root, ns->rootid));
TRACE("mount() OK, nspace@ %p, id %" B_PRId32 ", root@ %p, id %" B_PRId64 "\n", ns, ns->nsid, root, ns->rootid);
return B_OK;
}
free_lock(&root->l);
@ -193,7 +194,7 @@ static status_t googlefs_unmount(fs_volume *_volume)
fs_nspace *ns = (fs_nspace *)_volume->private_volume;
status_t err;
struct fs_node *node;
TRACE((PFS "unmount(%" B_PRId32 ")\n", ns->nsid));
TRACE("unmount(%" B_PRId32 ")\n", ns->nsid);
err = LOCK(&ns->l);
if (err)
return err;
@ -225,7 +226,7 @@ static int compare_fs_node_by_vnid(fs_node *node, ino_t *id)
static int googlefs_free_vnode(fs_volume *_volume, fs_node *node)
{
fs_nspace *ns = (fs_nspace *)_volume->private_volume;
TRACE((PFS "%s(%" B_PRId32 ", %" B_PRId64 ")\n", __FUNCTION__, ns->nsid, node->vnid));
TRACE("%s(%" B_PRId32 ", %" B_PRId64 ")\n", __FUNCTION__, ns->nsid, node->vnid);
free_lock(&node->l);
atomic_add(&ns->nodecount, -1);
vnidpool_put(ns->vnids, node->vnid);
@ -241,23 +242,23 @@ static status_t googlefs_remove_vnode(fs_volume *_volume, fs_vnode *_node, bool
fs_nspace *ns = (fs_nspace *)_volume->private_volume;
fs_node *node = (fs_node *)_node->private_node;
status_t err = B_OK;
TRACE((PFS "%s(%" B_PRId32 ", %" B_PRId64 ", %s)\n", __FUNCTION__, ns->nsid, node->vnid, reenter?"r":"!r"));
TRACE("%s(%" B_PRId32 ", %" B_PRId64 ", %s)\n", __FUNCTION__, ns->nsid, node->vnid, reenter?"r":"!r");
if (!reenter)
err = LOCK(&ns->l);
if (err)
return err;
if (node->vnid == ns->rootid) {
TRACE((PFS "asked to remove the root node!!\n"));
TRACE("asked to remove the root node!!\n");
}
TRACE((PFS "SLL_REMOVE(ns->nodes %p, nlnext, %p)\n", ns->nodes, node));
TRACE("SLL_REMOVE(ns->nodes %p, nlnext, %p)\n", ns->nodes, node);
//LOCK(&node->l);
err = SLL_REMOVE(ns->nodes, nlnext, node);
/* query dirs must be removed from the query list too */
TRACE((PFS "SLL_REMOVE(ns->queries %p, qnext, %p)\n", ns->nodes, node));
TRACE("SLL_REMOVE(ns->queries %p, qnext, %p)\n", ns->nodes, node);
err = SLL_REMOVE(ns->queries, qnext, node);
if (node->parent) {
LOCK(&node->parent->l);
TRACE((PFS "SLL_REMOVE(node->parent->children %p, next, %p)\n", node->parent->children, node));
TRACE("SLL_REMOVE(node->parent->children %p, next, %p)\n", node->parent->children, node);
SLL_REMOVE(node->parent->children, next, node);
UNLOCK(&node->parent->l);
}
@ -272,7 +273,7 @@ static status_t googlefs_read_vnode(fs_volume *_volume, ino_t vnid, fs_vnode *_n
fs_nspace *ns = (fs_nspace *)_volume->private_volume;
fs_node *n;
status_t err = B_OK;
TRACE((PFS "%s(%" B_PRId32 ", %" B_PRId64 ", %s)\n", __FUNCTION__, _volume->id, vnid, reenter?"r":"!r"));
TRACE("%s(%" B_PRId32 ", %" B_PRId64 ", %s)\n", __FUNCTION__, _volume->id, vnid, reenter?"r":"!r");
if (!reenter)
err = LOCK(&ns->l);
if (err)
@ -294,14 +295,14 @@ static status_t googlefs_read_vnode(fs_volume *_volume, ino_t vnid, fs_vnode *_n
static status_t googlefs_release_vnode(fs_volume *_volume, fs_vnode *_node, bool reenter)
{
fs_node *node = (fs_node *)_node->private_node;
TRACE((PFS "%s(%" B_PRId32 ", %" B_PRId64 ", %s)\n", __FUNCTION__, _volume->id, node->vnid, reenter?"r":"!r"));
TRACE("%s(%" B_PRId32 ", %" B_PRId64 ", %s)\n", __FUNCTION__, _volume->id, node->vnid, reenter?"r":"!r");
return B_OK;
}
static int compare_fs_node_by_name(fs_node *node, char *name)
{
//return memcmp(node->name, name, GOOGLEFS_NAME_LEN);
//TRACE((PFS"find_by_name: '%s' <> '%s'\n", node->name, name));
//TRACE("find_by_name: '%s' <> '%s'\n", node->name, name);
return strncmp(node->name, name, GOOGLEFS_NAME_LEN);
}
@ -310,7 +311,7 @@ static status_t googlefs_get_vnode_name(fs_volume *_volume, fs_vnode *_node, cha
fs_nspace *ns = (fs_nspace *)_volume->private_volume;
fs_node *node = (fs_node *)_node->private_node;
TRACE((PFS "get_vnode_name(%" B_PRId32 ", %" B_PRId64 ", )\n", ns->nsid, (int64)(node?node->vnid:-1)));
TRACE("get_vnode_name(%" B_PRId32 ", %" B_PRId64 ", )\n", ns->nsid, (int64)(node?node->vnid:-1));
strlcpy(buffer, node->name, MIN(GOOGLEFS_NAME_LEN, len));
return B_OK;
}
@ -322,7 +323,7 @@ static status_t googlefs_walk(fs_volume *_volume, fs_vnode *_base, const char *f
fs_node *base = _base->private_node;
fs_node *n, *dummy;
status_t err = B_OK;
TRACE((PFS "walk(%" B_PRId32 ", %" B_PRId64 ", %s)\n", ns->nsid, (int64)(base?base->vnid:-1), file));
TRACE("walk(%" B_PRId32 ", %" B_PRId64 ", %s)\n", ns->nsid, (int64)(base?base->vnid:-1), file);
err = LOCK(&base->l);
if (err)
return err;
@ -355,7 +356,7 @@ static status_t googlefs_walk(fs_volume *_volume, fs_vnode *_base, const char *f
err = EINVAL;
}
UNLOCK(&base->l);
TRACE((PFS "walk() -> error 0x%08" B_PRIx32 "\n", err));
TRACE("walk() -> error 0x%08" B_PRIx32 "\n", err);
return err;
}
@ -365,7 +366,7 @@ static status_t googlefs_opendir(fs_volume *_volume, fs_vnode *_node, void **coo
fs_node *node = (fs_node *)_node->private_node;
status_t err = B_OK;
fs_dir_cookie *c;
TRACE((PFS "opendir(%" B_PRId32 ", %" B_PRId64 ")\n", ns->nsid, node->vnid));
TRACE("opendir(%" B_PRId32 ", %" B_PRId64 ")\n", ns->nsid, node->vnid);
if (!node)
return EINVAL;
if (!S_ISDIR(node->st.st_mode))
@ -397,7 +398,7 @@ static status_t googlefs_closedir(fs_volume *_volume, fs_vnode *_node, void *_co
fs_dir_cookie *cookie = (fs_dir_cookie *)_cookie;
status_t err = B_OK;
// node = cookie->node; // work around VFS bug
TRACE((PFS "closedir(%" B_PRId32 ", %" B_PRId64 ", %p)\n", ns->nsid, node->vnid, cookie));
TRACE("closedir(%" B_PRId32 ", %" B_PRId64 ", %p)\n", ns->nsid, node->vnid, cookie);
err = LOCK(&node->l);
if (err)
return err;
@ -413,7 +414,7 @@ static status_t googlefs_rewinddir(fs_volume *_volume, fs_vnode *_node, void *_c
fs_nspace *ns = (fs_nspace *)_volume->private_volume;
fs_node *node = (fs_node *)_node->private_node;
fs_dir_cookie *cookie = (fs_dir_cookie *)_cookie;
TRACE((PFS "rewinddir(%" B_PRId32 ", %" B_PRId64 ")\n", ns->nsid, node->vnid));
TRACE("rewinddir(%" B_PRId32 ", %" B_PRId64 ")\n", ns->nsid, node->vnid);
cookie->dir_current = 0;
return B_OK;
}
@ -426,12 +427,12 @@ static status_t googlefs_readdir(fs_volume *_volume, fs_vnode *_node, void *_coo
fs_node *n = NULL;
fs_node *parent = node->parent;
int index;
TRACE((PFS "readdir(%" B_PRId32 ", %" B_PRId64 ") @ %d\n", ns->nsid, node->vnid, cookie->dir_current));
TRACE("readdir(%" B_PRId32 ", %" B_PRId64 ") @ %d\n", ns->nsid, node->vnid, cookie->dir_current);
if (!node || !cookie || !num || !*num || !buf || (bufsize < (sizeof(dirent_t)+GOOGLEFS_NAME_LEN)))
return EINVAL;
LOCK(&node->l);
if (cookie->dir_current == 0) { /* .. */
TRACE((PFS "readdir: giving ..\n"));
TRACE("readdir: giving ..\n");
/* the VFS will correct that anyway */
buf->d_dev = ns->nsid;
buf->d_pdev = ns->nsid;
@ -442,7 +443,7 @@ static status_t googlefs_readdir(fs_volume *_volume, fs_vnode *_node, void *_coo
cookie->dir_current++;
*num = 1;
} else if (cookie->dir_current == 1) { /* . */
TRACE((PFS "readdir: giving .\n"));
TRACE("readdir: giving .\n");
/* the VFS will correct that anyway */
buf->d_dev = ns->nsid;
buf->d_pdev = ns->nsid;
@ -456,7 +457,7 @@ static status_t googlefs_readdir(fs_volume *_volume, fs_vnode *_node, void *_coo
index = cookie->dir_current-2;
for (n = node->children; n && index; n = n->next, index--); //XXX: care about n->hidden || n->deleted
if (n) {
TRACE((PFS "readdir: giving ino %" B_PRId64 ", %s\n", n->vnid, n->name));
TRACE("readdir: giving ino %" B_PRId64 ", %s\n", n->vnid, n->name);
buf->d_dev = ns->nsid;
buf->d_pdev = ns->nsid;
buf->d_ino = n->vnid;
@ -480,7 +481,7 @@ static status_t googlefs_free_dircookie(fs_volume *_volume, fs_vnode *_node, voi
fs_dir_cookie *cookie = (fs_dir_cookie *)_cookie;
status_t err = B_OK;
// node = cookie->node; // work around VFS bug
TRACE((PFS"freedircookie(%" B_PRId32 ", %" B_PRId64 ", %p)\n", ns->nsid, node?node->vnid:(int64)0, (void *)cookie));
TRACE("freedircookie(%" B_PRId32 ", %" B_PRId64 ", %p)\n", ns->nsid, node?node->vnid:(int64)0, (void *)cookie);
err = LOCK(&node->l);
if (err)
return err;
@ -535,7 +536,7 @@ static status_t googlefs_open(fs_volume *_volume, fs_vnode *_node, int omode, vo
status_t err = B_OK;
//fs_node *dummy;
fs_file_cookie *fc;
TRACE((PFS"open(%" B_PRId32 ", %" B_PRId64 ", 0x%x)\n", ns->nsid, node->vnid, omode));
TRACE("open(%" B_PRId32 ", %" B_PRId64 ", 0x%x)\n", ns->nsid, node->vnid, omode);
if (!node || !cookie)
return EINVAL;
@ -589,7 +590,7 @@ static status_t googlefs_close(fs_volume *_volume, fs_vnode *_node, void *_cooki
fs_node *node = (fs_node *)_node->private_node;
fs_file_cookie *cookie = (fs_file_cookie *)_cookie;
status_t err;
TRACE((PFS"close(%" B_PRId32 ", %" B_PRId64 ")\n", ns->nsid, node->vnid));
TRACE("close(%" B_PRId32 ", %" B_PRId64 ")\n", ns->nsid, node->vnid);
if (!ns || !node || !cookie)
return EINVAL;
err = LOCK(&node->l);
@ -609,7 +610,7 @@ static status_t googlefs_free_cookie(fs_volume *_volume, fs_vnode *_node, void *
fs_node *node = (fs_node *)_node->private_node;
fs_file_cookie *cookie = (fs_file_cookie *)_cookie;
status_t err = B_OK;
TRACE((PFS"freecookie(%" B_PRId32 ", %" B_PRId64 ")\n", ns->nsid, node->vnid));
TRACE("freecookie(%" B_PRId32 ", %" B_PRId64 ")\n", ns->nsid, node->vnid);
err = LOCK(&node->l);
if (err)
return err;
@ -636,7 +637,7 @@ static status_t googlefs_read(fs_volume *_volume, fs_vnode *_node, void *_cookie
fs_nspace *ns = (fs_nspace *)_volume->private_volume;
fs_node *node = (fs_node *)_node->private_node;
status_t err = B_OK;
TRACE((PFS"read(%" B_PRId32 ", %" B_PRId64 ", %jd, %zu)\n", ns->nsid, node->vnid, pos, *len));
TRACE("read(%" B_PRId32 ", %" B_PRId64 ", %jd, %zu)\n", ns->nsid, node->vnid, pos, *len);
if (pos < 0 || (size_t)pos > node->data_size)
err = EFPOS;
if (err || node->data_size == 0 || !node->data) {
@ -651,7 +652,7 @@ static status_t googlefs_read(fs_volume *_volume, fs_vnode *_node, void *_cookie
static status_t googlefs_write(fs_volume *_volume, fs_vnode *_node, void *_cookie, off_t pos, const void *buf, size_t *len)
{
fs_node *node = (fs_node *)_node->private_node;
TRACE((PFS"write(%" B_PRId32 ", %" B_PRId64 ", %jd, %zu)\n", _volume->id, node->vnid, pos, *len));
TRACE("write(%" B_PRId32 ", %" B_PRId64 ", %jd, %zu)\n", _volume->id, node->vnid, pos, *len);
*len = 0;
return ENOSYS;
}
@ -659,13 +660,13 @@ static status_t googlefs_write(fs_volume *_volume, fs_vnode *_node, void *_cooki
static status_t googlefs_wstat(fs_volume *_volume, fs_vnode *_node, const struct stat *st, uint32 mask)
{
fs_node *node = (fs_node *)_node->private_node;
TRACE((PFS"wstat(%" B_PRId32 ", %" B_PRId64 ", , 0x%08" B_PRIx32 ")\n", _volume->id, node->vnid, mask));
TRACE("wstat(%" B_PRId32 ", %" B_PRId64 ", , 0x%08" B_PRIx32 ")\n", _volume->id, node->vnid, mask);
return ENOSYS;
}
static status_t googlefs_wfsstat(fs_volume *_volume, const struct fs_info *info, uint32 mask)
{
TRACE((PFS"wfsstat(%" B_PRId32 ", , 0x%08" B_PRIx32 ")\n", _volume->id, mask));
TRACE("wfsstat(%" B_PRId32 ", , 0x%08" B_PRIx32 ")\n", _volume->id, mask);
return ENOSYS;
}
@ -687,7 +688,7 @@ static int googlefs_create_gen(fs_volume *_volume, fs_node *dir, const char *nam
status_t err;
fs_node *n;
int i;
TRACE((PFS"create_gen(%" B_PRId32 ", %" B_PRId64 ", '%s', 0x%08x, %c, %c)\n", ns->nsid, dir->vnid, name, omode, mkdir?'t':'f', uniq?'t':'f'));
TRACE("create_gen(%" B_PRId32 ", %" B_PRId64 ", '%s', 0x%08x, %c, %c)\n", ns->nsid, dir->vnid, name, omode, mkdir?'t':'f', uniq?'t':'f');
if (strlen(name) > GOOGLEFS_NAME_LEN-1)
return ENAMETOOLONG;
@ -790,7 +791,7 @@ static status_t googlefs_create(fs_volume *_volume, fs_vnode *_dir, const char *
status_t err;
fs_node *n;
struct fs_vnode child = { NULL, &sGoogleFSVnodeOps };
TRACE((PFS"create(%" B_PRId32 ", %" B_PRId64 ", '%s', 0x%08x)\n", ns->nsid, dir->vnid, name, omode));
TRACE("create(%" B_PRId32 ", %" B_PRId64 ", '%s', 0x%08x)\n", ns->nsid, dir->vnid, name, omode);
/* don't let ppl mess our fs up */
return ENOSYS;
@ -808,7 +809,7 @@ static int googlefs_unlink_gen(fs_volume *_volume, fs_node *dir, const char *nam
fs_nspace *ns = (fs_nspace *)_volume->private_volume;
status_t err;
fs_node *n;
TRACE((PFS"unlink(%" B_PRId32 ", %" B_PRId64 ", %s)\n", ns->nsid, dir->vnid, name));
TRACE("unlink(%" B_PRId32 ", %" B_PRId64 ", %s)\n", ns->nsid, dir->vnid, name);
//dprintf(PFS"unlink(%" B_PRId32 ", %" B_PRId64 ", %s)\n", ns->nsid, dir->vnid, name);
err = LOCK(&dir->l);
if (err)
@ -849,7 +850,7 @@ static status_t googlefs_rmdir(fs_volume *_volume, fs_vnode *_dir, const char *n
{
//fs_nspace *ns = (fs_nspace *)_volume->private_volume;
fs_node *dir = (fs_node *)_dir->private_node;
TRACE((PFS"rmdir(%" B_PRId32 ", %" B_PRId64 ", %s)\n", _volume->id, dir->vnid, name));
TRACE("rmdir(%" B_PRId32 ", %" B_PRId64 ", %s)\n", _volume->id, dir->vnid, name);
return googlefs_unlink(_volume, _dir, name);
}
@ -858,7 +859,7 @@ static int googlefs_unlink_node_rec(fs_volume *_volume, fs_node *node)
fs_nspace *ns = (fs_nspace *)_volume->private_volume;
status_t err;
fs_node *n;
TRACE((PFS"googlefs_unlink_node_rec(%" B_PRId32 ", %" B_PRId64 ":%s)\n", ns->nsid, node->vnid, node->name));
TRACE("googlefs_unlink_node_rec(%" B_PRId32 ", %" B_PRId64 ":%s)\n", ns->nsid, node->vnid, node->name);
if (!ns || !node)
return EINVAL;
// kill_request();
@ -880,7 +881,7 @@ static status_t googlefs_access(fs_volume *_volume, fs_vnode *_node, int mode)
{
fs_nspace *ns = (fs_nspace *)_volume->private_volume;
fs_node *node = (fs_node *)_node->private_node;
TRACE((PFS"access(%" B_PRId32 ", %" B_PRId64 ", 0x%x)\n", ns->nsid, node->vnid, mode));
TRACE("access(%" B_PRId32 ", %" B_PRId64 ", 0x%x)\n", ns->nsid, node->vnid, mode);
return B_OK;
}
@ -900,7 +901,7 @@ static int googlefs_mkdir_gen(fs_volume *_volume, fs_vnode *_dir, const char *na
status_t err;
fs_node *n;
int i;
TRACE((PFS"mkdir_gen(%" B_PRId32 ", %" B_PRId64 ", '%s', 0x%08x, %c)\n", ns->nsid, dir->vnid, name, perms, uniq?'t':'f'));
TRACE("mkdir_gen(%" B_PRId32 ", %" B_PRId64 ", '%s', 0x%08x, %c)\n", ns->nsid, dir->vnid, name, perms, uniq?'t':'f');
if (strlen(name) > GOOGLEFS_NAME_LEN-1)
return ENAMETOOLONG;
@ -985,7 +986,7 @@ static status_t googlefs_mkdir(fs_volume *_volume, fs_vnode *_dir, const char *n
{
fs_nspace *ns = (fs_nspace *)_volume->private_volume;
fs_node *dir = (fs_node *)_dir->private_node;
TRACE((PFS"mkdir(%" B_PRId32 ", %" B_PRId64 ", '%s', 0x%08x)\n", ns->nsid, dir->vnid, name, perms));
TRACE("mkdir(%" B_PRId32 ", %" B_PRId64 ", '%s', 0x%08x)\n", ns->nsid, dir->vnid, name, perms);
return googlefs_create_gen(_volume, dir, name, O_EXCL, perms, NULL, NULL, folders_attrs, true, false);
}
@ -997,7 +998,7 @@ static status_t googlefs_open_attrdir(fs_volume *_volume, fs_vnode *_node, void
fs_node *node = (fs_node *)_node->private_node;
status_t err = B_OK;
fs_attr_dir_cookie *c;
TRACE((PFS "open_attrdir(%" B_PRId32 ", %" B_PRId64 ")\n", ns->nsid, node->vnid));
TRACE("open_attrdir(%" B_PRId32 ", %" B_PRId64 ")\n", ns->nsid, node->vnid);
if (!node)
return EINVAL;
err = LOCK(&node->l);
@ -1026,7 +1027,7 @@ static status_t googlefs_close_attrdir(fs_volume *_volume, fs_vnode *_node, void
fs_node *node = (fs_node *)_node->private_node;
fs_attr_dir_cookie *cookie = (fs_attr_dir_cookie *)_cookie;
status_t err = B_OK;
TRACE((PFS "close_attrdir(%" B_PRId32 ", %" B_PRId64 ")\n", ns->nsid, node->vnid));
TRACE("close_attrdir(%" B_PRId32 ", %" B_PRId64 ")\n", ns->nsid, node->vnid);
err = LOCK(&node->l);
if (err)
return err;
@ -1041,7 +1042,7 @@ static status_t googlefs_free_attrdircookie(fs_volume *_volume, fs_vnode *_node,
fs_node *node = (fs_node *)_node->private_node;
fs_attr_dir_cookie *cookie = (fs_attr_dir_cookie *)_cookie;
status_t err = B_OK;
TRACE((PFS"free_attrdircookie(%" B_PRId32 ", %" B_PRId64 ")\n", ns->nsid, node->vnid));
TRACE("free_attrdircookie(%" B_PRId32 ", %" B_PRId64 ")\n", ns->nsid, node->vnid);
err = LOCK(&node->l);
if (err)
return err;
@ -1056,7 +1057,7 @@ static status_t googlefs_rewind_attrdir(fs_volume *_volume, fs_vnode *_node, voi
fs_nspace *ns = (fs_nspace *)_volume->private_volume;
fs_node *node = (fs_node *)_node->private_node;
fs_attr_dir_cookie *cookie = (fs_attr_dir_cookie *)_cookie;
TRACE((PFS "rewind_attrdir(%" B_PRId32 ", %" B_PRId64 ")\n", ns->nsid, node->vnid));
TRACE("rewind_attrdir(%" B_PRId32 ", %" B_PRId64 ")\n", ns->nsid, node->vnid);
cookie->dir_current = 0;
return B_OK;
}
@ -1071,7 +1072,7 @@ static status_t googlefs_read_attrdir(fs_volume *_volume, fs_vnode *_node, void
attr_entry *ae = NULL;
int i;
int count_indirect;
TRACE((PFS "read_attrdir(%" B_PRId32 ", %" B_PRId64 ") @ %d\n", ns->nsid, node->vnid, cookie->dir_current));
TRACE("read_attrdir(%" B_PRId32 ", %" B_PRId64 ") @ %d\n", ns->nsid, node->vnid, cookie->dir_current);
if (!node || !cookie || !num || !*num || !buf || (bufsize < (sizeof(dirent_t)+GOOGLEFS_NAME_LEN)))
return EINVAL;
LOCK(&node->l);
@ -1083,7 +1084,7 @@ static status_t googlefs_read_attrdir(fs_volume *_volume, fs_vnode *_node, void
ae = &node->attrs[i];
if (ae) {
TRACE((PFS "read_attrdir: giving %s\n", ae->name));
TRACE("read_attrdir: giving %s\n", ae->name);
buf->d_dev = ns->nsid;
buf->d_pdev = ns->nsid;
buf->d_ino = node->vnid;
@ -1116,7 +1117,7 @@ static status_t googlefs_open_attr_h(fs_volume *_volume, fs_vnode *_node, const
fs_file_cookie *fc;
attr_entry *ae = NULL;
int i;
TRACE((PFS"open_attr(%" B_PRId32 ", %" B_PRId64 ", %s, 0x%x)\n", ns->nsid, node->vnid, name, omode));
TRACE("open_attr(%" B_PRId32 ", %" B_PRId64 ", %s, 0x%x)\n", ns->nsid, node->vnid, name, omode);
if (!node || !name || !cookie)
return EINVAL;
@ -1174,7 +1175,7 @@ static status_t googlefs_close_attr_h(fs_volume *_volume, fs_vnode *_node, void
fs_node *node = (fs_node *)_node->private_node;
fs_file_cookie *cookie = (fs_file_cookie *)_cookie;
status_t err;
TRACE((PFS"close_attr(%" B_PRId32 ", %" B_PRId64 ":%s)\n", ns->nsid, node->vnid, cookie->attr?cookie->attr->name:"?"));
TRACE("close_attr(%" B_PRId32 ", %" B_PRId64 ":%s)\n", ns->nsid, node->vnid, cookie->attr?cookie->attr->name:"?");
if (!ns || !node || !cookie)
return EINVAL;
err = LOCK(&node->l);
@ -1194,7 +1195,7 @@ static status_t googlefs_free_attr_cookie_h(fs_volume *_volume, fs_vnode *_node,
fs_node *node = (fs_node *)_node->private_node;
fs_file_cookie *cookie = (fs_file_cookie *)_cookie;
status_t err = B_OK;
TRACE((PFS"free_attrcookie(%" B_PRId32 ", %" B_PRId64 ":%s)\n", ns->nsid, node->vnid, cookie->attr?cookie->attr->name:"?"));
TRACE("free_attrcookie(%" B_PRId32 ", %" B_PRId64 ":%s)\n", ns->nsid, node->vnid, cookie->attr?cookie->attr->name:"?");
err = LOCK(&node->l);
if (err)
return err;
@ -1215,7 +1216,7 @@ static status_t googlefs_read_attr_stat(fs_volume *_volume, fs_vnode *_node, voi
fs_file_cookie *cookie = (fs_file_cookie *)_cookie;
status_t err = B_OK;
attr_entry *ae = cookie->attr;
TRACE((PFS"stat_attr(%" B_PRId32 ", %" B_PRId64 ":%s)\n", ns->nsid, node->vnid, ae->name));
TRACE("stat_attr(%" B_PRId32 ", %" B_PRId64 ":%s)\n", ns->nsid, node->vnid, ae->name);
if (!node || !st || !cookie || !cookie->attr)
return EINVAL;
memcpy(st, &node->st, sizeof(struct stat));
@ -1232,7 +1233,7 @@ static status_t googlefs_read_attr(fs_volume *_volume, fs_vnode *_node, void *_c
fs_file_cookie *cookie = (fs_file_cookie *)_cookie;
status_t err = B_OK;
attr_entry *ae = cookie->attr;
TRACE((PFS"read_attr(%" B_PRId32 ", %" B_PRId64 ":%s)\n", ns->nsid, node->vnid, ae->name));
TRACE("read_attr(%" B_PRId32 ", %" B_PRId64 ":%s)\n", ns->nsid, node->vnid, ae->name);
if (!node || !cookie || !len || !*len)
return EINVAL;
@ -1258,8 +1259,8 @@ static int compare_fs_node_by_recent_query_string(fs_node *node, char *query)
{
time_t tm = time(NULL);
//return memcmp(node->name, name, GOOGLEFS_NAME_LEN);
TRACE((PFS"find_by_recent_query_string: '%s' <> '%s'\n", \
node->request?node->request->query_string:NULL, query));
TRACE("find_by_recent_query_string: '%s' <> '%s'\n", \
node->request?node->request->query_string:NULL, query);
if (!node->request || !node->request->query_string)
return -1;
/* reject if older than 5 min */
@ -1282,7 +1283,7 @@ static status_t googlefs_open_query(fs_volume *_volume, const char *query, uint3
bool accepted = true;
bool reused = false;
//int i;
TRACE((PFS"open_query(%" B_PRId32 ", '%s', 0x%08" B_PRIx32 ", %" B_PRId32 ", %" B_PRId32 ")\n", ns->nsid, query, flags, port, token));
TRACE("open_query(%" B_PRId32 ", '%s', 0x%08" B_PRIx32 ", %" B_PRId32 ", %" B_PRId32 ")\n", ns->nsid, query, flags, port, token);
// if (flags & B_LIVE_QUERY)
// return ENOSYS; /* no live query yet, they are live enough anyway */
//return ENOSYS;
@ -1327,7 +1328,7 @@ static status_t googlefs_open_query(fs_volume *_volume, const char *query, uint3
*cookie = (void *)c;
return B_OK;
}
TRACE((PFS"open_query: QUERY: '%s'\n", qstring));
TRACE("open_query: QUERY: '%s'\n", qstring);
/* reuse query if it's not too old */
LOCK(&ns->l);
qn = SLL_FIND(ns->queries, qnext,
@ -1335,7 +1336,7 @@ static status_t googlefs_open_query(fs_volume *_volume, const char *query, uint3
UNLOCK(&ns->l);
reused = (qn != NULL);
if (reused) {
TRACE((PFS"open_query: reusing %" B_PRId32 ":%" B_PRId64 "\n", ns->nsid, qn->vnid));
TRACE("open_query: reusing %" B_PRId32 ":%" B_PRId64 "\n", ns->nsid, qn->vnid);
err = get_vnode(_volume, qn->vnid, (void **)&dummy); /* inc ref count */
if (err)
goto err_mkdir;
@ -1370,12 +1371,12 @@ static status_t googlefs_open_query(fs_volume *_volume, const char *query, uint3
if (err)
goto err_gn;
TRACE((PFS"open_query: request_open done\n"));
TRACE("open_query: request_open done\n");
#ifndef NO_SEARCH
err = google_request_process(qn->request);
if (err)
goto err_gro;
TRACE((PFS"open_query: request_process done\n"));
TRACE("open_query: request_process done\n");
#else
/* fake entries */
@ -1422,7 +1423,7 @@ err_qs:
free(qstring);
//err_m:
free(c);
TRACE((PFS"open_query: error 0x%08" B_PRIx32 "\n", err));
TRACE("open_query: error 0x%08" B_PRIx32 "\n", err);
return err;
}
@ -1432,7 +1433,7 @@ static status_t googlefs_close_query(fs_volume *_volume, void *_cookie)
fs_query_cookie *cookie = (fs_query_cookie *)_cookie;
status_t err;
fs_node *q;
TRACE((PFS"close_query(%" B_PRId32 ", %" B_PRId64 ")\n", ns->nsid, cookie->node?cookie->node->vnid:(int64)0));
TRACE("close_query(%" B_PRId32 ", %" B_PRId64 ")\n", ns->nsid, cookie->node?cookie->node->vnid:(int64)0);
//return ENOSYS;
q = cookie->node;
if (!q)
@ -1458,7 +1459,7 @@ static status_t googlefs_free_query_cookie(fs_volume *_volume, void *_cookie)
fs_query_cookie *cookie = (fs_query_cookie *)_cookie;
status_t err = B_OK;
fs_node *q;
TRACE((PFS"free_query_cookie(%" B_PRId32 ")\n", _volume->id));
TRACE("free_query_cookie(%" B_PRId32 ")\n", _volume->id);
q = cookie->node;
if (!q)
goto no_node;
@ -1485,7 +1486,7 @@ static status_t googlefs_read_query(fs_volume *_volume, void *_cookie, struct di
fs_node *n = NULL;
fs_node *node = cookie->node;
int index;
TRACE((PFS"read_query(%" B_PRId32 ", %" B_PRId64 ") @ %d\n", ns->nsid, node?node->vnid:(int64)0, cookie->dir_current));
TRACE("read_query(%" B_PRId32 ", %" B_PRId64 ") @ %d\n", ns->nsid, node?node->vnid:(int64)0, cookie->dir_current);
if (!cookie || !num || !*num || !buf || (bufsize < (sizeof(dirent_t)+GOOGLEFS_NAME_LEN)))
return EINVAL;
if (!node) {
@ -1498,7 +1499,7 @@ static status_t googlefs_read_query(fs_volume *_volume, void *_cookie, struct di
index = cookie->dir_current;
for (n = node->children; n && index; n = n->next, index--);
if (n) {
TRACE((PFS "read_query: giving ino %" PRId64 ", %s\n", n->vnid, n->name));
TRACE("read_query: giving ino %" PRId64 ", %s\n", n->vnid, n->name);
buf->d_dev = ns->nsid;
buf->d_pdev = ns->nsid;
buf->d_ino = n->vnid;
@ -1524,7 +1525,7 @@ int googlefs_push_result_to_query(struct google_request *request, struct google_
char ename[GOOGLEFS_NAME_LEN];
char *p;
int i;
TRACE((PFS"push_result_to_query(%" B_PRId32 ", %" B_PRId64 ", %ld:'%s')\n", ns->nsid, qn->vnid, result->id, result->name));
TRACE("push_result_to_query(%" B_PRId32 ", %" B_PRId64 ", %ld:'%s')\n", ns->nsid, qn->vnid, result->id, result->name);
//dprintf(PFS"push_result_to_query(%" B_PRId32 ", %" B_PRId64 ", %ld:'%s')\n", ns->nsid, qn->vnid, result->id, result->name);
//return ENOSYS;
if (!ns || !qn)
@ -1597,7 +1598,7 @@ int googlefs_push_result_to_query(struct google_request *request, struct google_
UNLOCK(&n->l);
return B_OK;
TRACE((PFS "push_result_to_query: error 0x%08" B_PRIx32 "\n", err));
TRACE("push_result_to_query: error 0x%08" B_PRIx32 "\n", err);
return err;
}
@ -1608,10 +1609,10 @@ googlefs_std_ops(int32 op, ...)
{
switch (op) {
case B_MODULE_INIT:
TRACE((PFS"std_ops(INIT)\n"));
TRACE("std_ops(INIT)\n");
return B_OK;
case B_MODULE_UNINIT:
TRACE((PFS"std_ops(UNINIT)\n"));
TRACE("std_ops(UNINIT)\n");
return B_OK;
default:
return B_ERROR;

View File

@ -9,8 +9,8 @@
#ifdef __HAIKU__
#include <fs_interface.h>
#include <kernel/lock.h>
#include <fs_info.h>
#include <private/shared/locks.h>
#include <NodeMonitor.h>
#define lock mutex
#define new_lock mutex_init

View File

@ -73,7 +73,7 @@ status_t http_delete(struct http_cnx *cnx)
if (!cnx)
return EINVAL;
if ((unsigned long)cnx < 0x40) {
dprintf("http: WARNING: cnx ptr = %p\n", cnx);
fprintf(stderr, "http: WARNING: cnx ptr = %p\n", cnx);
return B_OK;
}
if (cnx->sock >= 0) {
@ -93,12 +93,12 @@ status_t http_connect(struct http_cnx *cnx, struct sockaddr_in *sin)
uint32 ip;
uint16 port;
if (!sin) {
dprintf("http_connect(, NULL)!!\n");
fprintf(stderr, "http_connect(, NULL)!!\n");
return EINVAL;
}
ip = sin->sin_addr.s_addr;
port = sin->sin_port;
dprintf("http_connect(, %"B_PRId32".%"B_PRId32".%" B_PRId32 ".%" B_PRId32 ":%d), sock = %d\n", ip & 0xff, (ip >> 8) & 0xff, (ip >> 16) & 0xff, (ip >> 24) & 0xff, ntohs(port), cnx->sock);
fprintf(stderr, "http_connect(, %"B_PRId32".%"B_PRId32".%" B_PRId32 ".%" B_PRId32 ":%d), sock = %d\n", ip & 0xff, (ip >> 8) & 0xff, (ip >> 16) & 0xff, (ip >> 24) & 0xff, ntohs(port), cnx->sock);
err = kconnect(cnx->sock, (struct sockaddr *)sin, sin->sin_len);
cnx->err = 0;
if (err == -1)

View File

@ -7,6 +7,8 @@
#include <OS.h>
#include "lists2.h"
#include <stdio.h>
void *sll_find(long nextoff, void *head, sll_compare_func func, void *id)
{
void *p = head;
@ -18,7 +20,7 @@ void *sll_find(long nextoff, void *head, sll_compare_func func, void *id)
return p;
p = sll_next(nextoff, p);
if (!count--) {
dprintf("sll_find: WARNING: 5000 nodes to search ??? looks more of a loop.\n");
fprintf(stderr, "sll_find: WARNING: 5000 nodes to search ??? looks more of a loop.\n");
return NULL;
}
}
@ -44,7 +46,7 @@ status_t sll_insert_tail(long nextoff, void **head, void *item)
return EINVAL;
if (*(void **)(((char *)item)+nextoff)) {
dprintf("sll_insert_tail: WARNING: %p->next NOT NULL\n", item);
fprintf(stderr, "sll_insert_tail: WARNING: %p->next NOT NULL\n", item);
*(void **)(((char *)item)+nextoff) = NULL;
}

View File

@ -1,132 +0,0 @@
## BeOS Generic Makefile v2.2 ##
## Fill in this file to specify the project being created, and the referenced
## makefile-engine will do all of the hard work for you. This handles both
## Intel and PowerPC builds of the BeOS.
## Application Specific Settings ---------------------------------------------
# specify the name of the binary
NAME= googlefs
# specify the type of binary
# APP: Application
# SHARED: Shared library or add-on
# STATIC: Static library archive
# DRIVER: Kernel Driver
TYPE= DRIVER
# add support for new Pe and Eddie features
# to fill in generic makefile
#%{
# @src->@
# specify the source files to use
# full paths or paths relative to the makefile can be included
# all files, regardless of directory, will have their object
# files created in the common object directory.
# Note that this means this makefile will not work correctly
# if two source files with the same name (source.c or source.cpp)
# are included from different directories. Also note that spaces
# in folder names do not work well with this makefile.
SRCS= vnidpool.c \
lists2.c \
http_cnx.c \
parse_google_html.c \
google_request.c \
query.c \
googlefs.c \
attrs.c \
settings.c \
string_utils.c
# specify the resource files to use
# full path or a relative path to the resource file can be used.
RSRCS=
# @<-src@
#%}
# end support for Pe and Eddie
# specify additional libraries to link against
# there are two acceptable forms of library specifications
# - if your library follows the naming pattern of:
# libXXX.so or libXXX.a you can simply specify XXX
# library: libbe.so entry: be
#
# - if your library does not follow the standard library
# naming scheme you need to specify the path to the library
# and it's name
# library: my_lib.a entry: my_lib.a or path/my_lib.a
LIBS=
# specify additional paths to directories following the standard
# libXXX.so or libXXX.a naming scheme. You can specify full paths
# or paths relative to the makefile. The paths included may not
# be recursive, so include all of the paths where libraries can
# be found. Directories where source files are found are
# automatically included.
LIBPATHS=
# additional paths to look for system headers
# thes use the form: #include <header>
# source file directories are NOT auto-included here
SYSTEM_INCLUDE_PATHS =
# additional paths to look for local headers
# thes use the form: #include "header"
# source file directories are automatically included
LOCAL_INCLUDE_PATHS =
# specify the level of optimization that you desire
# NONE, SOME, FULL
OPTIMIZE= FULL
# specify any preprocessor symbols to be defined. The symbols will not
# have their values set automatically; you must supply the value (if any)
# to use. For example, setting DEFINES to "DEBUG=1" will cause the
# compiler option "-DDEBUG=1" to be used. Setting DEFINES to "DEBUG"
# would pass "-DDEBUG" on the compiler's command line.
#DEFINES= _IMPEXP_KERNEL= DEBUG_GOOGLEFS=1
DEFINES+= _IMPEXP_KERNEL=
#DEFINES+= DEBUG=1
#DEBUG=1
# specify special warning levels
# if unspecified default warnings will be used
# NONE = supress all warnings
# ALL = enable all warnings
WARNINGS = ALL
# specify whether image symbols will be created
# so that stack crawls in the debugger are meaningful
# if TRUE symbols will be created
SYMBOLS = TRUE
# specify debug settings
# if TRUE will allow application to be run from a source-level
# debugger. Note that this will disable all optimzation.
DEBUGGER =
# specify additional compiler flags for all files
COMPILER_FLAGS =
# specify additional linker flags
LINKER_FLAGS =
# specify the version of this particular item
# (for example, -app 3 4 0 d 0 -short 340 -long "340 "`echo -n -e '\302\251'`"1999 GNU GPL")
# This may also be specified in a resource.
APP_VERSION =
# (for TYPE == DRIVER only) Specify desired location of driver in the /dev
# hierarchy. Used by the driverinstall rule. E.g., DRIVER_PATH = video/usb will
# instruct the driverinstall rule to place a symlink to your driver's binary in
# ~/add-ons/kernel/drivers/dev/video/usb, so that your driver will appear at
# /dev/video/usb when loaded. Default is "misc".
DRIVER_PATH =
## include the makefile-engine
include $(BUILDHOME)/etc/makefile-engine

View File

@ -1,133 +0,0 @@
## BeOS Generic Makefile v2.2 ##
## Fill in this file to specify the project being created, and the referenced
## makefile-engine will do all of the hard work for you. This handles both
## Intel and PowerPC builds of the BeOS.
## Application Specific Settings ---------------------------------------------
# specify the name of the binary
NAME= googlefs
# specify the type of binary
# APP: Application
# SHARED: Shared library or add-on
# STATIC: Static library archive
# DRIVER: Kernel Driver
TYPE= SHARED
# add support for new Pe and Eddie features
# to fill in generic makefile
#%{
# @src->@
# specify the source files to use
# full paths or paths relative to the makefile can be included
# all files, regardless of directory, will have their object
# files created in the common object directory.
# Note that this means this makefile will not work correctly
# if two source files with the same name (source.c or source.cpp)
# are included from different directories. Also note that spaces
# in folder names do not work well with this makefile.
SRCS= vnidpool.c \
lists2.c \
http_cnx.c \
parse_google_html.c \
google_request.c \
query.c \
googlefs.c \
attrs.c \
settings.c \
string_utils.c
# specify the resource files to use
# full path or a relative path to the resource file can be used.
RSRCS=
# @<-src@
#%}
# end support for Pe and Eddie
# specify additional libraries to link against
# there are two acceptable forms of library specifications
# - if your library follows the naming pattern of:
# libXXX.so or libXXX.a you can simply specify XXX
# library: libbe.so entry: be
#
# - if your library does not follow the standard library
# naming scheme you need to specify the path to the library
# and it's name
# library: my_lib.a entry: my_lib.a or path/my_lib.a
LIBS= _APP_ socket bind
# specify additional paths to directories following the standard
# libXXX.so or libXXX.a naming scheme. You can specify full paths
# or paths relative to the makefile. The paths included may not
# be recursive, so include all of the paths where libraries can
# be found. Directories where source files are found are
# automatically included.
LIBPATHS=
# additional paths to look for system headers
# thes use the form: #include <header>
# source file directories are NOT auto-included here
SYSTEM_INCLUDE_PATHS =
# additional paths to look for local headers
# thes use the form: #include "header"
# source file directories are automatically included
LOCAL_INCLUDE_PATHS =
# specify the level of optimization that you desire
# NONE, SOME, FULL
OPTIMIZE= FULL
# specify any preprocessor symbols to be defined. The symbols will not
# have their values set automatically; you must supply the value (if any)
# to use. For example, setting DEFINES to "DEBUG=1" will cause the
# compiler option "-DDEBUG=1" to be used. Setting DEFINES to "DEBUG"
# would pass "-DDEBUG" on the compiler's command line.
DEFINES= DEBUG=1 _BUILDING_fs=1 _IMPEXP_KERNEL=
#DEBUG=1
# specify special warning levels
# if unspecified default warnings will be used
# NONE = supress all warnings
# ALL = enable all warnings
WARNINGS = ALL
# specify whether image symbols will be created
# so that stack crawls in the debugger are meaningful
# if TRUE symbols will be created
SYMBOLS = TRUE
# specify debug settings
# if TRUE will allow application to be run from a source-level
# debugger. Note that this will disable all optimzation.
DEBUGGER =
# specify additional compiler flags for all files
COMPILER_FLAGS =
# specify additional linker flags
LINKER_FLAGS =
# specify the version of this particular item
# (for example, -app 3 4 0 d 0 -short 340 -long "340 "`echo -n -e '\302\251'`"1999 GNU GPL")
# This may also be specified in a resource.
APP_VERSION =
# (for TYPE == DRIVER only) Specify desired location of driver in the /dev
# hierarchy. Used by the driverinstall rule. E.g., DRIVER_PATH = video/usb will
# instruct the driverinstall rule to place a symlink to your driver's binary in
# ~/add-ons/kernel/drivers/dev/video/usb, so that your driver will appear at
# /dev/video/usb when loaded. Default is "misc".
DRIVER_PATH =
## include the makefile-engine
include $(BUILDHOME)/etc/makefile-engine
_APP_:
ln -s /boot/home/config/bin/UserlandFSServer _APP_

View File

@ -266,7 +266,7 @@ err0:
int main(int argc, char **argv)
{
struct google_result *results;
struct google_result *tag1 = 0xaaaa5555, *res = NULL, *tag2 = 0x5555aaaa;
struct google_result *tag1 = (void*)0xaaaa5555, *res = NULL, *tag2 = (void*)0x5555aaaa;
size_t len;
char *p;
int err;
@ -278,7 +278,7 @@ int main(int argc, char **argv)
*(uint32 *)p = 0xa5a5a5a5;
*(uint32 *)(&p[BUFSZ+4]) = 0x5a5a5a5a;
err = google_parse_results(p+4, len, &nextid, &results);
printf("error 0x%08lx\n", err);
printf("error 0x%08x\n", err);
if (err < 0)
return 1;
res = results;
@ -286,8 +286,8 @@ int main(int argc, char **argv)
printf("[%ld]:\nURL='%s'\nNAME='%s'\nSNIPSET='%s'\nCACHE='%s'\nSIMILAR='%s'\n\n", res->id, res->url, res->name, res->snipset, res->cache_url, res->similar_url);
res = res->next;
}
printf("before = 0x%08lx:0x%08lx, after = 0x%08lx:0x%08lx\n", 0xa5a5a5a5, *(uint32 *)p, 0x5a5a5a5a, *(uint32 *)(&p[BUFSZ+4]));
printf("before = 0x%08lx:0x%08lx, after = 0x%08lx:0x%08lx\n", 0xaaaa5555, tag1, 0x5555aaaa, tag2);
printf("before = 0x%08x:0x%08x, after = 0x%08x:0x%08x\n", 0xa5a5a5a5, *(uint32 *)p, 0x5a5a5a5a, *(uint32 *)(&p[BUFSZ+4]));
printf("before = 0x%08x:%p, after = 0x%08x:%p\n", 0xaaaa5555, tag1, 0x5555aaaa, tag2);
return 0;
}
#endif

View File

@ -9,6 +9,8 @@
#include <KernelExport.h>
#include "settings.h"
#include <stdio.h>
#define DEFAULT_GOOGLE_SERVER "74.125.136.105"
#define DEFAULT_MAX_VNODES 5000
char google_server[20] = DEFAULT_GOOGLE_SERVER;
@ -25,7 +27,7 @@ status_t load_settings(void)
if (!handle)
return ENOENT;
dprintf("googlefs: loaded settings\n");
fprintf(stderr, "googlefs: loaded settings\n");
val = get_driver_parameter(handle, "server", \
DEFAULT_GOOGLE_SERVER, DEFAULT_GOOGLE_SERVER);
@ -47,10 +49,10 @@ status_t load_settings(void)
sync_unlink_queries = get_driver_boolean_parameter(handle, "sync_unlink", false, true);
dprintf("googlefs: settings: server = %s\n", google_server);
dprintf("googlefs: settings: max_nodes = %" B_PRIu32 "\n", max_vnodes);
dprintf("googlefs: settings: max_results = %" B_PRIu32 " \n", max_results);
dprintf("googlefs: settings: sync_unlink = %c\n", sync_unlink_queries?'t':'f');
fprintf(stderr, "googlefs: settings: server = %s\n", google_server);
fprintf(stderr, "googlefs: settings: max_nodes = %" B_PRIu32 "\n", max_vnodes);
fprintf(stderr, "googlefs: settings: max_results = %" B_PRIu32 " \n", max_results);
fprintf(stderr, "googlefs: settings: sync_unlink = %c\n", sync_unlink_queries?'t':'f');
unload_driver_settings(handle);
return B_OK;
}

View File

@ -8,6 +8,8 @@
#include <KernelExport.h>
#include "vnidpool.h"
#include <stdio.h>
/* primary type for the bitmap */
#define BMT uint32
@ -33,14 +35,14 @@ status_t vnidpool_alloc(struct vnidpool **pool, size_t size)
p->bitmap = (BMT *)(p + 1);
p->bmsize = size;
memset(p->bitmap, 0, size / sizeof(BMT));
dprintf("vnidpool_alloc: pool @ %p, bitmap @ %p, size %ld\n", p, p->bitmap, p->bmsize);
fprintf(stderr, "vnidpool_alloc: pool @ %p, bitmap @ %p, size %ld\n", p, p->bitmap, p->bmsize);
*pool = p;
return B_OK;
}
status_t vnidpool_free(struct vnidpool *pool) {
unsigned int i;
dprintf("vnidpool_free: pool @ %p\n", pool);
fprintf(stderr, "vnidpool_free: pool @ %p\n", pool);
if (!pool)
return EINVAL;
if (LOCK(&pool->lock) < B_OK)
@ -48,7 +50,7 @@ status_t vnidpool_free(struct vnidpool *pool) {
/* make sure no vnid is left in use */
for (i = 0; i < (pool->bmsize % sizeof(BMT)); i++) {
if (pool->bitmap[i])
dprintf("WARNING: vnidpool_free called with vnids still in use!!!\n");
fprintf(stderr, "WARNING: vnidpool_free called with vnids still in use!!!\n");
//panic("vnidpool_free: vnids still in use");
}
free_lock(&pool->lock);