diff options
author | Zheng Da <zhengda1936@gmail.com> | 2010-05-31 17:51:05 +0200 |
---|---|---|
committer | Zheng Da <zhengda1936@gmail.com> | 2010-05-31 17:51:05 +0200 |
commit | 939878cb52cbfe18fd3151bc25d686d6aafc7cce (patch) | |
tree | 9133a05c4ed4a5ee5af4886b43a184c8def6de9e /windhoek/windhoek_local.h | |
parent | 2fe1437bd35016309e9ac4cfe57fb3daca3ba0a0 (diff) |
windhoek can be compiled.
Diffstat (limited to 'windhoek/windhoek_local.h')
-rw-r--r-- | windhoek/windhoek_local.h | 112 |
1 files changed, 0 insertions, 112 deletions
diff --git a/windhoek/windhoek_local.h b/windhoek/windhoek_local.h deleted file mode 100644 index d0d960b5..00000000 --- a/windhoek/windhoek_local.h +++ /dev/null @@ -1,112 +0,0 @@ -/** - * \file windhoek/server/src/windhoek_local.h - * \brief Windhoek internal server header - * - * \date 2008-01-29 - * \author Bjoern Doebel <doebel@tudos.org> - * - * (c) 2008 Technische Universitaet Dresden - * This file is part of DROPS, which is distributed under the terms of the - * GNU General Public License 2. Please see the COPYING file for details. - */ - -#ifndef WINDHOEK_LOCAL -#define WINDHOEK_LOCAL - -#include <l4/windhoek/types.h> -#include <l4/util/macros.h> - -#include <linux/genhd.h> -#include <linux/hdreg.h> - -#define MAX_GENDISKS 10 -#define MAX_CLIENTS 16 - -#undef DEBUG_MSG -#undef WARN_UNIMPL - -#define DEBUG_MSG(msg, ...) printk("%s: \033[34m"msg"\033[0m\n", __FUNCTION__, ##__VA_ARGS__) -#define WARN_UNIMPL DEBUG_MSG("unimplemented") - -extern struct gendisk* known_disks[MAX_GENDISKS]; -void gendisk_init(void); -struct gendisk* find_disk_by_name(const char *name); - -/* Main thread, so that IRQ threads can send notifications */ -extern l4_threadid_t main_thread; - -struct windhoek_data_ds -{ - struct list_head next; - l4dm_dataspace_t ds; - l4_size_t size; -}; - - -struct windhoek_bio_entry -{ - struct list_head next; - const windhoek_bio *wbio; -}; - - -struct client_state -{ - l4dm_dataspace_t ctrl_ds; - l4_size_t ctrl_size; - void *ctrl_address; /**< address where ctrl ds is mapped */ - l4dm_dataspace_t data_ds; - l4_size_t data_size; - void *data_address; /**< address where data ds is mapped */ - struct gendisk *gendisk; /**< the corresponding disk object */ - l4_threadid_t client_id; - l4_threadid_t notify_waiter; /**< thread waiting for notification */ - struct list_head finished_bios; /**< list of bios that have been serviced - - used to store until notifications - are retrieved by the client */ - spinlock_t lock; /**< lock XXX needed? */ -}; - - -extern struct client_state clients[MAX_CLIENTS]; - -void client_state_init(void); - - -/** Check whether there is a valid client with this handle */ -L4_INLINE int client_state_valid(int idx) -{ - return clients[idx].data_address != NULL; -} - - -/** Check whether the handle itself is valid */ -L4_INLINE int handle_valid(int handle) -{ - return ((handle >= 0) && (handle < MAX_CLIENTS)); -} - - -/** sanity check handle and caller */ -L4_INLINE int sanity_check(int handle, l4_threadid_t t) -{ - if (!handle_valid(handle) || - !client_state_valid(handle)) { - LOG_Error("invalid handle %d", handle); - return -EACCES; - } - - if (!l4_task_equal(clients[handle].client_id, t)) { - LOG_Error("Close by "l4util_idfmt", but owner is "l4util_idfmt, - l4util_idstr(t), l4util_idstr(clients[handle].client_id)); - return -EACCES; - } - - return 0; -} - -#define SANITY_CHECK(varname, handle, thread) \ - int varname = sanity_check(handle, thread); \ - if (varname) return varname; - -#endif |