switch stat_file() to passing a single struct rather than fsckloads of pointers
Subsystems (2)
PATCH 29/58 switch stat_file() to passing a single struct rather than fsckloads of pointers
Signed-off-by Al Viro <[email protected]>
--- fs/hostfs/hostfs.h | 20 +++++++++--- fs/hostfs/hostfs_kern.c | 31 +++++++------------ fs/hostfs/hostfs_user.c | 75 +++++++++++++++++++--------------------------- 3 files changed, 58 insertions(+), 68 deletions(-)
fs/hostfs/hostfs.h +15 -5
@@ -53,11 +53,21 @@ struct hostfs_iattr {struct timespec ia_ctime; }; -extern int stat_file (const char *path,unsigned long long *inode_out, -int *mode_out,int *nlink_out,int *uid_out,int *gid_out, -unsigned long long *size_out,struct timespec *atime_out, -struct timespec *mtime_out,struct timespec *ctime_out, -int *blksize_out,unsigned long long *blocks_out,int fd); +struct hostfs_stat { +unsigned long long ino; +unsigned int mode; +unsigned int nlink; +unsigned int uid; +unsigned int gid; +unsigned long long size; +struct timespec atime, mtime, ctime; +unsigned int blksize; +unsigned long long blocks; +unsigned int maj; +unsigned int min; +}; + +extern int stat_file (const char *path,struct hostfs_stat *p,int fd);extern int access_file (char *path,int r,int w,int x);extern int open_file (char *path,int r,int w,int append);extern int file_type (const char *path,int *maj,int *min);
fs/hostfs/hostfs_kern.c +12 -19
@@ -131,28 +131,21 @@ static char *inode_name(struct inode *ino, int extra)static int read_name (struct inode *ino,char *name) { -/* -* The non-int inode fields are copied into ints by stat_file and -* then copied into the inode because passing the actual pointers -* in and having them treated as int * breaks on big-endian machines -*/ -int err; -int i_mode, i_nlink, i_blksize; -unsigned long long i_size; -unsigned long long i_ino; -unsigned long long i_blocks; - - err =stat_file (name, &i_ino, &i_mode, &i_nlink, &ino->i_uid, - &ino->i_gid, &i_size, &ino->i_atime, &ino->i_mtime, - &ino->i_ctime, &i_blksize, &i_blocks,-1 ); +struct hostfs_stat st; +int err =stat_file (name, &st,-1 );if (err)return err; - ino->i_ino = i_ino; - ino->i_mode = i_mode; - ino->i_nlink = i_nlink; - ino->i_size = i_size; - ino->i_blocks = i_blocks; + ino->i_ino = st.ino; + ino->i_mode = st.mode; + ino->i_nlink = st.nlink; + ino->i_uid = st.uid; + ino->i_gid = st.gid; + ino->i_atime = st.atime; + ino->i_mtime = st.mtime; + ino->i_ctime = st.ctime; + ino->i_size = st.size; + ino->i_blocks = st.blocks;return 0 ; }
fs/hostfs/hostfs_user.c +31 -44
109 lines not on this page · raw message
Signature · 1 line
1.5.6.5