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
Kirill Smelkov
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(
* setgid binaries.
*/
if
(((
xip
->
i_d
.
di_mode
&
ISUID
)
||
((
xip
->
i_d
.
di_mode
&
(
ISGID
|
(
IEXEC
>>
3
)
))
==
(
ISGID
|
(
IEXEC
>>
3
)
)))
&&
if
(((
xip
->
i_d
.
di_mode
&
S_
ISUID
)
||
((
xip
->
i_d
.
di_mode
&
(
S_ISGID
|
S_IXGRP
))
==
(
S_ISGID
|
S_IXGRP
)))
&&
!
capable
(
CAP_FSETID
))
{
error
=
xfs_write_clear_setuid
(
xip
);
if
(
error
)
{
...
...
@@ -851,7 +851,7 @@ xfs_bmap(bhv_desc_t *bdp,
xfs_inode_t
*
ip
=
XFS_BHVTOI
(
bdp
);
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
)
==
((
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 {
typedef
struct
xfs_param
{
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
* GID */
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(
}
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
)))
{
xfs_trans_cancel
(
tp
,
XFS_TRANS_RELEASE_LOG_RES
|
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,
/*
* 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
);
return
(
XFS_ERROR
(
error
));
}
...
...
@@ -239,7 +239,7 @@ xfs_attr_set(bhv_desc_t *bdp, char *name, char *value, int valuelen, int flags,
return
(
EIO
);
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
);
return
(
XFS_ERROR
(
error
));
}
...
...
@@ -498,7 +498,7 @@ xfs_attr_remove(bhv_desc_t *bdp, char *name, int flags, struct cred *cred)
return
(
EIO
);
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
);
return
(
XFS_ERROR
(
error
));
}
else
if
(
XFS_IFORK_Q
(
dp
)
==
0
||
...
...
@@ -687,7 +687,7 @@ xfs_attr_list(bhv_desc_t *bdp, char *buffer, int bufsize, int flags,
* Do they have permission?
*/
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
);
return
(
XFS_ERROR
(
error
));
}
...
...
fs/xfs/xfs_bmap.c
View file @
21ef8d34
...
...
@@ -521,7 +521,7 @@ xfs_bmap_add_attrfork_local(
if
(
ip
->
i_df
.
if_bytes
<=
XFS_IFORK_DSIZE
(
ip
))
return
0
;
if
((
ip
->
i_d
.
di_mode
&
IFMT
)
==
IFDIR
)
{
if
((
ip
->
i_d
.
di_mode
&
S_IFMT
)
==
S_
IFDIR
)
{
mp
=
ip
->
i_mount
;
memset
(
&
dargs
,
0
,
sizeof
(
dargs
));
dargs
.
dp
=
ip
;
...
...
@@ -3354,7 +3354,7 @@ xfs_bmap_local_to_extents(
* 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.
*/
ASSERT
(
!
((
ip
->
i_d
.
di_mode
&
IFMT
)
==
IFREG
&&
ASSERT
(
!
((
ip
->
i_d
.
di_mode
&
S_IFMT
)
==
S_
IFREG
&&
whichfork
==
XFS_DATA_FORK
));
ifp
=
XFS_IFORK_PTR
(
ip
,
whichfork
);
ASSERT
(
XFS_IFORK_FORMAT
(
ip
,
whichfork
)
==
XFS_DINODE_FMT_LOCAL
);
...
...
fs/xfs/xfs_dfrag.c
View file @
21ef8d34
...
...
@@ -154,12 +154,12 @@ xfs_swapext(
goto
error0
;
}
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
))
{
goto
error0
;
}
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
))
{
goto
error0
;
}
...
...
fs/xfs/xfs_dinode.h
View file @
21ef8d34
...
...
@@ -107,7 +107,7 @@ typedef struct xfs_dinode
xfs_dir_shortform_t
di_dirsf
;
/* shortform directory */
xfs_dir2_sf_t
di_dir2sf
;
/* shortform directory v2 */
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 */
char
di_symlink
[
1
];
/* local symbolic link */
}
di_u
;
...
...
@@ -436,25 +436,6 @@ void xfs_dfork_next_set(xfs_dinode_t *dip, int w, int n);
#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)
xfs_dinode_t
*
xfs_buf_to_dinode
(
struct
xfs_buf
*
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)
{
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
)
return
(
1
);
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)
args
.
dp
=
dir
;
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
)))
return
error
;
...
...
@@ -257,7 +257,7 @@ xfs_dir_createname(xfs_trans_t *trans, xfs_inode_t *dp, char *name,
xfs_da_args_t
args
;
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
)))
return
(
retval
);
...
...
@@ -321,7 +321,7 @@ xfs_dir_canenter(xfs_trans_t *trans, xfs_inode_t *dp, char *name, int namelen)
xfs_da_args_t
args
;
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.
*/
...
...
@@ -366,7 +366,7 @@ xfs_dir_removename(xfs_trans_t *trans, xfs_inode_t *dp, char *name,
xfs_da_args_t
args
;
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
);
/*
* 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,
xfs_da_args_t
args
;
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
);
/*
...
...
@@ -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_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,
...
...
@@ -499,7 +499,7 @@ xfs_dir_replace(xfs_trans_t *trans, xfs_inode_t *dp, char *name, int namelen,
xfs_da_args_t
args
;
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
)))
return
retval
;
...
...
@@ -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
;
}
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(
{
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.
*/
...
...
@@ -183,7 +183,7 @@ xfs_dir2_init(
memset
((
char
*
)
&
args
,
0
,
sizeof
(
args
));
args
.
dp
=
dp
;
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
)))
{
return
error
;
}
...
...
@@ -208,7 +208,7 @@ xfs_dir2_createname(
int
rval
;
/* return 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
)))
{
return
rval
;
}
...
...
@@ -261,7 +261,7 @@ xfs_dir2_lookup(
int
rval
;
/* return 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
);
/*
...
...
@@ -319,7 +319,7 @@ xfs_dir2_removename(
int
rval
;
/* return 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
);
/*
* Fill in the arg structure for this request.
...
...
@@ -369,7 +369,7 @@ xfs_dir2_getdents(
int
rval
;
/* return 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
);
/*
* If our caller has given us a single contiguous aligned memory buffer,
...
...
@@ -422,7 +422,7 @@ xfs_dir2_replace(
int
rval
;
/* return 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
)))
{
return
rval
;
...
...
@@ -473,7 +473,7 @@ xfs_dir2_canenter(
int
rval
;
/* return 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.
*/
...
...
fs/xfs/xfs_inode.c
View file @
21ef8d34
...
...
@@ -487,11 +487,11 @@ xfs_iformat(
return
XFS_ERROR
(
EFSCORRUPTED
);
}
switch
(
ip
->
i_d
.
di_mode
&
IFMT
)
{
case
IFIFO
:
case
IFCHR
:
case
IFBLK
:
case
IFSOCK
:
switch
(
ip
->
i_d
.
di_mode
&
S_
IFMT
)
{
case
S_
IFIFO
:
case
S_
IFCHR
:
case
S_
IFBLK
:
case
S_
IFSOCK
:
if
(
unlikely
(
INT_GET
(
dip
->
di_core
.
di_format
,
ARCH_CONVERT
)
!=
XFS_DINODE_FMT_DEV
))
{
XFS_CORRUPTION_ERROR
(
"xfs_iformat(3)"
,
XFS_ERRLEVEL_LOW
,
ip
->
i_mount
,
dip
);
...
...
@@ -501,15 +501,15 @@ xfs_iformat(
ip
->
i_df
.
if_u2
.
if_rdev
=
INT_GET
(
dip
->
di_u
.
di_dev
,
ARCH_CONVERT
);
break
;
case
IFREG
:
case
IFLNK
:
case
IFDIR
:
case
S_
IFREG
:
case
S_
IFLNK
:
case
S_
IFDIR
:
switch
(
INT_GET
(
dip
->
di_core
.
di_format
,
ARCH_CONVERT
))
{
case
XFS_DINODE_FMT_LOCAL
:
/*
* 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
,
"corrupt inode (local format for regular file) %Lu. Unmount and run xfs_repair."
,
(
unsigned
long
long
)
ip
->
i_ino
);
...
...
@@ -1172,20 +1172,20 @@ xfs_ialloc(
if
(
XFS_INHERIT_GID
(
pip
,
vp
->
v_vfsp
))
{
ip
->
i_d
.
di_gid
=
pip
->
i_d
.
di_gid
;
if
((
pip
->
i_d
.
di_mode
&
ISGID
)
&&
(
mode
&
IFMT
)
==
IFDIR
)
{
ip
->
i_d
.
di_mode
|=
ISGID
;
if
((
pip
->
i_d
.
di_mode
&
S_ISGID
)
&&
(
mode
&
S_IFMT
)
==
S_
IFDIR
)
{
ip
->
i_d
.
di_mode
|=
S_
ISGID
;
}
}
/*
* 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).
*/
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
)))
{
ip
->
i_d
.
di_mode
&=
~
ISGID
;
ip
->
i_d
.
di_mode
&=
~
S_
ISGID
;
}
ip
->
i_d
.
di_size
=
0
;
...
...
@@ -1200,18 +1200,18 @@ xfs_ialloc(
ip
->
i_d
.
di_dmstate
=
0
;
ip
->
i_d
.
di_flags
=
0
;
flags
=
XFS_ILOG_CORE
;
switch
(
mode
&
IFMT
)
{
case
IFIFO
:
case
IFCHR
:
case
IFBLK
:
case
IFSOCK
:
switch
(
mode
&
S_
IFMT
)
{
case
S_
IFIFO
:
case
S_
IFCHR
:
case
S_
IFBLK
:
case
S_
IFSOCK
:
ip
->
i_d
.
di_format
=
XFS_DINODE_FMT_DEV
;
ip
->
i_df
.
if_u2
.
if_rdev
=
rdev
;
ip
->
i_df
.
if_flags
=
0
;
flags
|=
XFS_ILOG_DEV
;
break
;
case
IFREG
:
case
IFDIR
:
case
S_
IFREG
:
case
S_
IFDIR
:
if
(
pip
->
i_d
.
di_flags
&
(
XFS_DIFLAG_NOATIME
|
XFS_DIFLAG_NODUMP
|
XFS_DIFLAG_SYNC
))
{
if
((
pip
->
i_d
.
di_flags
&
XFS_DIFLAG_NOATIME
)
&&
...
...
@@ -1224,7 +1224,7 @@ xfs_ialloc(
xfs_inherit_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_df
.
if_flags
=
XFS_IFEXTENTS
;
ip
->
i_df
.
if_bytes
=
ip
->
i_df
.
if_real_bytes
=
0
;
...
...
@@ -1268,7 +1268,7 @@ xfs_isize_check(
int
nimaps
;
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
;
if
(
ip
->
i_d
.
di_flags
&
XFS_DIFLAG_REALTIME
)
...
...
@@ -2304,7 +2304,7 @@ xfs_ifree(
ASSERT
(
ip
->
i_d
.
di_nextents
==
0
);
ASSERT
(
ip
->
i_d
.
di_anextents
==
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
);
/*
...
...
@@ -2746,10 +2746,10 @@ xfs_idestroy(
xfs_inode_t
*
ip
)
{
switch
(
ip
->
i_d
.
di_mode
&
IFMT
)
{
case
IFREG
:
case
IFDIR
:
case
IFLNK
:
switch
(
ip
->
i_d
.
di_mode
&
S_
IFMT
)
{
case
S_
IFREG
:
case
S_
IFDIR
:
case
S_
IFLNK
:
xfs_idestroy_fork
(
ip
,
XFS_DATA_FORK
);
break
;
}
...
...
@@ -3390,7 +3390,7 @@ xfs_iflush_int(
ip
->
i_ino
,
ip
,
ip
->
i_d
.
di_magic
);
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
(
(
ip
->
i_d
.
di_format
!=
XFS_DINODE_FMT_EXTENTS
)
&&
(
ip
->
i_d
.
di_format
!=
XFS_DINODE_FMT_BTREE
),
...
...
@@ -3400,7 +3400,7 @@ xfs_iflush_int(
ip
->
i_ino
,
ip
);
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
(
(
ip
->
i_d
.
di_format
!=
XFS_DINODE_FMT_EXTENTS
)
&&
(
ip
->
i_d
.
di_format
!=
XFS_DINODE_FMT_BTREE
)
&&
...
...
@@ -3689,7 +3689,7 @@ xfs_iaccess(
if
((
error
=
_MAC_XFS_IACCESS
(
ip
,
mode
,
cr
)))
return
XFS_ERROR
(
error
);
if
(
mode
&
IWRITE
)
{
if
(
mode
&
S_IWUSR
)
{
umode_t
imode
=
inode
->
i_mode
;
if
(
IS_RDONLY
(
inode
)
&&
...
...
@@ -3722,13 +3722,13 @@ xfs_iaccess(
* Read/write DACs are always overridable.
* 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
))
return
0
;
if
((
orgmode
==
IREAD
)
||
(((
ip
->
i_d
.
di_mode
&
IFMT
)
==
IFDIR
)
&&
(
!
(
orgmode
&
~
(
IWRITE
|
IEXEC
)))))
{
if
((
orgmode
==
S_IRUSR
)
||
(((
ip
->
i_d
.
di_mode
&
S_IFMT
)
==
S_
IFDIR
)
&&
(
!
(
orgmode
&
~
(
S_IWUSR
|
S_IXUSR
)))))
{
if
(
capable_cred
(
cr
,
CAP_DAC_READ_SEARCH
))
return
0
;
#ifdef NOISE
...
...
fs/xfs/xfs_inode.h
View file @
21ef8d34
...
...
@@ -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))
/*
* 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
* new subdirectory gets ISGID bit from parent.
* new subdirectory gets
S_
ISGID bit from parent.
*/
#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.
...
...
fs/xfs/xfs_log_recover.c
View file @
21ef8d34
...
...
@@ -2383,7 +2383,7 @@ xlog_recover_do_inode_trans(
/* Take the opportunity to reset the flush iteration count */
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
)
&&
(
dicp
->
di_format
!=
XFS_DINODE_FMT_BTREE
))
{
XFS_CORRUPTION_ERROR
(
"xlog_recover_do_inode_trans(3)"
,
...
...
@@ -2394,7 +2394,7 @@ xlog_recover_do_inode_trans(
item
,
dip
,
bp
,
ino
);
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
)
&&
(
dicp
->
di_format
!=
XFS_DINODE_FMT_BTREE
)
&&
(
dicp
->
di_format
!=
XFS_DINODE_FMT_LOCAL
))
{
...
...
fs/xfs/xfs_mount.c
View file @
21ef8d34
...
...
@@ -977,7 +977,7 @@ xfs_mountfs(
rvp
=
XFS_ITOV
(
rip
);
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"
);
prdev
(
"Root inode %llu is not a directory"
,
mp
->
m_ddev_targp
,
(
unsigned
long
long
)
rip
->
i_ino
);
...
...
fs/xfs/xfs_rename.c
View file @
21ef8d34
...
...
@@ -326,7 +326,7 @@ xfs_rename(
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
*/
...
...
@@ -340,7 +340,7 @@ xfs_rename(
}
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
...
...
@@ -449,7 +449,7 @@ xfs_rename(
* target and source are directories and that target can be
* 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.
*/
...
...
fs/xfs/xfs_rw.c
View file @
21ef8d34
...
...
@@ -86,17 +86,17 @@ xfs_write_clear_setuid(
xfs_ilock
(
ip
,
XFS_ILOCK_EXCL
);
xfs_trans_ijoin
(
tp
,
ip
,
XFS_ILOCK_EXCL
);
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
* 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
* have been enabled.
*/
if
(
ip
->
i_d
.
di_mode
&
(
IEXEC
>>
3
)
)
{
ip
->
i_d
.
di_mode
&=
~
ISGID
;
if
(
ip
->
i_d
.
di_mode
&
S_IXGRP
)
{
ip
->
i_d
.
di_mode
&=
~
S_
ISGID
;
}
xfs_trans_log_inode
(
tp
,
ip
,
XFS_ILOG_CORE
);
xfs_trans_set_sync
(
tp
);
...
...
fs/xfs/xfs_vnodeops.c
View file @
21ef8d34
...
...
@@ -470,15 +470,15 @@ xfs_setattr(
if
(
mask
&
XFS_AT_MODE
)
{
mode_t
m
=
0
;
if
((
vap
->
va_mode
&
ISUID
)
&&
!
file_owner
)
m
|=
ISUID
;
if
((
vap
->
va_mode
&
ISGID
)
&&
if
((
vap
->
va_mode
&
S_
ISUID
)
&&
!
file_owner
)
m
|=
S_
ISUID
;
if
((
vap
->
va_mode
&
S_
ISGID
)
&&
!
in_group_p
((
gid_t
)
ip
->
i_d
.
di_gid
))
m
|=
ISGID
;
m
|=
S_
ISGID
;
#if 0
/* Linux allows this, Irix doesn't. */
if ((vap->va_mode & ISVTX) && vp->v_type != VDIR)
m |= ISVTX;
if ((vap->va_mode &
S_
ISVTX) && vp->v_type != VDIR)
m |=
S_
ISVTX;
#endif
if
(
m
&&
!
capable
(
CAP_FSETID
))
vap
->
va_mode
&=
~
m
;
...
...
@@ -755,8 +755,8 @@ xfs_setattr(
* Change file access modes.
*/
if
(
mask
&
XFS_AT_MODE
)
{
ip
->
i_d
.
di_mode
&=
IFMT
;
ip
->
i_d
.
di_mode
|=
vap
->
va_mode
&
~
IFMT
;
ip
->
i_d
.
di_mode
&=
S_
IFMT
;
ip
->
i_d
.
di_mode
|=
vap
->
va_mode
&
~
S_
IFMT
;
xfs_trans_log_inode
(
tp
,
ip
,
XFS_ILOG_CORE
);
timeflags
|=
XFS_ICHGTIME_CHG
;
...
...
@@ -776,9 +776,9 @@ xfs_setattr(
* The set-user-ID and set-group-ID bits of a file will be
* 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
))
{
ip
->
i_d
.
di_mode
&=
~
(
ISUID
|
ISGID
);
ip
->
i_d
.
di_mode
&=
~
(
S_ISUID
|
S_
ISGID
);
}
/*
...
...
@@ -1019,7 +1019,7 @@ xfs_readlink(
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
;
count
=
uiop
->
uio_resid
;
...
...
@@ -1662,7 +1662,7 @@ xfs_release(
mp
=
ip
->
i_mount
;
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_df
.
if_flags
&
XFS_IFEXTENTS
))
&&
(
!
(
ip
->
i_d
.
di_flags
&
(
XFS_DIFLAG_PREALLOC
|
XFS_DIFLAG_APPEND
))))
{
...
...
@@ -1723,7 +1723,7 @@ xfs_inactive(
*/
truncate
=
((
ip
->
i_d
.
di_nlink
==
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
;
...
...
@@ -1739,7 +1739,7 @@ xfs_inactive(
goto
out
;
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_df
.
if_flags
&
XFS_IFEXTENTS
))
&&
(
!
(
ip
->
i_d
.
di_flags
&
(
XFS_DIFLAG_PREALLOC
|
XFS_DIFLAG_APPEND
))
||
...
...
@@ -1802,7 +1802,7 @@ xfs_inactive(
xfs_iunlock
(
ip
,
XFS_IOLOCK_EXCL
|
XFS_ILOCK_EXCL
);
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
...
...
@@ -3508,7 +3508,7 @@ xfs_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
);
if
(
error
)
{
if
(
error
==
ENOSPC
)
...
...
@@ -3891,7 +3891,7 @@ xfs_reclaim(
ASSERT
(
!
VN_MAPPED
(
vp
));
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
)
{
/*
* Flush and invalidate any data left around that is
...
...
@@ -4597,7 +4597,7 @@ xfs_change_file_space(
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
);
return
error
;
}
...
...
@@ -4704,17 +4704,17 @@ xfs_change_file_space(
xfs_trans_ijoin
(
tp
,
ip
,
XFS_ILOCK_EXCL
);
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
* 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
* have been enabled.
*/
if
(
ip
->
i_d
.
di_mode
&
(
IEXEC
>>
3
)
)
ip
->
i_d
.
di_mode
&=
~
ISGID
;
if
(
ip
->
i_d
.
di_mode
&
S_IXGRP
)
ip
->
i_d
.
di_mode
&=
~
S_
ISGID
;
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