Fix broken fix for fsl-diu-db
[safe/jmp/linux-2.6] / fs / cifs / cifsglob.h
index fbde55c..9cfcf32 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *   fs/cifs/cifsglob.h
  *
- *   Copyright (C) International Business Machines  Corp., 2002,2007
+ *   Copyright (C) International Business Machines  Corp., 2002,2008
  *   Author(s): Steve French (sfrench@us.ibm.com)
  *              Jeremy Allison (jra@samba.org)
  *
 
 #include "cifspdu.h"
 
-#ifndef FALSE
-#define FALSE 0
-#endif
-
-#ifndef TRUE
-#define TRUE 1
-#endif
-
 #ifndef XATTR_DOS_ATTRIB
 #define XATTR_DOS_ATTRIB "user.DOSATTRIB"
 #endif
 
 /*
- * This information is kept on every Server we know about.
- *
- * Some things to note:
- *
- */
-#define SERVER_NAME_LEN_WITH_NULL      (SERVER_NAME_LENGTH + 1)
-
-/*
  * CIFS vfs client Status information (based on what we know.)
  */
 
@@ -110,6 +94,7 @@ struct mac_key {
        unsigned int len;
        union {
                char ntlm[CIFS_SESS_KEY_SIZE + 16];
+               char krb5[CIFS_SESS_KEY_SIZE + 16]; /* BB: length correct? */
                struct {
                        char key[16];
                        struct ntlmv2_resp resp;
@@ -139,6 +124,7 @@ struct TCP_Server_Info {
        /* 15 character server name + 0x20 16th byte indicating type = srv */
        char server_RFC1001_name[SERVER_NAME_LEN_WITH_NULL];
        char unicode_server_Name[SERVER_NAME_LEN_WITH_NULL * 2];
+       char *hostname; /* hostname portion of UNC string */
        struct socket *ssocket;
        union {
                struct sockaddr_in sockAddr;
@@ -153,7 +139,7 @@ struct TCP_Server_Info {
        enum protocolEnum protocolType;
        char versionMajor;
        char versionMinor;
-       unsigned svlocal:1;     /* local server or remote */
+       bool svlocal:1;                 /* local server or remote */
        atomic_t socketUseCount; /* number of open cifs sessions on socket */
        atomic_t inFlight;  /* number of requests on the wire to server */
 #ifdef CONFIG_CIFS_STATS2
@@ -292,10 +278,11 @@ struct cifsTconInfo {
        FILE_SYSTEM_DEVICE_INFO fsDevInfo;
        FILE_SYSTEM_ATTRIBUTE_INFO fsAttrInfo; /* ok if fs name truncated */
        FILE_SYSTEM_UNIX_INFO fsUnixInfo;
-       unsigned ipc:1;         /* set if connection to IPC$ eg for RPC/PIPES */
-       unsigned retry:1;
-       unsigned nocase:1;
-       unsigned unix_ext:1; /* if off disable Linux extensions to CIFS protocol
+       bool ipc:1;             /* set if connection to IPC$ eg for RPC/PIPES */
+       bool retry:1;
+       bool nocase:1;
+       bool seal:1;      /* transport encryption for this mounted share */
+       bool unix_ext:1;  /* if false disable Linux extensions to CIFS protocol
                                for this mount even if server would support */
        /* BB add field for back pointer to sb struct(s)? */
 };
@@ -323,10 +310,10 @@ struct cifs_search_info {
        char *srch_entries_start;
        char *presume_name;
        unsigned int resume_name_len;
-       unsigned endOfSearch:1;
-       unsigned emptyDir:1;
-       unsigned unicode:1;
-       unsigned smallBuf:1; /* so we know which buf_release function to call */
+       bool endOfSearch:1;
+       bool emptyDir:1;
+       bool unicode:1;
+       bool smallBuf:1; /* so we know which buf_release function to call */
 };
 
 struct cifsFileInfo {
@@ -341,12 +328,11 @@ struct cifsFileInfo {
        struct inode *pInode; /* needed for oplock break */
        struct mutex lock_mutex;
        struct list_head llist; /* list of byte range locks we have. */
-       unsigned closePend:1;   /* file is marked to close */
-       unsigned invalidHandle:1;  /* file closed via session abend */
-       unsigned messageMode:1;    /* for pipes: message vs byte mode */
+       bool closePend:1;       /* file is marked to close */
+       bool invalidHandle:1;   /* file closed via session abend */
+       bool messageMode:1;     /* for pipes: message vs byte mode */
        atomic_t wrtPending;   /* handle in use - defer close */
        struct semaphore fh_sem; /* prevents reopen race after dead ses*/
-       char *search_resume_name; /* BB removeme BB */
        struct cifs_search_info srch_inf;
 };
 
@@ -362,9 +348,9 @@ struct cifsInodeInfo {
        __u32 cifsAttrs; /* e.g. DOS archive bit, sparse, compressed, system */
        atomic_t inUse;  /* num concurrent users (local openers cifs) of file*/
        unsigned long time;     /* jiffies of last update/check of inode */
-       unsigned clientCanCacheRead:1; /* read oplock */
-       unsigned clientCanCacheAll:1;  /* read and writebehind oplock */
-       unsigned oplockPending:1;
+       bool clientCanCacheRead:1;      /* read oplock */
+       bool clientCanCacheAll:1;       /* read and writebehind oplock */
+       bool oplockPending:1;
        struct inode vfs_inode;
 };
 
@@ -432,9 +418,9 @@ struct mid_q_entry {
        struct smb_hdr *resp_buf;       /* response buffer */
        int midState;   /* wish this were enum but can not pass to wait_event */
        __u8 command;   /* smb command code */
-       unsigned largeBuf:1;    /* if valid response, is pointer to large buf */
-       unsigned multiRsp:1;   /* multiple trans2 responses for one request  */
-       unsigned multiEnd:1; /* both received */
+       bool largeBuf:1;        /* if valid response, is pointer to large buf */
+       bool multiRsp:1;        /* multiple trans2 responses for one request  */
+       bool multiEnd:1;        /* both received */
 };
 
 struct oplock_q_entry {
@@ -458,6 +444,37 @@ struct dir_notify_req {
        struct file *pfile;
 };
 
+struct dfs_info3_param {
+       int flags; /* DFSREF_REFERRAL_SERVER, DFSREF_STORAGE_SERVER*/
+       int path_consumed;
+       int server_type;
+       int ref_flag;
+       char *path_name;
+       char *node_name;
+};
+
+static inline void free_dfs_info_param(struct dfs_info3_param *param)
+{
+       if (param) {
+               kfree(param->path_name);
+               kfree(param->node_name);
+               kfree(param);
+       }
+}
+
+static inline void free_dfs_info_array(struct dfs_info3_param *param,
+                                      int number_of_items)
+{
+       int i;
+       if ((number_of_items == 0) || (param == NULL))
+               return;
+       for (i = 0; i < number_of_items; i++) {
+               kfree(param[i].path_name);
+               kfree(param[i].node_name);
+       }
+       kfree(param);
+}
+
 #define   MID_FREE 0
 #define   MID_REQUEST_ALLOCATED 1
 #define   MID_REQUEST_SUBMITTED 2
@@ -471,6 +488,17 @@ struct dir_notify_req {
 #define   CIFS_LARGE_BUFFER     2
 #define   CIFS_IOVEC            4    /* array of response buffers */
 
+/* Type of Request to SendReceive2 */
+#define   CIFS_STD_OP          0    /* normal request timeout */
+#define   CIFS_LONG_OP          1    /* long op (up to 45 sec, oplock time) */
+#define   CIFS_VLONG_OP         2    /* sloow op - can take up to 180 seconds */
+#define   CIFS_BLOCKING_OP      4    /* operation can block */
+#define   CIFS_ASYNC_OP         8    /* do not wait for response */
+#define   CIFS_TIMEOUT_MASK 0x00F    /* only one of 5 above set in req */
+#define   CIFS_LOG_ERROR    0x010    /* log NT STATUS if non-zero */
+#define   CIFS_LARGE_BUF_OP 0x020    /* large request buffer */
+#define   CIFS_NO_RESP      0x040    /* no response buffer required */
+
 /* Security Flags: indicate type of session setup needed */
 #define   CIFSSEC_MAY_SIGN     0x00001
 #define   CIFSSEC_MAY_NTLM     0x00002
@@ -479,6 +507,9 @@ struct dir_notify_req {
 #ifdef CONFIG_CIFS_WEAK_PW_HASH
 #define   CIFSSEC_MAY_LANMAN   0x00010
 #define   CIFSSEC_MAY_PLNTXT   0x00020
+#else
+#define   CIFSSEC_MAY_LANMAN    0
+#define   CIFSSEC_MAY_PLNTXT    0
 #endif /* weak passwords */
 #define   CIFSSEC_MAY_SEAL     0x00040 /* not supported yet */
 
@@ -492,9 +523,17 @@ require use of the stronger protocol */
 #ifdef CONFIG_CIFS_WEAK_PW_HASH
 #define   CIFSSEC_MUST_LANMAN  0x10010
 #define   CIFSSEC_MUST_PLNTXT  0x20020
+#ifdef CONFIG_CIFS_UPCALL
+#define   CIFSSEC_MASK          0x3F03F /* allows weak security but also krb5 */
+#else
 #define   CIFSSEC_MASK          0x37037 /* current flags supported if weak */
+#endif /* UPCALL */
+#else /* do not allow weak pw hash */
+#ifdef CONFIG_CIFS_UPCALL
+#define   CIFSSEC_MASK          0x0F00F /* flags supported if no weak allowed */
 #else
-#define          CIFSSEC_MASK          0x07007 /* flags supported if no weak config */
+#define          CIFSSEC_MASK          0x07007 /* flags supported if no weak allowed */
+#endif /* UPCALL */
 #endif /* WEAK_PW_HASH */
 #define   CIFSSEC_MUST_SEAL    0x40040 /* not supported yet */
 
@@ -586,7 +625,7 @@ GLOBAL_EXTERN atomic_t tcpSesAllocCount;
 GLOBAL_EXTERN atomic_t tcpSesReconnectCount;
 GLOBAL_EXTERN atomic_t tconInfoReconnectCount;
 
-/* Various Debug counters to remove someday (BB) */
+/* Various Debug counters */
 GLOBAL_EXTERN atomic_t bufAllocCount;    /* current number allocated  */
 #ifdef CONFIG_CIFS_STATS2
 GLOBAL_EXTERN atomic_t totBufAllocCount; /* total allocated over all time */