[linux-cifs-client] cifs-backport-for-old-kernels git tree updated
Yehuda Sadeh Weinraub
Yehuda.Sadeh at expand.com
Tue Feb 6 06:33:01 GMT 2007
Steve French wrote:
>
>cifs-backport-for-old-kernels git tree (and equivalent svn branch in
>linux-cifs-client on Samba svn) have been updated to build on more
>recent kernels (up to about 2.6.19) and include all but the last few
>weeks of changes to cifs.
>
>This allows people to build a version of cifs with all fixes on older
kernels.
Here's an updated patch that would get it compiled and work on various
2.4 kernels:
Index: fs/cifs/cifsfs24.c
===================================================================
--- fs/cifs/cifsfs24.c (revision 97)
+++ fs/cifs/cifsfs24.c (working copy)
@@ -249,18 +249,7 @@
cifs_inode = kmem_cache_alloc(cifs_inode_cachep, SLAB_KERNEL);
if (!cifs_inode)
return NULL;
- cifs_inode->cifsAttrs = 0x20; /* default */
- atomic_set(&cifs_inode->inUse, 0);
- cifs_inode->time = 0;
- /* Until the file is open and we have gotten oplock
- info back from the server, can not assume caching of
- file data or metadata */
- cifs_inode->clientCanCacheRead = FALSE;
- cifs_inode->clientCanCacheAll = FALSE;
- cifs_inode->vfs_inode.i_blksize = CIFS_MAX_MSGSIZE;
- cifs_inode->vfs_inode.i_blkbits = 14; /* 2**14 =
CIFS_MAX_MSGSIZE */
- cifs_inode->vfs_inode.i_flags = S_NOATIME | S_NOCMTIME;
- INIT_LIST_HEAD(&cifs_inode->openFileList);
+ cifs_init_inode(&cifs_inode->vfs_inode);
return &cifs_inode->vfs_inode;
}
#endif
Index: fs/cifs/cifssmb.c
===================================================================
--- fs/cifs/cifssmb.c (revision 97)
+++ fs/cifs/cifssmb.c (working copy)
@@ -2970,7 +2970,11 @@
ts.tv_nsec = 0;
ts.tv_sec = time;
/* decode time fields */
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)
pFinfo->ChangeTime = cpu_to_le64(cifs_UnixTimeToNT(ts));
+#else
+ pFinfo->ChangeTime =
cpu_to_le64(cifs_UnixTimeToNT(time));
+#endif
pFinfo->LastWriteTime = pFinfo->ChangeTime;
pFinfo->LastAccessTime = 0;
pFinfo->AllocationSize =
Index: fs/cifs/inode.c
===================================================================
--- fs/cifs/inode.c (revision 97)
+++ fs/cifs/inode.c (working copy)
@@ -32,6 +32,45 @@
#include <linux/buffer_head.h>
#endif
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)
+#define CIFS_INODE_FLAGS S_NOATIME | S_NOCMTIME
+#else
+#define CIFS_INODE_FLAGS S_NOATIME
+#endif
+
+void cifs_init_inode(struct inode *inode)
+{
+ struct cifsInodeInfo *cifs_inode;
+
+ cifs_inode = CIFS_I(inode);
+
+ cifs_inode->cifsAttrs = 0x20; /* default */
+ atomic_set(&cifs_inode->inUse, 0);
+ cifs_inode->time = 0;
+ /* Until the file is open and we have gotten oplock
+ info back from the server, can not assume caching of
+ file data or metadata */
+ cifs_inode->clientCanCacheRead = FALSE;
+ cifs_inode->clientCanCacheAll = FALSE;
+ inode->i_blksize = CIFS_MAX_MSGSIZE;
+ inode->i_blkbits = 14; /* 2**14 = CIFS_MAX_MSGSIZE */
+ inode->i_flags = CIFS_INODE_FLAGS;
+ INIT_LIST_HEAD(&cifs_inode->openFileList);
+}
+
+struct inode * get_cifs_inode(struct super_block * sb)
+{
+ struct inode * newinode;
+ newinode = new_inode(sb);
+ cFYI(1,("got new inode %p",newinode));
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
+ if(newinode) {
+ cifs_init_inode(newinode);
+ }
+#endif
+ return newinode;
+}
+
int cifs_get_inode_info_unix(struct inode **pinode,
const unsigned char *search_path, struct super_block *sb, int
xid)
{
@@ -83,7 +122,7 @@
/* get new inode */
if (*pinode == NULL) {
- *pinode = new_inode(sb);
+ *pinode = get_cifs_inode(sb);
if (*pinode == NULL)
return -ENOMEM;
/* Is an i_ino of zero legal? */
@@ -389,7 +428,7 @@
/* get new inode */
if (*pinode == NULL) {
- *pinode = new_inode(sb);
+ *pinode = get_cifs_inode(sb);
if (*pinode == NULL) {
kfree(buf);
return -ENOMEM;
@@ -450,8 +489,13 @@
cifs_NTtimeToUnix(le64_to_cpu(pfindData->ChangeTime));
cFYI(0, ("Attributes came in as 0x%x", attr));
if(adjustTZ && (pTcon->ses) && (pTcon->ses->server)) {
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)
inode->i_ctime.tv_sec +=
pTcon->ses->server->timeAdj;
inode->i_mtime.tv_sec +=
pTcon->ses->server->timeAdj;
+#else
+ inode->i_ctime += pTcon->ses->server->timeAdj;
+ inode->i_mtime += pTcon->ses->server->timeAdj;
+#endif
}
/* set default mode. will override for dirs below */
@@ -562,6 +606,10 @@
int xid;
struct cifs_sb_info *cifs_sb;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
+ cifs_init_inode(inode);
+#endif
+
cifs_sb = CIFS_SB(inode->i_sb);
xid = GetXid();
if (cifs_sb->tcon->ses->capabilities & CAP_UNIX)
Index: fs/cifs/netmisc.c
===================================================================
--- fs/cifs/netmisc.c (revision 97)
+++ fs/cifs/netmisc.c (working copy)
@@ -1003,7 +1003,6 @@
__u8 tm[2];
time_t ts;
int sec,min, days, month, year;
- struct timespec removeme; /* BB removeme BB */
/* SMB_TIME * st = (SMB_TIME *)&time;*/
cFYI(1,("date %d time %d",date, time));
@@ -1042,7 +1041,6 @@
days -= ((year & 0x03) == 0) && (month < 2 ? 1 : 0);
sec += 24 * 60 * 60 * days;
- removeme = CURRENT_TIME; /* BB removeme BB */
ts = (time_t)sec;
return ts;
Index: fs/cifs/readdir.c
===================================================================
--- fs/cifs/readdir.c (revision 97)
+++ fs/cifs/readdir.c (working copy)
@@ -78,7 +78,7 @@
*ptmp_inode = tmp_dentry->d_inode;
/* BB overwrite old name? i.e. tmp_dentry->d_name and
tmp_dentry->d_name.len??*/
if(*ptmp_inode == NULL) {
- *ptmp_inode = new_inode(file->f_dentry->d_sb);
+ *ptmp_inode =
get_cifs_inode(file->f_dentry->d_sb);
if(*ptmp_inode == NULL)
return rc;
rc = 1;
@@ -91,7 +91,7 @@
return rc;
}
- *ptmp_inode = new_inode(file->f_dentry->d_sb);
+ *ptmp_inode = get_cifs_inode(file->f_dentry->d_sb);
if (pTcon->nocase)
tmp_dentry->d_op = &cifs_ci_dentry_ops;
else
@@ -109,9 +109,15 @@
static void AdjustForTZ(struct cifsTconInfo * tcon, struct inode *
inode)
{
if((tcon) && (tcon->ses) && (tcon->ses->server)) {
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)
inode->i_ctime.tv_sec += tcon->ses->server->timeAdj;
inode->i_mtime.tv_sec += tcon->ses->server->timeAdj;
inode->i_atime.tv_sec += tcon->ses->server->timeAdj;
+#else
+ inode->i_ctime += tcon->ses->server->timeAdj;
+ inode->i_mtime += tcon->ses->server->timeAdj;
+ inode->i_atime += tcon->ses->server->timeAdj;
+#endif
}
return;
}
Index: fs/cifs/cifsproto.h
===================================================================
--- fs/cifs/cifsproto.h (revision 97)
+++ fs/cifs/cifsproto.h (working copy)
@@ -33,6 +33,10 @@
#define msleep(x) { set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(x * HZ / 1000); }
#endif
+#ifndef __user
+#define __user
+#endif
+
/*
*****************************************************************
* All Prototypes
@@ -94,7 +98,7 @@
#else
extern u64 cifs_UnixTimeToNT(time_t);
extern time_t cifs_NTtimeToUnix(u64 /* utc nanoseconds since 1601 */ );
-extern time_t timespec cnvrtDosUnixTm(__u16 date, __u16 time);
+extern time_t cnvrtDosUnixTm(__u16 date, __u16 time);
#endif
extern __le64 cnvrtDosCifsTm(__u16 date, __u16 time);
Index: fs/cifs/file.c
===================================================================
--- fs/cifs/file.c (revision 97)
+++ fs/cifs/file.c (working copy)
@@ -1066,7 +1066,9 @@
if(cifs_inode == NULL) {
cERROR(1,("Null inode passed to cifs_writeable_file"));
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 4, 19)
dump_stack();
+#endif
return NULL;
}
Index: fs/cifs/cifsfs.h
===================================================================
--- fs/cifs/cifsfs.h (revision 97)
+++ fs/cifs/cifsfs.h (working copy)
@@ -41,6 +41,10 @@
#define current_fs_time(arg) CURRENT_TIME
#endif
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 25)
+#define filemap_fdatawrite filemap_fdatasync
+#endif
+
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
static inline int timespec_equal(time_t *time1, time_t *time2)
{
Index: fs/cifs/transport.c
===================================================================
--- fs/cifs/transport.c (revision 97)
+++ fs/cifs/transport.c (working copy)
@@ -316,7 +316,9 @@
if (rc >= total_len) {
if(rc > total_len) {
cERROR(1,("unexpected length
received"));
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 4, 19)
dump_stack();
+#endif
}
break;
}
Index: fs/cifs/cifsglob.h
===================================================================
--- fs/cifs/cifsglob.h (revision 97)
+++ fs/cifs/cifsglob.h (working copy)
@@ -605,3 +605,5 @@
GLOBAL_EXTERN unsigned int cifs_min_small; /* min size of small buf
pool */
GLOBAL_EXTERN unsigned int cifs_max_pending; /* MAX requests at once to
server*/
+extern struct inode * get_cifs_inode(struct super_block * sb);
+
[yehuda at yehuda linux-converged-for-old-kernels]$
More information about the linux-cifs-client
mailing list