move internal-only parts of ncpfs headers to fs/ncpfs
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
@@ -21,9 +21,7 @@
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/byteorder.h>
|
||||
|
||||
#include <linux/ncp_fs.h>
|
||||
|
||||
#include "ncplib_kernel.h"
|
||||
#include "ncp_fs.h"
|
||||
|
||||
static void ncp_read_volume_list(struct file *, void *, filldir_t,
|
||||
struct ncp_cache_control *);
|
||||
|
@@ -18,8 +18,7 @@
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/sched.h>
|
||||
|
||||
#include <linux/ncp_fs.h>
|
||||
#include "ncplib_kernel.h"
|
||||
#include "ncp_fs.h"
|
||||
|
||||
static int ncp_fsync(struct file *file, int datasync)
|
||||
{
|
||||
|
@@ -31,11 +31,9 @@
|
||||
#include <linux/seq_file.h>
|
||||
#include <linux/namei.h>
|
||||
|
||||
#include <linux/ncp_fs.h>
|
||||
|
||||
#include <net/sock.h>
|
||||
|
||||
#include "ncplib_kernel.h"
|
||||
#include "ncp_fs.h"
|
||||
#include "getopt.h"
|
||||
|
||||
#define NCP_DEFAULT_FILE_MODE 0600
|
||||
|
@@ -20,11 +20,9 @@
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/sched.h>
|
||||
|
||||
#include <linux/ncp_fs.h>
|
||||
|
||||
#include <asm/uaccess.h>
|
||||
|
||||
#include "ncplib_kernel.h"
|
||||
#include "ncp_fs.h"
|
||||
|
||||
/* maximum limit for ncp_objectname_ioctl */
|
||||
#define NCP_OBJECT_NAME_MAX_LEN 4096
|
||||
|
@@ -16,12 +16,12 @@
|
||||
#include <linux/mman.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/fcntl.h>
|
||||
#include <linux/ncp_fs.h>
|
||||
|
||||
#include "ncplib_kernel.h"
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/system.h>
|
||||
|
||||
#include "ncp_fs.h"
|
||||
|
||||
/*
|
||||
* Fill in the supplied page for mmap
|
||||
* XXX: how are we excluding truncate/invalidate here? Maybe need to lock
|
||||
|
98
fs/ncpfs/ncp_fs.h
Normal file
98
fs/ncpfs/ncp_fs.h
Normal file
@@ -0,0 +1,98 @@
|
||||
#include <linux/ncp_fs.h>
|
||||
#include "ncp_fs_i.h"
|
||||
#include "ncp_fs_sb.h"
|
||||
|
||||
/* define because it is easy to change PRINTK to {*}PRINTK */
|
||||
#define PRINTK(format, args...) printk(KERN_DEBUG format , ## args)
|
||||
|
||||
#undef NCPFS_PARANOIA
|
||||
#ifdef NCPFS_PARANOIA
|
||||
#define PPRINTK(format, args...) PRINTK(format , ## args)
|
||||
#else
|
||||
#define PPRINTK(format, args...)
|
||||
#endif
|
||||
|
||||
#ifndef DEBUG_NCP
|
||||
#define DEBUG_NCP 0
|
||||
#endif
|
||||
#if DEBUG_NCP > 0
|
||||
#define DPRINTK(format, args...) PRINTK(format , ## args)
|
||||
#else
|
||||
#define DPRINTK(format, args...)
|
||||
#endif
|
||||
#if DEBUG_NCP > 1
|
||||
#define DDPRINTK(format, args...) PRINTK(format , ## args)
|
||||
#else
|
||||
#define DDPRINTK(format, args...)
|
||||
#endif
|
||||
|
||||
#define NCP_MAX_RPC_TIMEOUT (6*HZ)
|
||||
|
||||
|
||||
struct ncp_entry_info {
|
||||
struct nw_info_struct i;
|
||||
ino_t ino;
|
||||
int opened;
|
||||
int access;
|
||||
unsigned int volume;
|
||||
__u8 file_handle[6];
|
||||
};
|
||||
|
||||
static inline struct ncp_server *NCP_SBP(const struct super_block *sb)
|
||||
{
|
||||
return sb->s_fs_info;
|
||||
}
|
||||
|
||||
#define NCP_SERVER(inode) NCP_SBP((inode)->i_sb)
|
||||
static inline struct ncp_inode_info *NCP_FINFO(const struct inode *inode)
|
||||
{
|
||||
return container_of(inode, struct ncp_inode_info, vfs_inode);
|
||||
}
|
||||
|
||||
/* linux/fs/ncpfs/inode.c */
|
||||
int ncp_notify_change(struct dentry *, struct iattr *);
|
||||
struct inode *ncp_iget(struct super_block *, struct ncp_entry_info *);
|
||||
void ncp_update_inode(struct inode *, struct ncp_entry_info *);
|
||||
void ncp_update_inode2(struct inode *, struct ncp_entry_info *);
|
||||
|
||||
/* linux/fs/ncpfs/dir.c */
|
||||
extern const struct inode_operations ncp_dir_inode_operations;
|
||||
extern const struct file_operations ncp_dir_operations;
|
||||
extern const struct dentry_operations ncp_dentry_operations;
|
||||
int ncp_conn_logged_in(struct super_block *);
|
||||
int ncp_date_dos2unix(__le16 time, __le16 date);
|
||||
void ncp_date_unix2dos(int unix_date, __le16 * time, __le16 * date);
|
||||
|
||||
/* linux/fs/ncpfs/ioctl.c */
|
||||
long ncp_ioctl(struct file *, unsigned int, unsigned long);
|
||||
long ncp_compat_ioctl(struct file *, unsigned int, unsigned long);
|
||||
|
||||
/* linux/fs/ncpfs/sock.c */
|
||||
int ncp_request2(struct ncp_server *server, int function,
|
||||
void* reply, int max_reply_size);
|
||||
static inline int ncp_request(struct ncp_server *server, int function) {
|
||||
return ncp_request2(server, function, server->packet, server->packet_size);
|
||||
}
|
||||
int ncp_connect(struct ncp_server *server);
|
||||
int ncp_disconnect(struct ncp_server *server);
|
||||
void ncp_lock_server(struct ncp_server *server);
|
||||
void ncp_unlock_server(struct ncp_server *server);
|
||||
|
||||
/* linux/fs/ncpfs/symlink.c */
|
||||
#if defined(CONFIG_NCPFS_EXTRAS) || defined(CONFIG_NCPFS_NFS_NS)
|
||||
extern const struct address_space_operations ncp_symlink_aops;
|
||||
int ncp_symlink(struct inode*, struct dentry*, const char*);
|
||||
#endif
|
||||
|
||||
/* linux/fs/ncpfs/file.c */
|
||||
extern const struct inode_operations ncp_file_inode_operations;
|
||||
extern const struct file_operations ncp_file_operations;
|
||||
int ncp_make_open(struct inode *, int);
|
||||
|
||||
/* linux/fs/ncpfs/mmap.c */
|
||||
int ncp_mmap(struct file *, struct vm_area_struct *);
|
||||
|
||||
/* linux/fs/ncpfs/ncplib_kernel.c */
|
||||
int ncp_make_closed(struct inode *);
|
||||
|
||||
#include "ncplib_kernel.h"
|
29
fs/ncpfs/ncp_fs_i.h
Normal file
29
fs/ncpfs/ncp_fs_i.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* ncp_fs_i.h
|
||||
*
|
||||
* Copyright (C) 1995 Volker Lendecke
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_NCP_FS_I
|
||||
#define _LINUX_NCP_FS_I
|
||||
|
||||
/*
|
||||
* This is the ncpfs part of the inode structure. This must contain
|
||||
* all the information we need to work with an inode after creation.
|
||||
*/
|
||||
struct ncp_inode_info {
|
||||
__le32 dirEntNum;
|
||||
__le32 DosDirNum;
|
||||
__u8 volNumber;
|
||||
__le32 nwattr;
|
||||
struct mutex open_mutex;
|
||||
atomic_t opened;
|
||||
int access;
|
||||
int flags;
|
||||
#define NCPI_KLUDGE_SYMLINK 0x0001
|
||||
__u8 file_handle[6];
|
||||
struct inode vfs_inode;
|
||||
};
|
||||
|
||||
#endif /* _LINUX_NCP_FS_I */
|
176
fs/ncpfs/ncp_fs_sb.h
Normal file
176
fs/ncpfs/ncp_fs_sb.h
Normal file
@@ -0,0 +1,176 @@
|
||||
/*
|
||||
* ncp_fs_sb.h
|
||||
*
|
||||
* Copyright (C) 1995, 1996 by Volker Lendecke
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _NCP_FS_SB
|
||||
#define _NCP_FS_SB
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/ncp_mount.h>
|
||||
#include <linux/net.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/backing-dev.h>
|
||||
#include <linux/workqueue.h>
|
||||
|
||||
#define NCP_DEFAULT_OPTIONS 0 /* 2 for packet signatures */
|
||||
|
||||
struct sock;
|
||||
|
||||
struct ncp_mount_data_kernel {
|
||||
unsigned long flags; /* NCP_MOUNT_* flags */
|
||||
unsigned int int_flags; /* internal flags */
|
||||
#define NCP_IMOUNT_LOGGEDIN_POSSIBLE 0x0001
|
||||
__kernel_uid32_t mounted_uid; /* Who may umount() this filesystem? */
|
||||
struct pid *wdog_pid; /* Who cares for our watchdog packets? */
|
||||
unsigned int ncp_fd; /* The socket to the ncp port */
|
||||
unsigned int time_out; /* How long should I wait after
|
||||
sending a NCP request? */
|
||||
unsigned int retry_count; /* And how often should I retry? */
|
||||
unsigned char mounted_vol[NCP_VOLNAME_LEN + 1];
|
||||
__kernel_uid32_t uid;
|
||||
__kernel_gid32_t gid;
|
||||
__kernel_mode_t file_mode;
|
||||
__kernel_mode_t dir_mode;
|
||||
int info_fd;
|
||||
};
|
||||
|
||||
struct ncp_server {
|
||||
|
||||
struct ncp_mount_data_kernel m; /* Nearly all of the mount data is of
|
||||
interest for us later, so we store
|
||||
it completely. */
|
||||
|
||||
__u8 name_space[NCP_NUMBER_OF_VOLUMES + 2];
|
||||
|
||||
struct file *ncp_filp; /* File pointer to ncp socket */
|
||||
struct socket *ncp_sock;/* ncp socket */
|
||||
struct file *info_filp;
|
||||
struct socket *info_sock;
|
||||
|
||||
u8 sequence;
|
||||
u8 task;
|
||||
u16 connection; /* Remote connection number */
|
||||
|
||||
u8 completion; /* Status message from server */
|
||||
u8 conn_status; /* Bit 4 = 1 ==> Server going down, no
|
||||
requests allowed anymore.
|
||||
Bit 0 = 1 ==> Server is down. */
|
||||
|
||||
int buffer_size; /* Negotiated bufsize */
|
||||
|
||||
int reply_size; /* Size of last reply */
|
||||
|
||||
int packet_size;
|
||||
unsigned char *packet; /* Here we prepare requests and
|
||||
receive replies */
|
||||
unsigned char *txbuf; /* Storage for current request */
|
||||
unsigned char *rxbuf; /* Storage for reply to current request */
|
||||
|
||||
int lock; /* To prevent mismatch in protocols. */
|
||||
struct mutex mutex;
|
||||
|
||||
int current_size; /* for packet preparation */
|
||||
int has_subfunction;
|
||||
int ncp_reply_size;
|
||||
|
||||
int root_setuped;
|
||||
struct mutex root_setup_lock;
|
||||
|
||||
/* info for packet signing */
|
||||
int sign_wanted; /* 1=Server needs signed packets */
|
||||
int sign_active; /* 0=don't do signing, 1=do */
|
||||
char sign_root[8]; /* generated from password and encr. key */
|
||||
char sign_last[16];
|
||||
|
||||
/* Authentication info: NDS or BINDERY, username */
|
||||
struct {
|
||||
int auth_type;
|
||||
size_t object_name_len;
|
||||
void* object_name;
|
||||
int object_type;
|
||||
} auth;
|
||||
/* Password info */
|
||||
struct {
|
||||
size_t len;
|
||||
void* data;
|
||||
} priv;
|
||||
struct rw_semaphore auth_rwsem;
|
||||
|
||||
/* nls info: codepage for volume and charset for I/O */
|
||||
struct nls_table *nls_vol;
|
||||
struct nls_table *nls_io;
|
||||
|
||||
/* maximum age in jiffies */
|
||||
atomic_t dentry_ttl;
|
||||
|
||||
/* miscellaneous */
|
||||
unsigned int flags;
|
||||
|
||||
spinlock_t requests_lock; /* Lock accesses to tx.requests, tx.creq and rcv.creq when STREAM mode */
|
||||
|
||||
void (*data_ready)(struct sock* sk, int len);
|
||||
void (*error_report)(struct sock* sk);
|
||||
void (*write_space)(struct sock* sk); /* STREAM mode only */
|
||||
struct {
|
||||
struct work_struct tq; /* STREAM/DGRAM: data/error ready */
|
||||
struct ncp_request_reply* creq; /* STREAM/DGRAM: awaiting reply from this request */
|
||||
struct mutex creq_mutex; /* DGRAM only: lock accesses to rcv.creq */
|
||||
|
||||
unsigned int state; /* STREAM only: receiver state */
|
||||
struct {
|
||||
__u32 magic __packed;
|
||||
__u32 len __packed;
|
||||
__u16 type __packed;
|
||||
__u16 p1 __packed;
|
||||
__u16 p2 __packed;
|
||||
__u16 p3 __packed;
|
||||
__u16 type2 __packed;
|
||||
} buf; /* STREAM only: temporary buffer */
|
||||
unsigned char* ptr; /* STREAM only: pointer to data */
|
||||
size_t len; /* STREAM only: length of data to receive */
|
||||
} rcv;
|
||||
struct {
|
||||
struct list_head requests; /* STREAM only: queued requests */
|
||||
struct work_struct tq; /* STREAM only: transmitter ready */
|
||||
struct ncp_request_reply* creq; /* STREAM only: currently transmitted entry */
|
||||
} tx;
|
||||
struct timer_list timeout_tm; /* DGRAM only: timeout timer */
|
||||
struct work_struct timeout_tq; /* DGRAM only: associated queue, we run timers from process context */
|
||||
int timeout_last; /* DGRAM only: current timeout length */
|
||||
int timeout_retries; /* DGRAM only: retries left */
|
||||
struct {
|
||||
size_t len;
|
||||
__u8 data[128];
|
||||
} unexpected_packet;
|
||||
struct backing_dev_info bdi;
|
||||
};
|
||||
|
||||
extern void ncp_tcp_rcv_proc(struct work_struct *work);
|
||||
extern void ncp_tcp_tx_proc(struct work_struct *work);
|
||||
extern void ncpdgram_rcv_proc(struct work_struct *work);
|
||||
extern void ncpdgram_timeout_proc(struct work_struct *work);
|
||||
extern void ncpdgram_timeout_call(unsigned long server);
|
||||
extern void ncp_tcp_data_ready(struct sock* sk, int len);
|
||||
extern void ncp_tcp_write_space(struct sock* sk);
|
||||
extern void ncp_tcp_error_report(struct sock* sk);
|
||||
|
||||
#define NCP_FLAG_UTF8 1
|
||||
|
||||
#define NCP_CLR_FLAG(server, flag) ((server)->flags &= ~(flag))
|
||||
#define NCP_SET_FLAG(server, flag) ((server)->flags |= (flag))
|
||||
#define NCP_IS_FLAG(server, flag) ((server)->flags & (flag))
|
||||
|
||||
static inline int ncp_conn_valid(struct ncp_server *server)
|
||||
{
|
||||
return ((server->conn_status & 0x11) == 0);
|
||||
}
|
||||
|
||||
static inline void ncp_invalidate_conn(struct ncp_server *server)
|
||||
{
|
||||
server->conn_status |= 0x01;
|
||||
}
|
||||
|
||||
#endif
|
@@ -11,7 +11,7 @@
|
||||
|
||||
|
||||
|
||||
#include "ncplib_kernel.h"
|
||||
#include "ncp_fs.h"
|
||||
|
||||
static inline void assert_server_locked(struct ncp_server *server)
|
||||
{
|
||||
|
@@ -32,8 +32,6 @@
|
||||
#include <linux/ctype.h>
|
||||
#endif /* CONFIG_NCPFS_NLS */
|
||||
|
||||
#include <linux/ncp_fs.h>
|
||||
|
||||
#define NCP_MIN_SYMLINK_SIZE 8
|
||||
#define NCP_MAX_SYMLINK_SIZE 512
|
||||
|
||||
|
@@ -11,6 +11,7 @@
|
||||
#include <linux/string.h>
|
||||
#include <linux/ncp.h>
|
||||
#include <linux/bitops.h>
|
||||
#include "ncp_fs.h"
|
||||
#include "ncpsign_kernel.h"
|
||||
|
||||
/* i386: 32-bit, little endian, handles mis-alignment */
|
||||
|
@@ -8,8 +8,6 @@
|
||||
#ifndef _NCPSIGN_KERNEL_H
|
||||
#define _NCPSIGN_KERNEL_H
|
||||
|
||||
#include <linux/ncp_fs.h>
|
||||
|
||||
#ifdef CONFIG_NCPFS_PACKET_SIGNING
|
||||
void __sign_packet(struct ncp_server *server, const char *data, size_t size, __u32 totalsize, void *sign_buff);
|
||||
int sign_verify_reply(struct ncp_server *server, const char *data, size_t size, __u32 totalsize, const void *sign_buff);
|
||||
|
@@ -28,7 +28,7 @@
|
||||
#include <linux/poll.h>
|
||||
#include <linux/file.h>
|
||||
|
||||
#include <linux/ncp_fs.h>
|
||||
#include "ncp_fs.h"
|
||||
|
||||
#include "ncpsign_kernel.h"
|
||||
|
||||
|
@@ -25,13 +25,11 @@
|
||||
|
||||
#include <linux/errno.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/ncp_fs.h>
|
||||
#include <linux/time.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/stat.h>
|
||||
#include "ncplib_kernel.h"
|
||||
|
||||
#include "ncp_fs.h"
|
||||
|
||||
/* these magic numbers must appear in the symlink file -- this makes it a bit
|
||||
more resilient against the magic attributes being set on random files. */
|
||||
|
Reference in New Issue
Block a user