From 823053ec9f580c44aea57ca473a86452e7e332a7 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 31 Jan 2003 18:41:20 +0000 Subject: Initial commit of a libnetfs-based tarfs including a gzip/bzip2 store. --- main.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 main.c (limited to 'main.c') diff --git a/main.c b/main.c new file mode 100644 index 000000000..91b1fcbc4 --- /dev/null +++ b/main.c @@ -0,0 +1,76 @@ +/* tarfs - A GNU tar filesystem for the Hurd. + Copyright (C) 2002, Ludovic Courtès + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or * (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + USA */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "backend.h" + +/* Choose the right backend here. */ +extern struct fs_backend tarfs_backend; +struct fs_backend backend; + +/* The underlying node. */ +mach_port_t ul_node; + +/* Has to be defined for libnetfs... */ +int netfs_maxsymlinks = 2; + +/* Main. */ +int +main (int argc, char **argv) +{ + struct argp fs_argp; + mach_port_t bootstrap_port; + struct iouser *user; + error_t err; + + /* Defaults to tarfs. */ + backend = tarfs_backend; + + backend.get_argp (&fs_argp); + argp_parse (&fs_argp, argc, argv, 0, 0, 0); + + task_get_bootstrap_port (mach_task_self (), &bootstrap_port); + + /* Init netfs, the root_node and the backend, */ + netfs_init (); + err = iohelp_create_simple_iouser (&user, getuid (), getgid ()); + if (err) + error (1, err, "Cannot create iouser"); + + err = backend.init (&netfs_root_node, user); + if (err) + error (EXIT_FAILURE, err, "cannot create root node"); + ul_node = netfs_startup (bootstrap_port, 0); + + for (;;) + netfs_server_loop (); + + /* Never reached. */ + exit (0); +} -- cgit v1.2.3