file_systems/googlefs: Fix warnings and enable Werror

Part of #9460

Change-Id: I1dc3271b72886ede8db3c78e39b12de873c3e8bd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4572
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
This commit is contained in:
Franck LeCodeur 2021-10-12 20:43:46 +02:00 committed by waddlesplash
parent 9a594d0a60
commit 245e831213
6 changed files with 68 additions and 85 deletions

View File

@ -682,7 +682,7 @@ rule ArchitectureSetupWarnings architecture
EnableWerror src add-ons kernel file_systems cdda ;
EnableWerror src add-ons kernel file_systems ext2 ;
# EnableWerror src add-ons kernel file_systems fat ;
# EnableWerror src add-ons kernel file_systems googlefs ;
EnableWerror src add-ons kernel file_systems googlefs ;
EnableWerror src add-ons kernel file_systems iso9660 ;
EnableWerror src add-ons kernel file_systems layers ;
# EnableWerror src add-ons kernel file_systems netfs ;

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%08lx\n", err);
dprintf("google_request: http_connect: error 0x%08" B_PRIx32 "\n", err);
if (err)
goto err_cnx;
@ -115,7 +115,7 @@ status_t google_request_process(struct google_request *req)
dprintf("google_request: final URL: %s\n", url);
err = http_get(cnx, url);
dprintf("google_request: http_get: error 0x%08lx\n", err);
dprintf("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);

View File

@ -88,7 +88,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(%ld)\n", ns->nsid));
TRACE((PFS"googlefs_publish_static_entries(%" B_PRId32 ")\n", ns->nsid));
if (!ns || !dir)
return EINVAL;
@ -113,7 +113,7 @@ static int googlefs_publish_static_entries(fs_volume *_volume)
/*
err:
TRACE((PFS"push_result_to_query: error 0x%08lx\n", err));
TRACE((PFS"push_result_to_query: error 0x%08"B_PRIx32"\n", err));
return err;
*/
}
@ -124,7 +124,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%08lx, %s, , )\n", _vol, devname, flags, parms));
TRACE((PFS "mount(%p, %s, 0x%08" B_PRIx32 ", %s, , )\n", _vol, devname, flags, parms));
/* only allow a single mount */
if (atomic_add(&refcount, 1))
@ -175,7 +175,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 %ld, root@ %p, id %Ld\n", ns, ns->nsid, root, ns->rootid));
TRACE((PFS "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 +193,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(%ld)\n", ns->nsid));
TRACE((PFS "unmount(%" B_PRId32 ")\n", ns->nsid));
err = LOCK(&ns->l);
if (err)
return err;
@ -225,7 +225,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(%ld, %Ld)\n", __FUNCTION__, ns->nsid, node->vnid));
TRACE((PFS "%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,7 +241,7 @@ 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(%ld, %Ld, %s)\n", __FUNCTION__, ns->nsid, node->vnid, reenter?"r":"!r"));
TRACE((PFS "%s(%" B_PRId32 ", %" B_PRId64 ", %s)\n", __FUNCTION__, ns->nsid, node->vnid, reenter?"r":"!r"));
if (!reenter)
err = LOCK(&ns->l);
if (err)
@ -272,7 +272,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(%ld, %Ld, %s)\n", __FUNCTION__, _volume->id, vnid, reenter?"r":"!r"));
TRACE((PFS "%s(%" B_PRId32 ", %" B_PRId64 ", %s)\n", __FUNCTION__, _volume->id, vnid, reenter?"r":"!r"));
if (!reenter)
err = LOCK(&ns->l);
if (err)
@ -294,7 +294,7 @@ 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(%ld, %Ld, %s)\n", __FUNCTION__, _volume->id, node->vnid, reenter?"r":"!r"));
TRACE((PFS "%s(%" B_PRId32 ", %" B_PRId64 ", %s)\n", __FUNCTION__, _volume->id, node->vnid, reenter?"r":"!r"));
return B_OK;
}
@ -310,7 +310,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(%ld, %Ld, )\n", ns->nsid, (int64)(node?node->vnid:-1)));
TRACE((PFS "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 +322,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(%ld, %Ld, %s)\n", ns->nsid, (int64)(base?base->vnid:-1), file));
TRACE((PFS "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 +355,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%08lx\n", err));
TRACE((PFS "walk() -> error 0x%08" B_PRIx32 "\n", err));
return err;
}
@ -365,7 +365,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(%ld, %Ld)\n", ns->nsid, node->vnid));
TRACE((PFS "opendir(%" B_PRId32 ", %" B_PRId64 ")\n", ns->nsid, node->vnid));
if (!node)
return EINVAL;
if (!S_ISDIR(node->st.st_mode))
@ -397,7 +397,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(%ld, %Ld, %p)\n", ns->nsid, node->vnid, cookie));
TRACE((PFS "closedir(%" B_PRId32 ", %" B_PRId64 ", %p)\n", ns->nsid, node->vnid, cookie));
err = LOCK(&node->l);
if (err)
return err;
@ -413,7 +413,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(%ld, %Ld)\n", ns->nsid, node->vnid));
TRACE((PFS "rewinddir(%" B_PRId32 ", %" B_PRId64 ")\n", ns->nsid, node->vnid));
cookie->dir_current = 0;
return B_OK;
}
@ -423,14 +423,13 @@ static status_t googlefs_readdir(fs_volume *_volume, fs_vnode *_node, void *_coo
fs_nspace *ns = (fs_nspace *)_volume->private_volume;
fs_node *node = (fs_node *)_node->private_node;
fs_dir_cookie *cookie = (fs_dir_cookie *)_cookie;
status_t err = B_OK;
fs_node *n = NULL;
fs_node *parent = node->parent;
int index;
TRACE((PFS "readdir(%ld, %Ld) @ %d\n", ns->nsid, node->vnid, cookie->dir_current));
TRACE((PFS "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;
err = LOCK(&node->l);
LOCK(&node->l);
if (cookie->dir_current == 0) { /* .. */
TRACE((PFS "readdir: giving ..\n"));
/* the VFS will correct that anyway */
@ -457,7 +456,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 %Ld, %s\n", n->vnid, n->name));
TRACE((PFS "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;
@ -481,7 +480,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(%ld, %Ld, %p)\n", ns->nsid, node?node->vnid:0LL, cookie));
TRACE((PFS"freedircookie(%" B_PRId32 ", %" B_PRId64 ", %p)\n", ns->nsid, node?node->vnid:(int64)0, (void *)cookie));
err = LOCK(&node->l);
if (err)
return err;
@ -536,7 +535,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(%ld, %Ld, 0x%x)\n", ns->nsid, node->vnid, omode));
TRACE((PFS"open(%" B_PRId32 ", %" B_PRId64 ", 0x%x)\n", ns->nsid, node->vnid, omode));
if (!node || !cookie)
return EINVAL;
@ -590,7 +589,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(%ld, %Ld)\n", ns->nsid, node->vnid));
TRACE((PFS"close(%" B_PRId32 ", %" B_PRId64 ")\n", ns->nsid, node->vnid));
if (!ns || !node || !cookie)
return EINVAL;
err = LOCK(&node->l);
@ -610,7 +609,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(%ld, %Ld)\n", ns->nsid, node->vnid));
TRACE((PFS"freecookie(%" B_PRId32 ", %" B_PRId64 ")\n", ns->nsid, node->vnid));
err = LOCK(&node->l);
if (err)
return err;
@ -637,8 +636,8 @@ 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(%ld, %Ld, %Ld, %ld)\n", ns->nsid, node->vnid, pos, *len));
if (pos < 0 || pos > node->data_size)
TRACE((PFS"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) {
*len = 0;
@ -652,7 +651,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(%ld, %Ld, %Ld, %ld)\n", _volume->id, node->vnid, pos, *len));
TRACE((PFS"write(%" B_PRId32 ", %" B_PRId64 ", %jd, %zu)\n", _volume->id, node->vnid, pos, *len));
*len = 0;
return ENOSYS;
}
@ -660,13 +659,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(%ld, %Ld, , 0x%08lx)\n", _volume->id, node->vnid, mask));
TRACE((PFS"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(%ld, , 0x%08lx)\n", _volume->id, mask));
TRACE((PFS"wfsstat(%" B_PRId32 ", , 0x%08" B_PRIx32 ")\n", _volume->id, mask));
return ENOSYS;
}
@ -688,7 +687,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(%ld, %Ld, '%s', 0x%08x, %c, %c)\n", ns->nsid, dir->vnid, name, omode, mkdir?'t':'f', uniq?'t':'f'));
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'));
if (strlen(name) > GOOGLEFS_NAME_LEN-1)
return ENAMETOOLONG;
@ -791,7 +790,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(%ld, %Ld, '%s', 0x%08x)\n", ns->nsid, dir->vnid, name, omode));
TRACE((PFS"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;
@ -809,8 +808,8 @@ 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(%ld, %Ld, %s)\n", ns->nsid, dir->vnid, name));
//dprintf(PFS"unlink(%ld, %Ld, %s)\n", ns->nsid, dir->vnid, name);
TRACE((PFS"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)
return err;
@ -850,7 +849,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(%ld, %Ld, %s)\n", _volume->id, dir->vnid, name));
TRACE((PFS"rmdir(%" B_PRId32 ", %" B_PRId64 ", %s)\n", _volume->id, dir->vnid, name));
return googlefs_unlink(_volume, _dir, name);
}
@ -859,7 +858,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(%ld, %Ld:%s)\n", ns->nsid, node->vnid, node->name));
TRACE((PFS"googlefs_unlink_node_rec(%" B_PRId32 ", %" B_PRId64 ":%s)\n", ns->nsid, node->vnid, node->name));
if (!ns || !node)
return EINVAL;
// kill_request();
@ -881,7 +880,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(%ld, %Ld, 0x%x)\n", ns->nsid, node->vnid, mode));
TRACE((PFS"access(%" B_PRId32 ", %" B_PRId64 ", 0x%x)\n", ns->nsid, node->vnid, mode));
return B_OK;
}
@ -896,11 +895,12 @@ static int googlefs_setflags(fs_volume *_volume, fs_vnode *_node, fs_file_cookie
static int googlefs_mkdir_gen(fs_volume *_volume, fs_vnode *_dir, const char *name, int perms, fs_node **node, bool uniq)
{
fs_nspace *ns = (fs_nspace *)_volume->private_volume;
fs_node *dir = (fs_node *)_dir->private_node;
char newname[GOOGLEFS_NAME_LEN];
status_t err;
fs_node *n;
int i;
TRACE((PFS"mkdir_gen(%ld, %Ld, '%s', 0x%08lx, %c)\n", ns->nsid, dir->vnid, name, perms, uniq?'t':'f'));
TRACE((PFS"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;
@ -940,9 +940,7 @@ static int googlefs_mkdir_gen(fs_volume *_volume, fs_vnode *_dir, const char *na
strcpy(n->name, name);
//n->is_perm = 1;
fill_default_stat(&n->st, ns->nsid, n->vnid, (perms & ~S_IFMT) | S_IFDIR);
err = new_lock(&(n->l), "googlefs dir");
if (err)
goto err_m;
new_lock(&(n->l), "googlefs dir");
err = LOCK(&ns->l);
if (err)
goto err_nl;
@ -987,7 +985,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(%ld, %Ld, '%s', 0x%08x)\n", ns->nsid, dir->vnid, name, perms));
TRACE((PFS"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);
}
@ -999,7 +997,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(%ld, %Ld)\n", ns->nsid, node->vnid));
TRACE((PFS "open_attrdir(%" B_PRId32 ", %" B_PRId64 ")\n", ns->nsid, node->vnid));
if (!node)
return EINVAL;
err = LOCK(&node->l);
@ -1028,7 +1026,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(%ld, %Ld)\n", ns->nsid, node->vnid));
TRACE((PFS "close_attrdir(%" B_PRId32 ", %" B_PRId64 ")\n", ns->nsid, node->vnid));
err = LOCK(&node->l);
if (err)
return err;
@ -1043,7 +1041,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(%ld, %Ld)\n", ns->nsid, node->vnid));
TRACE((PFS"free_attrdircookie(%" B_PRId32 ", %" B_PRId64 ")\n", ns->nsid, node->vnid));
err = LOCK(&node->l);
if (err)
return err;
@ -1058,7 +1056,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(%ld, %Ld)\n", ns->nsid, node->vnid));
TRACE((PFS "rewind_attrdir(%" B_PRId32 ", %" B_PRId64 ")\n", ns->nsid, node->vnid));
cookie->dir_current = 0;
return B_OK;
}
@ -1068,16 +1066,15 @@ static status_t googlefs_read_attrdir(fs_volume *_volume, fs_vnode *_node, void
fs_nspace *ns = (fs_nspace *)_volume->private_volume;
fs_node *node = (fs_node *)_node->private_node;
fs_file_cookie *cookie = (fs_file_cookie *)_cookie;
status_t err = B_OK;
//fs_node *n = NULL;
//fs_node *parent = node->parent;
attr_entry *ae = NULL;
int i;
int count_indirect;
TRACE((PFS "read_attrdir(%ld, %Ld) @ %d\n", ns->nsid, node->vnid, cookie->dir_current));
TRACE((PFS "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;
err = LOCK(&node->l);
LOCK(&node->l);
for (i = 0, count_indirect = 0; node->attrs_indirect && !ae && node->attrs_indirect[i].name; i++, count_indirect++)
if (i == cookie->dir_current)
ae = &node->attrs_indirect[i];
@ -1119,7 +1116,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(%ld, %Ld, %s, 0x%x)\n", ns->nsid, node->vnid, name, omode));
TRACE((PFS"open_attr(%" B_PRId32 ", %" B_PRId64 ", %s, 0x%x)\n", ns->nsid, node->vnid, name, omode));
if (!node || !name || !cookie)
return EINVAL;
@ -1177,7 +1174,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(%ld, %Ld:%s)\n", ns->nsid, node->vnid, cookie->attr?cookie->attr->name:"?"));
TRACE((PFS"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);
@ -1197,7 +1194,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(%ld, %Ld:%s)\n", ns->nsid, node->vnid, cookie->attr?cookie->attr->name:"?"));
TRACE((PFS"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;
@ -1218,7 +1215,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(%ld, %Ld:%s)\n", ns->nsid, node->vnid, ae->name));
TRACE((PFS"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));
@ -1235,13 +1232,13 @@ 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(%ld, %Ld:%s)\n", ns->nsid, node->vnid, ae->name));
TRACE((PFS"read_attr(%" B_PRId32 ", %" B_PRId64 ":%s)\n", ns->nsid, node->vnid, ae->name));
if (!node || !cookie || !len || !*len)
return EINVAL;
err = LOCK(&node->l);
if (ae && pos < ae->size) {
if (ae && (pos < 0 || (size_t)pos < ae->size)) {
memcpy(buf, (char *)ae->value + pos, MIN(*len, ae->size-pos));
*len = MIN(*len, ae->size-pos);
err = B_OK;
@ -1285,7 +1282,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(%ld, '%s', 0x%08lx, %ld, %ld)\n", ns->nsid, query, flags, port, token));
TRACE((PFS"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;
@ -1338,7 +1335,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 %ld:%Ld\n", ns->nsid, qn->vnid));
TRACE((PFS"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;
@ -1425,7 +1422,7 @@ err_qs:
free(qstring);
//err_m:
free(c);
TRACE((PFS"open_query: error 0x%08lx\n", err));
TRACE((PFS"open_query: error 0x%08" B_PRIx32 "\n", err));
return err;
}
@ -1435,7 +1432,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(%ld, %Ld)\n", ns->nsid, cookie->node?cookie->node->vnid:0LL));
TRACE((PFS"close_query(%" B_PRId32 ", %" B_PRId64 ")\n", ns->nsid, cookie->node?cookie->node->vnid:(int64)0));
//return ENOSYS;
q = cookie->node;
if (!q)
@ -1461,7 +1458,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(%ld)\n", _volume->id));
TRACE((PFS"free_query_cookie(%" B_PRId32 ")\n", _volume->id));
q = cookie->node;
if (!q)
goto no_node;
@ -1485,11 +1482,10 @@ static status_t googlefs_read_query(fs_volume *_volume, void *_cookie, struct di
{
fs_nspace *ns = (fs_nspace *)_volume->private_volume;
fs_query_cookie *cookie = (fs_query_cookie *)_cookie;
status_t err = B_OK;
fs_node *n = NULL;
fs_node *node = cookie->node;
int index;
TRACE((PFS"read_query(%ld, %Ld) @ %d\n", ns->nsid, node?node->vnid:0LL, cookie->dir_current));
TRACE((PFS"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,11 +1494,11 @@ static status_t googlefs_read_query(fs_volume *_volume, void *_cookie, struct di
return B_OK;
}
//return ENOSYS;
err = LOCK(&node->l);
LOCK(&node->l);
index = cookie->dir_current;
for (n = node->children; n && index; n = n->next, index--);
if (n) {
TRACE((PFS "read_query: giving ino %Ld, %s\n", n->vnid, n->name));
TRACE((PFS "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;
@ -1528,8 +1524,8 @@ 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(%ld, %Ld, %ld:'%s')\n", ns->nsid, qn->vnid, result->id, result->name));
//dprintf(PFS"push_result_to_query(%ld, %Ld, %d:'%s')\n", ns->nsid, qn->vnid, result->id, result->name);
TRACE((PFS"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)
return EINVAL;
@ -1601,7 +1597,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%08lx\n", err));
TRACE((PFS "push_result_to_query: error 0x%08" B_PRIx32 "\n", err));
return err;
}

View File

@ -98,7 +98,7 @@ status_t http_connect(struct http_cnx *cnx, struct sockaddr_in *sin)
}
ip = sin->sin_addr.s_addr;
port = sin->sin_port;
dprintf("http_connect(, %ld.%ld.%ld.%ld:%d), sock = %d\n", ip & 0xff, (ip >> 8) & 0xff, (ip >> 16) & 0xff, (ip >> 24) & 0xff, ntohs(port), cnx->sock);
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);
err = kconnect(cnx->sock, (struct sockaddr *)sin, sin->sin_len);
cnx->err = 0;
if (err == -1)
@ -182,7 +182,7 @@ status_t http_get(struct http_cnx *cnx, const char *url)
cnx->err = strtol(p, &p, 10);
if (cnx->err < 200 || cnx->err > 299)
goto err0;
printf("REQ: %ld\n", cnx->err);
printf("REQ: %" B_PRId32 "\n", cnx->err);
contentlen = len - headerslen;
// if (!strstr(req, "\n\n") && !strstr(req, "\r\n\r\n"))
// goto err0;

View File

@ -19,19 +19,6 @@
#include <string.h>
// ('foo'<>"bar\"")&&!(()||())
static void free_query_tree(query_exp *tree)
{
if (!tree)
return;
if (tree->op >= B_AND) {
free_query_tree(tree->lv.exp);
free_query_tree(tree->rv.exp);
}
free(tree->lv.str);
free(tree->rv.str);
free(tree);
}
char *query_unescape_string(const char *q, const char **newq, char delim)
{
int backslash = 0;

View File

@ -48,8 +48,8 @@ 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 = %lu\n", max_vnodes);
dprintf("googlefs: settings: max_results = %lu\n", max_results);
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');
unload_driver_settings(handle);
return B_OK;