import lsattr and chattr from e2fsprogs
[oweals/busybox.git] / util-linux / e2p / getversion.c
1 /*
2  * getversion.c         - Get a file version on an ext2 file system
3  *
4  * Copyright (C) 1993, 1994  Remy Card <card@masi.ibp.fr>
5  *                           Laboratoire MASI, Institut Blaise Pascal
6  *                           Universite Pierre et Marie Curie (Paris VI)
7  *
8  * This file can be redistributed under the terms of the GNU Library General
9  * Public License
10  */
11
12 /*
13  * History:
14  * 93/10/30     - Creation
15  */
16
17 #if HAVE_ERRNO_H
18 #include <errno.h>
19 #endif
20 #include <sys/ioctl.h>
21
22 #include "e2p.h"
23
24 int getversion (int fd, unsigned long * version)
25 {
26 #if HAVE_EXT2_IOCTLS
27         int     r, ver;
28         
29         r = ioctl (fd, EXT2_IOC_GETVERSION, &ver);
30         *version = ver;
31         return 0;
32 #else /* ! HAVE_EXT2_IOCTLS */
33         extern int errno;
34         errno = EOPNOTSUPP;
35         return -1;
36 #endif /* ! HAVE_EXT2_IOCTLS */
37 }