diff options
12 files changed, 1094 insertions, 0 deletions
diff --git a/debian/patches/0001-include-install-refcount.h.patch b/debian/patches/0001-include-install-refcount.h.patch new file mode 100644 index 00000000..6468f6a4 --- /dev/null +++ b/debian/patches/0001-include-install-refcount.h.patch @@ -0,0 +1,26 @@ +From b793108b09138edf0a963d9e3107eb400ee27011 Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Thu, 22 May 2014 20:04:33 +0200 +Subject: [PATCH 01/11] include: install refcount.h + +* include/Makefile (installhdrs): Add refcount.h. +--- + include/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/Makefile b/include/Makefile +index b8773fe..4de165d 100644 +--- a/include/Makefile ++++ b/include/Makefile +@@ -22,7 +22,7 @@ + dir := include + makemode := misc + +-installhdrs := sys/procfs.h ++installhdrs := sys/procfs.h refcount.h + + include ../Makeconf + +-- +2.0.0.rc2 + diff --git a/debian/patches/0002-exec-add-missing-includes.patch b/debian/patches/0002-exec-add-missing-includes.patch new file mode 100644 index 00000000..42ee2243 --- /dev/null +++ b/debian/patches/0002-exec-add-missing-includes.patch @@ -0,0 +1,39 @@ +From 8ff385da583ca493d80b688a277d3bbd16698f23 Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Tue, 20 May 2014 16:02:59 +0200 +Subject: [PATCH 02/11] exec: add missing includes + +* exec/exec.c: Include mach/gnumach.h. +* exec/main.c: Include device/device.h. +--- + exec/exec.c | 1 + + exec/main.c | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/exec/exec.c b/exec/exec.c +index b068f5e..2fc1e44 100644 +--- a/exec/exec.c ++++ b/exec/exec.c +@@ -24,6 +24,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + + + #include "priv.h" ++#include <mach/gnumach.h> + #include <hurd.h> + #include <hurd/exec.h> + #include <sys/stat.h> +diff --git a/exec/main.c b/exec/main.c +index 27f33b1..78faebd 100644 +--- a/exec/main.c ++++ b/exec/main.c +@@ -21,6 +21,7 @@ + + #include "priv.h" + #include <error.h> ++#include <device/device.h> + #include <hurd/paths.h> + #include <hurd/startup.h> + #include <argp.h> +-- +2.0.0.rc2 + diff --git a/debian/patches/0003-pfinet-add-missing-include.patch b/debian/patches/0003-pfinet-add-missing-include.patch new file mode 100644 index 00000000..d8f5cc23 --- /dev/null +++ b/debian/patches/0003-pfinet-add-missing-include.patch @@ -0,0 +1,26 @@ +From 7d7a72915d923767f680efb7466ce0c48c78007c Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Thu, 22 May 2014 20:14:02 +0200 +Subject: [PATCH 03/11] pfinet: add missing include + +* pfinet/linux-src/include/net/addrconf.h: Include ipv6.h. +--- + pfinet/linux-src/include/net/addrconf.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/pfinet/linux-src/include/net/addrconf.h b/pfinet/linux-src/include/net/addrconf.h +index d711d0d..4b27077 100644 +--- a/pfinet/linux-src/include/net/addrconf.h ++++ b/pfinet/linux-src/include/net/addrconf.h +@@ -1,6 +1,8 @@ + #ifndef _ADDRCONF_H + #define _ADDRCONF_H + ++#include "ipv6.h" ++ + #define RETRANS_TIMER HZ + + #define MAX_RTR_SOLICITATIONS 3 +-- +2.0.0.rc2 + diff --git a/debian/patches/0004-term-fix-memory-leak.patch b/debian/patches/0004-term-fix-memory-leak.patch new file mode 100644 index 00000000..9c7b89b8 --- /dev/null +++ b/debian/patches/0004-term-fix-memory-leak.patch @@ -0,0 +1,30 @@ +From 4aaa192400ad02b5c1540b505e3d406d4878c247 Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Tue, 20 May 2014 16:17:17 +0200 +Subject: [PATCH 04/11] term: fix memory leak + +I hope someone fixed that bug. + +* term/users.c (pi_destroy_hook): Fix memory leak. +--- + term/users.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/term/users.c b/term/users.c +index 97bc22c..9bd51d0 100644 +--- a/term/users.c ++++ b/term/users.c +@@ -259,9 +259,7 @@ pi_destroy_hook (struct trivfs_protid *cred) + { + assert (((struct protid_hook *)cred->hook)->refcnt > 0); + if (--((struct protid_hook *)cred->hook)->refcnt == 0) +- /* XXX don't free for now, so we can try and catch a multiple-freeing +- bug. */ +- /* free (cred->hook) */; ++ free (cred->hook); + } + pthread_mutex_unlock (&global_lock); + } +-- +2.0.0.rc2 + diff --git a/debian/patches/0005-libdiskfs-fix-type-of-dir_cache_id-node_cache_id.patch b/debian/patches/0005-libdiskfs-fix-type-of-dir_cache_id-node_cache_id.patch new file mode 100644 index 00000000..9f2442aa --- /dev/null +++ b/debian/patches/0005-libdiskfs-fix-type-of-dir_cache_id-node_cache_id.patch @@ -0,0 +1,27 @@ +From e83ff31b7cb747543593be87781e270f8898a848 Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Wed, 21 May 2014 13:20:29 +0200 +Subject: [PATCH 05/11] libdiskfs: fix type of dir_cache_id, node_cache_id + +* libdiskfs/name-cache.c (struct lookup_cache): Fix type of +dir_cache_id, node_cache_id. +--- + libdiskfs/name-cache.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libdiskfs/name-cache.c b/libdiskfs/name-cache.c +index 8424ffe..c113692 100644 +--- a/libdiskfs/name-cache.c ++++ b/libdiskfs/name-cache.c +@@ -37,7 +37,7 @@ struct lookup_cache + /* Used to indentify nodes to the fs dependent code. 0 for NODE_CACHE_ID + means a `negative' entry -- recording that there's definitely no node with + this name. */ +- int dir_cache_id, node_cache_id; ++ ino64_t dir_cache_id, node_cache_id; + + /* Name of the node NODE_CACHE_ID in the directory DIR_CACHE_ID. Entries + with names too long to fit in this buffer aren't cached at all. */ +-- +2.0.0.rc2 + diff --git a/debian/patches/0006-libstore-provide-function-declaration-until-availabl.patch b/debian/patches/0006-libstore-provide-function-declaration-until-availabl.patch new file mode 100644 index 00000000..432fc4b8 --- /dev/null +++ b/debian/patches/0006-libstore-provide-function-declaration-until-availabl.patch @@ -0,0 +1,38 @@ +From 7afcd582f075d0c95ca0822006cff49c89e90e77 Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Wed, 21 May 2014 13:30:24 +0200 +Subject: [PATCH 06/11] libstore: provide function declaration until available + upstream + +Until the Hurd specific header is available, provide a local +declaration of ped_device_new_from_store. + +* libstore/part.c (ped_device_new_from_store): New declaration. +--- + libstore/part.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/libstore/part.c b/libstore/part.c +index 56e904e..fb7f07e 100644 +--- a/libstore/part.c ++++ b/libstore/part.c +@@ -26,6 +26,16 @@ + + #include <parted/parted.h> + /*#include <parted/device_gnu.h>*/ ++ ++/* XXX Until the Hurd specific header is available, provide the ++ declaration of ped_device_new_from_store here. */ ++ ++/* Initialize a PedDevice using SOURCE. The SOURCE will NOT be destroyed; ++ the caller created it, it is the caller's responsilbility to free it ++ after it calls ped_device_destory. SOURCE is not registered in Parted's ++ list of devices. */ ++PedDevice* ped_device_new_from_store (struct store *source); ++ + #include <string.h> + #include <error.h> + +-- +2.0.0.rc2 + diff --git a/debian/patches/0007-Avoid-compiler-warning-about-empty-bodies.patch b/debian/patches/0007-Avoid-compiler-warning-about-empty-bodies.patch new file mode 100644 index 00000000..2add8b6d --- /dev/null +++ b/debian/patches/0007-Avoid-compiler-warning-about-empty-bodies.patch @@ -0,0 +1,120 @@ +From 4b90feece926c69d1dbecb673c71cabb00378f87 Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Tue, 20 May 2014 16:07:44 +0200 +Subject: [PATCH 07/11] Avoid compiler warning about empty bodies + +Make empty bodies of control flow statements more explicit. Doing so +will allow us to use stricter compiler settings. This would have +cought 4ece292c. + +* console-client/xkb/xkb.c: Make empty bodies more explicit +* libpipe/pipe.c: Likewise. +* mach-defpager/default_pager.c: Likewise. +* pfinet/linux-src/net/ipv4/fib_hash.c: Likewise. +* pflocal/connq.c: Likewise. +* pflocal/socket.c: Likewise. +--- + console-client/xkb/xkb.c | 3 ++- + libpipe/pipe.c | 4 +++- + mach-defpager/default_pager.c | 4 ++-- + pfinet/linux-src/net/ipv4/fib_hash.c | 2 +- + pflocal/connq.c | 2 +- + pflocal/socket.c | 4 +++- + 6 files changed, 12 insertions(+), 7 deletions(-) + +diff --git a/console-client/xkb/xkb.c b/console-client/xkb/xkb.c +index 0b43913..220701b 100644 +--- a/console-client/xkb/xkb.c ++++ b/console-client/xkb/xkb.c +@@ -606,10 +606,11 @@ clearcontrols (keypress_t key, boolctrls ctrls, int flags) + static void + lockcontrols (keypress_t key, boolctrls ctrls, int flags) + { ++ /* XXX this needs a closer look. */ + if (!key.rel) + { + //setcontrols (key, boolctrls, flags); +- if (!(flags & noLock)); ++ //if (!(flags & noLock)); + // lboolctrls |= boolctrls; + } + else +diff --git a/libpipe/pipe.c b/libpipe/pipe.c +index 1080b5d..f9300e7 100644 +--- a/libpipe/pipe.c ++++ b/libpipe/pipe.c +@@ -352,7 +352,9 @@ pipe_send (struct pipe *pipe, int noblock, void *source, + if (!err) + err = packet_set_ports (control_packet, ports, num_ports); + if (err) +- /* Trash CONTROL_PACKET somehow XXX */; ++ { ++ /* Trash CONTROL_PACKET somehow XXX */ ++ } + } + } + +diff --git a/mach-defpager/default_pager.c b/mach-defpager/default_pager.c +index f514ea6..380c724 100644 +--- a/mach-defpager/default_pager.c ++++ b/mach-defpager/default_pager.c +@@ -88,13 +88,13 @@ synchronized_printf (const char *fmt, ...) + #if 0 + #define dprintf(f, x...) synchronized_printf (f, ##x) + #else +-#define dprintf(f, x...) ++#define dprintf(f, x...) (void) 0 + #endif + + #if 0 + #define ddprintf(f, x...) synchronized_printf (f, ##x) + #else +-#define ddprintf(f, x...) ++#define ddprintf(f, x...) (void) 0 + #endif + + /* +diff --git a/pfinet/linux-src/net/ipv4/fib_hash.c b/pfinet/linux-src/net/ipv4/fib_hash.c +index d9e029c..e3987ea 100644 +--- a/pfinet/linux-src/net/ipv4/fib_hash.c ++++ b/pfinet/linux-src/net/ipv4/fib_hash.c +@@ -406,7 +406,7 @@ static void rtmsg_fib(int, struct fib_node*, int, int, + struct nlmsghdr *n, + struct netlink_skb_parms *); + #else +-#define rtmsg_fib(a, b, c, d, e, f) ++#define rtmsg_fib(a, b, c, d, e, f) (void) 0 + #endif + + +diff --git a/pflocal/connq.c b/pflocal/connq.c +index d88711e..d86f9a2 100644 +--- a/pflocal/connq.c ++++ b/pflocal/connq.c +@@ -212,7 +212,7 @@ connq_listen (struct connq *cq, struct timespec *tsp, struct sock **sock) + request and another listener (should) eventually come along. + (In fact it is very probably as the caller has likely done a + select and will now follow up with an accept.) */ +- ; ++ { /* Do nothing. */ } + + out: + pthread_mutex_unlock (&cq->lock); +diff --git a/pflocal/socket.c b/pflocal/socket.c +index 7142c6e..792c637 100644 +--- a/pflocal/socket.c ++++ b/pflocal/socket.c +@@ -198,7 +198,9 @@ S_socket_accept (struct sock_user *user, + ports_port_deref (peer_addr); + } + else +- /* TEAR DOWN THE CONNECTION XXX */; ++ { ++ /* TEAR DOWN THE CONNECTION XXX */ ++ } + } + } + +-- +2.0.0.rc2 + diff --git a/debian/patches/0008-libdiskfs-add-diskfs_make_node_alloc-to-allocate-fat.patch b/debian/patches/0008-libdiskfs-add-diskfs_make_node_alloc-to-allocate-fat.patch new file mode 100644 index 00000000..87725904 --- /dev/null +++ b/debian/patches/0008-libdiskfs-add-diskfs_make_node_alloc-to-allocate-fat.patch @@ -0,0 +1,126 @@ +From d8c082cdb15d33845cdc2c495469a7cc6aa01d9e Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Fri, 16 May 2014 23:06:33 +0200 +Subject: [PATCH 08/11] libdiskfs: add diskfs_make_node_alloc to allocate fat + nodes + +libdiskfs has two kind of nodes, struct node and struct netnode. +struct node is used to store libdiskfs specific data, while struct +netnode contains user supplied data. Previously, both objects were +allocated separatly, and a pointer from the node to the netnode +provided a mapping from the former to the latter. + +Provide a function diskfs_make_node_alloc that allocates both nodes in +a contiguous region. + +This reduces the memory allocation overhead when creating nodes. It +also makes the relation between node and netnode a simple offset +calculation. Provide two functions to compute the netnode address +from the node address and vice-versa. + +Most notably, this makes implementing a cache on top of libdiskfs +easier. Auxiliary data for the cache can be stored in the +user-defined netnode, and the fat node can be used as the value. + +* libdiskfs/node-make.c (init_node): Move initialization here. +(diskfs_make_node): Use init_node. +(diskfs_make_node_alloc): New function to allocate fat nodes. +* libdiskfs/diskfs.h (diskfs_make_node_alloc): New declaration. +(diskfs_node_netnode): Compute netnode address from node address. +(diskfs_netnode_node): And vice-versa. +--- + libdiskfs/diskfs.h | 22 ++++++++++++++++++++++ + libdiskfs/node-make.c | 39 ++++++++++++++++++++++++++++++--------- + 2 files changed, 52 insertions(+), 9 deletions(-) + +diff --git a/libdiskfs/diskfs.h b/libdiskfs/diskfs.h +index 8151ddc..f710d10 100644 +--- a/libdiskfs/diskfs.h ++++ b/libdiskfs/diskfs.h +@@ -685,6 +685,28 @@ diskfs_notice_filechange (struct node *np, enum file_changed_type type, + The new node will have one hard reference and no light references. */ + struct node *diskfs_make_node (struct disknode *dn); + ++/* Create a new node structure. Also allocate SIZE bytes for the ++ disknode. The address of the disknode can be obtained using ++ diskfs_node_disknode. The new node will have one hard reference ++ and no light references. */ ++struct node *diskfs_make_node_alloc (size_t size); ++ ++/* Return the address of the disknode for NODE. NODE must have been ++ allocated using diskfs_make_node_alloc. */ ++static inline struct disknode * ++diskfs_node_disknode (struct node *node) ++{ ++ return (struct disknode *) ((char *) node + sizeof (struct node)); ++} ++ ++/* Return the address of the node for DISKNODE. DISKNODE must have ++ been allocated using diskfs_make_node_alloc. */ ++static inline struct node * ++diskfs_disknode_node (struct disknode *disknode) ++{ ++ return (struct node *) ((char *) disknode - sizeof (struct node)); ++} ++ + + /* The library also exports the following functions; they are not generally + useful unless you are redefining other functions the library provides. */ +diff --git a/libdiskfs/node-make.c b/libdiskfs/node-make.c +index 2b6ef2a..ff0cc0d 100644 +--- a/libdiskfs/node-make.c ++++ b/libdiskfs/node-make.c +@@ -19,16 +19,9 @@ + #include <fcntl.h> + + +-/* Create a and return new node structure with DN as its physical disknode. +- The node will have one hard reference and no light references. */ +-struct node * +-diskfs_make_node (struct disknode *dn) ++static struct node * ++init_node (struct node *np, struct disknode *dn) + { +- struct node *np = malloc (sizeof (struct node)); +- +- if (np == 0) +- return 0; +- + np->dn = dn; + np->dn_set_ctime = 0; + np->dn_set_atime = 0; +@@ -52,3 +45,31 @@ diskfs_make_node (struct disknode *dn) + + return np; + } ++ ++/* Create a and return new node structure with DN as its physical disknode. ++ The node will have one hard reference and no light references. */ ++struct node * ++diskfs_make_node (struct disknode *dn) ++{ ++ struct node *np = malloc (sizeof (struct node)); ++ ++ if (np == 0) ++ return 0; ++ ++ return init_node (np, dn); ++} ++ ++/* Create a new node structure. Also allocate SIZE bytes for the ++ disknode. The address of the disknode can be obtained using ++ diskfs_node_disknode. The new node will have one hard reference ++ and no light references. */ ++struct node * ++diskfs_make_node_alloc (size_t size) ++{ ++ struct node *np = malloc (sizeof (struct node) + size); ++ ++ if (np == NULL) ++ return NULL; ++ ++ return init_node (np, diskfs_node_disknode (np)); ++} +-- +2.0.0.rc2 + diff --git a/debian/patches/0009-libnetfs-add-netfs_make_node_alloc-to-allocate-fat-n.patch b/debian/patches/0009-libnetfs-add-netfs_make_node_alloc-to-allocate-fat-n.patch new file mode 100644 index 00000000..a6d907bd --- /dev/null +++ b/debian/patches/0009-libnetfs-add-netfs_make_node_alloc-to-allocate-fat-n.patch @@ -0,0 +1,116 @@ +From cc83084c99d1f7d02b35e3e5a6e707fa1105f32b Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Sun, 18 May 2014 13:34:12 +0200 +Subject: [PATCH 09/11] libnetfs: add netfs_make_node_alloc to allocate fat + nodes + +libnetfs has two kind of nodes, struct node and struct netnode. +struct node is used to store libnetfs specific data, while struct +netnode contains user supplied data. Previously, both objects were +allocated separatly, and a pointer from the node to the netnode +provided a mapping from the former to the latter. + +Provide a function netfs_make_node_alloc that allocates both nodes in +a contiguous region. + +This reduces the memory allocation overhead when creating nodes. It +also makes the relation between node and netnode a simple offset +calculation. Provide two functions to compute the netnode address +from the node address and vice-versa. + +Most notably, this makes implementing a cache on top of libnetfs +easier. Auxiliary data for the cache can be stored in the +user-defined netnode, and the fat node can be used as the value. + +* libnetfs/make-node.c (init_node): Move initialization here. +(netfs_make_node): Use init_node. +(netfs_make_node_alloc): New function to allocate fat nodes. +* libnetfs/netfs.h (netfs_make_node_alloc): New declaration. +(netfs_node_netnode): Compute netnode address from node address. +(netfs_netnode_node): And vice-versa. +--- + libnetfs/make-node.c | 29 +++++++++++++++++++++++------ + libnetfs/netfs.h | 22 ++++++++++++++++++++++ + 2 files changed, 45 insertions(+), 6 deletions(-) + +diff --git a/libnetfs/make-node.c b/libnetfs/make-node.c +index f20ada1..6bd8109 100644 +--- a/libnetfs/make-node.c ++++ b/libnetfs/make-node.c +@@ -21,13 +21,9 @@ + #include "netfs.h" + #include <hurd/fshelp.h> + +-struct node * +-netfs_make_node (struct netnode *nn) ++static struct node * ++init_node (struct node *np, struct netnode *nn) + { +- struct node *np = malloc (sizeof (struct node)); +- if (! np) +- return NULL; +- + np->nn = nn; + + pthread_mutex_init (&np->lock, NULL); +@@ -40,3 +36,24 @@ netfs_make_node (struct netnode *nn) + + return np; + } ++ ++struct node * ++netfs_make_node (struct netnode *nn) ++{ ++ struct node *np = malloc (sizeof (struct node)); ++ if (! np) ++ return NULL; ++ ++ return init_node (np, nn); ++} ++ ++struct node * ++netfs_make_node_alloc (size_t size) ++{ ++ struct node *np = malloc (sizeof (struct node) + size); ++ ++ if (np == NULL) ++ return NULL; ++ ++ return init_node (np, netfs_node_netnode (np)); ++} +diff --git a/libnetfs/netfs.h b/libnetfs/netfs.h +index aef4a3d..e3c3b3e 100644 +--- a/libnetfs/netfs.h ++++ b/libnetfs/netfs.h +@@ -372,6 +372,28 @@ extern int netfs_maxsymlinks; + If an error occurs, NULL is returned. */ + struct node *netfs_make_node (struct netnode *); + ++/* Create a new node structure. Also allocate SIZE bytes for the ++ netnode. The address of the netnode can be obtained using ++ netfs_node_netnode. The new node will have one hard reference and ++ no light references. If an error occurs, NULL is returned. */ ++struct node *netfs_make_node_alloc (size_t size); ++ ++/* Return the address of the netnode for NODE. NODE must have been ++ allocated using netfs_make_node_alloc. */ ++static inline struct netnode * ++netfs_node_netnode (struct node *node) ++{ ++ return (struct netnode *) ((char *) node + sizeof (struct node)); ++} ++ ++/* Return the address of the node for NETNODE. NETNODE must have been ++ allocated using netfs_make_node_alloc. */ ++static inline struct node * ++netfs_netnode_node (struct netnode *netnode) ++{ ++ return (struct node *) ((char *) netnode - sizeof (struct node)); ++} ++ + /* Whenever node->references is to be touched, this lock must be + held. Cf. netfs_nrele, netfs_nput, netfs_nref and netfs_drop_node. */ + extern pthread_spinlock_t netfs_node_refcnt_lock; +-- +2.0.0.rc2 + diff --git a/debian/patches/0010-trans-fakeroot-use-fat-nodes-to-simplify-the-node-ca.patch b/debian/patches/0010-trans-fakeroot-use-fat-nodes-to-simplify-the-node-ca.patch new file mode 100644 index 00000000..3c5efdf6 --- /dev/null +++ b/debian/patches/0010-trans-fakeroot-use-fat-nodes-to-simplify-the-node-ca.patch @@ -0,0 +1,149 @@ +From 59985ce4faef0e3745adb08e1a6a82de458e61fb Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Sun, 18 May 2014 13:45:14 +0200 +Subject: [PATCH 10/11] trans/fakeroot: use fat nodes to simplify the node + cache + +Previously, fakeroot stored netnodes in the hash table. But we are +not interested in a cache for netnodes, we need a node cache. So +fakeroot kept pointers to the associated node object in each netnode +object. + +Use fat netfs nodes, which combine node and netnode objects. + +* trans/fakeroot.c (struct netnode): Remove np. +(idport_ihash): Fix ihash location pointer offset. +(new_node): Allocate fat nodes, store the node pointer in the hash +table. +(netfs_node_norefs): Adjust accordingly. +(netfs_S_dir_lookup): Likewise. +--- + trans/fakeroot.c | 36 ++++++++++++------------------------ + 1 file changed, 12 insertions(+), 24 deletions(-) + +diff --git a/trans/fakeroot.c b/trans/fakeroot.c +index 4175b55..59f8a86 100644 +--- a/trans/fakeroot.c ++++ b/trans/fakeroot.c +@@ -47,7 +47,6 @@ static auth_t fakeroot_auth_port; + + struct netnode + { +- struct node *np; /* our node */ + hurd_ihash_locp_t idport_locp;/* easy removal pointer in idport ihash */ + mach_port_t idport; /* port from io_identity */ + int openmodes; /* O_READ | O_WRITE | O_EXEC */ +@@ -64,7 +63,8 @@ struct netnode + + pthread_mutex_t idport_ihash_lock = PTHREAD_MUTEX_INITIALIZER; + struct hurd_ihash idport_ihash +- = HURD_IHASH_INITIALIZER (offsetof (struct netnode, idport_locp)); ++= HURD_IHASH_INITIALIZER (sizeof (struct node) ++ + offsetof (struct netnode, idport_locp)); + + + /* Make a new virtual node. Always consumes the ports. If +@@ -74,8 +74,9 @@ new_node (file_t file, mach_port_t idport, int locked, int openmodes, + struct node **np) + { + error_t err; +- struct netnode *nn = calloc (1, sizeof *nn); +- if (nn == 0) ++ struct netnode *nn; ++ *np = netfs_make_node_alloc (sizeof *nn); ++ if (*np == 0) + { + mach_port_deallocate (mach_task_self (), file); + if (idport != MACH_PORT_NULL) +@@ -84,6 +85,7 @@ new_node (file_t file, mach_port_t idport, int locked, int openmodes, + pthread_mutex_unlock (&idport_ihash_lock); + return ENOMEM; + } ++ nn = netfs_node_netnode (*np); + nn->file = file; + nn->openmodes = openmodes; + if (idport != MACH_PORT_NULL) +@@ -97,35 +99,26 @@ new_node (file_t file, mach_port_t idport, int locked, int openmodes, + if (err) + { + mach_port_deallocate (mach_task_self (), file); +- free (nn); ++ free (*np); + return err; + } + } + + if (!locked) + pthread_mutex_lock (&idport_ihash_lock); +- err = hurd_ihash_add (&idport_ihash, nn->idport, nn); ++ err = hurd_ihash_add (&idport_ihash, nn->idport, *np); + if (err) + goto lose; + +- *np = nn->np = netfs_make_node (nn); +- if (*np == 0) +- { +- err = ENOMEM; +- goto lose_hash; +- } +- + pthread_mutex_lock (&(*np)->lock); + pthread_mutex_unlock (&idport_ihash_lock); + return 0; + +- lose_hash: +- hurd_ihash_locp_remove (&idport_ihash, nn->idport_locp); + lose: + pthread_mutex_unlock (&idport_ihash_lock); + mach_port_deallocate (mach_task_self (), nn->idport); + mach_port_deallocate (mach_task_self (), file); +- free (nn); ++ free (*np); + return err; + } + +@@ -161,8 +154,6 @@ set_faked_attribute (struct node *np, unsigned int faked) + void + netfs_node_norefs (struct node *np) + { +- assert (np->nn->np == np); +- + pthread_mutex_unlock (&np->lock); + pthread_spin_unlock (&netfs_node_refcnt_lock); + +@@ -172,7 +163,6 @@ netfs_node_norefs (struct node *np) + + mach_port_deallocate (mach_task_self (), np->nn->file); + mach_port_deallocate (mach_task_self (), np->nn->idport); +- free (np->nn); + free (np); + + pthread_spin_lock (&netfs_node_refcnt_lock); +@@ -358,13 +348,12 @@ netfs_S_dir_lookup (struct protid *diruser, + refcount lock so that, if a node is found, its reference counter cannot + drop to 0 before we get our own reference. */ + pthread_spin_lock (&netfs_node_refcnt_lock); +- struct netnode *nn = hurd_ihash_find (&idport_ihash, idport); +- if (nn != NULL) ++ np = hurd_ihash_find (&idport_ihash, idport); ++ if (np != NULL) + { +- assert (nn->np->nn == nn); + /* We already know about this node. */ + +- if (nn->np->references == 0) ++ if (np->references == 0) + { + /* But it might be in the process of being released. If so, + unlock the hash table to give the node a chance to actually +@@ -376,7 +365,6 @@ netfs_S_dir_lookup (struct protid *diruser, + } + + /* Otherwise, reference it right away. */ +- np = nn->np; + np->references++; + pthread_spin_unlock (&netfs_node_refcnt_lock); + +-- +2.0.0.rc2 + diff --git a/debian/patches/0011-trans-fakeroot-use-netfs_node_netnode-instead-of-np-.patch b/debian/patches/0011-trans-fakeroot-use-netfs_node_netnode-instead-of-np-.patch new file mode 100644 index 00000000..22751606 --- /dev/null +++ b/debian/patches/0011-trans-fakeroot-use-netfs_node_netnode-instead-of-np-.patch @@ -0,0 +1,386 @@ +From 7005b2ddaab5fe3c9e78d3c326dacbb4946a5501 Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Sun, 18 May 2014 14:06:30 +0200 +Subject: [PATCH 11/11] trans/fakeroot: use netfs_node_netnode instead of + np->nn + +When using fat nodes, expressions of the form E->nn can be rewritten +as netfs_node_netnode (E). This is much faster as it only involves a +offset calculation. For reference, I used the following semantic +patch to create the patch: + +@@ +expression E; +@@ + +- E->nn ++ netfs_node_netnode (E) + +* trans/fakeroot.c: Use netfs_node_netnode instead of np->nn. +--- + trans/fakeroot.c | 99 ++++++++++++++++++++++++++++++-------------------------- + 1 file changed, 53 insertions(+), 46 deletions(-) + +diff --git a/trans/fakeroot.c b/trans/fakeroot.c +index 59f8a86..32a34ec 100644 +--- a/trans/fakeroot.c ++++ b/trans/fakeroot.c +@@ -125,7 +125,7 @@ new_node (file_t file, mach_port_t idport, int locked, int openmodes, + static void + set_default_attributes (struct node *np) + { +- np->nn->faked = FAKE_UID | FAKE_GID | FAKE_DEFAULT; ++ netfs_node_netnode (np)->faked = FAKE_UID | FAKE_GID | FAKE_DEFAULT; + np->nn_stat.st_uid = 0; + np->nn_stat.st_gid = 0; + } +@@ -133,9 +133,9 @@ set_default_attributes (struct node *np) + static void + set_faked_attribute (struct node *np, unsigned int faked) + { +- np->nn->faked |= faked; ++ netfs_node_netnode (np)->faked |= faked; + +- if (np->nn->faked & FAKE_DEFAULT) ++ if (netfs_node_netnode (np)->faked & FAKE_DEFAULT) + { + /* Now that the node has non-default faked attributes, they have to be + retained for future accesses. Account for the hash table reference. +@@ -146,7 +146,7 @@ set_faked_attribute (struct node *np, unsigned int faked) + easy enough if it's ever needed, although scalability could be + improved. */ + netfs_nref (np); +- np->nn->faked &= ~FAKE_DEFAULT; ++ netfs_node_netnode (np)->faked &= ~FAKE_DEFAULT; + } + } + +@@ -158,11 +158,11 @@ netfs_node_norefs (struct node *np) + pthread_spin_unlock (&netfs_node_refcnt_lock); + + pthread_mutex_lock (&idport_ihash_lock); +- hurd_ihash_locp_remove (&idport_ihash, np->nn->idport_locp); ++ hurd_ihash_locp_remove (&idport_ihash, netfs_node_netnode (np)->idport_locp); + pthread_mutex_unlock (&idport_ihash_lock); + +- mach_port_deallocate (mach_task_self (), np->nn->file); +- mach_port_deallocate (mach_task_self (), np->nn->idport); ++ mach_port_deallocate (mach_task_self (), netfs_node_netnode (np)->file); ++ mach_port_deallocate (mach_task_self (), netfs_node_netnode (np)->idport); + free (np); + + pthread_spin_lock (&netfs_node_refcnt_lock); +@@ -245,7 +245,8 @@ error_t + netfs_check_open_permissions (struct iouser *user, struct node *np, + int flags, int newnode) + { +- return check_openmodes (np->nn, flags & (O_RDWR|O_EXEC), MACH_PORT_NULL); ++ return check_openmodes (netfs_node_netnode (np), ++ flags & (O_RDWR|O_EXEC), MACH_PORT_NULL); + } + + error_t +@@ -271,12 +272,12 @@ netfs_S_dir_lookup (struct protid *diruser, + + dnp = diruser->po->np; + +- mach_port_t dir = dnp->nn->file; ++ mach_port_t dir = netfs_node_netnode (dnp)->file; + redo_lookup: + err = dir_lookup (dir, filename, + flags & (O_NOLINK|O_RDWR|O_EXEC|O_CREAT|O_EXCL|O_NONBLOCK), + mode, do_retry, retry_name, &file); +- if (dir != dnp->nn->file) ++ if (dir != netfs_node_netnode (dnp)->file) + mach_port_deallocate (mach_task_self (), dir); + if (err) + return err; +@@ -380,7 +381,8 @@ netfs_S_dir_lookup (struct protid *diruser, + pthread_mutex_unlock (&dnp->lock); + } + +- err = check_openmodes (np->nn, (flags & (O_RDWR|O_EXEC)), file); ++ err = check_openmodes (netfs_node_netnode (np), ++ (flags & (O_RDWR|O_EXEC)), file); + pthread_mutex_unlock (&idport_ihash_lock); + } + else +@@ -448,17 +450,17 @@ error_t + netfs_validate_stat (struct node *np, struct iouser *cred) + { + struct stat st; +- error_t err = io_stat (np->nn->file, &st); ++ error_t err = io_stat (netfs_node_netnode (np)->file, &st); + if (err) + return err; + +- if (np->nn->faked & FAKE_UID) ++ if (netfs_node_netnode (np)->faked & FAKE_UID) + st.st_uid = np->nn_stat.st_uid; +- if (np->nn->faked & FAKE_GID) ++ if (netfs_node_netnode (np)->faked & FAKE_GID) + st.st_gid = np->nn_stat.st_gid; +- if (np->nn->faked & FAKE_AUTHOR) ++ if (netfs_node_netnode (np)->faked & FAKE_AUTHOR) + st.st_author = np->nn_stat.st_author; +- if (np->nn->faked & FAKE_MODE) ++ if (netfs_node_netnode (np)->faked & FAKE_MODE) + st.st_mode = np->nn_stat.st_mode; + + np->nn_stat = st; +@@ -528,7 +530,7 @@ netfs_attempt_chmod (struct iouser *cred, struct node *np, mode_t mode) + + /* We don't bother with error checking since the fake mode change should + always succeed--worst case a later open will get EACCES. */ +- (void) file_chmod (np->nn->file, mode); ++ (void) file_chmod (netfs_node_netnode (np)->file, mode); + set_faked_attribute (np, FAKE_MODE); + np->nn_stat.st_mode = mode; + return 0; +@@ -543,7 +545,7 @@ netfs_attempt_mksymlink (struct iouser *cred, struct node *np, char *name) + char trans[sizeof _HURD_SYMLINK + namelen]; + memcpy (trans, _HURD_SYMLINK, sizeof _HURD_SYMLINK); + memcpy (&trans[sizeof _HURD_SYMLINK], name, namelen); +- return file_set_translator (np->nn->file, ++ return file_set_translator (netfs_node_netnode (np)->file, + FS_TRANS_EXCL|FS_TRANS_SET, + FS_TRANS_EXCL|FS_TRANS_SET, 0, + trans, sizeof trans, +@@ -562,7 +564,7 @@ netfs_attempt_mkdev (struct iouser *cred, struct node *np, + return ENOMEM; + else + { +- error_t err = file_set_translator (np->nn->file, ++ error_t err = file_set_translator (netfs_node_netnode (np)->file, + FS_TRANS_EXCL|FS_TRANS_SET, + FS_TRANS_EXCL|FS_TRANS_SET, 0, + trans, translen + 1, +@@ -576,7 +578,7 @@ netfs_attempt_mkdev (struct iouser *cred, struct node *np, + error_t + netfs_attempt_chflags (struct iouser *cred, struct node *np, int flags) + { +- return file_chflags (np->nn->file, flags); ++ return file_chflags (netfs_node_netnode (np)->file, flags); + } + + error_t +@@ -602,25 +604,25 @@ netfs_attempt_utimes (struct iouser *cred, struct node *np, + else + m.tv.tv_sec = m.tv.tv_usec = -1; + +- return file_utimes (np->nn->file, a.tvt, m.tvt); ++ return file_utimes (netfs_node_netnode (np)->file, a.tvt, m.tvt); + } + + error_t + netfs_attempt_set_size (struct iouser *cred, struct node *np, off_t size) + { +- return file_set_size (np->nn->file, size); ++ return file_set_size (netfs_node_netnode (np)->file, size); + } + + error_t + netfs_attempt_statfs (struct iouser *cred, struct node *np, struct statfs *st) + { +- return file_statfs (np->nn->file, st); ++ return file_statfs (netfs_node_netnode (np)->file, st); + } + + error_t + netfs_attempt_sync (struct iouser *cred, struct node *np, int wait) + { +- return file_sync (np->nn->file, wait, 0); ++ return file_sync (netfs_node_netnode (np)->file, wait, 0); + } + + error_t +@@ -633,7 +635,7 @@ error_t + netfs_attempt_mkdir (struct iouser *user, struct node *dir, + char *name, mode_t mode) + { +- return dir_mkdir (dir->nn->file, name, mode | S_IRWXU); ++ return dir_mkdir (netfs_node_netnode (dir)->file, name, mode | S_IRWXU); + } + + +@@ -645,7 +647,7 @@ netfs_attempt_mkdir (struct iouser *user, struct node *dir, + error_t + netfs_attempt_unlink (struct iouser *user, struct node *dir, char *name) + { +- return dir_unlink (dir->nn->file, name); ++ return dir_unlink (netfs_node_netnode (dir)->file, name); + } + + error_t +@@ -653,22 +655,22 @@ netfs_attempt_rename (struct iouser *user, struct node *fromdir, + char *fromname, struct node *todir, + char *toname, int excl) + { +- return dir_rename (fromdir->nn->file, fromname, +- todir->nn->file, toname, excl); ++ return dir_rename (netfs_node_netnode (fromdir)->file, fromname, ++ netfs_node_netnode (todir)->file, toname, excl); + } + + error_t + netfs_attempt_rmdir (struct iouser *user, + struct node *dir, char *name) + { +- return dir_rmdir (dir->nn->file, name); ++ return dir_rmdir (netfs_node_netnode (dir)->file, name); + } + + error_t + netfs_attempt_link (struct iouser *user, struct node *dir, + struct node *file, char *name, int excl) + { +- return dir_link (dir->nn->file, file->nn->file, name, excl); ++ return dir_link (netfs_node_netnode (dir)->file, netfs_node_netnode (file)->file, name, excl); + } + + error_t +@@ -676,7 +678,7 @@ netfs_attempt_mkfile (struct iouser *user, struct node *dir, + mode_t mode, struct node **np) + { + file_t newfile; +- error_t err = dir_mkfile (dir->nn->file, O_RDWR|O_EXEC, ++ error_t err = dir_mkfile (netfs_node_netnode (dir)->file, O_RDWR|O_EXEC, + real_from_fake_mode (mode), &newfile); + pthread_mutex_unlock (&dir->lock); + if (err == 0) +@@ -692,7 +694,8 @@ netfs_attempt_readlink (struct iouser *user, struct node *np, char *buf) + char transbuf[sizeof _HURD_SYMLINK + np->nn_stat.st_size + 1]; + char *trans = transbuf; + size_t translen = sizeof transbuf; +- error_t err = file_get_translator (np->nn->file, &trans, &translen); ++ error_t err = file_get_translator (netfs_node_netnode (np)->file, ++ &trans, &translen); + if (err == 0) + { + if (translen < sizeof _HURD_SYMLINK +@@ -715,7 +718,8 @@ netfs_attempt_read (struct iouser *cred, struct node *np, + off_t offset, size_t *len, void *data) + { + char *buf = data; +- error_t err = io_read (np->nn->file, &buf, len, offset, *len); ++ error_t err = io_read (netfs_node_netnode (np)->file, ++ &buf, len, offset, *len); + if (err == 0 && buf != data) + { + memcpy (data, buf, *len); +@@ -728,7 +732,7 @@ error_t + netfs_attempt_write (struct iouser *cred, struct node *np, + off_t offset, size_t *len, void *data) + { +- return io_write (np->nn->file, data, *len, offset, len); ++ return io_write (netfs_node_netnode (np)->file, data, *len, offset, len); + } + + error_t +@@ -744,7 +748,7 @@ netfs_get_dirents (struct iouser *cred, struct node *dir, + mach_msg_type_number_t *datacnt, + vm_size_t bufsize, int *amt) + { +- return dir_readdir (dir->nn->file, data, datacnt, ++ return dir_readdir (netfs_node_netnode (dir)->file, data, datacnt, + entry, nentries, bufsize, amt); + } + +@@ -762,7 +766,7 @@ netfs_file_get_storage_info (struct iouser *cred, + mach_msg_type_number_t *data_len) + { + *ports_type = MACH_MSG_TYPE_MOVE_SEND; +- return file_get_storage_info (np->nn->file, ++ return file_get_storage_info (netfs_node_netnode (np)->file, + ports, num_ports, + ints, num_ints, + offsets, num_offsets, +@@ -795,8 +799,9 @@ netfs_S_file_exec (struct protid *user, + return EOPNOTSUPP; + + pthread_mutex_lock (&user->po->np->lock); +- err = check_openmodes (user->po->np->nn, O_EXEC, MACH_PORT_NULL); +- file = user->po->np->nn->file; ++ err = check_openmodes (netfs_node_netnode (user->po->np), ++ O_EXEC, MACH_PORT_NULL); ++ file = netfs_node_netnode (user->po->np)->file; + if (!err) + err = mach_port_mod_refs (mach_task_self (), + file, MACH_PORT_RIGHT_SEND, 1); +@@ -806,7 +811,8 @@ netfs_S_file_exec (struct protid *user, + { + /* We cannot use MACH_MSG_TYPE_MOVE_SEND because we might need to + retry an interrupted call that would have consumed the rights. */ +- err = file_exec (user->po->np->nn->file, task, flags, argv, argvlen, ++ err = file_exec (netfs_node_netnode (user->po->np)->file, ++ task, flags, argv, argvlen, + envp, envplen, fds, MACH_MSG_TYPE_COPY_SEND, fdslen, + portarray, MACH_MSG_TYPE_COPY_SEND, portarraylen, + intarray, intarraylen, deallocnames, deallocnameslen, +@@ -838,7 +844,7 @@ netfs_S_io_map (struct protid *user, + *rdobjtype = *wrobjtype = MACH_MSG_TYPE_MOVE_SEND; + + pthread_mutex_lock (&user->po->np->lock); +- err = io_map (user->po->np->nn->file, rdobj, wrobj); ++ err = io_map (netfs_node_netnode (user->po->np)->file, rdobj, wrobj); + pthread_mutex_unlock (&user->po->np->lock); + return err; + } +@@ -855,7 +861,7 @@ netfs_S_io_map_cntl (struct protid *user, + *objtype = MACH_MSG_TYPE_MOVE_SEND; + + pthread_mutex_lock (&user->po->np->lock); +- err = io_map_cntl (user->po->np->nn->file, obj); ++ err = io_map_cntl (netfs_node_netnode (user->po->np)->file, obj); + pthread_mutex_unlock (&user->po->np->lock); + return err; + } +@@ -876,7 +882,8 @@ netfs_S_io_identity (struct protid *user, + *idtype = *fsystype = MACH_MSG_TYPE_MOVE_SEND; + + pthread_mutex_lock (&user->po->np->lock); +- err = io_identity (user->po->np->nn->file, id, fsys, fileno); ++ err = io_identity (netfs_node_netnode (user->po->np)->file, ++ id, fsys, fileno); + pthread_mutex_unlock (&user->po->np->lock); + return err; + } +@@ -891,7 +898,7 @@ netfs_S_##name (struct protid *user) \ + return EOPNOTSUPP; \ + \ + pthread_mutex_lock (&user->po->np->lock); \ +- err = name (user->po->np->nn->file); \ ++ err = name (netfs_node_netnode (user->po->np)->file); \ + pthread_mutex_unlock (&user->po->np->lock); \ + return err; \ + } +@@ -913,7 +920,7 @@ netfs_S_io_prenotify (struct protid *user, + return EOPNOTSUPP; + + pthread_mutex_lock (&user->po->np->lock); +- err = io_prenotify (user->po->np->nn->file, start, stop); ++ err = io_prenotify (netfs_node_netnode (user->po->np)->file, start, stop); + pthread_mutex_unlock (&user->po->np->lock); + return err; + } +@@ -928,7 +935,7 @@ netfs_S_io_postnotify (struct protid *user, + return EOPNOTSUPP; + + pthread_mutex_lock (&user->po->np->lock); +- err = io_postnotify (user->po->np->nn->file, start, stop); ++ err = io_postnotify (netfs_node_netnode (user->po->np)->file, start, stop); + pthread_mutex_unlock (&user->po->np->lock); + return err; + } +@@ -971,7 +978,7 @@ netfs_demuxer (mach_msg_header_t *inp, + | MACH_MSGH_BITS (MACH_MSG_TYPE_COPY_SEND, + MACH_MSGH_BITS_REMOTE (inp->msgh_bits)); + inp->msgh_local_port = inp->msgh_remote_port; /* reply port */ +- inp->msgh_remote_port = cred->po->np->nn->file; ++ inp->msgh_remote_port = netfs_node_netnode (cred->po->np)->file; + err = mach_msg (inp, MACH_SEND_MSG, inp->msgh_size, 0, + MACH_PORT_NULL, MACH_MSG_TIMEOUT_NONE, + MACH_PORT_NULL); +-- +2.0.0.rc2 + diff --git a/debian/patches/series b/debian/patches/series index 6f1da5d7..735295d0 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -42,3 +42,14 @@ mach-defpager-protected-payload.patch #0010-libihash-make-the-locp-offset-mechanism-more-flexibl.patch #0011-trans-fakeroot-use-the-indirection-mechanism-for-loc.patch +0001-include-install-refcount.h.patch +0002-exec-add-missing-includes.patch +0003-pfinet-add-missing-include.patch +0004-term-fix-memory-leak.patch +0005-libdiskfs-fix-type-of-dir_cache_id-node_cache_id.patch +0006-libstore-provide-function-declaration-until-availabl.patch +0007-Avoid-compiler-warning-about-empty-bodies.patch +0008-libdiskfs-add-diskfs_make_node_alloc-to-allocate-fat.patch +0009-libnetfs-add-netfs_make_node_alloc-to-allocate-fat-n.patch +0010-trans-fakeroot-use-fat-nodes-to-simplify-the-node-ca.patch +0011-trans-fakeroot-use-netfs_node_netnode-instead-of-np-.patch |