]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - fs/ncpfs/dir.c
Merge tag 'iio-fixes-for-4.1a-take2' of git://git.kernel.org/pub/scm/linux/kernel...
[karo-tx-linux.git] / fs / ncpfs / dir.c
index e7ca827d7694c130e0be25b85fa6e6aed7217ab5..80021c709af9cc02dc2d3a41a0f14fd7b6409e89 100644 (file)
@@ -127,7 +127,7 @@ static inline int ncp_case_sensitive(const struct inode *i)
 static int 
 ncp_hash_dentry(const struct dentry *dentry, struct qstr *this)
 {
-       struct inode *inode = ACCESS_ONCE(dentry->d_inode);
+       struct inode *inode = d_inode_rcu(dentry);
 
        if (!inode)
                return 0;
@@ -162,7 +162,7 @@ ncp_compare_dentry(const struct dentry *parent, const struct dentry *dentry,
        if (len != name->len)
                return 1;
 
-       pinode = ACCESS_ONCE(parent->d_inode);
+       pinode = d_inode_rcu(parent);
        if (!pinode)
                return 1;
 
@@ -180,7 +180,7 @@ ncp_compare_dentry(const struct dentry *parent, const struct dentry *dentry,
 static int
 ncp_delete_dentry(const struct dentry * dentry)
 {
-       struct inode *inode = dentry->d_inode;
+       struct inode *inode = d_inode(dentry);
 
        if (inode) {
                if (is_bad_inode(inode))
@@ -224,7 +224,7 @@ ncp_force_unlink(struct inode *dir, struct dentry* dentry)
        memset(&info, 0, sizeof(info));
        
         /* remove the Read-Only flag on the NW server */
-       inode = dentry->d_inode;
+       inode = d_inode(dentry);
 
        old_nwattr = NCP_FINFO(inode)->nwattr;
        info.attributes = old_nwattr & ~(aRONLY|aDELETEINHIBIT|aRENAMEINHIBIT);
@@ -254,7 +254,7 @@ ncp_force_rename(struct inode *old_dir, struct dentry* old_dentry, char *_old_na
 {
        struct nw_modify_dos_info info;
         int res=0x90,res2;
-       struct inode *old_inode = old_dentry->d_inode;
+       struct inode *old_inode = d_inode(old_dentry);
        __le32 old_nwattr = NCP_FINFO(old_inode)->nwattr;
        __le32 new_nwattr = 0; /* shut compiler warning */
        int old_nwattr_changed = 0;
@@ -268,8 +268,8 @@ ncp_force_rename(struct inode *old_dir, struct dentry* old_dentry, char *_old_na
        res2 = ncp_modify_file_or_subdir_dos_info_path(NCP_SERVER(old_inode), old_inode, NULL, DM_ATTRIBUTES, &info);
        if (!res2)
                old_nwattr_changed = 1;
-       if (new_dentry && new_dentry->d_inode) {
-               new_nwattr = NCP_FINFO(new_dentry->d_inode)->nwattr;
+       if (new_dentry && d_really_is_positive(new_dentry)) {
+               new_nwattr = NCP_FINFO(d_inode(new_dentry))->nwattr;
                info.attributes = new_nwattr & ~(aRONLY|aRENAMEINHIBIT|aDELETEINHIBIT);
                res2 = ncp_modify_file_or_subdir_dos_info_path(NCP_SERVER(new_dir), new_dir, _new_name, DM_ATTRIBUTES, &info);
                if (!res2)
@@ -324,9 +324,9 @@ ncp_lookup_validate(struct dentry *dentry, unsigned int flags)
                return -ECHILD;
 
        parent = dget_parent(dentry);
-       dir = parent->d_inode;
+       dir = d_inode(parent);
 
-       if (!dentry->d_inode)
+       if (d_really_is_negative(dentry))
                goto finished;
 
        server = NCP_SERVER(dir);
@@ -367,7 +367,7 @@ ncp_lookup_validate(struct dentry *dentry, unsigned int flags)
         * what we remember, it's not valid any more.
         */
        if (!res) {
-               struct inode *inode = dentry->d_inode;
+               struct inode *inode = d_inode(dentry);
 
                mutex_lock(&inode->i_mutex);
                if (finfo.i.dirEntNum == NCP_FINFO(inode)->dirEntNum) {
@@ -388,7 +388,7 @@ finished:
 
 static time_t ncp_obtain_mtime(struct dentry *dentry)
 {
-       struct inode *inode = dentry->d_inode;
+       struct inode *inode = d_inode(dentry);
        struct ncp_server *server = NCP_SERVER(inode);
        struct nw_info_struct i;
 
@@ -404,7 +404,7 @@ static time_t ncp_obtain_mtime(struct dentry *dentry)
 static inline void
 ncp_invalidate_dircache_entries(struct dentry *parent)
 {
-       struct ncp_server *server = NCP_SERVER(parent->d_inode);
+       struct ncp_server *server = NCP_SERVER(d_inode(parent));
        struct dentry *dentry;
 
        spin_lock(&parent->d_lock);
@@ -418,7 +418,7 @@ ncp_invalidate_dircache_entries(struct dentry *parent)
 static int ncp_readdir(struct file *file, struct dir_context *ctx)
 {
        struct dentry *dentry = file->f_path.dentry;
-       struct inode *inode = dentry->d_inode;
+       struct inode *inode = d_inode(dentry);
        struct page *page = NULL;
        struct ncp_server *server = NCP_SERVER(inode);
        union  ncp_dir_cache *cache = NULL;
@@ -491,13 +491,13 @@ static int ncp_readdir(struct file *file, struct dir_context *ctx)
                                goto invalid_cache;
                        }
                        spin_unlock(&dentry->d_lock);
-                       if (!dent->d_inode) {
+                       if (d_really_is_negative(dent)) {
                                dput(dent);
                                goto invalid_cache;
                        }
                        over = !dir_emit(ctx, dent->d_name.name,
                                        dent->d_name.len,
-                                       dent->d_inode->i_ino, DT_UNKNOWN);
+                                       d_inode(dent)->i_ino, DT_UNKNOWN);
                        dput(dent);
                        if (over)
                                goto finished;
@@ -571,7 +571,7 @@ static void ncp_d_prune(struct dentry *dentry)
 {
        if (!dentry->d_fsdata)  /* not referenced from page cache */
                return;
-       NCP_FINFO(dentry->d_parent->d_inode)->flags &= ~NCPI_DIR_CACHE;
+       NCP_FINFO(d_inode(dentry->d_parent))->flags &= ~NCPI_DIR_CACHE;
 }
 
 static int
@@ -580,7 +580,7 @@ ncp_fill_cache(struct file *file, struct dir_context *ctx,
                int inval_childs)
 {
        struct dentry *newdent, *dentry = file->f_path.dentry;
-       struct inode *dir = dentry->d_inode;
+       struct inode *dir = d_inode(dentry);
        struct ncp_cache_control ctl = *ctrl;
        struct qstr qname;
        int valid = 0;
@@ -621,7 +621,7 @@ ncp_fill_cache(struct file *file, struct dir_context *ctx,
                dentry_update_name_case(newdent, &qname);
        }
 
-       if (!newdent->d_inode) {
+       if (d_really_is_negative(newdent)) {
                struct inode *inode;
 
                entry->opened = 0;
@@ -637,7 +637,7 @@ ncp_fill_cache(struct file *file, struct dir_context *ctx,
                        spin_unlock(&dentry->d_lock);
                }
        } else {
-               struct inode *inode = newdent->d_inode;
+               struct inode *inode = d_inode(newdent);
 
                mutex_lock_nested(&inode->i_mutex, I_MUTEX_CHILD);
                ncp_update_inode2(inode, entry);
@@ -659,10 +659,10 @@ ncp_fill_cache(struct file *file, struct dir_context *ctx,
                        ctl.cache = kmap(ctl.page);
        }
        if (ctl.cache) {
-               if (newdent->d_inode) {
+               if (d_really_is_positive(newdent)) {
                        newdent->d_fsdata = newdent;
                        ctl.cache->dentry[ctl.idx] = newdent;
-                       ino = newdent->d_inode->i_ino;
+                       ino = d_inode(newdent)->i_ino;
                        ncp_new_dentry(newdent);
                }
                valid = 1;
@@ -807,7 +807,7 @@ int ncp_conn_logged_in(struct super_block *sb)
                }
                dent = sb->s_root;
                if (dent) {
-                       struct inode* ino = dent->d_inode;
+                       struct inode* ino = d_inode(dent);
                        if (ino) {
                                ncp_update_known_namespace(server, volNumber, NULL);
                                NCP_FINFO(ino)->volNumber = volNumber;
@@ -815,7 +815,7 @@ int ncp_conn_logged_in(struct super_block *sb)
                                NCP_FINFO(ino)->DosDirNum = DosDirNum;
                                result = 0;
                        } else {
-                               ncp_dbg(1, "sb->s_root->d_inode == NULL!\n");
+                               ncp_dbg(1, "d_inode(sb->s_root) == NULL!\n");
                        }
                } else {
                        ncp_dbg(1, "sb->s_root == NULL!\n");
@@ -1055,7 +1055,7 @@ out:
 
 static int ncp_unlink(struct inode *dir, struct dentry *dentry)
 {
-       struct inode *inode = dentry->d_inode;
+       struct inode *inode = d_inode(dentry);
        struct ncp_server *server;
        int error;