Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
21ef8d34
Commit
21ef8d34
authored
Oct 07, 2003
by
Stephen Lord
Committed by
Stephen Lord
Oct 07, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[XFS] switch xfs to use linux imode flags internally
SGI Modid: 2.5.x-xfs:slinx:159631a
parent
c9f3cf79
Changes
16
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
102 additions
and
121 deletions
+102
-121
fs/xfs/linux/xfs_lrw.c
fs/xfs/linux/xfs_lrw.c
+4
-4
fs/xfs/linux/xfs_sysctl.h
fs/xfs/linux/xfs_sysctl.h
+1
-1
fs/xfs/quota/xfs_qm.c
fs/xfs/quota/xfs_qm.c
+1
-1
fs/xfs/xfs_attr.c
fs/xfs/xfs_attr.c
+4
-4
fs/xfs/xfs_bmap.c
fs/xfs/xfs_bmap.c
+2
-2
fs/xfs/xfs_dfrag.c
fs/xfs/xfs_dfrag.c
+2
-2
fs/xfs/xfs_dinode.h
fs/xfs/xfs_dinode.h
+1
-20
fs/xfs/xfs_dir.c
fs/xfs/xfs_dir.c
+9
-9
fs/xfs/xfs_dir2.c
fs/xfs/xfs_dir2.c
+8
-8
fs/xfs/xfs_inode.c
fs/xfs/xfs_inode.c
+35
-35
fs/xfs/xfs_inode.h
fs/xfs/xfs_inode.h
+3
-3
fs/xfs/xfs_log_recover.c
fs/xfs/xfs_log_recover.c
+2
-2
fs/xfs/xfs_mount.c
fs/xfs/xfs_mount.c
+1
-1
fs/xfs/xfs_rename.c
fs/xfs/xfs_rename.c
+3
-3
fs/xfs/xfs_rw.c
fs/xfs/xfs_rw.c
+4
-4
fs/xfs/xfs_vnodeops.c
fs/xfs/xfs_vnodeops.c
+22
-22
No files found.
fs/xfs/linux/xfs_lrw.c
View file @
21ef8d34
...
@@ -671,9 +671,9 @@ xfs_write(
...
@@ -671,9 +671,9 @@ xfs_write(
* setgid binaries.
* setgid binaries.
*/
*/
if
(((
xip
->
i_d
.
di_mode
&
ISUID
)
||
if
(((
xip
->
i_d
.
di_mode
&
S_
ISUID
)
||
((
xip
->
i_d
.
di_mode
&
(
ISGID
|
(
IEXEC
>>
3
)
))
==
((
xip
->
i_d
.
di_mode
&
(
S_ISGID
|
S_IXGRP
))
==
(
ISGID
|
(
IEXEC
>>
3
)
)))
&&
(
S_ISGID
|
S_IXGRP
)))
&&
!
capable
(
CAP_FSETID
))
{
!
capable
(
CAP_FSETID
))
{
error
=
xfs_write_clear_setuid
(
xip
);
error
=
xfs_write_clear_setuid
(
xip
);
if
(
error
)
{
if
(
error
)
{
...
@@ -851,7 +851,7 @@ xfs_bmap(bhv_desc_t *bdp,
...
@@ -851,7 +851,7 @@ xfs_bmap(bhv_desc_t *bdp,
xfs_inode_t
*
ip
=
XFS_BHVTOI
(
bdp
);
xfs_inode_t
*
ip
=
XFS_BHVTOI
(
bdp
);
xfs_iocore_t
*
io
=
&
ip
->
i_iocore
;
xfs_iocore_t
*
io
=
&
ip
->
i_iocore
;
ASSERT
((
ip
->
i_d
.
di_mode
&
IFMT
)
==
IFREG
);
ASSERT
((
ip
->
i_d
.
di_mode
&
S_IFMT
)
==
S_
IFREG
);
ASSERT
(((
ip
->
i_d
.
di_flags
&
XFS_DIFLAG_REALTIME
)
!=
0
)
==
ASSERT
(((
ip
->
i_d
.
di_flags
&
XFS_DIFLAG_REALTIME
)
!=
0
)
==
((
ip
->
i_iocore
.
io_flags
&
XFS_IOCORE_RT
)
!=
0
));
((
ip
->
i_iocore
.
io_flags
&
XFS_IOCORE_RT
)
!=
0
));
...
...
fs/xfs/linux/xfs_sysctl.h
View file @
21ef8d34
...
@@ -47,7 +47,7 @@ typedef struct xfs_sysctl_val {
...
@@ -47,7 +47,7 @@ typedef struct xfs_sysctl_val {
typedef
struct
xfs_param
{
typedef
struct
xfs_param
{
xfs_sysctl_val_t
restrict_chown
;
/* Root/non-root can give away files.*/
xfs_sysctl_val_t
restrict_chown
;
/* Root/non-root can give away files.*/
xfs_sysctl_val_t
sgid_inherit
;
/* Inherit ISGID bit if process' GID
xfs_sysctl_val_t
sgid_inherit
;
/* Inherit
S_
ISGID bit if process' GID
* is not a member of the parent dir
* is not a member of the parent dir
* GID */
* GID */
xfs_sysctl_val_t
symlink_mode
;
/* Link creat mode affected by umask */
xfs_sysctl_val_t
symlink_mode
;
/* Link creat mode affected by umask */
...
...
fs/xfs/quota/xfs_qm.c
View file @
21ef8d34
...
@@ -1433,7 +1433,7 @@ xfs_qm_qino_alloc(
...
@@ -1433,7 +1433,7 @@ xfs_qm_qino_alloc(
}
}
memset
(
&
zerocr
,
0
,
sizeof
(
zerocr
));
memset
(
&
zerocr
,
0
,
sizeof
(
zerocr
));
if
((
error
=
xfs_dir_ialloc
(
&
tp
,
mp
->
m_rootip
,
IFREG
,
1
,
0
,
if
((
error
=
xfs_dir_ialloc
(
&
tp
,
mp
->
m_rootip
,
S_
IFREG
,
1
,
0
,
&
zerocr
,
0
,
1
,
ip
,
&
committed
)))
{
&
zerocr
,
0
,
1
,
ip
,
&
committed
)))
{
xfs_trans_cancel
(
tp
,
XFS_TRANS_RELEASE_LOG_RES
|
xfs_trans_cancel
(
tp
,
XFS_TRANS_RELEASE_LOG_RES
|
XFS_TRANS_ABORT
);
XFS_TRANS_ABORT
);
...
...
fs/xfs/xfs_attr.c
View file @
21ef8d34
...
@@ -143,7 +143,7 @@ xfs_attr_get_int(xfs_inode_t *ip, char *name, char *value, int *valuelenp,
...
@@ -143,7 +143,7 @@ xfs_attr_get_int(xfs_inode_t *ip, char *name, char *value, int *valuelenp,
/*
/*
* Do we answer them, or ignore them?
* Do we answer them, or ignore them?
*/
*/
if
((
error
=
xfs_iaccess
(
ip
,
IREAD
,
cred
)))
{
if
((
error
=
xfs_iaccess
(
ip
,
S_IRUSR
,
cred
)))
{
xfs_iunlock
(
ip
,
XFS_ILOCK_SHARED
);
xfs_iunlock
(
ip
,
XFS_ILOCK_SHARED
);
return
(
XFS_ERROR
(
error
));
return
(
XFS_ERROR
(
error
));
}
}
...
@@ -239,7 +239,7 @@ xfs_attr_set(bhv_desc_t *bdp, char *name, char *value, int valuelen, int flags,
...
@@ -239,7 +239,7 @@ xfs_attr_set(bhv_desc_t *bdp, char *name, char *value, int valuelen, int flags,
return
(
EIO
);
return
(
EIO
);
xfs_ilock
(
dp
,
XFS_ILOCK_SHARED
);
xfs_ilock
(
dp
,
XFS_ILOCK_SHARED
);
if
((
error
=
xfs_iaccess
(
dp
,
IWRITE
,
cred
)))
{
if
((
error
=
xfs_iaccess
(
dp
,
S_IWUSR
,
cred
)))
{
xfs_iunlock
(
dp
,
XFS_ILOCK_SHARED
);
xfs_iunlock
(
dp
,
XFS_ILOCK_SHARED
);
return
(
XFS_ERROR
(
error
));
return
(
XFS_ERROR
(
error
));
}
}
...
@@ -498,7 +498,7 @@ xfs_attr_remove(bhv_desc_t *bdp, char *name, int flags, struct cred *cred)
...
@@ -498,7 +498,7 @@ xfs_attr_remove(bhv_desc_t *bdp, char *name, int flags, struct cred *cred)
return
(
EIO
);
return
(
EIO
);
xfs_ilock
(
dp
,
XFS_ILOCK_SHARED
);
xfs_ilock
(
dp
,
XFS_ILOCK_SHARED
);
if
((
error
=
xfs_iaccess
(
dp
,
IWRITE
,
cred
)))
{
if
((
error
=
xfs_iaccess
(
dp
,
S_IWUSR
,
cred
)))
{
xfs_iunlock
(
dp
,
XFS_ILOCK_SHARED
);
xfs_iunlock
(
dp
,
XFS_ILOCK_SHARED
);
return
(
XFS_ERROR
(
error
));
return
(
XFS_ERROR
(
error
));
}
else
if
(
XFS_IFORK_Q
(
dp
)
==
0
||
}
else
if
(
XFS_IFORK_Q
(
dp
)
==
0
||
...
@@ -687,7 +687,7 @@ xfs_attr_list(bhv_desc_t *bdp, char *buffer, int bufsize, int flags,
...
@@ -687,7 +687,7 @@ xfs_attr_list(bhv_desc_t *bdp, char *buffer, int bufsize, int flags,
* Do they have permission?
* Do they have permission?
*/
*/
xfs_ilock
(
dp
,
XFS_ILOCK_SHARED
);
xfs_ilock
(
dp
,
XFS_ILOCK_SHARED
);
if
((
error
=
xfs_iaccess
(
dp
,
IREAD
,
cred
)))
{
if
((
error
=
xfs_iaccess
(
dp
,
S_IRUSR
,
cred
)))
{
xfs_iunlock
(
dp
,
XFS_ILOCK_SHARED
);
xfs_iunlock
(
dp
,
XFS_ILOCK_SHARED
);
return
(
XFS_ERROR
(
error
));
return
(
XFS_ERROR
(
error
));
}
}
...
...
fs/xfs/xfs_bmap.c
View file @
21ef8d34
...
@@ -521,7 +521,7 @@ xfs_bmap_add_attrfork_local(
...
@@ -521,7 +521,7 @@ xfs_bmap_add_attrfork_local(
if
(
ip
->
i_df
.
if_bytes
<=
XFS_IFORK_DSIZE
(
ip
))
if
(
ip
->
i_df
.
if_bytes
<=
XFS_IFORK_DSIZE
(
ip
))
return
0
;
return
0
;
if
((
ip
->
i_d
.
di_mode
&
IFMT
)
==
IFDIR
)
{
if
((
ip
->
i_d
.
di_mode
&
S_IFMT
)
==
S_
IFDIR
)
{
mp
=
ip
->
i_mount
;
mp
=
ip
->
i_mount
;
memset
(
&
dargs
,
0
,
sizeof
(
dargs
));
memset
(
&
dargs
,
0
,
sizeof
(
dargs
));
dargs
.
dp
=
ip
;
dargs
.
dp
=
ip
;
...
@@ -3354,7 +3354,7 @@ xfs_bmap_local_to_extents(
...
@@ -3354,7 +3354,7 @@ xfs_bmap_local_to_extents(
* We don't want to deal with the case of keeping inode data inline yet.
* We don't want to deal with the case of keeping inode data inline yet.
* So sending the data fork of a regular inode is invalid.
* So sending the data fork of a regular inode is invalid.
*/
*/
ASSERT
(
!
((
ip
->
i_d
.
di_mode
&
IFMT
)
==
IFREG
&&
ASSERT
(
!
((
ip
->
i_d
.
di_mode
&
S_IFMT
)
==
S_
IFREG
&&
whichfork
==
XFS_DATA_FORK
));
whichfork
==
XFS_DATA_FORK
));
ifp
=
XFS_IFORK_PTR
(
ip
,
whichfork
);
ifp
=
XFS_IFORK_PTR
(
ip
,
whichfork
);
ASSERT
(
XFS_IFORK_FORMAT
(
ip
,
whichfork
)
==
XFS_DINODE_FMT_LOCAL
);
ASSERT
(
XFS_IFORK_FORMAT
(
ip
,
whichfork
)
==
XFS_DINODE_FMT_LOCAL
);
...
...
fs/xfs/xfs_dfrag.c
View file @
21ef8d34
...
@@ -154,12 +154,12 @@ xfs_swapext(
...
@@ -154,12 +154,12 @@ xfs_swapext(
goto
error0
;
goto
error0
;
}
}
if
((
current
->
fsuid
!=
ip
->
i_d
.
di_uid
)
&&
if
((
current
->
fsuid
!=
ip
->
i_d
.
di_uid
)
&&
(
error
=
xfs_iaccess
(
ip
,
IWRITE
,
NULL
))
&&
(
error
=
xfs_iaccess
(
ip
,
S_IWUSR
,
NULL
))
&&
!
capable_cred
(
NULL
,
CAP_FOWNER
))
{
!
capable_cred
(
NULL
,
CAP_FOWNER
))
{
goto
error0
;
goto
error0
;
}
}
if
((
current
->
fsuid
!=
tip
->
i_d
.
di_uid
)
&&
if
((
current
->
fsuid
!=
tip
->
i_d
.
di_uid
)
&&
(
error
=
xfs_iaccess
(
tip
,
IWRITE
,
NULL
))
&&
(
error
=
xfs_iaccess
(
tip
,
S_IWUSR
,
NULL
))
&&
!
capable_cred
(
NULL
,
CAP_FOWNER
))
{
!
capable_cred
(
NULL
,
CAP_FOWNER
))
{
goto
error0
;
goto
error0
;
}
}
...
...
fs/xfs/xfs_dinode.h
View file @
21ef8d34
...
@@ -107,7 +107,7 @@ typedef struct xfs_dinode
...
@@ -107,7 +107,7 @@ typedef struct xfs_dinode
xfs_dir_shortform_t
di_dirsf
;
/* shortform directory */
xfs_dir_shortform_t
di_dirsf
;
/* shortform directory */
xfs_dir2_sf_t
di_dir2sf
;
/* shortform directory v2 */
xfs_dir2_sf_t
di_dir2sf
;
/* shortform directory v2 */
char
di_c
[
1
];
/* local contents */
char
di_c
[
1
];
/* local contents */
xfs_dev_t
di_dev
;
/* device for
IFCHR/
IFBLK */
xfs_dev_t
di_dev
;
/* device for
S_IFCHR/S_
IFBLK */
uuid_t
di_muuid
;
/* mount point value */
uuid_t
di_muuid
;
/* mount point value */
char
di_symlink
[
1
];
/* local symbolic link */
char
di_symlink
[
1
];
/* local symbolic link */
}
di_u
;
}
di_u
;
...
@@ -436,25 +436,6 @@ void xfs_dfork_next_set(xfs_dinode_t *dip, int w, int n);
...
@@ -436,25 +436,6 @@ void xfs_dfork_next_set(xfs_dinode_t *dip, int w, int n);
#endif
#endif
/*
* File types (mode field)
*/
#define IFMT S_IFMT
#define IFSOCK S_IFSOCK
#define IFLNK S_IFLNK
#define IFREG S_IFREG
#define IFBLK S_IFBLK
#define IFDIR S_IFDIR
#define IFCHR S_IFCHR
#define IFIFO S_IFIFO
#define ISUID S_ISUID
#define ISGID S_ISGID
#define ISVTX S_ISVTX
#define IREAD S_IRUSR
#define IWRITE S_IWUSR
#define IEXEC S_IXUSR
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_DINODE)
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_DINODE)
xfs_dinode_t
*
xfs_buf_to_dinode
(
struct
xfs_buf
*
bp
);
xfs_dinode_t
*
xfs_buf_to_dinode
(
struct
xfs_buf
*
bp
);
#define XFS_BUF_TO_DINODE(bp) xfs_buf_to_dinode(bp)
#define XFS_BUF_TO_DINODE(bp) xfs_buf_to_dinode(bp)
...
...
fs/xfs/xfs_dir.c
View file @
21ef8d34
...
@@ -216,7 +216,7 @@ xfs_dir_isempty(xfs_inode_t *dp)
...
@@ -216,7 +216,7 @@ xfs_dir_isempty(xfs_inode_t *dp)
{
{
xfs_dir_sf_hdr_t
*
hdr
;
xfs_dir_sf_hdr_t
*
hdr
;
ASSERT
((
dp
->
i_d
.
di_mode
&
IFMT
)
==
IFDIR
);
ASSERT
((
dp
->
i_d
.
di_mode
&
S_IFMT
)
==
S_
IFDIR
);
if
(
dp
->
i_d
.
di_size
==
0
)
if
(
dp
->
i_d
.
di_size
==
0
)
return
(
1
);
return
(
1
);
if
(
dp
->
i_d
.
di_size
>
XFS_IFORK_DSIZE
(
dp
))
if
(
dp
->
i_d
.
di_size
>
XFS_IFORK_DSIZE
(
dp
))
...
@@ -238,7 +238,7 @@ xfs_dir_init(xfs_trans_t *trans, xfs_inode_t *dir, xfs_inode_t *parent_dir)
...
@@ -238,7 +238,7 @@ xfs_dir_init(xfs_trans_t *trans, xfs_inode_t *dir, xfs_inode_t *parent_dir)
args
.
dp
=
dir
;
args
.
dp
=
dir
;
args
.
trans
=
trans
;
args
.
trans
=
trans
;
ASSERT
((
dir
->
i_d
.
di_mode
&
IFMT
)
==
IFDIR
);
ASSERT
((
dir
->
i_d
.
di_mode
&
S_IFMT
)
==
S_
IFDIR
);
if
((
error
=
xfs_dir_ino_validate
(
trans
->
t_mountp
,
parent_dir
->
i_ino
)))
if
((
error
=
xfs_dir_ino_validate
(
trans
->
t_mountp
,
parent_dir
->
i_ino
)))
return
error
;
return
error
;
...
@@ -257,7 +257,7 @@ xfs_dir_createname(xfs_trans_t *trans, xfs_inode_t *dp, char *name,
...
@@ -257,7 +257,7 @@ xfs_dir_createname(xfs_trans_t *trans, xfs_inode_t *dp, char *name,
xfs_da_args_t
args
;
xfs_da_args_t
args
;
int
retval
,
newsize
,
done
;
int
retval
,
newsize
,
done
;
ASSERT
((
dp
->
i_d
.
di_mode
&
IFMT
)
==
IFDIR
);
ASSERT
((
dp
->
i_d
.
di_mode
&
S_IFMT
)
==
S_
IFDIR
);
if
((
retval
=
xfs_dir_ino_validate
(
trans
->
t_mountp
,
inum
)))
if
((
retval
=
xfs_dir_ino_validate
(
trans
->
t_mountp
,
inum
)))
return
(
retval
);
return
(
retval
);
...
@@ -321,7 +321,7 @@ xfs_dir_canenter(xfs_trans_t *trans, xfs_inode_t *dp, char *name, int namelen)
...
@@ -321,7 +321,7 @@ xfs_dir_canenter(xfs_trans_t *trans, xfs_inode_t *dp, char *name, int namelen)
xfs_da_args_t
args
;
xfs_da_args_t
args
;
int
retval
,
newsize
;
int
retval
,
newsize
;
ASSERT
((
dp
->
i_d
.
di_mode
&
IFMT
)
==
IFDIR
);
ASSERT
((
dp
->
i_d
.
di_mode
&
S_IFMT
)
==
S_
IFDIR
);
/*
/*
* Fill in the arg structure for this request.
* Fill in the arg structure for this request.
*/
*/
...
@@ -366,7 +366,7 @@ xfs_dir_removename(xfs_trans_t *trans, xfs_inode_t *dp, char *name,
...
@@ -366,7 +366,7 @@ xfs_dir_removename(xfs_trans_t *trans, xfs_inode_t *dp, char *name,
xfs_da_args_t
args
;
xfs_da_args_t
args
;
int
count
,
totallen
,
newsize
,
retval
;
int
count
,
totallen
,
newsize
,
retval
;
ASSERT
((
dp
->
i_d
.
di_mode
&
IFMT
)
==
IFDIR
);
ASSERT
((
dp
->
i_d
.
di_mode
&
S_IFMT
)
==
S_
IFDIR
);
XFS_STATS_INC
(
xs_dir_remove
);
XFS_STATS_INC
(
xs_dir_remove
);
/*
/*
* Fill in the arg structure for this request.
* Fill in the arg structure for this request.
...
@@ -409,7 +409,7 @@ xfs_dir_lookup(xfs_trans_t *trans, xfs_inode_t *dp, char *name, int namelen,
...
@@ -409,7 +409,7 @@ xfs_dir_lookup(xfs_trans_t *trans, xfs_inode_t *dp, char *name, int namelen,
xfs_da_args_t
args
;
xfs_da_args_t
args
;
int
retval
;
int
retval
;
ASSERT
((
dp
->
i_d
.
di_mode
&
IFMT
)
==
IFDIR
);
ASSERT
((
dp
->
i_d
.
di_mode
&
S_IFMT
)
==
S_
IFDIR
);
XFS_STATS_INC
(
xs_dir_lookup
);
XFS_STATS_INC
(
xs_dir_lookup
);
/*
/*
...
@@ -455,7 +455,7 @@ xfs_dir_getdents(xfs_trans_t *trans, xfs_inode_t *dp, uio_t *uio, int *eofp)
...
@@ -455,7 +455,7 @@ xfs_dir_getdents(xfs_trans_t *trans, xfs_inode_t *dp, uio_t *uio, int *eofp)
xfs_dir_put_t
put
;
xfs_dir_put_t
put
;
XFS_STATS_INC
(
xs_dir_getdents
);
XFS_STATS_INC
(
xs_dir_getdents
);
ASSERT
((
dp
->
i_d
.
di_mode
&
IFMT
)
==
IFDIR
);
ASSERT
((
dp
->
i_d
.
di_mode
&
S_IFMT
)
==
S_
IFDIR
);
/*
/*
* If our caller has given us a single contiguous memory buffer,
* If our caller has given us a single contiguous memory buffer,
...
@@ -499,7 +499,7 @@ xfs_dir_replace(xfs_trans_t *trans, xfs_inode_t *dp, char *name, int namelen,
...
@@ -499,7 +499,7 @@ xfs_dir_replace(xfs_trans_t *trans, xfs_inode_t *dp, char *name, int namelen,
xfs_da_args_t
args
;
xfs_da_args_t
args
;
int
retval
;
int
retval
;
ASSERT
((
dp
->
i_d
.
di_mode
&
IFMT
)
==
IFDIR
);
ASSERT
((
dp
->
i_d
.
di_mode
&
S_IFMT
)
==
S_
IFDIR
);
if
((
retval
=
xfs_dir_ino_validate
(
trans
->
t_mountp
,
inum
)))
if
((
retval
=
xfs_dir_ino_validate
(
trans
->
t_mountp
,
inum
)))
return
retval
;
return
retval
;
...
@@ -545,7 +545,7 @@ xfs_dir_shortform_validate_ondisk(xfs_mount_t *mp, xfs_dinode_t *dp)
...
@@ -545,7 +545,7 @@ xfs_dir_shortform_validate_ondisk(xfs_mount_t *mp, xfs_dinode_t *dp)
if
((
INT_GET
(
dp
->
di_core
.
di_mode
,
ARCH_CONVERT
)
&
IFMT
)
!=
IFDIR
)
{
if
((
INT_GET
(
dp
->
di_core
.
di_mode
,
ARCH_CONVERT
)
&
S_IFMT
)
!=
S_
IFDIR
)
{
return
0
;
return
0
;
}
}
if
(
INT_GET
(
dp
->
di_core
.
di_format
,
ARCH_CONVERT
)
!=
XFS_DINODE_FMT_LOCAL
)
{
if
(
INT_GET
(
dp
->
di_core
.
di_format
,
ARCH_CONVERT
)
!=
XFS_DINODE_FMT_LOCAL
)
{
...
...
fs/xfs/xfs_dir2.c
View file @
21ef8d34
...
@@ -155,7 +155,7 @@ xfs_dir2_isempty(
...
@@ -155,7 +155,7 @@ xfs_dir2_isempty(
{
{
xfs_dir2_sf_t
*
sfp
;
/* shortform directory structure */
xfs_dir2_sf_t
*
sfp
;
/* shortform directory structure */
ASSERT
((
dp
->
i_d
.
di_mode
&
IFMT
)
==
IFDIR
);
ASSERT
((
dp
->
i_d
.
di_mode
&
S_IFMT
)
==
S_
IFDIR
);
/*
/*
* Might happen during shutdown.
* Might happen during shutdown.
*/
*/
...
@@ -183,7 +183,7 @@ xfs_dir2_init(
...
@@ -183,7 +183,7 @@ xfs_dir2_init(
memset
((
char
*
)
&
args
,
0
,
sizeof
(
args
));
memset
((
char
*
)
&
args
,
0
,
sizeof
(
args
));
args
.
dp
=
dp
;
args
.
dp
=
dp
;
args
.
trans
=
tp
;
args
.
trans
=
tp
;
ASSERT
((
dp
->
i_d
.
di_mode
&
IFMT
)
==
IFDIR
);
ASSERT
((
dp
->
i_d
.
di_mode
&
S_IFMT
)
==
S_
IFDIR
);
if
((
error
=
xfs_dir_ino_validate
(
tp
->
t_mountp
,
pdp
->
i_ino
)))
{
if
((
error
=
xfs_dir_ino_validate
(
tp
->
t_mountp
,
pdp
->
i_ino
)))
{
return
error
;
return
error
;
}
}
...
@@ -208,7 +208,7 @@ xfs_dir2_createname(
...
@@ -208,7 +208,7 @@ xfs_dir2_createname(
int
rval
;
/* return value */
int
rval
;
/* return value */
int
v
;
/* type-checking value */
int
v
;
/* type-checking value */
ASSERT
((
dp
->
i_d
.
di_mode
&
IFMT
)
==
IFDIR
);
ASSERT
((
dp
->
i_d
.
di_mode
&
S_IFMT
)
==
S_
IFDIR
);
if
((
rval
=
xfs_dir_ino_validate
(
tp
->
t_mountp
,
inum
)))
{
if
((
rval
=
xfs_dir_ino_validate
(
tp
->
t_mountp
,
inum
)))
{
return
rval
;
return
rval
;
}
}
...
@@ -261,7 +261,7 @@ xfs_dir2_lookup(
...
@@ -261,7 +261,7 @@ xfs_dir2_lookup(
int
rval
;
/* return value */
int
rval
;
/* return value */
int
v
;
/* type-checking value */
int
v
;
/* type-checking value */
ASSERT
((
dp
->
i_d
.
di_mode
&
IFMT
)
==
IFDIR
);
ASSERT
((
dp
->
i_d
.
di_mode
&
S_IFMT
)
==
S_
IFDIR
);
XFS_STATS_INC
(
xs_dir_lookup
);
XFS_STATS_INC
(
xs_dir_lookup
);
/*
/*
...
@@ -319,7 +319,7 @@ xfs_dir2_removename(
...
@@ -319,7 +319,7 @@ xfs_dir2_removename(
int
rval
;
/* return value */
int
rval
;
/* return value */
int
v
;
/* type-checking value */
int
v
;
/* type-checking value */
ASSERT
((
dp
->
i_d
.
di_mode
&
IFMT
)
==
IFDIR
);
ASSERT
((
dp
->
i_d
.
di_mode
&
S_IFMT
)
==
S_
IFDIR
);
XFS_STATS_INC
(
xs_dir_remove
);
XFS_STATS_INC
(
xs_dir_remove
);
/*
/*
* Fill in the arg structure for this request.
* Fill in the arg structure for this request.
...
@@ -369,7 +369,7 @@ xfs_dir2_getdents(
...
@@ -369,7 +369,7 @@ xfs_dir2_getdents(
int
rval
;
/* return value */
int
rval
;
/* return value */
int
v
;
/* type-checking value */
int
v
;
/* type-checking value */
ASSERT
((
dp
->
i_d
.
di_mode
&
IFMT
)
==
IFDIR
);
ASSERT
((
dp
->
i_d
.
di_mode
&
S_IFMT
)
==
S_
IFDIR
);
XFS_STATS_INC
(
xs_dir_getdents
);
XFS_STATS_INC
(
xs_dir_getdents
);
/*
/*
* If our caller has given us a single contiguous aligned memory buffer,
* If our caller has given us a single contiguous aligned memory buffer,
...
@@ -422,7 +422,7 @@ xfs_dir2_replace(
...
@@ -422,7 +422,7 @@ xfs_dir2_replace(
int
rval
;
/* return value */
int
rval
;
/* return value */
int
v
;
/* type-checking value */
int
v
;
/* type-checking value */
ASSERT
((
dp
->
i_d
.
di_mode
&
IFMT
)
==
IFDIR
);
ASSERT
((
dp
->
i_d
.
di_mode
&
S_IFMT
)
==
S_
IFDIR
);
if
((
rval
=
xfs_dir_ino_validate
(
tp
->
t_mountp
,
inum
)))
{
if
((
rval
=
xfs_dir_ino_validate
(
tp
->
t_mountp
,
inum
)))
{
return
rval
;
return
rval
;
...
@@ -473,7 +473,7 @@ xfs_dir2_canenter(
...
@@ -473,7 +473,7 @@ xfs_dir2_canenter(
int
rval
;
/* return value */
int
rval
;
/* return value */
int
v
;
/* type-checking value */
int
v
;
/* type-checking value */
ASSERT
((
dp
->
i_d
.
di_mode
&
IFMT
)
==
IFDIR
);
ASSERT
((
dp
->
i_d
.
di_mode
&
S_IFMT
)
==
S_
IFDIR
);
/*
/*
* Fill in the arg structure for this request.
* Fill in the arg structure for this request.
*/
*/
...
...
fs/xfs/xfs_inode.c
View file @
21ef8d34
...
@@ -487,11 +487,11 @@ xfs_iformat(
...
@@ -487,11 +487,11 @@ xfs_iformat(
return
XFS_ERROR
(
EFSCORRUPTED
);
return
XFS_ERROR
(
EFSCORRUPTED
);
}
}
switch
(
ip
->
i_d
.
di_mode
&
IFMT
)
{
switch
(
ip
->
i_d
.
di_mode
&
S_
IFMT
)
{
case
IFIFO
:
case
S_
IFIFO
:
case
IFCHR
:
case
S_
IFCHR
:
case
IFBLK
:
case
S_
IFBLK
:
case
IFSOCK
:
case
S_
IFSOCK
:
if
(
unlikely
(
INT_GET
(
dip
->
di_core
.
di_format
,
ARCH_CONVERT
)
!=
XFS_DINODE_FMT_DEV
))
{
if
(
unlikely
(
INT_GET
(
dip
->
di_core
.
di_format
,
ARCH_CONVERT
)
!=
XFS_DINODE_FMT_DEV
))
{
XFS_CORRUPTION_ERROR
(
"xfs_iformat(3)"
,
XFS_ERRLEVEL_LOW
,
XFS_CORRUPTION_ERROR
(
"xfs_iformat(3)"
,
XFS_ERRLEVEL_LOW
,
ip
->
i_mount
,
dip
);
ip
->
i_mount
,
dip
);
...
@@ -501,15 +501,15 @@ xfs_iformat(
...
@@ -501,15 +501,15 @@ xfs_iformat(
ip
->
i_df
.
if_u2
.
if_rdev
=
INT_GET
(
dip
->
di_u
.
di_dev
,
ARCH_CONVERT
);
ip
->
i_df
.
if_u2
.
if_rdev
=
INT_GET
(
dip
->
di_u
.
di_dev
,
ARCH_CONVERT
);
break
;
break
;
case
IFREG
:
case
S_
IFREG
:
case
IFLNK
:
case
S_
IFLNK
:
case
IFDIR
:
case
S_
IFDIR
:
switch
(
INT_GET
(
dip
->
di_core
.
di_format
,
ARCH_CONVERT
))
{
switch
(
INT_GET
(
dip
->
di_core
.
di_format
,
ARCH_CONVERT
))
{
case
XFS_DINODE_FMT_LOCAL
:
case
XFS_DINODE_FMT_LOCAL
:
/*
/*
* no local regular files yet
* no local regular files yet
*/
*/
if
(
unlikely
((
INT_GET
(
dip
->
di_core
.
di_mode
,
ARCH_CONVERT
)
&
IFMT
)
==
IFREG
))
{
if
(
unlikely
((
INT_GET
(
dip
->
di_core
.
di_mode
,
ARCH_CONVERT
)
&
S_IFMT
)
==
S_
IFREG
))
{
xfs_fs_cmn_err
(
CE_WARN
,
ip
->
i_mount
,
xfs_fs_cmn_err
(
CE_WARN
,
ip
->
i_mount
,
"corrupt inode (local format for regular file) %Lu. Unmount and run xfs_repair."
,
"corrupt inode (local format for regular file) %Lu. Unmount and run xfs_repair."
,
(
unsigned
long
long
)
ip
->
i_ino
);
(
unsigned
long
long
)
ip
->
i_ino
);
...
@@ -1172,20 +1172,20 @@ xfs_ialloc(
...
@@ -1172,20 +1172,20 @@ xfs_ialloc(
if
(
XFS_INHERIT_GID
(
pip
,
vp
->
v_vfsp
))
{
if
(
XFS_INHERIT_GID
(
pip
,
vp
->
v_vfsp
))
{
ip
->
i_d
.
di_gid
=
pip
->
i_d
.
di_gid
;
ip
->
i_d
.
di_gid
=
pip
->
i_d
.
di_gid
;
if
((
pip
->
i_d
.
di_mode
&
ISGID
)
&&
(
mode
&
IFMT
)
==
IFDIR
)
{
if
((
pip
->
i_d
.
di_mode
&
S_ISGID
)
&&
(
mode
&
S_IFMT
)
==
S_
IFDIR
)
{
ip
->
i_d
.
di_mode
|=
ISGID
;
ip
->
i_d
.
di_mode
|=
S_
ISGID
;
}
}
}
}
/*
/*
* If the group ID of the new file does not match the effective group
* If the group ID of the new file does not match the effective group
* ID or one of the supplementary group IDs, the ISGID bit is cleared
* ID or one of the supplementary group IDs, the
S_
ISGID bit is cleared
* (and only if the irix_sgid_inherit compatibility variable is set).
* (and only if the irix_sgid_inherit compatibility variable is set).
*/
*/
if
((
irix_sgid_inherit
)
&&
if
((
irix_sgid_inherit
)
&&
(
ip
->
i_d
.
di_mode
&
ISGID
)
&&
(
ip
->
i_d
.
di_mode
&
S_
ISGID
)
&&
(
!
in_group_p
((
gid_t
)
ip
->
i_d
.
di_gid
)))
{
(
!
in_group_p
((
gid_t
)
ip
->
i_d
.
di_gid
)))
{
ip
->
i_d
.
di_mode
&=
~
ISGID
;
ip
->
i_d
.
di_mode
&=
~
S_
ISGID
;
}
}
ip
->
i_d
.
di_size
=
0
;
ip
->
i_d
.
di_size
=
0
;
...
@@ -1200,18 +1200,18 @@ xfs_ialloc(
...
@@ -1200,18 +1200,18 @@ xfs_ialloc(
ip
->
i_d
.
di_dmstate
=
0
;
ip
->
i_d
.
di_dmstate
=
0
;
ip
->
i_d
.
di_flags
=
0
;
ip
->
i_d
.
di_flags
=
0
;
flags
=
XFS_ILOG_CORE
;
flags
=
XFS_ILOG_CORE
;
switch
(
mode
&
IFMT
)
{
switch
(
mode
&
S_
IFMT
)
{
case
IFIFO
:
case
S_
IFIFO
:
case
IFCHR
:
case
S_
IFCHR
:
case
IFBLK
:
case
S_
IFBLK
:
case
IFSOCK
:
case
S_
IFSOCK
:
ip
->
i_d
.
di_format
=
XFS_DINODE_FMT_DEV
;
ip
->
i_d
.
di_format
=
XFS_DINODE_FMT_DEV
;
ip
->
i_df
.
if_u2
.
if_rdev
=
rdev
;
ip
->
i_df
.
if_u2
.
if_rdev
=
rdev
;
ip
->
i_df
.
if_flags
=
0
;
ip
->
i_df
.
if_flags
=
0
;
flags
|=
XFS_ILOG_DEV
;
flags
|=
XFS_ILOG_DEV
;
break
;
break
;
case
IFREG
:
case
S_
IFREG
:
case
IFDIR
:
case
S_
IFDIR
:
if
(
pip
->
i_d
.
di_flags
&
if
(
pip
->
i_d
.
di_flags
&
(
XFS_DIFLAG_NOATIME
|
XFS_DIFLAG_NODUMP
|
XFS_DIFLAG_SYNC
))
{
(
XFS_DIFLAG_NOATIME
|
XFS_DIFLAG_NODUMP
|
XFS_DIFLAG_SYNC
))
{
if
((
pip
->
i_d
.
di_flags
&
XFS_DIFLAG_NOATIME
)
&&
if
((
pip
->
i_d
.
di_flags
&
XFS_DIFLAG_NOATIME
)
&&
...
@@ -1224,7 +1224,7 @@ xfs_ialloc(
...
@@ -1224,7 +1224,7 @@ xfs_ialloc(
xfs_inherit_sync
)
xfs_inherit_sync
)
ip
->
i_d
.
di_flags
|=
XFS_DIFLAG_SYNC
;
ip
->
i_d
.
di_flags
|=
XFS_DIFLAG_SYNC
;
}
}
case
IFLNK
:
case
S_
IFLNK
:
ip
->
i_d
.
di_format
=
XFS_DINODE_FMT_EXTENTS
;
ip
->
i_d
.
di_format
=
XFS_DINODE_FMT_EXTENTS
;
ip
->
i_df
.
if_flags
=
XFS_IFEXTENTS
;
ip
->
i_df
.
if_flags
=
XFS_IFEXTENTS
;
ip
->
i_df
.
if_bytes
=
ip
->
i_df
.
if_real_bytes
=
0
;
ip
->
i_df
.
if_bytes
=
ip
->
i_df
.
if_real_bytes
=
0
;
...
@@ -1268,7 +1268,7 @@ xfs_isize_check(
...
@@ -1268,7 +1268,7 @@ xfs_isize_check(
int
nimaps
;
int
nimaps
;
xfs_bmbt_irec_t
imaps
[
2
];
xfs_bmbt_irec_t
imaps
[
2
];
if
((
ip
->
i_d
.
di_mode
&
IFMT
)
!=
IFREG
)
if
((
ip
->
i_d
.
di_mode
&
S_IFMT
)
!=
S_
IFREG
)
return
;
return
;
if
(
ip
->
i_d
.
di_flags
&
XFS_DIFLAG_REALTIME
)
if
(
ip
->
i_d
.
di_flags
&
XFS_DIFLAG_REALTIME
)
...
@@ -2304,7 +2304,7 @@ xfs_ifree(
...
@@ -2304,7 +2304,7 @@ xfs_ifree(
ASSERT
(
ip
->
i_d
.
di_nextents
==
0
);
ASSERT
(
ip
->
i_d
.
di_nextents
==
0
);
ASSERT
(
ip
->
i_d
.
di_anextents
==
0
);
ASSERT
(
ip
->
i_d
.
di_anextents
==
0
);
ASSERT
((
ip
->
i_d
.
di_size
==
0
)
||
ASSERT
((
ip
->
i_d
.
di_size
==
0
)
||
((
ip
->
i_d
.
di_mode
&
IFMT
)
!=
IFREG
));
((
ip
->
i_d
.
di_mode
&
S_IFMT
)
!=
S_
IFREG
));
ASSERT
(
ip
->
i_d
.
di_nblocks
==
0
);
ASSERT
(
ip
->
i_d
.
di_nblocks
==
0
);
/*
/*
...
@@ -2746,10 +2746,10 @@ xfs_idestroy(
...
@@ -2746,10 +2746,10 @@ xfs_idestroy(
xfs_inode_t
*
ip
)
xfs_inode_t
*
ip
)
{
{
switch
(
ip
->
i_d
.
di_mode
&
IFMT
)
{
switch
(
ip
->
i_d
.
di_mode
&
S_
IFMT
)
{
case
IFREG
:
case
S_
IFREG
:
case
IFDIR
:
case
S_
IFDIR
:
case
IFLNK
:
case
S_
IFLNK
:
xfs_idestroy_fork
(
ip
,
XFS_DATA_FORK
);
xfs_idestroy_fork
(
ip
,
XFS_DATA_FORK
);
break
;
break
;
}
}
...
@@ -3390,7 +3390,7 @@ xfs_iflush_int(
...
@@ -3390,7 +3390,7 @@ xfs_iflush_int(
ip
->
i_ino
,
ip
,
ip
->
i_d
.
di_magic
);
ip
->
i_ino
,
ip
,
ip
->
i_d
.
di_magic
);
goto
corrupt_out
;
goto
corrupt_out
;
}
}
if
((
ip
->
i_d
.
di_mode
&
IFMT
)
==
IFREG
)
{
if
((
ip
->
i_d
.
di_mode
&
S_IFMT
)
==
S_
IFREG
)
{
if
(
XFS_TEST_ERROR
(
if
(
XFS_TEST_ERROR
(
(
ip
->
i_d
.
di_format
!=
XFS_DINODE_FMT_EXTENTS
)
&&
(
ip
->
i_d
.
di_format
!=
XFS_DINODE_FMT_EXTENTS
)
&&
(
ip
->
i_d
.
di_format
!=
XFS_DINODE_FMT_BTREE
),
(
ip
->
i_d
.
di_format
!=
XFS_DINODE_FMT_BTREE
),
...
@@ -3400,7 +3400,7 @@ xfs_iflush_int(
...
@@ -3400,7 +3400,7 @@ xfs_iflush_int(
ip
->
i_ino
,
ip
);
ip
->
i_ino
,
ip
);
goto
corrupt_out
;
goto
corrupt_out
;
}
}
}
else
if
((
ip
->
i_d
.
di_mode
&
IFMT
)
==
IFDIR
)
{
}
else
if
((
ip
->
i_d
.
di_mode
&
S_IFMT
)
==
S_
IFDIR
)
{
if
(
XFS_TEST_ERROR
(
if
(
XFS_TEST_ERROR
(
(
ip
->
i_d
.
di_format
!=
XFS_DINODE_FMT_EXTENTS
)
&&
(
ip
->
i_d
.
di_format
!=
XFS_DINODE_FMT_EXTENTS
)
&&
(
ip
->
i_d
.
di_format
!=
XFS_DINODE_FMT_BTREE
)
&&
(
ip
->
i_d
.
di_format
!=
XFS_DINODE_FMT_BTREE
)
&&
...
@@ -3689,7 +3689,7 @@ xfs_iaccess(
...
@@ -3689,7 +3689,7 @@ xfs_iaccess(
if
((
error
=
_MAC_XFS_IACCESS
(
ip
,
mode
,
cr
)))
if
((
error
=
_MAC_XFS_IACCESS
(
ip
,
mode
,
cr
)))
return
XFS_ERROR
(
error
);
return
XFS_ERROR
(
error
);
if
(
mode
&
IWRITE
)
{
if
(
mode
&
S_IWUSR
)
{
umode_t
imode
=
inode
->
i_mode
;
umode_t
imode
=
inode
->
i_mode
;
if
(
IS_RDONLY
(
inode
)
&&
if
(
IS_RDONLY
(
inode
)
&&
...
@@ -3722,13 +3722,13 @@ xfs_iaccess(
...
@@ -3722,13 +3722,13 @@ xfs_iaccess(
* Read/write DACs are always overridable.
* Read/write DACs are always overridable.
* Executable DACs are overridable if at least one exec bit is set.
* Executable DACs are overridable if at least one exec bit is set.
*/
*/
if
((
orgmode
&
(
IREAD
|
IWRITE
))
||
(
inode
->
i_mode
&
S_IXUGO
))
if
((
orgmode
&
(
S_IRUSR
|
S_IWUSR
))
||
(
inode
->
i_mode
&
S_IXUGO
))
if
(
capable_cred
(
cr
,
CAP_DAC_OVERRIDE
))
if
(
capable_cred
(
cr
,
CAP_DAC_OVERRIDE
))
return
0
;
return
0
;
if
((
orgmode
==
IREAD
)
||
if
((
orgmode
==
S_IRUSR
)
||
(((
ip
->
i_d
.
di_mode
&
IFMT
)
==
IFDIR
)
&&
(((
ip
->
i_d
.
di_mode
&
S_IFMT
)
==
S_
IFDIR
)
&&
(
!
(
orgmode
&
~
(
IWRITE
|
IEXEC
)))))
{
(
!
(
orgmode
&
~
(
S_IWUSR
|
S_IXUSR
)))))
{
if
(
capable_cred
(
cr
,
CAP_DAC_READ_SEARCH
))
if
(
capable_cred
(
cr
,
CAP_DAC_READ_SEARCH
))
return
0
;
return
0
;
#ifdef NOISE
#ifdef NOISE
...
...
fs/xfs/xfs_inode.h
View file @
21ef8d34
...
@@ -438,12 +438,12 @@ xfs_inode_t *xfs_bhvtoi(struct bhv_desc *bhvp);
...
@@ -438,12 +438,12 @@ xfs_inode_t *xfs_bhvtoi(struct bhv_desc *bhvp);
#define XFS_CHASH(mp,blk) ((mp)->m_chash + (((uint)blk) % (mp)->m_chsize))
#define XFS_CHASH(mp,blk) ((mp)->m_chash + (((uint)blk) % (mp)->m_chsize))
/*
/*
* For multiple groups support: if ISGID bit is set in the parent
* For multiple groups support: if
S_
ISGID bit is set in the parent
* directory, group of new file is set to that of the parent, and
* directory, group of new file is set to that of the parent, and
* new subdirectory gets ISGID bit from parent.
* new subdirectory gets
S_
ISGID bit from parent.
*/
*/
#define XFS_INHERIT_GID(pip, vfsp) ((pip) != NULL && \
#define XFS_INHERIT_GID(pip, vfsp) ((pip) != NULL && \
(((vfsp)->vfs_flag & VFS_GRPID) || ((pip)->i_d.di_mode & ISGID)))
(((vfsp)->vfs_flag & VFS_GRPID) || ((pip)->i_d.di_mode &
S_
ISGID)))
/*
/*
* xfs_iget.c prototypes.
* xfs_iget.c prototypes.
...
...
fs/xfs/xfs_log_recover.c
View file @
21ef8d34
...
@@ -2383,7 +2383,7 @@ xlog_recover_do_inode_trans(
...
@@ -2383,7 +2383,7 @@ xlog_recover_do_inode_trans(
/* Take the opportunity to reset the flush iteration count */
/* Take the opportunity to reset the flush iteration count */
dicp
->
di_flushiter
=
0
;
dicp
->
di_flushiter
=
0
;
if
(
unlikely
((
dicp
->
di_mode
&
IFMT
)
==
IFREG
))
{
if
(
unlikely
((
dicp
->
di_mode
&
S_IFMT
)
==
S_
IFREG
))
{
if
((
dicp
->
di_format
!=
XFS_DINODE_FMT_EXTENTS
)
&&
if
((
dicp
->
di_format
!=
XFS_DINODE_FMT_EXTENTS
)
&&
(
dicp
->
di_format
!=
XFS_DINODE_FMT_BTREE
))
{
(
dicp
->
di_format
!=
XFS_DINODE_FMT_BTREE
))
{
XFS_CORRUPTION_ERROR
(
"xlog_recover_do_inode_trans(3)"
,
XFS_CORRUPTION_ERROR
(
"xlog_recover_do_inode_trans(3)"
,
...
@@ -2394,7 +2394,7 @@ xlog_recover_do_inode_trans(
...
@@ -2394,7 +2394,7 @@ xlog_recover_do_inode_trans(
item
,
dip
,
bp
,
ino
);
item
,
dip
,
bp
,
ino
);
return
XFS_ERROR
(
EFSCORRUPTED
);
return
XFS_ERROR
(
EFSCORRUPTED
);
}
}
}
else
if
(
unlikely
((
dicp
->
di_mode
&
IFMT
)
==
IFDIR
))
{
}
else
if
(
unlikely
((
dicp
->
di_mode
&
S_IFMT
)
==
S_
IFDIR
))
{
if
((
dicp
->
di_format
!=
XFS_DINODE_FMT_EXTENTS
)
&&
if
((
dicp
->
di_format
!=
XFS_DINODE_FMT_EXTENTS
)
&&
(
dicp
->
di_format
!=
XFS_DINODE_FMT_BTREE
)
&&
(
dicp
->
di_format
!=
XFS_DINODE_FMT_BTREE
)
&&
(
dicp
->
di_format
!=
XFS_DINODE_FMT_LOCAL
))
{
(
dicp
->
di_format
!=
XFS_DINODE_FMT_LOCAL
))
{
...
...
fs/xfs/xfs_mount.c
View file @
21ef8d34
...
@@ -977,7 +977,7 @@ xfs_mountfs(
...
@@ -977,7 +977,7 @@ xfs_mountfs(
rvp
=
XFS_ITOV
(
rip
);
rvp
=
XFS_ITOV
(
rip
);
VMAP
(
rvp
,
vmap
);
VMAP
(
rvp
,
vmap
);
if
(
unlikely
((
rip
->
i_d
.
di_mode
&
IFMT
)
!=
IFDIR
))
{
if
(
unlikely
((
rip
->
i_d
.
di_mode
&
S_IFMT
)
!=
S_
IFDIR
))
{
cmn_err
(
CE_WARN
,
"XFS: corrupted root inode"
);
cmn_err
(
CE_WARN
,
"XFS: corrupted root inode"
);
prdev
(
"Root inode %llu is not a directory"
,
prdev
(
"Root inode %llu is not a directory"
,
mp
->
m_ddev_targp
,
(
unsigned
long
long
)
rip
->
i_ino
);
mp
->
m_ddev_targp
,
(
unsigned
long
long
)
rip
->
i_ino
);
...
...
fs/xfs/xfs_rename.c
View file @
21ef8d34
...
@@ -326,7 +326,7 @@ xfs_rename(
...
@@ -326,7 +326,7 @@ xfs_rename(
ASSERT
(
src_ip
!=
NULL
);
ASSERT
(
src_ip
!=
NULL
);
if
((
src_ip
->
i_d
.
di_mode
&
IFMT
)
==
IFDIR
)
{
if
((
src_ip
->
i_d
.
di_mode
&
S_IFMT
)
==
S_
IFDIR
)
{
/*
/*
* Check for link count overflow on target_dp
* Check for link count overflow on target_dp
*/
*/
...
@@ -340,7 +340,7 @@ xfs_rename(
...
@@ -340,7 +340,7 @@ xfs_rename(
}
}
new_parent
=
(
src_dp
!=
target_dp
);
new_parent
=
(
src_dp
!=
target_dp
);
src_is_directory
=
((
src_ip
->
i_d
.
di_mode
&
IFMT
)
==
IFDIR
);
src_is_directory
=
((
src_ip
->
i_d
.
di_mode
&
S_IFMT
)
==
S_
IFDIR
);
/*
/*
* Drop the locks on our inodes so that we can do the ancestor
* Drop the locks on our inodes so that we can do the ancestor
...
@@ -449,7 +449,7 @@ xfs_rename(
...
@@ -449,7 +449,7 @@ xfs_rename(
* target and source are directories and that target can be
* target and source are directories and that target can be
* destroyed, or that neither is a directory.
* destroyed, or that neither is a directory.
*/
*/
if
((
target_ip
->
i_d
.
di_mode
&
IFMT
)
==
IFDIR
)
{
if
((
target_ip
->
i_d
.
di_mode
&
S_IFMT
)
==
S_
IFDIR
)
{
/*
/*
* Make sure target dir is empty.
* Make sure target dir is empty.
*/
*/
...
...
fs/xfs/xfs_rw.c
View file @
21ef8d34
...
@@ -86,17 +86,17 @@ xfs_write_clear_setuid(
...
@@ -86,17 +86,17 @@ xfs_write_clear_setuid(
xfs_ilock
(
ip
,
XFS_ILOCK_EXCL
);
xfs_ilock
(
ip
,
XFS_ILOCK_EXCL
);
xfs_trans_ijoin
(
tp
,
ip
,
XFS_ILOCK_EXCL
);
xfs_trans_ijoin
(
tp
,
ip
,
XFS_ILOCK_EXCL
);
xfs_trans_ihold
(
tp
,
ip
);
xfs_trans_ihold
(
tp
,
ip
);
ip
->
i_d
.
di_mode
&=
~
ISUID
;
ip
->
i_d
.
di_mode
&=
~
S_
ISUID
;
/*
/*
* Note that we don't have to worry about mandatory
* Note that we don't have to worry about mandatory
* file locking being disabled here because we only
* file locking being disabled here because we only
* clear the ISGID bit if the Group execute bit is
* clear the
S_
ISGID bit if the Group execute bit is
* on, but if it was on then mandatory locking wouldn't
* on, but if it was on then mandatory locking wouldn't
* have been enabled.
* have been enabled.
*/
*/
if
(
ip
->
i_d
.
di_mode
&
(
IEXEC
>>
3
)
)
{
if
(
ip
->
i_d
.
di_mode
&
S_IXGRP
)
{
ip
->
i_d
.
di_mode
&=
~
ISGID
;
ip
->
i_d
.
di_mode
&=
~
S_
ISGID
;
}
}
xfs_trans_log_inode
(
tp
,
ip
,
XFS_ILOG_CORE
);
xfs_trans_log_inode
(
tp
,
ip
,
XFS_ILOG_CORE
);
xfs_trans_set_sync
(
tp
);
xfs_trans_set_sync
(
tp
);
...
...
fs/xfs/xfs_vnodeops.c
View file @
21ef8d34
...
@@ -470,15 +470,15 @@ xfs_setattr(
...
@@ -470,15 +470,15 @@ xfs_setattr(
if
(
mask
&
XFS_AT_MODE
)
{
if
(
mask
&
XFS_AT_MODE
)
{
mode_t
m
=
0
;
mode_t
m
=
0
;
if
((
vap
->
va_mode
&
ISUID
)
&&
!
file_owner
)
if
((
vap
->
va_mode
&
S_
ISUID
)
&&
!
file_owner
)
m
|=
ISUID
;
m
|=
S_
ISUID
;
if
((
vap
->
va_mode
&
ISGID
)
&&
if
((
vap
->
va_mode
&
S_
ISGID
)
&&
!
in_group_p
((
gid_t
)
ip
->
i_d
.
di_gid
))
!
in_group_p
((
gid_t
)
ip
->
i_d
.
di_gid
))
m
|=
ISGID
;
m
|=
S_
ISGID
;
#if 0
#if 0
/* Linux allows this, Irix doesn't. */
/* Linux allows this, Irix doesn't. */
if ((vap->va_mode & ISVTX) && vp->v_type != VDIR)
if ((vap->va_mode &
S_
ISVTX) && vp->v_type != VDIR)
m |= ISVTX;
m |=
S_
ISVTX;
#endif
#endif
if
(
m
&&
!
capable
(
CAP_FSETID
))
if
(
m
&&
!
capable
(
CAP_FSETID
))
vap
->
va_mode
&=
~
m
;
vap
->
va_mode
&=
~
m
;
...
@@ -755,8 +755,8 @@ xfs_setattr(
...
@@ -755,8 +755,8 @@ xfs_setattr(
* Change file access modes.
* Change file access modes.
*/
*/
if
(
mask
&
XFS_AT_MODE
)
{
if
(
mask
&
XFS_AT_MODE
)
{
ip
->
i_d
.
di_mode
&=
IFMT
;
ip
->
i_d
.
di_mode
&=
S_
IFMT
;
ip
->
i_d
.
di_mode
|=
vap
->
va_mode
&
~
IFMT
;
ip
->
i_d
.
di_mode
|=
vap
->
va_mode
&
~
S_
IFMT
;
xfs_trans_log_inode
(
tp
,
ip
,
XFS_ILOG_CORE
);
xfs_trans_log_inode
(
tp
,
ip
,
XFS_ILOG_CORE
);
timeflags
|=
XFS_ICHGTIME_CHG
;
timeflags
|=
XFS_ICHGTIME_CHG
;
...
@@ -776,9 +776,9 @@ xfs_setattr(
...
@@ -776,9 +776,9 @@ xfs_setattr(
* The set-user-ID and set-group-ID bits of a file will be
* The set-user-ID and set-group-ID bits of a file will be
* cleared upon successful return from chown()
* cleared upon successful return from chown()
*/
*/
if
((
ip
->
i_d
.
di_mode
&
(
ISUID
|
ISGID
))
&&
if
((
ip
->
i_d
.
di_mode
&
(
S_ISUID
|
S_
ISGID
))
&&
!
capable
(
CAP_FSETID
))
{
!
capable
(
CAP_FSETID
))
{
ip
->
i_d
.
di_mode
&=
~
(
ISUID
|
ISGID
);
ip
->
i_d
.
di_mode
&=
~
(
S_ISUID
|
S_
ISGID
);
}
}
/*
/*
...
@@ -1019,7 +1019,7 @@ xfs_readlink(
...
@@ -1019,7 +1019,7 @@ xfs_readlink(
xfs_ilock
(
ip
,
XFS_ILOCK_SHARED
);
xfs_ilock
(
ip
,
XFS_ILOCK_SHARED
);
ASSERT
((
ip
->
i_d
.
di_mode
&
IFMT
)
==
IFLNK
);
ASSERT
((
ip
->
i_d
.
di_mode
&
S_IFMT
)
==
S_
IFLNK
);
offset
=
uiop
->
uio_offset
;
offset
=
uiop
->
uio_offset
;
count
=
uiop
->
uio_resid
;
count
=
uiop
->
uio_resid
;
...
@@ -1662,7 +1662,7 @@ xfs_release(
...
@@ -1662,7 +1662,7 @@ xfs_release(
mp
=
ip
->
i_mount
;
mp
=
ip
->
i_mount
;
if
(
ip
->
i_d
.
di_nlink
!=
0
)
{
if
(
ip
->
i_d
.
di_nlink
!=
0
)
{
if
((((
ip
->
i_d
.
di_mode
&
IFMT
)
==
IFREG
)
&&
if
((((
ip
->
i_d
.
di_mode
&
S_IFMT
)
==
S_
IFREG
)
&&
((
ip
->
i_d
.
di_size
>
0
)
||
(
VN_CACHED
(
vp
)
>
0
))
&&
((
ip
->
i_d
.
di_size
>
0
)
||
(
VN_CACHED
(
vp
)
>
0
))
&&
(
ip
->
i_df
.
if_flags
&
XFS_IFEXTENTS
))
&&
(
ip
->
i_df
.
if_flags
&
XFS_IFEXTENTS
))
&&
(
!
(
ip
->
i_d
.
di_flags
&
(
XFS_DIFLAG_PREALLOC
|
XFS_DIFLAG_APPEND
))))
{
(
!
(
ip
->
i_d
.
di_flags
&
(
XFS_DIFLAG_PREALLOC
|
XFS_DIFLAG_APPEND
))))
{
...
@@ -1723,7 +1723,7 @@ xfs_inactive(
...
@@ -1723,7 +1723,7 @@ xfs_inactive(
*/
*/
truncate
=
((
ip
->
i_d
.
di_nlink
==
0
)
&&
truncate
=
((
ip
->
i_d
.
di_nlink
==
0
)
&&
((
ip
->
i_d
.
di_size
!=
0
)
||
(
ip
->
i_d
.
di_nextents
>
0
))
&&
((
ip
->
i_d
.
di_size
!=
0
)
||
(
ip
->
i_d
.
di_nextents
>
0
))
&&
((
ip
->
i_d
.
di_mode
&
IFMT
)
==
IFREG
));
((
ip
->
i_d
.
di_mode
&
S_IFMT
)
==
S_
IFREG
));
mp
=
ip
->
i_mount
;
mp
=
ip
->
i_mount
;
...
@@ -1739,7 +1739,7 @@ xfs_inactive(
...
@@ -1739,7 +1739,7 @@ xfs_inactive(
goto
out
;
goto
out
;
if
(
ip
->
i_d
.
di_nlink
!=
0
)
{
if
(
ip
->
i_d
.
di_nlink
!=
0
)
{
if
((((
ip
->
i_d
.
di_mode
&
IFMT
)
==
IFREG
)
&&
if
((((
ip
->
i_d
.
di_mode
&
S_IFMT
)
==
S_
IFREG
)
&&
((
ip
->
i_d
.
di_size
>
0
)
||
(
VN_CACHED
(
vp
)
>
0
))
&&
((
ip
->
i_d
.
di_size
>
0
)
||
(
VN_CACHED
(
vp
)
>
0
))
&&
(
ip
->
i_df
.
if_flags
&
XFS_IFEXTENTS
))
&&
(
ip
->
i_df
.
if_flags
&
XFS_IFEXTENTS
))
&&
(
!
(
ip
->
i_d
.
di_flags
&
(
XFS_DIFLAG_PREALLOC
|
XFS_DIFLAG_APPEND
))
||
(
!
(
ip
->
i_d
.
di_flags
&
(
XFS_DIFLAG_PREALLOC
|
XFS_DIFLAG_APPEND
))
||
...
@@ -1802,7 +1802,7 @@ xfs_inactive(
...
@@ -1802,7 +1802,7 @@ xfs_inactive(
xfs_iunlock
(
ip
,
XFS_IOLOCK_EXCL
|
XFS_ILOCK_EXCL
);
xfs_iunlock
(
ip
,
XFS_IOLOCK_EXCL
|
XFS_ILOCK_EXCL
);
return
(
VN_INACTIVE_CACHE
);
return
(
VN_INACTIVE_CACHE
);
}
}
}
else
if
((
ip
->
i_d
.
di_mode
&
IFMT
)
==
IFLNK
)
{
}
else
if
((
ip
->
i_d
.
di_mode
&
S_IFMT
)
==
S_
IFLNK
)
{
/*
/*
* If we get an error while cleaning up a
* If we get an error while cleaning up a
...
@@ -3508,7 +3508,7 @@ xfs_symlink(
...
@@ -3508,7 +3508,7 @@ xfs_symlink(
/*
/*
* Allocate an inode for the symlink.
* Allocate an inode for the symlink.
*/
*/
error
=
xfs_dir_ialloc
(
&
tp
,
dp
,
IFLNK
|
(
vap
->
va_mode
&~
IFMT
),
error
=
xfs_dir_ialloc
(
&
tp
,
dp
,
S_IFLNK
|
(
vap
->
va_mode
&~
S_
IFMT
),
1
,
0
,
credp
,
prid
,
resblks
>
0
,
&
ip
,
NULL
);
1
,
0
,
credp
,
prid
,
resblks
>
0
,
&
ip
,
NULL
);
if
(
error
)
{
if
(
error
)
{
if
(
error
==
ENOSPC
)
if
(
error
==
ENOSPC
)
...
@@ -3891,7 +3891,7 @@ xfs_reclaim(
...
@@ -3891,7 +3891,7 @@ xfs_reclaim(
ASSERT
(
!
VN_MAPPED
(
vp
));
ASSERT
(
!
VN_MAPPED
(
vp
));
ip
=
XFS_BHVTOI
(
bdp
);
ip
=
XFS_BHVTOI
(
bdp
);
if
((
ip
->
i_d
.
di_mode
&
IFMT
)
==
IFREG
)
{
if
((
ip
->
i_d
.
di_mode
&
S_IFMT
)
==
S_
IFREG
)
{
if
(
ip
->
i_d
.
di_size
>
0
)
{
if
(
ip
->
i_d
.
di_size
>
0
)
{
/*
/*
* Flush and invalidate any data left around that is
* Flush and invalidate any data left around that is
...
@@ -4597,7 +4597,7 @@ xfs_change_file_space(
...
@@ -4597,7 +4597,7 @@ xfs_change_file_space(
xfs_ilock
(
ip
,
XFS_ILOCK_SHARED
);
xfs_ilock
(
ip
,
XFS_ILOCK_SHARED
);
if
((
error
=
xfs_iaccess
(
ip
,
IWRITE
,
credp
)))
{
if
((
error
=
xfs_iaccess
(
ip
,
S_IWUSR
,
credp
)))
{
xfs_iunlock
(
ip
,
XFS_ILOCK_SHARED
);
xfs_iunlock
(
ip
,
XFS_ILOCK_SHARED
);
return
error
;
return
error
;
}
}
...
@@ -4704,17 +4704,17 @@ xfs_change_file_space(
...
@@ -4704,17 +4704,17 @@ xfs_change_file_space(
xfs_trans_ijoin
(
tp
,
ip
,
XFS_ILOCK_EXCL
);
xfs_trans_ijoin
(
tp
,
ip
,
XFS_ILOCK_EXCL
);
xfs_trans_ihold
(
tp
,
ip
);
xfs_trans_ihold
(
tp
,
ip
);
ip
->
i_d
.
di_mode
&=
~
ISUID
;
ip
->
i_d
.
di_mode
&=
~
S_
ISUID
;
/*
/*
* Note that we don't have to worry about mandatory
* Note that we don't have to worry about mandatory
* file locking being disabled here because we only
* file locking being disabled here because we only
* clear the ISGID bit if the Group execute bit is
* clear the
S_
ISGID bit if the Group execute bit is
* on, but if it was on then mandatory locking wouldn't
* on, but if it was on then mandatory locking wouldn't
* have been enabled.
* have been enabled.
*/
*/
if
(
ip
->
i_d
.
di_mode
&
(
IEXEC
>>
3
)
)
if
(
ip
->
i_d
.
di_mode
&
S_IXGRP
)
ip
->
i_d
.
di_mode
&=
~
ISGID
;
ip
->
i_d
.
di_mode
&=
~
S_
ISGID
;
xfs_ichgtime
(
ip
,
XFS_ICHGTIME_MOD
|
XFS_ICHGTIME_CHG
);
xfs_ichgtime
(
ip
,
XFS_ICHGTIME_MOD
|
XFS_ICHGTIME_CHG
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment