lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * setversion.c - Set 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 | * %Begin-Header% |
| 9 | * This file may be redistributed under the terms of the GNU Library |
| 10 | * General Public License, version 2. |
| 11 | * %End-Header% |
| 12 | */ |
| 13 | |
| 14 | /* |
| 15 | * History: |
| 16 | * 93/10/30 - Creation |
| 17 | */ |
| 18 | |
| 19 | #include "config.h" |
| 20 | #if HAVE_ERRNO_H |
| 21 | #include <errno.h> |
| 22 | #endif |
| 23 | #include <sys/ioctl.h> |
| 24 | |
| 25 | #include "e2p.h" |
| 26 | |
| 27 | int setversion (int fd, unsigned long version) |
| 28 | { |
| 29 | #if HAVE_EXT2_IOCTLS |
| 30 | int ver; |
| 31 | |
| 32 | ver = (int) version; |
| 33 | return ioctl (fd, EXT2_IOC_SETVERSION, &ver); |
| 34 | #else /* ! HAVE_EXT2_IOCTLS */ |
| 35 | extern int errno; |
| 36 | errno = EOPNOTSUPP; |
| 37 | return -1; |
| 38 | #endif /* ! HAVE_EXT2_IOCTLS */ |
| 39 | } |