X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=libcfs%2Finclude%2Flibcfs%2Flibcfs.h;h=be826b49d402a90429b91d74c915933fa070c7a3;hb=84a3fd67356c8073a917ea6abd63928055e38156;hp=549dab69fcd9f331f860618ac81000471ac89627;hpb=0f8dca08a4f68cba82c2c822998ecc309d3b7aaf;p=fs%2Flustre-release.git diff --git a/libcfs/include/libcfs/libcfs.h b/libcfs/include/libcfs/libcfs.h index 549dab6..be826b4 100644 --- a/libcfs/include/libcfs/libcfs.h +++ b/libcfs/include/libcfs/libcfs.h @@ -1,6 +1,4 @@ -/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- - * vim:expandtab:shiftwidth=8:tabstop=8: - * +/* * GPL HEADER START * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,6 +26,8 @@ /* * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. + * + * Copyright (c) 2011, Whamcloud, Inc. */ /* * This file is part of Lustre, http://www.lustre.org/ @@ -204,10 +204,11 @@ enum cfs_alloc_flags { /* flags for cfs_page_alloc() in addition to enum cfs_alloc_flags */ enum cfs_alloc_page_flags { - /* allow to return page beyond KVM. It has to be mapped into KVM by - * cfs_page_map(); */ - CFS_ALLOC_HIGH = 0x40, - CFS_ALLOC_HIGHUSER = CFS_ALLOC_WAIT | CFS_ALLOC_FS | CFS_ALLOC_IO | CFS_ALLOC_HIGH, + /* allow to return page beyond KVM. It has to be mapped into KVM by + * cfs_kmap() and unmapped with cfs_kunmap(). */ + CFS_ALLOC_HIGHMEM = 0x40, + CFS_ALLOC_HIGHUSER = CFS_ALLOC_WAIT | CFS_ALLOC_FS | CFS_ALLOC_IO | + CFS_ALLOC_HIGHMEM, }; /* @@ -223,10 +224,12 @@ void cfs_daemonize(char *str); int cfs_daemonize_ctxt(char *str); cfs_sigset_t cfs_get_blocked_sigs(void); cfs_sigset_t cfs_block_allsigs(void); -cfs_sigset_t cfs_block_sigs(cfs_sigset_t bits); +cfs_sigset_t cfs_block_sigs(unsigned long sigs); +cfs_sigset_t cfs_block_sigsinv(unsigned long sigs); void cfs_restore_sigs(cfs_sigset_t); int cfs_signal_pending(void); void cfs_clear_sigpending(void); + /* * XXX Liang: * these macros should be removed in the future, @@ -260,10 +263,15 @@ void cfs_stack_trace_fill(struct cfs_stack_trace *trace); */ void *cfs_stack_trace_frame(struct cfs_stack_trace *trace, int frame_no); +#ifndef O_NOACCESS +#define O_NOACCESS O_NONBLOCK +#endif + /* * Universal open flags. */ -#define CFS_O_ACCMODE 0003 +#define CFS_O_NOACCESS 0003 +#define CFS_O_ACCMODE CFS_O_NOACCESS #define CFS_O_CREAT 0100 #define CFS_O_EXCL 0200 #define CFS_O_NOCTTY 0400 @@ -284,14 +292,29 @@ int cfs_oflags2univ(int flags); /* convert universal open flags to local open flags */ int cfs_univ2oflags(int flags); +/* + * Random number handling + */ + +/* returns a random 32-bit integer */ +unsigned int cfs_rand(void); +/* seed the generator */ +void cfs_srand(unsigned int, unsigned int); +void cfs_get_random_bytes(void *buf, int size); + #include +#include #include #include #include #include #include #include +#include #include +#include +#include +#include /* container_of depends on "likely" which is defined in libcfs_private.h */ static inline void *__container_of(void *ptr, unsigned long shift) @@ -305,6 +328,8 @@ static inline void *__container_of(void *ptr, unsigned long shift) #define container_of0(ptr, type, member) \ ((type *)__container_of((void *)(ptr), offsetof(type, member))) +#define SET_BUT_UNUSED(a) do { } while(sizeof(a) - sizeof(a)) + #define _LIBCFS_H #endif /* _LIBCFS_H */