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>
14 #include <linux/magic.h>
16 #include <linux/ipx.h>
17 #include <linux/ncp_no.h>
23 struct ncp_ioctl_request
{
24 unsigned int function
;
31 struct sockaddr_ipx addr
;
32 __kernel_uid_t mounted_uid
;
33 int connection
; /* Connection number the server assigned us */
34 int buffer_size
; /* The negotiated buffer size, to be
35 used for read/write requests! */
41 struct ncp_fs_info_v2
{
43 unsigned long mounted_uid
;
44 unsigned int connection
;
45 unsigned int buffer_size
;
47 unsigned int volume_number
;
63 #define NCP_LOCK_LOG 0
66 #define NCP_LOCK_CLEAR 256
71 #define NCP_LOCK_DEFAULT_TIMEOUT 18
72 #define NCP_LOCK_MAX_TIMEOUT 180
76 struct ncp_setroot_ioctl
83 struct ncp_objectname_ioctl
85 #define NCP_AUTH_NONE 0x00
86 #define NCP_AUTH_BIND 0x31
87 #define NCP_AUTH_NDS 0x32
89 size_t object_name_len
;
90 void __user
* object_name
; /* an userspace data, in most cases user name */
93 struct ncp_privatedata_ioctl
96 void __user
* data
; /* ~1000 for NDS */
99 /* NLS charsets by ioctl */
100 #define NCP_IOCSNAME_LEN 20
103 unsigned char codepage
[NCP_IOCSNAME_LEN
+1];
104 unsigned char iocharset
[NCP_IOCSNAME_LEN
+1];
107 #define NCP_IOC_NCPREQUEST _IOR('n', 1, struct ncp_ioctl_request)
108 #define NCP_IOC_GETMOUNTUID _IOW('n', 2, __kernel_old_uid_t)
109 #define NCP_IOC_GETMOUNTUID2 _IOW('n', 2, unsigned long)
111 #define NCP_IOC_CONN_LOGGED_IN _IO('n', 3)
113 #define NCP_GET_FS_INFO_VERSION (1)
114 #define NCP_IOC_GET_FS_INFO _IOWR('n', 4, struct ncp_fs_info)
115 #define NCP_GET_FS_INFO_VERSION_V2 (2)
116 #define NCP_IOC_GET_FS_INFO_V2 _IOWR('n', 4, struct ncp_fs_info_v2)
118 #define NCP_IOC_SIGN_INIT _IOR('n', 5, struct ncp_sign_init)
119 #define NCP_IOC_SIGN_WANTED _IOR('n', 6, int)
120 #define NCP_IOC_SET_SIGN_WANTED _IOW('n', 6, int)
122 #define NCP_IOC_LOCKUNLOCK _IOR('n', 7, struct ncp_lock_ioctl)
124 #define NCP_IOC_GETROOT _IOW('n', 8, struct ncp_setroot_ioctl)
125 #define NCP_IOC_SETROOT _IOR('n', 8, struct ncp_setroot_ioctl)
127 #define NCP_IOC_GETOBJECTNAME _IOWR('n', 9, struct ncp_objectname_ioctl)
128 #define NCP_IOC_SETOBJECTNAME _IOR('n', 9, struct ncp_objectname_ioctl)
129 #define NCP_IOC_GETPRIVATEDATA _IOWR('n', 10, struct ncp_privatedata_ioctl)
130 #define NCP_IOC_SETPRIVATEDATA _IOR('n', 10, struct ncp_privatedata_ioctl)
132 #define NCP_IOC_GETCHARSETS _IOWR('n', 11, struct ncp_nls_ioctl)
133 #define NCP_IOC_SETCHARSETS _IOR('n', 11, struct ncp_nls_ioctl)
135 #define NCP_IOC_GETDENTRYTTL _IOW('n', 12, __u32)
136 #define NCP_IOC_SETDENTRYTTL _IOR('n', 12, __u32)
139 * The packet size to allocate. One page should be enough.
141 #define NCP_PACKET_SIZE 4070
143 #define NCP_MAXPATHLEN 255
144 #define NCP_MAXNAMELEN 14
148 #include <linux/ncp_fs_i.h>
149 #include <linux/ncp_fs_sb.h>
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
;
187 static inline struct ncp_server
*NCP_SBP(struct super_block
*sb
)
189 return sb
->s_fs_info
;
192 #define NCP_SERVER(inode) NCP_SBP((inode)->i_sb)
193 static inline struct ncp_inode_info
*NCP_FINFO(struct inode
*inode
)
195 return container_of(inode
, struct ncp_inode_info
, vfs_inode
);
198 /* linux/fs/ncpfs/inode.c */
199 int ncp_notify_change(struct dentry
*, struct iattr
*);
200 struct inode
*ncp_iget(struct super_block
*, struct ncp_entry_info
*);
201 void ncp_update_inode(struct inode
*, struct ncp_entry_info
*);
202 void ncp_update_inode2(struct inode
*, struct ncp_entry_info
*);
204 /* linux/fs/ncpfs/dir.c */
205 extern const struct inode_operations ncp_dir_inode_operations
;
206 extern const struct file_operations ncp_dir_operations
;
207 int ncp_conn_logged_in(struct super_block
*);
208 int ncp_date_dos2unix(__le16 time
, __le16 date
);
209 void ncp_date_unix2dos(int unix_date
, __le16
* time
, __le16
* date
);
211 /* linux/fs/ncpfs/ioctl.c */
212 int ncp_ioctl(struct inode
*, struct file
*, unsigned int, unsigned long);
213 long ncp_compat_ioctl(struct file
*, unsigned int, unsigned long);
215 /* linux/fs/ncpfs/sock.c */
216 int ncp_request2(struct ncp_server
*server
, int function
,
217 void* reply
, int max_reply_size
);
218 static inline int ncp_request(struct ncp_server
*server
, int function
) {
219 return ncp_request2(server
, function
, server
->packet
, server
->packet_size
);
221 int ncp_connect(struct ncp_server
*server
);
222 int ncp_disconnect(struct ncp_server
*server
);
223 void ncp_lock_server(struct ncp_server
*server
);
224 void ncp_unlock_server(struct ncp_server
*server
);
226 /* linux/fs/ncpfs/file.c */
227 extern const struct inode_operations ncp_file_inode_operations
;
228 extern const struct file_operations ncp_file_operations
;
229 int ncp_make_open(struct inode
*, int);
231 /* linux/fs/ncpfs/mmap.c */
232 int ncp_mmap(struct file
*, struct vm_area_struct
*);
234 /* linux/fs/ncpfs/ncplib_kernel.c */
235 int ncp_make_closed(struct inode
*);
237 #define ncp_namespace(i) (NCP_SERVER(i)->name_space[NCP_FINFO(i)->volNumber])
239 static inline int ncp_preserve_entry_case(struct inode
*i
, __u32 nscreator
)
241 #ifdef CONFIG_NCPFS_SMALLDOS
242 int ns
= ncp_namespace(i
);
244 if ((ns
== NW_NS_DOS
)
245 #ifdef CONFIG_NCPFS_OS2_NS
246 || ((ns
== NW_NS_OS2
) && (nscreator
== NW_NS_DOS
))
247 #endif /* CONFIG_NCPFS_OS2_NS */
250 #endif /* CONFIG_NCPFS_SMALLDOS */
254 #define ncp_preserve_case(i) (ncp_namespace(i) != NW_NS_DOS)
256 static inline int ncp_case_sensitive(struct inode
*i
)
258 #ifdef CONFIG_NCPFS_NFS_NS
259 return ncp_namespace(i
) == NW_NS_NFS
;
262 #endif /* CONFIG_NCPFS_NFS_NS */
265 #endif /* __KERNEL__ */
267 #endif /* _LINUX_NCP_FS_H */