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

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: 
1.1.1.2 ! root       43: int sys_lstat(char* filename, struct stat * statbuf)
        !            44: {
        !            45:        return sys_stat(filename,statbuf);
        !            46: }
        !            47: 
1.1       root       48: int sys_fstat(unsigned int fd, struct stat * statbuf)
                     49: {
                     50:        struct file * f;
                     51:        struct m_inode * inode;
                     52: 
                     53:        if (fd >= NR_OPEN || !(f=current->filp[fd]) || !(inode=f->f_inode))
                     54:                return -ENOENT;
                     55:        return cp_stat(inode,statbuf);
                     56: }
1.1.1.2 ! root       57: 
        !            58: 
        !            59: static int cp_stat64(struct m_inode * inode, struct stat64 * statbuf)
        !            60: {
        !            61:        struct stat64 tmp;
        !            62:        int i;
        !            63: 
        !            64:        verify_area(statbuf,sizeof (* statbuf));
        !            65:        tmp.st_dev = inode->i_dev;
        !            66:        tmp.st_ino = inode->i_num;
        !            67:        tmp.st_mode = inode->i_mode;
        !            68:        tmp.st_nlink = inode->i_nlinks;
        !            69:        tmp.st_uid = inode->i_uid;
        !            70:        tmp.st_gid = inode->i_gid;
        !            71:        tmp.st_rdev = inode->i_zone[0];
        !            72:        tmp.st_size = inode->i_size;
        !            73:        tmp.st_atime = inode->i_atime;
        !            74:        tmp.st_mtime = inode->i_mtime;
        !            75:        tmp.st_ctime = inode->i_ctime;
        !            76:        for (i=0 ; i<sizeof (tmp) ; i++)
        !            77:                put_fs_byte(((char *) &tmp)[i],&((char *) statbuf)[i]);
        !            78:        return (0);
        !            79: }
        !            80: 
        !            81: int sys_stat64(char * filename, struct stat64 * statbuf)
        !            82: {
        !            83:        int i;
        !            84:        struct m_inode * inode;
        !            85: 
        !            86:        if (!(inode=namei(filename)))
        !            87:                return -ENOENT;
        !            88:        i=cp_stat64(inode,statbuf);
        !            89:        iput(inode);
        !            90:        return i;
        !            91: }
        !            92: 
        !            93: int sys_fstat64(unsigned int fd, struct stat64 * statbuf)
        !            94: {
        !            95:        struct file * f;
        !            96:        struct m_inode * inode;
        !            97: 
        !            98:        if (fd >= NR_OPEN || !(f=current->filp[fd]) || !(inode=f->f_inode))
        !            99:                return -ENOENT;
        !           100:        return cp_stat64(inode,statbuf);
        !           101: }
        !           102: 
        !           103: int sys_lstat64(char* filename, struct stat * statbuf)
        !           104: {
        !           105:        return sys_stat64(filename,statbuf);
        !           106: }
        !           107: 
        !           108: int sys_oldstat()
        !           109: {
        !           110:        printk("calling obsolete system call oldstat\n");
        !           111:        return 0;
        !           112: }
        !           113: 
        !           114: int sys_oldfstat()
        !           115: {
        !           116:        printk("calling obsolete system call oldfstat\n");
        !           117:        return 0;
        !           118: }
        !           119: 

unix.superglobalmegacorp.com

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