]>
git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/unix/sysv/linux/alpha/xstatconv.c
1 /* Convert between the kernel's `struct stat' format, and libc's.
2 Copyright (C) 1997 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If not,
17 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
24 xstat_conv (int vers
, struct kernel_stat
*kbuf
, void *ubuf
)
28 case _STAT_VER_KERNEL
:
29 /* Nothing to do. The struct is in the form the kernel expects.
30 We should have short-circuted before we got here, but for
32 memcpy ((struct kernel_stat
*) ubuf
, kbuf
, sizeof (*kbuf
));
35 case _STAT_VER_GLIBC2
:
37 struct glibc2_stat
*buf
= ubuf
;
39 buf
->st_dev
= kbuf
->st_dev
;
40 buf
->st_ino
= kbuf
->st_ino
;
41 buf
->st_mode
= kbuf
->st_mode
;
42 buf
->st_nlink
= kbuf
->st_nlink
;
43 buf
->st_uid
= kbuf
->st_uid
;
44 buf
->st_gid
= kbuf
->st_gid
;
45 buf
->st_rdev
= kbuf
->st_rdev
;
46 buf
->st_size
= kbuf
->st_size
;
47 buf
->st_atime
= kbuf
->st_atime
;
48 buf
->st_mtime
= kbuf
->st_mtime
;
49 buf
->st_ctime
= kbuf
->st_ctime
;
50 buf
->st_blksize
= kbuf
->st_blksize
;
51 buf
->st_blocks
= kbuf
->st_blocks
;
52 buf
->st_flags
= kbuf
->st_flags
;
53 buf
->st_gen
= kbuf
->st_gen
;
57 case _STAT_VER_GLIBC2_1
:
59 struct stat64
*buf
= ubuf
;
61 buf
->st_dev
= kbuf
->st_dev
;
62 buf
->st_ino
= kbuf
->st_ino
;
63 buf
->st_mode
= kbuf
->st_mode
;
64 buf
->st_nlink
= kbuf
->st_nlink
;
65 buf
->st_uid
= kbuf
->st_uid
;
66 buf
->st_gid
= kbuf
->st_gid
;
67 buf
->st_rdev
= kbuf
->st_rdev
;
68 buf
->st_size
= kbuf
->st_size
;
69 buf
->st_atime
= kbuf
->st_atime
;
70 buf
->st_mtime
= kbuf
->st_mtime
;
71 buf
->st_ctime
= kbuf
->st_ctime
;
72 buf
->st_blocks
= kbuf
->st_blocks
;
73 buf
->st_blksize
= kbuf
->st_blksize
;
74 buf
->st_flags
= kbuf
->st_flags
;
75 buf
->st_gen
= kbuf
->st_gen
;