Annotation of linux/fs/stat.c, revision 1.1.1.1

1.1       root        1: #include <errno.h>
                      2: #include <sys/stat.h>
                      3: 
                      4: #include <linux/fs.h>
                      5: #include <linux/sched.h>
                      6: #include <linux/kernel.h>
                      7: #include <asm/segment.h>
                      8: 
                      9: static int cp_stat(struct m_inode * inode, struct stat * statbuf)
                     10: {
                     11:        struct stat tmp;
                     12:        int i;
                     13: 
                     14:        verify_area(statbuf,sizeof (* statbuf));
                     15:        tmp.st_dev = inode->i_dev;
                     16:        tmp.st_ino = inode->i_num;
                     17:        tmp.st_mode = inode->i_mode;
                     18:        tmp.st_nlink = inode->i_nlinks;
                     19:        tmp.st_uid = inode->i_uid;
                     20:        tmp.st_gid = inode->i_gid;
                     21:        tmp.st_rdev = inode->i_zone[0];
                     22:        tmp.st_size = inode->i_size;
                     23:        tmp.st_atime = inode->i_atime;
                     24:        tmp.st_mtime = inode->i_mtime;
                     25:        tmp.st_ctime = inode->i_ctime;
                     26:        for (i=0 ; i<sizeof (tmp) ; i++)
                     27:                put_fs_byte(((char *) &tmp)[i],&((char *) statbuf)[i]);
                     28:        return (0);
                     29: }
                     30: 
                     31: int sys_stat(char * filename, struct stat * statbuf)
                     32: {
                     33:        int i;
                     34:        struct m_inode * inode;
                     35: 
                     36:        if (!(inode=namei(filename)))
                     37:                return -ENOENT;
                     38:        i=cp_stat(inode,statbuf);
                     39:        iput(inode);
                     40:        return i;
                     41: }
                     42: 
                     43: int sys_fstat(unsigned int fd, struct stat * statbuf)
                     44: {
                     45:        struct file * f;
                     46:        struct m_inode * inode;
                     47: 
                     48:        if (fd >= NR_OPEN || !(f=current->filp[fd]) || !(inode=f->f_inode))
                     49:                return -ENOENT;
                     50:        return cp_stat(inode,statbuf);
                     51: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.