4 * Copyright (C) 1995, 1996 by Volker Lendecke
8 #ifndef _LINUX_NCP_FS_H
9 #define _LINUX_NCP_FS_H
13 #include <linux/types.h>
15 #include <linux/ipx.h>
16 #include <linux/ncp_no.h>
22 struct ncp_ioctl_request
{
23 unsigned int function
;
30 struct sockaddr_ipx addr
;
31 __kernel_uid_t mounted_uid
;
32 int connection
; /* Connection number the server assigned us */
33 int buffer_size
; /* The negotiated buffer size, to be
34 used for read/write requests! */
40 struct ncp_fs_info_v2
{
42 unsigned long mounted_uid
;
43 unsigned int connection
;
44 unsigned int buffer_size
;
46 unsigned int volume_number
;
62 #define NCP_LOCK_LOG 0
65 #define NCP_LOCK_CLEAR 256
70 #define NCP_LOCK_DEFAULT_TIMEOUT 18
71 #define NCP_LOCK_MAX_TIMEOUT 180
75 struct ncp_setroot_ioctl
82 struct ncp_objectname_ioctl
84 #define NCP_AUTH_NONE 0x00
85 #define NCP_AUTH_BIND 0x31
86 #define NCP_AUTH_NDS 0x32
88 size_t object_name_len
;
89 void* object_name
; /* an userspace data, in most cases user name */
92 struct ncp_privatedata_ioctl
95 void* data
; /* ~1000 for NDS */
98 /* NLS charsets by ioctl */
99 #define NCP_IOCSNAME_LEN 20
102 unsigned char codepage
[NCP_IOCSNAME_LEN
+1];
103 unsigned char iocharset
[NCP_IOCSNAME_LEN
+1];
106 #define NCP_IOC_NCPREQUEST _IOR('n', 1, struct ncp_ioctl_request)
107 #define NCP_IOC_GETMOUNTUID _IOW('n', 2, __kernel_old_uid_t)
108 #define NCP_IOC_GETMOUNTUID2 _IOW('n', 2, unsigned long)
110 #define NCP_IOC_CONN_LOGGED_IN _IO('n', 3)
112 #define NCP_GET_FS_INFO_VERSION (1)
113 #define NCP_IOC_GET_FS_INFO _IOWR('n', 4, struct ncp_fs_info)
114 #define NCP_GET_FS_INFO_VERSION_V2 (2)
115 #define NCP_IOC_GET_FS_INFO_V2 _IOWR('n', 4, struct ncp_fs_info_v2)
117 #define NCP_IOC_SIGN_INIT _IOR('n', 5, struct ncp_sign_init)
118 #define NCP_IOC_SIGN_WANTED _IOR('n', 6, int)
119 #define NCP_IOC_SET_SIGN_WANTED _IOW('n', 6, int)
121 #define NCP_IOC_LOCKUNLOCK _IOR('n', 7, struct ncp_lock_ioctl)
123 #define NCP_IOC_GETROOT _IOW('n', 8, struct ncp_setroot_ioctl)
124 #define NCP_IOC_SETROOT _IOR('n', 8, struct ncp_setroot_ioctl)
126 #define NCP_IOC_GETOBJECTNAME _IOWR('n', 9, struct ncp_objectname_ioctl)
127 #define NCP_IOC_SETOBJECTNAME _IOR('n', 9, struct ncp_objectname_ioctl)
128 #define NCP_IOC_GETPRIVATEDATA _IOWR('n', 10, struct ncp_privatedata_ioctl)
129 #define NCP_IOC_SETPRIVATEDATA _IOR('n', 10, struct ncp_privatedata_ioctl)
131 #define NCP_IOC_GETCHARSETS _IOWR('n', 11, struct ncp_nls_ioctl)
132 #define NCP_IOC_SETCHARSETS _IOR('n', 11, struct ncp_nls_ioctl)
134 #define NCP_IOC_GETDENTRYTTL _IOW('n', 12, __u32)
135 #define NCP_IOC_SETDENTRYTTL _IOR('n', 12, __u32)
138 * The packet size to allocate. One page should be enough.
140 #define NCP_PACKET_SIZE 4070
142 #define NCP_MAXPATHLEN 255
143 #define NCP_MAXNAMELEN 14
147 #include <linux/config.h>
149 /* undef because public define in umsdos_fs.h (ncp_fs.h isn't public) */
151 /* define because it is easy to change PRINTK to {*}PRINTK */
152 #define PRINTK(format, args...) printk(KERN_DEBUG format , ## args)
154 #undef NCPFS_PARANOIA
155 #ifdef NCPFS_PARANOIA
156 #define PPRINTK(format, args...) PRINTK(format , ## args)
158 #define PPRINTK(format, args...)
165 #define DPRINTK(format, args...) PRINTK(format , ## args)
167 #define DPRINTK(format, args...)
170 #define DDPRINTK(format, args...) PRINTK(format , ## args)
172 #define DDPRINTK(format, args...)
175 #define NCP_MAX_RPC_TIMEOUT (6*HZ)
178 struct ncp_entry_info
{
179 struct nw_info_struct i
;
183 __u32 server_file_handle
__attribute__((packed
));
184 __u8 open_create_action
__attribute__((packed
));
185 __u8 file_handle
[6] __attribute__((packed
));
188 /* Guess, what 0x564c is :-) */
189 #define NCP_SUPER_MAGIC 0x564c
192 #define NCP_SBP(sb) (&((sb)->u.ncpfs_sb))
194 #define NCP_SERVER(inode) NCP_SBP((inode)->i_sb)
195 #define NCP_FINFO(inode) (&((inode)->u.ncpfs_i))
197 #ifdef DEBUG_NCP_MALLOC
199 #include <linux/malloc.h>
201 extern int ncp_malloced
;
202 extern int ncp_current_malloced
;
205 ncp_kmalloc(unsigned int size
, int priority
)
208 ncp_current_malloced
+= 1;
209 return kmalloc(size
, priority
);
212 static inline void ncp_kfree_s(void *obj
, int size
)
214 ncp_current_malloced
-= 1;
218 #else /* DEBUG_NCP_MALLOC */
220 #define ncp_kmalloc(s,p) kmalloc(s,p)
221 #define ncp_kfree_s(o,s) kfree_s(o,s)
223 #endif /* DEBUG_NCP_MALLOC */
225 /* linux/fs/ncpfs/inode.c */
226 int ncp_notify_change(struct dentry
*, struct iattr
*);
227 struct super_block
*ncp_read_super(struct super_block
*, void *, int);
228 struct inode
*ncp_iget(struct super_block
*, struct ncp_entry_info
*);
229 void ncp_update_inode(struct inode
*, struct ncp_entry_info
*);
230 void ncp_update_inode2(struct inode
*, struct ncp_entry_info
*);
231 extern int init_ncp_fs(void);
233 /* linux/fs/ncpfs/dir.c */
234 extern struct inode_operations ncp_dir_inode_operations
;
235 int ncp_conn_logged_in(struct super_block
*);
236 int ncp_date_dos2unix(__u16 time
, __u16 date
);
237 void ncp_date_unix2dos(int unix_date
, __u16
* time
, __u16
* date
);
239 /* linux/fs/ncpfs/ioctl.c */
240 int ncp_ioctl(struct inode
*, struct file
*, unsigned int, unsigned long);
242 /* linux/fs/ncpfs/sock.c */
243 int ncp_request2(struct ncp_server
*server
, int function
,
244 void* reply
, int max_reply_size
);
245 static int inline ncp_request(struct ncp_server
*server
, int function
) {
246 return ncp_request2(server
, function
, server
->packet
, server
->packet_size
);
248 int ncp_connect(struct ncp_server
*server
);
249 int ncp_disconnect(struct ncp_server
*server
);
250 void ncp_lock_server(struct ncp_server
*server
);
251 void ncp_unlock_server(struct ncp_server
*server
);
253 /* linux/fs/ncpfs/file.c */
254 extern struct inode_operations ncp_file_inode_operations
;
255 int ncp_make_open(struct inode
*, int);
257 /* linux/fs/ncpfs/mmap.c */
258 int ncp_mmap(struct file
*, struct vm_area_struct
*);
260 /* linux/fs/ncpfs/ncplib_kernel.c */
261 int ncp_make_closed(struct inode
*);
263 #define ncp_namespace(i) (NCP_SERVER(i)->name_space[NCP_FINFO(i)->volNumber])
265 static inline int ncp_preserve_entry_case(struct inode
*i
, __u32 nscreator
)
267 #ifdef CONFIG_NCPFS_SMALLDOS
268 int ns
= ncp_namespace(i
);
270 if ((ns
== NW_NS_DOS
)
271 #ifdef CONFIG_NCPFS_OS2_NS
272 || ((ns
== NW_NS_OS2
) && (nscreator
== NW_NS_DOS
))
273 #endif /* CONFIG_NCPFS_OS2_NS */
276 #endif /* CONFIG_NCPFS_SMALLDOS */
280 #define ncp_preserve_case(i) (ncp_namespace(i) != NW_NS_DOS)
282 static inline int ncp_case_sensitive(struct inode
*i
)
284 #ifdef CONFIG_NCPFS_NFS_NS
285 return ncp_namespace(i
) == NW_NS_NFS
;
288 #endif /* CONFIG_NCPFS_NFS_NS */
291 #endif /* __KERNEL__ */
293 #endif /* _LINUX_NCP_FS_H */