2 * setflags.c - Set a file flags on an ext2 file system
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)
8 * This file can be redistributed under the terms of the GNU Library General
21 #include <sys/types.h>
22 #include <sys/stat.h> /* For the flag values. */
24 #include <sys/ioctl.h>
29 int setflags (int fd, unsigned long flags)
32 unsigned long bsd_flags = 0;
35 if (flags & EXT2_IMMUTABLE_FL)
36 bsd_flags |= UF_IMMUTABLE;
39 if (flags & EXT2_APPEND_FL)
40 bsd_flags |= UF_APPEND;
43 if (flags & EXT2_NODUMP_FL)
44 bsd_flags |= UF_NODUMP;
47 return fchflags (fd, bsd_flags);
50 return ioctl (fd, EXT2_IOC_SETFLAGS, &flags);
51 #else /* ! HAVE_EXT2_IOCTLS */
55 #endif /* ! HAVE_EXT2_IOCTLS */