]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/unix/sysv/linux/alpha/xstatconv.c
(__old_glob, __old_globfree): Add attribute_compat_text_section.
[thirdparty/glibc.git] / sysdeps / unix / sysv / linux / alpha / xstatconv.c
CommitLineData
05da9c9f 1/* Convert between the kernel's `struct stat' format, and libc's.
c27758e9 2 Copyright (C) 1997, 2003 Free Software Foundation, Inc.
05da9c9f
UD
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
3214b89b
AJ
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
05da9c9f
UD
9
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
3214b89b 13 Lesser General Public License for more details.
05da9c9f 14
3214b89b
AJ
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 02111-1307 USA. */
05da9c9f 19
c27758e9 20#include <errno.h>
05da9c9f 21#include <string.h>
c27758e9 22#include <sys/stat.h>
ebcd2cd1 23#include <kernel_stat.h>
c27758e9 24#include <xstatconv.h>
05da9c9f 25
c27758e9
UD
26
27int
28__xstat_conv (int vers, struct kernel_stat *kbuf, void *ubuf)
05da9c9f
UD
29{
30 switch (vers)
31 {
32 case _STAT_VER_KERNEL:
33 /* Nothing to do. The struct is in the form the kernel expects.
34 We should have short-circuted before we got here, but for
35 completeness... */
2645f7aa 36 *(struct kernel_stat *) ubuf = *kbuf;
05da9c9f
UD
37 break;
38
39 case _STAT_VER_GLIBC2:
40 {
41 struct glibc2_stat *buf = ubuf;
42
43 buf->st_dev = kbuf->st_dev;
44 buf->st_ino = kbuf->st_ino;
45 buf->st_mode = kbuf->st_mode;
46 buf->st_nlink = kbuf->st_nlink;
47 buf->st_uid = kbuf->st_uid;
48 buf->st_gid = kbuf->st_gid;
49 buf->st_rdev = kbuf->st_rdev;
50 buf->st_size = kbuf->st_size;
51 buf->st_atime = kbuf->st_atime;
52 buf->st_mtime = kbuf->st_mtime;
53 buf->st_ctime = kbuf->st_ctime;
54 buf->st_blksize = kbuf->st_blksize;
55 buf->st_blocks = kbuf->st_blocks;
56 buf->st_flags = kbuf->st_flags;
57 buf->st_gen = kbuf->st_gen;
58 }
59 break;
60
61 case _STAT_VER_GLIBC2_1:
62 {
63 struct stat64 *buf = ubuf;
64
65 buf->st_dev = kbuf->st_dev;
66 buf->st_ino = kbuf->st_ino;
67 buf->st_mode = kbuf->st_mode;
68 buf->st_nlink = kbuf->st_nlink;
69 buf->st_uid = kbuf->st_uid;
70 buf->st_gid = kbuf->st_gid;
71 buf->st_rdev = kbuf->st_rdev;
72 buf->st_size = kbuf->st_size;
73 buf->st_atime = kbuf->st_atime;
74 buf->st_mtime = kbuf->st_mtime;
75 buf->st_ctime = kbuf->st_ctime;
76 buf->st_blocks = kbuf->st_blocks;
77 buf->st_blksize = kbuf->st_blksize;
78 buf->st_flags = kbuf->st_flags;
79 buf->st_gen = kbuf->st_gen;
80 buf->__pad3 = 0;
81 buf->__unused[0] = 0;
82 buf->__unused[1] = 0;
83 buf->__unused[2] = 0;
84 buf->__unused[3] = 0;
85 }
86 break;
87
88 default:
89 __set_errno (EINVAL);
90 return -1;
91 }
92
93 return 0;
94}