patch-2.3.48 linux/fs/smbfs/file.c
Next file: linux/fs/smbfs/inode.c
Previous file: linux/fs/smbfs/dir.c
Back to the patch index
Back to the overall index
- Lines: 66
- Date:
Sat Feb 26 20:33:42 2000
- Orig file:
v2.3.47/linux/fs/smbfs/file.c
- Orig date:
Thu Feb 10 17:11:18 2000
diff -u --recursive --new-file v2.3.47/linux/fs/smbfs/file.c linux/fs/smbfs/file.c
@@ -169,17 +169,25 @@
static int
smb_writepage(struct dentry *dentry, struct page *page)
{
- int result;
-
-#ifdef SMBFS_PARANOIA
- if (!PageLocked(page))
- printk("smb_writepage: page not already locked!\n");
-#endif
+ struct inode *inode = dentry->d_inode;
+ unsigned long end_index = inode->i_size >> PAGE_CACHE_SHIFT;
+ unsigned offset = PAGE_CACHE_SIZE;
+ int err;
+
+ /* easy case */
+ if (page->index < end_index)
+ goto do_it;
+ /* things got complicated... */
+ offset = inode->i_size & (PAGE_CACHE_SIZE-1);
+ /* OK, are we completely out? */
+ if (page->index >= end_index+1 || !offset)
+ return -EIO;
+do_it:
get_page(page);
- result = smb_writepage_sync(dentry, page, 0, PAGE_SIZE);
+ err = smb_writepage_sync(dentry, page, 0, offset);
SetPageUptodate(page);
put_page(page);
- return result;
+ return err;
}
static int
@@ -376,7 +384,7 @@
return error;
}
-static struct file_operations smb_file_operations =
+struct file_operations smb_file_operations =
{
read: smb_file_read,
write: smb_file_write,
@@ -389,19 +397,7 @@
struct inode_operations smb_file_inode_operations =
{
- &smb_file_operations, /* default file operations */
- NULL, /* create */
- NULL, /* lookup */
- NULL, /* link */
- NULL, /* unlink */
- NULL, /* symlink */
- NULL, /* mkdir */
- NULL, /* rmdir */
- NULL, /* mknod */
- NULL, /* rename */
- NULL, /* readlink */
- NULL, /* follow_link */
- NULL, /* truncate */
- smb_file_permission, /* permission */
- smb_revalidate_inode, /* revalidate */
+ permission: smb_file_permission,
+ revalidate: smb_revalidate_inode,
+ setattr: smb_notify_change,
};
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)