X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=libcfs%2Finclude%2Flibcfs%2Flinux%2Flinux-prim.h;h=20f367407131f675aba94db93d73c07f7ac8b15a;hp=705499e7ddf77761c647b60cd3d88f132b04c795;hb=6869932b552ac705f411de3362f01bd50c1f6f7d;hpb=e1b3d71a27c166bebd26ab33f7299c41bd75dab5 diff --git a/libcfs/include/libcfs/linux/linux-prim.h b/libcfs/include/libcfs/linux/linux-prim.h index 705499e..20f3674 100644 --- a/libcfs/include/libcfs/linux/linux-prim.h +++ b/libcfs/include/libcfs/linux/linux-prim.h @@ -1,25 +1,41 @@ /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- * vim:expandtab:shiftwidth=8:tabstop=8: * - * Copyright (C) 2001 Cluster File Systems, Inc. + * GPL HEADER START * - * This file is part of Lustre, http://www.lustre.org. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Lustre is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 only, + * as published by the Free Software Foundation. * - * Lustre 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. + * 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 version 2 for more details (a copy is included + * in the LICENSE file that accompanied this code). * - * You should have received a copy of the GNU General Public License - * along with Lustre; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * You should have received a copy of the GNU General Public License + * version 2 along with this program; If not, see + * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf * - * Basic library routines. + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. + * + * GPL HEADER END + */ +/* + * Copyright 2008 Sun Microsystems, Inc. All rights reserved + * Use is subject to license terms. + */ +/* + * This file is part of Lustre, http://www.lustre.org/ + * Lustre is a trademark of Sun Microsystems, Inc. + * + * libcfs/include/libcfs/linux/linux-prim.h * + * Basic library routines. */ #ifndef __LIBCFS_LINUX_CFS_PRIM_H__ @@ -29,7 +45,10 @@ #error Do not #include this file directly. #include instead #endif -#ifdef __KERNEL__ +#ifndef __KERNEL__ +#error This include is only for kernel use. +#endif + #ifndef AUTOCONF_INCLUDED #include #endif @@ -102,27 +121,12 @@ typedef struct proc_dir_entry cfs_proc_dir_entry_t; */ #define CFS_TASK_INTERRUPTIBLE TASK_INTERRUPTIBLE #define CFS_TASK_UNINT TASK_UNINTERRUPTIBLE +#define CFS_TASK_RUNNING TASK_RUNNING typedef wait_queue_t cfs_waitlink_t; typedef wait_queue_head_t cfs_waitq_t; - typedef long cfs_task_state_t; -#define cfs_waitq_init(w) init_waitqueue_head(w) -#define cfs_waitlink_init(l) init_waitqueue_entry(l, current) -#define cfs_waitq_add(w, l) add_wait_queue(w, l) -#define cfs_waitq_add_exclusive(w, l) add_wait_queue_exclusive(w, l) -#define cfs_waitq_forward(l, w) do {} while(0) -#define cfs_waitq_del(w, l) remove_wait_queue(w, l) -#define cfs_waitq_active(w) waitqueue_active(w) -#define cfs_waitq_signal(w) wake_up(w) -#define cfs_waitq_signal_nr(w,n) wake_up_nr(w, n) -#define cfs_waitq_broadcast(w) wake_up_all(w) -#define cfs_waitq_wait(l, s) schedule() -#define cfs_waitq_timedwait(l, s, t) schedule_timeout(t) -#define cfs_schedule_timeout(s, t) schedule_timeout(t) -#define cfs_schedule() schedule() - /* Kernel thread */ typedef int (*cfs_thread_t)(void *); @@ -169,49 +173,7 @@ typedef sigset_t cfs_sigset_t; * Timer */ typedef struct timer_list cfs_timer_t; -typedef void (*timer_func_t)(unsigned long); - -#define cfs_init_timer(t) init_timer(t) - -static inline void cfs_timer_init(cfs_timer_t *t, void (*func)(unsigned long), void *arg) -{ - init_timer(t); - t->function = (timer_func_t)func; - t->data = (unsigned long)arg; -} - -static inline void cfs_timer_done(cfs_timer_t *t) -{ - return; -} -static inline void cfs_timer_arm(cfs_timer_t *t, cfs_time_t deadline) -{ - mod_timer(t, deadline); -} - -static inline void cfs_timer_disarm(cfs_timer_t *t) -{ - del_timer(t); -} - -static inline int cfs_timer_is_armed(cfs_timer_t *t) -{ - return timer_pending(t); -} - -static inline cfs_time_t cfs_timer_deadline(cfs_timer_t *t) -{ - return t->expires; -} - - -/* deschedule for a bit... */ -static inline void cfs_pause(cfs_duration_t ticks) -{ - set_current_state(TASK_UNINTERRUPTIBLE); - schedule_timeout(ticks); -} #ifndef wait_event_timeout /* Only for RHEL3 2.4.21 kernel */ #define __wait_event_timeout(wq, condition, timeout, ret) \ @@ -301,11 +263,4 @@ do { \ #define cfs_waitq_wait_event_interruptible_timeout wait_event_interruptible_timeout #endif -#else /* !__KERNEL__ */ - -typedef struct proc_dir_entry cfs_proc_dir_entry_t; -#include "../user-prim.h" - -#endif /* __KERNEL__ */ - #endif