OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [rc203soc/] [sw/] [uClinux/] [fs/] [autofs/] [autofs_i.h] - Diff between revs 1765 and 1782

Only display areas with differences | Details | Blame | View Log

Rev 1765 Rev 1782
/* -*- linux-c -*- ------------------------------------------------------- *
/* -*- linux-c -*- ------------------------------------------------------- *
 *
 *
 * linux/fs/autofs/autofs_i.h
 * linux/fs/autofs/autofs_i.h
 *
 *
 *   Copyright 1997 Transmeta Corporation - All Rights Reserved
 *   Copyright 1997 Transmeta Corporation - All Rights Reserved
 *
 *
 * This file is part of the Linux kernel and is made available under
 * This file is part of the Linux kernel and is made available under
 * the terms of the GNU General Public License, version 2, or at your
 * the terms of the GNU General Public License, version 2, or at your
 * option, any later version, incorporated herein by reference.
 * option, any later version, incorporated herein by reference.
 *
 *
 * ----------------------------------------------------------------------- */
 * ----------------------------------------------------------------------- */
 
 
/* Internal header file for autofs */
/* Internal header file for autofs */
 
 
#include <linux/auto_fs.h>
#include <linux/auto_fs.h>
 
 
/* This is the range of ioctl() numbers we claim as ours */
/* This is the range of ioctl() numbers we claim as ours */
#define AUTOFS_IOC_FIRST     AUTOFS_IOC_READY
#define AUTOFS_IOC_FIRST     AUTOFS_IOC_READY
#define AUTOFS_IOC_COUNT     32
#define AUTOFS_IOC_COUNT     32
 
 
#include <linux/kernel.h>
#include <linux/kernel.h>
#include <linux/malloc.h>
#include <linux/malloc.h>
#include <linux/sched.h>
#include <linux/sched.h>
#include <linux/string.h>
#include <linux/string.h>
#include <linux/wait.h>
#include <linux/wait.h>
 
 
#define kver(a,b,c) (((a) << 16) + ((b) << 8) + (c)) 
#define kver(a,b,c) (((a) << 16) + ((b) << 8) + (c)) 
 
 
#if LINUX_VERSION_CODE < kver(2,1,0)
#if LINUX_VERSION_CODE < kver(2,1,0)
 
 
/* Segmentation stuff for pre-2.1 kernels */
/* Segmentation stuff for pre-2.1 kernels */
#include <asm/segment.h>
#include <asm/segment.h>
 
 
static inline int copy_to_user(void *dst, void *src, unsigned long len)
static inline int copy_to_user(void *dst, void *src, unsigned long len)
{
{
        int rv = verify_area(VERIFY_WRITE, dst, len);
        int rv = verify_area(VERIFY_WRITE, dst, len);
        if ( rv )
        if ( rv )
                return -1;
                return -1;
        memcpy_tofs(dst,src,len);
        memcpy_tofs(dst,src,len);
        return 0;
        return 0;
}
}
 
 
static inline int copy_from_user(void *dst, void *src, unsigned long len)
static inline int copy_from_user(void *dst, void *src, unsigned long len)
{
{
        int rv = verify_area(VERIFY_READ, src, len);
        int rv = verify_area(VERIFY_READ, src, len);
        if ( rv )
        if ( rv )
                return -1;
                return -1;
        memcpy_fromfs(dst,src,len);
        memcpy_fromfs(dst,src,len);
        return 0;
        return 0;
}
}
 
 
#else
#else
 
 
/* Segmentation stuff for post-2.1 kernels */
/* Segmentation stuff for post-2.1 kernels */
#include <asm/uaccess.h>
#include <asm/uaccess.h>
#define register_symtab(x)      ((void)0)
#define register_symtab(x)      ((void)0)
 
 
#endif
#endif
 
 
#ifdef DEBUG
#ifdef DEBUG
#define DPRINTK(D) printk D;
#define DPRINTK(D) printk D;
#else
#else
#define DPRINTK(D)
#define DPRINTK(D)
#endif
#endif
 
 
#define AUTOFS_SUPER_MAGIC 0x0187
#define AUTOFS_SUPER_MAGIC 0x0187
 
 
/* Structures associated with the root directory hash */
/* Structures associated with the root directory hash */
 
 
#define AUTOFS_HASH_SIZE 67
#define AUTOFS_HASH_SIZE 67
 
 
typedef u32 autofs_hash_t;      /* Type returned by autofs_hash() */
typedef u32 autofs_hash_t;      /* Type returned by autofs_hash() */
 
 
struct autofs_dir_ent {
struct autofs_dir_ent {
        autofs_hash_t hash;
        autofs_hash_t hash;
        struct autofs_dir_ent *next;
        struct autofs_dir_ent *next;
        struct autofs_dir_ent **back;
        struct autofs_dir_ent **back;
        char *name;
        char *name;
        int len;
        int len;
        ino_t ino;
        ino_t ino;
        /* The following entries are for the expiry system */
        /* The following entries are for the expiry system */
        unsigned long last_usage;
        unsigned long last_usage;
        struct autofs_dir_ent *exp_next;
        struct autofs_dir_ent *exp_next;
        struct autofs_dir_ent *exp_prev;
        struct autofs_dir_ent *exp_prev;
};
};
 
 
struct autofs_dirhash {
struct autofs_dirhash {
        struct autofs_dir_ent *h[AUTOFS_HASH_SIZE];
        struct autofs_dir_ent *h[AUTOFS_HASH_SIZE];
        struct autofs_dir_ent expiry_head;
        struct autofs_dir_ent expiry_head;
};
};
 
 
struct autofs_wait_queue {
struct autofs_wait_queue {
        unsigned long wait_queue_token;
        unsigned long wait_queue_token;
        struct wait_queue *queue;
        struct wait_queue *queue;
        struct autofs_wait_queue *next;
        struct autofs_wait_queue *next;
        /* We use the following to see what we are waiting for */
        /* We use the following to see what we are waiting for */
        autofs_hash_t hash;
        autofs_hash_t hash;
        int len;
        int len;
        char *name;
        char *name;
        /* This is for status reporting upon return */
        /* This is for status reporting upon return */
        int status;
        int status;
        int wait_ctr;
        int wait_ctr;
};
};
 
 
struct autofs_symlink {
struct autofs_symlink {
        int len;
        int len;
        char *data;
        char *data;
        time_t mtime;
        time_t mtime;
};
};
 
 
#define AUTOFS_MAX_SYMLINKS 256
#define AUTOFS_MAX_SYMLINKS 256
 
 
#define AUTOFS_ROOT_INO      1
#define AUTOFS_ROOT_INO      1
#define AUTOFS_FIRST_SYMLINK 2
#define AUTOFS_FIRST_SYMLINK 2
#define AUTOFS_FIRST_DIR_INO (AUTOFS_FIRST_SYMLINK+AUTOFS_MAX_SYMLINKS)
#define AUTOFS_FIRST_DIR_INO (AUTOFS_FIRST_SYMLINK+AUTOFS_MAX_SYMLINKS)
 
 
#define AUTOFS_SYMLINK_BITMAP_LEN ((AUTOFS_MAX_SYMLINKS+31)/32)
#define AUTOFS_SYMLINK_BITMAP_LEN ((AUTOFS_MAX_SYMLINKS+31)/32)
 
 
#ifndef END_OF_TIME
#ifndef END_OF_TIME
#define END_OF_TIME ((time_t)((unsigned long)((time_t)(~0UL)) >> 1))
#define END_OF_TIME ((time_t)((unsigned long)((time_t)(~0UL)) >> 1))
#endif
#endif
 
 
#define AUTOFS_SBI_MAGIC 0x6d4a556d
#define AUTOFS_SBI_MAGIC 0x6d4a556d
 
 
struct autofs_sb_info {
struct autofs_sb_info {
        u32 magic;
        u32 magic;
        struct file *pipe;
        struct file *pipe;
        pid_t oz_pgrp;
        pid_t oz_pgrp;
        int catatonic;
        int catatonic;
        unsigned long exp_timeout;
        unsigned long exp_timeout;
        ino_t next_dir_ino;
        ino_t next_dir_ino;
        struct autofs_wait_queue *queues; /* Wait queue pointer */
        struct autofs_wait_queue *queues; /* Wait queue pointer */
        struct autofs_dirhash dirhash; /* Root directory hash */
        struct autofs_dirhash dirhash; /* Root directory hash */
        struct autofs_symlink symlink[AUTOFS_MAX_SYMLINKS];
        struct autofs_symlink symlink[AUTOFS_MAX_SYMLINKS];
        u32 symlink_bitmap[AUTOFS_SYMLINK_BITMAP_LEN];
        u32 symlink_bitmap[AUTOFS_SYMLINK_BITMAP_LEN];
};
};
 
 
/* autofs_oz_mode(): do we see the man behind the curtain? */
/* autofs_oz_mode(): do we see the man behind the curtain? */
static inline int autofs_oz_mode(struct autofs_sb_info *sbi) {
static inline int autofs_oz_mode(struct autofs_sb_info *sbi) {
        return sbi->catatonic || current->pgrp == sbi->oz_pgrp;
        return sbi->catatonic || current->pgrp == sbi->oz_pgrp;
}
}
 
 
/* Debug the mysteriously disappearing wait list */
/* Debug the mysteriously disappearing wait list */
 
 
#ifdef DEBUG_WAITLIST
#ifdef DEBUG_WAITLIST
#define CHECK_WAITLIST(S,O) autofs_check_waitlist_integrity(S,O)
#define CHECK_WAITLIST(S,O) autofs_check_waitlist_integrity(S,O)
void autofs_check_waitlist_integrity(struct autofs_sb_info *,char *);
void autofs_check_waitlist_integrity(struct autofs_sb_info *,char *);
#else
#else
#define CHECK_WAITLIST(S,O)
#define CHECK_WAITLIST(S,O)
#endif
#endif
 
 
/* Hash operations */
/* Hash operations */
 
 
autofs_hash_t autofs_hash(const char *,int);
autofs_hash_t autofs_hash(const char *,int);
void autofs_initialize_hash(struct autofs_dirhash *);
void autofs_initialize_hash(struct autofs_dirhash *);
struct autofs_dir_ent *autofs_hash_lookup(const struct autofs_dirhash *,autofs_hash_t,const char *,int);
struct autofs_dir_ent *autofs_hash_lookup(const struct autofs_dirhash *,autofs_hash_t,const char *,int);
void autofs_hash_insert(struct autofs_dirhash *,struct autofs_dir_ent *);
void autofs_hash_insert(struct autofs_dirhash *,struct autofs_dir_ent *);
void autofs_hash_delete(struct autofs_dir_ent *);
void autofs_hash_delete(struct autofs_dir_ent *);
struct autofs_dir_ent *autofs_hash_enum(const struct autofs_dirhash *,off_t *);
struct autofs_dir_ent *autofs_hash_enum(const struct autofs_dirhash *,off_t *);
void autofs_hash_nuke(struct autofs_dirhash *);
void autofs_hash_nuke(struct autofs_dirhash *);
 
 
/* Expiration-handling functions */
/* Expiration-handling functions */
 
 
void autofs_update_usage(struct autofs_dirhash *,struct autofs_dir_ent *);
void autofs_update_usage(struct autofs_dirhash *,struct autofs_dir_ent *);
struct autofs_dir_ent *autofs_expire(struct autofs_dirhash *,unsigned long);
struct autofs_dir_ent *autofs_expire(struct autofs_dirhash *,unsigned long);
 
 
/* Operations structures */
/* Operations structures */
 
 
extern struct inode_operations autofs_root_inode_operations;
extern struct inode_operations autofs_root_inode_operations;
extern struct inode_operations autofs_symlink_inode_operations;
extern struct inode_operations autofs_symlink_inode_operations;
extern struct inode_operations autofs_dir_inode_operations;
extern struct inode_operations autofs_dir_inode_operations;
 
 
/* Initializing function */
/* Initializing function */
 
 
struct super_block *autofs_read_super(struct super_block *, void *,int);
struct super_block *autofs_read_super(struct super_block *, void *,int);
 
 
/* Queue management functions */
/* Queue management functions */
 
 
int autofs_wait(struct autofs_sb_info *,autofs_hash_t,const char *,int);
int autofs_wait(struct autofs_sb_info *,autofs_hash_t,const char *,int);
int autofs_wait_release(struct autofs_sb_info *,unsigned long,int);
int autofs_wait_release(struct autofs_sb_info *,unsigned long,int);
void autofs_catatonic_mode(struct autofs_sb_info *);
void autofs_catatonic_mode(struct autofs_sb_info *);
 
 
#ifdef DEBUG
#ifdef DEBUG
void autofs_say(const char *name, int len);
void autofs_say(const char *name, int len);
#else
#else
#define autofs_say(n,l)
#define autofs_say(n,l)
#endif
#endif
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.