struct inode *inode = dentry->d_inode;
struct file open_file;
struct dentry open_dentry;
+ loff_t tmp_ppos;
+ loff_t *cache_ppos;
int rc = 0;
ENTRY;
if (!cache_inode)
RETURN(-ENOENT);
+ if (ppos != &(filp->f_pos)) {
+ cache_ppos = &tmp_ppos;
+ } else {
+ cache_ppos = &open_file.f_pos;
+ }
+ *cache_ppos = *ppos;
+
smfs_prepare_cachefile(inode, filp, cache_inode,
&open_file, &open_dentry);
-
if (cache_inode->i_fop->write)
- rc = cache_inode->i_fop->write(&open_file, buf, count, &open_file.f_pos);
+ rc = cache_inode->i_fop->write(&open_file, buf, count, cache_ppos);
- *ppos = open_file.f_pos;
+ *ppos = *cache_ppos;
duplicate_inode(cache_inode, inode);
smfs_update_file(filp, &open_file);
struct dentry *dentry = filp->f_dentry;
struct file open_file;
struct dentry open_dentry;
- ssize_t rc;
+ ssize_t rc = 0;
ENTRY;
struct inode *inode = dentry->d_inode;
struct file open_file;
struct dentry open_dentry;
- ssize_t rc;
+ loff_t tmp_ppos;
+ loff_t *cache_ppos;
+ ssize_t rc = 0;
ENTRY;
if (!cache_inode)
RETURN(-ENOENT);
+ if (ppos != &(filp->f_pos)) {
+ cache_ppos = &tmp_ppos;
+ } else {
+ cache_ppos = &open_file.f_pos;
+ }
+ *cache_ppos = *ppos;
+
+
smfs_prepare_cachefile(inode, filp, cache_inode,
&open_file, &open_dentry);
+
if (cache_inode->i_fop->read)
- rc = cache_inode->i_fop->read(&open_file, buf, count, &open_file.f_pos);
+ rc = cache_inode->i_fop->read(&open_file, buf, count, cache_ppos);
- *ppos = open_file.f_pos;
+ *ppos = *cache_ppos;
duplicate_inode(cache_inode, inode);
smfs_update_file(filp, &open_file);
RETURN(rc);
struct dentry *dentry = file->f_dentry;
struct file open_file;
struct dentry open_dentry;
- ssize_t rc;
+ ssize_t rc = 0;
ENTRY;
if (cache_inode->i_fop->llseek)
rc = cache_inode->i_fop->llseek(&open_file, offset, origin);
-
+
duplicate_inode(cache_inode, dentry->d_inode);
smfs_update_file(file, &open_file);