From bade74e904168247a16fcff1dfde78f46106d5d1 Mon Sep 17 00:00:00 2001
From: Justus Winter <4winter@informatik.uni-hamburg.de>
Date: Tue, 8 Apr 2014 21:46:38 +0200
Subject: Revert "eth-filter: fix receiver lookups"
This reverts commit 4c9e012c872e3527b5071fde0f33f4ffd5976698.
---
eth-filter/filter.c | 48 ++++++++++++++++++++++++++++++++++++------------
eth-filter/mig-decls.h | 45 ---------------------------------------------
eth-filter/mig-mutate.h | 7 -------
3 files changed, 36 insertions(+), 64 deletions(-)
delete mode 100644 eth-filter/mig-decls.h
diff --git a/eth-filter/filter.c b/eth-filter/filter.c
index a1fcf378..f3d58ddd 100644
--- a/eth-filter/filter.c
+++ b/eth-filter/filter.c
@@ -287,21 +287,21 @@ do_mach_notify_dead_name (struct port_info *pi,
/* Implementation of device interface */
kern_return_t
-ds_xxx_device_set_status (struct proxy_user *device, dev_flavor_t flavor,
+ds_xxx_device_set_status (device_t device, dev_flavor_t flavor,
dev_status_t status, size_t statu_cnt)
{
return D_INVALID_OPERATION;
}
kern_return_t
-ds_xxx_device_get_status (struct proxy_user *device, dev_flavor_t flavor,
+ds_xxx_device_get_status (device_t device, dev_flavor_t flavor,
dev_status_t status, size_t *statuscnt)
{
return D_INVALID_OPERATION;
}
kern_return_t
-ds_xxx_device_set_filter (struct proxy_user *device, mach_port_t rec,
+ds_xxx_device_set_filter (device_t device, mach_port_t rec,
int pri, filter_array_t filt, size_t len)
{
return D_INVALID_OPERATION;
@@ -360,13 +360,13 @@ ds_device_open (mach_port_t master_port, mach_port_t reply_port,
}
kern_return_t
-ds_device_close (struct proxy_user *device)
+ds_device_close (device_t device)
{
return 0;
}
kern_return_t
-ds_device_write (struct proxy_user *user, mach_port_t reply_port,
+ds_device_write (device_t device, mach_port_t reply_port,
mach_msg_type_name_t reply_type, dev_mode_t mode,
recnum_t recnum, io_buf_ptr_t data, size_t datalen,
int *bytes_written)
@@ -375,14 +375,17 @@ ds_device_write (struct proxy_user *user, mach_port_t reply_port,
int has_filter = 0;
net_hash_entry_t entp, *hash_headp;
net_rcv_port_t infp, nextfp;
+ struct proxy_user *user;
struct proxy *proxy;
+ user = ports_lookup_port (port_bucket, device, user_portclass);
if (user == NULL)
{
vm_deallocate (mach_task_self (), (vm_address_t) data, datalen);
return D_INVALID_OPERATION;
}
proxy = user->proxy;
+ ports_port_deref (user);
/* The packet can be sent as long as it passes one filter,
* even thought there is usually only one filter in the list. */
@@ -418,17 +421,20 @@ ds_device_write (struct proxy_user *user, mach_port_t reply_port,
}
kern_return_t
-ds_device_write_inband (struct proxy_user *user, mach_port_t reply_port,
+ds_device_write_inband (device_t device, mach_port_t reply_port,
mach_msg_type_name_t reply_type, dev_mode_t mode,
recnum_t recnum, io_buf_ptr_inband_t data,
size_t datalen, int *bytes_written)
{
kern_return_t ret;
+ struct proxy_user *user;
struct proxy *proxy;
+ user = ports_lookup_port (port_bucket, device, user_portclass);
if (user == NULL)
return D_INVALID_OPERATION;
proxy = user->proxy;
+ ports_port_deref (user);
ret = device_write_inband (proxy->device_port, mode, recnum, data,
datalen, bytes_written);
@@ -436,17 +442,20 @@ ds_device_write_inband (struct proxy_user *user, mach_port_t reply_port,
}
kern_return_t
-ds_device_read (struct proxy_user *user, mach_port_t reply_port,
+ds_device_read (device_t device, mach_port_t reply_port,
mach_msg_type_name_t reply_type, dev_mode_t mode,
recnum_t recnum, int bytes_wanted,
io_buf_ptr_t *data, size_t *datalen)
{
kern_return_t ret;
+ struct proxy_user *user;
struct proxy *proxy;
+ user = ports_lookup_port (port_bucket, device, user_portclass);
if (user == NULL)
return D_INVALID_OPERATION;
proxy = user->proxy;
+ ports_port_deref (user);
ret = device_read (proxy->device_port, mode, recnum,
bytes_wanted, data, datalen);
@@ -454,17 +463,20 @@ ds_device_read (struct proxy_user *user, mach_port_t reply_port,
}
kern_return_t
-ds_device_read_inband (struct proxy_user *user, mach_port_t reply_port,
+ds_device_read_inband (device_t device, mach_port_t reply_port,
mach_msg_type_name_t reply_type, dev_mode_t mode,
recnum_t recnum, int bytes_wanted,
io_buf_ptr_inband_t data, size_t *datalen)
{
kern_return_t ret;
+ struct proxy_user *user;
struct proxy *proxy;
+ user = ports_lookup_port (port_bucket, device, user_portclass);
if (user == NULL)
return D_INVALID_OPERATION;
proxy = user->proxy;
+ ports_port_deref (user);
ret = device_read_inband (proxy->device_port, mode, recnum,
bytes_wanted, data, datalen);
@@ -472,15 +484,18 @@ ds_device_read_inband (struct proxy_user *user, mach_port_t reply_port,
}
kern_return_t
-ds_device_map (struct proxy_user *user, vm_prot_t prot, vm_offset_t offset,
+ds_device_map (device_t device, vm_prot_t prot, vm_offset_t offset,
vm_size_t size, memory_object_t *pager, int unmap)
{
kern_return_t ret;
+ struct proxy_user *user;
struct proxy *proxy;
+ user = ports_lookup_port (port_bucket, device, user_portclass);
if (user == NULL)
return D_INVALID_OPERATION;
proxy = user->proxy;
+ ports_port_deref (user);
ret = device_map (proxy->device_port, prot, offset,
size, pager, unmap);
@@ -488,15 +503,18 @@ ds_device_map (struct proxy_user *user, vm_prot_t prot, vm_offset_t offset,
}
kern_return_t
-ds_device_set_status (struct proxy_user *user, dev_flavor_t flavor,
+ds_device_set_status (device_t device, dev_flavor_t flavor,
dev_status_t status, size_t statuslen)
{
kern_return_t ret;
+ struct proxy_user *user;
struct proxy *proxy;
+ user = ports_lookup_port (port_bucket, device, user_portclass);
if (user == NULL)
return D_INVALID_OPERATION;
proxy = user->proxy;
+ ports_port_deref (user);
ret = device_set_status (proxy->device_port, flavor,
status, statuslen);
@@ -504,32 +522,38 @@ ds_device_set_status (struct proxy_user *user, dev_flavor_t flavor,
}
kern_return_t
-ds_device_get_status (struct proxy_user *user, dev_flavor_t flavor,
+ds_device_get_status (device_t device, dev_flavor_t flavor,
dev_status_t status, size_t *statuslen)
{
kern_return_t ret;
+ struct proxy_user *user;
struct proxy *proxy;
+ user = ports_lookup_port (port_bucket, device, user_portclass);
if (user == NULL)
return D_INVALID_OPERATION;
proxy = user->proxy;
+ ports_port_deref (user);
ret = device_get_status (proxy->device_port, flavor, status, statuslen);
return ret;
}
kern_return_t
-ds_device_set_filter (struct proxy_user *user, mach_port_t receive_port,
+ds_device_set_filter (device_t device, mach_port_t receive_port,
int priority, filter_array_t filter, size_t filterlen)
{
mach_port_t tmp;
kern_return_t err;
mach_port_t device_receive_port;
+ struct proxy_user *user;
struct proxy *proxy;
+ user = ports_lookup_port (port_bucket, device, user_portclass);
if (user == NULL)
return D_INVALID_OPERATION;
proxy = user->proxy;
+ ports_port_deref (user);
if (proxy->device == NULL)
{
diff --git a/eth-filter/mig-decls.h b/eth-filter/mig-decls.h
deleted file mode 100644
index 24cb0984..00000000
--- a/eth-filter/mig-decls.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- Copyright (C) 2014 Free Software Foundation, Inc.
- Written by Justus Winter.
-
- This file is part of the GNU Hurd.
-
- The GNU Hurd 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, or (at
- your option) any later version.
-
- The GNU Hurd 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 the GNU Hurd. If not, see . */
-
-#ifndef __ETH_FILTER_MIG_DECLS_H__
-#define __ETH_FILTER_MIG_DECLS_H__
-
-#include
-
-typedef struct proxy_user *proxy_user_t;
-
-extern struct port_bucket *port_bucket;
-extern struct port_class *user_portclass;
-
-/* Called by server stub functions. */
-
-static inline struct proxy_user * __attribute__ ((unused))
-begin_using_device_port (mach_port_t port)
-{
- return ports_lookup_port (port_bucket, device, user_portclass);
-}
-
-static inline void __attribute__ ((unused))
-end_using_device (struct proxy_user *p)
-{
- if (p)
- ports_port_deref (p);
-}
-
-#endif /* __ETH_FILTER_MIG_DECLS_H__ */
diff --git a/eth-filter/mig-mutate.h b/eth-filter/mig-mutate.h
index 388ce090..f692236e 100644
--- a/eth-filter/mig-mutate.h
+++ b/eth-filter/mig-mutate.h
@@ -23,10 +23,3 @@
end_using_port_info (port_info_t)
#define NOTIFY_IMPORTS \
import "libports/mig-decls.h";
-
-#define DEVICE_INTRAN \
- proxy_user_t begin_using_device_port (mach_port_t)
-#define DEVICE_DESTRUCTOR \
- end_using_device (proxy_user_t)
-#define DEVICE_IMPORTS \
- import "eth-filter/mig-decls.h";
--
cgit v1.2.3