subr.c

来自「Solaris操作系统下的过滤驱动程序, C源码程序.」· C语言 代码 · 共 85 行

C
85
字号
/* * Copyright (c) 1997-2003 Erez Zadok * Copyright (c) 2001-2003 Stony Brook University * Copyright (c) 1997-2000 Columbia University * * For specific licensing information, see the COPYING file distributed with * this package, or get one from ftp://ftp.filesystems.org/pub/fist/COPYING. * * This Copyright notice must be kept intact and distributed with all * fistgen sources INCLUDING sources generated by fistgen. *//* *  $Id: subr.c,v 1.7 2003/02/10 04:08:13 cwright Exp $ */#ifdef HAVE_CONFIG_H# include <config.h>#endif /* HAVE_CONFIG_H */#ifdef FISTGEN# include "fist_wrapfs.h"#endif /* FISTGEN */#include "fist.h"#include "wrapfs.h"#error do not compile this file directly. it is only an example.#ifdef FIST_FILTER_DATA/* * return the number of bytes written */intwrapfs_encode_block(const char *inbuf, char *outbuf, int len){    memcpy(outbuf, inbuf, len);    return len;}/* * return the number of bytes written */intwrapfs_decode_block(const char *inbuf, char *outbuf, int len){    memcpy(outbuf, inbuf, len);    return len;}#endif /* FIST_FILTER_DATA */#ifdef FIST_FILTER_NAMEintwrapfs_encode_filename(const char *name, int length, char **encoded_name, int skip_dots, const vnode_t *this_vnode, const vfs_t *this_vfsp){    int encoded_length;    encoded_length = length + 1;    *encoded_name = kmalloc(encoded_length, GFP_KERNEL);    ASSERT(*encoded_name);    memcpy(*encoded_name, name, length);    (*encoded_name)[length] = '\0';    return encoded_length;}/* returns length of decoded string, or -1 if error */intwrapfs_decode_filename(const char *name, int length, char **decoded_name, int skip_dots, const vnode_t *this_vnode, const vfs_t *this_vfsp){    int error = 0;    *decoded_name = kmalloc(length, GFP_KERNEL);    ASSERT(*decoded_name);    memcpy(*decoded_name, name, length);    error = length;    return error;}#endif /* FIST_FILTER_NAME *//* * Local variables: * c-basic-offset: 4 * End: */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?