From: Andy P. <at...@us...> - 2002-04-09 15:08:11
|
Update of /cvsroot/linux-vax/kernel-2.4/fs/ncpfs In directory usw-pr-cvs1:/tmp/cvs-serv29245/ncpfs Modified Files: dir.c file.c inode.c ioctl.c mmap.c ncplib_kernel.c ncpsign_kernel.c Log Message: synch 2.4.15 commit 13 Index: dir.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/fs/ncpfs/dir.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- dir.c 25 Feb 2001 23:14:46 -0000 1.1.1.2 +++ dir.c 9 Apr 2002 13:19:35 -0000 1.2 @@ -326,56 +326,15 @@ return res; } -/* most parts from nfsd_d_validate() */ -static int -ncp_d_validate(struct dentry *dentry) -{ - unsigned long dent_addr = (unsigned long) dentry; - unsigned long min_addr = PAGE_OFFSET; - unsigned long align_mask = 0x0F; - unsigned int len; - int valid = 0; - - if (dent_addr < min_addr) - goto bad_addr; - if (dent_addr > (unsigned long)high_memory - sizeof(struct dentry)) - goto bad_addr; - if ((dent_addr & ~align_mask) != dent_addr) - goto bad_align; - if ((!kern_addr_valid(dent_addr)) || (!kern_addr_valid(dent_addr -1 + - sizeof(struct dentry)))) - goto bad_addr; - /* - * Looks safe enough to dereference ... - */ - len = dentry->d_name.len; - if (len > NCP_MAXPATHLEN) - goto out; - /* - * Note: d_validate doesn't dereference the parent pointer ... - * just combines it with the name hash to find the hash chain. - */ - valid = d_validate(dentry, dentry->d_parent, dentry->d_name.hash, len); -out: - return valid; - -bad_addr: - PRINTK("ncp_d_validate: invalid address %lx\n", dent_addr); - goto out; -bad_align: - PRINTK("ncp_d_validate: unaligned address %lx\n", dent_addr); - goto out; -} - static struct dentry * ncp_dget_fpos(struct dentry *dentry, struct dentry *parent, unsigned long fpos) { struct dentry *dent = dentry; struct list_head *next; - if (ncp_d_validate(dent)) { - if (dent->d_parent == parent && - (unsigned long)dent->d_fsdata == fpos) { + if (d_validate(dent, parent)) { + if (dent->d_name.len <= NCP_MAXPATHLEN && + (unsigned long)dent->d_fsdata == fpos) { if (!dent->d_inode) { dput(dent); dent = NULL; @@ -580,6 +539,7 @@ struct ncp_cache_control ctl = *ctrl; struct qstr qname; int valid = 0; + int hashed = 0; ino_t ino = 0; __u8 __name[256]; @@ -602,9 +562,11 @@ newdent = d_alloc(dentry, &qname); if (!newdent) goto end_advance; - } else + } else { + hashed = 1; memcpy((char *) newdent->d_name.name, qname.name, newdent->d_name.len); + } if (!newdent->d_inode) { entry->opened = 0; @@ -612,7 +574,9 @@ newino = ncp_iget(inode->i_sb, entry); if (newino) { newdent->d_op = &ncp_dentry_operations; - d_add(newdent, newino); + d_instantiate(newdent, newino); + if (!hashed) + d_rehash(newdent); } } else ncp_update_inode2(newdent->d_inode, entry); Index: file.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/fs/ncpfs/file.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- file.c 25 Feb 2001 23:14:46 -0000 1.1.1.2 +++ file.c 9 Apr 2002 13:19:35 -0000 1.2 @@ -22,11 +22,6 @@ #include <linux/ncp_fs.h> #include "ncplib_kernel.h" -static inline unsigned int min(unsigned int a, unsigned int b) -{ - return a < b ? a : b; -} - static int ncp_fsync(struct file *file, struct dentry *dentry, int datasync) { return 0; @@ -157,8 +152,9 @@ /* First read in as much as possible for each bufsize. */ while (already_read < count) { int read_this_time; - size_t to_read = min(bufsize - (pos % bufsize), - count - already_read); + size_t to_read = min_t(unsigned int, + bufsize - (pos % bufsize), + count - already_read); error = ncp_read_bounce(NCP_SERVER(inode), NCP_FINFO(inode)->file_handle, @@ -238,8 +234,9 @@ } while (already_written < count) { int written_this_time; - size_t to_write = min(bufsize - (pos % bufsize), - count - already_written); + size_t to_write = min_t(unsigned int, + bufsize - (pos % bufsize), + count - already_written); if (copy_from_user(bouncebuffer, buf, to_write)) { errno = -EFAULT; @@ -284,6 +281,7 @@ struct file_operations ncp_file_operations = { + llseek: generic_file_llseek, read: ncp_file_read, write: ncp_file_write, ioctl: ncp_ioctl, Index: inode.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/fs/ncpfs/inode.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- inode.c 25 Feb 2001 23:14:46 -0000 1.1.1.2 +++ inode.c 9 Apr 2002 13:19:35 -0000 1.2 @@ -692,7 +692,7 @@ ncp_inode_close(inode); result = ncp_make_closed(inode); if (!result) - vmtruncate(inode, attr->ia_size); + result = vmtruncate(inode, attr->ia_size); } out: return result; @@ -730,3 +730,4 @@ module_init(init_ncp_fs) module_exit(exit_ncp_fs) +MODULE_LICENSE("GPL"); Index: ioctl.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/fs/ncpfs/ioctl.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- ioctl.c 14 Jan 2001 16:28:42 -0000 1.1.1.1 +++ ioctl.c 9 Apr 2002 13:19:35 -0000 1.2 @@ -378,7 +378,7 @@ } { struct ncp_objectname_ioctl user; - int outl; + size_t outl; if (copy_from_user(&user, (struct ncp_objectname_ioctl*)arg, @@ -448,7 +448,7 @@ } { struct ncp_privatedata_ioctl user; - int outl; + size_t outl; if (copy_from_user(&user, (struct ncp_privatedata_ioctl*)arg, Index: mmap.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/fs/ncpfs/mmap.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- mmap.c 25 Feb 2001 23:14:46 -0000 1.1.1.2 +++ mmap.c 9 Apr 2002 13:19:35 -0000 1.2 @@ -22,11 +22,6 @@ #include <asm/uaccess.h> #include <asm/system.h> -static inline int min(int a, int b) -{ - return a < b ? a : b; -} - /* * Fill in the supplied page for mmap */ @@ -43,7 +38,7 @@ int bufsize; int pos; - page = alloc_page(GFP_HIGHMEM); /* ncpfs has nothing against GFP_HIGHMEM + page = alloc_page(GFP_HIGHUSER); /* ncpfs has nothing against high pages as long as recvmsg and memset works on it */ if (!page) return page; @@ -66,7 +61,7 @@ to_read = bufsize - (pos % bufsize); - to_read = min(to_read, count - already_read); + to_read = min_t(unsigned int, to_read, count - already_read); if (ncp_read_kernel(NCP_SERVER(inode), NCP_FINFO(inode)->file_handle, Index: ncplib_kernel.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/fs/ncpfs/ncplib_kernel.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- ncplib_kernel.c 14 Jan 2001 16:28:48 -0000 1.1.1.1 +++ ncplib_kernel.c 9 Apr 2002 13:19:35 -0000 1.2 @@ -13,11 +13,6 @@ #include "ncplib_kernel.h" -static inline int min(int a, int b) -{ - return a < b ? a : b; -} - static inline void assert_server_locked(struct ncp_server *server) { if (server->lock == 0) { @@ -132,7 +127,7 @@ ncp_unlock_server(server); return result; } - *target = min(ntohs(ncp_reply_word(server, 0)), size); + *target = min_t(unsigned int, ntohs(ncp_reply_word(server, 0)), size); ncp_unlock_server(server); return 0; @@ -163,7 +158,8 @@ /* NCP over UDP returns 0 (!!!) */ result = ntohs(ncp_reply_word(server, 0)); - if (result >= NCP_BLOCK_SIZE) size=min(result, size); + if (result >= NCP_BLOCK_SIZE) + size = min(result, size); *ret_size = size; *ret_options = ncp_reply_byte(server, 4); Index: ncpsign_kernel.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/fs/ncpfs/ncpsign_kernel.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- ncpsign_kernel.c 14 Jan 2001 16:28:50 -0000 1.1.1.1 +++ ncpsign_kernel.c 9 Apr 2002 13:19:35 -0000 1.2 @@ -52,8 +52,6 @@ #define PUT_LE32(p,v) DSET_LH(p,0,v) #endif -#define min(a,b) ((a)<(b)?(a):(b)) - static void nwsign(char *r_data1, char *r_data2, char *outdata) { int i; unsigned int w0,w1,w2,w3; @@ -102,7 +100,7 @@ memcpy(data,server->sign_root,8); PUT_LE32(data+8,(*size)); memcpy(data+12,server->packet+sizeof(struct ncp_request_header)-1, - min((*size)-sizeof(struct ncp_request_header)+1,52)); + min_t(unsigned int,(*size)-sizeof(struct ncp_request_header)+1,52)); nwsign(server->sign_last,data,server->sign_last); |