diff options
author | Moritz Schulte <moritz@duesseldorf.ccc.de> | 2002-10-19 12:04:42 +0000 |
---|---|---|
committer | Moritz Schulte <moritz@duesseldorf.ccc.de> | 2002-10-19 12:04:42 +0000 |
commit | ff0f5a422aae574c864c38b10185258192a230b2 (patch) | |
tree | 46bd0b9f90b973e92d3473cffd63b5938352fdd4 | |
parent | 79c2c62389a1b99cb301391834ef807b57ea57ee (diff) |
2002-10-19 Moritz Schulte <moritz@duesseldorf.ccc.de>
* netio.h (NETIO_VERSION): Set to "0.2".
2002-10-19 Moritz Schulte <moritz@duesseldorf.ccc.de>
* main.c (main): Initialize stat_default.
* node.c: New variable: struct stat stat_default.
(node_make_new): Initialize (*node)->nn_stat with stat_default.
* node.c (node_make_protocol_node): Remove unnecessary nn_stat
initialization.
(node_make_host_node): Likewise.
(node_make_port_node): Likewise.
* main.c: New variable: int fsid ...
(main): ... initialized with getpid ().
2002-10-16 Moritz Schulte <moritz@duesseldorf.ccc.de>
* main.c: (main): Set netfs_root_node->nn_stat.st_fsid after
netfs_root_node->nn_stat is initialized.
* Makefile (CFLAGS): Added -D_FILE_OFFSET_BITS=64.
-rw-r--r-- | ChangeLog | 27 | ||||
-rw-r--r-- | main.c | 30 | ||||
-rw-r--r-- | netio.h | 2 | ||||
-rw-r--r-- | node.c | 26 |
4 files changed, 59 insertions, 26 deletions
@@ -1,4 +1,29 @@ +2002-10-19 Moritz Schulte <moritz@duesseldorf.ccc.de> + + * netio.h (NETIO_VERSION): Set to "0.2". + +2002-10-19 Moritz Schulte <moritz@duesseldorf.ccc.de> + + * main.c (main): Initialize stat_default. + + * node.c: New variable: struct stat stat_default. + (node_make_new): Initialize (*node)->nn_stat with stat_default. + + * node.c (node_make_protocol_node): Remove unnecessary nn_stat + initialization. + (node_make_host_node): Likewise. + (node_make_port_node): Likewise. + + * main.c: New variable: int fsid ... + (main): ... initialized with getpid (). + +2002-10-16 Moritz Schulte <moritz@duesseldorf.ccc.de> + + * main.c: (main): Set netfs_root_node->nn_stat.st_fsid after + netfs_root_node->nn_stat is initialized. + + * Makefile (CFLAGS): Added -D_FILE_OFFSET_BITS=64. + 2002-05-27 Moritz Schulte <moritz@duesseldorf.ccc.de> * main.c (netfs_server_name, netfs_server_version): New variables. - @@ -33,12 +33,13 @@ #include "version.h" +char *netfs_server_name = "netio"; +char *netfs_server_version = HURD_VERSION; + const char *argp_program_version = STANDARD_HURD_VERSION (netio); const char *argp_program_bug_address = "Moritz Schulte <moritz@duesseldorf.ccc.de>"; const char *doc = "Hurd netio translator v" NETIO_VERSION; -char *netfs_server_name = "netio"; -char *netfs_server_version = HURD_VERSION; /* The underlying node. */ mach_port_t ul_node; @@ -49,6 +50,9 @@ pf_t socket_server; /* Has to be defined for libnetfs... */ int netfs_maxsymlinks = 0; +/* Our filesystem id - will be our pid. */ +int fsid = 0; + /* Used for updating node information. */ volatile struct mapped_time_value *netio_maptime; @@ -73,6 +77,7 @@ main (int argc, char **argv) NULL, doc, NULL }; mach_port_t bootstrap_port; error_t err; + extern struct stat stat_default; argp_parse (&netio_argp, argc, argv, 0, 0, 0); task_get_bootstrap_port (mach_task_self (), &bootstrap_port); @@ -82,15 +87,16 @@ main (int argc, char **argv) err = node_make_root_node (&netfs_root_node); if (err) error (EXIT_FAILURE, err, "cannot create root node"); - + fsid = getpid (); + { /* Here we adjust the root node permissions. */ struct stat ul_node_stat; err = io_stat (ul_node, &ul_node_stat); if (err) error (EXIT_FAILURE, err, "cannot stat underlying node"); - netfs_root_node->nn_stat.st_fsid = getpid (); netfs_root_node->nn_stat = ul_node_stat; + netfs_root_node->nn_stat.st_fsid = fsid; netfs_root_node->nn_stat.st_mode = S_IFDIR | (ul_node_stat.st_mode & ~S_IFMT & ~S_ITRANS); @@ -115,6 +121,22 @@ main (int argc, char **argv) TOUCH_ATIME|TOUCH_MTIME|TOUCH_CTIME, netio_maptime); + /* Here we initialize the default stat information for netio + nodes. */ + stat_default.st_fstype = FSTYPE_MISC; + stat_default.st_fsid = fsid; + stat_default.st_ino = 1; /* ? */ + stat_default.st_gen = 0; + stat_default.st_rdev = 0; + stat_default.st_mode = 0; + stat_default.st_nlink = 0; + stat_default.st_uid = netfs_root_node->nn_stat.st_uid; + stat_default.st_gid = netfs_root_node->nn_stat.st_gid; + stat_default.st_size = 0; + stat_default.st_blksize = 0; + stat_default.st_blocks = 0; + stat_default.st_author = netfs_root_node->nn_stat.st_author; + err = open_socket_server (PF_INET, &socket_server); if (err) error (EXIT_FAILURE, err, "open_socket_server"); @@ -20,7 +20,7 @@ #include <stdint.h> #include <maptime.h> -#define NETIO_VERSION "0.1" +#define NETIO_VERSION "0.2" #define OPENONLY_STATE_MODES (O_CREAT|O_EXCL|O_NOLINK|O_NOTRANS|O_NONBLOCK) @@ -24,6 +24,9 @@ #include "netio.h" #include "lib.h" +/* The default stat information for netio nodes. */ +struct stat stat_default; + /* Create a new node in the directory *DIR (if DIR is nonzero) and store it in *NODE. If CONNECT is true (in which case *DIR has to be a valid directory node), attach the new node to the list of @@ -52,6 +55,8 @@ node_make_new (struct node *dir, int connect, struct node **node) (*node)->nn->connected = 0; (*node)->nn->entries = 0; (*node)->nn->dir = dir; + (*node)->nn_stat = stat_default; + if (dir) netfs_nref (dir); @@ -116,12 +121,7 @@ node_make_protocol_node (struct node *dir, struct protocol *protocol) | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; node->nn_stat.st_ino = protocol->id; - node->nn_stat.st_dev = netfs_root_node->nn_stat.st_dev; - node->nn_stat.st_uid = netfs_root_node->nn_stat.st_uid; - node->nn_stat.st_gid = netfs_root_node->nn_stat.st_gid; - node->nn_stat.st_size = 0; /* ? */ - node->nn_stat.st_blocks = 0; - node->nn_stat.st_blksize = 0; + node->nn_stat.st_nlink = 2; fshelp_touch (&node->nn_stat, TOUCH_ATIME | TOUCH_CTIME | TOUCH_MTIME, netio_maptime); return err; @@ -148,13 +148,6 @@ node_make_host_node (struct iouser *user, struct node *dir, char *host, np->nn->flags |= HOST_NODE; np->nn->protocol = dir->nn->protocol; np->nn_stat.st_mode = S_IFDIR | S_IRUSR | S_IXUSR ; - np->nn_stat.st_ino = 1; /* ? */ - np->nn_stat.st_dev = netfs_root_node->nn_stat.st_dev; - np->nn_stat.st_uid = *user->uids->ids; - np->nn_stat.st_gid = *user->gids->ids; - np->nn_stat.st_size = 0; /* ? */ - np->nn_stat.st_blocks = 0; - np->nn_stat.st_blksize = 0; fshelp_touch (&np->nn_stat, TOUCH_ATIME | TOUCH_CTIME | TOUCH_MTIME, netio_maptime); *node = np; @@ -181,13 +174,6 @@ node_make_port_node (struct iouser *user, struct node *dir, np->nn->flags |= HOST_NODE; np->nn->protocol = dir->nn->protocol; np->nn_stat.st_mode = S_IFSOCK | S_IRUSR | S_IWUSR ; - np->nn_stat.st_ino = 1; /* ? */ - np->nn_stat.st_dev = netfs_root_node->nn_stat.st_dev; - np->nn_stat.st_uid = *user->uids->ids; - np->nn_stat.st_gid = *user->gids->ids; - np->nn_stat.st_size = 0; /* ? */ - np->nn_stat.st_blocks = 0; - np->nn_stat.st_blksize = 0; fshelp_touch (&np->nn_stat, TOUCH_ATIME | TOUCH_CTIME | TOUCH_MTIME, netio_maptime); *node = np; |