blob: d72270b66d1119ead85eddaf4a2ca45d9bcc346a [file] [log] [blame]
Theodore Ts'o3839e651997-04-26 13:21:57 +00001/*
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 *
Theodore Ts'o543547a2010-05-17 21:31:56 -04008 * %Begin-Header%
9 * This file may be redistributed under the terms of the GNU Library
10 * General Public License, version 2.
11 * %End-Header%
Theodore Ts'o3839e651997-04-26 13:21:57 +000012 */
13
14/*
15 * History:
16 * 93/10/30 - Creation
17 */
18
Theodore Ts'o50e1e101997-04-26 13:58:21 +000019#if HAVE_ERRNO_H
Theodore Ts'o3839e651997-04-26 13:21:57 +000020#include <errno.h>
Theodore Ts'o50e1e101997-04-26 13:58:21 +000021#endif
Theodore Ts'o3839e651997-04-26 13:21:57 +000022#include <sys/ioctl.h>
23
Theodore Ts'o3839e651997-04-26 13:21:57 +000024#include "e2p.h"
25
26int setversion (int fd, unsigned long version)
27{
Theodore Ts'o50e1e101997-04-26 13:58:21 +000028#if HAVE_EXT2_IOCTLS
Theodore Ts'occe382b1998-03-09 13:07:09 +000029 int ver;
30
31 ver = (int) version;
32 return ioctl (fd, EXT2_IOC_SETVERSION, &ver);
Theodore Ts'o50e1e101997-04-26 13:58:21 +000033#else /* ! HAVE_EXT2_IOCTLS */
34 extern int errno;
35 errno = EOPNOTSUPP;
36 return -1;
37#endif /* ! HAVE_EXT2_IOCTLS */
Theodore Ts'o3839e651997-04-26 13:21:57 +000038}