Import ncpfs 2.0.10

This commit is contained in:
ncpfs archive import
2026-04-28 20:39:58 +02:00
parent f88460b2e6
commit 1a5653d403
61 changed files with 2859 additions and 2704 deletions

View File

@@ -18,28 +18,30 @@
#define NCP_REQUEST (0x2222)
#define NCP_DEALLOC_SLOT_REQUEST (0x5555)
struct ncp_request_header {
__u16 type __attribute__ ((packed));
__u8 sequence __attribute__ ((packed));
__u8 conn_low __attribute__ ((packed));
__u8 task __attribute__ ((packed));
__u8 conn_high __attribute__ ((packed));
__u8 function __attribute__ ((packed));
__u8 data[0] __attribute__ ((packed));
struct ncp_request_header
{
__u16 type __attribute__((packed));
__u8 sequence __attribute__((packed));
__u8 conn_low __attribute__((packed));
__u8 task __attribute__((packed));
__u8 conn_high __attribute__((packed));
__u8 function __attribute__((packed));
__u8 data[0] __attribute__((packed));
};
#define NCP_REPLY (0x3333)
#define NCP_POSITIVE_ACK (0x9999)
struct ncp_reply_header {
__u16 type __attribute__ ((packed));
__u8 sequence __attribute__ ((packed));
__u8 conn_low __attribute__ ((packed));
__u8 task __attribute__ ((packed));
__u8 conn_high __attribute__ ((packed));
__u8 completion_code __attribute__ ((packed));
__u8 connection_state __attribute__ ((packed));
__u8 data[0] __attribute__ ((packed));
struct ncp_reply_header
{
__u16 type __attribute__((packed));
__u8 sequence __attribute__((packed));
__u8 conn_low __attribute__((packed));
__u8 task __attribute__((packed));
__u8 conn_high __attribute__((packed));
__u8 completion_code __attribute__((packed));
__u8 connection_state __attribute__((packed));
__u8 data[0] __attribute__((packed));
};
@@ -48,45 +50,50 @@ struct ncp_reply_header {
#define NCP_BINDERY_PQUEUE (0x0003)
#define NCP_BINDERY_FSERVER (0x0004)
#define NCP_BINDERY_NAME_LEN (48)
struct ncp_bindery_object {
__u32 object_id;
__u16 object_type;
__u8 object_name[NCP_BINDERY_NAME_LEN];
__u8 object_flags;
__u8 object_security;
__u8 object_has_prop;
struct ncp_bindery_object
{
__u32 object_id;
__u16 object_type;
__u8 object_name[NCP_BINDERY_NAME_LEN];
__u8 object_flags;
__u8 object_security;
__u8 object_has_prop;
};
struct nw_property {
__u8 value[128];
__u8 more_flag;
__u8 property_flag;
struct nw_property
{
__u8 value[128];
__u8 more_flag;
__u8 property_flag;
};
struct prop_net_address {
__u32 network __attribute__ ((packed));
__u8 node[IPX_NODE_LEN] __attribute__ ((packed));
__u16 port __attribute__ ((packed));
struct prop_net_address
{
__u32 network __attribute__((packed));
__u8 node[IPX_NODE_LEN] __attribute__((packed));
__u16 port __attribute__((packed));
};
#define NCP_VOLNAME_LEN (16)
#define NCP_NUMBER_OF_VOLUMES (64)
struct ncp_volume_info {
__u32 total_blocks;
__u32 free_blocks;
__u32 purgeable_blocks;
__u32 not_yet_purgeable_blocks;
__u32 total_dir_entries;
__u32 available_dir_entries;
__u8 sectors_per_block;
char volume_name[NCP_VOLNAME_LEN+1];
struct ncp_volume_info
{
__u32 total_blocks;
__u32 free_blocks;
__u32 purgeable_blocks;
__u32 not_yet_purgeable_blocks;
__u32 total_dir_entries;
__u32 available_dir_entries;
__u8 sectors_per_block;
char volume_name[NCP_VOLNAME_LEN + 1];
};
struct ncp_filesearch_info {
__u8 volume_number;
__u16 directory_id;
__u16 sequence_no;
__u8 access_rights;
struct ncp_filesearch_info
{
__u8 volume_number;
__u16 directory_id;
__u16 sequence_no;
__u8 access_rights;
};
#define NCP_MAX_FILENAME 14
@@ -104,16 +111,17 @@ struct ncp_filesearch_info {
#define AR_EXCLUSIVE (0x20)
#define NCP_FILE_ID_LEN 6
struct ncp_file_info {
__u8 file_id[NCP_FILE_ID_LEN];
char file_name[NCP_MAX_FILENAME+1];
__u8 file_attributes;
__u8 file_mode;
__u32 file_length;
__u16 creation_date;
__u16 access_date;
__u16 update_date;
__u16 update_time;
struct ncp_file_info
{
__u8 file_id[NCP_FILE_ID_LEN];
char file_name[NCP_MAX_FILENAME + 1];
__u8 file_attributes;
__u8 file_mode;
__u32 file_length;
__u16 creation_date;
__u16 access_date;
__u16 update_date;
__u16 update_time;
};
/* Defines for Name Spaces */
@@ -165,32 +173,32 @@ struct ncp_file_info {
struct nw_info_struct
{
__u32 spaceAlloc __attribute__ ((packed));
__u32 attributes __attribute__ ((packed));
__u16 flags __attribute__ ((packed));
__u32 dataStreamSize __attribute__ ((packed));
__u32 totalStreamSize __attribute__ ((packed));
__u16 numberOfStreams __attribute__ ((packed));
__u16 creationTime __attribute__ ((packed));
__u16 creationDate __attribute__ ((packed));
__u32 creatorID __attribute__ ((packed));
__u16 modifyTime __attribute__ ((packed));
__u16 modifyDate __attribute__ ((packed));
__u32 modifierID __attribute__ ((packed));
__u16 lastAccessDate __attribute__ ((packed));
__u16 archiveTime __attribute__ ((packed));
__u16 archiveDate __attribute__ ((packed));
__u32 archiverID __attribute__ ((packed));
__u16 inheritedRightsMask __attribute__ ((packed));
__u32 dirEntNum __attribute__ ((packed));
__u32 DosDirNum __attribute__ ((packed));
__u32 volNumber __attribute__ ((packed));
__u32 EADataSize __attribute__ ((packed));
__u32 EAKeyCount __attribute__ ((packed));
__u32 EAKeySize __attribute__ ((packed));
__u32 NSCreator __attribute__ ((packed));
__u8 nameLen __attribute__ ((packed));
__u8 entryName[256] __attribute__ ((packed));
__u32 spaceAlloc __attribute__((packed));
__u32 attributes __attribute__((packed));
__u16 flags __attribute__((packed));
__u32 dataStreamSize __attribute__((packed));
__u32 totalStreamSize __attribute__((packed));
__u16 numberOfStreams __attribute__((packed));
__u16 creationTime __attribute__((packed));
__u16 creationDate __attribute__((packed));
__u32 creatorID __attribute__((packed));
__u16 modifyTime __attribute__((packed));
__u16 modifyDate __attribute__((packed));
__u32 modifierID __attribute__((packed));
__u16 lastAccessDate __attribute__((packed));
__u16 archiveTime __attribute__((packed));
__u16 archiveDate __attribute__((packed));
__u32 archiverID __attribute__((packed));
__u16 inheritedRightsMask __attribute__((packed));
__u32 dirEntNum __attribute__((packed));
__u32 DosDirNum __attribute__((packed));
__u32 volNumber __attribute__((packed));
__u32 EADataSize __attribute__((packed));
__u32 EAKeyCount __attribute__((packed));
__u32 EAKeySize __attribute__((packed));
__u32 NSCreator __attribute__((packed));
__u8 nameLen __attribute__((packed));
__u8 entryName[256] __attribute__((packed));
};
/* modify mask - use with MODIFY_DOS_INFO structure */
@@ -210,62 +218,66 @@ struct nw_info_struct
struct nw_modify_dos_info
{
__u32 attributes __attribute__ ((packed));
__u16 creationDate __attribute__ ((packed));
__u16 creationTime __attribute__ ((packed));
__u32 creatorID __attribute__ ((packed));
__u16 modifyDate __attribute__ ((packed));
__u16 modifyTime __attribute__ ((packed));
__u32 modifierID __attribute__ ((packed));
__u16 archiveDate __attribute__ ((packed));
__u16 archiveTime __attribute__ ((packed));
__u32 archiverID __attribute__ ((packed));
__u16 lastAccessDate __attribute__ ((packed));
__u16 inheritanceGrantMask __attribute__ ((packed));
__u16 inheritanceRevokeMask __attribute__ ((packed));
__u32 maximumSpace __attribute__ ((packed));
__u32 attributes __attribute__((packed));
__u16 creationDate __attribute__((packed));
__u16 creationTime __attribute__((packed));
__u32 creatorID __attribute__((packed));
__u16 modifyDate __attribute__((packed));
__u16 modifyTime __attribute__((packed));
__u32 modifierID __attribute__((packed));
__u16 archiveDate __attribute__((packed));
__u16 archiveTime __attribute__((packed));
__u32 archiverID __attribute__((packed));
__u16 lastAccessDate __attribute__((packed));
__u16 inheritanceGrantMask __attribute__((packed));
__u16 inheritanceRevokeMask __attribute__((packed));
__u32 maximumSpace __attribute__((packed));
};
struct nw_file_info {
struct nw_file_info
{
struct nw_info_struct i;
int opened;
int access;
__u32 server_file_handle __attribute__ ((packed));
__u8 open_create_action __attribute__ ((packed));
__u8 file_handle[6] __attribute__ ((packed));
int opened;
int access;
__u32 server_file_handle __attribute__((packed));
__u8 open_create_action __attribute__((packed));
__u8 file_handle[6] __attribute__((packed));
};
struct nw_search_sequence {
__u8 volNumber __attribute__ ((packed));
__u32 dirBase __attribute__ ((packed));
__u32 sequence __attribute__ ((packed));
struct nw_search_sequence
{
__u8 volNumber __attribute__((packed));
__u32 dirBase __attribute__((packed));
__u32 sequence __attribute__((packed));
};
struct nw_queue_job_entry {
__u16 InUse __attribute__ ((packed));
__u32 prev __attribute__ ((packed));
__u32 next __attribute__ ((packed));
__u32 ClientStation __attribute__ ((packed));
__u32 ClientTask __attribute__ ((packed));
__u32 ClientObjectID __attribute__ ((packed));
__u32 TargetServerID __attribute__ ((packed));
__u8 TargetExecTime[6] __attribute__ ((packed));
__u8 JobEntryTime[6] __attribute__ ((packed));
__u32 JobNumber __attribute__ ((packed));
__u16 JobType __attribute__ ((packed));
__u16 JobPosition __attribute__ ((packed));
__u16 JobControlFlags __attribute__ ((packed));
__u8 FileNameLen __attribute__ ((packed));
char JobFileName[13] __attribute__ ((packed));
__u32 JobFileHandle __attribute__ ((packed));
__u32 ServerStation __attribute__ ((packed));
__u32 ServerTaskNumber __attribute__ ((packed));
__u32 ServerObjectID __attribute__ ((packed));
char JobTextDescription[50] __attribute__ ((packed));
char ClientRecordArea[152] __attribute__ ((packed));
struct nw_queue_job_entry
{
__u16 InUse __attribute__((packed));
__u32 prev __attribute__((packed));
__u32 next __attribute__((packed));
__u32 ClientStation __attribute__((packed));
__u32 ClientTask __attribute__((packed));
__u32 ClientObjectID __attribute__((packed));
__u32 TargetServerID __attribute__((packed));
__u8 TargetExecTime[6] __attribute__((packed));
__u8 JobEntryTime[6] __attribute__((packed));
__u32 JobNumber __attribute__((packed));
__u16 JobType __attribute__((packed));
__u16 JobPosition __attribute__((packed));
__u16 JobControlFlags __attribute__((packed));
__u8 FileNameLen __attribute__((packed));
char JobFileName[13] __attribute__((packed));
__u32 JobFileHandle __attribute__((packed));
__u32 ServerStation __attribute__((packed));
__u32 ServerTaskNumber __attribute__((packed));
__u32 ServerObjectID __attribute__((packed));
char JobTextDescription[50] __attribute__((packed));
char ClientRecordArea[152] __attribute__((packed));
};
struct queue_job {
struct queue_job
{
struct nw_queue_job_entry j;
__u8 file_handle[6];
};
@@ -285,20 +297,21 @@ struct queue_job {
#define EXPAND_TABS 0x4000
#define PRINT_BANNER 0x8000
struct print_job_record {
__u8 Version __attribute__ ((packed));
__u8 TabSize __attribute__ ((packed));
__u16 Copies __attribute__ ((packed));
__u16 CtrlFlags __attribute__ ((packed));
__u16 Lines __attribute__ ((packed));
__u16 Rows __attribute__ ((packed));
char FormName[16] __attribute__ ((packed));
__u8 Reserved[6] __attribute__ ((packed));
char BannerName[13] __attribute__ ((packed));
char FnameBanner[13] __attribute__ ((packed));
char FnameHeader[14] __attribute__ ((packed));
char Path[80] __attribute__ ((packed));
struct print_job_record
{
__u8 Version __attribute__((packed));
__u8 TabSize __attribute__((packed));
__u16 Copies __attribute__((packed));
__u16 CtrlFlags __attribute__((packed));
__u16 Lines __attribute__((packed));
__u16 Rows __attribute__((packed));
char FormName[16] __attribute__((packed));
__u8 Reserved[6] __attribute__((packed));
char BannerName[13] __attribute__((packed));
char FnameBanner[13] __attribute__((packed));
char FnameHeader[14] __attribute__((packed));
char Path[80] __attribute__((packed));
};
#endif /* _LINUX_NCP_H */
#endif /* _LINUX_NCP_H */

View File

@@ -20,23 +20,25 @@
* ioctl commands
*/
struct ncp_ioctl_request {
unsigned int function;
unsigned int size;
char *data;
struct ncp_ioctl_request
{
unsigned int function;
unsigned int size;
char *data;
};
struct ncp_fs_info {
int version;
struct ncp_fs_info
{
int version;
struct sockaddr_ipx addr;
uid_t mounted_uid;
int connection; /* Connection number the server assigned us */
int buffer_size; /* The negotiated buffer size, to be
uid_t mounted_uid;
int connection; /* Connection number the server assigned us */
int buffer_size; /* The negotiated buffer size, to be
used for read/write requests! */
int volume_number;
__u32 directory_id;
};
int volume_number;
__u32 directory_id;
};
#define NCP_IOC_NCPREQUEST _IOR('n', 1, struct ncp_ioctl_request)
#define NCP_IOC_GETMOUNTUID _IOW('n', 2, uid_t)
@@ -84,24 +86,24 @@ extern int ncp_current_malloced;
static inline void *
ncp_kmalloc(unsigned int size, int priority)
{
ncp_malloced += 1;
ncp_current_malloced += 1;
return kmalloc(size, priority);
ncp_malloced += 1;
ncp_current_malloced += 1;
return kmalloc(size, priority);
}
static inline void
ncp_kfree_s(void *obj, int size)
{
ncp_current_malloced -= 1;
kfree_s(obj, size);
ncp_current_malloced -= 1;
kfree_s(obj, size);
}
#else /* DEBUG_NCP_MALLOC */
#else /* DEBUG_NCP_MALLOC */
#define ncp_kmalloc(s,p) kmalloc(s,p)
#define ncp_kfree_s(o,s) kfree_s(o,s)
#endif /* DEBUG_NCP_MALLOC */
#endif /* DEBUG_NCP_MALLOC */
#if DEBUG_NCP > 0
#define DPRINTK(format, args...) printk(format , ## args)
@@ -125,25 +127,25 @@ extern struct inode_operations ncp_dir_inode_operations;
void ncp_free_inode_info(struct ncp_inode_info *i);
void ncp_free_all_inodes(struct ncp_server *server);
void ncp_init_root(struct ncp_server *server);
int ncp_conn_logged_in(struct ncp_server *server);
int ncp_stat_root(struct ncp_server *server);
int ncp_conn_logged_in(struct ncp_server *server);
int ncp_stat_root(struct ncp_server *server);
void ncp_init_dir_cache(void);
void ncp_invalid_dir_cache(struct inode *ino);
struct ncp_inode_info *ncp_find_inode(struct inode *inode);
ino_t ncp_info_ino(struct ncp_server *server, struct ncp_inode_info *info);
void ncp_invalidate_all_inodes(struct ncp_server *server);
void ncp_free_dir_cache(void);
int ncp_date_dos2unix(__u16 time, __u16 date);
void ncp_date_unix2dos(int unix_date, __u16 *time, __u16 *date);
int ncp_date_dos2unix(__u16 time, __u16 date);
void ncp_date_unix2dos(int unix_date, __u16 * time, __u16 * date);
/* linux/fs/ncpfs/ioctl.c */
int ncp_ioctl (struct inode * inode, struct file * filp,
unsigned int cmd, unsigned long arg);
int ncp_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
/* linux/fs/ncpfs/inode.c */
struct super_block *ncp_read_super(struct super_block *sb,
void *raw_data, int silent);
void *raw_data, int silent);
void ncp_invalidate_connection(struct ncp_server *server);
int ncp_conn_is_valid(struct ncp_server *server);
@@ -157,8 +159,8 @@ void ncp_lock_server(struct ncp_server *server);
void ncp_unlock_server(struct ncp_server *server);
/* linux/fs/ncpfs/mmap.c */
int ncp_mmap(struct inode * inode, struct file * file, struct vm_area_struct * vma);
int ncp_mmap(struct inode *inode, struct file *file, struct vm_area_struct *vma);
#endif /* __KERNEL__ */
#endif /* __KERNEL__ */
#endif /* _LINUX_NCP_FS_H */
#endif /* _LINUX_NCP_FS_H */

View File

@@ -12,22 +12,24 @@
#ifdef __KERNEL__
enum ncp_inode_state {
NCP_INODE_VALID = 19, /* Inode currently in use */
NCP_INODE_LOOKED_UP, /* directly before iget */
NCP_INODE_CACHED, /* in a path to an inode which is in use */
NCP_INODE_INVALID
enum ncp_inode_state
{
NCP_INODE_VALID = 19, /* Inode currently in use */
NCP_INODE_LOOKED_UP, /* directly before iget */
NCP_INODE_CACHED, /* in a path to an inode which is in use */
NCP_INODE_INVALID
};
/*
* ncp fs inode data (in memory only)
*/
struct ncp_inode_info {
enum ncp_inode_state state;
int nused; /* for directories:
number of references in memory */
struct ncp_inode_info *dir;
struct ncp_inode_info *next, *prev;
struct ncp_inode_info
{
enum ncp_inode_state state;
int nused; /* for directories:
number of references in memory */
struct ncp_inode_info *dir;
struct ncp_inode_info *next, *prev;
struct inode *inode;
struct nw_file_info finfo;
};

View File

@@ -15,11 +15,12 @@
#define NCP_DEFAULT_BUFSIZE 1024
struct ncp_server {
struct ncp_server
{
struct ncp_mount_data m; /* Nearly all of the mount data is of
interest for us later, so we store
it completely. */
struct ncp_mount_data 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];
@@ -30,32 +31,32 @@ struct ncp_server {
old one for checking purposes and
to reset it on unmounting. */
u8 sequence;
u8 task;
u16 connection; /* Remote connection number */
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
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 buffer_size; /* Negotiated bufsize */
int reply_size; /* Size of last reply */
int reply_size; /* Size of last reply */
int packet_size;
int packet_size;
unsigned char *packet; /* Here we prepare requests and
receive replies */
int lock; /* To prevent mismatch in protocols. */
int lock; /* To prevent mismatch in protocols. */
struct wait_queue *wait;
int current_size; /* for packet preparation */
int has_subfunction;
int ncp_reply_size;
int current_size; /* for packet preparation */
int has_subfunction;
int ncp_reply_size;
struct ncp_inode_info root;
char root_path; /* '\0' */
struct ncp_inode_info root;
char root_path; /* '\0' */
};
static inline int
@@ -70,6 +71,6 @@ ncp_invalidate_conn(struct ncp_server *server)
server->conn_status |= 0x01;
}
#endif /* __KERNEL__ */
#endif /* __KERNEL__ */
#endif

View File

@@ -22,28 +22,29 @@
#define NCP_MOUNT_SOFT 0x0001
#define NCP_MOUNT_INTR 0x0002
struct ncp_mount_data {
struct ncp_mount_data
{
int version;
unsigned int ncp_fd; /* The socket to the ncp port */
unsigned int wdog_fd; /* Watchdog packets come here */
unsigned int message_fd; /* Message notifications come here */
uid_t mounted_uid; /* Who may umount() this filesystem? */
unsigned int message_fd; /* Message notifications come here */
uid_t mounted_uid; /* Who may umount() this filesystem? */
struct sockaddr_ipx serv_addr;
unsigned char server_name[NCP_BINDERY_NAME_LEN];
unsigned char mount_point[PATH_MAX+1];
unsigned char mounted_vol[NCP_VOLNAME_LEN+1];
unsigned char mount_point[PATH_MAX + 1];
unsigned char mounted_vol[NCP_VOLNAME_LEN + 1];
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 int retry_count; /* And how often should I retry? */
unsigned int flags;
uid_t uid;
gid_t gid;
mode_t file_mode;
mode_t dir_mode;
uid_t uid;
gid_t gid;
mode_t file_mode;
mode_t dir_mode;
};
#endif