Home

This document is a cache from http://www.nobius.org/~dbg/practical-file-system-design.pdf


Practical File System Design

Document source : www.nobius.org


1 0 . 5
T H E N O D E M O N I T O R
181
the presence of an index without having to iterate through the whole index
directory.
Query Operations
The last group of vnode operations relates to queries. The vnode layer
supports a simple API that allows programs to issue queries about the files
on a file system. The result of a query is a list of files that match the query.
For a file system to implement queries, it must implement these operations:
op_open_query
(*open_query);
op_close_query
(*close_query);
op_free_cookie
(*free_querycookie);
op_read_query
(*read_query);
Again, there is a very close resemblance to the normal directory routines,
which makes sense since both queries and directories contain a list of files.
The rewind function is not present as we felt it added little to the function-
ality of the API and could potentially be difficult to implement in some file
systems.
The
open query()
routine accepts a query string that it must parse, and it
creates a cookie that it uses to maintain state. The choice to pass a string to
open query()
deserves closer examination. By passing a string to a file system
routine, file systems wishing to implement the query API need to implement
a parser. For example, BFS has a full recursive descent parser and builds a
complete parse tree of the query. String manipulation and parse trees are
usually the domain of compilers running at the user level, not something
typically done in kernel space. The alternative, however, is even less ap-
pealing. Instead of passing a string to
open query()
, the parsing could have
been done in a library at user level, and a complete data structure passed
to the kernel. This is even less appealing than passing a string because the
kernel would have to validate the entire data structure before touching it (to
avoid bad pointers, etc.). Further, a fixed parse tree data structure would re-
quire more work to extend and could pose binary compatibility problems if
changes were needed. Although it does require a fair amount of code to parse
the query language string, the alternatives are even less appealing.
The core of the query routines is
read query()
. This function iterates
through the results of a query, returning each one in succession. At the vnode
layer there is little that differentiates
read query()
from a
readdir()
call, but
internally a file system has quite a bit of work to do to complete the call.
10.5
The Node Monitor
The BeOS vnode layer also supports an API to monitor modifications made
to files and directories. This API is collectively known as the node monitor
Practical File System Design:The Be File System
, Dominic Giampaolo
page 181







Summary :

The vnode layer supports a simple API that allows programs to issue queries about the files on a file system. The result of a query is a list of files that match the query. By passing a string to a file system routine, file systems wishing to implement the query API need to implement a parser. This API is collectively known as the node monitor Practical File System Design:The Be File System , Dominic Giampaolo page 181


Tags : file,string,system,node,implement,parse,api,queries,files,complete,passing,data,function





Terms    |    Link pdf-search-files.com    |    Site Map
   |    Content Removal Notice   
   |    Contact   

All books are the property of their respective owners.
Please respect the publisher and the author for their creations if their books copyrighted