Reenabled query support for the Haiku kernel.
Implemented bfs_rewind_query(). git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10405 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1900,25 +1900,24 @@ bfs_stat_index(fs_volume _fs, const char *name, struct stat *stat)
|
|||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
// Query functions
|
// Query functions
|
||||||
|
|
||||||
#if 0
|
|
||||||
static status_t
|
static status_t
|
||||||
bfs_open_query(void *_ns, const char *queryString, ulong flags, port_id port,
|
bfs_open_query(void *_fs, const char *queryString, uint32 flags, port_id port,
|
||||||
long token, void **cookie)
|
uint32 token, void **_cookie)
|
||||||
{
|
{
|
||||||
FUNCTION();
|
FUNCTION_START(("bfs_open_query(\"%s\", flags = %lu, port_id = %ld, token = %ld)\n",
|
||||||
if (_ns == NULL || queryString == NULL || cookie == NULL)
|
queryString, flags, port, token));
|
||||||
RETURN_ERROR(B_BAD_VALUE);
|
|
||||||
|
|
||||||
PRINT(("query = \"%s\", flags = %lu, port_id = %ld, token = %ld\n", queryString, flags, port, token));
|
Volume *volume = (Volume *)_fs;
|
||||||
|
|
||||||
Volume *volume = (Volume *)_ns;
|
|
||||||
|
|
||||||
Expression *expression = new Expression((char *)queryString);
|
Expression *expression = new Expression((char *)queryString);
|
||||||
if (expression == NULL)
|
if (expression == NULL)
|
||||||
RETURN_ERROR(B_NO_MEMORY);
|
RETURN_ERROR(B_NO_MEMORY);
|
||||||
|
|
||||||
if (expression->InitCheck() < B_OK) {
|
if (expression->InitCheck() < B_OK) {
|
||||||
FATAL(("Could not parse query, stopped at: \"%s\"\n", expression->Position()));
|
INFORM(("Could not parse query \"%s\", stopped at: \"%s\"\n",
|
||||||
|
queryString, expression->Position()));
|
||||||
|
|
||||||
delete expression;
|
delete expression;
|
||||||
RETURN_ERROR(B_BAD_VALUE);
|
RETURN_ERROR(B_BAD_VALUE);
|
||||||
}
|
}
|
||||||
@@ -1932,14 +1931,14 @@ bfs_open_query(void *_ns, const char *queryString, ulong flags, port_id port,
|
|||||||
if (flags & B_LIVE_QUERY)
|
if (flags & B_LIVE_QUERY)
|
||||||
query->SetLiveMode(port, token);
|
query->SetLiveMode(port, token);
|
||||||
|
|
||||||
*cookie = (void *)query;
|
*_cookie = (void *)query;
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
bfs_close_query(void *ns, void *cookie)
|
bfs_close_query(void *fs, void *cookie)
|
||||||
{
|
{
|
||||||
FUNCTION();
|
FUNCTION();
|
||||||
return B_OK;
|
return B_OK;
|
||||||
@@ -1947,7 +1946,7 @@ bfs_close_query(void *ns, void *cookie)
|
|||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
bfs_free_query_cookie(void *ns, void *node, void *cookie)
|
bfs_free_query_cookie(void *fs, void *cookie)
|
||||||
{
|
{
|
||||||
FUNCTION();
|
FUNCTION();
|
||||||
if (cookie == NULL)
|
if (cookie == NULL)
|
||||||
@@ -1963,7 +1962,7 @@ bfs_free_query_cookie(void *ns, void *node, void *cookie)
|
|||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
bfs_read_query(void */*ns*/, void *cookie, long *num, struct dirent *dirent, size_t bufferSize)
|
bfs_read_query(void */*fs*/, void *cookie, struct dirent *dirent, size_t bufferSize, uint32 *_num)
|
||||||
{
|
{
|
||||||
FUNCTION();
|
FUNCTION();
|
||||||
Query *query = (Query *)cookie;
|
Query *query = (Query *)cookie;
|
||||||
@@ -1972,15 +1971,27 @@ bfs_read_query(void */*ns*/, void *cookie, long *num, struct dirent *dirent, siz
|
|||||||
|
|
||||||
status_t status = query->GetNextEntry(dirent, bufferSize);
|
status_t status = query->GetNextEntry(dirent, bufferSize);
|
||||||
if (status == B_OK)
|
if (status == B_OK)
|
||||||
*num = 1;
|
*_num = 1;
|
||||||
else if (status == B_ENTRY_NOT_FOUND)
|
else if (status == B_ENTRY_NOT_FOUND)
|
||||||
*num = 0;
|
*_num = 0;
|
||||||
else
|
else
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
static status_t
|
||||||
|
bfs_rewind_query(void */*fs*/, void *cookie)
|
||||||
|
{
|
||||||
|
FUNCTION();
|
||||||
|
Query *query = (Query *)cookie;
|
||||||
|
if (query == NULL)
|
||||||
|
RETURN_ERROR(B_BAD_VALUE);
|
||||||
|
|
||||||
|
return query->Rewind();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
@@ -2096,14 +2107,13 @@ static file_system_info sBeFileSystem = {
|
|||||||
&bfs_create_index,
|
&bfs_create_index,
|
||||||
&bfs_remove_index,
|
&bfs_remove_index,
|
||||||
&bfs_stat_index,
|
&bfs_stat_index,
|
||||||
#if 0
|
|
||||||
/* query operations */
|
/* query operations */
|
||||||
&bfs_open_query, // open query
|
&bfs_open_query,
|
||||||
&bfs_close_query, // close query
|
&bfs_close_query,
|
||||||
&bfs_free_query_cookie, // free query cookie
|
&bfs_free_query_cookie,
|
||||||
&bfs_read_query, // read query
|
&bfs_read_query,
|
||||||
#endif
|
&bfs_rewind_query,
|
||||||
NULL,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern module_info gDiskDeviceInfo;
|
extern module_info gDiskDeviceInfo;
|
||||||
|
|||||||
Reference in New Issue
Block a user