
Proceedings of FREENIX Track: 2000 USENIX Annual Technical Conference San Diego, California, USA, June 18–23, 2000 U N I X F I L E S Y S T E M E X T E N S I O N S I N T H E G N O M E E N V I R O N M E N T Ettore Perazzoli THE ADVANCED COMPUTING SYSTEMS ASSOCIATION © 2000 by The USENIX Association All Rights Reserved For more information about the USENIX Association: Phone: 1 510 528 8649 FAX: 1 510 548 5738 Email: [email protected] WWW: http://www.usenix.org Rights to individual papers remain with the author or the author's employer. Permission is granted for noncommercial reproduction of the work for educational or research purposes. This copyright notice must be included in the reproduced paper. USENIX acknowledges all trademarks herein. Unix file system extensions in the GNOME environment Ettore Perazzoli Helix Code, Inc. [email protected], http://primates.helixcode.com/~ettore/ 1 Introduction files in a simple way. This paper explains how the GNOME 1.2 Representing special non-file [GNOME] project is extending the function- objects ality of the Unix file system for use in both the desktop and applications, by using a user- level library called the GNOME Virtual File Current Unix desktop environments lack a System. unified file system -like representation of the system resources. In the Windows operat- There are various reasons for extending the ing system, users can access all the system Unix file system and its API, as explained in resources from the \My Computer" folder the following sections. which acts as the root of the operating system shell's \namespace". This means that the control panel, the printer's spool, the trash- 1.1 Uniform file access can, the removeable devices and so on are all accessible through the same simple \point- and-click" mechanism within the same appli- In a modern desktop environment, users cation (Explorer.exe). Unlike the current have to deal with files that are available in Unix desktop environments, users don't need different ways. For example, files can be re- to deal with different applications for the var- motely available from a Web or FTP site. ious objects that are in their computer: they Sometimes they are stored locally, but are can just use the desktop shell. contained in tar or zip files. Sometimes they are stored in a compressed form. To implement similiar functionality on Unix, we would need to have an extensible Each of these cases usually requires the mechanism for providing the contents to these user to use a different tool; using different virtual folders and implementing operations tools means that users have to learn the user that can be performed on them. interface for each of them, and have to manu- ally make these tools talk to the applications, for example by using temporary files. 1.3 Asynchronous operation To avoid this problem, there should be a global file system namespace that all applica- On Unix, there is no API to let applica- tions can use to access these different kinds tions do fully asynchronous I/O in an easy of files. Users should not need to install and and portable way. use different programs to access files available through different methods, and all the appli- The reason why this is so important is that cations should be able to access this global GUI applications need to be responsive all the file system namespace. time. If a GUI application is blocked during a long synchronous file operation, the user So basically we need a consistent API that cannot stop the operation, nor perform any all the applications can use to access these other task with the same application. This is especially important for a file manager, 2.1 The GNU Midnight Comman- which needs to be able to perform multiple der I/O tasks in parallel without taking control away from the user. The GNU Midnight Commander is the file One of the ways of dealing with asyn- manager of choice for the GNOME project chronous I/O, i.e. using the select() sys- at the time of writing. It implements a user- tem call, does not work with all the opera- space Virtual File System library that solves tions; for example, there is no way to make the problem of accessing files within archive an asynchronous gethostbyname(), open() files or on remote Internet sites through an or stat() without complicated hacks. extended URI system which is explained in greater detail in section 4. Unix programmers could also use POSIX threads for performing asynchronous opera- Although the VFS library source code tions, but thread programming is very error- could be made independent of the GNU Mid- prone and can easily lead to problems. Writ- night Commander and thus its functionality ing a threaded application requires more pro- could be used by all the applications, it suf- gramming skills writing a non-threaded one, fers a few design problems: and in the free software world it is very im- portant to make things easy for programmers. It does not support asynchronous oper- • Moreover, POSIX threads are not fully ation: if you perform an operation on a portable across different platforms, as not all remote system, the Midnight Comman- implementations are reliable and efficient. der will be blocked until the operation is complete, and the user is not even able Finally, although a POSIX API for asyn- to stop the operation. chronous I/O exist, it is not implemented on The library is hidden under a Unix API all systems and does not work with all system • that is not very extensible. calls. For example, you cannot execute the open() nsystem call in an asynchronous fash- ion. Moreover, this API does not fit nicely in The latter problem is the most important the event-based model of GUI systems; con- one: as a Virtual File System has to deal sequently, it is not suitable for rapid develop- with kinds of files that can be quite different ment of GUI applications. from the standard Unix files, it needs some API extensions to support this functionality. What we need for asynchronous operation Moreover, it needs some API extensions to is an easy to use API that hides most of the deal with asynchronous operations. Unfortu- details from the programmer and integrates nately, it is not possible to add functionality nicely with the existing GUI toolkits. The to the API in a clean way without breaking API should give a better abstraction for doing Unix compat- ibility, so this makes the GNU async I/O, in the most simple way possible. Midnight Commander's Virtual File System unsuitable as a generic library for GNOME. 2 Existing User Space Virtual 2.2 KDE's kio File Systems The K Desktop Environment [KDE] pro- vides a completely asynchronous virtual file In the past, there have been other attempts system library called kio. to implement extensions to the Unix file sys- tem in the free software world, none of which kio uses the same extended URI syntax completely fulfilled the needs of the GNOME that the GNU Midnight Commander uses; project. but unlike the Midnight Commander, all the file operations are performed through exter- The implementation should be portable, nal helper processes (kioslaves) in an asyn- • so that making GNOME VFS a core chronous fashion. The helper process commu- component of GNOME would not re- nicates with the master process using Unix strict the availabilty of GNOME on var- domain sockets and custom protocols; the ious Unix platforms. library performs encoding/decoding of such Using GNOME VFS should not make protocols automatically and notifies the pro- • grammer using the Qt [Qt] signal system. the programmer's life harder. The asynchronous API should be simple Although this system is closer to the re- • to use, and be nicely integrated with the quirements that we have listed at the begin- standard GLIB main loop that is central ning of this paper, it is still suboptimal, for to GNOME applications. (The GLIB the following reasons: main loop is the main event-handling loop in GTK+ and GNOME applica- tions. The X main loop is nicely wrapped Operations are very simple: the API by the GLIB loop.) • allows the programmer to down- load/upload a whole file and perform Adding new access methods should be some simple file operations, but it does • possible, and programmers should not not provide all the versatility of the need to care about too many of the Unix API. details, such as asynchronous behavior. (By \access method", we mean the im- Each file operation requires an external plementation of a protocol, of a file for- • process: kio does not take advantage of mat, or any other way to retrieve, create threads. or modify a GNOME VFS file. For ex- ample, there should be an HTTP access There is no API to perform operations in method, a ZIP file access method and so • a synchronous fashion, so the program- on.) mer needs to spawn a process, request an operation and then wait for the result from it. 4 Extended URIs 3 The GNOME Virtual File The GNOME VFS uses an extension of the System traditional web Uniform Resource Identifiers (URIs) to access files, instead of the standard Unix file paths. This enables us to access dif- The solution we gave to these issues in the ferent kinds of resources in a way that is both GNOME project is in the form of a new li- generic and easy to understand for users.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages11 Page
-
File Size-