diff options
author | jdike <jdike> | 2003-09-18 14:12:09 +0000 |
---|---|---|
committer | jdike <jdike> | 2003-09-18 14:12:09 +0000 |
commit | c2c555aa1d2d8587ec1f7aef7c6c4bfcf1a373dc (patch) | |
tree | 1464e529226e93c66e9fe7e2ce46b321f741f7d5 | |
parent | c39c65e23c4387f9d2d88adab49813a5571c841d (diff) | |
download | uml-history-c2c555aa1d2d8587ec1f7aef7c6c4bfcf1a373dc.tar.gz |
Changed the field names of uml_stat because the old names were #defined
to something syntactically wrong by a system header.
-rw-r--r-- | arch/um/drivers/cow_user.c | 2 | ||||
-rw-r--r-- | arch/um/include/os.h | 24 | ||||
-rw-r--r-- | arch/um/kernel/mem_user.c | 2 | ||||
-rw-r--r-- | arch/um/os-Linux/file.c | 59 |
4 files changed, 45 insertions, 42 deletions
diff --git a/arch/um/drivers/cow_user.c b/arch/um/drivers/cow_user.c index 8a77065..79a2cdb 100644 --- a/arch/um/drivers/cow_user.c +++ b/arch/um/drivers/cow_user.c @@ -206,7 +206,7 @@ int write_cow_header(char *cow_file, int fd, char *backing_file, goto out_free; } - header->mtime = htonl(buf.st_mtime); + header->mtime = htonl(buf.ust_mtime); header->size = htonll(*size); header->sectorsize = htonl(sectorsize); header->alignment = htonl(alignment); diff --git a/arch/um/include/os.h b/arch/um/include/os.h index f7ebe0c..65af4d9 100644 --- a/arch/um/include/os.h +++ b/arch/um/include/os.h @@ -29,18 +29,18 @@ * (if they are wrong here, they are wrong there...). */ struct uml_stat { - int st_dev; /* device */ - unsigned long long st_ino; /* inode */ - int st_mode; /* protection */ - int st_nlink; /* number of hard links */ - int st_uid; /* user ID of owner */ - int st_gid; /* group ID of owner */ - unsigned long long st_size; /* total size, in bytes */ - int st_blksize; /* blocksize for filesystem I/O */ - unsigned long long st_blocks; /* number of blocks allocated */ - unsigned long st_atime; /* time of last access */ - unsigned long st_mtime; /* time of last modification */ - unsigned long st_ctime; /* time of last change */ + int ust_dev; /* device */ + unsigned long long ust_ino; /* inode */ + int ust_mode; /* protection */ + int ust_nlink; /* number of hard links */ + int ust_uid; /* user ID of owner */ + int ust_gid; /* group ID of owner */ + unsigned long long ust_size; /* total size, in bytes */ + int ust_blksize; /* blocksize for filesystem I/O */ + unsigned long long ust_blocks; /* number of blocks allocated */ + unsigned long ust_atime; /* time of last access */ + unsigned long ust_mtime; /* time of last modification */ + unsigned long ust_ctime; /* time of last change */ }; struct openflags { diff --git a/arch/um/kernel/mem_user.c b/arch/um/kernel/mem_user.c index ff4ee46..f56081f 100644 --- a/arch/um/kernel/mem_user.c +++ b/arch/um/kernel/mem_user.c @@ -121,7 +121,7 @@ static int __init parse_iomem(char *str, int *add) *new = ((struct iomem_region) { .next = iomem_regions, .driver = driver, .fd = fd, - .size = buf.st_size, + .size = buf.ust_size, .phys = 0, .virt = 0 }); iomem_regions = new; diff --git a/arch/um/os-Linux/file.c b/arch/um/os-Linux/file.c index 7bfab42..e48b997 100644 --- a/arch/um/os-Linux/file.c +++ b/arch/um/os-Linux/file.c @@ -19,25 +19,25 @@ #include "user.h" #include "kern_util.h" -static void copy_stat(struct uml_stat* dst, struct stat64* src) -{ - *dst=((struct uml_stat) { - .st_dev = src->st_dev, /* device */ - .st_ino = src->st_ino, /* inode */ - .st_mode = src->st_mode, /* protection */ - .st_nlink = src->st_nlink, /* number of hard links */ - .st_uid = src->st_uid, /* user ID of owner */ - .st_gid = src->st_gid, /* group ID of owner */ - .st_size = src->st_size, /* total size, in bytes */ - .st_blksize = src->st_blksize, /* blocksize for filesys I/O */ - .st_blocks = src->st_blocks, /* number of blocks allocated */ - .st_atime = src->st_atime, /* time of last access */ - .st_mtime = src->st_mtime, /* time of last modification */ - .st_ctime = src->st_ctime, /* time of last change */ +static void copy_stat(struct uml_stat *dst, struct stat64 *src) +{ + *dst = ((struct uml_stat) { + .ust_dev = src->st_dev, /* device */ + .ust_ino = src->st_ino, /* inode */ + .ust_mode = src->st_mode, /* protection */ + .ust_nlink = src->st_nlink, /* number of hard links */ + .ust_uid = src->st_uid, /* user ID of owner */ + .ust_gid = src->st_gid, /* group ID of owner */ + .ust_size = src->st_size, /* total size, in bytes */ + .ust_blksize = src->st_blksize, /* blocksize for filesys I/O */ + .ust_blocks = src->st_blocks, /* number of blocks allocated */ + .ust_atime = src->st_atime, /* time of last access */ + .ust_mtime = src->st_mtime, /* time of last modification */ + .ust_ctime = src->st_ctime, /* time of last change */ }); } -int os_stat_fd(const int fd, struct uml_stat* ubuf) +int os_stat_fd(const int fd, struct uml_stat *ubuf) { struct stat64 sbuf; int err; @@ -49,22 +49,25 @@ int os_stat_fd(const int fd, struct uml_stat* ubuf) if(err < 0) return(-errno); - copy_stat(ubuf, &sbuf); + if(ubuf != NULL) + copy_stat(ubuf, &sbuf); return(err); } -int os_stat_file(const char* file_name, struct uml_stat* ubuf) +int os_stat_file(const char *file_name, struct uml_stat *ubuf) { struct stat64 sbuf; int err; do { err = stat64(file_name, &sbuf); - } while((err < 0) && (errno==EINTR)) ; + } while((err < 0) && (errno == EINTR)) ; if(err < 0) return(-errno); - copy_stat(ubuf, &sbuf); + + if(ubuf != NULL) + copy_stat(ubuf, &sbuf); return(err); } @@ -220,12 +223,12 @@ int os_file_type(char *file) if(err < 0) return(err); - if(S_ISDIR(buf.st_mode)) return(OS_TYPE_DIR); - else if(S_ISLNK(buf.st_mode)) return(OS_TYPE_SYMLINK); - else if(S_ISCHR(buf.st_mode)) return(OS_TYPE_CHARDEV); - else if(S_ISBLK(buf.st_mode)) return(OS_TYPE_BLOCKDEV); - else if(S_ISFIFO(buf.st_mode)) return(OS_TYPE_FIFO); - else if(S_ISSOCK(buf.st_mode)) return(OS_TYPE_SOCK); + if(S_ISDIR(buf.ust_mode)) return(OS_TYPE_DIR); + else if(S_ISLNK(buf.ust_mode)) return(OS_TYPE_SYMLINK); + else if(S_ISCHR(buf.ust_mode)) return(OS_TYPE_CHARDEV); + else if(S_ISBLK(buf.ust_mode)) return(OS_TYPE_BLOCKDEV); + else if(S_ISFIFO(buf.ust_mode)) return(OS_TYPE_FIFO); + else if(S_ISSOCK(buf.ust_mode)) return(OS_TYPE_SOCK); else return(OS_TYPE_FILE); } @@ -362,7 +365,7 @@ int os_file_size(char *file, long long *size_out) return(err); } - if(S_ISBLK(buf.st_mode)){ + if(S_ISBLK(buf.ust_mode)){ int fd, blocks; fd = os_open_file(file, of_read(OPENFLAGS()), 0); @@ -381,7 +384,7 @@ int os_file_size(char *file, long long *size_out) os_close_file(fd); return(0); } - *size_out = buf.st_size; + *size_out = buf.ust_size; return(0); } |