Commit ca8eaf61 authored by Christoph Hellwig's avatar Christoph Hellwig

[XFS] Change AT_* to XFS_AT_* to prevent namespace collisions; move some type

declarations into more appropriate places.

SGI Modid: 2.5.x-xfs:slinx:132930a
parent 2df1a93b
...@@ -280,7 +280,7 @@ linvfs_file_mmap( ...@@ -280,7 +280,7 @@ linvfs_file_mmap(
{ {
struct inode *ip = filp->f_dentry->d_inode; struct inode *ip = filp->f_dentry->d_inode;
vnode_t *vp = LINVFS_GET_VP(ip); vnode_t *vp = LINVFS_GET_VP(ip);
vattr_t va = { .va_mask = AT_UPDATIME }; vattr_t va = { .va_mask = XFS_AT_UPDATIME };
int error; int error;
if ((vp->v_type == VREG) && (vp->v_vfsp->vfs_flag & VFS_DMI)) { if ((vp->v_type == VREG) && (vp->v_vfsp->vfs_flag & VFS_DMI)) {
...@@ -291,7 +291,7 @@ linvfs_file_mmap( ...@@ -291,7 +291,7 @@ linvfs_file_mmap(
vma->vm_ops = &linvfs_file_vm_ops; vma->vm_ops = &linvfs_file_vm_ops;
VOP_SETATTR(vp, &va, AT_UPDATIME, NULL, error); VOP_SETATTR(vp, &va, XFS_AT_UPDATIME, NULL, error);
UPDATE_ATIME(ip); UPDATE_ATIME(ip);
return 0; return 0;
} }
......
...@@ -945,7 +945,7 @@ int xfs_ioc_xattr( ...@@ -945,7 +945,7 @@ int xfs_ioc_xattr(
switch (cmd) { switch (cmd) {
case XFS_IOC_FSGETXATTR: { case XFS_IOC_FSGETXATTR: {
va.va_mask = AT_XFLAGS|AT_EXTSIZE|AT_NEXTENTS; va.va_mask = XFS_AT_XFLAGS|XFS_AT_EXTSIZE|XFS_AT_NEXTENTS;
VOP_GETATTR(vp, &va, 0, NULL, error); VOP_GETATTR(vp, &va, 0, NULL, error);
if (error) if (error)
return -error; return -error;
...@@ -965,7 +965,7 @@ int xfs_ioc_xattr( ...@@ -965,7 +965,7 @@ int xfs_ioc_xattr(
if (copy_from_user(&fa, (struct fsxattr *)arg, sizeof(fa))) if (copy_from_user(&fa, (struct fsxattr *)arg, sizeof(fa)))
return -XFS_ERROR(EFAULT); return -XFS_ERROR(EFAULT);
va.va_mask = AT_XFLAGS | AT_EXTSIZE; va.va_mask = XFS_AT_XFLAGS | XFS_AT_EXTSIZE;
va.va_xflags = fa.fsx_xflags; va.va_xflags = fa.fsx_xflags;
va.va_extsize = fa.fsx_extsize; va.va_extsize = fa.fsx_extsize;
...@@ -978,7 +978,7 @@ int xfs_ioc_xattr( ...@@ -978,7 +978,7 @@ int xfs_ioc_xattr(
case XFS_IOC_FSGETXATTRA: { case XFS_IOC_FSGETXATTRA: {
va.va_mask = AT_XFLAGS|AT_EXTSIZE|AT_ANEXTENTS; va.va_mask = XFS_AT_XFLAGS|XFS_AT_EXTSIZE|XFS_AT_ANEXTENTS;
VOP_GETATTR(vp, &va, 0, NULL, error); VOP_GETATTR(vp, &va, 0, NULL, error);
if (error) if (error)
return -error; return -error;
......
...@@ -45,7 +45,7 @@ validate_fields( ...@@ -45,7 +45,7 @@ validate_fields(
vattr_t va; vattr_t va;
int error; int error;
va.va_mask = AT_NLINK|AT_SIZE; va.va_mask = XFS_AT_NLINK|XFS_AT_SIZE;
VOP_GETATTR(vp, &va, ATTR_LAZY, NULL, error); VOP_GETATTR(vp, &va, ATTR_LAZY, NULL, error);
ip->i_nlink = va.va_nlink; ip->i_nlink = va.va_nlink;
ip->i_size = va.va_size; ip->i_size = va.va_size;
...@@ -85,14 +85,14 @@ linvfs_mknod( ...@@ -85,14 +85,14 @@ linvfs_mknod(
mode &= ~current->fs->umask; mode &= ~current->fs->umask;
memset(&va, 0, sizeof(va)); memset(&va, 0, sizeof(va));
va.va_mask = AT_TYPE|AT_MODE; va.va_mask = XFS_AT_TYPE|XFS_AT_MODE;
va.va_type = IFTOVT(mode); va.va_type = IFTOVT(mode);
va.va_mode = mode; va.va_mode = mode;
switch (mode & S_IFMT) { switch (mode & S_IFMT) {
case S_IFCHR: case S_IFBLK: case S_IFIFO: case S_IFSOCK: case S_IFCHR: case S_IFBLK: case S_IFIFO: case S_IFSOCK:
va.va_rdev = XFS_MKDEV(MAJOR(rdev), MINOR(rdev)); va.va_rdev = XFS_MKDEV(MAJOR(rdev), MINOR(rdev));
va.va_mask |= AT_RDEV; va.va_mask |= XFS_AT_RDEV;
/*FALLTHROUGH*/ /*FALLTHROUGH*/
case S_IFREG: case S_IFREG:
VOP_CREATE(dvp, dentry, &va, &vp, NULL, error); VOP_CREATE(dvp, dentry, &va, &vp, NULL, error);
...@@ -255,7 +255,7 @@ linvfs_symlink( ...@@ -255,7 +255,7 @@ linvfs_symlink(
memset(&va, 0, sizeof(va)); memset(&va, 0, sizeof(va));
va.va_type = VLNK; va.va_type = VLNK;
va.va_mode = irix_symlink_mode ? 0777 & ~current->fs->umask : S_IRWXUGO; va.va_mode = irix_symlink_mode ? 0777 & ~current->fs->umask : S_IRWXUGO;
va.va_mask = AT_TYPE|AT_MODE; va.va_mask = XFS_AT_TYPE|XFS_AT_MODE;
error = 0; error = 0;
VOP_SYMLINK(dvp, dentry, &va, (char *)symname, &cvp, NULL, error); VOP_SYMLINK(dvp, dentry, &va, (char *)symname, &cvp, NULL, error);
...@@ -462,31 +462,31 @@ linvfs_setattr( ...@@ -462,31 +462,31 @@ linvfs_setattr(
memset(&vattr, 0, sizeof(vattr_t)); memset(&vattr, 0, sizeof(vattr_t));
if (ia_valid & ATTR_UID) { if (ia_valid & ATTR_UID) {
vattr.va_mask |= AT_UID; vattr.va_mask |= XFS_AT_UID;
vattr.va_uid = attr->ia_uid; vattr.va_uid = attr->ia_uid;
} }
if (ia_valid & ATTR_GID) { if (ia_valid & ATTR_GID) {
vattr.va_mask |= AT_GID; vattr.va_mask |= XFS_AT_GID;
vattr.va_gid = attr->ia_gid; vattr.va_gid = attr->ia_gid;
} }
if (ia_valid & ATTR_SIZE) { if (ia_valid & ATTR_SIZE) {
vattr.va_mask |= AT_SIZE; vattr.va_mask |= XFS_AT_SIZE;
vattr.va_size = attr->ia_size; vattr.va_size = attr->ia_size;
} }
if (ia_valid & ATTR_ATIME) { if (ia_valid & ATTR_ATIME) {
vattr.va_mask |= AT_ATIME; vattr.va_mask |= XFS_AT_ATIME;
vattr.va_atime = attr->ia_atime; vattr.va_atime = attr->ia_atime;
} }
if (ia_valid & ATTR_MTIME) { if (ia_valid & ATTR_MTIME) {
vattr.va_mask |= AT_MTIME; vattr.va_mask |= XFS_AT_MTIME;
vattr.va_mtime = attr->ia_mtime; vattr.va_mtime = attr->ia_mtime;
} }
if (ia_valid & ATTR_CTIME) { if (ia_valid & ATTR_CTIME) {
vattr.va_mask |= AT_CTIME; vattr.va_mask |= XFS_AT_CTIME;
vattr.va_ctime = attr->ia_ctime; vattr.va_ctime = attr->ia_ctime;
} }
if (ia_valid & ATTR_MODE) { if (ia_valid & ATTR_MODE) {
vattr.va_mask |= AT_MODE; vattr.va_mask |= XFS_AT_MODE;
vattr.va_mode = attr->ia_mode; vattr.va_mode = attr->ia_mode;
if (!in_group_p(inode->i_gid) && !capable(CAP_FSETID)) if (!in_group_p(inode->i_gid) && !capable(CAP_FSETID))
inode->i_mode &= ~S_ISGID; inode->i_mode &= ~S_ISGID;
......
...@@ -72,18 +72,6 @@ ...@@ -72,18 +72,6 @@
#define irix_sgid_inherit xfs_params.sgid_inherit #define irix_sgid_inherit xfs_params.sgid_inherit
#define irix_symlink_mode xfs_params.symlink_mode #define irix_symlink_mode xfs_params.symlink_mode
typedef struct xfs_dirent { /* data from readdir() */
xfs_ino_t d_ino; /* inode number of entry */
xfs_off_t d_off; /* offset of disk directory entry */
unsigned short d_reclen; /* length of this record */
char d_name[1]; /* name of file */
} xfs_dirent_t;
#define DIRENTBASESIZE (((xfs_dirent_t *)0)->d_name - (char *)0)
#define DIRENTSIZE(namelen) \
((DIRENTBASESIZE + (namelen) + \
sizeof(xfs_off_t)) & ~(sizeof(xfs_off_t) - 1))
#define NBPP PAGE_SIZE #define NBPP PAGE_SIZE
#define DPPSHFT (PAGE_SHIFT - 9) #define DPPSHFT (PAGE_SHIFT - 9)
#define NDPP (1 << (PAGE_SHIFT - 9)) #define NDPP (1 << (PAGE_SHIFT - 9))
......
...@@ -32,15 +32,128 @@ ...@@ -32,15 +32,128 @@
#ifndef __XFS_STATS_H__ #ifndef __XFS_STATS_H__
#define __XFS_STATS_H__ #define __XFS_STATS_H__
#if defined(CONFIG_PROC_FS) && !defined(XFS_STATS_OFF)
/* /*
* procfs interface * XFS global statistics
*/ */
#ifdef CONFIG_PROC_FS struct xfsstats {
# define XFSSTAT_END_EXTENT_ALLOC 4
__uint32_t xs_allocx;
__uint32_t xs_allocb;
__uint32_t xs_freex;
__uint32_t xs_freeb;
# define XFSSTAT_END_ALLOC_BTREE (XFSSTAT_END_EXTENT_ALLOC+4)
__uint32_t xs_abt_lookup;
__uint32_t xs_abt_compare;
__uint32_t xs_abt_insrec;
__uint32_t xs_abt_delrec;
# define XFSSTAT_END_BLOCK_MAPPING (XFSSTAT_END_ALLOC_BTREE+7)
__uint32_t xs_blk_mapr;
__uint32_t xs_blk_mapw;
__uint32_t xs_blk_unmap;
__uint32_t xs_add_exlist;
__uint32_t xs_del_exlist;
__uint32_t xs_look_exlist;
__uint32_t xs_cmp_exlist;
# define XFSSTAT_END_BLOCK_MAP_BTREE (XFSSTAT_END_BLOCK_MAPPING+4)
__uint32_t xs_bmbt_lookup;
__uint32_t xs_bmbt_compare;
__uint32_t xs_bmbt_insrec;
__uint32_t xs_bmbt_delrec;
# define XFSSTAT_END_DIRECTORY_OPS (XFSSTAT_END_BLOCK_MAP_BTREE+4)
__uint32_t xs_dir_lookup;
__uint32_t xs_dir_create;
__uint32_t xs_dir_remove;
__uint32_t xs_dir_getdents;
# define XFSSTAT_END_TRANSACTIONS (XFSSTAT_END_DIRECTORY_OPS+3)
__uint32_t xs_trans_sync;
__uint32_t xs_trans_async;
__uint32_t xs_trans_empty;
# define XFSSTAT_END_INODE_OPS (XFSSTAT_END_TRANSACTIONS+7)
__uint32_t xs_ig_attempts;
__uint32_t xs_ig_found;
__uint32_t xs_ig_frecycle;
__uint32_t xs_ig_missed;
__uint32_t xs_ig_dup;
__uint32_t xs_ig_reclaims;
__uint32_t xs_ig_attrchg;
# define XFSSTAT_END_LOG_OPS (XFSSTAT_END_INODE_OPS+5)
__uint32_t xs_log_writes;
__uint32_t xs_log_blocks;
__uint32_t xs_log_noiclogs;
__uint32_t xs_log_force;
__uint32_t xs_log_force_sleep;
# define XFSSTAT_END_TAIL_PUSHING (XFSSTAT_END_LOG_OPS+10)
__uint32_t xs_try_logspace;
__uint32_t xs_sleep_logspace;
__uint32_t xs_push_ail;
__uint32_t xs_push_ail_success;
__uint32_t xs_push_ail_pushbuf;
__uint32_t xs_push_ail_pinned;
__uint32_t xs_push_ail_locked;
__uint32_t xs_push_ail_flushing;
__uint32_t xs_push_ail_restarts;
__uint32_t xs_push_ail_flush;
# define XFSSTAT_END_WRITE_CONVERT (XFSSTAT_END_TAIL_PUSHING+2)
__uint32_t xs_xstrat_quick;
__uint32_t xs_xstrat_split;
# define XFSSTAT_END_READ_WRITE_OPS (XFSSTAT_END_WRITE_CONVERT+2)
__uint32_t xs_write_calls;
__uint32_t xs_read_calls;
# define XFSSTAT_END_ATTRIBUTE_OPS (XFSSTAT_END_READ_WRITE_OPS+4)
__uint32_t xs_attr_get;
__uint32_t xs_attr_set;
__uint32_t xs_attr_remove;
__uint32_t xs_attr_list;
# define XFSSTAT_END_QUOTA_OPS (XFSSTAT_END_ATTRIBUTE_OPS+8)
__uint32_t xs_qm_dqreclaims;
__uint32_t xs_qm_dqreclaim_misses;
__uint32_t xs_qm_dquot_dups;
__uint32_t xs_qm_dqcachemisses;
__uint32_t xs_qm_dqcachehits;
__uint32_t xs_qm_dqwants;
__uint32_t xs_qm_dqshake_reclaims;
__uint32_t xs_qm_dqinact_reclaims;
# define XFSSTAT_END_INODE_CLUSTER (XFSSTAT_END_QUOTA_OPS+3)
__uint32_t xs_iflush_count;
__uint32_t xs_icluster_flushcnt;
__uint32_t xs_icluster_flushinode;
# define XFSSTAT_END_VNODE_OPS (XFSSTAT_END_INODE_CLUSTER+8)
__uint32_t vn_active; /* # vnodes not on free lists */
__uint32_t vn_alloc; /* # times vn_alloc called */
__uint32_t vn_get; /* # times vn_get called */
__uint32_t vn_hold; /* # times vn_hold called */
__uint32_t vn_rele; /* # times vn_rele called */
__uint32_t vn_reclaim; /* # times vn_reclaim called */
__uint32_t vn_remove; /* # times vn_remove called */
__uint32_t vn_free; /* # times vn_free called */
/* Extra precision counters */
__uint64_t xs_xstrat_bytes;
__uint64_t xs_write_bytes;
__uint64_t xs_read_bytes;
};
extern struct xfsstats xfsstats;
# define XFS_STATS_INC(count) ( (count)++ )
# define XFS_STATS_DEC(count) ( (count)-- )
# define XFS_STATS_ADD(count, inc) ( (count) += (inc) )
extern void xfs_init_procfs(void); extern void xfs_init_procfs(void);
extern void xfs_cleanup_procfs(void); extern void xfs_cleanup_procfs(void);
#else
#else /* !CONFIG_PROC_FS */
# define XFS_STATS_INC(count)
# define XFS_STATS_DEC(count)
# define XFS_STATS_ADD(count, inc)
static __inline void xfs_init_procfs(void) { }; static __inline void xfs_init_procfs(void) { };
static __inline void xfs_cleanup_procfs(void) { }; static __inline void xfs_cleanup_procfs(void) { };
#endif
#endif /* !CONFIG_PROC_FS */
#endif /* __XFS_STATS_H__ */ #endif /* __XFS_STATS_H__ */
...@@ -200,7 +200,7 @@ vn_revalidate(struct vnode *vp) ...@@ -200,7 +200,7 @@ vn_revalidate(struct vnode *vp)
vn_trace_entry(vp, "vn_revalidate", (inst_t *)__return_address); vn_trace_entry(vp, "vn_revalidate", (inst_t *)__return_address);
va.va_mask = AT_STAT|AT_GENCOUNT; va.va_mask = XFS_AT_STAT|XFS_AT_GENCOUNT;
ASSERT(vp->v_bh.bh_first != NULL); ASSERT(vp->v_bh.bh_first != NULL);
......
...@@ -541,53 +541,55 @@ typedef struct vattr { ...@@ -541,53 +541,55 @@ typedef struct vattr {
/* /*
* setattr or getattr attributes * setattr or getattr attributes
*/ */
#define AT_TYPE 0x00000001 #define XFS_AT_TYPE 0x00000001
#define AT_MODE 0x00000002 #define XFS_AT_MODE 0x00000002
#define AT_UID 0x00000004 #define XFS_AT_UID 0x00000004
#define AT_GID 0x00000008 #define XFS_AT_GID 0x00000008
#define AT_FSID 0x00000010 #define XFS_AT_FSID 0x00000010
#define AT_NODEID 0x00000020 #define XFS_AT_NODEID 0x00000020
#define AT_NLINK 0x00000040 #define XFS_AT_NLINK 0x00000040
#define AT_SIZE 0x00000080 #define XFS_AT_SIZE 0x00000080
#define AT_ATIME 0x00000100 #define XFS_AT_ATIME 0x00000100
#define AT_MTIME 0x00000200 #define XFS_AT_MTIME 0x00000200
#define AT_CTIME 0x00000400 #define XFS_AT_CTIME 0x00000400
#define AT_RDEV 0x00000800 #define XFS_AT_RDEV 0x00000800
#define AT_BLKSIZE 0x00001000 #define XFS_AT_BLKSIZE 0x00001000
#define AT_NBLOCKS 0x00002000 #define XFS_AT_NBLOCKS 0x00002000
#define AT_VCODE 0x00004000 #define XFS_AT_VCODE 0x00004000
#define AT_MAC 0x00008000 #define XFS_AT_MAC 0x00008000
#define AT_UPDATIME 0x00010000 #define XFS_AT_UPDATIME 0x00010000
#define AT_UPDMTIME 0x00020000 #define XFS_AT_UPDMTIME 0x00020000
#define AT_UPDCTIME 0x00040000 #define XFS_AT_UPDCTIME 0x00040000
#define AT_ACL 0x00080000 #define XFS_AT_ACL 0x00080000
#define AT_CAP 0x00100000 #define XFS_AT_CAP 0x00100000
#define AT_INF 0x00200000 #define XFS_AT_INF 0x00200000
#define AT_XFLAGS 0x00400000 #define XFS_AT_XFLAGS 0x00400000
#define AT_EXTSIZE 0x00800000 #define XFS_AT_EXTSIZE 0x00800000
#define AT_NEXTENTS 0x01000000 #define XFS_AT_NEXTENTS 0x01000000
#define AT_ANEXTENTS 0x02000000 #define XFS_AT_ANEXTENTS 0x02000000
#define AT_PROJID 0x04000000 #define XFS_AT_PROJID 0x04000000
#define AT_SIZE_NOPERM 0x08000000 #define XFS_AT_SIZE_NOPERM 0x08000000
#define AT_GENCOUNT 0x10000000 #define XFS_AT_GENCOUNT 0x10000000
#define AT_ALL (AT_TYPE|AT_MODE|AT_UID|AT_GID|AT_FSID|AT_NODEID|\ #define XFS_AT_ALL (XFS_AT_TYPE|XFS_AT_MODE|XFS_AT_UID|XFS_AT_GID|\
AT_NLINK|AT_SIZE|AT_ATIME|AT_MTIME|AT_CTIME|AT_RDEV|\ XFS_AT_FSID|XFS_AT_NODEID|XFS_AT_NLINK|XFS_AT_SIZE|\
AT_BLKSIZE|AT_NBLOCKS|AT_VCODE|AT_MAC|AT_ACL|AT_CAP|\ XFS_AT_ATIME|XFS_AT_MTIME|XFS_AT_CTIME|XFS_AT_RDEV|\
AT_INF|AT_XFLAGS|AT_EXTSIZE|AT_NEXTENTS|AT_ANEXTENTS|\ XFS_AT_BLKSIZE|XFS_AT_NBLOCKS|XFS_AT_VCODE|XFS_AT_MAC|\
AT_PROJID|AT_GENCOUNT) XFS_AT_ACL|XFS_AT_CAP|XFS_AT_INF|XFS_AT_XFLAGS|XFS_AT_EXTSIZE|\
XFS_AT_NEXTENTS|XFS_AT_ANEXTENTS|XFS_AT_PROJID|XFS_AT_GENCOUNT)
#define AT_STAT (AT_TYPE|AT_MODE|AT_UID|AT_GID|AT_FSID|AT_NODEID|AT_NLINK|\
AT_SIZE|AT_ATIME|AT_MTIME|AT_CTIME|AT_RDEV|AT_BLKSIZE|\ #define XFS_AT_STAT (XFS_AT_TYPE|XFS_AT_MODE|XFS_AT_UID|XFS_AT_GID|\
AT_NBLOCKS|AT_PROJID) XFS_AT_FSID|XFS_AT_NODEID|XFS_AT_NLINK|XFS_AT_SIZE|\
XFS_AT_ATIME|XFS_AT_MTIME|XFS_AT_CTIME|XFS_AT_RDEV|\
#define AT_TIMES (AT_ATIME|AT_MTIME|AT_CTIME) XFS_AT_BLKSIZE|XFS_AT_NBLOCKS|XFS_AT_PROJID)
#define AT_UPDTIMES (AT_UPDATIME|AT_UPDMTIME|AT_UPDCTIME) #define XFS_AT_TIMES (XFS_AT_ATIME|XFS_AT_MTIME|XFS_AT_CTIME)
#define AT_NOSET (AT_NLINK|AT_RDEV|AT_FSID|AT_NODEID|AT_TYPE|\ #define XFS_AT_UPDTIMES (XFS_AT_UPDATIME|XFS_AT_UPDMTIME|XFS_AT_UPDCTIME)
AT_BLKSIZE|AT_NBLOCKS|AT_VCODE|AT_NEXTENTS|AT_ANEXTENTS|\
AT_GENCOUNT) #define XFS_AT_NOSET (XFS_AT_NLINK|XFS_AT_RDEV|XFS_AT_FSID|XFS_AT_NODEID|\
XFS_AT_TYPE|XFS_AT_BLKSIZE|XFS_AT_NBLOCKS|XFS_AT_VCODE|\
XFS_AT_NEXTENTS|XFS_AT_ANEXTENTS|XFS_AT_GENCOUNT)
#define VREAD 00400 #define VREAD 00400
#define VWRITE 00200 #define VWRITE 00200
......
...@@ -35,6 +35,8 @@ ...@@ -35,6 +35,8 @@
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/time.h> #include <linux/time.h>
typedef struct timespec timespec_t;
static inline void delay(long ticks) static inline void delay(long ticks)
{ {
current->state = TASK_UNINTERRUPTIBLE; current->state = TASK_UNINTERRUPTIBLE;
......
...@@ -112,7 +112,7 @@ uuid_create_nil(uuid_t *uuid) ...@@ -112,7 +112,7 @@ uuid_create_nil(uuid_t *uuid)
memset(uuid, 0, sizeof(*uuid)); memset(uuid, 0, sizeof(*uuid));
} }
int boolean_t
uuid_is_nil(uuid_t *uuid) uuid_is_nil(uuid_t *uuid)
{ {
int i; int i;
...@@ -126,7 +126,7 @@ uuid_is_nil(uuid_t *uuid) ...@@ -126,7 +126,7 @@ uuid_is_nil(uuid_t *uuid)
return B_TRUE; /* is nil */ return B_TRUE; /* is nil */
} }
int boolean_t
uuid_equal(uuid_t *uuid1, uuid_t *uuid2) uuid_equal(uuid_t *uuid1, uuid_t *uuid2)
{ {
return memcmp(uuid1, uuid2, sizeof(uuid_t)) ? B_FALSE : B_TRUE; return memcmp(uuid1, uuid2, sizeof(uuid_t)) ? B_FALSE : B_TRUE;
......
...@@ -32,9 +32,18 @@ ...@@ -32,9 +32,18 @@
#ifndef __XFS_SUPPORT_UUID_H__ #ifndef __XFS_SUPPORT_UUID_H__
#define __XFS_SUPPORT_UUID_H__ #define __XFS_SUPPORT_UUID_H__
typedef enum {
B_FALSE,
B_TRUE
} boolean_t;
typedef struct {
unsigned char __u_bits[16];
} uuid_t;
void uuid_create_nil(uuid_t *uuid); void uuid_create_nil(uuid_t *uuid);
int uuid_is_nil(uuid_t *uuid); boolean_t uuid_is_nil(uuid_t *uuid);
int uuid_equal(uuid_t *uuid1, uuid_t *uuid2); boolean_t uuid_equal(uuid_t *uuid1, uuid_t *uuid2);
void uuid_getnodeuniq(uuid_t *uuid, int fsid [2]); void uuid_getnodeuniq(uuid_t *uuid, int fsid [2]);
__uint64_t uuid_hash64(uuid_t *uuid); __uint64_t uuid_hash64(uuid_t *uuid);
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#define __XFS_H__ #define __XFS_H__
#include <linux/config.h> #include <linux/config.h>
#include <linux/types.h>
#include <xfs_types.h> #include <xfs_types.h>
#include <xfs_arch.h> #include <xfs_arch.h>
......
...@@ -235,7 +235,7 @@ xfs_acl_vget( ...@@ -235,7 +235,7 @@ xfs_acl_vget(
if (kind == _ACL_TYPE_ACCESS) { if (kind == _ACL_TYPE_ACCESS) {
vattr_t va; vattr_t va;
va.va_mask = AT_MODE; va.va_mask = XFS_AT_MODE;
VOP_GETATTR(vp, &va, 0, sys_cred, error); VOP_GETATTR(vp, &va, 0, sys_cred, error);
if (error) if (error)
goto out; goto out;
...@@ -372,7 +372,7 @@ xfs_acl_allow_set( ...@@ -372,7 +372,7 @@ xfs_acl_allow_set(
return EROFS; return EROFS;
if ((error = _MAC_VACCESS(vp, NULL, VWRITE))) if ((error = _MAC_VACCESS(vp, NULL, VWRITE)))
return error; return error;
va.va_mask = AT_UID; va.va_mask = XFS_AT_UID;
VOP_GETATTR(vp, &va, 0, NULL, error); VOP_GETATTR(vp, &va, 0, NULL, error);
if (error) if (error)
return error; return error;
...@@ -702,7 +702,7 @@ xfs_acl_vtoacl( ...@@ -702,7 +702,7 @@ xfs_acl_vtoacl(
xfs_acl_get_attr(vp, access_acl, _ACL_TYPE_ACCESS, 0, &error); xfs_acl_get_attr(vp, access_acl, _ACL_TYPE_ACCESS, 0, &error);
if (!error) { if (!error) {
/* Got the ACL, need the mode... */ /* Got the ACL, need the mode... */
va.va_mask = AT_MODE; va.va_mask = XFS_AT_MODE;
VOP_GETATTR(vp, &va, 0, sys_cred, error); VOP_GETATTR(vp, &va, 0, sys_cred, error);
} }
...@@ -800,12 +800,12 @@ xfs_acl_setmode( ...@@ -800,12 +800,12 @@ xfs_acl_setmode(
* Copy the u::, g::, o::, and m:: bits from the ACL into the * Copy the u::, g::, o::, and m:: bits from the ACL into the
* mode. The m:: bits take precedence over the g:: bits. * mode. The m:: bits take precedence over the g:: bits.
*/ */
va.va_mask = AT_MODE; va.va_mask = XFS_AT_MODE;
VOP_GETATTR(vp, &va, 0, sys_cred, error); VOP_GETATTR(vp, &va, 0, sys_cred, error);
if (error) if (error)
return error; return error;
va.va_mask = AT_MODE; va.va_mask = XFS_AT_MODE;
va.va_mode &= ~(S_IRWXU|S_IRWXG|S_IRWXO); va.va_mode &= ~(S_IRWXU|S_IRWXG|S_IRWXO);
ap = acl->acl_entry; ap = acl->acl_entry;
for (i = 0; i < acl->acl_cnt; ++i) { for (i = 0; i < acl->acl_cnt; ++i) {
......
...@@ -192,7 +192,7 @@ xfs_cap_allow_set( ...@@ -192,7 +192,7 @@ xfs_cap_allow_set(
return EROFS; return EROFS;
if ((error = _MAC_VACCESS(vp, NULL, VWRITE))) if ((error = _MAC_VACCESS(vp, NULL, VWRITE)))
return error; return error;
va.va_mask = AT_UID; va.va_mask = XFS_AT_UID;
VOP_GETATTR(vp, &va, 0, NULL, error); VOP_GETATTR(vp, &va, 0, NULL, error);
if (error) if (error)
return error; return error;
......
...@@ -30,12 +30,8 @@ ...@@ -30,12 +30,8 @@
* *
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/ */
#ifndef _LINUX_XFS_FS_H #ifndef __XFS_FS_H__
#define _LINUX_XFS_FS_H #define __XFS_FS_H__
#include <linux/types.h>
#include <asm/ioctl.h>
/* /*
* SGI's XFS filesystem's major stuff (constants, structures) * SGI's XFS filesystem's major stuff (constants, structures)
...@@ -394,11 +390,13 @@ typedef struct { ...@@ -394,11 +390,13 @@ typedef struct {
* This is typically called by a stateless file server in order to generate * This is typically called by a stateless file server in order to generate
* "file handles". * "file handles".
*/ */
#ifndef MAXFIDSZ
#define MAXFIDSZ 46 #define MAXFIDSZ 46
typedef struct fid { typedef struct fid {
__u16 fid_len; /* length of data in bytes */ __u16 fid_len; /* length of data in bytes */
unsigned char fid_data[MAXFIDSZ]; /* data (variable length) */ unsigned char fid_data[MAXFIDSZ]; /* data (variable length) */
} fid_t; } fid_t;
#endif
typedef struct xfs_fid { typedef struct xfs_fid {
__u16 xfs_fid_len; /* length of remainder */ __u16 xfs_fid_len; /* length of remainder */
...@@ -499,4 +497,4 @@ typedef struct xfs_handle { ...@@ -499,4 +497,4 @@ typedef struct xfs_handle {
#define BTOBBT(bytes) ((__u64)(bytes) >> BBSHIFT) #define BTOBBT(bytes) ((__u64)(bytes) >> BBSHIFT)
#define BBTOB(bbs) ((bbs) << BBSHIFT) #define BBTOB(bbs) ((bbs) << BBSHIFT)
#endif /* _LINUX_XFS_FS_H */ #endif /* __XFS_FS_H__ */
...@@ -34,8 +34,6 @@ ...@@ -34,8 +34,6 @@
#ifdef __KERNEL__ #ifdef __KERNEL__
#include <linux/types.h>
/* /*
* POSIX Extensions * POSIX Extensions
*/ */
...@@ -56,9 +54,6 @@ typedef unsigned int __uint32_t; ...@@ -56,9 +54,6 @@ typedef unsigned int __uint32_t;
typedef signed long long int __int64_t; typedef signed long long int __int64_t;
typedef unsigned long long int __uint64_t; typedef unsigned long long int __uint64_t;
typedef enum { B_FALSE, B_TRUE } boolean_t;
typedef __int64_t prid_t; /* project ID */ typedef __int64_t prid_t; /* project ID */
typedef __uint32_t inst_t; /* an instruction */ typedef __uint32_t inst_t; /* an instruction */
...@@ -68,11 +63,17 @@ typedef __s64 xfs_daddr_t; /* <disk address> type */ ...@@ -68,11 +63,17 @@ typedef __s64 xfs_daddr_t; /* <disk address> type */
typedef char * xfs_caddr_t; /* <core address> type */ typedef char * xfs_caddr_t; /* <core address> type */
typedef __u32 xfs_dev_t; typedef __u32 xfs_dev_t;
typedef struct timespec timespec_t; typedef struct xfs_dirent { /* data from readdir() */
xfs_ino_t d_ino; /* inode number of entry */
xfs_off_t d_off; /* offset of disk directory entry */
unsigned short d_reclen; /* length of this record */
char d_name[1]; /* name of file */
} xfs_dirent_t;
typedef struct { #define DIRENTBASESIZE (((xfs_dirent_t *)0)->d_name - (char *)0)
unsigned char __u_bits[16]; #define DIRENTSIZE(namelen) \
} uuid_t; ((DIRENTBASESIZE + (namelen) + \
sizeof(xfs_off_t)) & ~(sizeof(xfs_off_t) - 1))
/* __psint_t is the same size as a pointer */ /* __psint_t is the same size as a pointer */
#if (BITS_PER_LONG == 32) #if (BITS_PER_LONG == 32)
...@@ -151,7 +152,7 @@ typedef __uint64_t xfs_fileoff_t; /* block number in a file */ ...@@ -151,7 +152,7 @@ typedef __uint64_t xfs_fileoff_t; /* block number in a file */
typedef __int64_t xfs_sfiloff_t; /* signed block number in a file */ typedef __int64_t xfs_sfiloff_t; /* signed block number in a file */
typedef __uint64_t xfs_filblks_t; /* number of blocks in a file */ typedef __uint64_t xfs_filblks_t; /* number of blocks in a file */
typedef __uint8_t xfs_arch_t; /* architecutre of an xfs fs */ typedef __uint8_t xfs_arch_t; /* architecture of an xfs fs */
/* /*
* Null values for the types. * Null values for the types.
...@@ -195,119 +196,6 @@ typedef enum { ...@@ -195,119 +196,6 @@ typedef enum {
} xfs_btnum_t; } xfs_btnum_t;
#if defined(CONFIG_PROC_FS) && defined(__KERNEL__) && !defined(XFS_STATS_OFF)
/*
* XFS global statistics
*/
struct xfsstats {
# define XFSSTAT_END_EXTENT_ALLOC 4
__uint32_t xs_allocx;
__uint32_t xs_allocb;
__uint32_t xs_freex;
__uint32_t xs_freeb;
# define XFSSTAT_END_ALLOC_BTREE (XFSSTAT_END_EXTENT_ALLOC+4)
__uint32_t xs_abt_lookup;
__uint32_t xs_abt_compare;
__uint32_t xs_abt_insrec;
__uint32_t xs_abt_delrec;
# define XFSSTAT_END_BLOCK_MAPPING (XFSSTAT_END_ALLOC_BTREE+7)
__uint32_t xs_blk_mapr;
__uint32_t xs_blk_mapw;
__uint32_t xs_blk_unmap;
__uint32_t xs_add_exlist;
__uint32_t xs_del_exlist;
__uint32_t xs_look_exlist;
__uint32_t xs_cmp_exlist;
# define XFSSTAT_END_BLOCK_MAP_BTREE (XFSSTAT_END_BLOCK_MAPPING+4)
__uint32_t xs_bmbt_lookup;
__uint32_t xs_bmbt_compare;
__uint32_t xs_bmbt_insrec;
__uint32_t xs_bmbt_delrec;
# define XFSSTAT_END_DIRECTORY_OPS (XFSSTAT_END_BLOCK_MAP_BTREE+4)
__uint32_t xs_dir_lookup;
__uint32_t xs_dir_create;
__uint32_t xs_dir_remove;
__uint32_t xs_dir_getdents;
# define XFSSTAT_END_TRANSACTIONS (XFSSTAT_END_DIRECTORY_OPS+3)
__uint32_t xs_trans_sync;
__uint32_t xs_trans_async;
__uint32_t xs_trans_empty;
# define XFSSTAT_END_INODE_OPS (XFSSTAT_END_TRANSACTIONS+7)
__uint32_t xs_ig_attempts;
__uint32_t xs_ig_found;
__uint32_t xs_ig_frecycle;
__uint32_t xs_ig_missed;
__uint32_t xs_ig_dup;
__uint32_t xs_ig_reclaims;
__uint32_t xs_ig_attrchg;
# define XFSSTAT_END_LOG_OPS (XFSSTAT_END_INODE_OPS+5)
__uint32_t xs_log_writes;
__uint32_t xs_log_blocks;
__uint32_t xs_log_noiclogs;
__uint32_t xs_log_force;
__uint32_t xs_log_force_sleep;
# define XFSSTAT_END_TAIL_PUSHING (XFSSTAT_END_LOG_OPS+10)
__uint32_t xs_try_logspace;
__uint32_t xs_sleep_logspace;
__uint32_t xs_push_ail;
__uint32_t xs_push_ail_success;
__uint32_t xs_push_ail_pushbuf;
__uint32_t xs_push_ail_pinned;
__uint32_t xs_push_ail_locked;
__uint32_t xs_push_ail_flushing;
__uint32_t xs_push_ail_restarts;
__uint32_t xs_push_ail_flush;
# define XFSSTAT_END_WRITE_CONVERT (XFSSTAT_END_TAIL_PUSHING+2)
__uint32_t xs_xstrat_quick;
__uint32_t xs_xstrat_split;
# define XFSSTAT_END_READ_WRITE_OPS (XFSSTAT_END_WRITE_CONVERT+2)
__uint32_t xs_write_calls;
__uint32_t xs_read_calls;
# define XFSSTAT_END_ATTRIBUTE_OPS (XFSSTAT_END_READ_WRITE_OPS+4)
__uint32_t xs_attr_get;
__uint32_t xs_attr_set;
__uint32_t xs_attr_remove;
__uint32_t xs_attr_list;
# define XFSSTAT_END_QUOTA_OPS (XFSSTAT_END_ATTRIBUTE_OPS+8)
__uint32_t xs_qm_dqreclaims;
__uint32_t xs_qm_dqreclaim_misses;
__uint32_t xs_qm_dquot_dups;
__uint32_t xs_qm_dqcachemisses;
__uint32_t xs_qm_dqcachehits;
__uint32_t xs_qm_dqwants;
__uint32_t xs_qm_dqshake_reclaims;
__uint32_t xs_qm_dqinact_reclaims;
# define XFSSTAT_END_INODE_CLUSTER (XFSSTAT_END_QUOTA_OPS+3)
__uint32_t xs_iflush_count;
__uint32_t xs_icluster_flushcnt;
__uint32_t xs_icluster_flushinode;
# define XFSSTAT_END_VNODE_OPS (XFSSTAT_END_INODE_CLUSTER+8)
__uint32_t vn_active; /* # vnodes not on free lists */
__uint32_t vn_alloc; /* # times vn_alloc called */
__uint32_t vn_get; /* # times vn_get called */
__uint32_t vn_hold; /* # times vn_hold called */
__uint32_t vn_rele; /* # times vn_rele called */
__uint32_t vn_reclaim; /* # times vn_reclaim called */
__uint32_t vn_remove; /* # times vn_remove called */
__uint32_t vn_free; /* # times vn_free called */
/* Extra precision counters */
__uint64_t xs_xstrat_bytes;
__uint64_t xs_write_bytes;
__uint64_t xs_read_bytes;
};
extern struct xfsstats xfsstats;
# define XFS_STATS_INC(count) ( (count)++ )
# define XFS_STATS_DEC(count) ( (count)-- )
# define XFS_STATS_ADD(count, inc) ( (count) += (inc) )
#else /* !CONFIG_PROC_FS */
# define XFS_STATS_INC(count)
# define XFS_STATS_DEC(count)
# define XFS_STATS_ADD(count, inc)
#endif /* !CONFIG_PROC_FS */
/* /*
* Juggle IRIX device numbers - still used in ondisk structures * Juggle IRIX device numbers - still used in ondisk structures
*/ */
......
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
*/ */
#include <xfs.h> #include <xfs.h>
#include <asm/fcntl.h>
/* /*
...@@ -119,7 +118,7 @@ xfs_getattr( ...@@ -119,7 +118,7 @@ xfs_getattr(
xfs_ilock(ip, XFS_ILOCK_SHARED); xfs_ilock(ip, XFS_ILOCK_SHARED);
vap->va_size = ip->i_d.di_size; vap->va_size = ip->i_d.di_size;
if (vap->va_mask == AT_SIZE) { if (vap->va_mask == XFS_AT_SIZE) {
if (!(flags & ATTR_LAZY)) if (!(flags & ATTR_LAZY))
xfs_iunlock(ip, XFS_ILOCK_SHARED); xfs_iunlock(ip, XFS_ILOCK_SHARED);
return 0; return 0;
...@@ -137,7 +136,8 @@ xfs_getattr( ...@@ -137,7 +136,8 @@ xfs_getattr(
/* /*
* Quick exit for non-stat callers * Quick exit for non-stat callers
*/ */
if ((vap->va_mask & ~(AT_SIZE|AT_FSID|AT_NODEID|AT_NLINK)) == 0) { if ((vap->va_mask &
~(XFS_AT_SIZE|XFS_AT_FSID|XFS_AT_NODEID|XFS_AT_NLINK)) == 0) {
if (!(flags & ATTR_LAZY)) if (!(flags & ATTR_LAZY))
xfs_iunlock(ip, XFS_ILOCK_SHARED); xfs_iunlock(ip, XFS_ILOCK_SHARED);
return 0; return 0;
...@@ -224,8 +224,8 @@ xfs_getattr( ...@@ -224,8 +224,8 @@ xfs_getattr(
* to be filled in are needed. * to be filled in are needed.
*/ */
if ((vap->va_mask & if ((vap->va_mask &
(AT_XFLAGS|AT_EXTSIZE|AT_NEXTENTS|AT_ANEXTENTS| (XFS_AT_XFLAGS|XFS_AT_EXTSIZE|XFS_AT_NEXTENTS|XFS_AT_ANEXTENTS|
AT_GENCOUNT|AT_VCODE)) == 0) { XFS_AT_GENCOUNT|XFS_AT_VCODE)) == 0) {
if (!(flags & ATTR_LAZY)) if (!(flags & ATTR_LAZY))
xfs_iunlock(ip, XFS_ILOCK_SHARED); xfs_iunlock(ip, XFS_ILOCK_SHARED);
return 0; return 0;
...@@ -294,7 +294,7 @@ xfs_setattr( ...@@ -294,7 +294,7 @@ xfs_setattr(
* Cannot set certain attributes. * Cannot set certain attributes.
*/ */
mask = vap->va_mask; mask = vap->va_mask;
if (mask & AT_NOSET) { if (mask & XFS_AT_NOSET) {
return XFS_ERROR(EINVAL); return XFS_ERROR(EINVAL);
} }
...@@ -308,11 +308,11 @@ xfs_setattr( ...@@ -308,11 +308,11 @@ xfs_setattr(
* Timestamps do not need to be logged and hence do not * Timestamps do not need to be logged and hence do not
* need to be done within a transaction. * need to be done within a transaction.
*/ */
if (mask & AT_UPDTIMES) { if (mask & XFS_AT_UPDTIMES) {
ASSERT((mask & ~AT_UPDTIMES) == 0); ASSERT((mask & ~XFS_AT_UPDTIMES) == 0);
timeflags = ((mask & AT_UPDATIME) ? XFS_ICHGTIME_ACC : 0) | timeflags = ((mask & XFS_AT_UPDATIME) ? XFS_ICHGTIME_ACC : 0) |
((mask & AT_UPDCTIME) ? XFS_ICHGTIME_CHG : 0) | ((mask & XFS_AT_UPDCTIME) ? XFS_ICHGTIME_CHG : 0) |
((mask & AT_UPDMTIME) ? XFS_ICHGTIME_MOD : 0); ((mask & XFS_AT_UPDMTIME) ? XFS_ICHGTIME_MOD : 0);
xfs_ichgtime(ip, timeflags); xfs_ichgtime(ip, timeflags);
return 0; return 0;
} }
...@@ -328,15 +328,15 @@ xfs_setattr( ...@@ -328,15 +328,15 @@ xfs_setattr(
* If the IDs do change before we take the ilock, we're covered * If the IDs do change before we take the ilock, we're covered
* because the i_*dquot fields will get updated anyway. * because the i_*dquot fields will get updated anyway.
*/ */
if (XFS_IS_QUOTA_ON(mp) && (mask & (AT_UID|AT_GID))) { if (XFS_IS_QUOTA_ON(mp) && (mask & (XFS_AT_UID|XFS_AT_GID))) {
qflags = 0; qflags = 0;
if (mask & AT_UID) { if (mask & XFS_AT_UID) {
uid = vap->va_uid; uid = vap->va_uid;
qflags |= XFS_QMOPT_UQUOTA; qflags |= XFS_QMOPT_UQUOTA;
} else { } else {
uid = ip->i_d.di_uid; uid = ip->i_d.di_uid;
} }
if (mask & AT_GID) { if (mask & XFS_AT_GID) {
gid = vap->va_gid; gid = vap->va_gid;
qflags |= XFS_QMOPT_GQUOTA; qflags |= XFS_QMOPT_GQUOTA;
} else { } else {
...@@ -360,8 +360,8 @@ xfs_setattr( ...@@ -360,8 +360,8 @@ xfs_setattr(
*/ */
tp = NULL; tp = NULL;
lock_flags = XFS_ILOCK_EXCL; lock_flags = XFS_ILOCK_EXCL;
if (!(mask & AT_SIZE)) { if (!(mask & XFS_AT_SIZE)) {
if ((mask != (AT_CTIME|AT_ATIME|AT_MTIME)) || if ((mask != (XFS_AT_CTIME|XFS_AT_ATIME|XFS_AT_MTIME)) ||
(mp->m_flags & XFS_MOUNT_WSYNC)) { (mp->m_flags & XFS_MOUNT_WSYNC)) {
tp = xfs_trans_alloc(mp, XFS_TRANS_SETATTR_NOT_SIZE); tp = xfs_trans_alloc(mp, XFS_TRANS_SETATTR_NOT_SIZE);
commit_flags = 0; commit_flags = 0;
...@@ -400,7 +400,9 @@ xfs_setattr( ...@@ -400,7 +400,9 @@ xfs_setattr(
* Only the owner or users with CAP_FOWNER * Only the owner or users with CAP_FOWNER
* capability may do these things. * capability may do these things.
*/ */
if (mask & (AT_MODE|AT_XFLAGS|AT_EXTSIZE|AT_UID|AT_GID|AT_PROJID)) { if (mask &
(XFS_AT_MODE|XFS_AT_XFLAGS|XFS_AT_EXTSIZE|XFS_AT_UID|
XFS_AT_GID|XFS_AT_PROJID)) {
/* /*
* CAP_FOWNER overrides the following restrictions: * CAP_FOWNER overrides the following restrictions:
* *
...@@ -424,7 +426,7 @@ xfs_setattr( ...@@ -424,7 +426,7 @@ xfs_setattr(
* IDs of the calling process shall match the group owner of * IDs of the calling process shall match the group owner of
* the file when setting the set-group-ID bit on that file * the file when setting the set-group-ID bit on that file
*/ */
if (mask & 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 & ISUID) && !file_owner)
...@@ -449,7 +451,7 @@ xfs_setattr( ...@@ -449,7 +451,7 @@ xfs_setattr(
* and can change the group id only to a group of which he * and can change the group id only to a group of which he
* or she is a member. * or she is a member.
*/ */
if (mask & (AT_UID|AT_GID|AT_PROJID)) { if (mask & (XFS_AT_UID|XFS_AT_GID|XFS_AT_PROJID)) {
/* /*
* These IDs could have changed since we last looked at them. * These IDs could have changed since we last looked at them.
* But, we're assured that if the ownership did change * But, we're assured that if the ownership did change
...@@ -459,9 +461,9 @@ xfs_setattr( ...@@ -459,9 +461,9 @@ xfs_setattr(
iuid = ip->i_d.di_uid; iuid = ip->i_d.di_uid;
iprojid = ip->i_d.di_projid; iprojid = ip->i_d.di_projid;
igid = ip->i_d.di_gid; igid = ip->i_d.di_gid;
gid = (mask & AT_GID) ? vap->va_gid : igid; gid = (mask & XFS_AT_GID) ? vap->va_gid : igid;
uid = (mask & AT_UID) ? vap->va_uid : iuid; uid = (mask & XFS_AT_UID) ? vap->va_uid : iuid;
projid = (mask & AT_PROJID) ? (xfs_prid_t)vap->va_projid : projid = (mask & XFS_AT_PROJID) ? (xfs_prid_t)vap->va_projid :
iprojid; iprojid;
/* /*
...@@ -506,13 +508,13 @@ xfs_setattr( ...@@ -506,13 +508,13 @@ xfs_setattr(
/* /*
* Truncate file. Must have write permission and not be a directory. * Truncate file. Must have write permission and not be a directory.
*/ */
if (mask & AT_SIZE) { if (mask & XFS_AT_SIZE) {
/* Short circuit the truncate case for zero length files */ /* Short circuit the truncate case for zero length files */
if ((vap->va_size == 0) && if ((vap->va_size == 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)) {
xfs_iunlock(ip, XFS_ILOCK_EXCL); xfs_iunlock(ip, XFS_ILOCK_EXCL);
lock_flags &= ~XFS_ILOCK_EXCL; lock_flags &= ~XFS_ILOCK_EXCL;
if (mask & AT_CTIME) if (mask & XFS_AT_CTIME)
xfs_ichgtime(ip, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); xfs_ichgtime(ip, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG);
code = 0; code = 0;
goto error_return; goto error_return;
...@@ -537,7 +539,7 @@ xfs_setattr( ...@@ -537,7 +539,7 @@ xfs_setattr(
/* /*
* Change file access or modified times. * Change file access or modified times.
*/ */
if (mask & (AT_ATIME|AT_MTIME)) { if (mask & (XFS_AT_ATIME|XFS_AT_MTIME)) {
if (!file_owner) { if (!file_owner) {
if ((flags & ATTR_UTIME) && if ((flags & ATTR_UTIME) &&
!capable(CAP_FOWNER)) { !capable(CAP_FOWNER)) {
...@@ -550,11 +552,11 @@ xfs_setattr( ...@@ -550,11 +552,11 @@ xfs_setattr(
/* /*
* Change extent size or realtime flag. * Change extent size or realtime flag.
*/ */
if (mask & (AT_EXTSIZE|AT_XFLAGS)) { if (mask & (XFS_AT_EXTSIZE|XFS_AT_XFLAGS)) {
/* /*
* Can't change extent size if any extents are allocated. * Can't change extent size if any extents are allocated.
*/ */
if (ip->i_d.di_nextents && (mask & AT_EXTSIZE) && if (ip->i_d.di_nextents && (mask & XFS_AT_EXTSIZE) &&
((ip->i_d.di_extsize << mp->m_sb.sb_blocklog) != ((ip->i_d.di_extsize << mp->m_sb.sb_blocklog) !=
vap->va_extsize) ) { vap->va_extsize) ) {
code = XFS_ERROR(EINVAL); /* EFBIG? */ code = XFS_ERROR(EINVAL); /* EFBIG? */
...@@ -569,11 +571,11 @@ xfs_setattr( ...@@ -569,11 +571,11 @@ xfs_setattr(
* with buffered data writes is implemented. * with buffered data writes is implemented.
* *
*/ */
if ((mask & AT_EXTSIZE) && if ((mask & XFS_AT_EXTSIZE) &&
((ip->i_d.di_extsize << mp->m_sb.sb_blocklog) != ((ip->i_d.di_extsize << mp->m_sb.sb_blocklog) !=
vap->va_extsize) && vap->va_extsize) &&
(!((ip->i_d.di_flags & XFS_DIFLAG_REALTIME) || (!((ip->i_d.di_flags & XFS_DIFLAG_REALTIME) ||
((mask & AT_XFLAGS) && ((mask & XFS_AT_XFLAGS) &&
(vap->va_xflags & XFS_XFLAG_REALTIME))))) { (vap->va_xflags & XFS_XFLAG_REALTIME))))) {
code = XFS_ERROR(EINVAL); code = XFS_ERROR(EINVAL);
goto error_return; goto error_return;
...@@ -582,7 +584,7 @@ xfs_setattr( ...@@ -582,7 +584,7 @@ xfs_setattr(
/* /*
* Can't change realtime flag if any extents are allocated. * Can't change realtime flag if any extents are allocated.
*/ */
if (ip->i_d.di_nextents && (mask & AT_XFLAGS) && if (ip->i_d.di_nextents && (mask & XFS_AT_XFLAGS) &&
(ip->i_d.di_flags & XFS_DIFLAG_REALTIME) != (ip->i_d.di_flags & XFS_DIFLAG_REALTIME) !=
(vap->va_xflags & XFS_XFLAG_REALTIME)) { (vap->va_xflags & XFS_XFLAG_REALTIME)) {
code = XFS_ERROR(EINVAL); /* EFBIG? */ code = XFS_ERROR(EINVAL); /* EFBIG? */
...@@ -592,11 +594,11 @@ xfs_setattr( ...@@ -592,11 +594,11 @@ xfs_setattr(
* Extent size must be a multiple of the appropriate block * Extent size must be a multiple of the appropriate block
* size, if set at all. * size, if set at all.
*/ */
if ((mask & AT_EXTSIZE) && vap->va_extsize != 0) { if ((mask & XFS_AT_EXTSIZE) && vap->va_extsize != 0) {
xfs_extlen_t size; xfs_extlen_t size;
if ((ip->i_d.di_flags & XFS_DIFLAG_REALTIME) || if ((ip->i_d.di_flags & XFS_DIFLAG_REALTIME) ||
((mask & AT_XFLAGS) && ((mask & XFS_AT_XFLAGS) &&
(vap->va_xflags & XFS_XFLAG_REALTIME))) { (vap->va_xflags & XFS_XFLAG_REALTIME))) {
size = mp->m_sb.sb_rextsize << size = mp->m_sb.sb_rextsize <<
mp->m_sb.sb_blocklog; mp->m_sb.sb_blocklog;
...@@ -611,7 +613,7 @@ xfs_setattr( ...@@ -611,7 +613,7 @@ xfs_setattr(
/* /*
* If realtime flag is set then must have realtime data. * If realtime flag is set then must have realtime data.
*/ */
if ((mask & AT_XFLAGS) && if ((mask & XFS_AT_XFLAGS) &&
(vap->va_xflags & XFS_XFLAG_REALTIME)) { (vap->va_xflags & XFS_XFLAG_REALTIME)) {
if ((mp->m_sb.sb_rblocks == 0) || if ((mp->m_sb.sb_rblocks == 0) ||
(mp->m_sb.sb_rextsize == 0) || (mp->m_sb.sb_rextsize == 0) ||
...@@ -624,13 +626,13 @@ xfs_setattr( ...@@ -624,13 +626,13 @@ xfs_setattr(
/* /*
* Now we can make the changes. Before we join the inode * Now we can make the changes. Before we join the inode
* to the transaction, if AT_SIZE is set then take care of * to the transaction, if XFS_AT_SIZE is set then take care of
* the part of the truncation that must be done without the * the part of the truncation that must be done without the
* inode lock. This needs to be done before joining the inode * inode lock. This needs to be done before joining the inode
* to the transaction, because the inode cannot be unlocked * to the transaction, because the inode cannot be unlocked
* once it is a part of the transaction. * once it is a part of the transaction.
*/ */
if (mask & AT_SIZE) { if (mask & XFS_AT_SIZE) {
if (vap->va_size > ip->i_d.di_size) { if (vap->va_size > ip->i_d.di_size) {
code = xfs_igrow_start(ip, vap->va_size, credp); code = xfs_igrow_start(ip, vap->va_size, credp);
xfs_iunlock(ip, XFS_ILOCK_EXCL); xfs_iunlock(ip, XFS_ILOCK_EXCL);
...@@ -673,7 +675,7 @@ xfs_setattr( ...@@ -673,7 +675,7 @@ xfs_setattr(
/* /*
* Truncate file. Must have write permission and not be a directory. * Truncate file. Must have write permission and not be a directory.
*/ */
if (mask & AT_SIZE) { if (mask & XFS_AT_SIZE) {
if (vap->va_size > ip->i_d.di_size) { if (vap->va_size > ip->i_d.di_size) {
xfs_igrow_finish(tp, ip, vap->va_size, xfs_igrow_finish(tp, ip, vap->va_size,
!(flags & ATTR_DMI)); !(flags & ATTR_DMI));
...@@ -703,7 +705,7 @@ xfs_setattr( ...@@ -703,7 +705,7 @@ xfs_setattr(
/* /*
* Change file access modes. * Change file access modes.
*/ */
if (mask & AT_MODE) { if (mask & XFS_AT_MODE) {
ip->i_d.di_mode &= IFMT; ip->i_d.di_mode &= IFMT;
ip->i_d.di_mode |= vap->va_mode & ~IFMT; ip->i_d.di_mode |= vap->va_mode & ~IFMT;
...@@ -718,7 +720,7 @@ xfs_setattr( ...@@ -718,7 +720,7 @@ xfs_setattr(
* and can change the group id only to a group of which he * and can change the group id only to a group of which he
* or she is a member. * or she is a member.
*/ */
if (mask & (AT_UID|AT_GID|AT_PROJID)) { if (mask & (XFS_AT_UID|XFS_AT_GID|XFS_AT_PROJID)) {
/* /*
* CAP_FSETID overrides the following restrictions: * CAP_FSETID overrides the following restrictions:
* *
...@@ -736,7 +738,7 @@ xfs_setattr( ...@@ -736,7 +738,7 @@ xfs_setattr(
*/ */
if (iuid != uid) { if (iuid != uid) {
if (XFS_IS_UQUOTA_ON(mp)) { if (XFS_IS_UQUOTA_ON(mp)) {
ASSERT(mask & AT_UID); ASSERT(mask & XFS_AT_UID);
ASSERT(udqp); ASSERT(udqp);
ASSERT(xfs_qm_dqid(udqp) == (xfs_dqid_t)uid); ASSERT(xfs_qm_dqid(udqp) == (xfs_dqid_t)uid);
olddquot1 = xfs_qm_vop_chown(tp, ip, olddquot1 = xfs_qm_vop_chown(tp, ip,
...@@ -750,7 +752,7 @@ xfs_setattr( ...@@ -750,7 +752,7 @@ xfs_setattr(
} }
if (igid != gid) { if (igid != gid) {
if (XFS_IS_GQUOTA_ON(mp)) { if (XFS_IS_GQUOTA_ON(mp)) {
ASSERT(mask & AT_GID); ASSERT(mask & XFS_AT_GID);
ASSERT(gdqp); ASSERT(gdqp);
ASSERT(xfs_qm_dqid(gdqp) == gid); ASSERT(xfs_qm_dqid(gdqp) == gid);
olddquot2 = xfs_qm_vop_chown(tp, ip, olddquot2 = xfs_qm_vop_chown(tp, ip,
...@@ -778,14 +780,14 @@ xfs_setattr( ...@@ -778,14 +780,14 @@ xfs_setattr(
/* /*
* Change file access or modified times. * Change file access or modified times.
*/ */
if (mask & (AT_ATIME|AT_MTIME)) { if (mask & (XFS_AT_ATIME|XFS_AT_MTIME)) {
if (mask & AT_ATIME) { if (mask & XFS_AT_ATIME) {
ip->i_d.di_atime.t_sec = vap->va_atime.tv_sec; ip->i_d.di_atime.t_sec = vap->va_atime.tv_sec;
ip->i_d.di_atime.t_nsec = vap->va_atime.tv_nsec; ip->i_d.di_atime.t_nsec = vap->va_atime.tv_nsec;
ip->i_update_core = 1; ip->i_update_core = 1;
timeflags &= ~XFS_ICHGTIME_ACC; timeflags &= ~XFS_ICHGTIME_ACC;
} }
if (mask & AT_MTIME) { if (mask & XFS_AT_MTIME) {
ip->i_d.di_mtime.t_sec = vap->va_mtime.tv_sec; ip->i_d.di_mtime.t_sec = vap->va_mtime.tv_sec;
ip->i_d.di_mtime.t_nsec = vap->va_mtime.tv_nsec; ip->i_d.di_mtime.t_nsec = vap->va_mtime.tv_nsec;
timeflags &= ~XFS_ICHGTIME_MOD; timeflags &= ~XFS_ICHGTIME_MOD;
...@@ -798,15 +800,15 @@ xfs_setattr( ...@@ -798,15 +800,15 @@ xfs_setattr(
/* /*
* Change XFS-added attributes. * Change XFS-added attributes.
*/ */
if (mask & (AT_EXTSIZE|AT_XFLAGS)) { if (mask & (XFS_AT_EXTSIZE|XFS_AT_XFLAGS)) {
if (mask & AT_EXTSIZE) { if (mask & XFS_AT_EXTSIZE) {
/* /*
* Converting bytes to fs blocks. * Converting bytes to fs blocks.
*/ */
ip->i_d.di_extsize = vap->va_extsize >> ip->i_d.di_extsize = vap->va_extsize >>
mp->m_sb.sb_blocklog; mp->m_sb.sb_blocklog;
} }
if (mask & AT_XFLAGS) { if (mask & XFS_AT_XFLAGS) {
ip->i_d.di_flags = 0; ip->i_d.di_flags = 0;
if (vap->va_xflags & XFS_XFLAG_REALTIME) { if (vap->va_xflags & XFS_XFLAG_REALTIME) {
ip->i_d.di_flags |= XFS_DIFLAG_REALTIME; ip->i_d.di_flags |= XFS_DIFLAG_REALTIME;
...@@ -822,11 +824,11 @@ xfs_setattr( ...@@ -822,11 +824,11 @@ xfs_setattr(
} }
/* /*
* Change file inode change time only if AT_CTIME set * Change file inode change time only if XFS_AT_CTIME set
* AND we have been called by a DMI function. * AND we have been called by a DMI function.
*/ */
if ( (flags & ATTR_DMI) && (mask & AT_CTIME) ) { if ( (flags & ATTR_DMI) && (mask & XFS_AT_CTIME) ) {
ip->i_d.di_ctime.t_sec = vap->va_ctime.tv_sec; ip->i_d.di_ctime.t_sec = vap->va_ctime.tv_sec;
ip->i_d.di_ctime.t_nsec = vap->va_ctime.tv_nsec; ip->i_d.di_ctime.t_nsec = vap->va_ctime.tv_nsec;
ip->i_update_core = 1; ip->i_update_core = 1;
...@@ -2015,7 +2017,7 @@ xfs_create( ...@@ -2015,7 +2017,7 @@ xfs_create(
return XFS_ERROR(EIO); return XFS_ERROR(EIO);
udqp = gdqp = NULL; udqp = gdqp = NULL;
if (vap->va_mask & AT_PROJID) if (vap->va_mask & XFS_AT_PROJID)
prid = (xfs_prid_t)vap->va_projid; prid = (xfs_prid_t)vap->va_projid;
else else
prid = (xfs_prid_t)dfltprid; prid = (xfs_prid_t)dfltprid;
...@@ -2076,7 +2078,7 @@ xfs_create( ...@@ -2076,7 +2078,7 @@ xfs_create(
if (resblks == 0 && if (resblks == 0 &&
(error = XFS_DIR_CANENTER(mp, tp, dp, name, namelen))) (error = XFS_DIR_CANENTER(mp, tp, dp, name, namelen)))
goto error_return; goto error_return;
rdev = (vap->va_mask & AT_RDEV) ? vap->va_rdev : 0; rdev = (vap->va_mask & XFS_AT_RDEV) ? vap->va_rdev : 0;
error = xfs_dir_ialloc(&tp, dp, error = xfs_dir_ialloc(&tp, dp,
MAKEIMODE(vap->va_type,vap->va_mode), 1, MAKEIMODE(vap->va_type,vap->va_mode), 1,
rdev, credp, prid, resblks > 0, rdev, credp, prid, resblks > 0,
...@@ -2989,7 +2991,7 @@ xfs_mkdir( ...@@ -2989,7 +2991,7 @@ xfs_mkdir(
mp = dp->i_mount; mp = dp->i_mount;
udqp = gdqp = NULL; udqp = gdqp = NULL;
if (vap->va_mask & AT_PROJID) if (vap->va_mask & XFS_AT_PROJID)
prid = (xfs_prid_t)vap->va_projid; prid = (xfs_prid_t)vap->va_projid;
else else
prid = (xfs_prid_t)dfltprid; prid = (xfs_prid_t)dfltprid;
...@@ -3049,7 +3051,7 @@ xfs_mkdir( ...@@ -3049,7 +3051,7 @@ xfs_mkdir(
/* /*
* create the directory inode. * create the directory inode.
*/ */
rdev = (vap->va_mask & AT_RDEV) ? vap->va_rdev : 0; rdev = (vap->va_mask & XFS_AT_RDEV) ? vap->va_rdev : 0;
error = xfs_dir_ialloc(&tp, dp, error = xfs_dir_ialloc(&tp, dp,
MAKEIMODE(vap->va_type,vap->va_mode), 2, MAKEIMODE(vap->va_type,vap->va_mode), 2,
rdev, credp, prid, resblks > 0, rdev, credp, prid, resblks > 0,
...@@ -3594,7 +3596,7 @@ xfs_symlink( ...@@ -3594,7 +3596,7 @@ xfs_symlink(
/* Return through std_return after this point. */ /* Return through std_return after this point. */
udqp = gdqp = NULL; udqp = gdqp = NULL;
if (vap->va_mask & AT_PROJID) if (vap->va_mask & XFS_AT_PROJID)
prid = (xfs_prid_t)vap->va_projid; prid = (xfs_prid_t)vap->va_projid;
else else
prid = (xfs_prid_t)dfltprid; prid = (xfs_prid_t)dfltprid;
...@@ -3662,7 +3664,7 @@ xfs_symlink( ...@@ -3662,7 +3664,7 @@ xfs_symlink(
/* /*
* Allocate an inode for the symlink. * Allocate an inode for the symlink.
*/ */
rdev = (vap->va_mask & AT_RDEV) ? vap->va_rdev : 0; rdev = (vap->va_mask & XFS_AT_RDEV) ? vap->va_rdev : 0;
error = xfs_dir_ialloc(&tp, dp, IFLNK | (vap->va_mode&~IFMT), error = xfs_dir_ialloc(&tp, dp, IFLNK | (vap->va_mode&~IFMT),
1, rdev, credp, prid, resblks > 0, &ip, NULL); 1, rdev, credp, prid, resblks > 0, &ip, NULL);
...@@ -4824,7 +4826,7 @@ xfs_change_file_space( ...@@ -4824,7 +4826,7 @@ xfs_change_file_space(
break; break;
} }
va.va_mask = AT_SIZE; va.va_mask = XFS_AT_SIZE;
va.va_size = startoffset; va.va_size = startoffset;
error = xfs_setattr(bdp, &va, attr_flags, credp); error = xfs_setattr(bdp, &va, attr_flags, credp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment